mirror of
https://github.com/jiangteng2019/satellite-track.git
synced 2025-06-17 07:18:18 +00:00
13932 lines
3.5 MiB
13932 lines
3.5 MiB
var qne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eht=qne((ff,hf)=>{(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerpolicy&&(r.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?r.credentials="include":o.crossorigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=n(o);fetch(o.href,r)}})();function aN(e,t){const n=Object.create(null),i=e.split(",");for(let o=0;o<i.length;o++)n[i[o]]=!0;return t?o=>!!n[o.toLowerCase()]:o=>!!n[o]}function Ds(e){if(Yt(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=_i(i)?Kne(i):Ds(i);if(o)for(const r in o)t[r]=o[r]}return t}else{if(_i(e))return e;if(Di(e))return e}}const $ne=/;(?![^(]*\))/g,Yne=/:([^]+)/,Xne=/\/\*.*?\*\//gs;function Kne(e){const t={};return e.replace(Xne,"").split($ne).forEach(n=>{if(n){const i=n.split(Yne);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function st(e){let t="";if(_i(e))t=e;else if(Yt(e))for(let n=0;n<e.length;n++){const i=st(e[n]);i&&(t+=i+" ")}else if(Di(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Jne="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Qne=aN(Jne);function w6(e){return!!e||e===""}function Zne(e,t){if(e.length!==t.length)return!1;let n=!0;for(let i=0;n&&i<e.length;i++)n=Rv(e[i],t[i]);return n}function Rv(e,t){if(e===t)return!0;let n=jF(e),i=jF(t);if(n||i)return n&&i?e.getTime()===t.getTime():!1;if(n=eC(e),i=eC(t),n||i)return e===t;if(n=Yt(e),i=Yt(t),n||i)return n&&i?Zne(e,t):!1;if(n=Di(e),i=Di(t),n||i){if(!n||!i)return!1;const o=Object.keys(e).length,r=Object.keys(t).length;if(o!==r)return!1;for(const s in e){const a=e.hasOwnProperty(s),c=t.hasOwnProperty(s);if(a&&!c||!a&&c||!Rv(e[s],t[s]))return!1}}return String(e)===String(t)}function S6(e,t){return e.findIndex(n=>Rv(n,t))}const Pr=e=>_i(e)?e:e==null?"":Yt(e)||Di(e)&&(e.toString===I6||!En(e.toString))?JSON.stringify(e,v6,2):String(e),v6=(e,t)=>t&&t.__v_isRef?v6(e,t.value):Py(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[i,o])=>(n[`${i} =>`]=o,n),{})}:Mv(t)?{[`Set(${t.size})`]:[...t.values()]}:Di(t)&&!Yt(t)&&!P6(t)?String(t):t,Eo={},Iy=[],Bi=()=>{},eie=()=>!1,tie=/^on[^a-z]/,Nv=e=>tie.test(e),cN=e=>e.startsWith("onUpdate:"),gs=Object.assign,lN=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},nie=Object.prototype.hasOwnProperty,oi=(e,t)=>nie.call(e,t),Yt=Array.isArray,Py=e=>rT(e)==="[object Map]",Mv=e=>rT(e)==="[object Set]",jF=e=>rT(e)==="[object Date]",En=e=>typeof e=="function",_i=e=>typeof e=="string",eC=e=>typeof e=="symbol",Di=e=>e!==null&&typeof e=="object",D6=e=>Di(e)&&En(e.then)&&En(e.catch),I6=Object.prototype.toString,rT=e=>I6.call(e),iie=e=>rT(e).slice(8,-1),P6=e=>rT(e)==="[object Object]",uN=e=>_i(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,xw=aN(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fv=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},oie=/-(\w)/g,lu=Fv(e=>e.replace(oie,(t,n)=>n?n.toUpperCase():"")),rie=/\B([A-Z])/g,G_=Fv(e=>e.replace(rie,"-$1").toLowerCase()),zv=Fv(e=>e.charAt(0).toUpperCase()+e.slice(1)),PI=Fv(e=>e?`on${zv(e)}`:""),tC=(e,t)=>!Object.is(e,t),ww=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},bS=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},dN=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let qF;const sie=()=>qF||(qF=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let tc;class O6{constructor(t=!1){this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=tc,!t&&tc&&(this.index=(tc.scopes||(tc.scopes=[])).push(this)-1)}run(t){if(this.active){const n=tc;try{return tc=this,t()}finally{tc=n}}}on(){tc=this}off(){tc=this.parent}stop(t){if(this.active){let n,i;for(n=0,i=this.effects.length;n<i;n++)this.effects[n].stop();for(n=0,i=this.cleanups.length;n<i;n++)this.cleanups[n]();if(this.scopes)for(n=0,i=this.scopes.length;n<i;n++)this.scopes[n].stop(!0);if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0,this.active=!1}}}function aie(e){return new O6(e)}function cie(e,t=tc){t&&t.active&&t.effects.push(e)}function lie(){return tc}function L6(e){tc&&tc.cleanups.push(e)}const fN=e=>{const t=new Set(e);return t.w=0,t.n=0,t},B6=e=>(e.w&Tp)>0,R6=e=>(e.n&Tp)>0,uie=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=Tp},die=e=>{const{deps:t}=e;if(t.length){let n=0;for(let i=0;i<t.length;i++){const o=t[i];B6(o)&&!R6(o)?o.delete(e):t[n++]=o,o.w&=~Tp,o.n&=~Tp}t.length=n}},SL=new WeakMap;let ib=0,Tp=1;const vL=30;let ql;const a_=Symbol(""),DL=Symbol("");class hN{constructor(t,n=null,i){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,cie(this,i)}run(){if(!this.active)return this.fn();let t=ql,n=sp;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=ql,ql=this,sp=!0,Tp=1<<++ib,ib<=vL?uie(this):$F(this),this.fn()}finally{ib<=vL&&die(this),Tp=1<<--ib,ql=this.parent,sp=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){ql===this?this.deferStop=!0:this.active&&($F(this),this.onStop&&this.onStop(),this.active=!1)}}function $F(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let sp=!0;const N6=[];function x0(){N6.push(sp),sp=!1}function w0(){const e=N6.pop();sp=e===void 0?!0:e}function bc(e,t,n){if(sp&&ql){let i=SL.get(e);i||SL.set(e,i=new Map);let o=i.get(n);o||i.set(n,o=fN()),M6(o)}}function M6(e,t){let n=!1;ib<=vL?R6(e)||(e.n|=Tp,n=!B6(e)):n=!e.has(ql),n&&(e.add(ql),ql.deps.push(e))}function vf(e,t,n,i,o,r){const s=SL.get(e);if(!s)return;let a=[];if(t==="clear")a=[...s.values()];else if(n==="length"&&Yt(e)){const c=dN(i);s.forEach((u,d)=>{(d==="length"||d>=c)&&a.push(u)})}else switch(n!==void 0&&a.push(s.get(n)),t){case"add":Yt(e)?uN(n)&&a.push(s.get("length")):(a.push(s.get(a_)),Py(e)&&a.push(s.get(DL)));break;case"delete":Yt(e)||(a.push(s.get(a_)),Py(e)&&a.push(s.get(DL)));break;case"set":Py(e)&&a.push(s.get(a_));break}if(a.length===1)a[0]&&IL(a[0]);else{const c=[];for(const u of a)u&&c.push(...u);IL(fN(c))}}function IL(e,t){const n=Yt(e)?e:[...e];for(const i of n)i.computed&&YF(i);for(const i of n)i.computed||YF(i)}function YF(e,t){(e!==ql||e.allowRecurse)&&(e.scheduler?e.scheduler():e.run())}const fie=aN("__proto__,__v_isRef,__isVue"),F6=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(eC)),hie=pN(),pie=pN(!1,!0),mie=pN(!0),XF=_ie();function _ie(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const i=Ci(this);for(let r=0,s=this.length;r<s;r++)bc(i,"get",r+"");const o=i[t](...n);return o===-1||o===!1?i[t](...n.map(Ci)):o}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){x0();const i=Ci(this)[t].apply(this,n);return w0(),i}}),e}function pN(e=!1,t=!1){return function(i,o,r){if(o==="__v_isReactive")return!e;if(o==="__v_isReadonly")return e;if(o==="__v_isShallow")return t;if(o==="__v_raw"&&r===(e?t?Lie:k6:t?V6:H6).get(i))return i;const s=Yt(i);if(!e&&s&&oi(XF,o))return Reflect.get(XF,o,r);const a=Reflect.get(i,o,r);return(eC(o)?F6.has(o):fie(o))||(e||bc(i,"get",o),t)?a:So(a)?s&&uN(o)?a:a.value:Di(a)?e?W6(a):W_(a):a}}const gie=z6(),yie=z6(!0);function z6(e=!1){return function(n,i,o,r){let s=n[i];if(Zy(s)&&So(s)&&!So(o))return!1;if(!e&&(!CS(o)&&!Zy(o)&&(s=Ci(s),o=Ci(o)),!Yt(n)&&So(s)&&!So(o)))return s.value=o,!0;const a=Yt(n)&&uN(i)?Number(i)<n.length:oi(n,i),c=Reflect.set(n,i,o,r);return n===Ci(r)&&(a?tC(o,s)&&vf(n,"set",i,o):vf(n,"add",i,o)),c}}function Aie(e,t){const n=oi(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&n&&vf(e,"delete",t,void 0),i}function bie(e,t){const n=Reflect.has(e,t);return(!eC(t)||!F6.has(t))&&bc(e,"has",t),n}function Cie(e){return bc(e,"iterate",Yt(e)?"length":a_),Reflect.ownKeys(e)}const U6={get:hie,set:gie,deleteProperty:Aie,has:bie,ownKeys:Cie},Tie={get:mie,set(e,t){return!0},deleteProperty(e,t){return!0}},Eie=gs({},U6,{get:pie,set:yie}),mN=e=>e,Uv=e=>Reflect.getPrototypeOf(e);function rE(e,t,n=!1,i=!1){e=e.__v_raw;const o=Ci(e),r=Ci(t);n||(t!==r&&bc(o,"get",t),bc(o,"get",r));const{has:s}=Uv(o),a=i?mN:n?AN:nC;if(s.call(o,t))return a(e.get(t));if(s.call(o,r))return a(e.get(r));e!==o&&e.get(t)}function sE(e,t=!1){const n=this.__v_raw,i=Ci(n),o=Ci(e);return t||(e!==o&&bc(i,"has",e),bc(i,"has",o)),e===o?n.has(e):n.has(e)||n.has(o)}function aE(e,t=!1){return e=e.__v_raw,!t&&bc(Ci(e),"iterate",a_),Reflect.get(e,"size",e)}function KF(e){e=Ci(e);const t=Ci(this);return Uv(t).has.call(t,e)||(t.add(e),vf(t,"add",e,e)),this}function JF(e,t){t=Ci(t);const n=Ci(this),{has:i,get:o}=Uv(n);let r=i.call(n,e);r||(e=Ci(e),r=i.call(n,e));const s=o.call(n,e);return n.set(e,t),r?tC(t,s)&&vf(n,"set",e,t):vf(n,"add",e,t),this}function QF(e){const t=Ci(this),{has:n,get:i}=Uv(t);let o=n.call(t,e);o||(e=Ci(e),o=n.call(t,e)),i&&i.call(t,e);const r=t.delete(e);return o&&vf(t,"delete",e,void 0),r}function ZF(){const e=Ci(this),t=e.size!==0,n=e.clear();return t&&vf(e,"clear",void 0,void 0),n}function cE(e,t){return function(i,o){const r=this,s=r.__v_raw,a=Ci(s),c=t?mN:e?AN:nC;return!e&&bc(a,"iterate",a_),s.forEach((u,d)=>i.call(o,c(u),c(d),r))}}function lE(e,t,n){return function(...i){const o=this.__v_raw,r=Ci(o),s=Py(r),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,u=o[e](...i),d=n?mN:t?AN:nC;return!t&&bc(r,"iterate",c?DL:a_),{next(){const{value:h,done:m}=u.next();return m?{value:h,done:m}:{value:a?[d(h[0]),d(h[1])]:d(h),done:m}},[Symbol.iterator](){return this}}}}function dh(e){return function(...t){return e==="delete"?!1:this}}function xie(){const e={get(r){return rE(this,r)},get size(){return aE(this)},has:sE,add:KF,set:JF,delete:QF,clear:ZF,forEach:cE(!1,!1)},t={get(r){return rE(this,r,!1,!0)},get size(){return aE(this)},has:sE,add:KF,set:JF,delete:QF,clear:ZF,forEach:cE(!1,!0)},n={get(r){return rE(this,r,!0)},get size(){return aE(this,!0)},has(r){return sE.call(this,r,!0)},add:dh("add"),set:dh("set"),delete:dh("delete"),clear:dh("clear"),forEach:cE(!0,!1)},i={get(r){return rE(this,r,!0,!0)},get size(){return aE(this,!0)},has(r){return sE.call(this,r,!0)},add:dh("add"),set:dh("set"),delete:dh("delete"),clear:dh("clear"),forEach:cE(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=lE(r,!1,!1),n[r]=lE(r,!0,!1),t[r]=lE(r,!1,!0),i[r]=lE(r,!0,!0)}),[e,n,t,i]}const[wie,Sie,vie,Die]=xie();function _N(e,t){const n=t?e?Die:vie:e?Sie:wie;return(i,o,r)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?i:Reflect.get(oi(n,o)&&o in i?n:i,o,r)}const Iie={get:_N(!1,!1)},Pie={get:_N(!1,!0)},Oie={get:_N(!0,!1)},H6=new WeakMap,V6=new WeakMap,k6=new WeakMap,Lie=new WeakMap;function Bie(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Rie(e){return e.__v_skip||!Object.isExtensible(e)?0:Bie(iie(e))}function W_(e){return Zy(e)?e:gN(e,!1,U6,Iie,H6)}function G6(e){return gN(e,!1,Eie,Pie,V6)}function W6(e){return gN(e,!0,Tie,Oie,k6)}function gN(e,t,n,i,o){if(!Di(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const r=o.get(e);if(r)return r;const s=Rie(e);if(s===0)return e;const a=new Proxy(e,s===2?i:n);return o.set(e,a),a}function Oy(e){return Zy(e)?Oy(e.__v_raw):!!(e&&e.__v_isReactive)}function Zy(e){return!!(e&&e.__v_isReadonly)}function CS(e){return!!(e&&e.__v_isShallow)}function j6(e){return Oy(e)||Zy(e)}function Ci(e){const t=e&&e.__v_raw;return t?Ci(t):e}function yN(e){return bS(e,"__v_skip",!0),e}const nC=e=>Di(e)?W_(e):e,AN=e=>Di(e)?W6(e):e;function q6(e){sp&&ql&&(e=Ci(e),M6(e.dep||(e.dep=fN())))}function $6(e,t){e=Ci(e),e.dep&&IL(e.dep)}function So(e){return!!(e&&e.__v_isRef===!0)}function bn(e){return Y6(e,!1)}function c_(e){return Y6(e,!0)}function Y6(e,t){return So(e)?e:new Nie(e,t)}class Nie{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:Ci(t),this._value=n?t:nC(t)}get value(){return q6(this),this._value}set value(t){const n=this.__v_isShallow||CS(t)||Zy(t);t=n?t:Ci(t),tC(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:nC(t),$6(this))}}function pe(e){return So(e)?e.value:e}const Mie={get:(e,t,n)=>pe(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return So(o)&&!So(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function X6(e){return Oy(e)?e:new Proxy(e,Mie)}function K6(e){const t=Yt(e)?new Array(e.length):{};for(const n in e)t[n]=e0(e,n);return t}class Fie{constructor(t,n,i){this._object=t,this._key=n,this._defaultValue=i,this.__v_isRef=!0}get value(){const t=this._object[this._key];return t===void 0?this._defaultValue:t}set value(t){this._object[this._key]=t}}function e0(e,t,n){const i=e[t];return So(i)?i:new Fie(e,t,n)}var J6;class zie{constructor(t,n,i,o){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[J6]=!1,this._dirty=!0,this.effect=new hN(t,()=>{this._dirty||(this._dirty=!0,$6(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!o,this.__v_isReadonly=i}get value(){const t=Ci(this);return q6(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}J6="__v_isReadonly";function Q6(e,t,n=!1){let i,o;const r=En(e);return r?(i=e,o=Bi):(i=e.get,o=e.set),new zie(i,o,r||!o,n)}function Uie(e,...t){}function ap(e,t,n,i){let o;try{o=i?e(...i):e()}catch(r){Hv(r,t,n)}return o}function cl(e,t,n,i){if(En(e)){const r=ap(e,t,n,i);return r&&D6(r)&&r.catch(s=>{Hv(s,t,n)}),r}const o=[];for(let r=0;r<e.length;r++)o.push(cl(e[r],t,n,i));return o}function Hv(e,t,n,i=!0){const o=t?t.vnode:null;if(t){let r=t.parent;const s=t.proxy,a=n;for(;r;){const u=r.ec;if(u){for(let d=0;d<u.length;d++)if(u[d](e,s,a)===!1)return}r=r.parent}const c=t.appContext.config.errorHandler;if(c){ap(c,null,10,[e,s,a]);return}}Hie(e,n,o,i)}function Hie(e,t,n,i=!0){console.error(e)}let iC=!1,PL=!1;const Qs=[];let Ku=0;const Ly=[];let Kd=null,Gm=0;const Z6=Promise.resolve();let bN=null;function us(e){const t=bN||Z6;return e?t.then(this?e.bind(this):e):t}function Vie(e){let t=Ku+1,n=Qs.length;for(;t<n;){const i=t+n>>>1;oC(Qs[i])<e?t=i+1:n=i}return t}function CN(e){(!Qs.length||!Qs.includes(e,iC&&e.allowRecurse?Ku+1:Ku))&&(e.id==null?Qs.push(e):Qs.splice(Vie(e.id),0,e),e9())}function e9(){!iC&&!PL&&(PL=!0,bN=Z6.then(n9))}function kie(e){const t=Qs.indexOf(e);t>Ku&&Qs.splice(t,1)}function Gie(e){Yt(e)?Ly.push(...e):(!Kd||!Kd.includes(e,e.allowRecurse?Gm+1:Gm))&&Ly.push(e),e9()}function e3(e,t=iC?Ku+1:0){for(;t<Qs.length;t++){const n=Qs[t];n&&n.pre&&(Qs.splice(t,1),t--,n())}}function t9(e){if(Ly.length){const t=[...new Set(Ly)];if(Ly.length=0,Kd){Kd.push(...t);return}for(Kd=t,Kd.sort((n,i)=>oC(n)-oC(i)),Gm=0;Gm<Kd.length;Gm++)Kd[Gm]();Kd=null,Gm=0}}const oC=e=>e.id==null?1/0:e.id,Wie=(e,t)=>{const n=oC(e)-oC(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function n9(e){PL=!1,iC=!0,Qs.sort(Wie);const t=Bi;try{for(Ku=0;Ku<Qs.length;Ku++){const n=Qs[Ku];n&&n.active!==!1&&ap(n,null,14)}}finally{Ku=0,Qs.length=0,t9(),iC=!1,bN=null,(Qs.length||Ly.length)&&n9()}}function jie(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||Eo;let o=n;const r=t.startsWith("update:"),s=r&&t.slice(7);if(s&&s in i){const d=`${s==="modelValue"?"model":s}Modifiers`,{number:h,trim:m}=i[d]||Eo;m&&(o=n.map(g=>_i(g)?g.trim():g)),h&&(o=n.map(dN))}let a,c=i[a=PI(t)]||i[a=PI(lu(t))];!c&&r&&(c=i[a=PI(G_(t))]),c&&cl(c,e,6,o);const u=i[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,cl(u,e,6,o)}}function i9(e,t,n=!1){const i=t.emitsCache,o=i.get(e);if(o!==void 0)return o;const r=e.emits;let s={},a=!1;if(!En(e)){const c=u=>{const d=i9(u,t,!0);d&&(a=!0,gs(s,d))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!r&&!a?(Di(e)&&i.set(e,null),null):(Yt(r)?r.forEach(c=>s[c]=null):gs(s,r),Di(e)&&i.set(e,s),s)}function Vv(e,t){return!e||!Nv(t)?!1:(t=t.slice(2).replace(/Once$/,""),oi(e,t[0].toLowerCase()+t.slice(1))||oi(e,G_(t))||oi(e,t))}let Os=null,o9=null;function TS(e){const t=Os;return Os=e,o9=e&&e.type.__scopeId||null,t}function an(e,t=Os,n){if(!t||e._n)return e;const i=(...o)=>{i._d&&f3(-1);const r=TS(t);let s;try{s=e(...o)}finally{TS(r),i._d&&f3(1)}return s};return i._n=!0,i._c=!0,i._d=!0,i}function OI(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:r,propsOptions:[s],slots:a,attrs:c,emit:u,render:d,renderCache:h,data:m,setupState:g,ctx:p,inheritAttrs:y}=e;let b,C;const E=TS(e);try{if(n.shapeFlag&4){const S=o||i;b=ju(d.call(S,S,h,r,g,m,p)),C=c}else{const S=t;b=ju(S.length>1?S(r,{attrs:c,slots:a,emit:u}):S(r,null)),C=t.props?c:qie(c)}}catch(S){Db.length=0,Hv(S,e,1),b=fn(ll)}let w=b;if(C&&y!==!1){const S=Object.keys(C),{shapeFlag:P}=w;S.length&&P&7&&(s&&S.some(cN)&&(C=$ie(C,s)),w=xp(w,C))}return n.dirs&&(w=xp(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),b=w,TS(E),b}const qie=e=>{let t;for(const n in e)(n==="class"||n==="style"||Nv(n))&&((t||(t={}))[n]=e[n]);return t},$ie=(e,t)=>{const n={};for(const i in e)(!cN(i)||!(i.slice(9)in t))&&(n[i]=e[i]);return n};function Yie(e,t,n){const{props:i,children:o,component:r}=e,{props:s,children:a,patchFlag:c}=t,u=r.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return i?t3(i,s,u):!!s;if(c&8){const d=t.dynamicProps;for(let h=0;h<d.length;h++){const m=d[h];if(s[m]!==i[m]&&!Vv(u,m))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:i===s?!1:i?s?t3(i,s,u):!0:!!s;return!1}function t3(e,t,n){const i=Object.keys(t);if(i.length!==Object.keys(e).length)return!0;for(let o=0;o<i.length;o++){const r=i[o];if(t[r]!==e[r]&&!Vv(n,r))return!0}return!1}function Xie({vnode:e,parent:t},n){for(;t&&t.subTree===e;)(e=t.vnode).el=n,t=t.parent}const Kie=e=>e.__isSuspense;function Jie(e,t){t&&t.pendingBranch?Yt(e)?t.effects.push(...e):t.effects.push(e):Gie(e)}function nd(e,t){if(ds){let n=ds.provides;const i=ds.parent&&ds.parent.provides;i===n&&(n=ds.provides=Object.create(i)),n[e]=t}}function er(e,t,n=!1){const i=ds||Os;if(i){const o=i.parent==null?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides;if(o&&e in o)return o[e];if(arguments.length>1)return n&&En(t)?t.call(i.proxy):t}}function Qie(e,t){return TN(e,null,t)}const uE={};function to(e,t,n){return TN(e,t,n)}function TN(e,t,{immediate:n,deep:i,flush:o,onTrack:r,onTrigger:s}=Eo){const a=ds;let c,u=!1,d=!1;if(So(e)?(c=()=>e.value,u=CS(e)):Oy(e)?(c=()=>e,i=!0):Yt(e)?(d=!0,u=e.some(w=>Oy(w)||CS(w)),c=()=>e.map(w=>{if(So(w))return w.value;if(Oy(w))return Qm(w);if(En(w))return ap(w,a,2)})):En(e)?t?c=()=>ap(e,a,2):c=()=>{if(!(a&&a.isUnmounted))return h&&h(),cl(e,a,3,[m])}:c=Bi,t&&i){const w=c;c=()=>Qm(w())}let h,m=w=>{h=C.onStop=()=>{ap(w,a,4)}},g;if(cC)if(m=Bi,t?n&&cl(t,a,3,[c(),d?[]:void 0,m]):c(),o==="sync"){const w=Goe();g=w.__watcherHandles||(w.__watcherHandles=[])}else return Bi;let p=d?new Array(e.length).fill(uE):uE;const y=()=>{if(C.active)if(t){const w=C.run();(i||u||(d?w.some((S,P)=>tC(S,p[P])):tC(w,p)))&&(h&&h(),cl(t,a,3,[w,p===uE?void 0:d&&p[0]===uE?[]:p,m]),p=w)}else C.run()};y.allowRecurse=!!t;let b;o==="sync"?b=y:o==="post"?b=()=>Wa(y,a&&a.suspense):(y.pre=!0,a&&(y.id=a.uid),b=()=>CN(y));const C=new hN(c,b);t?n?y():p=C.run():o==="post"?Wa(C.run.bind(C),a&&a.suspense):C.run();const E=()=>{C.stop(),a&&a.scope&&lN(a.scope.effects,C)};return g&&g.push(E),E}function Zie(e,t,n){const i=this.proxy,o=_i(e)?e.includes(".")?r9(i,e):()=>i[e]:e.bind(i,i);let r;En(t)?r=t:(r=t.handler,n=t);const s=ds;t0(this);const a=TN(o,r.bind(i),n);return s?t0(s):l_(),a}function r9(e,t){const n=t.split(".");return()=>{let i=e;for(let o=0;o<n.length&&i;o++)i=i[n[o]];return i}}function Qm(e,t){if(!Di(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),So(e))Qm(e.value,t);else if(Yt(e))for(let n=0;n<e.length;n++)Qm(e[n],t);else if(Mv(e)||Py(e))e.forEach(n=>{Qm(n,t)});else if(P6(e))for(const n in e)Qm(e[n],t);return e}function s9(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Oc(()=>{e.isMounted=!0}),Wp(()=>{e.isUnmounting=!0}),e}const zc=[Function,Array],eoe={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:zc,onEnter:zc,onAfterEnter:zc,onEnterCancelled:zc,onBeforeLeave:zc,onLeave:zc,onAfterLeave:zc,onLeaveCancelled:zc,onBeforeAppear:zc,onAppear:zc,onAfterAppear:zc,onAppearCancelled:zc},setup(e,{slots:t}){const n=Lc(),i=s9();let o;return()=>{const r=t.default&&EN(t.default(),!0);if(!r||!r.length)return;let s=r[0];if(r.length>1){for(const y of r)if(y.type!==ll){s=y;break}}const a=Ci(e),{mode:c}=a;if(i.isLeaving)return LI(s);const u=n3(s);if(!u)return LI(s);const d=rC(u,a,i,n);sC(u,d);const h=n.subTree,m=h&&n3(h);let g=!1;const{getTransitionKey:p}=u.type;if(p){const y=p();o===void 0?o=y:y!==o&&(o=y,g=!0)}if(m&&m.type!==ll&&(!Wm(u,m)||g)){const y=rC(m,a,i,n);if(sC(m,y),c==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update.active!==!1&&n.update()},LI(s);c==="in-out"&&u.type!==ll&&(y.delayLeave=(b,C,E)=>{const w=c9(i,m);w[String(m.key)]=m,b._leaveCb=()=>{C(),b._leaveCb=void 0,delete d.delayedLeave},d.delayedLeave=E})}return s}}},a9=eoe;function c9(e,t){const{leavingVNodes:n}=e;let i=n.get(t.type);return i||(i=Object.create(null),n.set(t.type,i)),i}function rC(e,t,n,i){const{appear:o,mode:r,persisted:s=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:h,onLeave:m,onAfterLeave:g,onLeaveCancelled:p,onBeforeAppear:y,onAppear:b,onAfterAppear:C,onAppearCancelled:E}=t,w=String(e.key),S=c9(n,e),P=(R,F)=>{R&&cl(R,i,9,F)},L=(R,F)=>{const U=F[1];P(R,F),Yt(R)?R.every(D=>D.length<=1)&&U():R.length<=1&&U()},z={mode:r,persisted:s,beforeEnter(R){let F=a;if(!n.isMounted)if(o)F=y||a;else return;R._leaveCb&&R._leaveCb(!0);const U=S[w];U&&Wm(e,U)&&U.el._leaveCb&&U.el._leaveCb(),P(F,[R])},enter(R){let F=c,U=u,D=d;if(!n.isMounted)if(o)F=b||c,U=C||u,D=E||d;else return;let I=!1;const _=R._enterCb=v=>{I||(I=!0,v?P(D,[R]):P(U,[R]),z.delayedLeave&&z.delayedLeave(),R._enterCb=void 0)};F?L(F,[R,_]):_()},leave(R,F){const U=String(e.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return F();P(h,[R]);let D=!1;const I=R._leaveCb=_=>{D||(D=!0,F(),_?P(p,[R]):P(g,[R]),R._leaveCb=void 0,S[U]===e&&delete S[U])};S[U]=e,m?L(m,[R,I]):I()},clone(R){return rC(R,t,n,i)}};return z}function LI(e){if(kv(e))return e=xp(e),e.children=null,e}function n3(e){return kv(e)?e.children?e.children[0]:void 0:e}function sC(e,t){e.shapeFlag&6&&e.component?sC(e.component.subTree,t):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function EN(e,t=!1,n){let i=[],o=0;for(let r=0;r<e.length;r++){let s=e[r];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:r);s.type===Jo?(s.patchFlag&128&&o++,i=i.concat(EN(s.children,t,a))):(t||s.type!==ll)&&i.push(a!=null?xp(s,{key:a}):s)}if(o>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function ci(e){return En(e)?{setup:e,name:e.name}:e}const wb=e=>!!e.type.__asyncLoader,kv=e=>e.type.__isKeepAlive;function toe(e,t){l9(e,"a",t)}function noe(e,t){l9(e,"da",t)}function l9(e,t,n=ds){const i=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Gv(t,i,n),n){let o=n.parent;for(;o&&o.parent;)kv(o.parent.vnode)&&ioe(i,t,n,o),o=o.parent}}function ioe(e,t,n,i){const o=Gv(t,e,i,!0);xN(()=>{lN(i[t],o)},n)}function Gv(e,t,n=ds,i=!1){if(n){const o=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...s)=>{if(n.isUnmounted)return;x0(),t0(n);const a=cl(t,n,e,s);return l_(),w0(),a});return i?o.unshift(r):o.push(r),r}}const Hf=e=>(t,n=ds)=>(!cC||e==="sp")&&Gv(e,(...i)=>t(...i),n),ooe=Hf("bm"),Oc=Hf("m"),roe=Hf("bu"),u9=Hf("u"),Wp=Hf("bum"),xN=Hf("um"),soe=Hf("sp"),aoe=Hf("rtg"),coe=Hf("rtc");function loe(e,t=ds){Gv("ec",e,t)}function eu(e,t){const n=Os;if(n===null)return e;const i=jv(n)||n.proxy,o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[s,a,c,u=Eo]=t[r];s&&(En(s)&&(s={mounted:s,updated:s}),s.deep&&Qm(a),o.push({dir:s,instance:i,value:a,oldValue:void 0,arg:c,modifiers:u}))}return e}function um(e,t,n,i){const o=e.dirs,r=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];r&&(a.oldValue=r[s].value);let c=a.dir[i];c&&(x0(),cl(c,n,8,[e.el,a,e,t]),w0())}}const wN="components";function Wu(e,t){return f9(wN,e,!0,t)||e}const d9=Symbol();function Ia(e){return _i(e)?f9(wN,e,!1)||e:e||d9}function f9(e,t,n=!0,i=!1){const o=Os||ds;if(o){const r=o.type;if(e===wN){const a=Uoe(r,!1);if(a&&(a===t||a===lu(t)||a===zv(lu(t))))return r}const s=i3(o[e]||r[e],t)||i3(o.appContext[e],t);return!s&&i?r:s}}function i3(e,t){return e&&(e[t]||e[lu(t)]||e[zv(lu(t))])}function h9(e,t,n,i){let o;const r=n&&n[i];if(Yt(e)||_i(e)){o=new Array(e.length);for(let s=0,a=e.length;s<a;s++)o[s]=t(e[s],s,void 0,r&&r[s])}else if(typeof e=="number"){o=new Array(e);for(let s=0;s<e;s++)o[s]=t(s+1,s,void 0,r&&r[s])}else if(Di(e))if(e[Symbol.iterator])o=Array.from(e,(s,a)=>t(s,a,void 0,r&&r[a]));else{const s=Object.keys(e);o=new Array(s.length);for(let a=0,c=s.length;a<c;a++){const u=s[a];o[a]=t(e[u],u,a,r&&r[a])}}else o=[];return n&&(n[i]=o),o}function o3(e,t){for(let n=0;n<t.length;n++){const i=t[n];if(Yt(i))for(let o=0;o<i.length;o++)e[i[o].name]=i[o].fn;else i&&(e[i.name]=i.key?(...o)=>{const r=i.fn(...o);return r&&(r.key=i.key),r}:i.fn)}return e}function Zn(e,t,n={},i,o){if(Os.isCE||Os.parent&&wb(Os.parent)&&Os.parent.isCE)return t!=="default"&&(n.name=t),fn("slot",n,i&&i());let r=e[t];r&&r._c&&(r._d=!1),qe();const s=r&&p9(r(n)),a=Dn(Jo,{key:n.key||s&&s.key||`_${t}`},s||(i?i():[]),s&&e._===1?64:-2);return!o&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),r&&r._c&&(r._d=!0),a}function p9(e){return e.some(t=>Ep(t)?!(t.type===ll||t.type===Jo&&!p9(t.children)):!0)?e:null}const OL=e=>e?w9(e)?jv(e)||e.proxy:OL(e.parent):null,Sb=gs(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>OL(e.parent),$root:e=>OL(e.root),$emit:e=>e.emit,$options:e=>SN(e),$forceUpdate:e=>e.f||(e.f=()=>CN(e.update)),$nextTick:e=>e.n||(e.n=us.bind(e.proxy)),$watch:e=>Zie.bind(e)}),BI=(e,t)=>e!==Eo&&!e.__isScriptSetup&&oi(e,t),uoe={get({_:e},t){const{ctx:n,setupState:i,data:o,props:r,accessCache:s,type:a,appContext:c}=e;let u;if(t[0]!=="$"){const g=s[t];if(g!==void 0)switch(g){case 1:return i[t];case 2:return o[t];case 4:return n[t];case 3:return r[t]}else{if(BI(i,t))return s[t]=1,i[t];if(o!==Eo&&oi(o,t))return s[t]=2,o[t];if((u=e.propsOptions[0])&&oi(u,t))return s[t]=3,r[t];if(n!==Eo&&oi(n,t))return s[t]=4,n[t];LL&&(s[t]=0)}}const d=Sb[t];let h,m;if(d)return t==="$attrs"&&bc(e,"get",t),d(e);if((h=a.__cssModules)&&(h=h[t]))return h;if(n!==Eo&&oi(n,t))return s[t]=4,n[t];if(m=c.config.globalProperties,oi(m,t))return m[t]},set({_:e},t,n){const{data:i,setupState:o,ctx:r}=e;return BI(o,t)?(o[t]=n,!0):i!==Eo&&oi(i,t)?(i[t]=n,!0):oi(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(r[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:o,propsOptions:r}},s){let a;return!!n[s]||e!==Eo&&oi(e,s)||BI(t,s)||(a=r[0])&&oi(a,s)||oi(i,s)||oi(Sb,s)||oi(o.config.globalProperties,s)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:oi(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};let LL=!0;function doe(e){const t=SN(e),n=e.proxy,i=e.ctx;LL=!1,t.beforeCreate&&r3(t.beforeCreate,e,"bc");const{data:o,computed:r,methods:s,watch:a,provide:c,inject:u,created:d,beforeMount:h,mounted:m,beforeUpdate:g,updated:p,activated:y,deactivated:b,beforeDestroy:C,beforeUnmount:E,destroyed:w,unmounted:S,render:P,renderTracked:L,renderTriggered:z,errorCaptured:R,serverPrefetch:F,expose:U,inheritAttrs:D,components:I,directives:_,filters:v}=t;if(u&&foe(u,i,null,e.appContext.config.unwrapInjectedRef),s)for(const V in s){const k=s[V];En(k)&&(i[V]=k.bind(n))}if(o){const V=o.call(n,n);Di(V)&&(e.data=W_(V))}if(LL=!0,r)for(const V in r){const k=r[V],G=En(k)?k.bind(n,n):En(k.get)?k.get.bind(n,n):Bi,W=!En(k)&&En(k.set)?k.set.bind(n):Bi,K=tt({get:G,set:W});Object.defineProperty(i,V,{enumerable:!0,configurable:!0,get:()=>K.value,set:q=>K.value=q})}if(a)for(const V in a)m9(a[V],i,n,V);if(c){const V=En(c)?c.call(n):c;Reflect.ownKeys(V).forEach(k=>{nd(k,V[k])})}d&&r3(d,e,"c");function N(V,k){Yt(k)?k.forEach(G=>V(G.bind(n))):k&&V(k.bind(n))}if(N(ooe,h),N(Oc,m),N(roe,g),N(u9,p),N(toe,y),N(noe,b),N(loe,R),N(coe,L),N(aoe,z),N(Wp,E),N(xN,S),N(soe,F),Yt(U))if(U.length){const V=e.exposed||(e.exposed={});U.forEach(k=>{Object.defineProperty(V,k,{get:()=>n[k],set:G=>n[k]=G})})}else e.exposed||(e.exposed={});P&&e.render===Bi&&(e.render=P),D!=null&&(e.inheritAttrs=D),I&&(e.components=I),_&&(e.directives=_)}function foe(e,t,n=Bi,i=!1){Yt(e)&&(e=BL(e));for(const o in e){const r=e[o];let s;Di(r)?"default"in r?s=er(r.from||o,r.default,!0):s=er(r.from||o):s=er(r),So(s)&&i?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):t[o]=s}}function r3(e,t,n){cl(Yt(e)?e.map(i=>i.bind(t.proxy)):e.bind(t.proxy),t,n)}function m9(e,t,n,i){const o=i.includes(".")?r9(n,i):()=>n[i];if(_i(e)){const r=t[e];En(r)&&to(o,r)}else if(En(e))to(o,e.bind(n));else if(Di(e))if(Yt(e))e.forEach(r=>m9(r,t,n,i));else{const r=En(e.handler)?e.handler.bind(n):t[e.handler];En(r)&&to(o,r,e)}}function SN(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:r,config:{optionMergeStrategies:s}}=e.appContext,a=r.get(t);let c;return a?c=a:!o.length&&!n&&!i?c=t:(c={},o.length&&o.forEach(u=>ES(c,u,s,!0)),ES(c,t,s)),Di(t)&&r.set(t,c),c}function ES(e,t,n,i=!1){const{mixins:o,extends:r}=t;r&&ES(e,r,n,!0),o&&o.forEach(s=>ES(e,s,n,!0));for(const s in t)if(!(i&&s==="expose")){const a=hoe[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}const hoe={data:s3,props:Um,emits:Um,methods:Um,computed:Um,beforeCreate:Ea,created:Ea,beforeMount:Ea,mounted:Ea,beforeUpdate:Ea,updated:Ea,beforeDestroy:Ea,beforeUnmount:Ea,destroyed:Ea,unmounted:Ea,activated:Ea,deactivated:Ea,errorCaptured:Ea,serverPrefetch:Ea,components:Um,directives:Um,watch:moe,provide:s3,inject:poe};function s3(e,t){return t?e?function(){return gs(En(e)?e.call(this,this):e,En(t)?t.call(this,this):t)}:t:e}function poe(e,t){return Um(BL(e),BL(t))}function BL(e){if(Yt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ea(e,t){return e?[...new Set([].concat(e,t))]:t}function Um(e,t){return e?gs(gs(Object.create(null),e),t):t}function moe(e,t){if(!e)return t;if(!t)return e;const n=gs(Object.create(null),e);for(const i in t)n[i]=Ea(e[i],t[i]);return n}function _oe(e,t,n,i=!1){const o={},r={};bS(r,Wv,1),e.propsDefaults=Object.create(null),_9(e,t,o,r);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=i?o:G6(o):e.type.props?e.props=o:e.props=r,e.attrs=r}function goe(e,t,n,i){const{props:o,attrs:r,vnode:{patchFlag:s}}=e,a=Ci(o),[c]=e.propsOptions;let u=!1;if((i||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let h=0;h<d.length;h++){let m=d[h];if(Vv(e.emitsOptions,m))continue;const g=t[m];if(c)if(oi(r,m))g!==r[m]&&(r[m]=g,u=!0);else{const p=lu(m);o[p]=RL(c,a,p,g,e,!1)}else g!==r[m]&&(r[m]=g,u=!0)}}}else{_9(e,t,o,r)&&(u=!0);let d;for(const h in a)(!t||!oi(t,h)&&((d=G_(h))===h||!oi(t,d)))&&(c?n&&(n[h]!==void 0||n[d]!==void 0)&&(o[h]=RL(c,a,h,void 0,e,!0)):delete o[h]);if(r!==a)for(const h in r)(!t||!oi(t,h))&&(delete r[h],u=!0)}u&&vf(e,"set","$attrs")}function _9(e,t,n,i){const[o,r]=e.propsOptions;let s=!1,a;if(t)for(let c in t){if(xw(c))continue;const u=t[c];let d;o&&oi(o,d=lu(c))?!r||!r.includes(d)?n[d]=u:(a||(a={}))[d]=u:Vv(e.emitsOptions,c)||(!(c in i)||u!==i[c])&&(i[c]=u,s=!0)}if(r){const c=Ci(n),u=a||Eo;for(let d=0;d<r.length;d++){const h=r[d];n[h]=RL(o,c,h,u[h],e,!oi(u,h))}}return s}function RL(e,t,n,i,o,r){const s=e[n];if(s!=null){const a=oi(s,"default");if(a&&i===void 0){const c=s.default;if(s.type!==Function&&En(c)){const{propsDefaults:u}=o;n in u?i=u[n]:(t0(o),i=u[n]=c.call(null,t),l_())}else i=c}s[0]&&(r&&!a?i=!1:s[1]&&(i===""||i===G_(n))&&(i=!0))}return i}function g9(e,t,n=!1){const i=t.propsCache,o=i.get(e);if(o)return o;const r=e.props,s={},a=[];let c=!1;if(!En(e)){const d=h=>{c=!0;const[m,g]=g9(h,t,!0);gs(s,m),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!r&&!c)return Di(e)&&i.set(e,Iy),Iy;if(Yt(r))for(let d=0;d<r.length;d++){const h=lu(r[d]);a3(h)&&(s[h]=Eo)}else if(r)for(const d in r){const h=lu(d);if(a3(h)){const m=r[d],g=s[h]=Yt(m)||En(m)?{type:m}:Object.assign({},m);if(g){const p=u3(Boolean,g.type),y=u3(String,g.type);g[0]=p>-1,g[1]=y<0||p<y,(p>-1||oi(g,"default"))&&a.push(h)}}}const u=[s,a];return Di(e)&&i.set(e,u),u}function a3(e){return e[0]!=="$"}function c3(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function l3(e,t){return c3(e)===c3(t)}function u3(e,t){return Yt(t)?t.findIndex(n=>l3(n,e)):En(t)&&l3(t,e)?0:-1}const y9=e=>e[0]==="_"||e==="$stable",vN=e=>Yt(e)?e.map(ju):[ju(e)],yoe=(e,t,n)=>{if(t._n)return t;const i=an((...o)=>vN(t(...o)),n);return i._c=!1,i},A9=(e,t,n)=>{const i=e._ctx;for(const o in e){if(y9(o))continue;const r=e[o];if(En(r))t[o]=yoe(o,r,i);else if(r!=null){const s=vN(r);t[o]=()=>s}}},b9=(e,t)=>{const n=vN(t);e.slots.default=()=>n},Aoe=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=Ci(t),bS(t,"_",n)):A9(t,e.slots={})}else e.slots={},t&&b9(e,t);bS(e.slots,Wv,1)},boe=(e,t,n)=>{const{vnode:i,slots:o}=e;let r=!0,s=Eo;if(i.shapeFlag&32){const a=t._;a?n&&a===1?r=!1:(gs(o,t),!n&&a===1&&delete o._):(r=!t.$stable,A9(t,o)),s=t}else t&&(b9(e,t),s={default:1});if(r)for(const a in o)!y9(a)&&!(a in s)&&delete o[a]};function C9(){return{app:null,config:{isNativeTag:eie,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Coe=0;function Toe(e,t){return function(i,o=null){En(i)||(i=Object.assign({},i)),o!=null&&!Di(o)&&(o=null);const r=C9(),s=new Set;let a=!1;const c=r.app={_uid:Coe++,_component:i,_props:o,_container:null,_context:r,_instance:null,version:Woe,get config(){return r.config},set config(u){},use(u,...d){return s.has(u)||(u&&En(u.install)?(s.add(u),u.install(c,...d)):En(u)&&(s.add(u),u(c,...d))),c},mixin(u){return r.mixins.includes(u)||r.mixins.push(u),c},component(u,d){return d?(r.components[u]=d,c):r.components[u]},directive(u,d){return d?(r.directives[u]=d,c):r.directives[u]},mount(u,d,h){if(!a){const m=fn(i,o);return m.appContext=r,d&&t?t(m,u):e(m,u,h),a=!0,c._container=u,u.__vue_app__=c,jv(m.component)||m.component.proxy}},unmount(){a&&(e(null,c._container),delete c._container.__vue_app__)},provide(u,d){return r.provides[u]=d,c}};return c}}function NL(e,t,n,i,o=!1){if(Yt(e)){e.forEach((m,g)=>NL(m,t&&(Yt(t)?t[g]:t),n,i,o));return}if(wb(i)&&!o)return;const r=i.shapeFlag&4?jv(i.component)||i.component.proxy:i.el,s=o?null:r,{i:a,r:c}=e,u=t&&t.r,d=a.refs===Eo?a.refs={}:a.refs,h=a.setupState;if(u!=null&&u!==c&&(_i(u)?(d[u]=null,oi(h,u)&&(h[u]=null)):So(u)&&(u.value=null)),En(c))ap(c,a,12,[s,d]);else{const m=_i(c),g=So(c);if(m||g){const p=()=>{if(e.f){const y=m?oi(h,c)?h[c]:d[c]:c.value;o?Yt(y)&&lN(y,r):Yt(y)?y.includes(r)||y.push(r):m?(d[c]=[r],oi(h,c)&&(h[c]=d[c])):(c.value=[r],e.k&&(d[e.k]=c.value))}else m?(d[c]=s,oi(h,c)&&(h[c]=s)):g&&(c.value=s,e.k&&(d[e.k]=s))};s?(p.id=-1,Wa(p,n)):p()}}}const Wa=Jie;function Eoe(e){return xoe(e)}function xoe(e,t){const n=sie();n.__VUE__=!0;const{insert:i,remove:o,patchProp:r,createElement:s,createText:a,createComment:c,setText:u,setElementText:d,parentNode:h,nextSibling:m,setScopeId:g=Bi,insertStaticContent:p}=e,y=(Q,ne,de,_e=null,Se=null,ve=null,Le=!1,Ee=null,Be=!!ne.dynamicChildren)=>{if(Q===ne)return;Q&&!Wm(Q,ne)&&(_e=se(Q),q(Q,Se,ve,!0),Q=null),ne.patchFlag===-2&&(Be=!1,ne.dynamicChildren=null);const{type:Pe,ref:Ae,shapeFlag:xe}=ne;switch(Pe){case sT:b(Q,ne,de,_e);break;case ll:C(Q,ne,de,_e);break;case RI:Q==null&&E(ne,de,_e,Le);break;case Jo:I(Q,ne,de,_e,Se,ve,Le,Ee,Be);break;default:xe&1?P(Q,ne,de,_e,Se,ve,Le,Ee,Be):xe&6?_(Q,ne,de,_e,Se,ve,Le,Ee,Be):(xe&64||xe&128)&&Pe.process(Q,ne,de,_e,Se,ve,Le,Ee,Be,re)}Ae!=null&&Se&&NL(Ae,Q&&Q.ref,ve,ne||Q,!ne)},b=(Q,ne,de,_e)=>{if(Q==null)i(ne.el=a(ne.children),de,_e);else{const Se=ne.el=Q.el;ne.children!==Q.children&&u(Se,ne.children)}},C=(Q,ne,de,_e)=>{Q==null?i(ne.el=c(ne.children||""),de,_e):ne.el=Q.el},E=(Q,ne,de,_e)=>{[Q.el,Q.anchor]=p(Q.children,ne,de,_e,Q.el,Q.anchor)},w=({el:Q,anchor:ne},de,_e)=>{let Se;for(;Q&&Q!==ne;)Se=m(Q),i(Q,de,_e),Q=Se;i(ne,de,_e)},S=({el:Q,anchor:ne})=>{let de;for(;Q&&Q!==ne;)de=m(Q),o(Q),Q=de;o(ne)},P=(Q,ne,de,_e,Se,ve,Le,Ee,Be)=>{Le=Le||ne.type==="svg",Q==null?L(ne,de,_e,Se,ve,Le,Ee,Be):F(Q,ne,Se,ve,Le,Ee,Be)},L=(Q,ne,de,_e,Se,ve,Le,Ee)=>{let Be,Pe;const{type:Ae,props:xe,shapeFlag:Oe,transition:Ve,dirs:Re}=Q;if(Be=Q.el=s(Q.type,ve,xe&&xe.is,xe),Oe&8?d(Be,Q.children):Oe&16&&R(Q.children,Be,null,_e,Se,ve&&Ae!=="foreignObject",Le,Ee),Re&&um(Q,null,_e,"created"),xe){for(const xt in xe)xt!=="value"&&!xw(xt)&&r(Be,xt,null,xe[xt],ve,Q.children,_e,Se,$);"value"in xe&&r(Be,"value",null,xe.value),(Pe=xe.onVnodeBeforeMount)&&Nu(Pe,_e,Q)}z(Be,Q,Q.scopeId,Le,_e),Re&&um(Q,null,_e,"beforeMount");const At=(!Se||Se&&!Se.pendingBranch)&&Ve&&!Ve.persisted;At&&Ve.beforeEnter(Be),i(Be,ne,de),((Pe=xe&&xe.onVnodeMounted)||At||Re)&&Wa(()=>{Pe&&Nu(Pe,_e,Q),At&&Ve.enter(Be),Re&&um(Q,null,_e,"mounted")},Se)},z=(Q,ne,de,_e,Se)=>{if(de&&g(Q,de),_e)for(let ve=0;ve<_e.length;ve++)g(Q,_e[ve]);if(Se){let ve=Se.subTree;if(ne===ve){const Le=Se.vnode;z(Q,Le,Le.scopeId,Le.slotScopeIds,Se.parent)}}},R=(Q,ne,de,_e,Se,ve,Le,Ee,Be=0)=>{for(let Pe=Be;Pe<Q.length;Pe++){const Ae=Q[Pe]=Ee?Gh(Q[Pe]):ju(Q[Pe]);y(null,Ae,ne,de,_e,Se,ve,Le,Ee)}},F=(Q,ne,de,_e,Se,ve,Le)=>{const Ee=ne.el=Q.el;let{patchFlag:Be,dynamicChildren:Pe,dirs:Ae}=ne;Be|=Q.patchFlag&16;const xe=Q.props||Eo,Oe=ne.props||Eo;let Ve;de&&dm(de,!1),(Ve=Oe.onVnodeBeforeUpdate)&&Nu(Ve,de,ne,Q),Ae&&um(ne,Q,de,"beforeUpdate"),de&&dm(de,!0);const Re=Se&&ne.type!=="foreignObject";if(Pe?U(Q.dynamicChildren,Pe,Ee,de,_e,Re,ve):Le||k(Q,ne,Ee,null,de,_e,Re,ve,!1),Be>0){if(Be&16)D(Ee,ne,xe,Oe,de,_e,Se);else if(Be&2&&xe.class!==Oe.class&&r(Ee,"class",null,Oe.class,Se),Be&4&&r(Ee,"style",xe.style,Oe.style,Se),Be&8){const At=ne.dynamicProps;for(let xt=0;xt<At.length;xt++){const Nt=At[xt],On=xe[Nt],Nn=Oe[Nt];(Nn!==On||Nt==="value")&&r(Ee,Nt,On,Nn,Se,Q.children,de,_e,$)}}Be&1&&Q.children!==ne.children&&d(Ee,ne.children)}else!Le&&Pe==null&&D(Ee,ne,xe,Oe,de,_e,Se);((Ve=Oe.onVnodeUpdated)||Ae)&&Wa(()=>{Ve&&Nu(Ve,de,ne,Q),Ae&&um(ne,Q,de,"updated")},_e)},U=(Q,ne,de,_e,Se,ve,Le)=>{for(let Ee=0;Ee<ne.length;Ee++){const Be=Q[Ee],Pe=ne[Ee],Ae=Be.el&&(Be.type===Jo||!Wm(Be,Pe)||Be.shapeFlag&70)?h(Be.el):de;y(Be,Pe,Ae,null,_e,Se,ve,Le,!0)}},D=(Q,ne,de,_e,Se,ve,Le)=>{if(de!==_e){if(de!==Eo)for(const Ee in de)!xw(Ee)&&!(Ee in _e)&&r(Q,Ee,de[Ee],null,Le,ne.children,Se,ve,$);for(const Ee in _e){if(xw(Ee))continue;const Be=_e[Ee],Pe=de[Ee];Be!==Pe&&Ee!=="value"&&r(Q,Ee,Pe,Be,Le,ne.children,Se,ve,$)}"value"in _e&&r(Q,"value",de.value,_e.value)}},I=(Q,ne,de,_e,Se,ve,Le,Ee,Be)=>{const Pe=ne.el=Q?Q.el:a(""),Ae=ne.anchor=Q?Q.anchor:a("");let{patchFlag:xe,dynamicChildren:Oe,slotScopeIds:Ve}=ne;Ve&&(Ee=Ee?Ee.concat(Ve):Ve),Q==null?(i(Pe,de,_e),i(Ae,de,_e),R(ne.children,de,Ae,Se,ve,Le,Ee,Be)):xe>0&&xe&64&&Oe&&Q.dynamicChildren?(U(Q.dynamicChildren,Oe,de,Se,ve,Le,Ee),(ne.key!=null||Se&&ne===Se.subTree)&&DN(Q,ne,!0)):k(Q,ne,de,Ae,Se,ve,Le,Ee,Be)},_=(Q,ne,de,_e,Se,ve,Le,Ee,Be)=>{ne.slotScopeIds=Ee,Q==null?ne.shapeFlag&512?Se.ctx.activate(ne,de,_e,Le,Be):v(ne,de,_e,Se,ve,Le,Be):O(Q,ne,Be)},v=(Q,ne,de,_e,Se,ve,Le)=>{const Ee=Q.component=Noe(Q,_e,Se);if(kv(Q)&&(Ee.ctx.renderer=re),Moe(Ee),Ee.asyncDep){if(Se&&Se.registerDep(Ee,N),!Q.el){const Be=Ee.subTree=fn(ll);C(null,Be,ne,de)}return}N(Ee,Q,ne,de,Se,ve,Le)},O=(Q,ne,de)=>{const _e=ne.component=Q.component;if(Yie(Q,ne,de))if(_e.asyncDep&&!_e.asyncResolved){V(_e,ne,de);return}else _e.next=ne,kie(_e.update),_e.update();else ne.el=Q.el,_e.vnode=ne},N=(Q,ne,de,_e,Se,ve,Le)=>{const Ee=()=>{if(Q.isMounted){let{next:Ae,bu:xe,u:Oe,parent:Ve,vnode:Re}=Q,At=Ae,xt;dm(Q,!1),Ae?(Ae.el=Re.el,V(Q,Ae,Le)):Ae=Re,xe&&ww(xe),(xt=Ae.props&&Ae.props.onVnodeBeforeUpdate)&&Nu(xt,Ve,Ae,Re),dm(Q,!0);const Nt=OI(Q),On=Q.subTree;Q.subTree=Nt,y(On,Nt,h(On.el),se(On),Q,Se,ve),Ae.el=Nt.el,At===null&&Xie(Q,Nt.el),Oe&&Wa(Oe,Se),(xt=Ae.props&&Ae.props.onVnodeUpdated)&&Wa(()=>Nu(xt,Ve,Ae,Re),Se)}else{let Ae;const{el:xe,props:Oe}=ne,{bm:Ve,m:Re,parent:At}=Q,xt=wb(ne);if(dm(Q,!1),Ve&&ww(Ve),!xt&&(Ae=Oe&&Oe.onVnodeBeforeMount)&&Nu(Ae,At,ne),dm(Q,!0),xe&&ce){const Nt=()=>{Q.subTree=OI(Q),ce(xe,Q.subTree,Q,Se,null)};xt?ne.type.__asyncLoader().then(()=>!Q.isUnmounted&&Nt()):Nt()}else{const Nt=Q.subTree=OI(Q);y(null,Nt,de,_e,Q,Se,ve),ne.el=Nt.el}if(Re&&Wa(Re,Se),!xt&&(Ae=Oe&&Oe.onVnodeMounted)){const Nt=ne;Wa(()=>Nu(Ae,At,Nt),Se)}(ne.shapeFlag&256||At&&wb(At.vnode)&&At.vnode.shapeFlag&256)&&Q.a&&Wa(Q.a,Se),Q.isMounted=!0,ne=de=_e=null}},Be=Q.effect=new hN(Ee,()=>CN(Pe),Q.scope),Pe=Q.update=()=>Be.run();Pe.id=Q.uid,dm(Q,!0),Pe()},V=(Q,ne,de)=>{ne.component=Q;const _e=Q.vnode.props;Q.vnode=ne,Q.next=null,goe(Q,ne.props,_e,de),boe(Q,ne.children,de),x0(),e3(),w0()},k=(Q,ne,de,_e,Se,ve,Le,Ee,Be=!1)=>{const Pe=Q&&Q.children,Ae=Q?Q.shapeFlag:0,xe=ne.children,{patchFlag:Oe,shapeFlag:Ve}=ne;if(Oe>0){if(Oe&128){W(Pe,xe,de,_e,Se,ve,Le,Ee,Be);return}else if(Oe&256){G(Pe,xe,de,_e,Se,ve,Le,Ee,Be);return}}Ve&8?(Ae&16&&$(Pe,Se,ve),xe!==Pe&&d(de,xe)):Ae&16?Ve&16?W(Pe,xe,de,_e,Se,ve,Le,Ee,Be):$(Pe,Se,ve,!0):(Ae&8&&d(de,""),Ve&16&&R(xe,de,_e,Se,ve,Le,Ee,Be))},G=(Q,ne,de,_e,Se,ve,Le,Ee,Be)=>{Q=Q||Iy,ne=ne||Iy;const Pe=Q.length,Ae=ne.length,xe=Math.min(Pe,Ae);let Oe;for(Oe=0;Oe<xe;Oe++){const Ve=ne[Oe]=Be?Gh(ne[Oe]):ju(ne[Oe]);y(Q[Oe],Ve,de,null,Se,ve,Le,Ee,Be)}Pe>Ae?$(Q,Se,ve,!0,!1,xe):R(ne,de,_e,Se,ve,Le,Ee,Be,xe)},W=(Q,ne,de,_e,Se,ve,Le,Ee,Be)=>{let Pe=0;const Ae=ne.length;let xe=Q.length-1,Oe=Ae-1;for(;Pe<=xe&&Pe<=Oe;){const Ve=Q[Pe],Re=ne[Pe]=Be?Gh(ne[Pe]):ju(ne[Pe]);if(Wm(Ve,Re))y(Ve,Re,de,null,Se,ve,Le,Ee,Be);else break;Pe++}for(;Pe<=xe&&Pe<=Oe;){const Ve=Q[xe],Re=ne[Oe]=Be?Gh(ne[Oe]):ju(ne[Oe]);if(Wm(Ve,Re))y(Ve,Re,de,null,Se,ve,Le,Ee,Be);else break;xe--,Oe--}if(Pe>xe){if(Pe<=Oe){const Ve=Oe+1,Re=Ve<Ae?ne[Ve].el:_e;for(;Pe<=Oe;)y(null,ne[Pe]=Be?Gh(ne[Pe]):ju(ne[Pe]),de,Re,Se,ve,Le,Ee,Be),Pe++}}else if(Pe>Oe)for(;Pe<=xe;)q(Q[Pe],Se,ve,!0),Pe++;else{const Ve=Pe,Re=Pe,At=new Map;for(Pe=Re;Pe<=Oe;Pe++){const vn=ne[Pe]=Be?Gh(ne[Pe]):ju(ne[Pe]);vn.key!=null&&At.set(vn.key,Pe)}let xt,Nt=0;const On=Oe-Re+1;let Nn=!1,Sn=0;const un=new Array(On);for(Pe=0;Pe<On;Pe++)un[Pe]=0;for(Pe=Ve;Pe<=xe;Pe++){const vn=Q[Pe];if(Nt>=On){q(vn,Se,ve,!0);continue}let Pn;if(vn.key!=null)Pn=At.get(vn.key);else for(xt=Re;xt<=Oe;xt++)if(un[xt-Re]===0&&Wm(vn,ne[xt])){Pn=xt;break}Pn===void 0?q(vn,Se,ve,!0):(un[Pn-Re]=Pe+1,Pn>=Sn?Sn=Pn:Nn=!0,y(vn,ne[Pn],de,null,Se,ve,Le,Ee,Be),Nt++)}const Ht=Nn?woe(un):Iy;for(xt=Ht.length-1,Pe=On-1;Pe>=0;Pe--){const vn=Re+Pe,Pn=ne[vn],qt=vn+1<Ae?ne[vn+1].el:_e;un[Pe]===0?y(null,Pn,de,qt,Se,ve,Le,Ee,Be):Nn&&(xt<0||Pe!==Ht[xt]?K(Pn,de,qt,2):xt--)}}},K=(Q,ne,de,_e,Se=null)=>{const{el:ve,type:Le,transition:Ee,children:Be,shapeFlag:Pe}=Q;if(Pe&6){K(Q.component.subTree,ne,de,_e);return}if(Pe&128){Q.suspense.move(ne,de,_e);return}if(Pe&64){Le.move(Q,ne,de,re);return}if(Le===Jo){i(ve,ne,de);for(let xe=0;xe<Be.length;xe++)K(Be[xe],ne,de,_e);i(Q.anchor,ne,de);return}if(Le===RI){w(Q,ne,de);return}if(_e!==2&&Pe&1&&Ee)if(_e===0)Ee.beforeEnter(ve),i(ve,ne,de),Wa(()=>Ee.enter(ve),Se);else{const{leave:xe,delayLeave:Oe,afterLeave:Ve}=Ee,Re=()=>i(ve,ne,de),At=()=>{xe(ve,()=>{Re(),Ve&&Ve()})};Oe?Oe(ve,Re,At):At()}else i(ve,ne,de)},q=(Q,ne,de,_e=!1,Se=!1)=>{const{type:ve,props:Le,ref:Ee,children:Be,dynamicChildren:Pe,shapeFlag:Ae,patchFlag:xe,dirs:Oe}=Q;if(Ee!=null&&NL(Ee,null,de,Q,!0),Ae&256){ne.ctx.deactivate(Q);return}const Ve=Ae&1&&Oe,Re=!wb(Q);let At;if(Re&&(At=Le&&Le.onVnodeBeforeUnmount)&&Nu(At,ne,Q),Ae&6)X(Q.component,de,_e);else{if(Ae&128){Q.suspense.unmount(de,_e);return}Ve&&um(Q,null,ne,"beforeUnmount"),Ae&64?Q.type.remove(Q,ne,de,Se,re,_e):Pe&&(ve!==Jo||xe>0&&xe&64)?$(Pe,ne,de,!1,!0):(ve===Jo&&xe&384||!Se&&Ae&16)&&$(Be,ne,de),_e&&te(Q)}(Re&&(At=Le&&Le.onVnodeUnmounted)||Ve)&&Wa(()=>{At&&Nu(At,ne,Q),Ve&&um(Q,null,ne,"unmounted")},de)},te=Q=>{const{type:ne,el:de,anchor:_e,transition:Se}=Q;if(ne===Jo){Y(de,_e);return}if(ne===RI){S(Q);return}const ve=()=>{o(de),Se&&!Se.persisted&&Se.afterLeave&&Se.afterLeave()};if(Q.shapeFlag&1&&Se&&!Se.persisted){const{leave:Le,delayLeave:Ee}=Se,Be=()=>Le(de,ve);Ee?Ee(Q.el,ve,Be):Be()}else ve()},Y=(Q,ne)=>{let de;for(;Q!==ne;)de=m(Q),o(Q),Q=de;o(ne)},X=(Q,ne,de)=>{const{bum:_e,scope:Se,update:ve,subTree:Le,um:Ee}=Q;_e&&ww(_e),Se.stop(),ve&&(ve.active=!1,q(Le,Q,ne,de)),Ee&&Wa(Ee,ne),Wa(()=>{Q.isUnmounted=!0},ne),ne&&ne.pendingBranch&&!ne.isUnmounted&&Q.asyncDep&&!Q.asyncResolved&&Q.suspenseId===ne.pendingId&&(ne.deps--,ne.deps===0&&ne.resolve())},$=(Q,ne,de,_e=!1,Se=!1,ve=0)=>{for(let Le=ve;Le<Q.length;Le++)q(Q[Le],ne,de,_e,Se)},se=Q=>Q.shapeFlag&6?se(Q.component.subTree):Q.shapeFlag&128?Q.suspense.next():m(Q.anchor||Q.el),ue=(Q,ne,de)=>{Q==null?ne._vnode&&q(ne._vnode,null,null,!0):y(ne._vnode||null,Q,ne,null,null,null,de),e3(),t9(),ne._vnode=Q},re={p:y,um:q,m:K,r:te,mt:v,mc:R,pc:k,pbc:U,n:se,o:e};let he,ce;return t&&([he,ce]=t(re)),{render:ue,hydrate:he,createApp:Toe(ue,he)}}function dm({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function DN(e,t,n=!1){const i=e.children,o=t.children;if(Yt(i)&&Yt(o))for(let r=0;r<i.length;r++){const s=i[r];let a=o[r];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[r]=Gh(o[r]),a.el=s.el),n||DN(s,a)),a.type===sT&&(a.el=s.el)}}function woe(e){const t=e.slice(),n=[0];let i,o,r,s,a;const c=e.length;for(i=0;i<c;i++){const u=e[i];if(u!==0){if(o=n[n.length-1],e[o]<u){t[i]=o,n.push(i);continue}for(r=0,s=n.length-1;r<s;)a=r+s>>1,e[n[a]]<u?r=a+1:s=a;u<e[n[r]]&&(r>0&&(t[i]=n[r-1]),n[r]=i)}}for(r=n.length,s=n[r-1];r-- >0;)n[r]=s,s=t[s];return n}const Soe=e=>e.__isTeleport,vb=e=>e&&(e.disabled||e.disabled===""),d3=e=>typeof SVGElement<"u"&&e instanceof SVGElement,ML=(e,t)=>{const n=e&&e.to;return _i(n)?t?t(n):null:n},voe={__isTeleport:!0,process(e,t,n,i,o,r,s,a,c,u){const{mc:d,pc:h,pbc:m,o:{insert:g,querySelector:p,createText:y,createComment:b}}=u,C=vb(t.props);let{shapeFlag:E,children:w,dynamicChildren:S}=t;if(e==null){const P=t.el=y(""),L=t.anchor=y("");g(P,n,i),g(L,n,i);const z=t.target=ML(t.props,p),R=t.targetAnchor=y("");z&&(g(R,z),s=s||d3(z));const F=(U,D)=>{E&16&&d(w,U,D,o,r,s,a,c)};C?F(n,L):z&&F(z,R)}else{t.el=e.el;const P=t.anchor=e.anchor,L=t.target=e.target,z=t.targetAnchor=e.targetAnchor,R=vb(e.props),F=R?n:L,U=R?P:z;if(s=s||d3(L),S?(m(e.dynamicChildren,S,F,o,r,s,a),DN(e,t,!0)):c||h(e,t,F,U,o,r,s,a,!1),C)R||dE(t,n,P,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const D=t.target=ML(t.props,p);D&&dE(t,D,null,u,0)}else R&&dE(t,L,z,u,1)}T9(t)},remove(e,t,n,i,{um:o,o:{remove:r}},s){const{shapeFlag:a,children:c,anchor:u,targetAnchor:d,target:h,props:m}=e;if(h&&r(d),(s||!vb(m))&&(r(u),a&16))for(let g=0;g<c.length;g++){const p=c[g];o(p,t,n,!0,!!p.dynamicChildren)}},move:dE,hydrate:Doe};function dE(e,t,n,{o:{insert:i},m:o},r=2){r===0&&i(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:c,children:u,props:d}=e,h=r===2;if(h&&i(s,t,n),(!h||vb(d))&&c&16)for(let m=0;m<u.length;m++)o(u[m],t,n,2);h&&i(a,t,n)}function Doe(e,t,n,i,o,r,{o:{nextSibling:s,parentNode:a,querySelector:c}},u){const d=t.target=ML(t.props,c);if(d){const h=d._lpa||d.firstChild;if(t.shapeFlag&16)if(vb(t.props))t.anchor=u(s(e),t,a(e),n,i,o,r),t.targetAnchor=h;else{t.anchor=s(e);let m=h;for(;m;)if(m=s(m),m&&m.nodeType===8&&m.data==="teleport anchor"){t.targetAnchor=m,d._lpa=t.targetAnchor&&s(t.targetAnchor);break}u(h,t,d,n,i,o,r)}T9(t)}return t.anchor&&s(t.anchor)}const Ioe=voe;function T9(e){const t=e.ctx;if(t&&t.ut){let n=e.children[0].el;for(;n!==e.targetAnchor;)n.nodeType===1&&n.setAttribute("data-v-owner",t.uid),n=n.nextSibling;t.ut()}}const Jo=Symbol(void 0),sT=Symbol(void 0),ll=Symbol(void 0),RI=Symbol(void 0),Db=[];let Yl=null;function qe(e=!1){Db.push(Yl=e?null:[])}function Poe(){Db.pop(),Yl=Db[Db.length-1]||null}let aC=1;function f3(e){aC+=e}function E9(e){return e.dynamicChildren=aC>0?Yl||Iy:null,Poe(),aC>0&&Yl&&Yl.push(e),e}function Dt(e,t,n,i,o,r){return E9(Vt(e,t,n,i,o,r,!0))}function Dn(e,t,n,i,o){return E9(fn(e,t,n,i,o,!0))}function Ep(e){return e?e.__v_isVNode===!0:!1}function Wm(e,t){return e.type===t.type&&e.key===t.key}const Wv="__vInternal",x9=({key:e})=>e??null,Sw=({ref:e,ref_key:t,ref_for:n})=>e!=null?_i(e)||So(e)||En(e)?{i:Os,r:e,k:t,f:!!n}:e:null;function Vt(e,t=null,n=null,i=0,o=null,r=e===Jo?0:1,s=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&x9(t),ref:t&&Sw(t),scopeId:o9,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Os};return a?(IN(c,n),r&128&&e.normalize(c)):n&&(c.shapeFlag|=_i(n)?8:16),aC>0&&!s&&Yl&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&Yl.push(c),c}const fn=Ooe;function Ooe(e,t=null,n=null,i=0,o=null,r=!1){if((!e||e===d9)&&(e=ll),Ep(e)){const a=xp(e,t,!0);return n&&IN(a,n),aC>0&&!r&&Yl&&(a.shapeFlag&6?Yl[Yl.indexOf(e)]=a:Yl.push(a)),a.patchFlag|=-2,a}if(Hoe(e)&&(e=e.__vccOpts),t){t=Loe(t);let{class:a,style:c}=t;a&&!_i(a)&&(t.class=st(a)),Di(c)&&(j6(c)&&!Yt(c)&&(c=gs({},c)),t.style=Ds(c))}const s=_i(e)?1:Kie(e)?128:Soe(e)?64:Di(e)?4:En(e)?2:0;return Vt(e,t,n,i,o,s,r,!0)}function Loe(e){return e?j6(e)||Wv in e?gs({},e):e:null}function xp(e,t,n=!1){const{props:i,ref:o,patchFlag:r,children:s}=e,a=t?cp(i||{},t):i;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&x9(a),ref:t&&t.ref?n&&o?Yt(o)?o.concat(Sw(t)):[o,Sw(t)]:Sw(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Jo?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:e.transition,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&xp(e.ssContent),ssFallback:e.ssFallback&&xp(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx}}function $l(e=" ",t=0){return fn(sT,null,e,t)}function Mt(e="",t=!1){return t?(qe(),Dn(ll,null,e)):fn(ll,null,e)}function ju(e){return e==null||typeof e=="boolean"?fn(ll):Yt(e)?fn(Jo,null,e.slice()):typeof e=="object"?Gh(e):fn(sT,null,String(e))}function Gh(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:xp(e)}function IN(e,t){let n=0;const{shapeFlag:i}=e;if(t==null)t=null;else if(Yt(t))n=16;else if(typeof t=="object")if(i&65){const o=t.default;o&&(o._c&&(o._d=!1),IN(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!(Wv in t)?t._ctx=Os:o===3&&Os&&(Os.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else En(t)?(t={default:t,_ctx:Os},n=32):(t=String(t),i&64?(n=16,t=[$l(t)]):n=8);e.children=t,e.shapeFlag|=n}function cp(...e){const t={};for(let n=0;n<e.length;n++){const i=e[n];for(const o in i)if(o==="class")t.class!==i.class&&(t.class=st([t.class,i.class]));else if(o==="style")t.style=Ds([t.style,i.style]);else if(Nv(o)){const r=t[o],s=i[o];s&&r!==s&&!(Yt(r)&&r.includes(s))&&(t[o]=r?[].concat(r,s):s)}else o!==""&&(t[o]=i[o])}return t}function Nu(e,t,n,i=null){cl(e,t,7,[n,i])}const Boe=C9();let Roe=0;function Noe(e,t,n){const i=e.type,o=(t?t.appContext:e.appContext)||Boe,r={uid:Roe++,vnode:e,type:i,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,scope:new O6(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:g9(i,o),emitsOptions:i9(i,o),emit:null,emitted:null,propsDefaults:Eo,inheritAttrs:i.inheritAttrs,ctx:Eo,data:Eo,props:Eo,attrs:Eo,slots:Eo,refs:Eo,setupState:Eo,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=jie.bind(null,r),e.ce&&e.ce(r),r}let ds=null;const Lc=()=>ds||Os,t0=e=>{ds=e,e.scope.on()},l_=()=>{ds&&ds.scope.off(),ds=null};function w9(e){return e.vnode.shapeFlag&4}let cC=!1;function Moe(e,t=!1){cC=t;const{props:n,children:i}=e.vnode,o=w9(e);_oe(e,n,o,t),Aoe(e,i);const r=o?Foe(e,t):void 0;return cC=!1,r}function Foe(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=yN(new Proxy(e.ctx,uoe));const{setup:i}=n;if(i){const o=e.setupContext=i.length>1?v9(e):null;t0(e),x0();const r=ap(i,e,0,[e.props,o]);if(w0(),l_(),D6(r)){if(r.then(l_,l_),t)return r.then(s=>{h3(e,s,t)}).catch(s=>{Hv(s,e,0)});e.asyncDep=r}else h3(e,r,t)}else S9(e,t)}function h3(e,t,n){En(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Di(t)&&(e.setupState=X6(t)),S9(e,n)}let p3;function S9(e,t,n){const i=e.type;if(!e.render){if(!t&&p3&&!i.render){const o=i.template||SN(e).template;if(o){const{isCustomElement:r,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:c}=i,u=gs(gs({isCustomElement:r,delimiters:a},s),c);i.render=p3(o,u)}}e.render=i.render||Bi}t0(e),x0(),doe(e),w0(),l_()}function zoe(e){return new Proxy(e.attrs,{get(t,n){return bc(e,"get","$attrs"),t[n]}})}function v9(e){const t=i=>{e.exposed=i||{}};let n;return{get attrs(){return n||(n=zoe(e))},slots:e.slots,emit:e.emit,expose:t}}function jv(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(X6(yN(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Sb)return Sb[n](e)},has(t,n){return n in t||n in Sb}}))}function Uoe(e,t=!0){return En(e)?e.displayName||e.name:e.name||t&&e.__name}function Hoe(e){return En(e)&&"__vccOpts"in e}const tt=(e,t)=>Q6(e,t,cC);function aT(){return D9().slots}function Voe(){return D9().attrs}function D9(){const e=Lc();return e.setupContext||(e.setupContext=v9(e))}function qv(e,t,n){const i=arguments.length;return i===2?Di(t)&&!Yt(t)?Ep(t)?fn(e,null,[t]):fn(e,t):fn(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&Ep(n)&&(n=[n]),fn(e,t,n))}const koe=Symbol(""),Goe=()=>er(koe),Woe="3.2.45",joe="http://www.w3.org/2000/svg",jm=typeof document<"u"?document:null,m3=jm&&jm.createElement("template"),qoe={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const o=t?jm.createElementNS(joe,e):jm.createElement(e,n?{is:n}:void 0);return e==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:e=>jm.createTextNode(e),createComment:e=>jm.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>jm.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,o,r){const s=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===r||!(o=o.nextSibling)););else{m3.innerHTML=i?`<svg>${e}</svg>`:e;const a=m3.content;if(i){const c=a.firstChild;for(;c.firstChild;)a.appendChild(c.firstChild);a.removeChild(c)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}};function $oe(e,t,n){const i=e._vtc;i&&(t=(t?[t,...i]:[...i]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Yoe(e,t,n){const i=e.style,o=_i(n);if(n&&!o){for(const r in n)FL(i,r,n[r]);if(t&&!_i(t))for(const r in t)n[r]==null&&FL(i,r,"")}else{const r=i.display;o?t!==n&&(i.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(i.display=r)}}const _3=/\s*!important$/;function FL(e,t,n){if(Yt(n))n.forEach(i=>FL(e,t,i));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=Xoe(e,t);_3.test(n)?e.setProperty(G_(i),n.replace(_3,""),"important"):e[i]=n}}const g3=["Webkit","Moz","ms"],NI={};function Xoe(e,t){const n=NI[t];if(n)return n;let i=lu(t);if(i!=="filter"&&i in e)return NI[t]=i;i=zv(i);for(let o=0;o<g3.length;o++){const r=g3[o]+i;if(r in e)return NI[t]=r}return t}const y3="http://www.w3.org/1999/xlink";function Koe(e,t,n,i,o){if(i&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(y3,t.slice(6,t.length)):e.setAttributeNS(y3,t,n);else{const r=Qne(t);n==null||r&&!w6(n)?e.removeAttribute(t):e.setAttribute(t,r?"":n)}}function Joe(e,t,n,i,o,r,s){if(t==="innerHTML"||t==="textContent"){i&&s(i,o,r),e[t]=n??"";return}if(t==="value"&&e.tagName!=="PROGRESS"&&!e.tagName.includes("-")){e._value=n;const c=n??"";(e.value!==c||e.tagName==="OPTION")&&(e.value=c),n==null&&e.removeAttribute(t);return}let a=!1;if(n===""||n==null){const c=typeof e[t];c==="boolean"?n=w6(n):n==null&&c==="string"?(n="",a=!0):c==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(t)}function I9(e,t,n,i){e.addEventListener(t,n,i)}function Qoe(e,t,n,i){e.removeEventListener(t,n,i)}function Zoe(e,t,n,i,o=null){const r=e._vei||(e._vei={}),s=r[t];if(i&&s)s.value=i;else{const[a,c]=ere(t);if(i){const u=r[t]=ire(i,o);I9(e,a,u,c)}else s&&(Qoe(e,a,s,c),r[t]=void 0)}}const A3=/(?:Once|Passive|Capture)$/;function ere(e){let t;if(A3.test(e)){t={};let i;for(;i=e.match(A3);)e=e.slice(0,e.length-i[0].length),t[i[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):G_(e.slice(2)),t]}let MI=0;const tre=Promise.resolve(),nre=()=>MI||(tre.then(()=>MI=0),MI=Date.now());function ire(e,t){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;cl(ore(i,n.value),t,5,[i])};return n.value=e,n.attached=nre(),n}function ore(e,t){if(Yt(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(i=>o=>!o._stopped&&i&&i(o))}else return t}const b3=/^on[a-z]/,rre=(e,t,n,i,o=!1,r,s,a,c)=>{t==="class"?$oe(e,i,o):t==="style"?Yoe(e,n,i):Nv(t)?cN(t)||Zoe(e,t,n,i,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):sre(e,t,i,o))?Joe(e,t,i,r,s,a,c):(t==="true-value"?e._trueValue=i:t==="false-value"&&(e._falseValue=i),Koe(e,t,i,o))};function sre(e,t,n,i){return i?!!(t==="innerHTML"||t==="textContent"||t in e&&b3.test(t)&&En(n)):t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||b3.test(t)&&_i(n)?!1:t in e}const fh="transition",eA="animation",S0=(e,{slots:t})=>qv(a9,O9(e),t);S0.displayName="Transition";const P9={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},are=S0.props=gs({},a9.props,P9),fm=(e,t=[])=>{Yt(e)?e.forEach(n=>n(...t)):e&&e(...t)},C3=e=>e?Yt(e)?e.some(t=>t.length>1):e.length>1:!1;function O9(e){const t={};for(const I in e)I in P9||(t[I]=e[I]);if(e.css===!1)return t;const{name:n="v",type:i,duration:o,enterFromClass:r=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=r,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,p=cre(o),y=p&&p[0],b=p&&p[1],{onBeforeEnter:C,onEnter:E,onEnterCancelled:w,onLeave:S,onLeaveCancelled:P,onBeforeAppear:L=C,onAppear:z=E,onAppearCancelled:R=w}=t,F=(I,_,v)=>{Mh(I,_?d:a),Mh(I,_?u:s),v&&v()},U=(I,_)=>{I._isLeaving=!1,Mh(I,h),Mh(I,g),Mh(I,m),_&&_()},D=I=>(_,v)=>{const O=I?z:E,N=()=>F(_,I,v);fm(O,[_,N]),T3(()=>{Mh(_,I?c:r),Xd(_,I?d:a),C3(O)||E3(_,i,y,N)})};return gs(t,{onBeforeEnter(I){fm(C,[I]),Xd(I,r),Xd(I,s)},onBeforeAppear(I){fm(L,[I]),Xd(I,c),Xd(I,u)},onEnter:D(!1),onAppear:D(!0),onLeave(I,_){I._isLeaving=!0;const v=()=>U(I,_);Xd(I,h),B9(),Xd(I,m),T3(()=>{I._isLeaving&&(Mh(I,h),Xd(I,g),C3(S)||E3(I,i,b,v))}),fm(S,[I,v])},onEnterCancelled(I){F(I,!1),fm(w,[I])},onAppearCancelled(I){F(I,!0),fm(R,[I])},onLeaveCancelled(I){U(I),fm(P,[I])}})}function cre(e){if(e==null)return null;if(Di(e))return[FI(e.enter),FI(e.leave)];{const t=FI(e);return[t,t]}}function FI(e){return dN(e)}function Xd(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e._vtc||(e._vtc=new Set)).add(t)}function Mh(e,t){t.split(/\s+/).forEach(i=>i&&e.classList.remove(i));const{_vtc:n}=e;n&&(n.delete(t),n.size||(e._vtc=void 0))}function T3(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let lre=0;function E3(e,t,n,i){const o=e._endId=++lre,r=()=>{o===e._endId&&i()};if(n)return setTimeout(r,n);const{type:s,timeout:a,propCount:c}=L9(e,t);if(!s)return i();const u=s+"end";let d=0;const h=()=>{e.removeEventListener(u,m),r()},m=g=>{g.target===e&&++d>=c&&h()};setTimeout(()=>{d<c&&h()},a+1),e.addEventListener(u,m)}function L9(e,t){const n=window.getComputedStyle(e),i=p=>(n[p]||"").split(", "),o=i(`${fh}Delay`),r=i(`${fh}Duration`),s=x3(o,r),a=i(`${eA}Delay`),c=i(`${eA}Duration`),u=x3(a,c);let d=null,h=0,m=0;t===fh?s>0&&(d=fh,h=s,m=r.length):t===eA?u>0&&(d=eA,h=u,m=c.length):(h=Math.max(s,u),d=h>0?s>u?fh:eA:null,m=d?d===fh?r.length:c.length:0);const g=d===fh&&/\b(transform|all)(,|$)/.test(i(`${fh}Property`).toString());return{type:d,timeout:h,propCount:m,hasTransform:g}}function x3(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,i)=>w3(n)+w3(e[i])))}function w3(e){return Number(e.slice(0,-1).replace(",","."))*1e3}function B9(){return document.body.offsetHeight}const R9=new WeakMap,N9=new WeakMap,ure={name:"TransitionGroup",props:gs({},are,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Lc(),i=s9();let o,r;return u9(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!mre(o[0].el,n.vnode.el,s))return;o.forEach(fre),o.forEach(hre);const a=o.filter(pre);B9(),a.forEach(c=>{const u=c.el,d=u.style;Xd(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const h=u._moveCb=m=>{m&&m.target!==u||(!m||/transform$/.test(m.propertyName))&&(u.removeEventListener("transitionend",h),u._moveCb=null,Mh(u,s))};u.addEventListener("transitionend",h)})}),()=>{const s=Ci(e),a=O9(s);let c=s.tag||Jo;o=r,r=t.default?EN(t.default()):[];for(let u=0;u<r.length;u++){const d=r[u];d.key!=null&&sC(d,rC(d,a,i,n))}if(o)for(let u=0;u<o.length;u++){const d=o[u];sC(d,rC(d,a,i,n)),R9.set(d,d.el.getBoundingClientRect())}return fn(c,null,r)}}},dre=ure;function fre(e){const t=e.el;t._moveCb&&t._moveCb(),t._enterCb&&t._enterCb()}function hre(e){N9.set(e,e.el.getBoundingClientRect())}function pre(e){const t=R9.get(e),n=N9.get(e),i=t.left-n.left,o=t.top-n.top;if(i||o){const r=e.el.style;return r.transform=r.webkitTransform=`translate(${i}px,${o}px)`,r.transitionDuration="0s",e}}function mre(e,t,n){const i=e.cloneNode();e._vtc&&e._vtc.forEach(s=>{s.split(/\s+/).forEach(a=>a&&i.classList.remove(a))}),n.split(/\s+/).forEach(s=>s&&i.classList.add(s)),i.style.display="none";const o=t.nodeType===1?t:t.parentNode;o.appendChild(i);const{hasTransform:r}=L9(i);return o.removeChild(i),r}const S3=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Yt(t)?n=>ww(t,n):t},xS={deep:!0,created(e,t,n){e._assign=S3(n),I9(e,"change",()=>{const i=e._modelValue,o=_re(e),r=e.checked,s=e._assign;if(Yt(i)){const a=S6(i,o),c=a!==-1;if(r&&!c)s(i.concat(o));else if(!r&&c){const u=[...i];u.splice(a,1),s(u)}}else if(Mv(i)){const a=new Set(i);r?a.add(o):a.delete(o),s(a)}else s(M9(e,r))})},mounted:v3,beforeUpdate(e,t,n){e._assign=S3(n),v3(e,t,n)}};function v3(e,{value:t,oldValue:n},i){e._modelValue=t,Yt(t)?e.checked=S6(t,i.props.value)>-1:Mv(t)?e.checked=t.has(i.props.value):t!==n&&(e.checked=Rv(t,M9(e,!0)))}function _re(e){return"_value"in e?e._value:e.value}function M9(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const gre=["ctrl","shift","alt","meta"],yre={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>gre.some(n=>e[`${n}Key`]&&!t.includes(n))},cc=(e,t)=>(n,...i)=>{for(let o=0;o<t.length;o++){const r=yre[t[o]];if(r&&r(n,t))return}return e(n,...i)},Are={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},by=(e,t)=>n=>{if(!("key"in n))return;const i=G_(n.key);if(t.some(o=>o===i||Are[o]===i))return e(n)},u_={beforeMount(e,{value:t},{transition:n}){e._vod=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):tA(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:i}){!t!=!n&&(i?t?(i.beforeEnter(e),tA(e,!0),i.enter(e)):i.leave(e,()=>{tA(e,!1)}):tA(e,t))},beforeUnmount(e,{value:t}){tA(e,t)}};function tA(e,t){e.style.display=t?e._vod:"none"}const bre=gs({patchProp:rre},qoe);let D3;function F9(){return D3||(D3=Eoe(bre))}const wS=(...e)=>{F9().render(...e)},Cre=(...e)=>{const t=F9().createApp(...e),{mount:n}=t;return t.mount=i=>{const o=Tre(i);if(!o)return;const r=t._component;!En(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.innerHTML="";const s=n(o,!1,o instanceof SVGElement);return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t};function Tre(e){return _i(e)?document.querySelector(e):e}var Ere=!1;/*!
|
||
* pinia v2.0.28
|
||
* (c) 2022 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/const xre=Symbol();var I3;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(I3||(I3={}));function wre(){const e=aie(!0),t=e.run(()=>bn({}));let n=[],i=[];const o=yN({install(r){o._a=r,r.provide(xre,o),r.config.globalProperties.$pinia=o,i.forEach(s=>n.push(s)),i=[]},use(r){return!this._a&&!Ere?i.push(r):n.push(r),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}/*!
|
||
* vue-router v4.1.6
|
||
* (c) 2022 Eduardo San Martin Morote
|
||
* @license MIT
|
||
*/const iy=typeof window<"u";function Sre(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const eo=Object.assign;function zI(e,t){const n={};for(const i in t){const o=t[i];n[i]=uu(o)?o.map(e):e(o)}return n}const Ib=()=>{},uu=Array.isArray,vre=/\/$/,Dre=e=>e.replace(vre,"");function UI(e,t,n="/"){let i,o={},r="",s="";const a=t.indexOf("#");let c=t.indexOf("?");return a<c&&a>=0&&(c=-1),c>-1&&(i=t.slice(0,c),r=t.slice(c+1,a>-1?a:t.length),o=e(r)),a>-1&&(i=i||t.slice(0,a),s=t.slice(a,t.length)),i=Lre(i??t,n),{fullPath:i+(r&&"?")+r+s,path:i,query:o,hash:s}}function Ire(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function P3(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Pre(e,t,n){const i=t.matched.length-1,o=n.matched.length-1;return i>-1&&i===o&&n0(t.matched[i],n.matched[o])&&z9(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function n0(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function z9(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!Ore(e[n],t[n]))return!1;return!0}function Ore(e,t){return uu(e)?O3(e,t):uu(t)?O3(t,e):e===t}function O3(e,t){return uu(t)?e.length===t.length&&e.every((n,i)=>n===t[i]):e.length===1&&e[0]===t}function Lre(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),i=e.split("/");let o=n.length-1,r,s;for(r=0;r<i.length;r++)if(s=i[r],s!==".")if(s==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+i.slice(r-(r===i.length?1:0)).join("/")}var lC;(function(e){e.pop="pop",e.push="push"})(lC||(lC={}));var Pb;(function(e){e.back="back",e.forward="forward",e.unknown=""})(Pb||(Pb={}));function Bre(e){if(!e)if(iy){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Dre(e)}const Rre=/^[^#]+#/;function Nre(e,t){return e.replace(Rre,"#")+t}function Mre(e,t){const n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect();return{behavior:t.behavior,left:i.left-n.left-(t.left||0),top:i.top-n.top-(t.top||0)}}const $v=()=>({left:window.pageXOffset,top:window.pageYOffset});function Fre(e){let t;if("el"in e){const n=e.el,i=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?i?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=Mre(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.pageXOffset,t.top!=null?t.top:window.pageYOffset)}function L3(e,t){return(history.state?history.state.position-t:-1)+e}const zL=new Map;function zre(e,t){zL.set(e,t)}function Ure(e){const t=zL.get(e);return zL.delete(e),t}let Hre=()=>location.protocol+"//"+location.host;function U9(e,t){const{pathname:n,search:i,hash:o}=t,r=e.indexOf("#");if(r>-1){let a=o.includes(e.slice(r))?e.slice(r).length:1,c=o.slice(a);return c[0]!=="/"&&(c="/"+c),P3(c,"")}return P3(n,e)+i+o}function Vre(e,t,n,i){let o=[],r=[],s=null;const a=({state:m})=>{const g=U9(e,location),p=n.value,y=t.value;let b=0;if(m){if(n.value=g,t.value=m,s&&s===p){s=null;return}b=y?m.position-y.position:0}else i(g);o.forEach(C=>{C(n.value,p,{delta:b,type:lC.pop,direction:b?b>0?Pb.forward:Pb.back:Pb.unknown})})};function c(){s=n.value}function u(m){o.push(m);const g=()=>{const p=o.indexOf(m);p>-1&&o.splice(p,1)};return r.push(g),g}function d(){const{history:m}=window;m.state&&m.replaceState(eo({},m.state,{scroll:$v()}),"")}function h(){for(const m of r)m();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",d)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",d),{pauseListeners:c,listen:u,destroy:h}}function B3(e,t,n,i=!1,o=!1){return{back:e,current:t,forward:n,replaced:i,position:window.history.length,scroll:o?$v():null}}function kre(e){const{history:t,location:n}=window,i={value:U9(e,n)},o={value:t.state};o.value||r(i.value,{back:null,current:i.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(c,u,d){const h=e.indexOf("#"),m=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+c:Hre()+e+c;try{t[d?"replaceState":"pushState"](u,"",m),o.value=u}catch(g){console.error(g),n[d?"replace":"assign"](m)}}function s(c,u){const d=eo({},t.state,B3(o.value.back,c,o.value.forward,!0),u,{position:o.value.position});r(c,d,!0),i.value=c}function a(c,u){const d=eo({},o.value,t.state,{forward:c,scroll:$v()});r(d.current,d,!0);const h=eo({},B3(i.value,c,null),{position:d.position+1},u);r(c,h,!1),i.value=c}return{location:i,state:o,push:a,replace:s}}function Gre(e){e=Bre(e);const t=kre(e),n=Vre(e,t.state,t.location,t.replace);function i(r,s=!0){s||n.pauseListeners(),history.go(r)}const o=eo({location:"",base:e,go:i,createHref:Nre.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}function Wre(e){return typeof e=="string"||e&&typeof e=="object"}function H9(e){return typeof e=="string"||typeof e=="symbol"}const hh={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},V9=Symbol("");var R3;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(R3||(R3={}));function i0(e,t){return eo(new Error,{type:e,[V9]:!0},t)}function zd(e,t){return e instanceof Error&&V9 in e&&(t==null||!!(e.type&t))}const N3="[^/]+?",jre={sensitive:!1,strict:!1,start:!0,end:!0},qre=/[.+*?^${}()[\]/\\]/g;function $re(e,t){const n=eo({},jre,t),i=[];let o=n.start?"^":"";const r=[];for(const u of e){const d=u.length?[]:[90];n.strict&&!u.length&&(o+="/");for(let h=0;h<u.length;h++){const m=u[h];let g=40+(n.sensitive?.25:0);if(m.type===0)h||(o+="/"),o+=m.value.replace(qre,"\\$&"),g+=40;else if(m.type===1){const{value:p,repeatable:y,optional:b,regexp:C}=m;r.push({name:p,repeatable:y,optional:b});const E=C||N3;if(E!==N3){g+=10;try{new RegExp(`(${E})`)}catch(S){throw new Error(`Invalid custom RegExp for param "${p}" (${E}): `+S.message)}}let w=y?`((?:${E})(?:/(?:${E}))*)`:`(${E})`;h||(w=b&&u.length<2?`(?:/${w})`:"/"+w),b&&(w+="?"),o+=w,g+=20,b&&(g+=-8),y&&(g+=-20),E===".*"&&(g+=-50)}d.push(g)}i.push(d)}if(n.strict&&n.end){const u=i.length-1;i[u][i[u].length-1]+=.7000000000000001}n.strict||(o+="/?"),n.end?o+="$":n.strict&&(o+="(?:/|$)");const s=new RegExp(o,n.sensitive?"":"i");function a(u){const d=u.match(s),h={};if(!d)return null;for(let m=1;m<d.length;m++){const g=d[m]||"",p=r[m-1];h[p.name]=g&&p.repeatable?g.split("/"):g}return h}function c(u){let d="",h=!1;for(const m of e){(!h||!d.endsWith("/"))&&(d+="/"),h=!1;for(const g of m)if(g.type===0)d+=g.value;else if(g.type===1){const{value:p,repeatable:y,optional:b}=g,C=p in u?u[p]:"";if(uu(C)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const E=uu(C)?C.join("/"):C;if(!E)if(b)m.length<2&&(d.endsWith("/")?d=d.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);d+=E}}return d||"/"}return{re:s,score:i,keys:r,parse:a,stringify:c}}function Yre(e,t){let n=0;for(;n<e.length&&n<t.length;){const i=t[n]-e[n];if(i)return i;n++}return e.length<t.length?e.length===1&&e[0]===40+40?-1:1:e.length>t.length?t.length===1&&t[0]===40+40?1:-1:0}function Xre(e,t){let n=0;const i=e.score,o=t.score;for(;n<i.length&&n<o.length;){const r=Yre(i[n],o[n]);if(r)return r;n++}if(Math.abs(o.length-i.length)===1){if(M3(i))return 1;if(M3(o))return-1}return o.length-i.length}function M3(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Kre={type:0,value:""},Jre=/[a-zA-Z0-9_]/;function Qre(e){if(!e)return[[]];if(e==="/")return[[Kre]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(g){throw new Error(`ERR (${n})/"${u}": ${g}`)}let n=0,i=n;const o=[];let r;function s(){r&&o.push(r),r=[]}let a=0,c,u="",d="";function h(){u&&(n===0?r.push({type:0,value:u}):n===1||n===2||n===3?(r.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),r.push({type:1,value:u,regexp:d,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function m(){u+=c}for(;a<e.length;){if(c=e[a++],c==="\\"&&n!==2){i=n,n=4;continue}switch(n){case 0:c==="/"?(u&&h(),s()):c===":"?(h(),n=1):m();break;case 4:m(),n=i;break;case 1:c==="("?n=2:Jre.test(c)?m():(h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--);break;case 2:c===")"?d[d.length-1]=="\\"?d=d.slice(0,-1)+c:n=3:d+=c;break;case 3:h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--,d="";break;default:t("Unknown state");break}}return n===2&&t(`Unfinished custom RegExp for param "${u}"`),h(),s(),o}function Zre(e,t,n){const i=$re(Qre(e.path),n),o=eo(i,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function ese(e,t){const n=[],i=new Map;t=U3({strict:!1,end:!0,sensitive:!1},t);function o(d){return i.get(d)}function r(d,h,m){const g=!m,p=tse(d);p.aliasOf=m&&m.record;const y=U3(t,d),b=[p];if("alias"in d){const w=typeof d.alias=="string"?[d.alias]:d.alias;for(const S of w)b.push(eo({},p,{components:m?m.record.components:p.components,path:S,aliasOf:m?m.record:p}))}let C,E;for(const w of b){const{path:S}=w;if(h&&S[0]!=="/"){const P=h.record.path,L=P[P.length-1]==="/"?"":"/";w.path=h.record.path+(S&&L+S)}if(C=Zre(w,h,y),m?m.alias.push(C):(E=E||C,E!==C&&E.alias.push(C),g&&d.name&&!z3(C)&&s(d.name)),p.children){const P=p.children;for(let L=0;L<P.length;L++)r(P[L],C,m&&m.children[L])}m=m||C,(C.record.components&&Object.keys(C.record.components).length||C.record.name||C.record.redirect)&&c(C)}return E?()=>{s(E)}:Ib}function s(d){if(H9(d)){const h=i.get(d);h&&(i.delete(d),n.splice(n.indexOf(h),1),h.children.forEach(s),h.alias.forEach(s))}else{const h=n.indexOf(d);h>-1&&(n.splice(h,1),d.record.name&&i.delete(d.record.name),d.children.forEach(s),d.alias.forEach(s))}}function a(){return n}function c(d){let h=0;for(;h<n.length&&Xre(d,n[h])>=0&&(d.record.path!==n[h].record.path||!k9(d,n[h]));)h++;n.splice(h,0,d),d.record.name&&!z3(d)&&i.set(d.record.name,d)}function u(d,h){let m,g={},p,y;if("name"in d&&d.name){if(m=i.get(d.name),!m)throw i0(1,{location:d});y=m.record.name,g=eo(F3(h.params,m.keys.filter(E=>!E.optional).map(E=>E.name)),d.params&&F3(d.params,m.keys.map(E=>E.name))),p=m.stringify(g)}else if("path"in d)p=d.path,m=n.find(E=>E.re.test(p)),m&&(g=m.parse(p),y=m.record.name);else{if(m=h.name?i.get(h.name):n.find(E=>E.re.test(h.path)),!m)throw i0(1,{location:d,currentLocation:h});y=m.record.name,g=eo({},h.params,d.params),p=m.stringify(g)}const b=[];let C=m;for(;C;)b.unshift(C.record),C=C.parent;return{name:y,path:p,params:g,matched:b,meta:ise(b)}}return e.forEach(d=>r(d)),{addRoute:r,resolve:u,removeRoute:s,getRoutes:a,getRecordMatcher:o}}function F3(e,t){const n={};for(const i of t)i in e&&(n[i]=e[i]);return n}function tse(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:nse(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}}}function nse(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const i in e.components)t[i]=typeof n=="boolean"?n:n[i];return t}function z3(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function ise(e){return e.reduce((t,n)=>eo(t,n.meta),{})}function U3(e,t){const n={};for(const i in e)n[i]=i in t?t[i]:e[i];return n}function k9(e,t){return t.children.some(n=>n===e||k9(e,n))}const G9=/#/g,ose=/&/g,rse=/\//g,sse=/=/g,ase=/\?/g,W9=/\+/g,cse=/%5B/g,lse=/%5D/g,j9=/%5E/g,use=/%60/g,q9=/%7B/g,dse=/%7C/g,$9=/%7D/g,fse=/%20/g;function PN(e){return encodeURI(""+e).replace(dse,"|").replace(cse,"[").replace(lse,"]")}function hse(e){return PN(e).replace(q9,"{").replace($9,"}").replace(j9,"^")}function UL(e){return PN(e).replace(W9,"%2B").replace(fse,"+").replace(G9,"%23").replace(ose,"%26").replace(use,"`").replace(q9,"{").replace($9,"}").replace(j9,"^")}function pse(e){return UL(e).replace(sse,"%3D")}function mse(e){return PN(e).replace(G9,"%23").replace(ase,"%3F")}function _se(e){return e==null?"":mse(e).replace(rse,"%2F")}function SS(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function gse(e){const t={};if(e===""||e==="?")return t;const i=(e[0]==="?"?e.slice(1):e).split("&");for(let o=0;o<i.length;++o){const r=i[o].replace(W9," "),s=r.indexOf("="),a=SS(s<0?r:r.slice(0,s)),c=s<0?null:SS(r.slice(s+1));if(a in t){let u=t[a];uu(u)||(u=t[a]=[u]),u.push(c)}else t[a]=c}return t}function H3(e){let t="";for(let n in e){const i=e[n];if(n=pse(n),i==null){i!==void 0&&(t+=(t.length?"&":"")+n);continue}(uu(i)?i.map(r=>r&&UL(r)):[i&&UL(i)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function yse(e){const t={};for(const n in e){const i=e[n];i!==void 0&&(t[n]=uu(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}const Ase=Symbol(""),V3=Symbol(""),ON=Symbol(""),Y9=Symbol(""),HL=Symbol("");function nA(){let e=[];function t(i){return e.push(i),()=>{const o=e.indexOf(i);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e,reset:n}}function Wh(e,t,n,i,o){const r=i&&(i.enterCallbacks[o]=i.enterCallbacks[o]||[]);return()=>new Promise((s,a)=>{const c=h=>{h===!1?a(i0(4,{from:n,to:t})):h instanceof Error?a(h):Wre(h)?a(i0(2,{from:t,to:h})):(r&&i.enterCallbacks[o]===r&&typeof h=="function"&&r.push(h),s())},u=e.call(i&&i.instances[o],t,n,c);let d=Promise.resolve(u);e.length<3&&(d=d.then(c)),d.catch(h=>a(h))})}function HI(e,t,n,i){const o=[];for(const r of e)for(const s in r.components){let a=r.components[s];if(!(t!=="beforeRouteEnter"&&!r.instances[s]))if(bse(a)){const u=(a.__vccOpts||a)[t];u&&o.push(Wh(u,n,i,r,s))}else{let c=a();o.push(()=>c.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${s}" at "${r.path}"`));const d=Sre(u)?u.default:u;r.components[s]=d;const m=(d.__vccOpts||d)[t];return m&&Wh(m,n,i,r,s)()}))}}return o}function bse(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function k3(e){const t=er(ON),n=er(Y9),i=tt(()=>t.resolve(pe(e.to))),o=tt(()=>{const{matched:c}=i.value,{length:u}=c,d=c[u-1],h=n.matched;if(!d||!h.length)return-1;const m=h.findIndex(n0.bind(null,d));if(m>-1)return m;const g=G3(c[u-2]);return u>1&&G3(d)===g&&h[h.length-1].path!==g?h.findIndex(n0.bind(null,c[u-2])):m}),r=tt(()=>o.value>-1&&xse(n.params,i.value.params)),s=tt(()=>o.value>-1&&o.value===n.matched.length-1&&z9(n.params,i.value.params));function a(c={}){return Ese(c)?t[pe(e.replace)?"replace":"push"](pe(e.to)).catch(Ib):Promise.resolve()}return{route:i,href:tt(()=>i.value.href),isActive:r,isExactActive:s,navigate:a}}const Cse=ci({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:k3,setup(e,{slots:t}){const n=W_(k3(e)),{options:i}=er(ON),o=tt(()=>({[W3(e.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[W3(e.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const r=t.default&&t.default(n);return e.custom?r:qv("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},r)}}}),Tse=Cse;function Ese(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function xse(e,t){for(const n in t){const i=t[n],o=e[n];if(typeof i=="string"){if(i!==o)return!1}else if(!uu(o)||o.length!==i.length||i.some((r,s)=>r!==o[s]))return!1}return!0}function G3(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const W3=(e,t,n)=>e??t??n,wse=ci({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const i=er(HL),o=tt(()=>e.route||i.value),r=er(V3,0),s=tt(()=>{let u=pe(r);const{matched:d}=o.value;let h;for(;(h=d[u])&&!h.components;)u++;return u}),a=tt(()=>o.value.matched[s.value]);nd(V3,tt(()=>s.value+1)),nd(Ase,a),nd(HL,o);const c=bn();return to(()=>[c.value,a.value,e.name],([u,d,h],[m,g,p])=>{d&&(d.instances[h]=u,g&&g!==d&&u&&u===m&&(d.leaveGuards.size||(d.leaveGuards=g.leaveGuards),d.updateGuards.size||(d.updateGuards=g.updateGuards))),u&&d&&(!g||!n0(d,g)||!m)&&(d.enterCallbacks[h]||[]).forEach(y=>y(u))},{flush:"post"}),()=>{const u=o.value,d=e.name,h=a.value,m=h&&h.components[d];if(!m)return j3(n.default,{Component:m,route:u});const g=h.props[d],p=g?g===!0?u.params:typeof g=="function"?g(u):g:null,b=qv(m,eo({},p,t,{onVnodeUnmounted:C=>{C.component.isUnmounted&&(h.instances[d]=null)},ref:c}));return j3(n.default,{Component:b,route:u})||b}}});function j3(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const X9=wse;function Sse(e){const t=ese(e.routes,e),n=e.parseQuery||gse,i=e.stringifyQuery||H3,o=e.history,r=nA(),s=nA(),a=nA(),c=c_(hh);let u=hh;iy&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const d=zI.bind(null,X=>""+X),h=zI.bind(null,_se),m=zI.bind(null,SS);function g(X,$){let se,ue;return H9(X)?(se=t.getRecordMatcher(X),ue=$):ue=X,t.addRoute(ue,se)}function p(X){const $=t.getRecordMatcher(X);$&&t.removeRoute($)}function y(){return t.getRoutes().map(X=>X.record)}function b(X){return!!t.getRecordMatcher(X)}function C(X,$){if($=eo({},$||c.value),typeof X=="string"){const Q=UI(n,X,$.path),ne=t.resolve({path:Q.path},$),de=o.createHref(Q.fullPath);return eo(Q,ne,{params:m(ne.params),hash:SS(Q.hash),redirectedFrom:void 0,href:de})}let se;if("path"in X)se=eo({},X,{path:UI(n,X.path,$.path).path});else{const Q=eo({},X.params);for(const ne in Q)Q[ne]==null&&delete Q[ne];se=eo({},X,{params:h(X.params)}),$.params=h($.params)}const ue=t.resolve(se,$),re=X.hash||"";ue.params=d(m(ue.params));const he=Ire(i,eo({},X,{hash:hse(re),path:ue.path})),ce=o.createHref(he);return eo({fullPath:he,hash:re,query:i===H3?yse(X.query):X.query||{}},ue,{redirectedFrom:void 0,href:ce})}function E(X){return typeof X=="string"?UI(n,X,c.value.path):eo({},X)}function w(X,$){if(u!==X)return i0(8,{from:$,to:X})}function S(X){return z(X)}function P(X){return S(eo(E(X),{replace:!0}))}function L(X){const $=X.matched[X.matched.length-1];if($&&$.redirect){const{redirect:se}=$;let ue=typeof se=="function"?se(X):se;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=E(ue):{path:ue},ue.params={}),eo({query:X.query,hash:X.hash,params:"path"in ue?{}:X.params},ue)}}function z(X,$){const se=u=C(X),ue=c.value,re=X.state,he=X.force,ce=X.replace===!0,Q=L(se);if(Q)return z(eo(E(Q),{state:typeof Q=="object"?eo({},re,Q.state):re,force:he,replace:ce}),$||se);const ne=se;ne.redirectedFrom=$;let de;return!he&&Pre(i,ue,se)&&(de=i0(16,{to:ne,from:ue}),W(ue,ue,!0,!1)),(de?Promise.resolve(de):F(ne,ue)).catch(_e=>zd(_e)?zd(_e,2)?_e:G(_e):V(_e,ne,ue)).then(_e=>{if(_e){if(zd(_e,2))return z(eo({replace:ce},E(_e.to),{state:typeof _e.to=="object"?eo({},re,_e.to.state):re,force:he}),$||ne)}else _e=D(ne,ue,!0,ce,re);return U(ne,ue,_e),_e})}function R(X,$){const se=w(X,$);return se?Promise.reject(se):Promise.resolve()}function F(X,$){let se;const[ue,re,he]=vse(X,$);se=HI(ue.reverse(),"beforeRouteLeave",X,$);for(const Q of ue)Q.leaveGuards.forEach(ne=>{se.push(Wh(ne,X,$))});const ce=R.bind(null,X,$);return se.push(ce),Cg(se).then(()=>{se=[];for(const Q of r.list())se.push(Wh(Q,X,$));return se.push(ce),Cg(se)}).then(()=>{se=HI(re,"beforeRouteUpdate",X,$);for(const Q of re)Q.updateGuards.forEach(ne=>{se.push(Wh(ne,X,$))});return se.push(ce),Cg(se)}).then(()=>{se=[];for(const Q of X.matched)if(Q.beforeEnter&&!$.matched.includes(Q))if(uu(Q.beforeEnter))for(const ne of Q.beforeEnter)se.push(Wh(ne,X,$));else se.push(Wh(Q.beforeEnter,X,$));return se.push(ce),Cg(se)}).then(()=>(X.matched.forEach(Q=>Q.enterCallbacks={}),se=HI(he,"beforeRouteEnter",X,$),se.push(ce),Cg(se))).then(()=>{se=[];for(const Q of s.list())se.push(Wh(Q,X,$));return se.push(ce),Cg(se)}).catch(Q=>zd(Q,8)?Q:Promise.reject(Q))}function U(X,$,se){for(const ue of a.list())ue(X,$,se)}function D(X,$,se,ue,re){const he=w(X,$);if(he)return he;const ce=$===hh,Q=iy?history.state:{};se&&(ue||ce?o.replace(X.fullPath,eo({scroll:ce&&Q&&Q.scroll},re)):o.push(X.fullPath,re)),c.value=X,W(X,$,se,ce),G()}let I;function _(){I||(I=o.listen((X,$,se)=>{if(!Y.listening)return;const ue=C(X),re=L(ue);if(re){z(eo(re,{replace:!0}),ue).catch(Ib);return}u=ue;const he=c.value;iy&&zre(L3(he.fullPath,se.delta),$v()),F(ue,he).catch(ce=>zd(ce,12)?ce:zd(ce,2)?(z(ce.to,ue).then(Q=>{zd(Q,20)&&!se.delta&&se.type===lC.pop&&o.go(-1,!1)}).catch(Ib),Promise.reject()):(se.delta&&o.go(-se.delta,!1),V(ce,ue,he))).then(ce=>{ce=ce||D(ue,he,!1),ce&&(se.delta&&!zd(ce,8)?o.go(-se.delta,!1):se.type===lC.pop&&zd(ce,20)&&o.go(-1,!1)),U(ue,he,ce)}).catch(Ib)}))}let v=nA(),O=nA(),N;function V(X,$,se){G(X);const ue=O.list();return ue.length?ue.forEach(re=>re(X,$,se)):console.error(X),Promise.reject(X)}function k(){return N&&c.value!==hh?Promise.resolve():new Promise((X,$)=>{v.add([X,$])})}function G(X){return N||(N=!X,_(),v.list().forEach(([$,se])=>X?se(X):$()),v.reset()),X}function W(X,$,se,ue){const{scrollBehavior:re}=e;if(!iy||!re)return Promise.resolve();const he=!se&&Ure(L3(X.fullPath,0))||(ue||!se)&&history.state&&history.state.scroll||null;return us().then(()=>re(X,$,he)).then(ce=>ce&&Fre(ce)).catch(ce=>V(ce,X,$))}const K=X=>o.go(X);let q;const te=new Set,Y={currentRoute:c,listening:!0,addRoute:g,removeRoute:p,hasRoute:b,getRoutes:y,resolve:C,options:e,push:S,replace:P,go:K,back:()=>K(-1),forward:()=>K(1),beforeEach:r.add,beforeResolve:s.add,afterEach:a.add,onError:O.add,isReady:k,install(X){const $=this;X.component("RouterLink",Tse),X.component("RouterView",X9),X.config.globalProperties.$router=$,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>pe(c)}),iy&&!q&&c.value===hh&&(q=!0,S(o.location).catch(re=>{}));const se={};for(const re in hh)se[re]=tt(()=>c.value[re]);X.provide(ON,$),X.provide(Y9,W_(se)),X.provide(HL,c);const ue=X.unmount;te.add(X),X.unmount=function(){te.delete(X),te.size<1&&(u=hh,I&&I(),I=null,c.value=hh,q=!1,N=!1),ue()}}};return Y}function Cg(e){return e.reduce((t,n)=>t.then(()=>n()),Promise.resolve())}function vse(e,t){const n=[],i=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let s=0;s<r;s++){const a=t.matched[s];a&&(e.matched.find(u=>n0(u,a))?i.push(a):n.push(a));const c=e.matched[s];c&&(t.matched.find(u=>n0(u,c))||o.push(c))}return[n,i,o]}const Dse=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},Ise={__name:"App",setup(e){return(t,n)=>(qe(),Dn(pe(X9)))}},Pse=Dse(Ise,[["__scopeId","data-v-0969e94e"]]);var Ose=typeof global=="object"&&global&&global.Object===Object&&global;const K9=Ose;var Lse=typeof self=="object"&&self&&self.Object===Object&&self,Bse=K9||Lse||Function("return this")();const Vf=Bse;var Rse=Vf.Symbol;const ld=Rse;var J9=Object.prototype,Nse=J9.hasOwnProperty,Mse=J9.toString,iA=ld?ld.toStringTag:void 0;function Fse(e){var t=Nse.call(e,iA),n=e[iA];try{e[iA]=void 0;var i=!0}catch{}var o=Mse.call(e);return i&&(t?e[iA]=n:delete e[iA]),o}var zse=Object.prototype,Use=zse.toString;function Hse(e){return Use.call(e)}var Vse="[object Null]",kse="[object Undefined]",q3=ld?ld.toStringTag:void 0;function v0(e){return e==null?e===void 0?kse:Vse:q3&&q3 in Object(e)?Fse(e):Hse(e)}function o0(e){return e!=null&&typeof e=="object"}var Gse="[object Symbol]";function LN(e){return typeof e=="symbol"||o0(e)&&v0(e)==Gse}function Wse(e,t){for(var n=-1,i=e==null?0:e.length,o=Array(i);++n<i;)o[n]=t(e[n],n,e);return o}var jse=Array.isArray;const Df=jse;var qse=1/0,$3=ld?ld.prototype:void 0,Y3=$3?$3.toString:void 0;function Q9(e){if(typeof e=="string")return e;if(Df(e))return Wse(e,Q9)+"";if(LN(e))return Y3?Y3.call(e):"";var t=e+"";return t=="0"&&1/e==-qse?"-0":t}function vS(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function $se(e){return e}var Yse="[object AsyncFunction]",Xse="[object Function]",Kse="[object GeneratorFunction]",Jse="[object Proxy]";function Z9(e){if(!vS(e))return!1;var t=v0(e);return t==Xse||t==Kse||t==Yse||t==Jse}var Qse=Vf["__core-js_shared__"];const VI=Qse;var X3=function(){var e=/[^.]+$/.exec(VI&&VI.keys&&VI.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Zse(e){return!!X3&&X3 in e}var eae=Function.prototype,tae=eae.toString;function j_(e){if(e!=null){try{return tae.call(e)}catch{}try{return e+""}catch{}}return""}var nae=/[\\^$.*+?()[\]{}|]/g,iae=/^\[object .+?Constructor\]$/,oae=Function.prototype,rae=Object.prototype,sae=oae.toString,aae=rae.hasOwnProperty,cae=RegExp("^"+sae.call(aae).replace(nae,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function lae(e){if(!vS(e)||Zse(e))return!1;var t=Z9(e)?cae:iae;return t.test(j_(e))}function uae(e,t){return e==null?void 0:e[t]}function q_(e,t){var n=uae(e,t);return lae(n)?n:void 0}var dae=q_(Vf,"WeakMap");const VL=dae;function fae(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var hae=800,pae=16,mae=Date.now;function _ae(e){var t=0,n=0;return function(){var i=mae(),o=pae-(i-n);if(n=i,o>0){if(++t>=hae)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function gae(e){return function(){return e}}var yae=function(){try{var e=q_(Object,"defineProperty");return e({},"",{}),e}catch{}}();const DS=yae;var Aae=DS?function(e,t){return DS(e,"toString",{configurable:!0,enumerable:!1,value:gae(t),writable:!0})}:$se;const bae=Aae;var Cae=_ae(bae);const Tae=Cae;var Eae=9007199254740991,xae=/^(?:0|[1-9]\d*)$/;function BN(e,t){var n=typeof e;return t=t??Eae,!!t&&(n=="number"||n!="symbol"&&xae.test(e))&&e>-1&&e%1==0&&e<t}function wae(e,t,n){t=="__proto__"&&DS?DS(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function RN(e,t){return e===t||e!==e&&t!==t}var Sae=Object.prototype,vae=Sae.hasOwnProperty;function Dae(e,t,n){var i=e[t];(!(vae.call(e,t)&&RN(i,n))||n===void 0&&!(t in e))&&wae(e,t,n)}var K3=Math.max;function Iae(e,t,n){return t=K3(t===void 0?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=K3(i.length-t,0),s=Array(r);++o<r;)s[o]=i[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=i[o];return a[t]=n(s),fae(e,this,a)}}var Pae=9007199254740991;function NN(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Pae}function Oae(e){return e!=null&&NN(e.length)&&!Z9(e)}var Lae=Object.prototype;function Bae(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Lae;return e===n}function Rae(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}var Nae="[object Arguments]";function J3(e){return o0(e)&&v0(e)==Nae}var eW=Object.prototype,Mae=eW.hasOwnProperty,Fae=eW.propertyIsEnumerable,zae=J3(function(){return arguments}())?J3:function(e){return o0(e)&&Mae.call(e,"callee")&&!Fae.call(e,"callee")};const MN=zae;function Uae(){return!1}var tW=typeof ff=="object"&&ff&&!ff.nodeType&&ff,Q3=tW&&typeof hf=="object"&&hf&&!hf.nodeType&&hf,Hae=Q3&&Q3.exports===tW,Z3=Hae?Vf.Buffer:void 0,Vae=Z3?Z3.isBuffer:void 0,kae=Vae||Uae;const kL=kae;var Gae="[object Arguments]",Wae="[object Array]",jae="[object Boolean]",qae="[object Date]",$ae="[object Error]",Yae="[object Function]",Xae="[object Map]",Kae="[object Number]",Jae="[object Object]",Qae="[object RegExp]",Zae="[object Set]",ece="[object String]",tce="[object WeakMap]",nce="[object ArrayBuffer]",ice="[object DataView]",oce="[object Float32Array]",rce="[object Float64Array]",sce="[object Int8Array]",ace="[object Int16Array]",cce="[object Int32Array]",lce="[object Uint8Array]",uce="[object Uint8ClampedArray]",dce="[object Uint16Array]",fce="[object Uint32Array]",Co={};Co[oce]=Co[rce]=Co[sce]=Co[ace]=Co[cce]=Co[lce]=Co[uce]=Co[dce]=Co[fce]=!0;Co[Gae]=Co[Wae]=Co[nce]=Co[jae]=Co[ice]=Co[qae]=Co[$ae]=Co[Yae]=Co[Xae]=Co[Kae]=Co[Jae]=Co[Qae]=Co[Zae]=Co[ece]=Co[tce]=!1;function hce(e){return o0(e)&&NN(e.length)&&!!Co[v0(e)]}function pce(e){return function(t){return e(t)}}var nW=typeof ff=="object"&&ff&&!ff.nodeType&&ff,Ob=nW&&typeof hf=="object"&&hf&&!hf.nodeType&&hf,mce=Ob&&Ob.exports===nW,kI=mce&&K9.process,_ce=function(){try{var e=Ob&&Ob.require&&Ob.require("util").types;return e||kI&&kI.binding&&kI.binding("util")}catch{}}();const ez=_ce;var tz=ez&&ez.isTypedArray,gce=tz?pce(tz):hce;const iW=gce;var yce=Object.prototype,Ace=yce.hasOwnProperty;function bce(e,t){var n=Df(e),i=!n&&MN(e),o=!n&&!i&&kL(e),r=!n&&!i&&!o&&iW(e),s=n||i||o||r,a=s?Rae(e.length,String):[],c=a.length;for(var u in e)(t||Ace.call(e,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||r&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||BN(u,c)))&&a.push(u);return a}function Cce(e,t){return function(n){return e(t(n))}}var Tce=Cce(Object.keys,Object);const Ece=Tce;var xce=Object.prototype,wce=xce.hasOwnProperty;function Sce(e){if(!Bae(e))return Ece(e);var t=[];for(var n in Object(e))wce.call(e,n)&&n!="constructor"&&t.push(n);return t}function vce(e){return Oae(e)?bce(e):Sce(e)}var Dce=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ice=/^\w*$/;function Pce(e,t){if(Df(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||LN(e)?!0:Ice.test(e)||!Dce.test(e)||t!=null&&e in Object(t)}var Oce=q_(Object,"create");const uC=Oce;function Lce(){this.__data__=uC?uC(null):{},this.size=0}function Bce(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Rce="__lodash_hash_undefined__",Nce=Object.prototype,Mce=Nce.hasOwnProperty;function Fce(e){var t=this.__data__;if(uC){var n=t[e];return n===Rce?void 0:n}return Mce.call(t,e)?t[e]:void 0}var zce=Object.prototype,Uce=zce.hasOwnProperty;function Hce(e){var t=this.__data__;return uC?t[e]!==void 0:Uce.call(t,e)}var Vce="__lodash_hash_undefined__";function kce(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=uC&&t===void 0?Vce:t,this}function C_(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}C_.prototype.clear=Lce;C_.prototype.delete=Bce;C_.prototype.get=Fce;C_.prototype.has=Hce;C_.prototype.set=kce;function Gce(){this.__data__=[],this.size=0}function Yv(e,t){for(var n=e.length;n--;)if(RN(e[n][0],t))return n;return-1}var Wce=Array.prototype,jce=Wce.splice;function qce(e){var t=this.__data__,n=Yv(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():jce.call(t,n,1),--this.size,!0}function $ce(e){var t=this.__data__,n=Yv(t,e);return n<0?void 0:t[n][1]}function Yce(e){return Yv(this.__data__,e)>-1}function Xce(e,t){var n=this.__data__,i=Yv(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}function kf(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}kf.prototype.clear=Gce;kf.prototype.delete=qce;kf.prototype.get=$ce;kf.prototype.has=Yce;kf.prototype.set=Xce;var Kce=q_(Vf,"Map");const dC=Kce;function Jce(){this.size=0,this.__data__={hash:new C_,map:new(dC||kf),string:new C_}}function Qce(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Xv(e,t){var n=e.__data__;return Qce(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Zce(e){var t=Xv(this,e).delete(e);return this.size-=t?1:0,t}function ele(e){return Xv(this,e).get(e)}function tle(e){return Xv(this,e).has(e)}function nle(e,t){var n=Xv(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}function Gf(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Gf.prototype.clear=Jce;Gf.prototype.delete=Zce;Gf.prototype.get=ele;Gf.prototype.has=tle;Gf.prototype.set=nle;var ile="Expected a function";function FN(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(ile);var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var s=e.apply(this,i);return n.cache=r.set(o,s)||r,s};return n.cache=new(FN.Cache||Gf),n}FN.Cache=Gf;var ole=500;function rle(e){var t=FN(e,function(i){return n.size===ole&&n.clear(),i}),n=t.cache;return t}var sle=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ale=/\\(\\)?/g,cle=rle(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(sle,function(n,i,o,r){t.push(o?r.replace(ale,"$1"):i||n)}),t});const lle=cle;function ule(e){return e==null?"":Q9(e)}function Kv(e,t){return Df(e)?e:Pce(e,t)?[e]:lle(ule(e))}var dle=1/0;function zN(e){if(typeof e=="string"||LN(e))return e;var t=e+"";return t=="0"&&1/e==-dle?"-0":t}function oW(e,t){t=Kv(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[zN(t[n++])];return n&&n==i?e:void 0}function fle(e,t,n){var i=e==null?void 0:oW(e,t);return i===void 0?n:i}function rW(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var nz=ld?ld.isConcatSpreadable:void 0;function hle(e){return Df(e)||MN(e)||!!(nz&&e&&e[nz])}function sW(e,t,n,i,o){var r=-1,s=e.length;for(n||(n=hle),o||(o=[]);++r<s;){var a=e[r];t>0&&n(a)?t>1?sW(a,t-1,n,i,o):rW(o,a):i||(o[o.length]=a)}return o}function ple(e){var t=e==null?0:e.length;return t?sW(e,1):[]}function mle(e){return Tae(Iae(e,void 0,ple),e+"")}function _le(){this.__data__=new kf,this.size=0}function gle(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function yle(e){return this.__data__.get(e)}function Ale(e){return this.__data__.has(e)}var ble=200;function Cle(e,t){var n=this.__data__;if(n instanceof kf){var i=n.__data__;if(!dC||i.length<ble-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gf(i)}return n.set(e,t),this.size=n.size,this}function lp(e){var t=this.__data__=new kf(e);this.size=t.size}lp.prototype.clear=_le;lp.prototype.delete=gle;lp.prototype.get=yle;lp.prototype.has=Ale;lp.prototype.set=Cle;function Tle(e,t){for(var n=-1,i=e==null?0:e.length,o=0,r=[];++n<i;){var s=e[n];t(s,n,e)&&(r[o++]=s)}return r}function Ele(){return[]}var xle=Object.prototype,wle=xle.propertyIsEnumerable,iz=Object.getOwnPropertySymbols,Sle=iz?function(e){return e==null?[]:(e=Object(e),Tle(iz(e),function(t){return wle.call(e,t)}))}:Ele;const vle=Sle;function Dle(e,t,n){var i=t(e);return Df(e)?i:rW(i,n(e))}function oz(e){return Dle(e,vce,vle)}var Ile=q_(Vf,"DataView");const GL=Ile;var Ple=q_(Vf,"Promise");const WL=Ple;var Ole=q_(Vf,"Set");const jL=Ole;var rz="[object Map]",Lle="[object Object]",sz="[object Promise]",az="[object Set]",cz="[object WeakMap]",lz="[object DataView]",Ble=j_(GL),Rle=j_(dC),Nle=j_(WL),Mle=j_(jL),Fle=j_(VL),Hm=v0;(GL&&Hm(new GL(new ArrayBuffer(1)))!=lz||dC&&Hm(new dC)!=rz||WL&&Hm(WL.resolve())!=sz||jL&&Hm(new jL)!=az||VL&&Hm(new VL)!=cz)&&(Hm=function(e){var t=v0(e),n=t==Lle?e.constructor:void 0,i=n?j_(n):"";if(i)switch(i){case Ble:return lz;case Rle:return rz;case Nle:return sz;case Mle:return az;case Fle:return cz}return t});const uz=Hm;var zle=Vf.Uint8Array;const dz=zle;var Ule="__lodash_hash_undefined__";function Hle(e){return this.__data__.set(e,Ule),this}function Vle(e){return this.__data__.has(e)}function IS(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Gf;++t<n;)this.add(e[t])}IS.prototype.add=IS.prototype.push=Hle;IS.prototype.has=Vle;function kle(e,t){for(var n=-1,i=e==null?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function Gle(e,t){return e.has(t)}var Wle=1,jle=2;function aW(e,t,n,i,o,r){var s=n&Wle,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=r.get(e),d=r.get(t);if(u&&d)return u==t&&d==e;var h=-1,m=!0,g=n&jle?new IS:void 0;for(r.set(e,t),r.set(t,e);++h<a;){var p=e[h],y=t[h];if(i)var b=s?i(y,p,h,t,e,r):i(p,y,h,e,t,r);if(b!==void 0){if(b)continue;m=!1;break}if(g){if(!kle(t,function(C,E){if(!Gle(g,E)&&(p===C||o(p,C,n,i,r)))return g.push(E)})){m=!1;break}}else if(!(p===y||o(p,y,n,i,r))){m=!1;break}}return r.delete(e),r.delete(t),m}function qle(e){var t=-1,n=Array(e.size);return e.forEach(function(i,o){n[++t]=[o,i]}),n}function $le(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var Yle=1,Xle=2,Kle="[object Boolean]",Jle="[object Date]",Qle="[object Error]",Zle="[object Map]",eue="[object Number]",tue="[object RegExp]",nue="[object Set]",iue="[object String]",oue="[object Symbol]",rue="[object ArrayBuffer]",sue="[object DataView]",fz=ld?ld.prototype:void 0,GI=fz?fz.valueOf:void 0;function aue(e,t,n,i,o,r,s){switch(n){case sue:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rue:return!(e.byteLength!=t.byteLength||!r(new dz(e),new dz(t)));case Kle:case Jle:case eue:return RN(+e,+t);case Qle:return e.name==t.name&&e.message==t.message;case tue:case iue:return e==t+"";case Zle:var a=qle;case nue:var c=i&Yle;if(a||(a=$le),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;i|=Xle,s.set(e,t);var d=aW(a(e),a(t),i,o,r,s);return s.delete(e),d;case oue:if(GI)return GI.call(e)==GI.call(t)}return!1}var cue=1,lue=Object.prototype,uue=lue.hasOwnProperty;function due(e,t,n,i,o,r){var s=n&cue,a=oz(e),c=a.length,u=oz(t),d=u.length;if(c!=d&&!s)return!1;for(var h=c;h--;){var m=a[h];if(!(s?m in t:uue.call(t,m)))return!1}var g=r.get(e),p=r.get(t);if(g&&p)return g==t&&p==e;var y=!0;r.set(e,t),r.set(t,e);for(var b=s;++h<c;){m=a[h];var C=e[m],E=t[m];if(i)var w=s?i(E,C,m,t,e,r):i(C,E,m,e,t,r);if(!(w===void 0?C===E||o(C,E,n,i,r):w)){y=!1;break}b||(b=m=="constructor")}if(y&&!b){var S=e.constructor,P=t.constructor;S!=P&&"constructor"in e&&"constructor"in t&&!(typeof S=="function"&&S instanceof S&&typeof P=="function"&&P instanceof P)&&(y=!1)}return r.delete(e),r.delete(t),y}var fue=1,hz="[object Arguments]",pz="[object Array]",fE="[object Object]",hue=Object.prototype,mz=hue.hasOwnProperty;function pue(e,t,n,i,o,r){var s=Df(e),a=Df(t),c=s?pz:uz(e),u=a?pz:uz(t);c=c==hz?fE:c,u=u==hz?fE:u;var d=c==fE,h=u==fE,m=c==u;if(m&&kL(e)){if(!kL(t))return!1;s=!0,d=!1}if(m&&!d)return r||(r=new lp),s||iW(e)?aW(e,t,n,i,o,r):aue(e,t,c,n,i,o,r);if(!(n&fue)){var g=d&&mz.call(e,"__wrapped__"),p=h&&mz.call(t,"__wrapped__");if(g||p){var y=g?e.value():e,b=p?t.value():t;return r||(r=new lp),o(y,b,n,i,r)}}return m?(r||(r=new lp),due(e,t,n,i,o,r)):!1}function cW(e,t,n,i,o){return e===t?!0:e==null||t==null||!o0(e)&&!o0(t)?e!==e&&t!==t:pue(e,t,n,i,cW,o)}function mue(e,t){return e!=null&&t in Object(e)}function _ue(e,t,n){t=Kv(t,e);for(var i=-1,o=t.length,r=!1;++i<o;){var s=zN(t[i]);if(!(r=e!=null&&n(e,s)))break;e=e[s]}return r||++i!=o?r:(o=e==null?0:e.length,!!o&&NN(o)&&BN(s,o)&&(Df(e)||MN(e)))}function gue(e,t){return e!=null&&_ue(e,t,mue)}function lW(e){for(var t=-1,n=e==null?0:e.length,i={};++t<n;){var o=e[t];i[o[0]]=o[1]}return i}function yue(e,t){return cW(e,t)}function Jv(e){return e==null}function Aue(e,t,n,i){if(!vS(e))return e;t=Kv(t,e);for(var o=-1,r=t.length,s=r-1,a=e;a!=null&&++o<r;){var c=zN(t[o]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var d=a[c];u=i?i(d,c,a):void 0,u===void 0&&(u=vS(d)?d:BN(t[o+1])?[]:{})}Dae(a,c,u),a=a[c]}return e}function bue(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var s=t[i],a=oW(e,s);n(a,s)&&Aue(r,Kv(s,e),a)}return r}function Cue(e,t){return bue(e,t,function(n,i){return gue(e,i)})}var Tue=mle(function(e,t){return e==null?{}:Cue(e,t)});const Eue=Tue,xue='a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])',wue=e=>getComputedStyle(e).position==="fixed"?!1:e.offsetParent!==null,_z=e=>Array.from(e.querySelectorAll(xue)).filter(t=>Sue(t)&&wue(t)),Sue=e=>{if(e.tabIndex>0||e.tabIndex===0&&e.getAttribute("tabIndex")!==null)return!0;if(e.disabled)return!1;switch(e.nodeName){case"A":return!!e.href&&e.rel!=="ignore";case"INPUT":return!(e.type==="hidden"||e.type==="file");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;default:return!1}};var gz;const Cc=typeof window<"u",vue=e=>typeof e<"u",PS=e=>typeof e=="boolean",Due=e=>typeof e=="function",wp=e=>typeof e=="number",Iue=e=>typeof e=="string",Pue=()=>{};Cc&&((gz=window==null?void 0:window.navigator)!=null&&gz.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function uW(e){return typeof e=="function"?e():pe(e)}function Oue(e){return e}function UN(e){return lie()?(L6(e),!0):!1}function Lue(e,t=!0){Lc()?Oc(e):t?e():us(e)}function qL(e,t,n={}){const{immediate:i=!0}=n,o=bn(!1);let r=null;function s(){r&&(clearTimeout(r),r=null)}function a(){o.value=!1,s()}function c(...u){s(),o.value=!0,r=setTimeout(()=>{o.value=!1,r=null,e(...u)},uW(t))}return i&&(o.value=!0,Cc&&c()),UN(a),{isPending:o,start:c,stop:a}}function dW(e){var t;const n=uW(e);return(t=n==null?void 0:n.$el)!=null?t:n}const fW=Cc?window:void 0;function Bue(...e){let t,n,i,o;if(Iue(e[0])||Array.isArray(e[0])?([n,i,o]=e,t=fW):[t,n,i,o]=e,!t)return Pue;Array.isArray(n)||(n=[n]),Array.isArray(i)||(i=[i]);const r=[],s=()=>{r.forEach(d=>d()),r.length=0},a=(d,h,m)=>(d.addEventListener(h,m,o),()=>d.removeEventListener(h,m,o)),c=to(()=>dW(t),d=>{s(),d&&r.push(...n.flatMap(h=>i.map(m=>a(d,h,m))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return UN(u),u}function Rue(e,t=!1){const n=bn(),i=()=>n.value=Boolean(e());return i(),Lue(i,t),n}function Nue(e){return JSON.parse(JSON.stringify(e))}const $L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},YL="__vueuse_ssr_handlers__";$L[YL]=$L[YL]||{};$L[YL];var yz=Object.getOwnPropertySymbols,Mue=Object.prototype.hasOwnProperty,Fue=Object.prototype.propertyIsEnumerable,zue=(e,t)=>{var n={};for(var i in e)Mue.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&yz)for(var i of yz(e))t.indexOf(i)<0&&Fue.call(e,i)&&(n[i]=e[i]);return n};function hW(e,t,n={}){const i=n,{window:o=fW}=i,r=zue(i,["window"]);let s;const a=Rue(()=>o&&"ResizeObserver"in o),c=()=>{s&&(s.disconnect(),s=void 0)},u=to(()=>dW(e),h=>{c(),a.value&&o&&h&&(s=new ResizeObserver(t),s.observe(h,r))},{immediate:!0,flush:"post"}),d=()=>{c(),u()};return UN(d),{isSupported:a,stop:d}}var Az;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(Az||(Az={}));var Uue=Object.defineProperty,bz=Object.getOwnPropertySymbols,Hue=Object.prototype.hasOwnProperty,Vue=Object.prototype.propertyIsEnumerable,Cz=(e,t,n)=>t in e?Uue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kue=(e,t)=>{for(var n in t||(t={}))Hue.call(t,n)&&Cz(e,n,t[n]);if(bz)for(var n of bz(t))Vue.call(t,n)&&Cz(e,n,t[n]);return e};const Gue={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};kue({linear:Oue},Gue);function Wue(e,t,n,i={}){var o,r,s;const{clone:a=!1,passive:c=!1,eventName:u,deep:d=!1,defaultValue:h}=i,m=Lc(),g=n||(m==null?void 0:m.emit)||((o=m==null?void 0:m.$emit)==null?void 0:o.bind(m))||((s=(r=m==null?void 0:m.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(m==null?void 0:m.proxy));let p=u;t||(t="modelValue"),p=u||p||`update:${t.toString()}`;const y=C=>a?Due(a)?a(C):Nue(C):C,b=()=>vue(e[t])?y(e[t]):h;if(c){const C=b(),E=bn(C);return to(()=>e[t],w=>E.value=y(w)),to(E,w=>{(w!==e[t]||d)&&g(p,w)},{deep:d}),E}else return tt({get(){return b()},set(C){g(p,C)}})}const fC=e=>e===void 0,XL=e=>typeof Element>"u"?!1:e instanceof Element,jue=e=>_i(e)?!Number.isNaN(Number(e)):!1,Tz=e=>Object.keys(e),que=e=>Object.entries(e);class $ue extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function Qv(e,t){throw new $ue(`[${e}] ${t}`)}const pW=(e="")=>e.split(" ").filter(t=>!!t.trim()),Ez=(e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)},Yue=(e,t)=>{!e||!t.trim()||e.classList.add(...pW(t))},Xue=(e,t)=>{!e||!t.trim()||e.classList.remove(...pW(t))},Kue=(e,t)=>{var n;if(!Cc||!e||!t)return"";let i=lu(t);i==="float"&&(i="cssFloat");try{const o=e.style[i];if(o)return o;const r=(n=document.defaultView)==null?void 0:n.getComputedStyle(e,"");return r?r[i]:""}catch{return e.style[i]}};function hC(e,t="px"){if(!e)return"";if(wp(e)||jue(e))return`${e}${t}`;if(_i(e))return e}let hE;const Jue=e=>{var t;if(!Cc)return 0;if(hE!==void 0)return hE;const n=document.createElement("div");n.className=`${e}-scrollbar__wrap`,n.style.visibility="hidden",n.style.width="100px",n.style.position="absolute",n.style.top="-9999px",document.body.appendChild(n);const i=n.offsetWidth;n.style.overflow="scroll";const o=document.createElement("div");o.style.width="100%",n.appendChild(o);const r=o.offsetWidth;return(t=n.parentNode)==null||t.removeChild(n),hE=i-r,hE};/*! Element Plus Icons Vue v2.0.10 */var Ka=(e,t)=>{let n=e.__vccOpts||e;for(let[i,o]of t)n[i]=o;return n},Que={name:"Check"},Zue={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},ede=Vt("path",{fill:"currentColor",d:"M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"},null,-1),tde=[ede];function nde(e,t,n,i,o,r){return qe(),Dt("svg",Zue,tde)}var mW=Ka(Que,[["render",nde],["__file","check.vue"]]),ide={name:"CircleCheck"},ode={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},rde=Vt("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),sde=Vt("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"},null,-1),ade=[rde,sde];function cde(e,t,n,i,o,r){return qe(),Dt("svg",ode,ade)}var HN=Ka(ide,[["render",cde],["__file","circle-check.vue"]]),lde={name:"CircleCloseFilled"},ude={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},dde=Vt("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"},null,-1),fde=[dde];function hde(e,t,n,i,o,r){return qe(),Dt("svg",ude,fde)}var _W=Ka(lde,[["render",hde],["__file","circle-close-filled.vue"]]),pde={name:"CircleClose"},mde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},_de=Vt("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"},null,-1),gde=Vt("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),yde=[_de,gde];function Ade(e,t,n,i,o,r){return qe(),Dt("svg",mde,yde)}var VN=Ka(pde,[["render",Ade],["__file","circle-close.vue"]]),bde={name:"Close"},Cde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Tde=Vt("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"},null,-1),Ede=[Tde];function xde(e,t,n,i,o,r){return qe(),Dt("svg",Cde,Ede)}var Zv=Ka(bde,[["render",xde],["__file","close.vue"]]),wde={name:"Delete"},Sde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},vde=Vt("path",{fill:"currentColor",d:"M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"},null,-1),Dde=[vde];function Ide(e,t,n,i,o,r){return qe(),Dt("svg",Sde,Dde)}var Pde=Ka(wde,[["render",Ide],["__file","delete.vue"]]),Ode={name:"Document"},Lde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Bde=Vt("path",{fill:"currentColor",d:"M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"},null,-1),Rde=[Bde];function Nde(e,t,n,i,o,r){return qe(),Dt("svg",Lde,Rde)}var Mde=Ka(Ode,[["render",Nde],["__file","document.vue"]]),Fde={name:"Hide"},zde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ude=Vt("path",{d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z",fill:"currentColor"},null,-1),Hde=Vt("path",{d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z",fill:"currentColor"},null,-1),Vde=[Ude,Hde];function kde(e,t,n,i,o,r){return qe(),Dt("svg",zde,Vde)}var Gde=Ka(Fde,[["render",kde],["__file","hide.vue"]]),Wde={name:"InfoFilled"},jde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},qde=Vt("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"},null,-1),$de=[qde];function Yde(e,t,n,i,o,r){return qe(),Dt("svg",jde,$de)}var gW=Ka(Wde,[["render",Yde],["__file","info-filled.vue"]]),Xde={name:"Loading"},Kde={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Jde=Vt("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"},null,-1),Qde=[Jde];function Zde(e,t,n,i,o,r){return qe(),Dt("svg",Kde,Qde)}var yW=Ka(Xde,[["render",Zde],["__file","loading.vue"]]),efe={name:"SuccessFilled"},tfe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},nfe=Vt("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"},null,-1),ife=[nfe];function ofe(e,t,n,i,o,r){return qe(),Dt("svg",tfe,ife)}var AW=Ka(efe,[["render",ofe],["__file","success-filled.vue"]]),rfe={name:"View"},sfe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},afe=Vt("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),cfe=[afe];function lfe(e,t,n,i,o,r){return qe(),Dt("svg",sfe,cfe)}var ufe=Ka(rfe,[["render",lfe],["__file","view.vue"]]),dfe={name:"WarningFilled"},ffe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},hfe=Vt("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"},null,-1),pfe=[hfe];function mfe(e,t,n,i,o,r){return qe(),Dt("svg",ffe,pfe)}var kN=Ka(dfe,[["render",mfe],["__file","warning-filled.vue"]]),_fe={name:"ZoomIn"},gfe={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},yfe=Vt("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704zm-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64h96z"},null,-1),Afe=[yfe];function bfe(e,t,n,i,o,r){return qe(),Dt("svg",gfe,Afe)}var Cfe=Ka(_fe,[["render",bfe],["__file","zoom-in.vue"]]);const bW="__epPropKey",Qn=e=>e,Tfe=e=>Di(e)&&!!e[bW],CW=(e,t)=>{if(!Di(e)||Tfe(e))return e;const{values:n,required:i,default:o,type:r,validator:s}=e,c={type:r,required:!!i,validator:n||s?u=>{let d=!1,h=[];if(n&&(h=Array.from(n),oi(e,"default")&&h.push(o),d||(d=h.includes(u))),s&&(d||(d=s(u))),!d&&h.length>0){const m=[...new Set(h)].map(g=>JSON.stringify(g)).join(", ");Uie(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${m}], got value ${JSON.stringify(u)}.`)}return d}:void 0,[bW]:!0};return oi(e,"default")&&(c.default=o),c},bs=e=>lW(Object.entries(e).map(([t,n])=>[t,CW(n,t)])),r0=Qn([String,Object,Function]),TW={Close:Zv,SuccessFilled:AW,InfoFilled:gW,WarningFilled:kN,CircleCloseFilled:_W},OS={success:AW,warning:kN,error:_W,info:gW},Efe={validating:yW,success:HN,error:VN},Wf=(e,t)=>{if(e.install=n=>{for(const i of[e,...Object.values(t??{})])n.component(i.name,i)},t)for(const[n,i]of Object.entries(t))e[n]=i;return e},xfe=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),GN=e=>(e.install=Bi,e),eD={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},If="update:modelValue",EW=["","default","small","large"],wfe=e=>["",...EW].includes(e);var vw=(e=>(e[e.TEXT=1]="TEXT",e[e.CLASS=2]="CLASS",e[e.STYLE=4]="STYLE",e[e.PROPS=8]="PROPS",e[e.FULL_PROPS=16]="FULL_PROPS",e[e.HYDRATE_EVENTS=32]="HYDRATE_EVENTS",e[e.STABLE_FRAGMENT=64]="STABLE_FRAGMENT",e[e.KEYED_FRAGMENT=128]="KEYED_FRAGMENT",e[e.UNKEYED_FRAGMENT=256]="UNKEYED_FRAGMENT",e[e.NEED_PATCH=512]="NEED_PATCH",e[e.DYNAMIC_SLOTS=1024]="DYNAMIC_SLOTS",e[e.HOISTED=-1]="HOISTED",e[e.BAIL=-2]="BAIL",e))(vw||{});const Sfe=e=>/([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(e),pC=e=>e,vfe=["class","style"],Dfe=/^on[A-Z]/,Ife=(e={})=>{const{excludeListeners:t=!1,excludeKeys:n}=e,i=tt(()=>((n==null?void 0:n.value)||[]).concat(vfe)),o=Lc();return tt(o?()=>{var r;return lW(Object.entries((r=o.proxy)==null?void 0:r.$attrs).filter(([s])=>!i.value.includes(s)&&!(t&&Dfe.test(s))))}:()=>({}))},xW=Symbol("buttonGroupContextKey"),D0=Symbol("checkboxGroupContextKey"),wW=Symbol(),WN=Symbol("formContextKey"),SW=Symbol("formItemContextKey"),Pfe=Symbol("rowContextKey"),vW=Symbol("uploadContextKey"),DW=e=>{const t=Lc();return tt(()=>{var n,i;return(i=((n=t.proxy)==null?void 0:n.$props)[e])!=null?i:void 0})},LS=bn();function jp(e,t=void 0){const n=Lc()?er(wW,LS):LS;return e?tt(()=>{var i,o;return(o=(i=n.value)==null?void 0:i[e])!=null?o:t}):n}const Ofe=(e,t,n=!1)=>{var i;const o=!!Lc(),r=o?jp():void 0,s=(i=t==null?void 0:t.provide)!=null?i:o?nd:void 0;if(!s)return;const a=tt(()=>{const c=pe(e);return r!=null&&r.value?Lfe(r.value,c):c});return s(wW,a),(n||!LS.value)&&(LS.value=a.value),a},Lfe=(e,t)=>{var n;const i=[...new Set([...Tz(e),...Tz(t)])],o={};for(const r of i)o[r]=(n=t[r])!=null?n:e[r];return o},cT=CW({type:String,values:EW,required:!1}),mC=(e,t={})=>{const n=bn(void 0),i=t.prop?n:DW("size"),o=t.global?n:jp("size"),r=t.form?{size:void 0}:er(WN,void 0),s=t.formItem?{size:void 0}:er(SW,void 0);return tt(()=>i.value||pe(e)||(s==null?void 0:s.size)||(r==null?void 0:r.size)||o.value||"")},qp=e=>{const t=DW("disabled"),n=er(WN,void 0);return tt(()=>t.value||pe(e)||(n==null?void 0:n.disabled)||!1)},KL=({from:e,replacement:t,scope:n,version:i,ref:o,type:r="API"},s)=>{to(()=>pe(s),a=>{},{immediate:!0})},Bfe=(e,t,n)=>{let i={offsetX:0,offsetY:0};const o=a=>{const c=a.clientX,u=a.clientY,{offsetX:d,offsetY:h}=i,m=e.value.getBoundingClientRect(),g=m.left,p=m.top,y=m.width,b=m.height,C=document.documentElement.clientWidth,E=document.documentElement.clientHeight,w=-g+d,S=-p+h,P=C-g-y+d,L=E-p-b+h,z=F=>{const U=Math.min(Math.max(d+F.clientX-c,w),P),D=Math.min(Math.max(h+F.clientY-u,S),L);i={offsetX:U,offsetY:D},e.value.style.transform=`translate(${hC(U)}, ${hC(D)})`},R=()=>{document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",R)};document.addEventListener("mousemove",z),document.addEventListener("mouseup",R)},r=()=>{t.value&&e.value&&t.value.addEventListener("mousedown",o)},s=()=>{t.value&&e.value&&t.value.removeEventListener("mousedown",o)};Oc(()=>{Qie(()=>{n.value?r():s()})}),Wp(()=>{s()})},jN="el",Rfe="is-",hm=(e,t,n,i,o)=>{let r=`${e}-${t}`;return n&&(r+=`-${n}`),i&&(r+=`__${i}`),o&&(r+=`--${o}`),r},dr=e=>{const t=jp("namespace",jN);return{namespace:t,b:(p="")=>hm(t.value,e,p,"",""),e:p=>p?hm(t.value,e,"",p,""):"",m:p=>p?hm(t.value,e,"","",p):"",be:(p,y)=>p&&y?hm(t.value,e,p,y,""):"",em:(p,y)=>p&&y?hm(t.value,e,"",p,y):"",bm:(p,y)=>p&&y?hm(t.value,e,p,"",y):"",bem:(p,y,b)=>p&&y&&b?hm(t.value,e,p,y,b):"",is:(p,...y)=>{const b=y.length>=1?y[0]:!0;return p&&b?`${Rfe}${p}`:""},cssVar:p=>{const y={};for(const b in p)p[b]&&(y[`--${t.value}-${b}`]=p[b]);return y},cssVarName:p=>`--${t.value}-${p}`,cssVarBlock:p=>{const y={};for(const b in p)p[b]&&(y[`--${t.value}-${e}-${b}`]=p[b]);return y},cssVarBlockName:p=>`--${t.value}-${e}-${p}`}},xz={prefix:Math.floor(Math.random()*1e4),current:0},Nfe=Symbol("elIdInjection"),Mfe=()=>Lc()?er(Nfe,xz):xz,_C=e=>{const t=Mfe(),n=jp("namespace",jN);return tt(()=>pe(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},lT=()=>{const e=er(WN,void 0),t=er(SW,void 0);return{form:e,formItem:t}},qN=(e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:i})=>{n||(n=bn(!1)),i||(i=bn(!1));const o=bn();let r;const s=tt(()=>{var a;return!!(!e.label&&t&&t.inputIds&&((a=t.inputIds)==null?void 0:a.length)<=1)});return Oc(()=>{r=to([e0(e,"id"),n],([a,c])=>{const u=a??(c?void 0:_C().value);u!==o.value&&(t!=null&&t.removeInputId&&(o.value&&t.removeInputId(o.value),!(i!=null&&i.value)&&!c&&u&&t.addInputId(u)),o.value=u)},{immediate:!0})}),xN(()=>{r&&r(),t!=null&&t.removeInputId&&o.value&&t.removeInputId(o.value)}),{isLabeledByFormItem:s,inputId:o}};var Ffe={name:"en",el:{colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"}}};const zfe=e=>(t,n)=>Ufe(t,n,pe(e)),Ufe=(e,t,n)=>fle(n,e,e).replace(/\{(\w+)\}/g,(i,o)=>{var r;return`${(r=t==null?void 0:t[o])!=null?r:`{${o}}`}`}),Hfe=e=>{const t=tt(()=>pe(e).name),n=So(e)?e:bn(e);return{lang:t,locale:n,t:zfe(e)}},$N=()=>{const e=jp("locale");return Hfe(tt(()=>e.value||Ffe))},IW=e=>{So(e)||Qv("[useLockscreen]","You need to pass a ref param to this function");const t=dr("popup"),n=Q6(()=>t.bm("parent","hidden"));if(!Cc||Ez(document.body,n.value))return;let i=0,o=!1,r="0";const s=()=>{setTimeout(()=>{Xue(document.body,n.value),o&&(document.body.style.width=r)},200)};to(e,a=>{if(!a){s();return}o=!Ez(document.body,n.value),o&&(r=document.body.style.width),i=Jue(t.namespace.value);const c=document.documentElement.clientHeight<document.body.scrollHeight,u=Kue(document.body,"overflowY");i>0&&(c||u==="scroll")&&o&&(document.body.style.width=`calc(100% - ${i}px)`),Yue(document.body,n.value)}),L6(()=>s())},Vfe=(e,t)=>{let n;to(()=>e.value,i=>{var o,r;i?(n=document.activeElement,So(t)&&((r=(o=t.value).focus)==null||r.call(o))):n.focus()})},PW=e=>{if(!e)return{onClick:Bi,onMousedown:Bi,onMouseup:Bi};let t=!1,n=!1;return{onClick:s=>{t&&n&&e(s),t=n=!1},onMousedown:s=>{t=s.target===s.currentTarget},onMouseup:s=>{n=s.target===s.currentTarget}}};let oy=[];const wz=e=>{const t=e;t.key===eD.esc&&oy.forEach(n=>n(t))},kfe=e=>{Oc(()=>{oy.length===0&&document.addEventListener("keydown",wz),Cc&&oy.push(e)}),Wp(()=>{oy=oy.filter(t=>t!==e),oy.length===0&&Cc&&document.removeEventListener("keydown",wz)})},Sz=bn(0),YN=()=>{const e=jp("zIndex",2e3),t=tt(()=>e.value+Sz.value);return{initialZIndex:e,currentZIndex:t,nextZIndex:()=>(Sz.value++,t.value)}};function Gfe(e){const t=bn();function n(){if(e.value==null)return;const{selectionStart:o,selectionEnd:r,value:s}=e.value;if(o==null||r==null)return;const a=s.slice(0,Math.max(0,o)),c=s.slice(Math.max(0,r));t.value={selectionStart:o,selectionEnd:r,value:s,beforeTxt:a,afterTxt:c}}function i(){if(e.value==null||t.value==null)return;const{value:o}=e.value,{beforeTxt:r,afterTxt:s,selectionStart:a}=t.value;if(r==null||s==null||a==null)return;let c=o.length;if(o.endsWith(s))c=o.length-s.length;else if(o.startsWith(r))c=r.length;else{const u=r[a-1],d=o.indexOf(u,a-1);d!==-1&&(c=d+1)}e.value.setSelectionRange(c,c)}return[n,i]}var Cs=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n};const Wfe=bs({size:{type:Qn([Number,String])},color:{type:String}}),jfe=ci({name:"ElIcon",inheritAttrs:!1}),qfe=ci({...jfe,props:Wfe,setup(e){const t=e,n=dr("icon"),i=tt(()=>{const{size:o,color:r}=t;return!o&&!r?{}:{fontSize:fC(o)?void 0:hC(o),"--color":r}});return(o,r)=>(qe(),Dt("i",cp({class:pe(n).b(),style:pe(i)},o.$attrs),[Zn(o.$slots,"default")],16))}});var $fe=Cs(qfe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const ss=Wf($fe);let Pl;const Yfe=`
|
||
height:0 !important;
|
||
visibility:hidden !important;
|
||
overflow:hidden !important;
|
||
position:absolute !important;
|
||
z-index:-1000 !important;
|
||
top:0 !important;
|
||
right:0 !important;
|
||
`,Xfe=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function Kfe(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),i=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),o=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width"));return{contextStyle:Xfe.map(s=>`${s}:${t.getPropertyValue(s)}`).join(";"),paddingSize:i,borderSize:o,boxSizing:n}}function vz(e,t=1,n){var i;Pl||(Pl=document.createElement("textarea"),document.body.appendChild(Pl));const{paddingSize:o,borderSize:r,boxSizing:s,contextStyle:a}=Kfe(e);Pl.setAttribute("style",`${a};${Yfe}`),Pl.value=e.value||e.placeholder||"";let c=Pl.scrollHeight;const u={};s==="border-box"?c=c+r:s==="content-box"&&(c=c-o),Pl.value="";const d=Pl.scrollHeight-o;if(wp(t)){let h=d*t;s==="border-box"&&(h=h+o+r),c=Math.max(h,c),u.minHeight=`${h}px`}if(wp(n)){let h=d*n;s==="border-box"&&(h=h+o+r),c=Math.min(h,c)}return u.height=`${c}px`,(i=Pl.parentNode)==null||i.removeChild(Pl),Pl=void 0,u}const Jfe=bs({id:{type:String,default:void 0},size:cT,disabled:Boolean,modelValue:{type:Qn([String,Number,Object]),default:""},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:Qn([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},suffixIcon:{type:r0},prefixIcon:{type:r0},containerRole:{type:String,default:void 0},label:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:Qn([Object,Array,String]),default:()=>pC({})}}),Qfe={[If]:e=>_i(e),input:e=>_i(e),change:e=>_i(e),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:()=>!0,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent},Zfe=["role"],ehe=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form"],the=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form"],nhe=ci({name:"ElInput",inheritAttrs:!1}),ihe=ci({...nhe,props:Jfe,emits:Qfe,setup(e,{expose:t,emit:n}){const i=e,o=Voe(),r=aT(),s=tt(()=>{const Ae={};return i.containerRole==="combobox"&&(Ae["aria-haspopup"]=o["aria-haspopup"],Ae["aria-owns"]=o["aria-owns"],Ae["aria-expanded"]=o["aria-expanded"]),Ae}),a=tt(()=>[i.type==="textarea"?b.b():y.b(),y.m(g.value),y.is("disabled",p.value),y.is("exceed",K.value),{[y.b("group")]:r.prepend||r.append,[y.bm("group","append")]:r.append,[y.bm("group","prepend")]:r.prepend,[y.m("prefix")]:r.prefix||i.prefixIcon,[y.m("suffix")]:r.suffix||i.suffixIcon||i.clearable||i.showPassword,[y.bm("suffix","password-clear")]:V.value&&k.value},o.class]),c=tt(()=>[y.e("wrapper"),y.is("focus",w.value)]),u=Ife({excludeKeys:tt(()=>Object.keys(s.value))}),{form:d,formItem:h}=lT(),{inputId:m}=qN(i,{formItemContext:h}),g=mC(),p=qp(),y=dr("input"),b=dr("textarea"),C=c_(),E=c_(),w=bn(!1),S=bn(!1),P=bn(!1),L=bn(!1),z=bn(),R=c_(i.inputStyle),F=tt(()=>C.value||E.value),U=tt(()=>{var Ae;return(Ae=d==null?void 0:d.statusIcon)!=null?Ae:!1}),D=tt(()=>(h==null?void 0:h.validateState)||""),I=tt(()=>D.value&&Efe[D.value]),_=tt(()=>L.value?ufe:Gde),v=tt(()=>[o.style,i.inputStyle]),O=tt(()=>[i.inputStyle,R.value,{resize:i.resize}]),N=tt(()=>Jv(i.modelValue)?"":String(i.modelValue)),V=tt(()=>i.clearable&&!p.value&&!i.readonly&&!!N.value&&(w.value||S.value)),k=tt(()=>i.showPassword&&!p.value&&!i.readonly&&!!N.value&&(!!N.value||w.value)),G=tt(()=>i.showWordLimit&&!!u.value.maxlength&&(i.type==="text"||i.type==="textarea")&&!p.value&&!i.readonly&&!i.showPassword),W=tt(()=>Array.from(N.value).length),K=tt(()=>!!G.value&&W.value>Number(u.value.maxlength)),q=tt(()=>!!r.suffix||!!i.suffixIcon||V.value||i.showPassword||G.value||!!D.value&&U.value),[te,Y]=Gfe(C);hW(E,Ae=>{if(!G.value||i.resize!=="both")return;const xe=Ae[0],{width:Oe}=xe.contentRect;z.value={right:`calc(100% - ${Oe+15+6}px)`}});const X=()=>{const{type:Ae,autosize:xe}=i;if(!(!Cc||Ae!=="textarea"))if(xe){const Oe=Di(xe)?xe.minRows:void 0,Ve=Di(xe)?xe.maxRows:void 0;R.value={...vz(E.value,Oe,Ve)}}else R.value={minHeight:vz(E.value).minHeight}},$=()=>{const Ae=F.value;!Ae||Ae.value===N.value||(Ae.value=N.value)},se=async Ae=>{te();let{value:xe}=Ae.target;if(i.formatter&&(xe=i.parser?i.parser(xe):xe,xe=i.formatter(xe)),!P.value){if(xe===N.value){$();return}n(If,xe),n("input",xe),await us(),$(),Y()}},ue=Ae=>{n("change",Ae.target.value)},re=Ae=>{n("compositionstart",Ae),P.value=!0},he=Ae=>{var xe;n("compositionupdate",Ae);const Oe=(xe=Ae.target)==null?void 0:xe.value,Ve=Oe[Oe.length-1]||"";P.value=!Sfe(Ve)},ce=Ae=>{n("compositionend",Ae),P.value&&(P.value=!1,se(Ae))},Q=()=>{L.value=!L.value,ne()},ne=async()=>{var Ae;await us(),(Ae=F.value)==null||Ae.focus()},de=()=>{var Ae;return(Ae=F.value)==null?void 0:Ae.blur()},_e=Ae=>{w.value=!0,n("focus",Ae)},Se=Ae=>{var xe;w.value=!1,n("blur",Ae),i.validateEvent&&((xe=h==null?void 0:h.validate)==null||xe.call(h,"blur").catch(Oe=>void 0))},ve=Ae=>{S.value=!1,n("mouseleave",Ae)},Le=Ae=>{S.value=!0,n("mouseenter",Ae)},Ee=Ae=>{n("keydown",Ae)},Be=()=>{var Ae;(Ae=F.value)==null||Ae.select()},Pe=()=>{n(If,""),n("change",""),n("clear"),n("input","")};return to(()=>i.modelValue,()=>{var Ae;us(()=>X()),i.validateEvent&&((Ae=h==null?void 0:h.validate)==null||Ae.call(h,"change").catch(xe=>void 0))}),to(N,()=>$()),to(()=>i.type,async()=>{await us(),$(),X()}),Oc(()=>{!i.formatter&&i.parser,$(),us(X)}),t({input:C,textarea:E,ref:F,textareaStyle:O,autosize:e0(i,"autosize"),focus:ne,blur:de,select:Be,clear:Pe,resizeTextarea:X}),(Ae,xe)=>eu((qe(),Dt("div",cp(pe(s),{class:pe(a),style:pe(v),role:Ae.containerRole,onMouseenter:Le,onMouseleave:ve}),[Mt(" input "),Ae.type!=="textarea"?(qe(),Dt(Jo,{key:0},[Mt(" prepend slot "),Ae.$slots.prepend?(qe(),Dt("div",{key:0,class:st(pe(y).be("group","prepend"))},[Zn(Ae.$slots,"prepend")],2)):Mt("v-if",!0),Vt("div",{class:st(pe(c))},[Mt(" prefix slot "),Ae.$slots.prefix||Ae.prefixIcon?(qe(),Dt("span",{key:0,class:st(pe(y).e("prefix"))},[Vt("span",{class:st(pe(y).e("prefix-inner")),onClick:ne},[Zn(Ae.$slots,"prefix"),Ae.prefixIcon?(qe(),Dn(pe(ss),{key:0,class:st(pe(y).e("icon"))},{default:an(()=>[(qe(),Dn(Ia(Ae.prefixIcon)))]),_:1},8,["class"])):Mt("v-if",!0)],2)],2)):Mt("v-if",!0),Vt("input",cp({id:pe(m),ref_key:"input",ref:C,class:pe(y).e("inner")},pe(u),{type:Ae.showPassword?L.value?"text":"password":Ae.type,disabled:pe(p),formatter:Ae.formatter,parser:Ae.parser,readonly:Ae.readonly,autocomplete:Ae.autocomplete,tabindex:Ae.tabindex,"aria-label":Ae.label,placeholder:Ae.placeholder,style:Ae.inputStyle,form:i.form,onCompositionstart:re,onCompositionupdate:he,onCompositionend:ce,onInput:se,onFocus:_e,onBlur:Se,onChange:ue,onKeydown:Ee}),null,16,ehe),Mt(" suffix slot "),pe(q)?(qe(),Dt("span",{key:1,class:st(pe(y).e("suffix"))},[Vt("span",{class:st(pe(y).e("suffix-inner")),onClick:ne},[!pe(V)||!pe(k)||!pe(G)?(qe(),Dt(Jo,{key:0},[Zn(Ae.$slots,"suffix"),Ae.suffixIcon?(qe(),Dn(pe(ss),{key:0,class:st(pe(y).e("icon"))},{default:an(()=>[(qe(),Dn(Ia(Ae.suffixIcon)))]),_:1},8,["class"])):Mt("v-if",!0)],64)):Mt("v-if",!0),pe(V)?(qe(),Dn(pe(ss),{key:1,class:st([pe(y).e("icon"),pe(y).e("clear")]),onMousedown:cc(pe(Bi),["prevent"]),onClick:Pe},{default:an(()=>[fn(pe(VN))]),_:1},8,["class","onMousedown"])):Mt("v-if",!0),pe(k)?(qe(),Dn(pe(ss),{key:2,class:st([pe(y).e("icon"),pe(y).e("password")]),onClick:Q},{default:an(()=>[(qe(),Dn(Ia(pe(_))))]),_:1},8,["class"])):Mt("v-if",!0),pe(G)?(qe(),Dt("span",{key:3,class:st(pe(y).e("count"))},[Vt("span",{class:st(pe(y).e("count-inner"))},Pr(pe(W))+" / "+Pr(pe(u).maxlength),3)],2)):Mt("v-if",!0),pe(D)&&pe(I)&&pe(U)?(qe(),Dn(pe(ss),{key:4,class:st([pe(y).e("icon"),pe(y).e("validateIcon"),pe(y).is("loading",pe(D)==="validating")])},{default:an(()=>[(qe(),Dn(Ia(pe(I))))]),_:1},8,["class"])):Mt("v-if",!0)],2)],2)):Mt("v-if",!0)],2),Mt(" append slot "),Ae.$slots.append?(qe(),Dt("div",{key:1,class:st(pe(y).be("group","append"))},[Zn(Ae.$slots,"append")],2)):Mt("v-if",!0)],64)):(qe(),Dt(Jo,{key:1},[Mt(" textarea "),Vt("textarea",cp({id:pe(m),ref_key:"textarea",ref:E,class:pe(b).e("inner")},pe(u),{tabindex:Ae.tabindex,disabled:pe(p),readonly:Ae.readonly,autocomplete:Ae.autocomplete,style:pe(O),"aria-label":Ae.label,placeholder:Ae.placeholder,form:i.form,onCompositionstart:re,onCompositionupdate:he,onCompositionend:ce,onInput:se,onFocus:_e,onBlur:Se,onChange:ue,onKeydown:Ee}),null,16,the),pe(G)?(qe(),Dt("span",{key:0,style:Ds(z.value),class:st(pe(y).e("count"))},Pr(pe(W))+" / "+Pr(pe(u).maxlength),7)):Mt("v-if",!0)],64))],16,Zfe)),[[u_,Ae.type!=="hidden"]])}});var ohe=Cs(ihe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);const OW=Wf(ohe),WI="focus-trap.focus-after-trapped",jI="focus-trap.focus-after-released",rhe="focus-trap.focusout-prevented",Dz={cancelable:!0,bubbles:!1},she={cancelable:!0,bubbles:!1},Iz="focusAfterTrapped",Pz="focusAfterReleased",ahe=Symbol("elFocusTrap"),XN=bn(),tD=bn(0),KN=bn(0);let pE=0;const LW=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0||i===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t},Oz=(e,t)=>{for(const n of e)if(!che(n,t))return n},che=(e,t)=>{if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1},lhe=e=>{const t=LW(e),n=Oz(t,e),i=Oz(t.reverse(),e);return[n,i]},uhe=e=>e instanceof HTMLInputElement&&"select"in e,Fh=(e,t)=>{if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),KN.value=window.performance.now(),e!==n&&uhe(e)&&t&&e.select()}};function Lz(e,t){const n=[...e],i=e.indexOf(t);return i!==-1&&n.splice(i,1),n}const dhe=()=>{let e=[];return{push:i=>{const o=e[0];o&&i!==o&&o.pause(),e=Lz(e,i),e.unshift(i)},remove:i=>{var o,r;e=Lz(e,i),(r=(o=e[0])==null?void 0:o.resume)==null||r.call(o)}}},fhe=(e,t=!1)=>{const n=document.activeElement;for(const i of e)if(Fh(i,t),document.activeElement!==n)return},Bz=dhe(),hhe=()=>tD.value>KN.value,mE=()=>{XN.value="pointer",tD.value=window.performance.now()},Rz=()=>{XN.value="keyboard",tD.value=window.performance.now()},phe=()=>(Oc(()=>{pE===0&&(document.addEventListener("mousedown",mE),document.addEventListener("touchstart",mE),document.addEventListener("keydown",Rz)),pE++}),Wp(()=>{pE--,pE<=0&&(document.removeEventListener("mousedown",mE),document.removeEventListener("touchstart",mE),document.removeEventListener("keydown",Rz))}),{focusReason:XN,lastUserFocusTimestamp:tD,lastAutomatedFocusTimestamp:KN}),_E=e=>new CustomEvent(rhe,{...she,detail:e}),mhe=ci({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[Iz,Pz,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=bn();let i,o;const{focusReason:r}=phe();kfe(p=>{e.trapped&&!s.paused&&t("release-requested",p)});const s={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},a=p=>{if(!e.loop&&!e.trapped||s.paused)return;const{key:y,altKey:b,ctrlKey:C,metaKey:E,currentTarget:w,shiftKey:S}=p,{loop:P}=e,L=y===eD.tab&&!b&&!C&&!E,z=document.activeElement;if(L&&z){const R=w,[F,U]=lhe(R);if(F&&U){if(!S&&z===U){const I=_E({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||(p.preventDefault(),P&&Fh(F,!0))}else if(S&&[F,R].includes(z)){const I=_E({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||(p.preventDefault(),P&&Fh(U,!0))}}else if(z===R){const I=_E({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||p.preventDefault()}}};nd(ahe,{focusTrapRef:n,onKeydown:a}),to(()=>e.focusTrapEl,p=>{p&&(n.value=p)},{immediate:!0}),to([n],([p],[y])=>{p&&(p.addEventListener("keydown",a),p.addEventListener("focusin",d),p.addEventListener("focusout",h)),y&&(y.removeEventListener("keydown",a),y.removeEventListener("focusin",d),y.removeEventListener("focusout",h))});const c=p=>{t(Iz,p)},u=p=>t(Pz,p),d=p=>{const y=pe(n);if(!y)return;const b=p.target,C=p.relatedTarget,E=b&&y.contains(b);e.trapped||C&&y.contains(C)||(i=C),E&&t("focusin",p),!s.paused&&e.trapped&&(E?o=b:Fh(o,!0))},h=p=>{const y=pe(n);if(!(s.paused||!y))if(e.trapped){const b=p.relatedTarget;!Jv(b)&&!y.contains(b)&&setTimeout(()=>{if(!s.paused&&e.trapped){const C=_E({focusReason:r.value});t("focusout-prevented",C),C.defaultPrevented||Fh(o,!0)}},0)}else{const b=p.target;b&&y.contains(b)||t("focusout",p)}};async function m(){await us();const p=pe(n);if(p){Bz.push(s);const y=p.contains(document.activeElement)?i:document.activeElement;if(i=y,!p.contains(y)){const C=new Event(WI,Dz);p.addEventListener(WI,c),p.dispatchEvent(C),C.defaultPrevented||us(()=>{let E=e.focusStartEl;_i(E)||(Fh(E),document.activeElement!==E&&(E="first")),E==="first"&&fhe(LW(p),!0),(document.activeElement===y||E==="container")&&Fh(p)})}}}function g(){const p=pe(n);if(p){p.removeEventListener(WI,c);const y=new CustomEvent(jI,{...Dz,detail:{focusReason:r.value}});p.addEventListener(jI,u),p.dispatchEvent(y),!y.defaultPrevented&&(r.value=="keyboard"||!hhe())&&Fh(i??document.body),p.removeEventListener(jI,c),Bz.remove(s)}}return Oc(()=>{e.trapped&&m(),to(()=>e.trapped,p=>{p?m():g()})}),Wp(()=>{e.trapped&&g()}),{onKeydown:a}}});function _he(e,t,n,i,o,r){return Zn(e.$slots,"default",{handleKeydown:e.onKeydown})}var BW=Cs(mhe,[["render",_he],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const ghe=bs({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"}}),yhe=["textContent"],Ahe=ci({name:"ElBadge"}),bhe=ci({...Ahe,props:ghe,setup(e,{expose:t}){const n=e,i=dr("badge"),o=tt(()=>n.isDot?"":wp(n.value)&&wp(n.max)?n.max<n.value?`${n.max}+`:`${n.value}`:`${n.value}`);return t({content:o}),(r,s)=>(qe(),Dt("div",{class:st(pe(i).b())},[Zn(r.$slots,"default"),fn(S0,{name:`${pe(i).namespace.value}-zoom-in-center`,persisted:""},{default:an(()=>[eu(Vt("sup",{class:st([pe(i).e("content"),pe(i).em("content",r.type),pe(i).is("fixed",!!r.$slots.default),pe(i).is("dot",r.isDot)]),textContent:Pr(pe(o))},null,10,yhe),[[u_,!r.hidden&&(pe(o)||r.isDot)]])]),_:1},8,["name"])],2))}});var Che=Cs(bhe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const The=Wf(Che),Ehe=(e,t)=>{KL({from:"type.text",replacement:"link",version:"3.0.0",scope:"props",ref:"https://element-plus.org/en-US/component/button.html#button-attributes"},tt(()=>e.type==="text"));const n=er(xW,void 0),i=jp("button"),{form:o}=lT(),r=mC(tt(()=>n==null?void 0:n.size)),s=qp(),a=bn(),c=aT(),u=tt(()=>e.type||(n==null?void 0:n.type)||""),d=tt(()=>{var g,p,y;return(y=(p=e.autoInsertSpace)!=null?p:(g=i.value)==null?void 0:g.autoInsertSpace)!=null?y:!1}),h=tt(()=>{var g;const p=(g=c.default)==null?void 0:g.call(c);if(d.value&&(p==null?void 0:p.length)===1){const y=p[0];if((y==null?void 0:y.type)===sT){const b=y.children;return/^\p{Unified_Ideograph}{2}$/u.test(b.trim())}}return!1});return{_disabled:s,_size:r,_type:u,_ref:a,shouldAddSpace:h,handleClick:g=>{e.nativeType==="reset"&&(o==null||o.resetFields()),t("click",g)}}},xhe=["default","primary","success","warning","info","danger","text",""],whe=["button","submit","reset"],JL=bs({size:cT,disabled:Boolean,type:{type:String,values:xhe,default:""},icon:{type:r0},nativeType:{type:String,values:whe,default:"button"},loading:Boolean,loadingIcon:{type:r0,default:()=>yW},plain:Boolean,text:Boolean,link:Boolean,bg:Boolean,autofocus:Boolean,round:Boolean,circle:Boolean,color:String,dark:Boolean,autoInsertSpace:{type:Boolean,default:void 0}}),She={click:e=>e instanceof MouseEvent};function Ls(e,t){vhe(e)&&(e="100%");var n=Dhe(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(t===360?e=(e<0?e%t+t:e%t)/parseFloat(String(t)):e=e%t/parseFloat(String(t)),e)}function gE(e){return Math.min(1,Math.max(0,e))}function vhe(e){return typeof e=="string"&&e.indexOf(".")!==-1&&parseFloat(e)===1}function Dhe(e){return typeof e=="string"&&e.indexOf("%")!==-1}function RW(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function yE(e){return e<=1?"".concat(Number(e)*100,"%"):e}function Zm(e){return e.length===1?"0"+e:String(e)}function Ihe(e,t,n){return{r:Ls(e,255)*255,g:Ls(t,255)*255,b:Ls(n,255)*255}}function Nz(e,t,n){e=Ls(e,255),t=Ls(t,255),n=Ls(n,255);var i=Math.max(e,t,n),o=Math.min(e,t,n),r=0,s=0,a=(i+o)/2;if(i===o)s=0,r=0;else{var c=i-o;switch(s=a>.5?c/(2-i-o):c/(i+o),i){case e:r=(t-n)/c+(t<n?6:0);break;case t:r=(n-e)/c+2;break;case n:r=(e-t)/c+4;break}r/=6}return{h:r,s,l:a}}function qI(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Phe(e,t,n){var i,o,r;if(e=Ls(e,360),t=Ls(t,100),n=Ls(n,100),t===0)o=n,r=n,i=n;else{var s=n<.5?n*(1+t):n+t-n*t,a=2*n-s;i=qI(a,s,e+1/3),o=qI(a,s,e),r=qI(a,s,e-1/3)}return{r:i*255,g:o*255,b:r*255}}function Mz(e,t,n){e=Ls(e,255),t=Ls(t,255),n=Ls(n,255);var i=Math.max(e,t,n),o=Math.min(e,t,n),r=0,s=i,a=i-o,c=i===0?0:a/i;if(i===o)r=0;else{switch(i){case e:r=(t-n)/a+(t<n?6:0);break;case t:r=(n-e)/a+2;break;case n:r=(e-t)/a+4;break}r/=6}return{h:r,s:c,v:s}}function Ohe(e,t,n){e=Ls(e,360)*6,t=Ls(t,100),n=Ls(n,100);var i=Math.floor(e),o=e-i,r=n*(1-t),s=n*(1-o*t),a=n*(1-(1-o)*t),c=i%6,u=[n,s,r,r,a,n][c],d=[a,n,n,s,r,r][c],h=[r,r,a,n,n,s][c];return{r:u*255,g:d*255,b:h*255}}function Fz(e,t,n,i){var o=[Zm(Math.round(e).toString(16)),Zm(Math.round(t).toString(16)),Zm(Math.round(n).toString(16))];return i&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function Lhe(e,t,n,i,o){var r=[Zm(Math.round(e).toString(16)),Zm(Math.round(t).toString(16)),Zm(Math.round(n).toString(16)),Zm(Bhe(i))];return o&&r[0].startsWith(r[0].charAt(1))&&r[1].startsWith(r[1].charAt(1))&&r[2].startsWith(r[2].charAt(1))&&r[3].startsWith(r[3].charAt(1))?r[0].charAt(0)+r[1].charAt(0)+r[2].charAt(0)+r[3].charAt(0):r.join("")}function Bhe(e){return Math.round(parseFloat(e)*255).toString(16)}function zz(e){return ec(e)/255}function ec(e){return parseInt(e,16)}function Rhe(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var QL={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Nhe(e){var t={r:0,g:0,b:0},n=1,i=null,o=null,r=null,s=!1,a=!1;return typeof e=="string"&&(e=zhe(e)),typeof e=="object"&&(Ud(e.r)&&Ud(e.g)&&Ud(e.b)?(t=Ihe(e.r,e.g,e.b),s=!0,a=String(e.r).substr(-1)==="%"?"prgb":"rgb"):Ud(e.h)&&Ud(e.s)&&Ud(e.v)?(i=yE(e.s),o=yE(e.v),t=Ohe(e.h,i,o),s=!0,a="hsv"):Ud(e.h)&&Ud(e.s)&&Ud(e.l)&&(i=yE(e.s),r=yE(e.l),t=Phe(e.h,i,r),s=!0,a="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=RW(n),{ok:s,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var Mhe="[-\\+]?\\d+%?",Fhe="[-\\+]?\\d*\\.\\d+%?",Kh="(?:".concat(Fhe,")|(?:").concat(Mhe,")"),$I="[\\s|\\(]+(".concat(Kh,")[,|\\s]+(").concat(Kh,")[,|\\s]+(").concat(Kh,")\\s*\\)?"),YI="[\\s|\\(]+(".concat(Kh,")[,|\\s]+(").concat(Kh,")[,|\\s]+(").concat(Kh,")[,|\\s]+(").concat(Kh,")\\s*\\)?"),zl={CSS_UNIT:new RegExp(Kh),rgb:new RegExp("rgb"+$I),rgba:new RegExp("rgba"+YI),hsl:new RegExp("hsl"+$I),hsla:new RegExp("hsla"+YI),hsv:new RegExp("hsv"+$I),hsva:new RegExp("hsva"+YI),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function zhe(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(QL[e])e=QL[e],t=!0;else if(e==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n=zl.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=zl.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=zl.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=zl.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=zl.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=zl.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=zl.hex8.exec(e),n?{r:ec(n[1]),g:ec(n[2]),b:ec(n[3]),a:zz(n[4]),format:t?"name":"hex8"}:(n=zl.hex6.exec(e),n?{r:ec(n[1]),g:ec(n[2]),b:ec(n[3]),format:t?"name":"hex"}:(n=zl.hex4.exec(e),n?{r:ec(n[1]+n[1]),g:ec(n[2]+n[2]),b:ec(n[3]+n[3]),a:zz(n[4]+n[4]),format:t?"name":"hex8"}:(n=zl.hex3.exec(e),n?{r:ec(n[1]+n[1]),g:ec(n[2]+n[2]),b:ec(n[3]+n[3]),format:t?"name":"hex"}:!1)))))))))}function Ud(e){return Boolean(zl.CSS_UNIT.exec(String(e)))}var Uhe=function(){function e(t,n){t===void 0&&(t=""),n===void 0&&(n={});var i;if(t instanceof e)return t;typeof t=="number"&&(t=Rhe(t)),this.originalInput=t;var o=Nhe(t);this.originalInput=t,this.r=o.r,this.g=o.g,this.b=o.b,this.a=o.a,this.roundA=Math.round(100*this.a)/100,this.format=(i=n.format)!==null&&i!==void 0?i:o.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=o.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},e.prototype.getLuminance=function(){var t=this.toRgb(),n,i,o,r=t.r/255,s=t.g/255,a=t.b/255;return r<=.03928?n=r/12.92:n=Math.pow((r+.055)/1.055,2.4),s<=.03928?i=s/12.92:i=Math.pow((s+.055)/1.055,2.4),a<=.03928?o=a/12.92:o=Math.pow((a+.055)/1.055,2.4),.2126*n+.7152*i+.0722*o},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(t){return this.a=RW(t),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var t=this.toHsl().s;return t===0},e.prototype.toHsv=function(){var t=Mz(this.r,this.g,this.b);return{h:t.h*360,s:t.s,v:t.v,a:this.a}},e.prototype.toHsvString=function(){var t=Mz(this.r,this.g,this.b),n=Math.round(t.h*360),i=Math.round(t.s*100),o=Math.round(t.v*100);return this.a===1?"hsv(".concat(n,", ").concat(i,"%, ").concat(o,"%)"):"hsva(".concat(n,", ").concat(i,"%, ").concat(o,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var t=Nz(this.r,this.g,this.b);return{h:t.h*360,s:t.s,l:t.l,a:this.a}},e.prototype.toHslString=function(){var t=Nz(this.r,this.g,this.b),n=Math.round(t.h*360),i=Math.round(t.s*100),o=Math.round(t.l*100);return this.a===1?"hsl(".concat(n,", ").concat(i,"%, ").concat(o,"%)"):"hsla(".concat(n,", ").concat(i,"%, ").concat(o,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(t){return t===void 0&&(t=!1),Fz(this.r,this.g,this.b,t)},e.prototype.toHexString=function(t){return t===void 0&&(t=!1),"#"+this.toHex(t)},e.prototype.toHex8=function(t){return t===void 0&&(t=!1),Lhe(this.r,this.g,this.b,this.a,t)},e.prototype.toHex8String=function(t){return t===void 0&&(t=!1),"#"+this.toHex8(t)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var t=Math.round(this.r),n=Math.round(this.g),i=Math.round(this.b);return this.a===1?"rgb(".concat(t,", ").concat(n,", ").concat(i,")"):"rgba(".concat(t,", ").concat(n,", ").concat(i,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var t=function(n){return"".concat(Math.round(Ls(n,255)*100),"%")};return{r:t(this.r),g:t(this.g),b:t(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var t=function(n){return Math.round(Ls(n,255)*100)};return this.a===1?"rgb(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%)"):"rgba(".concat(t(this.r),"%, ").concat(t(this.g),"%, ").concat(t(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var t="#"+Fz(this.r,this.g,this.b,!1),n=0,i=Object.entries(QL);n<i.length;n++){var o=i[n],r=o[0],s=o[1];if(t===s)return r}return!1},e.prototype.toString=function(t){var n=Boolean(t);t=t??this.format;var i=!1,o=this.a<1&&this.a>=0,r=!n&&o&&(t.startsWith("hex")||t==="name");return r?t==="name"&&this.a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=gE(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=gE(n.l),new e(n)},e.prototype.tint=function(t){return t===void 0&&(t=10),this.mix("white",t)},e.prototype.shade=function(t){return t===void 0&&(t=10),this.mix("black",t)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=gE(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=gE(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),i=(n.h+t)%360;return n.h=i<0?360+i:i,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var i=this.toRgb(),o=new e(t).toRgb(),r=n/100,s={r:(o.r-i.r)*r+i.r,g:(o.g-i.g)*r+i.g,b:(o.b-i.b)*r+i.b,a:(o.a-i.a)*r+i.a};return new e(s)},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var i=this.toHsl(),o=360/n,r=[this];for(i.h=(i.h-(o*t>>1)+720)%360;--t;)i.h=(i.h+o)%360,r.push(new e(i));return r},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),i=n.h,o=n.s,r=n.v,s=[],a=1/t;t--;)s.push(new e({h:i,s:o,v:r})),r=(r+a)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),i=new e(t).toRgb();return new e({r:i.r+(n.r-i.r)*n.a,g:i.g+(n.g-i.g)*n.a,b:i.b+(n.b-i.b)*n.a})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),i=n.h,o=[this],r=360/t,s=1;s<t;s++)o.push(new e({h:(i+s*r)%360,s:n.s,l:n.l}));return o},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function ph(e,t=20){return e.mix("#141414",t).toString()}function Hhe(e){const t=qp(),n=dr("button");return tt(()=>{let i={};const o=e.color;if(o){const r=new Uhe(o),s=e.dark?r.tint(20).toString():ph(r,20);if(e.plain)i=n.cssVarBlock({"bg-color":e.dark?ph(r,90):r.tint(90).toString(),"text-color":o,"border-color":e.dark?ph(r,50):r.tint(50).toString(),"hover-text-color":`var(${n.cssVarName("color-white")})`,"hover-bg-color":o,"hover-border-color":o,"active-bg-color":s,"active-text-color":`var(${n.cssVarName("color-white")})`,"active-border-color":s}),t.value&&(i[n.cssVarBlockName("disabled-bg-color")]=e.dark?ph(r,90):r.tint(90).toString(),i[n.cssVarBlockName("disabled-text-color")]=e.dark?ph(r,50):r.tint(50).toString(),i[n.cssVarBlockName("disabled-border-color")]=e.dark?ph(r,80):r.tint(80).toString());else{const a=e.dark?ph(r,30):r.tint(30).toString(),c=r.isDark()?`var(${n.cssVarName("color-white")})`:`var(${n.cssVarName("color-black")})`;if(i=n.cssVarBlock({"bg-color":o,"text-color":c,"border-color":o,"hover-bg-color":a,"hover-text-color":c,"hover-border-color":a,"active-bg-color":s,"active-border-color":s}),t.value){const u=e.dark?ph(r,50):r.tint(50).toString();i[n.cssVarBlockName("disabled-bg-color")]=u,i[n.cssVarBlockName("disabled-text-color")]=e.dark?"rgba(255, 255, 255, 0.5)":`var(${n.cssVarName("color-white")})`,i[n.cssVarBlockName("disabled-border-color")]=u}}}return i})}const Vhe=["aria-disabled","disabled","autofocus","type"],khe=ci({name:"ElButton"}),Ghe=ci({...khe,props:JL,emits:She,setup(e,{expose:t,emit:n}){const i=e,o=Hhe(i),r=dr("button"),{_ref:s,_size:a,_type:c,_disabled:u,shouldAddSpace:d,handleClick:h}=Ehe(i,n);return t({ref:s,size:a,type:c,disabled:u,shouldAddSpace:d}),(m,g)=>(qe(),Dt("button",{ref_key:"_ref",ref:s,class:st([pe(r).b(),pe(r).m(pe(c)),pe(r).m(pe(a)),pe(r).is("disabled",pe(u)),pe(r).is("loading",m.loading),pe(r).is("plain",m.plain),pe(r).is("round",m.round),pe(r).is("circle",m.circle),pe(r).is("text",m.text),pe(r).is("link",m.link),pe(r).is("has-bg",m.bg)]),"aria-disabled":pe(u)||m.loading,disabled:pe(u)||m.loading,autofocus:m.autofocus,type:m.nativeType,style:Ds(pe(o)),onClick:g[0]||(g[0]=(...p)=>pe(h)&&pe(h)(...p))},[m.loading?(qe(),Dt(Jo,{key:0},[m.$slots.loading?Zn(m.$slots,"loading",{key:0}):(qe(),Dn(pe(ss),{key:1,class:st(pe(r).is("loading"))},{default:an(()=>[(qe(),Dn(Ia(m.loadingIcon)))]),_:1},8,["class"]))],64)):m.icon||m.$slots.icon?(qe(),Dn(pe(ss),{key:1},{default:an(()=>[m.icon?(qe(),Dn(Ia(m.icon),{key:0})):Zn(m.$slots,"icon",{key:1})]),_:3})):Mt("v-if",!0),m.$slots.default?(qe(),Dt("span",{key:2,class:st({[pe(r).em("text","expand")]:pe(d)})},[Zn(m.$slots,"default")],2)):Mt("v-if",!0)],14,Vhe))}});var Whe=Cs(Ghe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);const jhe={size:JL.size,type:JL.type},qhe=ci({name:"ElButtonGroup"}),$he=ci({...qhe,props:jhe,setup(e){const t=e;nd(xW,W_({size:e0(t,"size"),type:e0(t,"type")}));const n=dr("button");return(i,o)=>(qe(),Dt("div",{class:st(`${pe(n).b("group")}`)},[Zn(i.$slots,"default")],2))}});var NW=Cs($he,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);const MW=Wf(Whe,{ButtonGroup:NW});GN(NW);var By=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const ZL="_trap-focus-children",e_=[],Uz=e=>{if(e_.length===0)return;const t=e_[e_.length-1][ZL];if(t.length>0&&e.code===eD.tab){if(t.length===1){e.preventDefault(),document.activeElement!==t[0]&&t[0].focus();return}const n=e.shiftKey,i=e.target===t[0],o=e.target===t[t.length-1];i&&n&&(e.preventDefault(),t[t.length-1].focus()),o&&!n&&(e.preventDefault(),t[0].focus())}},Yhe={beforeMount(e){e[ZL]=_z(e),e_.push(e),e_.length<=1&&document.addEventListener("keydown",Uz)},updated(e){us(()=>{e[ZL]=_z(e)})},unmounted(){e_.shift(),e_.length===0&&document.removeEventListener("keydown",Uz)}},FW={modelValue:{type:[Number,String,Boolean],default:void 0},label:{type:[String,Boolean,Number,Object]},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:{type:String,default:void 0},trueLabel:{type:[String,Number],default:void 0},falseLabel:{type:[String,Number],default:void 0},id:{type:String,default:void 0},controls:{type:String,default:void 0},border:Boolean,size:cT,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0}},zW={[If]:e=>_i(e)||wp(e)||PS(e),change:e=>_i(e)||wp(e)||PS(e)},Xhe=({model:e,isChecked:t})=>{const n=er(D0,void 0),i=tt(()=>{var r,s;const a=(r=n==null?void 0:n.max)==null?void 0:r.value,c=(s=n==null?void 0:n.min)==null?void 0:s.value;return!fC(a)&&e.value.length>=a&&!t.value||!fC(c)&&e.value.length<=c&&t.value});return{isDisabled:qp(tt(()=>(n==null?void 0:n.disabled.value)||i.value)),isLimitDisabled:i}},Khe=(e,{model:t,isLimitExceeded:n,hasOwnLabel:i,isDisabled:o,isLabeledByFormItem:r})=>{const s=er(D0,void 0),{formItem:a}=lT(),{emit:c}=Lc();function u(p){var y,b;return p===e.trueLabel||p===!0?(y=e.trueLabel)!=null?y:!0:(b=e.falseLabel)!=null?b:!1}function d(p,y){c("change",u(p),y)}function h(p){if(n.value)return;const y=p.target;c("change",u(y.checked),p)}async function m(p){n.value||!i.value&&!o.value&&r.value&&(p.composedPath().some(C=>C.tagName==="LABEL")||(t.value=u([!1,e.falseLabel].includes(t.value)),await us(),d(t.value,p)))}const g=tt(()=>(s==null?void 0:s.validateEvent)||e.validateEvent);return to(()=>e.modelValue,()=>{g.value&&(a==null||a.validate("change").catch(p=>void 0))}),{handleChange:h,onClickRoot:m}},Jhe=e=>{const t=bn(!1),{emit:n}=Lc(),i=er(D0,void 0),o=tt(()=>fC(i)===!1),r=bn(!1);return{model:tt({get(){var a,c;return o.value?(a=i==null?void 0:i.modelValue)==null?void 0:a.value:(c=e.modelValue)!=null?c:t.value},set(a){var c,u;o.value&&Yt(a)?(r.value=((c=i==null?void 0:i.max)==null?void 0:c.value)!==void 0&&a.length>(i==null?void 0:i.max.value),r.value===!1&&((u=i==null?void 0:i.changeEvent)==null||u.call(i,a))):(n(If,a),t.value=a)}}),isGroup:o,isLimitExceeded:r}},Qhe=(e,t,{model:n})=>{const i=er(D0,void 0),o=bn(!1),r=tt(()=>{const u=n.value;return PS(u)?u:Yt(u)?Di(e.label)?u.map(Ci).some(d=>yue(d,e.label)):u.map(Ci).includes(e.label):u!=null?u===e.trueLabel:!!u}),s=mC(tt(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value}),{prop:!0}),a=mC(tt(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value})),c=tt(()=>!!(t.default||e.label));return{checkboxButtonSize:s,isChecked:r,isFocused:o,checkboxSize:a,hasOwnLabel:c}},Zhe=(e,{model:t})=>{function n(){Yt(t.value)&&!t.value.includes(e.label)?t.value.push(e.label):t.value=e.trueLabel||!0}e.checked&&n()},UW=(e,t)=>{const{formItem:n}=lT(),{model:i,isGroup:o,isLimitExceeded:r}=Jhe(e),{isFocused:s,isChecked:a,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:d}=Qhe(e,t,{model:i}),{isDisabled:h}=Xhe({model:i,isChecked:a}),{inputId:m,isLabeledByFormItem:g}=qN(e,{formItemContext:n,disableIdGeneration:d,disableIdManagement:o}),{handleChange:p,onClickRoot:y}=Khe(e,{model:i,isLimitExceeded:r,hasOwnLabel:d,isDisabled:h,isLabeledByFormItem:g});return Zhe(e,{model:i}),{inputId:m,isLabeledByFormItem:g,isChecked:a,isDisabled:h,isFocused:s,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:d,model:i,handleChange:p,onClickRoot:y}},epe=["tabindex","role","aria-checked"],tpe=["id","aria-hidden","name","tabindex","disabled","true-value","false-value"],npe=["id","aria-hidden","disabled","value","name","tabindex"],ipe=ci({name:"ElCheckbox"}),ope=ci({...ipe,props:FW,emits:zW,setup(e){const t=e,n=aT(),{inputId:i,isLabeledByFormItem:o,isChecked:r,isDisabled:s,isFocused:a,checkboxSize:c,hasOwnLabel:u,model:d,handleChange:h,onClickRoot:m}=UW(t,n),g=dr("checkbox"),p=tt(()=>[g.b(),g.m(c.value),g.is("disabled",s.value),g.is("bordered",t.border),g.is("checked",r.value)]),y=tt(()=>[g.e("input"),g.is("disabled",s.value),g.is("checked",r.value),g.is("indeterminate",t.indeterminate),g.is("focus",a.value)]);return(b,C)=>(qe(),Dn(Ia(!pe(u)&&pe(o)?"span":"label"),{class:st(pe(p)),"aria-controls":b.indeterminate?b.controls:null,onClick:pe(m)},{default:an(()=>[Vt("span",{class:st(pe(y)),tabindex:b.indeterminate?0:void 0,role:b.indeterminate?"checkbox":void 0,"aria-checked":b.indeterminate?"mixed":void 0},[b.trueLabel||b.falseLabel?eu((qe(),Dt("input",{key:0,id:pe(i),"onUpdate:modelValue":C[0]||(C[0]=E=>So(d)?d.value=E:null),class:st(pe(g).e("original")),type:"checkbox","aria-hidden":b.indeterminate?"true":"false",name:b.name,tabindex:b.tabindex,disabled:pe(s),"true-value":b.trueLabel,"false-value":b.falseLabel,onChange:C[1]||(C[1]=(...E)=>pe(h)&&pe(h)(...E)),onFocus:C[2]||(C[2]=E=>a.value=!0),onBlur:C[3]||(C[3]=E=>a.value=!1)},null,42,tpe)),[[xS,pe(d)]]):eu((qe(),Dt("input",{key:1,id:pe(i),"onUpdate:modelValue":C[4]||(C[4]=E=>So(d)?d.value=E:null),class:st(pe(g).e("original")),type:"checkbox","aria-hidden":b.indeterminate?"true":"false",disabled:pe(s),value:b.label,name:b.name,tabindex:b.tabindex,onChange:C[5]||(C[5]=(...E)=>pe(h)&&pe(h)(...E)),onFocus:C[6]||(C[6]=E=>a.value=!0),onBlur:C[7]||(C[7]=E=>a.value=!1)},null,42,npe)),[[xS,pe(d)]]),Vt("span",{class:st(pe(g).e("inner"))},null,2)],10,epe),pe(u)?(qe(),Dt("span",{key:0,class:st(pe(g).e("label"))},[Zn(b.$slots,"default"),b.$slots.default?Mt("v-if",!0):(qe(),Dt(Jo,{key:0},[$l(Pr(b.label),1)],64))],2)):Mt("v-if",!0)]),_:3},8,["class","aria-controls","onClick"]))}});var rpe=Cs(ope,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);const spe=["name","tabindex","disabled","true-value","false-value"],ape=["name","tabindex","disabled","value"],cpe=ci({name:"ElCheckboxButton"}),lpe=ci({...cpe,props:FW,emits:zW,setup(e){const t=e,n=aT(),{isFocused:i,isChecked:o,isDisabled:r,checkboxButtonSize:s,model:a,handleChange:c}=UW(t,n),u=er(D0,void 0),d=dr("checkbox"),h=tt(()=>{var g,p,y,b;const C=(p=(g=u==null?void 0:u.fill)==null?void 0:g.value)!=null?p:"";return{backgroundColor:C,borderColor:C,color:(b=(y=u==null?void 0:u.textColor)==null?void 0:y.value)!=null?b:"",boxShadow:C?`-1px 0 0 0 ${C}`:void 0}}),m=tt(()=>[d.b("button"),d.bm("button",s.value),d.is("disabled",r.value),d.is("checked",o.value),d.is("focus",i.value)]);return(g,p)=>(qe(),Dt("label",{class:st(pe(m))},[g.trueLabel||g.falseLabel?eu((qe(),Dt("input",{key:0,"onUpdate:modelValue":p[0]||(p[0]=y=>So(a)?a.value=y:null),class:st(pe(d).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:pe(r),"true-value":g.trueLabel,"false-value":g.falseLabel,onChange:p[1]||(p[1]=(...y)=>pe(c)&&pe(c)(...y)),onFocus:p[2]||(p[2]=y=>i.value=!0),onBlur:p[3]||(p[3]=y=>i.value=!1)},null,42,spe)),[[xS,pe(a)]]):eu((qe(),Dt("input",{key:1,"onUpdate:modelValue":p[4]||(p[4]=y=>So(a)?a.value=y:null),class:st(pe(d).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:pe(r),value:g.label,onChange:p[5]||(p[5]=(...y)=>pe(c)&&pe(c)(...y)),onFocus:p[6]||(p[6]=y=>i.value=!0),onBlur:p[7]||(p[7]=y=>i.value=!1)},null,42,ape)),[[xS,pe(a)]]),g.$slots.default||g.label?(qe(),Dt("span",{key:2,class:st(pe(d).be("button","inner")),style:Ds(pe(o)?pe(h):void 0)},[Zn(g.$slots,"default",{},()=>[$l(Pr(g.label),1)])],6)):Mt("v-if",!0)],2))}});var HW=Cs(lpe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);const upe=bs({modelValue:{type:Qn(Array),default:()=>[]},disabled:Boolean,min:Number,max:Number,size:cT,label:String,fill:String,textColor:String,tag:{type:String,default:"div"},validateEvent:{type:Boolean,default:!0}}),dpe={[If]:e=>Yt(e),change:e=>Yt(e)},fpe=ci({name:"ElCheckboxGroup"}),hpe=ci({...fpe,props:upe,emits:dpe,setup(e,{emit:t}){const n=e,i=dr("checkbox"),{formItem:o}=lT(),{inputId:r,isLabeledByFormItem:s}=qN(n,{formItemContext:o}),a=async u=>{t(If,u),await us(),t("change",u)},c=tt({get(){return n.modelValue},set(u){a(u)}});return nd(D0,{...Eue(K6(n),["size","min","max","disabled","validateEvent","fill","textColor"]),modelValue:c,changeEvent:a}),to(()=>n.modelValue,()=>{n.validateEvent&&(o==null||o.validate("change").catch(u=>void 0))}),(u,d)=>{var h;return qe(),Dn(Ia(u.tag),{id:pe(r),class:st(pe(i).b("group")),role:"group","aria-label":pe(s)?void 0:u.label||"checkbox-group","aria-labelledby":pe(s)?(h=pe(o))==null?void 0:h.labelId:void 0},{default:an(()=>[Zn(u.$slots,"default")]),_:3},8,["id","class","aria-label","aria-labelledby"])}}});var VW=Cs(hpe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);const ppe=Wf(rpe,{CheckboxButton:HW,CheckboxGroup:VW});GN(HW);const mpe=GN(VW),eB={},_pe=bs({a11y:{type:Boolean,default:!0},locale:{type:Qn(Object)},size:cT,button:{type:Qn(Object)},experimentalFeatures:{type:Qn(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:Qn(Object)},zIndex:Number,namespace:{type:String,default:"el"}});ci({name:"ElConfigProvider",props:_pe,setup(e,{slots:t}){to(()=>e.message,i=>{Object.assign(eB,i??{})},{immediate:!0,deep:!0});const n=Ofe(e);return()=>Zn(t,"default",{config:n==null?void 0:n.value})}});const gpe=bs({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:Qn([String,Array,Object])},zIndex:{type:Qn([String,Number])}}),ype={click:e=>e instanceof MouseEvent};var Ape=ci({name:"ElOverlay",props:gpe,emits:ype,setup(e,{slots:t,emit:n}){const i=dr("overlay"),o=c=>{n("click",c)},{onClick:r,onMousedown:s,onMouseup:a}=PW(e.customMaskEvent?void 0:o);return()=>e.mask?fn("div",{class:[i.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:r,onMousedown:s,onMouseup:a},[Zn(t,"default")],vw.STYLE|vw.CLASS|vw.PROPS,["onClick","onMouseup","onMousedown"]):qv("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[Zn(t,"default")])}});const kW=Ape,bpe=bs({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:r0},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),Cpe=bs({...bpe,appendToBody:{type:Boolean,default:!1},beforeClose:{type:Qn(Function)},destroyOnClose:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:0},top:{type:String},modelValue:{type:Boolean,default:!1},modalClass:String,width:{type:[String,Number]},zIndex:{type:Number},trapFocus:{type:Boolean,default:!1}}),Tpe={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[If]:e=>PS(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},Epe=(e,t)=>{const i=Lc().emit,{nextZIndex:o}=YN();let r="";const s=_C(),a=_C(),c=bn(!1),u=bn(!1),d=bn(!1),h=bn(e.zIndex||o());let m,g;const p=jp("namespace",jN),y=tt(()=>{const v={},O=`--${p.value}-dialog`;return e.fullscreen||(e.top&&(v[`${O}-margin-top`]=e.top),e.width&&(v[`${O}-width`]=hC(e.width))),v}),b=tt(()=>e.alignCenter?{display:"flex"}:{});function C(){i("opened")}function E(){i("closed"),i(If,!1),e.destroyOnClose&&(d.value=!1)}function w(){i("close")}function S(){g==null||g(),m==null||m(),e.openDelay&&e.openDelay>0?{stop:m}=qL(()=>R(),e.openDelay):R()}function P(){m==null||m(),g==null||g(),e.closeDelay&&e.closeDelay>0?{stop:g}=qL(()=>F(),e.closeDelay):F()}function L(){function v(O){O||(u.value=!0,c.value=!1)}e.beforeClose?e.beforeClose(v):P()}function z(){e.closeOnClickModal&&L()}function R(){Cc&&(c.value=!0)}function F(){c.value=!1}function U(){i("openAutoFocus")}function D(){i("closeAutoFocus")}function I(v){var O;((O=v.detail)==null?void 0:O.focusReason)==="pointer"&&v.preventDefault()}e.lockScroll&&IW(c);function _(){e.closeOnPressEscape&&L()}return to(()=>e.modelValue,v=>{v?(u.value=!1,S(),d.value=!0,h.value=e.zIndex?h.value++:o(),us(()=>{i("open"),t.value&&(t.value.scrollTop=0)})):c.value&&P()}),to(()=>e.fullscreen,v=>{t.value&&(v?(r=t.value.style.transform,t.value.style.transform=""):t.value.style.transform=r)}),Oc(()=>{e.modelValue&&(c.value=!0,d.value=!0,S())}),{afterEnter:C,afterLeave:E,beforeLeave:w,handleClose:L,onModalClick:z,close:P,doClose:F,onOpenAutoFocus:U,onCloseAutoFocus:D,onCloseRequested:_,onFocusoutPrevented:I,titleId:s,bodyId:a,closed:u,style:y,overlayDialogStyle:b,rendered:d,visible:c,zIndex:h}},xpe=bs({...Cpe,direction:{type:String,default:"rtl",values:["ltr","rtl","ttb","btt"]},size:{type:[String,Number],default:"30%"},withHeader:{type:Boolean,default:!0},modalFade:{type:Boolean,default:!0}}),wpe=Tpe,Spe=ci({name:"ElDrawer",components:{ElOverlay:kW,ElFocusTrap:BW,ElIcon:ss,Close:Zv},inheritAttrs:!1,props:xpe,emits:wpe,setup(e,{slots:t}){KL({scope:"el-drawer",from:"the title slot",replacement:"the header slot",version:"3.0.0",ref:"https://element-plus.org/en-US/component/drawer.html#slots"},tt(()=>!!t.title)),KL({scope:"el-drawer",from:"custom-class",replacement:"class",version:"2.3.0",ref:"https://element-plus.org/en-US/component/drawer.html#attributes",type:"Attribute"},tt(()=>!!e.customClass));const n=bn(),i=bn(),o=dr("drawer"),{t:r}=$N(),s=tt(()=>e.direction==="rtl"||e.direction==="ltr"),a=tt(()=>hC(e.size));return{...Epe(e,n),drawerRef:n,focusStartRef:i,isHorizontal:s,drawerSize:a,ns:o,t:r}}}),vpe=["aria-label","aria-labelledby","aria-describedby"],Dpe=["id"],Ipe=["aria-label"],Ppe=["id"];function Ope(e,t,n,i,o,r){const s=Wu("close"),a=Wu("el-icon"),c=Wu("el-focus-trap"),u=Wu("el-overlay");return qe(),Dn(Ioe,{to:"body",disabled:!e.appendToBody},[fn(S0,{name:e.ns.b("fade"),onAfterEnter:e.afterEnter,onAfterLeave:e.afterLeave,onBeforeLeave:e.beforeLeave,persisted:""},{default:an(()=>[eu(fn(u,{mask:e.modal,"overlay-class":e.modalClass,"z-index":e.zIndex,onClick:e.onModalClick},{default:an(()=>[fn(c,{loop:"",trapped:e.visible,"focus-trap-el":e.drawerRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:an(()=>[Vt("div",cp({ref:"drawerRef","aria-modal":"true","aria-label":e.title||void 0,"aria-labelledby":e.title?void 0:e.titleId,"aria-describedby":e.bodyId},e.$attrs,{class:[e.ns.b(),e.direction,e.visible&&"open",e.customClass],style:e.isHorizontal?"width: "+e.drawerSize:"height: "+e.drawerSize,role:"dialog",onClick:t[1]||(t[1]=cc(()=>{},["stop"]))}),[Vt("span",{ref:"focusStartRef",class:st(e.ns.e("sr-focus")),tabindex:"-1"},null,2),e.withHeader?(qe(),Dt("header",{key:0,class:st(e.ns.e("header"))},[e.$slots.title?Zn(e.$slots,"title",{key:1},()=>[Mt(" DEPRECATED SLOT ")]):Zn(e.$slots,"header",{key:0,close:e.handleClose,titleId:e.titleId,titleClass:e.ns.e("title")},()=>[e.$slots.title?Mt("v-if",!0):(qe(),Dt("span",{key:0,id:e.titleId,role:"heading",class:st(e.ns.e("title"))},Pr(e.title),11,Dpe))]),e.showClose?(qe(),Dt("button",{key:2,"aria-label":e.t("el.drawer.close"),class:st(e.ns.e("close-btn")),type:"button",onClick:t[0]||(t[0]=(...d)=>e.handleClose&&e.handleClose(...d))},[fn(a,{class:st(e.ns.e("close"))},{default:an(()=>[fn(s)]),_:1},8,["class"])],10,Ipe)):Mt("v-if",!0)],2)):Mt("v-if",!0),e.rendered?(qe(),Dt("div",{key:1,id:e.bodyId,class:st(e.ns.e("body"))},[Zn(e.$slots,"default")],10,Ppe)):Mt("v-if",!0),e.$slots.footer?(qe(),Dt("div",{key:2,class:st(e.ns.e("footer"))},[Zn(e.$slots,"footer")],2)):Mt("v-if",!0)],16,vpe)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[u_,e.visible]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])],8,["disabled"])}var Lpe=Cs(Spe,[["render",Ope],["__file","/home/runner/work/element-plus/element-plus/packages/components/drawer/src/drawer.vue"]]);const Bpe=Wf(Lpe),Rpe=bs({type:{type:String,default:"line",values:["line","circle","dashboard"]},percentage:{type:Number,default:0,validator:e=>e>=0&&e<=100},status:{type:String,default:"",values:["","success","exception","warning"]},indeterminate:{type:Boolean,default:!1},duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:Qn(String),default:"round"},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:Qn([String,Array,Function]),default:""},format:{type:Qn(Function),default:e=>`${e}%`}}),Npe=["aria-valuenow"],Mpe={viewBox:"0 0 100 100"},Fpe=["d","stroke","stroke-width"],zpe=["d","stroke","opacity","stroke-linecap","stroke-width"],Upe={key:0},Hpe=ci({name:"ElProgress"}),Vpe=ci({...Hpe,props:Rpe,setup(e){const t=e,n={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},i=dr("progress"),o=tt(()=>({width:`${t.percentage}%`,animationDuration:`${t.duration}s`,backgroundColor:E(t.percentage)})),r=tt(()=>(t.strokeWidth/t.width*100).toFixed(1)),s=tt(()=>["circle","dashboard"].includes(t.type)?Number.parseInt(`${50-Number.parseFloat(r.value)/2}`,10):0),a=tt(()=>{const w=s.value,S=t.type==="dashboard";return`
|
||
M 50 50
|
||
m 0 ${S?"":"-"}${w}
|
||
a ${w} ${w} 0 1 1 0 ${S?"-":""}${w*2}
|
||
a ${w} ${w} 0 1 1 0 ${S?"":"-"}${w*2}
|
||
`}),c=tt(()=>2*Math.PI*s.value),u=tt(()=>t.type==="dashboard"?.75:1),d=tt(()=>`${-1*c.value*(1-u.value)/2}px`),h=tt(()=>({strokeDasharray:`${c.value*u.value}px, ${c.value}px`,strokeDashoffset:d.value})),m=tt(()=>({strokeDasharray:`${c.value*u.value*(t.percentage/100)}px, ${c.value}px`,strokeDashoffset:d.value,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"})),g=tt(()=>{let w;return t.color?w=E(t.percentage):w=n[t.status]||n.default,w}),p=tt(()=>t.status==="warning"?kN:t.type==="line"?t.status==="success"?HN:VN:t.status==="success"?mW:Zv),y=tt(()=>t.type==="line"?12+t.strokeWidth*.4:t.width*.111111+2),b=tt(()=>t.format(t.percentage));function C(w){const S=100/w.length;return w.map((L,z)=>_i(L)?{color:L,percentage:(z+1)*S}:L).sort((L,z)=>L.percentage-z.percentage)}const E=w=>{var S;const{color:P}=t;if(En(P))return P(w);if(_i(P))return P;{const L=C(P);for(const z of L)if(z.percentage>w)return z.color;return(S=L[L.length-1])==null?void 0:S.color}};return(w,S)=>(qe(),Dt("div",{class:st([pe(i).b(),pe(i).m(w.type),pe(i).is(w.status),{[pe(i).m("without-text")]:!w.showText,[pe(i).m("text-inside")]:w.textInside}]),role:"progressbar","aria-valuenow":w.percentage,"aria-valuemin":"0","aria-valuemax":"100"},[w.type==="line"?(qe(),Dt("div",{key:0,class:st(pe(i).b("bar"))},[Vt("div",{class:st(pe(i).be("bar","outer")),style:Ds({height:`${w.strokeWidth}px`})},[Vt("div",{class:st([pe(i).be("bar","inner"),{[pe(i).bem("bar","inner","indeterminate")]:w.indeterminate}]),style:Ds(pe(o))},[(w.showText||w.$slots.default)&&w.textInside?(qe(),Dt("div",{key:0,class:st(pe(i).be("bar","innerText"))},[Zn(w.$slots,"default",{percentage:w.percentage},()=>[Vt("span",null,Pr(pe(b)),1)])],2)):Mt("v-if",!0)],6)],6)],2)):(qe(),Dt("div",{key:1,class:st(pe(i).b("circle")),style:Ds({height:`${w.width}px`,width:`${w.width}px`})},[(qe(),Dt("svg",Mpe,[Vt("path",{class:st(pe(i).be("circle","track")),d:pe(a),stroke:`var(${pe(i).cssVarName("fill-color-light")}, #e5e9f2)`,"stroke-width":pe(r),fill:"none",style:Ds(pe(h))},null,14,Fpe),Vt("path",{class:st(pe(i).be("circle","path")),d:pe(a),stroke:pe(g),fill:"none",opacity:w.percentage?1:0,"stroke-linecap":w.strokeLinecap,"stroke-width":pe(r),style:Ds(pe(m))},null,14,zpe)]))],6)),(w.showText||w.$slots.default)&&!w.textInside?(qe(),Dt("div",{key:2,class:st(pe(i).e("text")),style:Ds({fontSize:`${pe(y)}px`})},[Zn(w.$slots,"default",{percentage:w.percentage},()=>[w.status?(qe(),Dn(pe(ss),{key:1},{default:an(()=>[(qe(),Dn(Ia(pe(p))))]),_:1})):(qe(),Dt("span",Upe,Pr(pe(b)),1))])],6)):Mt("v-if",!0)],10,Npe))}});var kpe=Cs(Vpe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/progress/src/progress.vue"]]);const Gpe=Wf(kpe),Wpe=["start","center","end","space-around","space-between","space-evenly"],jpe=["top","middle","bottom"],qpe=bs({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:Wpe,default:"start"},align:{type:String,values:jpe,default:"top"}}),$pe=ci({name:"ElRow"}),Ype=ci({...$pe,props:qpe,setup(e){const t=e,n=dr("row"),i=tt(()=>t.gutter);nd(Pfe,{gutter:i});const o=tt(()=>{const s={};return t.gutter&&(s.marginRight=s.marginLeft=`-${t.gutter/2}px`),s}),r=tt(()=>[n.b(),n.is(`justify-${t.justify}`,t.justify!=="start"),n.is(`align-${t.align}`,t.align!=="top")]);return(s,a)=>(qe(),Dn(Ia(s.tag),{class:st(pe(r)),style:Ds(pe(o))},{default:an(()=>[Zn(s.$slots,"default")]),_:3},8,["class","style"]))}});var Xpe=Cs(Ype,[["__file","/home/runner/work/element-plus/element-plus/packages/components/row/src/row.vue"]]);const Kpe=Wf(Xpe),Jpe="ElUpload";class Qpe extends Error{constructor(t,n,i,o){super(t),this.name="UploadAjaxError",this.status=n,this.method=i,this.url=o}}function Hz(e,t,n){let i;return n.response?i=`${n.response.error||n.response}`:n.responseText?i=`${n.responseText}`:i=`fail to ${t.method} ${e} ${n.status}`,new Qpe(i,n.status,t.method,e)}function Zpe(e){const t=e.responseText||e.response;if(!t)return t;try{return JSON.parse(t)}catch{return t}}const eme=e=>{typeof XMLHttpRequest>"u"&&Qv(Jpe,"XMLHttpRequest is undefined");const t=new XMLHttpRequest,n=e.action;t.upload&&t.upload.addEventListener("progress",r=>{const s=r;s.percent=r.total>0?r.loaded/r.total*100:0,e.onProgress(s)});const i=new FormData;if(e.data)for(const[r,s]of Object.entries(e.data))Array.isArray(s)?i.append(r,...s):i.append(r,s);i.append(e.filename,e.file,e.file.name),t.addEventListener("error",()=>{e.onError(Hz(n,e,t))}),t.addEventListener("load",()=>{if(t.status<200||t.status>=300)return e.onError(Hz(n,e,t));e.onSuccess(Zpe(t))}),t.open(e.method,n,!0),e.withCredentials&&"withCredentials"in t&&(t.withCredentials=!0);const o=e.headers||{};if(o instanceof Headers)o.forEach((r,s)=>t.setRequestHeader(s,r));else for(const[r,s]of Object.entries(o))Jv(s)||t.setRequestHeader(r,String(s));return t.send(i),t},GW=["text","picture","picture-card"];let tme=1;const tB=()=>Date.now()+tme++,WW=bs({action:{type:String,default:"#"},headers:{type:Qn(Object)},method:{type:String,default:"post"},data:{type:Object,default:()=>pC({})},multiple:{type:Boolean,default:!1},name:{type:String,default:"file"},drag:{type:Boolean,default:!1},withCredentials:Boolean,showFileList:{type:Boolean,default:!0},accept:{type:String,default:""},type:{type:String,default:"select"},fileList:{type:Qn(Array),default:()=>pC([])},autoUpload:{type:Boolean,default:!0},listType:{type:String,values:GW,default:"text"},httpRequest:{type:Qn(Function),default:eme},disabled:Boolean,limit:Number}),nme=bs({...WW,beforeUpload:{type:Qn(Function),default:Bi},beforeRemove:{type:Qn(Function)},onRemove:{type:Qn(Function),default:Bi},onChange:{type:Qn(Function),default:Bi},onPreview:{type:Qn(Function),default:Bi},onSuccess:{type:Qn(Function),default:Bi},onProgress:{type:Qn(Function),default:Bi},onError:{type:Qn(Function),default:Bi},onExceed:{type:Qn(Function),default:Bi}}),ime=bs({files:{type:Qn(Array),default:()=>pC([])},disabled:{type:Boolean,default:!1},handlePreview:{type:Qn(Function),default:Bi},listType:{type:String,values:GW,default:"text"}}),ome={remove:e=>!!e},rme=["onKeydown"],sme=["src"],ame=["onClick"],cme=["onClick"],lme=["onClick"],ume=ci({name:"ElUploadList"}),dme=ci({...ume,props:ime,emits:ome,setup(e,{emit:t}){const{t:n}=$N(),i=dr("upload"),o=dr("icon"),r=dr("list"),s=qp(),a=bn(!1),c=u=>{t("remove",u)};return(u,d)=>(qe(),Dn(dre,{tag:"ul",class:st([pe(i).b("list"),pe(i).bm("list",u.listType),pe(i).is("disabled",pe(s))]),name:pe(r).b()},{default:an(()=>[(qe(!0),Dt(Jo,null,h9(u.files,h=>(qe(),Dt("li",{key:h.uid||h.name,class:st([pe(i).be("list","item"),pe(i).is(h.status),{focusing:a.value}]),tabindex:"0",onKeydown:by(m=>!pe(s)&&c(h),["delete"]),onFocus:d[0]||(d[0]=m=>a.value=!0),onBlur:d[1]||(d[1]=m=>a.value=!1),onClick:d[2]||(d[2]=m=>a.value=!1)},[Zn(u.$slots,"default",{file:h},()=>[u.listType==="picture"||h.status!=="uploading"&&u.listType==="picture-card"?(qe(),Dt("img",{key:0,class:st(pe(i).be("list","item-thumbnail")),src:h.url,alt:""},null,10,sme)):Mt("v-if",!0),h.status==="uploading"||u.listType!=="picture-card"?(qe(),Dt("div",{key:1,class:st(pe(i).be("list","item-info"))},[Vt("a",{class:st(pe(i).be("list","item-name")),onClick:cc(m=>u.handlePreview(h),["prevent"])},[fn(pe(ss),{class:st(pe(o).m("document"))},{default:an(()=>[fn(pe(Mde))]),_:1},8,["class"]),Vt("span",{class:st(pe(i).be("list","item-file-name"))},Pr(h.name),3)],10,ame),h.status==="uploading"?(qe(),Dn(pe(Gpe),{key:0,type:u.listType==="picture-card"?"circle":"line","stroke-width":u.listType==="picture-card"?6:2,percentage:Number(h.percentage),style:Ds(u.listType==="picture-card"?"":"margin-top: 0.5rem")},null,8,["type","stroke-width","percentage","style"])):Mt("v-if",!0)],2)):Mt("v-if",!0),Vt("label",{class:st(pe(i).be("list","item-status-label"))},[u.listType==="text"?(qe(),Dn(pe(ss),{key:0,class:st([pe(o).m("upload-success"),pe(o).m("circle-check")])},{default:an(()=>[fn(pe(HN))]),_:1},8,["class"])):["picture-card","picture"].includes(u.listType)?(qe(),Dn(pe(ss),{key:1,class:st([pe(o).m("upload-success"),pe(o).m("check")])},{default:an(()=>[fn(pe(mW))]),_:1},8,["class"])):Mt("v-if",!0)],2),pe(s)?Mt("v-if",!0):(qe(),Dn(pe(ss),{key:2,class:st(pe(o).m("close")),onClick:m=>c(h)},{default:an(()=>[fn(pe(Zv))]),_:2},1032,["class","onClick"])),Mt(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),Mt(" This is a bug which needs to be fixed "),Mt(" TODO: Fix the incorrect navigation interaction "),pe(s)?Mt("v-if",!0):(qe(),Dt("i",{key:3,class:st(pe(o).m("close-tip"))},Pr(pe(n)("el.upload.deleteTip")),3)),u.listType==="picture-card"?(qe(),Dt("span",{key:4,class:st(pe(i).be("list","item-actions"))},[Vt("span",{class:st(pe(i).be("list","item-preview")),onClick:m=>u.handlePreview(h)},[fn(pe(ss),{class:st(pe(o).m("zoom-in"))},{default:an(()=>[fn(pe(Cfe))]),_:1},8,["class"])],10,cme),pe(s)?Mt("v-if",!0):(qe(),Dt("span",{key:0,class:st(pe(i).be("list","item-delete")),onClick:m=>c(h)},[fn(pe(ss),{class:st(pe(o).m("delete"))},{default:an(()=>[fn(pe(Pde))]),_:1},8,["class"])],10,lme))],2)):Mt("v-if",!0)])],42,rme))),128)),Zn(u.$slots,"append")]),_:3},8,["class","name"]))}});var Vz=Cs(dme,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-list.vue"]]);const fme=bs({disabled:{type:Boolean,default:!1}}),hme={file:e=>Yt(e)},pme=["onDrop","onDragover"],jW="ElUploadDrag",mme=ci({name:jW}),_me=ci({...mme,props:fme,emits:hme,setup(e,{emit:t}){const n=er(vW);n||Qv(jW,"usage: <el-upload><el-upload-dragger /></el-upload>");const i=dr("upload"),o=bn(!1),r=qp(),s=c=>{if(r.value)return;o.value=!1;const u=Array.from(c.dataTransfer.files),d=n.accept.value;if(!d){t("file",u);return}const h=u.filter(m=>{const{type:g,name:p}=m,y=p.includes(".")?`.${p.split(".").pop()}`:"",b=g.replace(/\/.*$/,"");return d.split(",").map(C=>C.trim()).filter(C=>C).some(C=>C.startsWith(".")?y===C:/\/\*$/.test(C)?b===C.replace(/\/\*$/,""):/^[^/]+\/[^/]+$/.test(C)?g===C:!1)});t("file",h)},a=()=>{r.value||(o.value=!0)};return(c,u)=>(qe(),Dt("div",{class:st([pe(i).b("dragger"),pe(i).is("dragover",o.value)]),onDrop:cc(s,["prevent"]),onDragover:cc(a,["prevent"]),onDragleave:u[0]||(u[0]=cc(d=>o.value=!1,["prevent"]))},[Zn(c.$slots,"default")],42,pme))}});var gme=Cs(_me,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-dragger.vue"]]);const yme=bs({...WW,beforeUpload:{type:Qn(Function),default:Bi},onRemove:{type:Qn(Function),default:Bi},onStart:{type:Qn(Function),default:Bi},onSuccess:{type:Qn(Function),default:Bi},onProgress:{type:Qn(Function),default:Bi},onError:{type:Qn(Function),default:Bi},onExceed:{type:Qn(Function),default:Bi}}),Ame=["onKeydown"],bme=["name","multiple","accept"],Cme=ci({name:"ElUploadContent",inheritAttrs:!1}),Tme=ci({...Cme,props:yme,setup(e,{expose:t}){const n=e,i=dr("upload"),o=qp(),r=c_({}),s=c_(),a=p=>{if(p.length===0)return;const{autoUpload:y,limit:b,fileList:C,multiple:E,onStart:w,onExceed:S}=n;if(b&&C.length+p.length>b){S(p,C);return}E||(p=p.slice(0,1));for(const P of p){const L=P;L.uid=tB(),w(L),y&&c(L)}},c=async p=>{if(s.value.value="",!n.beforeUpload)return u(p);let y;try{y=await n.beforeUpload(p)}catch{y=!1}if(y===!1){n.onRemove(p);return}let b=p;y instanceof Blob&&(y instanceof File?b=y:b=new File([y],p.name,{type:p.type})),u(Object.assign(b,{uid:p.uid}))},u=p=>{const{headers:y,data:b,method:C,withCredentials:E,name:w,action:S,onProgress:P,onSuccess:L,onError:z,httpRequest:R}=n,{uid:F}=p,U={headers:y||{},withCredentials:E,file:p,data:b,method:C,filename:w,action:S,onProgress:I=>{P(I,p)},onSuccess:I=>{L(I,p),delete r.value[F]},onError:I=>{z(I,p),delete r.value[F]}},D=R(U);r.value[F]=D,D instanceof Promise&&D.then(U.onSuccess,U.onError)},d=p=>{const y=p.target.files;y&&a(Array.from(y))},h=()=>{o.value||(s.value.value="",s.value.click())},m=()=>{h()};return t({abort:p=>{que(r.value).filter(p?([b])=>String(p.uid)===b:()=>!0).forEach(([b,C])=>{C instanceof XMLHttpRequest&&C.abort(),delete r.value[b]})},upload:c}),(p,y)=>(qe(),Dt("div",{class:st([pe(i).b(),pe(i).m(p.listType),pe(i).is("drag",p.drag)]),tabindex:"0",onClick:h,onKeydown:by(cc(m,["self"]),["enter","space"])},[p.drag?(qe(),Dn(gme,{key:0,disabled:pe(o),onFile:a},{default:an(()=>[Zn(p.$slots,"default")]),_:3},8,["disabled"])):Zn(p.$slots,"default",{key:1}),Vt("input",{ref_key:"inputRef",ref:s,class:st(pe(i).e("input")),name:p.name,multiple:p.multiple,accept:p.accept,type:"file",onChange:d,onClick:y[0]||(y[0]=cc(()=>{},["stop"]))},null,42,bme)],42,Ame))}});var kz=Cs(Tme,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload-content.vue"]]);const Gz="ElUpload",Eme=e=>{var t;(t=e.url)!=null&&t.startsWith("blob:")&&URL.revokeObjectURL(e.url)},xme=(e,t)=>{const n=Wue(e,"fileList",void 0,{passive:!0}),i=m=>n.value.find(g=>g.uid===m.uid);function o(m){var g;(g=t.value)==null||g.abort(m)}function r(m=["ready","uploading","success","fail"]){n.value=n.value.filter(g=>!m.includes(g.status))}const s=(m,g)=>{const p=i(g);p&&(console.error(m),p.status="fail",n.value.splice(n.value.indexOf(p),1),e.onError(m,p,n.value),e.onChange(p,n.value))},a=(m,g)=>{const p=i(g);p&&(e.onProgress(m,p,n.value),p.status="uploading",p.percentage=Math.round(m.percent))},c=(m,g)=>{const p=i(g);p&&(p.status="success",p.response=m,e.onSuccess(m,p,n.value),e.onChange(p,n.value))},u=m=>{Jv(m.uid)&&(m.uid=tB());const g={name:m.name,percentage:0,status:"ready",size:m.size,raw:m,uid:m.uid};if(e.listType==="picture-card"||e.listType==="picture")try{g.url=URL.createObjectURL(m)}catch(p){p.message,e.onError(p,g,n.value)}n.value=[...n.value,g],e.onChange(g,n.value)},d=async m=>{const g=m instanceof File?i(m):m;g||Qv(Gz,"file to be removed not found");const p=y=>{o(y);const b=n.value;b.splice(b.indexOf(y),1),e.onRemove(y,b),Eme(y)};e.beforeRemove?await e.beforeRemove(g,n.value)!==!1&&p(g):p(g)};function h(){n.value.filter(({status:m})=>m==="ready").forEach(({raw:m})=>{var g;return m&&((g=t.value)==null?void 0:g.upload(m))})}return to(()=>e.listType,m=>{m!=="picture-card"&&m!=="picture"||(n.value=n.value.map(g=>{const{raw:p,url:y}=g;if(!y&&p)try{g.url=URL.createObjectURL(p)}catch(b){e.onError(b,g,n.value)}return g}))}),to(n,m=>{for(const g of m)g.uid||(g.uid=tB()),g.status||(g.status="success")},{immediate:!0,deep:!0}),{uploadFiles:n,abort:o,clearFiles:r,handleError:s,handleProgress:a,handleStart:u,handleSuccess:c,handleRemove:d,submit:h}},wme=ci({name:"ElUpload"}),Sme=ci({...wme,props:nme,setup(e,{expose:t}){const n=e,i=aT(),o=qp(),r=c_(),{abort:s,submit:a,clearFiles:c,uploadFiles:u,handleStart:d,handleError:h,handleRemove:m,handleSuccess:g,handleProgress:p}=xme(n,r),y=tt(()=>n.listType==="picture-card"),b=tt(()=>({...n,fileList:u.value,onStart:d,onProgress:p,onSuccess:g,onError:h,onRemove:m}));return Wp(()=>{u.value.forEach(({url:C})=>{C!=null&&C.startsWith("blob:")&&URL.revokeObjectURL(C)})}),nd(vW,{accept:e0(n,"accept")}),t({abort:s,submit:a,clearFiles:c,handleStart:d,handleRemove:m}),(C,E)=>(qe(),Dt("div",null,[pe(y)&&C.showFileList?(qe(),Dn(Vz,{key:0,disabled:pe(o),"list-type":C.listType,files:pe(u),"handle-preview":C.onPreview,onRemove:pe(m)},o3({append:an(()=>[fn(kz,cp({ref_key:"uploadRef",ref:r},pe(b)),{default:an(()=>[pe(i).trigger?Zn(C.$slots,"trigger",{key:0}):Mt("v-if",!0),!pe(i).trigger&&pe(i).default?Zn(C.$slots,"default",{key:1}):Mt("v-if",!0)]),_:3},16)]),_:2},[C.$slots.file?{name:"default",fn:an(({file:w})=>[Zn(C.$slots,"file",{file:w})])}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Mt("v-if",!0),!pe(y)||pe(y)&&!C.showFileList?(qe(),Dn(kz,cp({key:1,ref_key:"uploadRef",ref:r},pe(b)),{default:an(()=>[pe(i).trigger?Zn(C.$slots,"trigger",{key:0}):Mt("v-if",!0),!pe(i).trigger&&pe(i).default?Zn(C.$slots,"default",{key:1}):Mt("v-if",!0)]),_:3},16)):Mt("v-if",!0),C.$slots.trigger?Zn(C.$slots,"default",{key:2}):Mt("v-if",!0),Zn(C.$slots,"tip"),!pe(y)&&C.showFileList?(qe(),Dn(Vz,{key:3,disabled:pe(o),"list-type":C.listType,files:pe(u),"handle-preview":C.onPreview,onRemove:pe(m)},o3({_:2},[C.$slots.file?{name:"default",fn:an(({file:w})=>[Zn(C.$slots,"file",{file:w})])}:void 0]),1032,["disabled","list-type","files","handle-preview","onRemove"])):Mt("v-if",!0)]))}});var vme=Cs(Sme,[["__file","/home/runner/work/element-plus/element-plus/packages/components/upload/src/upload.vue"]]);const Dme=Wf(vme),qW=["success","info","warning","error"],Va=pC({customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:Cc?document.body:void 0}),Ime=bs({customClass:{type:String,default:Va.customClass},center:{type:Boolean,default:Va.center},dangerouslyUseHTMLString:{type:Boolean,default:Va.dangerouslyUseHTMLString},duration:{type:Number,default:Va.duration},icon:{type:r0,default:Va.icon},id:{type:String,default:Va.id},message:{type:Qn([String,Object,Function]),default:Va.message},onClose:{type:Qn(Function),required:!1},showClose:{type:Boolean,default:Va.showClose},type:{type:String,values:qW,default:Va.type},offset:{type:Number,default:Va.offset},zIndex:{type:Number,default:Va.zIndex},grouping:{type:Boolean,default:Va.grouping},repeatNum:{type:Number,default:Va.repeatNum}}),Pme={destroy:()=>!0},Qu=G6([]),Ome=e=>{const t=Qu.findIndex(o=>o.id===e),n=Qu[t];let i;return t>0&&(i=Qu[t-1]),{current:n,prev:i}},Lme=e=>{const{prev:t}=Ome(e);return t?t.vm.exposed.bottom.value:0},Bme=["id"],Rme=["innerHTML"],Nme=ci({name:"ElMessage"}),Mme=ci({...Nme,props:Ime,emits:Pme,setup(e,{expose:t}){const n=e,{Close:i}=TW,o=dr("message"),r=bn(),s=bn(!1),a=bn(0);let c;const u=tt(()=>n.type?n.type==="error"?"danger":n.type:"info"),d=tt(()=>{const S=n.type;return{[o.bm("icon",S)]:S&&OS[S]}}),h=tt(()=>n.icon||OS[n.type]||""),m=tt(()=>Lme(n.id)),g=tt(()=>n.offset+m.value),p=tt(()=>a.value+g.value),y=tt(()=>({top:`${g.value}px`,zIndex:n.zIndex}));function b(){n.duration!==0&&({stop:c}=qL(()=>{E()},n.duration))}function C(){c==null||c()}function E(){s.value=!1}function w({code:S}){S===eD.esc&&E()}return Oc(()=>{b(),s.value=!0}),to(()=>n.repeatNum,()=>{C(),b()}),Bue(document,"keydown",w),hW(r,()=>{a.value=r.value.getBoundingClientRect().height}),t({visible:s,bottom:p,close:E}),(S,P)=>(qe(),Dn(S0,{name:pe(o).b("fade"),onBeforeLeave:S.onClose,onAfterLeave:P[0]||(P[0]=L=>S.$emit("destroy")),persisted:""},{default:an(()=>[eu(Vt("div",{id:S.id,ref_key:"messageRef",ref:r,class:st([pe(o).b(),{[pe(o).m(S.type)]:S.type&&!S.icon},pe(o).is("center",S.center),pe(o).is("closable",S.showClose),S.customClass]),style:Ds(pe(y)),role:"alert",onMouseenter:C,onMouseleave:b},[S.repeatNum>1?(qe(),Dn(pe(The),{key:0,value:S.repeatNum,type:pe(u),class:st(pe(o).e("badge"))},null,8,["value","type","class"])):Mt("v-if",!0),pe(h)?(qe(),Dn(pe(ss),{key:1,class:st([pe(o).e("icon"),pe(d)])},{default:an(()=>[(qe(),Dn(Ia(pe(h))))]),_:1},8,["class"])):Mt("v-if",!0),Zn(S.$slots,"default",{},()=>[S.dangerouslyUseHTMLString?(qe(),Dt(Jo,{key:1},[Mt(" Caution here, message could've been compromised, never use user's input as message "),Vt("p",{class:st(pe(o).e("content")),innerHTML:S.message},null,10,Rme)],2112)):(qe(),Dt("p",{key:0,class:st(pe(o).e("content"))},Pr(S.message),3))]),S.showClose?(qe(),Dn(pe(ss),{key:2,class:st(pe(o).e("closeBtn")),onClick:cc(E,["stop"])},{default:an(()=>[fn(pe(i))]),_:1},8,["class","onClick"])):Mt("v-if",!0)],46,Bme),[[u_,s.value]])]),_:3},8,["name","onBeforeLeave"]))}});var Fme=Cs(Mme,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let zme=1;const $W=e=>{const t=!e||_i(e)||Ep(e)||En(e)?{message:e}:e,n={...Va,...t};if(!n.appendTo)n.appendTo=document.body;else if(_i(n.appendTo)){let i=document.querySelector(n.appendTo);XL(i)||(i=document.body),n.appendTo=i}return n},Ume=e=>{const t=Qu.indexOf(e);if(t===-1)return;Qu.splice(t,1);const{handler:n}=e;n.close()},Hme=({appendTo:e,...t},n)=>{const{nextZIndex:i}=YN(),o=`message_${zme++}`,r=t.onClose,s=document.createElement("div"),a={...t,zIndex:i()+t.zIndex,id:o,onClose:()=>{r==null||r(),Ume(h)},onDestroy:()=>{wS(null,s)}},c=fn(Fme,a,En(a.message)||Ep(a.message)?{default:En(a.message)?a.message:()=>a.message}:null);c.appContext=n||s0._context,wS(c,s),e.appendChild(s.firstElementChild);const u=c.component,h={id:o,vnode:c,vm:u,handler:{close:()=>{u.exposed.visible.value=!1}},props:c.component.props};return h},s0=(e={},t)=>{if(!Cc)return{close:()=>{}};if(wp(eB.max)&&Qu.length>=eB.max)return{close:()=>{}};const n=$W(e);if(n.grouping&&Qu.length){const o=Qu.find(({vnode:r})=>{var s;return((s=r.props)==null?void 0:s.message)===n.message});if(o)return o.props.repeatNum+=1,o.props.type=n.type,o.handler}const i=Hme(n,t);return Qu.push(i),i.handler};qW.forEach(e=>{s0[e]=(t={},n)=>{const i=$W(t);return s0({...i,type:e},n)}});function Vme(e){for(const t of Qu)(!e||e===t.props.type)&&t.handler.close()}s0.closeAll=Vme;s0._context=null;const Lb=xfe(s0,"$message"),kme=ci({name:"ElMessageBox",directives:{TrapFocus:Yhe},components:{ElButton:MW,ElFocusTrap:BW,ElInput:OW,ElOverlay:kW,ElIcon:ss,...TW},inheritAttrs:!1,props:{buttonSize:{type:String,validator:wfe},modal:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!0},closeOnHashChange:{type:Boolean,default:!0},center:Boolean,draggable:Boolean,roundButton:{default:!1,type:Boolean},container:{type:String,default:"body"},boxType:{type:String,default:""}},emits:["vanish","action"],setup(e,{emit:t}){const{t:n}=$N(),i=dr("message-box"),o=bn(!1),{nextZIndex:r}=YN(),s=W_({autofocus:!0,beforeClose:null,callback:null,cancelButtonText:"",cancelButtonClass:"",confirmButtonText:"",confirmButtonClass:"",customClass:"",customStyle:{},dangerouslyUseHTMLString:!1,distinguishCancelAndClose:!1,icon:"",inputPattern:null,inputPlaceholder:"",inputType:"text",inputValue:null,inputValidator:null,inputErrorMessage:"",message:null,modalFade:!0,modalClass:"",showCancelButton:!1,showConfirmButton:!0,type:"",title:void 0,showInput:!1,action:"",confirmButtonLoading:!1,cancelButtonLoading:!1,confirmButtonDisabled:!1,editorErrorMessage:"",validateError:!1,zIndex:r()}),a=tt(()=>{const _=s.type;return{[i.bm("icon",_)]:_&&OS[_]}}),c=_C(),u=_C(),d=mC(tt(()=>e.buttonSize),{prop:!0,form:!0,formItem:!0}),h=tt(()=>s.icon||OS[s.type]||""),m=tt(()=>!!s.message),g=bn(),p=bn(),y=bn(),b=bn(),C=bn(),E=tt(()=>s.confirmButtonClass);to(()=>s.inputValue,async _=>{await us(),e.boxType==="prompt"&&_!==null&&F()},{immediate:!0}),to(()=>o.value,_=>{var v,O;_&&(e.boxType!=="prompt"&&(s.autofocus?y.value=(O=(v=C.value)==null?void 0:v.$el)!=null?O:g.value:y.value=g.value),s.zIndex=r()),e.boxType==="prompt"&&(_?us().then(()=>{var N;b.value&&b.value.$el&&(s.autofocus?y.value=(N=U())!=null?N:g.value:y.value=g.value)}):(s.editorErrorMessage="",s.validateError=!1))});const w=tt(()=>e.draggable);Bfe(g,p,w),Oc(async()=>{await us(),e.closeOnHashChange&&window.addEventListener("hashchange",S)}),Wp(()=>{e.closeOnHashChange&&window.removeEventListener("hashchange",S)});function S(){o.value&&(o.value=!1,us(()=>{s.action&&t("action",s.action)}))}const P=()=>{e.closeOnClickModal&&R(s.distinguishCancelAndClose?"close":"cancel")},L=PW(P),z=_=>{if(s.inputType!=="textarea")return _.preventDefault(),R("confirm")},R=_=>{var v;e.boxType==="prompt"&&_==="confirm"&&!F()||(s.action=_,s.beforeClose?(v=s.beforeClose)==null||v.call(s,_,s,S):S())},F=()=>{if(e.boxType==="prompt"){const _=s.inputPattern;if(_&&!_.test(s.inputValue||""))return s.editorErrorMessage=s.inputErrorMessage||n("el.messagebox.error"),s.validateError=!0,!1;const v=s.inputValidator;if(typeof v=="function"){const O=v(s.inputValue);if(O===!1)return s.editorErrorMessage=s.inputErrorMessage||n("el.messagebox.error"),s.validateError=!0,!1;if(typeof O=="string")return s.editorErrorMessage=O,s.validateError=!0,!1}}return s.editorErrorMessage="",s.validateError=!1,!0},U=()=>{const _=b.value.$refs;return _.input||_.textarea},D=()=>{R("close")},I=()=>{e.closeOnPressEscape&&D()};return e.lockScroll&&IW(o),Vfe(o),{...K6(s),ns:i,overlayEvent:L,visible:o,hasMessage:m,typeClass:a,contentId:c,inputId:u,btnSize:d,iconComponent:h,confirmButtonClasses:E,rootRef:g,focusStartRef:y,headerRef:p,inputRef:b,confirmRef:C,doClose:S,handleClose:D,onCloseRequested:I,handleWrapperClick:P,handleInputEnter:z,handleAction:R,t:n}}}),Gme=["aria-label","aria-describedby"],Wme=["aria-label"],jme=["id"];function qme(e,t,n,i,o,r){const s=Wu("el-icon"),a=Wu("close"),c=Wu("el-input"),u=Wu("el-button"),d=Wu("el-focus-trap"),h=Wu("el-overlay");return qe(),Dn(S0,{name:"fade-in-linear",onAfterLeave:t[11]||(t[11]=m=>e.$emit("vanish")),persisted:""},{default:an(()=>[eu(fn(h,{"z-index":e.zIndex,"overlay-class":[e.ns.is("message-box"),e.modalClass],mask:e.modal},{default:an(()=>[Vt("div",{role:"dialog","aria-label":e.title,"aria-modal":"true","aria-describedby":e.showInput?void 0:e.contentId,class:st(`${e.ns.namespace.value}-overlay-message-box`),onClick:t[8]||(t[8]=(...m)=>e.overlayEvent.onClick&&e.overlayEvent.onClick(...m)),onMousedown:t[9]||(t[9]=(...m)=>e.overlayEvent.onMousedown&&e.overlayEvent.onMousedown(...m)),onMouseup:t[10]||(t[10]=(...m)=>e.overlayEvent.onMouseup&&e.overlayEvent.onMouseup(...m))},[fn(d,{loop:"",trapped:e.visible,"focus-trap-el":e.rootRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:an(()=>[Vt("div",{ref:"rootRef",class:st([e.ns.b(),e.customClass,e.ns.is("draggable",e.draggable),{[e.ns.m("center")]:e.center}]),style:Ds(e.customStyle),tabindex:"-1",onClick:t[7]||(t[7]=cc(()=>{},["stop"]))},[e.title!==null&&e.title!==void 0?(qe(),Dt("div",{key:0,ref:"headerRef",class:st(e.ns.e("header"))},[Vt("div",{class:st(e.ns.e("title"))},[e.iconComponent&&e.center?(qe(),Dn(s,{key:0,class:st([e.ns.e("status"),e.typeClass])},{default:an(()=>[(qe(),Dn(Ia(e.iconComponent)))]),_:1},8,["class"])):Mt("v-if",!0),Vt("span",null,Pr(e.title),1)],2),e.showClose?(qe(),Dt("button",{key:0,type:"button",class:st(e.ns.e("headerbtn")),"aria-label":e.t("el.messagebox.close"),onClick:t[0]||(t[0]=m=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel")),onKeydown:t[1]||(t[1]=by(cc(m=>e.handleAction(e.distinguishCancelAndClose?"close":"cancel"),["prevent"]),["enter"]))},[fn(s,{class:st(e.ns.e("close"))},{default:an(()=>[fn(a)]),_:1},8,["class"])],42,Wme)):Mt("v-if",!0)],2)):Mt("v-if",!0),Vt("div",{id:e.contentId,class:st(e.ns.e("content"))},[Vt("div",{class:st(e.ns.e("container"))},[e.iconComponent&&!e.center&&e.hasMessage?(qe(),Dn(s,{key:0,class:st([e.ns.e("status"),e.typeClass])},{default:an(()=>[(qe(),Dn(Ia(e.iconComponent)))]),_:1},8,["class"])):Mt("v-if",!0),e.hasMessage?(qe(),Dt("div",{key:1,class:st(e.ns.e("message"))},[Zn(e.$slots,"default",{},()=>[e.dangerouslyUseHTMLString?(qe(),Dn(Ia(e.showInput?"label":"p"),{key:1,for:e.showInput?e.inputId:void 0,innerHTML:e.message},null,8,["for","innerHTML"])):(qe(),Dn(Ia(e.showInput?"label":"p"),{key:0,for:e.showInput?e.inputId:void 0},{default:an(()=>[$l(Pr(e.dangerouslyUseHTMLString?"":e.message),1)]),_:1},8,["for"]))])],2)):Mt("v-if",!0)],2),eu(Vt("div",{class:st(e.ns.e("input"))},[fn(c,{id:e.inputId,ref:"inputRef",modelValue:e.inputValue,"onUpdate:modelValue":t[2]||(t[2]=m=>e.inputValue=m),type:e.inputType,placeholder:e.inputPlaceholder,"aria-invalid":e.validateError,class:st({invalid:e.validateError}),onKeydown:by(e.handleInputEnter,["enter"])},null,8,["id","modelValue","type","placeholder","aria-invalid","class","onKeydown"]),Vt("div",{class:st(e.ns.e("errormsg")),style:Ds({visibility:e.editorErrorMessage?"visible":"hidden"})},Pr(e.editorErrorMessage),7)],2),[[u_,e.showInput]])],10,jme),Vt("div",{class:st(e.ns.e("btns"))},[e.showCancelButton?(qe(),Dn(u,{key:0,loading:e.cancelButtonLoading,class:st([e.cancelButtonClass]),round:e.roundButton,size:e.btnSize,onClick:t[3]||(t[3]=m=>e.handleAction("cancel")),onKeydown:t[4]||(t[4]=by(cc(m=>e.handleAction("cancel"),["prevent"]),["enter"]))},{default:an(()=>[$l(Pr(e.cancelButtonText||e.t("el.messagebox.cancel")),1)]),_:1},8,["loading","class","round","size"])):Mt("v-if",!0),eu(fn(u,{ref:"confirmRef",type:"primary",loading:e.confirmButtonLoading,class:st([e.confirmButtonClasses]),round:e.roundButton,disabled:e.confirmButtonDisabled,size:e.btnSize,onClick:t[5]||(t[5]=m=>e.handleAction("confirm")),onKeydown:t[6]||(t[6]=by(cc(m=>e.handleAction("confirm"),["prevent"]),["enter"]))},{default:an(()=>[$l(Pr(e.confirmButtonText||e.t("el.messagebox.confirm")),1)]),_:1},8,["loading","class","round","disabled","size"]),[[u_,e.showConfirmButton]])],2)],6)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])],42,Gme)]),_:3},8,["z-index","overlay-class","mask"]),[[u_,e.visible]])]),_:3})}var $me=Cs(kme,[["render",qme],["__file","/home/runner/work/element-plus/element-plus/packages/components/message-box/src/index.vue"]]);const gC=new Map,Yme=e=>{let t=document.body;return e.appendTo&&(_i(e.appendTo)&&(t=document.querySelector(e.appendTo)),XL(e.appendTo)&&(t=e.appendTo),XL(t)||(t=document.body)),t},Xme=(e,t,n=null)=>{const i=fn($me,e,En(e.message)||Ep(e.message)?{default:En(e.message)?e.message:()=>e.message}:null);return i.appContext=n,wS(i,t),Yme(e).appendChild(t.firstElementChild),i.component},Kme=()=>document.createElement("div"),Jme=(e,t)=>{const n=Kme();e.onVanish=()=>{wS(null,n),gC.delete(o)},e.onAction=r=>{const s=gC.get(o);let a;e.showInput?a={value:o.inputValue,action:r}:a=r,e.callback?e.callback(a,i.proxy):r==="cancel"||r==="close"?e.distinguishCancelAndClose&&r!=="cancel"?s.reject("close"):s.reject("cancel"):s.resolve(a)};const i=Xme(e,n,t),o=i.proxy;for(const r in e)oi(e,r)&&!oi(o.$props,r)&&(o[r]=e[r]);return o.visible=!0,o};function I0(e,t=null){if(!Cc)return Promise.reject();let n;return _i(e)||Ep(e)?e={message:e}:n=e.callback,new Promise((i,o)=>{const r=Jme(e,t??I0._context);gC.set(r,{options:e,callback:n,resolve:i,reject:o})})}const Qme=["alert","confirm","prompt"],Zme={alert:{closeOnPressEscape:!1,closeOnClickModal:!1},confirm:{showCancelButton:!0},prompt:{showCancelButton:!0,showInput:!0}};Qme.forEach(e=>{I0[e]=e_e(e)});function e_e(e){return(t,n,i,o)=>{let r="";return Di(n)?(i=n,r=""):fC(n)?r="":r=n,I0(Object.assign({title:r,message:t,type:"",...Zme[e]},i,{boxType:e}),o)}}I0.close=()=>{gC.forEach((e,t)=>{t.doClose()}),gC.clear()};I0._context=null;const zh=I0;zh.install=e=>{zh._context=e._context,e.config.globalProperties.$msgbox=zh,e.config.globalProperties.$messageBox=zh,e.config.globalProperties.$alert=zh.alert,e.config.globalProperties.$confirm=zh.confirm,e.config.globalProperties.$prompt=zh.prompt};const t_e=zh,n_e="/assets/menu-a8f9cd83.svg",i_e="/assets/import-5c494d28.svg",o_e="/assets/clean-2b8d49bf.svg",r_e="/assets/hide-96ff822e.svg";function l(e){return e!=null}function x(e){this.name="DeveloperError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}l(Object.create)&&(x.prototype=Object.create(Error.prototype),x.prototype.constructor=x);x.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return l(this.stack)&&(e+=`
|
||
${this.stack.toString()}`),e};x.throwInstantiationError=function(){throw new x("This function defines an interface and should not be called directly.")};const Br={};Br.typeOf={};function s_e(e){return`${e} is required, actual value was undefined`}function P0(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Br.defined=function(e,t){if(!l(t))throw new x(s_e(e))};Br.typeOf.func=function(e,t){if(typeof t!="function")throw new x(P0(typeof t,"function",e))};Br.typeOf.string=function(e,t){if(typeof t!="string")throw new x(P0(typeof t,"string",e))};Br.typeOf.number=function(e,t){if(typeof t!="number")throw new x(P0(typeof t,"number",e))};Br.typeOf.number.lessThan=function(e,t,n){if(Br.typeOf.number(e,t),t>=n)throw new x(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Br.typeOf.number.lessThanOrEquals=function(e,t,n){if(Br.typeOf.number(e,t),t>n)throw new x(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Br.typeOf.number.greaterThan=function(e,t,n){if(Br.typeOf.number(e,t),t<=n)throw new x(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Br.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Br.typeOf.number(e,t),t<n)throw new x(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Br.typeOf.object=function(e,t){if(typeof t!="object")throw new x(P0(typeof t,"object",e))};Br.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new x(P0(typeof t,"boolean",e))};Br.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new x(P0(typeof t,"bigint",e))};Br.typeOf.number.equals=function(e,t,n,i){if(Br.typeOf.number(e,n),Br.typeOf.number(t,i),n!==i)throw new x(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};const T=Br;function A(e,t){return e??t}A.EMPTY_OBJECT=Object.freeze({});var jf=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)};jf.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}};jf.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};jf.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};jf.prototype.random_int31=function(){return this.random_int()>>>1};jf.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};jf.prototype.random=function(){return this.random_int()*(1/4294967296)};jf.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};jf.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};var nD=jf;const Xe={};Xe.EPSILON1=.1;Xe.EPSILON2=.01;Xe.EPSILON3=.001;Xe.EPSILON4=1e-4;Xe.EPSILON5=1e-5;Xe.EPSILON6=1e-6;Xe.EPSILON7=1e-7;Xe.EPSILON8=1e-8;Xe.EPSILON9=1e-9;Xe.EPSILON10=1e-10;Xe.EPSILON11=1e-11;Xe.EPSILON12=1e-12;Xe.EPSILON13=1e-13;Xe.EPSILON14=1e-14;Xe.EPSILON15=1e-15;Xe.EPSILON16=1e-16;Xe.EPSILON17=1e-17;Xe.EPSILON18=1e-18;Xe.EPSILON19=1e-19;Xe.EPSILON20=1e-20;Xe.EPSILON21=1e-21;Xe.GRAVITATIONALPARAMETER=3986004418e5;Xe.SOLAR_RADIUS=6955e5;Xe.LUNAR_RADIUS=1737400;Xe.SIXTY_FOUR_KILOBYTES=64*1024;Xe.FOUR_GIGABYTES=4*1024*1024*1024;Xe.sign=A(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});Xe.signNotZero=function(e){return e<0?-1:1};Xe.toSNorm=function(e,t){return t=A(t,255),Math.round((Xe.clamp(e,-1,1)*.5+.5)*t)};Xe.fromSNorm=function(e,t){return t=A(t,255),Xe.clamp(e,0,t)/t*2-1};Xe.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:Xe.clamp((e-t)/n,0,1)};Xe.sinh=A(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});Xe.cosh=A(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});Xe.lerp=function(e,t,n){return(1-n)*e+n*t};Xe.PI=Math.PI;Xe.ONE_OVER_PI=1/Math.PI;Xe.PI_OVER_TWO=Math.PI/2;Xe.PI_OVER_THREE=Math.PI/3;Xe.PI_OVER_FOUR=Math.PI/4;Xe.PI_OVER_SIX=Math.PI/6;Xe.THREE_PI_OVER_TWO=3*Math.PI/2;Xe.TWO_PI=2*Math.PI;Xe.ONE_OVER_TWO_PI=1/(2*Math.PI);Xe.RADIANS_PER_DEGREE=Math.PI/180;Xe.DEGREES_PER_RADIAN=180/Math.PI;Xe.RADIANS_PER_ARCSECOND=Xe.RADIANS_PER_DEGREE/3600;Xe.toRadians=function(e){if(!l(e))throw new x("degrees is required.");return e*Xe.RADIANS_PER_DEGREE};Xe.toDegrees=function(e){if(!l(e))throw new x("radians is required.");return e*Xe.DEGREES_PER_RADIAN};Xe.convertLongitudeRange=function(e){if(!l(e))throw new x("angle is required.");const t=Xe.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};Xe.clampToLatitudeRange=function(e){if(!l(e))throw new x("angle is required.");return Xe.clamp(e,-1*Xe.PI_OVER_TWO,Xe.PI_OVER_TWO)};Xe.negativePiToPi=function(e){if(!l(e))throw new x("angle is required.");return e>=-Xe.PI&&e<=Xe.PI?e:Xe.zeroToTwoPi(e+Xe.PI)-Xe.PI};Xe.zeroToTwoPi=function(e){if(!l(e))throw new x("angle is required.");if(e>=0&&e<=Xe.TWO_PI)return e;const t=Xe.mod(e,Xe.TWO_PI);return Math.abs(t)<Xe.EPSILON14&&Math.abs(e)>Xe.EPSILON14?Xe.TWO_PI:t};Xe.mod=function(e,t){if(!l(e))throw new x("m is required.");if(!l(t))throw new x("n is required.");if(t===0)throw new x("divisor cannot be 0.");return Xe.sign(e)===Xe.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};Xe.equalsEpsilon=function(e,t,n,i){if(!l(e))throw new x("left is required.");if(!l(t))throw new x("right is required.");n=A(n,0),i=A(i,n);const o=Math.abs(e-t);return o<=i||o<=n*Math.max(Math.abs(e),Math.abs(t))};Xe.lessThan=function(e,t,n){if(!l(e))throw new x("first is required.");if(!l(t))throw new x("second is required.");if(!l(n))throw new x("absoluteEpsilon is required.");return e-t<-n};Xe.lessThanOrEquals=function(e,t,n){if(!l(e))throw new x("first is required.");if(!l(t))throw new x("second is required.");if(!l(n))throw new x("absoluteEpsilon is required.");return e-t<n};Xe.greaterThan=function(e,t,n){if(!l(e))throw new x("first is required.");if(!l(t))throw new x("second is required.");if(!l(n))throw new x("absoluteEpsilon is required.");return e-t>n};Xe.greaterThanOrEquals=function(e,t,n){if(!l(e))throw new x("first is required.");if(!l(t))throw new x("second is required.");if(!l(n))throw new x("absoluteEpsilon is required.");return e-t>-n};const AE=[1];Xe.factorial=function(e){if(typeof e!="number"||e<0)throw new x("A number greater than or equal to 0 is required.");const t=AE.length;if(e>=t){let n=AE[t-1];for(let i=t;i<=e;i++){const o=n*i;AE.push(o),n=o}}return AE[e]};Xe.incrementWrap=function(e,t,n){if(n=A(n,0),!l(e))throw new x("n is required.");if(t<=n)throw new x("maximumValue must be greater than minimumValue.");return++e,e>t&&(e=n),e};Xe.isPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new x("A number between 0 and (2^32)-1 is required.");return e!==0&&(e&e-1)===0};Xe.nextPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>2147483648)throw new x("A number between 0 and 2^31 is required.");return--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e,e};Xe.previousPowerOfTwo=function(e){if(typeof e!="number"||e<0||e>4294967295)throw new x("A number between 0 and (2^32)-1 is required.");return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e=(e>>>0)-(e>>>1),e};Xe.clamp=function(e,t,n){return T.typeOf.number("value",e),T.typeOf.number("min",t),T.typeOf.number("max",n),e<t?t:e>n?n:e};let YW=new nD;Xe.setRandomNumberSeed=function(e){if(!l(e))throw new x("seed is required.");YW=new nD(e)};Xe.nextRandomNumber=function(){return YW.random()};Xe.randomBetween=function(e,t){return Xe.nextRandomNumber()*(t-e)+e};Xe.acosClamped=function(e){if(!l(e))throw new x("value is required.");return Math.acos(Xe.clamp(e,-1,1))};Xe.asinClamped=function(e){if(!l(e))throw new x("value is required.");return Math.asin(Xe.clamp(e,-1,1))};Xe.chordLength=function(e,t){if(!l(e))throw new x("angle is required.");if(!l(t))throw new x("radius is required.");return 2*t*Math.sin(e*.5)};Xe.logBase=function(e,t){if(!l(e))throw new x("number is required.");if(!l(t))throw new x("base is required.");return Math.log(e)/Math.log(t)};Xe.cbrt=A(Math.cbrt,function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});Xe.log2=A(Math.log2,function(t){return Math.log(t)*Math.LOG2E});Xe.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))};Xe.fastApproximateAtan=function(e){return T.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};Xe.fastApproximateAtan2=function(e,t){T.typeOf.number("x",e),T.typeOf.number("y",t);let n,i=Math.abs(e);n=Math.abs(t);const o=Math.max(i,n);n=Math.min(i,n);const r=n/o;if(isNaN(r))throw new x("either x or y must be nonzero");return i=Xe.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?Xe.PI_OVER_TWO-i:i,i=e<0?Xe.PI-i:i,i=t<0?-i:i,i};const M=Xe;function f(e,t,n){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0)}f.fromSpherical=function(e,t){T.typeOf.object("spherical",e),l(t)||(t=new f);const n=e.clock,i=e.cone,o=A(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};f.fromElements=function(e,t,n,i){return l(i)?(i.x=e,i.y=t,i.z=n,i):new f(e,t,n)};f.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new f(e.x,e.y,e.z)};f.fromCartesian4=f.clone;f.packedLength=3;f.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};f.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new f),n.x=e[t++],n.y=e[t++],n.z=e[t],n};f.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*3;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 3 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)f.pack(e[o],t,o*3);return t};f.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,3),e.length%3!==0)throw new x("array length must be a multiple of 3.");const n=e.length;l(t)?t.length=n/3:t=new Array(n/3);for(let i=0;i<n;i+=3){const o=i/3;t[o]=f.unpack(e,i,t[o])}return t};f.fromArray=f.unpack;f.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};f.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};f.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n};f.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n};f.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);const o=M.clamp(e.x,t.x,n.x),r=M.clamp(e.y,t.y,n.y),s=M.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};f.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};f.magnitude=function(e){return Math.sqrt(f.magnitudeSquared(e))};const BS=new f;f.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),f.subtract(e,t,BS),f.magnitude(BS)};f.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),f.subtract(e,t,BS),f.magnitudeSquared(BS)};f.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=f.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z))throw new x("normalized result is not a number");return t};f.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z};f.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};f.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};f.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};f.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};f.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};f.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};f.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t};f.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const Wz=new f;f.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),f.multiplyByScalar(t,n,Wz),i=f.multiplyByScalar(e,1-n,i),f.add(Wz,i,i)};const bE=new f,XI=new f;f.angleBetween=function(e,t){T.typeOf.object("left",e),T.typeOf.object("right",t),f.normalize(e,bE),f.normalize(t,XI);const n=f.dot(bE,XI),i=f.magnitude(f.cross(bE,XI,bE));return Math.atan2(i,n)};const a_e=new f;f.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=f.normalize(e,a_e);return f.abs(n,n),n.x<=n.y?n.x<=n.z?t=f.clone(f.UNIT_X,t):t=f.clone(f.UNIT_Z,t):n.y<=n.z?t=f.clone(f.UNIT_Y,t):t=f.clone(f.UNIT_Z,t),t};f.projectVector=function(e,t,n){T.defined("a",e),T.defined("b",t),T.defined("result",n);const i=f.dot(e,t)/f.dot(t,t);return f.multiplyByScalar(t,i,n)};f.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};f.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};f.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&M.equalsEpsilon(e.x,t.x,n,i)&&M.equalsEpsilon(e.y,t.y,n,i)&&M.equalsEpsilon(e.z,t.z,n,i)};f.cross=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=t.x,a=t.y,c=t.z,u=o*c-r*a,d=r*s-i*c,h=i*a-o*s;return n.x=u,n.y=d,n.z=h,n};f.midpoint=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=(e.x+t.x)*.5,n.y=(e.y+t.y)*.5,n.z=(e.z+t.z)*.5,n};f.fromDegrees=function(e,t,n,i,o){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),e=M.toRadians(e),t=M.toRadians(t),f.fromRadians(e,t,n,i,o)};let Uc=new f,Tg=new f;const c_e=new f(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);f.fromRadians=function(e,t,n,i,o){T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),n=A(n,0);const r=l(i)?i.radiiSquared:c_e,s=Math.cos(t);Uc.x=s*Math.cos(e),Uc.y=s*Math.sin(e),Uc.z=Math.sin(t),Uc=f.normalize(Uc,Uc),f.multiplyComponents(r,Uc,Tg);const a=Math.sqrt(f.dot(Uc,Tg));return Tg=f.divideByScalar(Tg,a,Tg),Uc=f.multiplyByScalar(Uc,n,Uc),l(o)||(o=new f),f.add(Tg,Uc,o)};f.fromDegreesArray=function(e,t,n){if(T.defined("coordinates",e),e.length<2||e.length%2!==0)throw new x("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;l(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=f.fromDegrees(r,s,0,t,n[a])}return n};f.fromRadiansArray=function(e,t,n){if(T.defined("coordinates",e),e.length<2||e.length%2!==0)throw new x("the number of coordinates must be a multiple of 2 and at least 2");const i=e.length;l(n)?n.length=i/2:n=new Array(i/2);for(let o=0;o<i;o+=2){const r=e[o],s=e[o+1],a=o/2;n[a]=f.fromRadians(r,s,0,t,n[a])}return n};f.fromDegreesArrayHeights=function(e,t,n){if(T.defined("coordinates",e),e.length<3||e.length%3!==0)throw new x("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;l(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],c=o/3;n[c]=f.fromDegrees(r,s,a,t,n[c])}return n};f.fromRadiansArrayHeights=function(e,t,n){if(T.defined("coordinates",e),e.length<3||e.length%3!==0)throw new x("the number of coordinates must be a multiple of 3 and at least 3");const i=e.length;l(n)?n.length=i/3:n=new Array(i/3);for(let o=0;o<i;o+=3){const r=e[o],s=e[o+1],a=e[o+2],c=o/3;n[c]=f.fromRadians(r,s,a,t,n[c])}return n};f.ZERO=Object.freeze(new f(0,0,0));f.ONE=Object.freeze(new f(1,1,1));f.UNIT_X=Object.freeze(new f(1,0,0));f.UNIT_Y=Object.freeze(new f(0,1,0));f.UNIT_Z=Object.freeze(new f(0,0,1));f.prototype.clone=function(e){return f.clone(this,e)};f.prototype.equals=function(e){return f.equals(this,e)};f.prototype.equalsEpsilon=function(e,t,n){return f.equalsEpsilon(this,e,t,n)};f.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z})`};function oe(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0),this.w=A(i,0)}oe.fromElements=function(e,t,n,i,o){return l(o)?(o.x=e,o.y=t,o.z=n,o.w=i,o):new oe(e,t,n,i)};oe.fromColor=function(e,t){return T.typeOf.object("color",e),l(t)?(t.x=e.red,t.y=e.green,t.z=e.blue,t.w=e.alpha,t):new oe(e.red,e.green,e.blue,e.alpha)};oe.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new oe(e.x,e.y,e.z,e.w)};oe.packedLength=4;oe.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};oe.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new oe),n.x=e[t++],n.y=e[t++],n.z=e[t++],n.w=e[t],n};oe.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*4;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)oe.pack(e[o],t,o*4);return t};oe.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new x("array length must be a multiple of 4.");const n=e.length;l(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=oe.unpack(e,i,t[o])}return t};oe.fromArray=oe.unpack;oe.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)};oe.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)};oe.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n.z=Math.min(e.z,t.z),n.w=Math.min(e.w,t.w),n};oe.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n.z=Math.max(e.z,t.z),n.w=Math.max(e.w,t.w),n};oe.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);const o=M.clamp(e.x,t.x,n.x),r=M.clamp(e.y,t.y,n.y),s=M.clamp(e.z,t.z,n.z),a=M.clamp(e.w,t.w,n.w);return i.x=o,i.y=r,i.z=s,i.w=a,i};oe.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};oe.magnitude=function(e){return Math.sqrt(oe.magnitudeSquared(e))};const RS=new oe;oe.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),oe.subtract(e,t,RS),oe.magnitude(RS)};oe.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),oe.subtract(e,t,RS),oe.magnitudeSquared(RS)};oe.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=oe.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n,t.w=e.w/n,isNaN(t.x)||isNaN(t.y)||isNaN(t.z)||isNaN(t.w))throw new x("normalized result is not a number");return t};oe.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};oe.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n.w=e.w*t.w,n};oe.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n.w=e.w/t.w,n};oe.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};oe.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};oe.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};oe.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};oe.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};oe.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t.w=Math.abs(e.w),t};const jz=new oe;oe.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),oe.multiplyByScalar(t,n,jz),i=oe.multiplyByScalar(e,1-n,i),oe.add(jz,i,i)};const l_e=new oe;oe.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=oe.normalize(e,l_e);return oe.abs(n,n),n.x<=n.y?n.x<=n.z?n.x<=n.w?t=oe.clone(oe.UNIT_X,t):t=oe.clone(oe.UNIT_W,t):n.z<=n.w?t=oe.clone(oe.UNIT_Z,t):t=oe.clone(oe.UNIT_W,t):n.y<=n.z?n.y<=n.w?t=oe.clone(oe.UNIT_Y,t):t=oe.clone(oe.UNIT_W,t):n.z<=n.w?t=oe.clone(oe.UNIT_Z,t):t=oe.clone(oe.UNIT_W,t),t};oe.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};oe.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]};oe.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&M.equalsEpsilon(e.x,t.x,n,i)&&M.equalsEpsilon(e.y,t.y,n,i)&&M.equalsEpsilon(e.z,t.z,n,i)&&M.equalsEpsilon(e.w,t.w,n,i)};oe.ZERO=Object.freeze(new oe(0,0,0,0));oe.ONE=Object.freeze(new oe(1,1,1,1));oe.UNIT_X=Object.freeze(new oe(1,0,0,0));oe.UNIT_Y=Object.freeze(new oe(0,1,0,0));oe.UNIT_Z=Object.freeze(new oe(0,0,1,0));oe.UNIT_W=Object.freeze(new oe(0,0,0,1));oe.prototype.clone=function(e){return oe.clone(this,e)};oe.prototype.equals=function(e){return oe.equals(this,e)};oe.prototype.equalsEpsilon=function(e,t,n){return oe.equalsEpsilon(this,e,t,n)};oe.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};const JN=new Float32Array(1),$s=new Uint8Array(JN.buffer),u_e=new Uint32Array([287454020]),d_e=new Uint8Array(u_e.buffer),XW=d_e[0]===68;oe.packFloat=function(e,t){return T.typeOf.number("value",e),l(t)||(t=new oe),JN[0]=e,XW?(t.x=$s[0],t.y=$s[1],t.z=$s[2],t.w=$s[3]):(t.x=$s[3],t.y=$s[2],t.z=$s[1],t.w=$s[0]),t};oe.unpackFloat=function(e){return T.typeOf.object("packedFloat",e),XW?($s[0]=e.x,$s[1]=e.y,$s[2]=e.z,$s[3]=e.w):($s[0]=e.w,$s[1]=e.z,$s[2]=e.y,$s[3]=e.x),JN[0]};function J(e,t,n,i,o,r,s,a,c){this[0]=A(e,0),this[1]=A(i,0),this[2]=A(s,0),this[3]=A(t,0),this[4]=A(o,0),this[5]=A(a,0),this[6]=A(n,0),this[7]=A(r,0),this[8]=A(c,0)}J.packedLength=9;J.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(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};J.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new J),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};J.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*9;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 9 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)J.pack(e[o],t,o*9);return t};J.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,9),e.length%9!==0)throw new x("array length must be a multiple of 9.");const n=e.length;l(t)?t.length=n/9:t=new Array(n/9);for(let i=0;i<n;i+=9){const o=i/9;t[o]=J.unpack(e,i,t[o])}return t};J.clone=function(e,t){if(l(e))return l(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 J(e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8])};J.fromArray=J.unpack;J.fromColumnMajorArray=function(e,t){return T.defined("values",e),J.clone(e,t)};J.fromRowMajorArray=function(e,t){return T.defined("values",e),l(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 J(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};J.fromQuaternion=function(e,t){T.typeOf.object("quaternion",e);const 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,u=e.z*e.z,d=e.z*e.w,h=e.w*e.w,m=n-s-u+h,g=2*(i-d),p=2*(o+c),y=2*(i+d),b=-n+s-u+h,C=2*(a-r),E=2*(o-c),w=2*(a+r),S=-n-s+u+h;return l(t)?(t[0]=m,t[1]=y,t[2]=E,t[3]=g,t[4]=b,t[5]=w,t[6]=p,t[7]=C,t[8]=S,t):new J(m,g,p,y,b,C,E,w,S)};J.fromHeadingPitchRoll=function(e,t){T.typeOf.object("headingPitchRoll",e);const 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,u=-o*s+a*r*i,d=a*s+o*r*i,h=n*s,m=o*i+a*r*s,g=-a*i+o*r*s,p=-r,y=a*n,b=o*n;return l(t)?(t[0]=c,t[1]=h,t[2]=p,t[3]=u,t[4]=m,t[5]=y,t[6]=d,t[7]=g,t[8]=b,t):new J(c,u,d,h,m,g,p,y,b)};J.fromScale=function(e,t){return T.typeOf.object("scale",e),l(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 J(e.x,0,0,0,e.y,0,0,0,e.z)};J.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),l(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 J(e,0,0,0,e,0,0,0,e)};J.fromCrossProduct=function(e,t){return T.typeOf.object("vector",e),l(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 J(0,-e.z,e.y,e.z,0,-e.x,-e.y,e.x,0)};J.fromRotationX=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(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 J(1,0,0,0,n,-i,0,i,n)};J.fromRotationY=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(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 J(n,0,i,0,1,0,-i,0,n)};J.fromRotationZ=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(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 J(n,-i,0,i,n,0,0,0,1)};J.toArray=function(e,t){return T.typeOf.object("matrix",e),l(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]]};J.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,2),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,2),e*3+t};J.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);const 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};J.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=J.clone(e,i);const o=t*3;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i};J.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("result",n);const i=e[t],o=e[t+3],r=e[t+6];return n.x=i,n.y=o,n.z=r,n};J.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,2),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=J.clone(e,i),i[t]=n.x,i[t+3]=n.y,i[t+6]=n.z,i};const f_e=new f;J.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);const i=J.getScale(e,f_e),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};const h_e=new f;J.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);const i=J.getScale(e,h_e),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};const KI=new f;J.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=f.magnitude(f.fromElements(e[0],e[1],e[2],KI)),t.y=f.magnitude(f.fromElements(e[3],e[4],e[5],KI)),t.z=f.magnitude(f.fromElements(e[6],e[7],e[8],KI)),t};const qz=new f;J.getMaximumScale=function(e){return J.getScale(e,qz),f.maximumComponent(qz)};const p_e=new f;J.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);const i=J.getScale(e,p_e);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};const m_e=new f;J.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=J.getScale(e,m_e);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};J.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const 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],u=e[0]*t[6]+e[3]*t[7]+e[6]*t[8],d=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=c,n[6]=u,n[7]=d,n[8]=h,n};J.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n};J.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n};J.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const 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};J.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};J.multiplyByScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.x,n[3]=e[3]*t.y,n[4]=e[4]*t.y,n[5]=e[5]*t.y,n[6]=e[6]*t.z,n[7]=e[7]*t.z,n[8]=e[8]*t.z,n};J.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n};J.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t};J.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[3],o=e[6],r=e[1],s=e[4],a=e[7],c=e[2],u=e[5],d=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]=u,t[8]=d,t};function __e(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}const nB=[1,0,0],iB=[2,2,1];function g_e(e){let t=0;for(let n=0;n<3;++n){const i=e[J.getElementIndex(iB[n],nB[n])];t+=2*i*i}return Math.sqrt(t)}function y_e(e,t){const n=M.EPSILON15;let i=0,o=1;for(let u=0;u<3;++u){const d=Math.abs(e[J.getElementIndex(iB[u],nB[u])]);d>i&&(o=u,i=d)}let r=1,s=0;const a=nB[o],c=iB[o];if(Math.abs(e[J.getElementIndex(c,a)])>n){const u=e[J.getElementIndex(c,c)],d=e[J.getElementIndex(a,a)],h=e[J.getElementIndex(c,a)],m=(u-d)/2/h;let g;m<0?g=-1/(-m+Math.sqrt(1+m*m)):g=1/(m+Math.sqrt(1+m*m)),r=1/Math.sqrt(1+g*g),s=g*r}return t=J.clone(J.IDENTITY,t),t[J.getElementIndex(a,a)]=t[J.getElementIndex(c,c)]=r,t[J.getElementIndex(c,a)]=s,t[J.getElementIndex(a,c)]=-s,t}const CE=new J,$z=new J;J.computeEigenDecomposition=function(e,t){T.typeOf.object("matrix",e);const n=M.EPSILON20,i=10;let o=0,r=0;l(t)||(t={});const s=t.unitary=J.clone(J.IDENTITY,t.unitary),a=t.diagonal=J.clone(e,t.diagonal),c=n*__e(a);for(;r<i&&g_e(a)>c;)y_e(a,CE),J.transpose(CE,$z),J.multiply(a,CE,a),J.multiply($z,a,a),J.multiply(s,CE,s),++o>2&&(++r,o=0);return t};J.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t};J.determinant=function(e){T.typeOf.object("matrix",e);const t=e[0],n=e[3],i=e[6],o=e[1],r=e[4],s=e[7],a=e[2],c=e[5],u=e[8];return t*(r*u-c*s)+o*(c*i-n*u)+a*(n*s-r*i)};J.inverse=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[3],s=e[4],a=e[5],c=e[6],u=e[7],d=e[8],h=J.determinant(e);if(Math.abs(h)<=M.EPSILON15)throw new x("matrix is not invertible");t[0]=s*d-u*a,t[1]=u*o-i*d,t[2]=i*a-s*o,t[3]=c*a-r*d,t[4]=n*d-c*o,t[5]=r*o-n*a,t[6]=r*u-c*s,t[7]=c*i-n*u,t[8]=n*s-r*i;const m=1/h;return J.multiplyByScalar(t,m,t)};const A_e=new J;J.inverseTranspose=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),J.inverse(J.transpose(e,A_e),t)};J.equals=function(e,t){return e===t||l(e)&&l(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]};J.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(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};J.IDENTITY=Object.freeze(new J(1,0,0,0,1,0,0,0,1));J.ZERO=Object.freeze(new J(0,0,0,0,0,0,0,0,0));J.COLUMN0ROW0=0;J.COLUMN0ROW1=1;J.COLUMN0ROW2=2;J.COLUMN1ROW0=3;J.COLUMN1ROW1=4;J.COLUMN1ROW2=5;J.COLUMN2ROW0=6;J.COLUMN2ROW1=7;J.COLUMN2ROW2=8;Object.defineProperties(J.prototype,{length:{get:function(){return J.packedLength}}});J.prototype.clone=function(e){return J.clone(this,e)};J.prototype.equals=function(e){return J.equals(this,e)};J.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]};J.prototype.equalsEpsilon=function(e,t){return J.equalsEpsilon(this,e,t)};J.prototype.toString=function(){return`(${this[0]}, ${this[3]}, ${this[6]})
|
||
(${this[1]}, ${this[4]}, ${this[7]})
|
||
(${this[2]}, ${this[5]}, ${this[8]})`};function Ie(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}l(Object.create)&&(Ie.prototype=Object.create(Error.prototype),Ie.prototype.constructor=Ie);Ie.prototype.toString=function(){let e=`${this.name}: ${this.message}`;return l(this.stack)&&(e+=`
|
||
${this.stack.toString()}`),e};function B(e,t,n,i,o,r,s,a,c,u,d,h,m,g,p,y){this[0]=A(e,0),this[1]=A(o,0),this[2]=A(c,0),this[3]=A(m,0),this[4]=A(t,0),this[5]=A(r,0),this[6]=A(u,0),this[7]=A(g,0),this[8]=A(n,0),this[9]=A(s,0),this[10]=A(d,0),this[11]=A(p,0),this[12]=A(i,0),this[13]=A(a,0),this[14]=A(h,0),this[15]=A(y,0)}B.packedLength=16;B.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(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};B.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new B),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};B.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*16;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 16 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)B.pack(e[o],t,o*16);return t};B.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,16),e.length%16!==0)throw new x("array length must be a multiple of 16.");const n=e.length;l(t)?t.length=n/16:t=new Array(n/16);for(let i=0;i<n;i+=16){const o=i/16;t[o]=B.unpack(e,i,t[o])}return t};B.clone=function(e,t){if(l(e))return l(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 B(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])};B.fromArray=B.unpack;B.fromColumnMajorArray=function(e,t){return T.defined("values",e),B.clone(e,t)};B.fromRowMajorArray=function(e,t){return T.defined("values",e),l(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 B(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])};B.fromRotationTranslation=function(e,t,n){return T.typeOf.object("rotation",e),t=A(t,f.ZERO),l(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 B(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)};B.fromTranslationQuaternionRotationScale=function(e,t,n,i){T.typeOf.object("translation",e),T.typeOf.object("rotation",t),T.typeOf.object("scale",n),l(i)||(i=new B);const o=n.x,r=n.y,s=n.z,a=t.x*t.x,c=t.x*t.y,u=t.x*t.z,d=t.x*t.w,h=t.y*t.y,m=t.y*t.z,g=t.y*t.w,p=t.z*t.z,y=t.z*t.w,b=t.w*t.w,C=a-h-p+b,E=2*(c-y),w=2*(u+g),S=2*(c+y),P=-a+h-p+b,L=2*(m-d),z=2*(u-g),R=2*(m+d),F=-a-h+p+b;return i[0]=C*o,i[1]=S*o,i[2]=z*o,i[3]=0,i[4]=E*r,i[5]=P*r,i[6]=R*r,i[7]=0,i[8]=w*s,i[9]=L*s,i[10]=F*s,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,i};B.fromTranslationRotationScale=function(e,t){return T.typeOf.object("translationRotationScale",e),B.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};B.fromTranslation=function(e,t){return T.typeOf.object("translation",e),B.fromRotationTranslation(J.IDENTITY,e,t)};B.fromScale=function(e,t){return T.typeOf.object("scale",e),l(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 B(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1)};B.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),l(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 B(e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1)};B.fromRotation=function(e,t){return T.typeOf.object("rotation",e),l(t)||(t=new B),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};const Eg=new f,xg=new f,oA=new f;B.fromCamera=function(e,t){T.typeOf.object("camera",e);const n=e.position,i=e.direction,o=e.up;T.typeOf.object("camera.position",n),T.typeOf.object("camera.direction",i),T.typeOf.object("camera.up",o),f.normalize(i,Eg),f.normalize(f.cross(Eg,o,xg),xg),f.normalize(f.cross(xg,Eg,oA),oA);const r=xg.x,s=xg.y,a=xg.z,c=Eg.x,u=Eg.y,d=Eg.z,h=oA.x,m=oA.y,g=oA.z,p=n.x,y=n.y,b=n.z,C=r*-p+s*-y+a*-b,E=h*-p+m*-y+g*-b,w=c*p+u*y+d*b;return l(t)?(t[0]=r,t[1]=h,t[2]=-c,t[3]=0,t[4]=s,t[5]=m,t[6]=-u,t[7]=0,t[8]=a,t[9]=g,t[10]=-d,t[11]=0,t[12]=C,t[13]=E,t[14]=w,t[15]=1,t):new B(r,s,a,C,h,m,g,E,-c,-u,-d,w,0,0,0,1)};B.computePerspectiveFieldOfView=function(e,t,n,i,o){T.typeOf.number.greaterThan("fovY",e,0),T.typeOf.number.lessThan("fovY",e,Math.PI),T.typeOf.number.greaterThan("near",n,0),T.typeOf.number.greaterThan("far",i,0),T.typeOf.object("result",o);const s=1/Math.tan(e*.5),a=s/t,c=(i+n)/(n-i),u=2*i*n/(n-i);return o[0]=a,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=c,o[11]=-1,o[12]=0,o[13]=0,o[14]=u,o[15]=0,o};B.computeOrthographicOffCenter=function(e,t,n,i,o,r,s){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.number("far",r),T.typeOf.object("result",s);let a=1/(t-e),c=1/(i-n),u=1/(r-o);const d=-(t+e)*a,h=-(i+n)*c,m=-(r+o)*u;return a*=2,c*=2,u*=-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]=u,s[11]=0,s[12]=d,s[13]=h,s[14]=m,s[15]=1,s};B.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.number("far",r),T.typeOf.object("result",s);const a=2*o/(t-e),c=2*o/(i-n),u=(t+e)/(t-e),d=(i+n)/(i-n),h=-(r+o)/(r-o),m=-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]=u,s[9]=d,s[10]=h,s[11]=m,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};B.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){T.typeOf.number("left",e),T.typeOf.number("right",t),T.typeOf.number("bottom",n),T.typeOf.number("top",i),T.typeOf.number("near",o),T.typeOf.object("result",r);const s=2*o/(t-e),a=2*o/(i-n),c=(t+e)/(t-e),u=(i+n)/(i-n),d=-1,h=-1,m=-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]=u,r[10]=d,r[11]=h,r[12]=0,r[13]=0,r[14]=m,r[15]=0,r};B.computeViewportTransformation=function(e,t,n,i){l(i)||(i=new B),e=A(e,A.EMPTY_OBJECT);const o=A(e.x,0),r=A(e.y,0),s=A(e.width,0),a=A(e.height,0);t=A(t,0),n=A(n,1);const c=s*.5,u=a*.5,d=(n-t)*.5,h=c,m=u,g=d,p=o+c,y=r+u,b=t+d,C=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=m,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=g,i[11]=0,i[12]=p,i[13]=y,i[14]=b,i[15]=C,i};B.computeView=function(e,t,n,i,o){return T.typeOf.object("position",e),T.typeOf.object("direction",t),T.typeOf.object("up",n),T.typeOf.object("right",i),T.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-f.dot(i,e),o[13]=-f.dot(n,e),o[14]=f.dot(t,e),o[15]=1,o};B.toArray=function(e,t){return T.typeOf.object("matrix",e),l(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]]};B.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,3),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,3),e*4+t};B.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("result",n);const 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};B.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=B.clone(e,i);const o=t*4;return i[o]=n.x,i[o+1]=n.y,i[o+2]=n.z,i[o+3]=n.w,i};B.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("result",n);const 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};B.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,3),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=B.clone(e,i),i[t]=n.x,i[t+4]=n.y,i[t+8]=n.z,i[t+12]=n.w,i};B.setTranslation=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("translation",t),T.typeOf.object("result",n),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=e[15],n};const b_e=new f;B.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);const i=B.getScale(e,b_e),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};const C_e=new f;B.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);const i=B.getScale(e,C_e),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};const JI=new f;B.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=f.magnitude(f.fromElements(e[0],e[1],e[2],JI)),t.y=f.magnitude(f.fromElements(e[4],e[5],e[6],JI)),t.z=f.magnitude(f.fromElements(e[8],e[9],e[10],JI)),t};const Yz=new f;B.getMaximumScale=function(e){return B.getScale(e,Yz),f.maximumComponent(Yz)};const T_e=new f;B.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);const i=B.getScale(e,T_e);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};const E_e=new f;B.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=B.getScale(e,E_e);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};B.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[3],a=e[4],c=e[5],u=e[6],d=e[7],h=e[8],m=e[9],g=e[10],p=e[11],y=e[12],b=e[13],C=e[14],E=e[15],w=t[0],S=t[1],P=t[2],L=t[3],z=t[4],R=t[5],F=t[6],U=t[7],D=t[8],I=t[9],_=t[10],v=t[11],O=t[12],N=t[13],V=t[14],k=t[15],G=i*w+a*S+h*P+y*L,W=o*w+c*S+m*P+b*L,K=r*w+u*S+g*P+C*L,q=s*w+d*S+p*P+E*L,te=i*z+a*R+h*F+y*U,Y=o*z+c*R+m*F+b*U,X=r*z+u*R+g*F+C*U,$=s*z+d*R+p*F+E*U,se=i*D+a*I+h*_+y*v,ue=o*D+c*I+m*_+b*v,re=r*D+u*I+g*_+C*v,he=s*D+d*I+p*_+E*v,ce=i*O+a*N+h*V+y*k,Q=o*O+c*N+m*V+b*k,ne=r*O+u*N+g*V+C*k,de=s*O+d*N+p*V+E*k;return n[0]=G,n[1]=W,n[2]=K,n[3]=q,n[4]=te,n[5]=Y,n[6]=X,n[7]=$,n[8]=se,n[9]=ue,n[10]=re,n[11]=he,n[12]=ce,n[13]=Q,n[14]=ne,n[15]=de,n};B.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n};B.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n};B.multiplyTransformation=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],u=e[8],d=e[9],h=e[10],m=e[12],g=e[13],p=e[14],y=t[0],b=t[1],C=t[2],E=t[4],w=t[5],S=t[6],P=t[8],L=t[9],z=t[10],R=t[12],F=t[13],U=t[14],D=i*y+s*b+u*C,I=o*y+a*b+d*C,_=r*y+c*b+h*C,v=i*E+s*w+u*S,O=o*E+a*w+d*S,N=r*E+c*w+h*S,V=i*P+s*L+u*z,k=o*P+a*L+d*z,G=r*P+c*L+h*z,W=i*R+s*F+u*U+m,K=o*R+a*F+d*U+g,q=r*R+c*F+h*U+p;return n[0]=D,n[1]=I,n[2]=_,n[3]=0,n[4]=v,n[5]=O,n[6]=N,n[7]=0,n[8]=V,n[9]=k,n[10]=G,n[11]=0,n[12]=W,n[13]=K,n[14]=q,n[15]=1,n};B.multiplyByMatrix3=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("rotation",t),T.typeOf.object("result",n);const i=e[0],o=e[1],r=e[2],s=e[4],a=e[5],c=e[6],u=e[8],d=e[9],h=e[10],m=t[0],g=t[1],p=t[2],y=t[3],b=t[4],C=t[5],E=t[6],w=t[7],S=t[8],P=i*m+s*g+u*p,L=o*m+a*g+d*p,z=r*m+c*g+h*p,R=i*y+s*b+u*C,F=o*y+a*b+d*C,U=r*y+c*b+h*C,D=i*E+s*w+u*S,I=o*E+a*w+d*S,_=r*E+c*w+h*S;return n[0]=P,n[1]=L,n[2]=z,n[3]=0,n[4]=R,n[5]=F,n[6]=U,n[7]=0,n[8]=D,n[9]=I,n[10]=_,n[11]=0,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};B.multiplyByTranslation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("translation",t),T.typeOf.object("result",n);const 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};B.multiplyByScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);const i=t.x,o=t.y,r=t.z;return i===1&&o===1&&r===1?B.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)};B.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3],n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7],n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n};B.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const 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,u=e[2]*i+e[6]*o+e[10]*r+e[14]*s,d=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=c,n.z=u,n.w=d,n};B.multiplyByPointAsVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const 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};B.multiplyByPoint=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const 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};B.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n};B.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t};B.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const 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};B.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t[4]=Math.abs(e[4]),t[5]=Math.abs(e[5]),t[6]=Math.abs(e[6]),t[7]=Math.abs(e[7]),t[8]=Math.abs(e[8]),t[9]=Math.abs(e[9]),t[10]=Math.abs(e[10]),t[11]=Math.abs(e[11]),t[12]=Math.abs(e[12]),t[13]=Math.abs(e[13]),t[14]=Math.abs(e[14]),t[15]=Math.abs(e[15]),t};B.equals=function(e,t){return e===t||l(e)&&l(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]};B.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(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};B.getTranslation=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t};B.getMatrix3=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t};const x_e=new J,w_e=new J,S_e=new oe,v_e=new oe(0,0,0,1);B.inverse=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[4],o=e[8],r=e[12],s=e[1],a=e[5],c=e[9],u=e[13],d=e[2],h=e[6],m=e[10],g=e[14],p=e[3],y=e[7],b=e[11],C=e[15];let E=m*C,w=g*b,S=h*C,P=g*y,L=h*b,z=m*y,R=d*C,F=g*p,U=d*b,D=m*p,I=d*y,_=h*p;const v=E*a+P*c+L*u-(w*a+S*c+z*u),O=w*s+R*c+D*u-(E*s+F*c+U*u),N=S*s+F*a+I*u-(P*s+R*a+_*u),V=z*s+U*a+_*c-(L*s+D*a+I*c),k=w*i+S*o+z*r-(E*i+P*o+L*r),G=E*n+F*o+U*r-(w*n+R*o+D*r),W=P*n+R*i+_*r-(S*n+F*i+I*r),K=L*n+D*i+I*o-(z*n+U*i+_*o);E=o*u,w=r*c,S=i*u,P=r*a,L=i*c,z=o*a,R=n*u,F=r*s,U=n*c,D=o*s,I=n*a,_=i*s;const q=E*y+P*b+L*C-(w*y+S*b+z*C),te=w*p+R*b+D*C-(E*p+F*b+U*C),Y=S*p+F*y+I*C-(P*p+R*y+_*C),X=z*p+U*y+_*b-(L*p+D*y+I*b),$=S*m+z*g+w*h-(L*g+E*h+P*m),se=U*g+E*d+F*m-(R*m+D*g+w*d),ue=R*h+_*g+P*d-(I*g+S*d+F*h),re=I*m+L*d+D*h-(U*h+_*m+z*d);let he=n*v+i*O+o*N+r*V;if(Math.abs(he)<M.EPSILON21){if(J.equalsEpsilon(B.getMatrix3(e,x_e),w_e,M.EPSILON7)&&oe.equals(B.getRow(e,3,S_e),v_e))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 Ie("matrix is not invertible because its determinate is zero.")}return he=1/he,t[0]=v*he,t[1]=O*he,t[2]=N*he,t[3]=V*he,t[4]=k*he,t[5]=G*he,t[6]=W*he,t[7]=K*he,t[8]=q*he,t[9]=te*he,t[10]=Y*he,t[11]=X*he,t[12]=$*he,t[13]=se*he,t[14]=ue*he,t[15]=re*he,t};B.inverseTransformation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=e[0],i=e[1],o=e[2],r=e[4],s=e[5],a=e[6],c=e[8],u=e[9],d=e[10],h=e[12],m=e[13],g=e[14],p=-n*h-i*m-o*g,y=-r*h-s*m-a*g,b=-c*h-u*m-d*g;return t[0]=n,t[1]=r,t[2]=c,t[3]=0,t[4]=i,t[5]=s,t[6]=u,t[7]=0,t[8]=o,t[9]=a,t[10]=d,t[11]=0,t[12]=p,t[13]=y,t[14]=b,t[15]=1,t};const D_e=new B;B.inverseTranspose=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),B.inverse(B.transpose(e,D_e),t)};B.IDENTITY=Object.freeze(new B(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1));B.ZERO=Object.freeze(new B(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));B.COLUMN0ROW0=0;B.COLUMN0ROW1=1;B.COLUMN0ROW2=2;B.COLUMN0ROW3=3;B.COLUMN1ROW0=4;B.COLUMN1ROW1=5;B.COLUMN1ROW2=6;B.COLUMN1ROW3=7;B.COLUMN2ROW0=8;B.COLUMN2ROW1=9;B.COLUMN2ROW2=10;B.COLUMN2ROW3=11;B.COLUMN3ROW0=12;B.COLUMN3ROW1=13;B.COLUMN3ROW2=14;B.COLUMN3ROW3=15;Object.defineProperties(B.prototype,{length:{get:function(){return B.packedLength}}});B.prototype.clone=function(e){return B.clone(this,e)};B.prototype.equals=function(e){return B.equals(this,e)};B.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]};B.prototype.equalsEpsilon=function(e,t){return B.equalsEpsilon(this,e,t)};B.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]})`};const I_e={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},ae=Object.freeze(I_e),P_e=new f;function Et(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const Ts={};Ts[ae.FLOAT]="float";Ts[ae.FLOAT_VEC2]="vec2";Ts[ae.FLOAT_VEC3]="vec3";Ts[ae.FLOAT_VEC4]="vec4";Ts[ae.INT]="int";Ts[ae.INT_VEC2]="ivec2";Ts[ae.INT_VEC3]="ivec3";Ts[ae.INT_VEC4]="ivec4";Ts[ae.BOOL]="bool";Ts[ae.BOOL_VEC2]="bvec2";Ts[ae.BOOL_VEC3]="bvec3";Ts[ae.BOOL_VEC4]="bvec4";Ts[ae.FLOAT_MAT2]="mat2";Ts[ae.FLOAT_MAT3]="mat3";Ts[ae.FLOAT_MAT4]="mat4";Ts[ae.SAMPLER_2D]="sampler2D";Ts[ae.SAMPLER_CUBE]="samplerCube";Et.prototype.getDeclaration=function(e){let t=`uniform ${Ts[this._datatype]} ${e}`;const n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};const O_e={czm_viewport:new Et({size:1,datatype:ae.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new Et({size:1,datatype:ae.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new Et({size:1,datatype:ae.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new Et({size:1,datatype:ae.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new Et({size:1,datatype:ae.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new Et({size:1,datatype:ae.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new Et({size:1,datatype:ae.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return B.getTranslation(e.inverseView,P_e)}}),czm_frameNumber:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new Et({size:1,datatype:ae.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new Et({size:1,datatype:ae.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new Et({size:1,datatype:ae.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new Et({size:1,datatype:ae.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new Et({size:1,datatype:ae.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new Et({size:9,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new Et({size:1,datatype:ae.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.fogDensity}}),czm_splitPosition:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new Et({size:1,datatype:ae.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new Et({size:1,datatype:ae.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new Et({size:1,datatype:ae.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},Dw=O_e;function Ms(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function L_e(){return!0}function He(e,t){t=A(t,"This object was destroyed, i.e., destroy() was called.");function n(){throw new x(t)}for(const i in e)typeof e[i]=="function"&&(e[i]=n);e.isDestroyed=L_e}const jr={UNSIGNED_BYTE:ae.UNSIGNED_BYTE,UNSIGNED_SHORT:ae.UNSIGNED_SHORT,UNSIGNED_INT:ae.UNSIGNED_INT};jr.getSizeInBytes=function(e){switch(e){case jr.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case jr.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case jr.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new x("indexDatatype is required and must be a valid IndexDatatype constant.")};jr.fromSizeInBytes=function(e){switch(e){case 2:return jr.UNSIGNED_SHORT;case 4:return jr.UNSIGNED_INT;case 1:return jr.UNSIGNED_BYTE;default:throw new x("Size in bytes cannot be mapped to an IndexDatatype")}};jr.validate=function(e){return l(e)&&(e===jr.UNSIGNED_BYTE||e===jr.UNSIGNED_SHORT||e===jr.UNSIGNED_INT)};jr.createTypedArray=function(e,t){if(!l(e))throw new x("numberOfVertices is required.");return e>=M.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};jr.createTypedArrayFromArrayBuffer=function(e,t,n,i){if(!l(e))throw new x("numberOfVertices is required.");if(!l(t))throw new x("sourceArray is required.");if(!l(n))throw new x("byteOffset is required.");return e>=M.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};jr.fromTypedArray=function(e){if(e instanceof Uint8Array)return jr.UNSIGNED_BYTE;if(e instanceof Uint16Array)return jr.UNSIGNED_SHORT;if(e instanceof Uint32Array)return jr.UNSIGNED_INT;throw new x("array must be a Uint8Array, Uint16Array, or Uint32Array.")};const at=Object.freeze(jr),Iw={STREAM_DRAW:ae.STREAM_DRAW,STATIC_DRAW:ae.STATIC_DRAW,DYNAMIC_DRAW:ae.DYNAMIC_DRAW,validate:function(e){return e===Iw.STREAM_DRAW||e===Iw.STATIC_DRAW||e===Iw.DYNAMIC_DRAW}},nt=Object.freeze(Iw);function Tt(e){if(e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context),!l(e.typedArray)&&!l(e.sizeInBytes))throw new x("Either options.sizeInBytes or options.typedArray is required.");if(l(e.typedArray)&&l(e.sizeInBytes))throw new x("Cannot pass in both options.sizeInBytes and options.typedArray.");if(l(e.typedArray)&&(T.typeOf.object("options.typedArray",e.typedArray),T.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!nt.validate(e.usage))throw new x("usage is invalid.");const t=e.context._gl,n=e.bufferTarget,i=e.typedArray;let o=e.sizeInBytes;const r=e.usage,s=l(i);s&&(o=i.byteLength),T.typeOf.number.greaterThan("sizeInBytes",o,0);const a=t.createBuffer();t.bindBuffer(n,a),t.bufferData(n,s?i:o,r),t.bindBuffer(n,null),this._id=Ms(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}Tt.createVertexBuffer=function(e){return T.defined("options.context",e.context),new Tt({context:e.context,bufferTarget:ae.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};Tt.createIndexBuffer=function(e){if(T.defined("options.context",e.context),!at.validate(e.indexDatatype))throw new x("Invalid indexDatatype.");if(e.indexDatatype===at.UNSIGNED_INT&&!e.context.elementIndexUint)throw new x("IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint.");const t=e.context,n=e.indexDatatype,i=at.getSizeInBytes(n),o=new Tt({context:t,bufferTarget:ae.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(Tt.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});Tt.prototype._getBuffer=function(){return this._buffer};Tt.prototype.copyFromArrayView=function(e,t){t=A(t,0),T.defined("arrayView",e),T.typeOf.number.lessThanOrEquals("offsetInBytes + arrayView.byteLength",t+e.byteLength,this._sizeInBytes);const n=this._gl,i=this._bufferTarget;n.bindBuffer(i,this._buffer),n.bufferSubData(i,t,e),n.bindBuffer(i,null)};Tt.prototype.copyFromBuffer=function(e,t,n,i){if(!this._webgl2)throw new x("A WebGL 2 context is required.");if(!l(e))throw new x("readBuffer must be defined.");if(!l(i)||i<=0)throw new x("sizeInBytes must be defined and be greater than zero.");if(!l(t)||t<0||t+i>e._sizeInBytes)throw new x("readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes.");if(!l(n)||n<0||n+i>this._sizeInBytes)throw new x("writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes.");if(this._buffer===e._buffer&&(n>=t&&n<t+i||t>n&&t<n+i))throw new x("When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap.");if(this._bufferTarget===ae.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==ae.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==ae.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===ae.ELEMENT_ARRAY_BUFFER)throw new x("Can not copy an index buffer into another buffer type.");const o=ae.COPY_READ_BUFFER,r=ae.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)};Tt.prototype.getBufferData=function(e,t,n,i){if(t=A(t,0),n=A(n,0),!this._webgl2)throw new x("A WebGL 2 context is required.");if(!l(e))throw new x("arrayView is required.");let o,r,s=e.byteLength;if(l(i)?(o=i,l(s)?r=1:(s=e.length,r=e.BYTES_PER_ELEMENT)):l(s)?(o=s-n,r=1):(s=e.length,o=s-n,r=e.BYTES_PER_ELEMENT),n<0||n>s)throw new x("destinationOffset must be greater than zero and less than the arrayView length.");if(n+o>s)throw new x("destinationOffset + length must be less than or equal to the arrayViewLength.");if(t<0||t>this._sizeInBytes)throw new x("sourceOffset must be greater than zero and less than the buffers size.");if(t+o*r>this._sizeInBytes)throw new x("sourceOffset + length must be less than the buffers size.");const a=this._gl,c=ae.COPY_READ_BUFFER;a.bindBuffer(c,this._buffer),a.getBufferSubData(c,t,e,n,i),a.bindBuffer(c,null)};Tt.prototype.isDestroyed=function(){return!1};Tt.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),He(this)};let mh;const Xo={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},ja={};Object.defineProperties(ja,{element:{get:function(){if(ja.supportsFullscreen())return document[Xo.fullscreenElement]}},changeEventName:{get:function(){if(ja.supportsFullscreen())return Xo.fullscreenchange}},errorEventName:{get:function(){if(ja.supportsFullscreen())return Xo.fullscreenerror}},enabled:{get:function(){if(ja.supportsFullscreen())return document[Xo.fullscreenEnabled]}},fullscreen:{get:function(){if(ja.supportsFullscreen())return ja.element!==null}}});ja.supportsFullscreen=function(){if(l(mh))return mh;mh=!1;const e=document.body;if(typeof e.requestFullscreen=="function")return Xo.requestFullscreen="requestFullscreen",Xo.exitFullscreen="exitFullscreen",Xo.fullscreenEnabled="fullscreenEnabled",Xo.fullscreenElement="fullscreenElement",Xo.fullscreenchange="fullscreenchange",Xo.fullscreenerror="fullscreenerror",mh=!0,mh;const t=["webkit","moz","o","ms","khtml"];let n;for(let i=0,o=t.length;i<o;++i){const r=t[i];n=`${r}RequestFullscreen`,typeof e[n]=="function"?(Xo.requestFullscreen=n,mh=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(Xo.requestFullscreen=n,mh=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?Xo.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(Xo.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?Xo.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(Xo.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?Xo.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(Xo.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),Xo.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),Xo.fullscreenerror=n)}return mh};ja.requestFullscreen=function(e,t){ja.supportsFullscreen()&&e[Xo.requestFullscreen]({vrDisplay:t})};ja.exitFullscreen=function(){ja.supportsFullscreen()&&document[Xo.exitFullscreen]()};ja._names=Xo;const os=ja;let ia;typeof navigator<"u"?ia=navigator:ia={};function T_(e){const t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}let TE,KW;function QN(){if(!l(TE)&&(TE=!1,!iD())){const e=/ Chrome\/([\.0-9]+)/.exec(ia.userAgent);e!==null&&(TE=!0,KW=T_(e[1]))}return TE}function B_e(){return QN()&&KW}let EE,JW;function QW(){if(!l(EE)&&(EE=!1,!QN()&&!iD()&&/ Safari\/[\.0-9]+/.test(ia.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(ia.userAgent);e!==null&&(EE=!0,JW=T_(e[1]))}return EE}function R_e(){return QW()&&JW}let xE,oB;function ZW(){if(!l(xE)){xE=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(ia.userAgent);e!==null&&(xE=!0,oB=T_(e[1]),oB.isNightly=!!e[2])}return xE}function N_e(){return ZW()&&oB}let rA,rB;function ej(){if(!l(rA)){rA=!1;let e;ia.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(ia.userAgent),e!==null&&(rA=!0,rB=T_(e[1]))):ia.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(ia.userAgent),e!==null&&(rA=!0,rB=T_(e[1])))}return rA}function M_e(){return ej()&&rB}let wE,tj;function iD(){if(!l(wE)){wE=!1;const e=/ Edg\/([\.0-9]+)/.exec(ia.userAgent);e!==null&&(wE=!0,tj=T_(e[1]))}return wE}function F_e(){return iD()&&tj}let SE,nj;function ZN(){if(!l(SE)){SE=!1;const e=/Firefox\/([\.0-9]+)/.exec(ia.userAgent);e!==null&&(SE=!0,nj=T_(e[1]))}return SE}let QI;function z_e(){return l(QI)||(QI=/Windows/i.test(ia.appVersion)),QI}let ZI;function U_e(){return l(ZI)||(ZI=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),ZI}function H_e(){return ZN()&&nj}let e1;function V_e(){return l(e1)||(e1=!ZN()&&typeof PointerEvent<"u"&&(!l(ia.pointerEnabled)||ia.pointerEnabled)),e1}let ij,vE;function oj(){if(!l(vE)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;vE=l(t)&&t!=="",vE&&(ij=t)}return vE}function k_e(){return oj()?ij:void 0}function qs(){if(!qs.initialized)throw new x("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return qs._result}qs._promise=void 0;qs._result=void 0;qs.initialize=function(){return l(qs._promise)||(qs._promise=new Promise(e=>{const t=new Image;t.onload=function(){qs._result=t.width>0&&t.height>0,e(qs._result)},t.onerror=function(){qs._result=!1,e(qs._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),qs._promise};Object.defineProperties(qs,{initialized:{get:function(){return l(qs._result)}}});const ry=[];typeof ArrayBuffer<"u"&&(ry.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&ry.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&ry.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&ry.push(BigInt64Array),typeof BigUint64Array<"u"&&ry.push(BigUint64Array));const ud={isChrome:QN,chromeVersion:B_e,isSafari:QW,safariVersion:R_e,isWebkit:ZW,webkitVersion:N_e,isInternetExplorer:ej,internetExplorerVersion:M_e,isEdge:iD,edgeVersion:F_e,isFirefox:ZN,firefoxVersion:H_e,isWindows:z_e,isIPadOrIOS:U_e,hardwareConcurrency:A(ia.hardwareConcurrency,3),supportsPointerEvents:V_e,supportsImageRenderingPixelated:oj,supportsWebP:qs,imageRenderingValue:k_e,typedArrayTypes:ry};ud.supportsBasis=function(e){return ud.supportsWebAssembly()&&e.context.supportsBasis};ud.supportsFullscreen=function(){return os.supportsFullscreen()};ud.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};ud.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};ud.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};ud.supportsBigInt=function(){return typeof BigInt<"u"};ud.supportsWebWorkers=function(){return typeof Worker<"u"};ud.supportsWebAssembly=function(){return typeof WebAssembly<"u"};const gn=ud;function t1(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 H(e,t,n,i){this.red=A(e,1),this.green=A(t,1),this.blue=A(n,1),this.alpha=A(i,1)}H.fromCartesian4=function(e,t){return T.typeOf.object("cartesian",e),l(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new H(e.x,e.y,e.z,e.w)};H.fromBytes=function(e,t,n,i,o){return e=H.byteToFloat(A(e,255)),t=H.byteToFloat(A(t,255)),n=H.byteToFloat(A(n,255)),i=H.byteToFloat(A(i,255)),l(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new H(e,t,n,i)};H.fromAlpha=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("alpha",t),l(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new H(e.red,e.green,e.blue,t)};let n1,eM,sf;gn.supportsTypedArrays()&&(n1=new ArrayBuffer(4),eM=new Uint32Array(n1),sf=new Uint8Array(n1));H.fromRgba=function(e,t){return eM[0]=e,H.fromBytes(sf[0],sf[1],sf[2],sf[3],t)};H.fromHsl=function(e,t,n,i,o){e=A(e,0)%1,t=A(t,0),n=A(n,0),i=A(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;const u=2*n-c;r=t1(u,c,e+1/3),s=t1(u,c,e),a=t1(u,c,e-1/3)}return l(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new H(r,s,a,i)};H.fromRandom=function(e,t){e=A(e,A.EMPTY_OBJECT);let n=e.red;if(!l(n)){const s=A(e.minimumRed,0),a=A(e.maximumRed,1);T.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+M.nextRandomNumber()*(a-s)}let i=e.green;if(!l(i)){const s=A(e.minimumGreen,0),a=A(e.maximumGreen,1);T.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+M.nextRandomNumber()*(a-s)}let o=e.blue;if(!l(o)){const s=A(e.minimumBlue,0),a=A(e.maximumBlue,1);T.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+M.nextRandomNumber()*(a-s)}let r=e.alpha;if(!l(r)){const s=A(e.minimumAlpha,0),a=A(e.maximumAlpha,1);T.typeOf.number.lessThanOrEquals("minumumAlpha",s,a),r=s+M.nextRandomNumber()*(a-s)}return l(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new H(n,i,o,r)};const G_e=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,W_e=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,j_e=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,q_e=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;H.fromCssColorString=function(e,t){T.typeOf.string("color",e),l(t)||(t=new H),e=e.replace(/\s/g,"");const n=H[e.toUpperCase()];if(l(n))return H.clone(n,t),t;let i=G_e.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(A(i[4],"f"),16)/15,t):(i=W_e.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(A(i[4],"ff"),16)/255,t):(i=j_e.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(A(i[4],"1.0")),t):(i=q_e.exec(e),i!==null?H.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(A(i[4],"1.0")),t):(t=void 0,t))))};H.packedLength=4;H.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};H.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new H),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};H.byteToFloat=function(e){return e/255};H.floatToByte=function(e){return e===1?255:e*256|0};H.clone=function(e,t){if(l(e))return l(t)?(t.red=e.red,t.green=e.green,t.blue=e.blue,t.alpha=e.alpha,t):new H(e.red,e.green,e.blue,e.alpha)};H.equals=function(e,t){return e===t||l(e)&&l(t)&&e.red===t.red&&e.green===t.green&&e.blue===t.blue&&e.alpha===t.alpha};H.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]};H.prototype.clone=function(e){return H.clone(this,e)};H.prototype.equals=function(e){return H.equals(this,e)};H.prototype.equalsEpsilon=function(e,t){return this===e||l(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};H.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};H.prototype.toCssColorString=function(){const e=H.floatToByte(this.red),t=H.floatToByte(this.green),n=H.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};H.prototype.toCssHexString=function(){let e=H.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=H.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=H.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=H.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};H.prototype.toBytes=function(e){const t=H.floatToByte(this.red),n=H.floatToByte(this.green),i=H.floatToByte(this.blue),o=H.floatToByte(this.alpha);return l(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};H.prototype.toRgba=function(){return sf[0]=H.floatToByte(this.red),sf[1]=H.floatToByte(this.green),sf[2]=H.floatToByte(this.blue),sf[3]=H.floatToByte(this.alpha),eM[0]};H.prototype.brighten=function(e,t){return T.typeOf.number("magnitude",e),T.typeOf.number.greaterThanOrEquals("magnitude",e,0),T.typeOf.object("result",t),e=1-e,t.red=1-(1-this.red)*e,t.green=1-(1-this.green)*e,t.blue=1-(1-this.blue)*e,t.alpha=this.alpha,t};H.prototype.darken=function(e,t){return T.typeOf.number("magnitude",e),T.typeOf.number.greaterThanOrEquals("magnitude",e,0),T.typeOf.object("result",t),e=1-e,t.red=this.red*e,t.green=this.green*e,t.blue=this.blue*e,t.alpha=this.alpha,t};H.prototype.withAlpha=function(e,t){return H.fromAlpha(this,e,t)};H.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red+t.red,n.green=e.green+t.green,n.blue=e.blue+t.blue,n.alpha=e.alpha+t.alpha,n};H.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red-t.red,n.green=e.green-t.green,n.blue=e.blue-t.blue,n.alpha=e.alpha-t.alpha,n};H.multiply=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red*t.red,n.green=e.green*t.green,n.blue=e.blue*t.blue,n.alpha=e.alpha*t.alpha,n};H.divide=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red/t.red,n.green=e.green/t.green,n.blue=e.blue/t.blue,n.alpha=e.alpha/t.alpha,n};H.mod=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.red=e.red%t.red,n.green=e.green%t.green,n.blue=e.blue%t.blue,n.alpha=e.alpha%t.alpha,n};H.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),i.red=M.lerp(e.red,t.red,n),i.green=M.lerp(e.green,t.green,n),i.blue=M.lerp(e.blue,t.blue,n),i.alpha=M.lerp(e.alpha,t.alpha,n),i};H.multiplyByScalar=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.red=e.red*t,n.green=e.green*t,n.blue=e.blue*t,n.alpha=e.alpha*t,n};H.divideByScalar=function(e,t,n){return T.typeOf.object("color",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.red=e.red/t,n.green=e.green/t,n.blue=e.blue/t,n.alpha=e.alpha/t,n};H.ALICEBLUE=Object.freeze(H.fromCssColorString("#F0F8FF"));H.ANTIQUEWHITE=Object.freeze(H.fromCssColorString("#FAEBD7"));H.AQUA=Object.freeze(H.fromCssColorString("#00FFFF"));H.AQUAMARINE=Object.freeze(H.fromCssColorString("#7FFFD4"));H.AZURE=Object.freeze(H.fromCssColorString("#F0FFFF"));H.BEIGE=Object.freeze(H.fromCssColorString("#F5F5DC"));H.BISQUE=Object.freeze(H.fromCssColorString("#FFE4C4"));H.BLACK=Object.freeze(H.fromCssColorString("#000000"));H.BLANCHEDALMOND=Object.freeze(H.fromCssColorString("#FFEBCD"));H.BLUE=Object.freeze(H.fromCssColorString("#0000FF"));H.BLUEVIOLET=Object.freeze(H.fromCssColorString("#8A2BE2"));H.BROWN=Object.freeze(H.fromCssColorString("#A52A2A"));H.BURLYWOOD=Object.freeze(H.fromCssColorString("#DEB887"));H.CADETBLUE=Object.freeze(H.fromCssColorString("#5F9EA0"));H.CHARTREUSE=Object.freeze(H.fromCssColorString("#7FFF00"));H.CHOCOLATE=Object.freeze(H.fromCssColorString("#D2691E"));H.CORAL=Object.freeze(H.fromCssColorString("#FF7F50"));H.CORNFLOWERBLUE=Object.freeze(H.fromCssColorString("#6495ED"));H.CORNSILK=Object.freeze(H.fromCssColorString("#FFF8DC"));H.CRIMSON=Object.freeze(H.fromCssColorString("#DC143C"));H.CYAN=Object.freeze(H.fromCssColorString("#00FFFF"));H.DARKBLUE=Object.freeze(H.fromCssColorString("#00008B"));H.DARKCYAN=Object.freeze(H.fromCssColorString("#008B8B"));H.DARKGOLDENROD=Object.freeze(H.fromCssColorString("#B8860B"));H.DARKGRAY=Object.freeze(H.fromCssColorString("#A9A9A9"));H.DARKGREEN=Object.freeze(H.fromCssColorString("#006400"));H.DARKGREY=H.DARKGRAY;H.DARKKHAKI=Object.freeze(H.fromCssColorString("#BDB76B"));H.DARKMAGENTA=Object.freeze(H.fromCssColorString("#8B008B"));H.DARKOLIVEGREEN=Object.freeze(H.fromCssColorString("#556B2F"));H.DARKORANGE=Object.freeze(H.fromCssColorString("#FF8C00"));H.DARKORCHID=Object.freeze(H.fromCssColorString("#9932CC"));H.DARKRED=Object.freeze(H.fromCssColorString("#8B0000"));H.DARKSALMON=Object.freeze(H.fromCssColorString("#E9967A"));H.DARKSEAGREEN=Object.freeze(H.fromCssColorString("#8FBC8F"));H.DARKSLATEBLUE=Object.freeze(H.fromCssColorString("#483D8B"));H.DARKSLATEGRAY=Object.freeze(H.fromCssColorString("#2F4F4F"));H.DARKSLATEGREY=H.DARKSLATEGRAY;H.DARKTURQUOISE=Object.freeze(H.fromCssColorString("#00CED1"));H.DARKVIOLET=Object.freeze(H.fromCssColorString("#9400D3"));H.DEEPPINK=Object.freeze(H.fromCssColorString("#FF1493"));H.DEEPSKYBLUE=Object.freeze(H.fromCssColorString("#00BFFF"));H.DIMGRAY=Object.freeze(H.fromCssColorString("#696969"));H.DIMGREY=H.DIMGRAY;H.DODGERBLUE=Object.freeze(H.fromCssColorString("#1E90FF"));H.FIREBRICK=Object.freeze(H.fromCssColorString("#B22222"));H.FLORALWHITE=Object.freeze(H.fromCssColorString("#FFFAF0"));H.FORESTGREEN=Object.freeze(H.fromCssColorString("#228B22"));H.FUCHSIA=Object.freeze(H.fromCssColorString("#FF00FF"));H.GAINSBORO=Object.freeze(H.fromCssColorString("#DCDCDC"));H.GHOSTWHITE=Object.freeze(H.fromCssColorString("#F8F8FF"));H.GOLD=Object.freeze(H.fromCssColorString("#FFD700"));H.GOLDENROD=Object.freeze(H.fromCssColorString("#DAA520"));H.GRAY=Object.freeze(H.fromCssColorString("#808080"));H.GREEN=Object.freeze(H.fromCssColorString("#008000"));H.GREENYELLOW=Object.freeze(H.fromCssColorString("#ADFF2F"));H.GREY=H.GRAY;H.HONEYDEW=Object.freeze(H.fromCssColorString("#F0FFF0"));H.HOTPINK=Object.freeze(H.fromCssColorString("#FF69B4"));H.INDIANRED=Object.freeze(H.fromCssColorString("#CD5C5C"));H.INDIGO=Object.freeze(H.fromCssColorString("#4B0082"));H.IVORY=Object.freeze(H.fromCssColorString("#FFFFF0"));H.KHAKI=Object.freeze(H.fromCssColorString("#F0E68C"));H.LAVENDER=Object.freeze(H.fromCssColorString("#E6E6FA"));H.LAVENDAR_BLUSH=Object.freeze(H.fromCssColorString("#FFF0F5"));H.LAWNGREEN=Object.freeze(H.fromCssColorString("#7CFC00"));H.LEMONCHIFFON=Object.freeze(H.fromCssColorString("#FFFACD"));H.LIGHTBLUE=Object.freeze(H.fromCssColorString("#ADD8E6"));H.LIGHTCORAL=Object.freeze(H.fromCssColorString("#F08080"));H.LIGHTCYAN=Object.freeze(H.fromCssColorString("#E0FFFF"));H.LIGHTGOLDENRODYELLOW=Object.freeze(H.fromCssColorString("#FAFAD2"));H.LIGHTGRAY=Object.freeze(H.fromCssColorString("#D3D3D3"));H.LIGHTGREEN=Object.freeze(H.fromCssColorString("#90EE90"));H.LIGHTGREY=H.LIGHTGRAY;H.LIGHTPINK=Object.freeze(H.fromCssColorString("#FFB6C1"));H.LIGHTSEAGREEN=Object.freeze(H.fromCssColorString("#20B2AA"));H.LIGHTSKYBLUE=Object.freeze(H.fromCssColorString("#87CEFA"));H.LIGHTSLATEGRAY=Object.freeze(H.fromCssColorString("#778899"));H.LIGHTSLATEGREY=H.LIGHTSLATEGRAY;H.LIGHTSTEELBLUE=Object.freeze(H.fromCssColorString("#B0C4DE"));H.LIGHTYELLOW=Object.freeze(H.fromCssColorString("#FFFFE0"));H.LIME=Object.freeze(H.fromCssColorString("#00FF00"));H.LIMEGREEN=Object.freeze(H.fromCssColorString("#32CD32"));H.LINEN=Object.freeze(H.fromCssColorString("#FAF0E6"));H.MAGENTA=Object.freeze(H.fromCssColorString("#FF00FF"));H.MAROON=Object.freeze(H.fromCssColorString("#800000"));H.MEDIUMAQUAMARINE=Object.freeze(H.fromCssColorString("#66CDAA"));H.MEDIUMBLUE=Object.freeze(H.fromCssColorString("#0000CD"));H.MEDIUMORCHID=Object.freeze(H.fromCssColorString("#BA55D3"));H.MEDIUMPURPLE=Object.freeze(H.fromCssColorString("#9370DB"));H.MEDIUMSEAGREEN=Object.freeze(H.fromCssColorString("#3CB371"));H.MEDIUMSLATEBLUE=Object.freeze(H.fromCssColorString("#7B68EE"));H.MEDIUMSPRINGGREEN=Object.freeze(H.fromCssColorString("#00FA9A"));H.MEDIUMTURQUOISE=Object.freeze(H.fromCssColorString("#48D1CC"));H.MEDIUMVIOLETRED=Object.freeze(H.fromCssColorString("#C71585"));H.MIDNIGHTBLUE=Object.freeze(H.fromCssColorString("#191970"));H.MINTCREAM=Object.freeze(H.fromCssColorString("#F5FFFA"));H.MISTYROSE=Object.freeze(H.fromCssColorString("#FFE4E1"));H.MOCCASIN=Object.freeze(H.fromCssColorString("#FFE4B5"));H.NAVAJOWHITE=Object.freeze(H.fromCssColorString("#FFDEAD"));H.NAVY=Object.freeze(H.fromCssColorString("#000080"));H.OLDLACE=Object.freeze(H.fromCssColorString("#FDF5E6"));H.OLIVE=Object.freeze(H.fromCssColorString("#808000"));H.OLIVEDRAB=Object.freeze(H.fromCssColorString("#6B8E23"));H.ORANGE=Object.freeze(H.fromCssColorString("#FFA500"));H.ORANGERED=Object.freeze(H.fromCssColorString("#FF4500"));H.ORCHID=Object.freeze(H.fromCssColorString("#DA70D6"));H.PALEGOLDENROD=Object.freeze(H.fromCssColorString("#EEE8AA"));H.PALEGREEN=Object.freeze(H.fromCssColorString("#98FB98"));H.PALETURQUOISE=Object.freeze(H.fromCssColorString("#AFEEEE"));H.PALEVIOLETRED=Object.freeze(H.fromCssColorString("#DB7093"));H.PAPAYAWHIP=Object.freeze(H.fromCssColorString("#FFEFD5"));H.PEACHPUFF=Object.freeze(H.fromCssColorString("#FFDAB9"));H.PERU=Object.freeze(H.fromCssColorString("#CD853F"));H.PINK=Object.freeze(H.fromCssColorString("#FFC0CB"));H.PLUM=Object.freeze(H.fromCssColorString("#DDA0DD"));H.POWDERBLUE=Object.freeze(H.fromCssColorString("#B0E0E6"));H.PURPLE=Object.freeze(H.fromCssColorString("#800080"));H.RED=Object.freeze(H.fromCssColorString("#FF0000"));H.ROSYBROWN=Object.freeze(H.fromCssColorString("#BC8F8F"));H.ROYALBLUE=Object.freeze(H.fromCssColorString("#4169E1"));H.SADDLEBROWN=Object.freeze(H.fromCssColorString("#8B4513"));H.SALMON=Object.freeze(H.fromCssColorString("#FA8072"));H.SANDYBROWN=Object.freeze(H.fromCssColorString("#F4A460"));H.SEAGREEN=Object.freeze(H.fromCssColorString("#2E8B57"));H.SEASHELL=Object.freeze(H.fromCssColorString("#FFF5EE"));H.SIENNA=Object.freeze(H.fromCssColorString("#A0522D"));H.SILVER=Object.freeze(H.fromCssColorString("#C0C0C0"));H.SKYBLUE=Object.freeze(H.fromCssColorString("#87CEEB"));H.SLATEBLUE=Object.freeze(H.fromCssColorString("#6A5ACD"));H.SLATEGRAY=Object.freeze(H.fromCssColorString("#708090"));H.SLATEGREY=H.SLATEGRAY;H.SNOW=Object.freeze(H.fromCssColorString("#FFFAFA"));H.SPRINGGREEN=Object.freeze(H.fromCssColorString("#00FF7F"));H.STEELBLUE=Object.freeze(H.fromCssColorString("#4682B4"));H.TAN=Object.freeze(H.fromCssColorString("#D2B48C"));H.TEAL=Object.freeze(H.fromCssColorString("#008080"));H.THISTLE=Object.freeze(H.fromCssColorString("#D8BFD8"));H.TOMATO=Object.freeze(H.fromCssColorString("#FF6347"));H.TURQUOISE=Object.freeze(H.fromCssColorString("#40E0D0"));H.VIOLET=Object.freeze(H.fromCssColorString("#EE82EE"));H.WHEAT=Object.freeze(H.fromCssColorString("#F5DEB3"));H.WHITE=Object.freeze(H.fromCssColorString("#FFFFFF"));H.WHITESMOKE=Object.freeze(H.fromCssColorString("#F5F5F5"));H.YELLOW=Object.freeze(H.fromCssColorString("#FFFF00"));H.YELLOWGREEN=Object.freeze(H.fromCssColorString("#9ACD32"));H.TRANSPARENT=Object.freeze(new H(0,0,0,0));function co(e){e=A(e,A.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}co.ALL=Object.freeze(new co({color:new H(0,0,0,0),depth:1,stencil:0}));co.prototype.execute=function(e,t){e.clear(this,t)};const $_e={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},Ne=Object.freeze($_e);function yC(e){e=A(e,A.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=A(e.persists,!1),this.pass=Ne.COMPUTE,this.owner=e.owner}yC.prototype.execute=function(e){e.execute(this)};function j(e,t){this.x=A(e,0),this.y=A(t,0)}j.fromElements=function(e,t,n){return l(n)?(n.x=e,n.y=t,n):new j(e,t)};j.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t):new j(e.x,e.y)};j.fromCartesian3=j.clone;j.fromCartesian4=j.clone;j.packedLength=2;j.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.x,t[n]=e.y,t};j.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new j),n.x=e[t++],n.y=e[t],n};j.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*2;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 2 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)j.pack(e[o],t,o*2);return t};j.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,2),e.length%2!==0)throw new x("array length must be a multiple of 2.");const n=e.length;l(t)?t.length=n/2:t=new Array(n/2);for(let i=0;i<n;i+=2){const o=i/2;t[o]=j.unpack(e,i,t[o])}return t};j.fromArray=j.unpack;j.maximumComponent=function(e){return T.typeOf.object("cartesian",e),Math.max(e.x,e.y)};j.minimumComponent=function(e){return T.typeOf.object("cartesian",e),Math.min(e.x,e.y)};j.minimumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.min(e.x,t.x),n.y=Math.min(e.y,t.y),n};j.maximumByComponent=function(e,t,n){return T.typeOf.object("first",e),T.typeOf.object("second",t),T.typeOf.object("result",n),n.x=Math.max(e.x,t.x),n.y=Math.max(e.y,t.y),n};j.clamp=function(e,t,n,i){T.typeOf.object("value",e),T.typeOf.object("min",t),T.typeOf.object("max",n),T.typeOf.object("result",i);const o=M.clamp(e.x,t.x,n.x),r=M.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};j.magnitudeSquared=function(e){return T.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y};j.magnitude=function(e){return Math.sqrt(j.magnitudeSquared(e))};const NS=new j;j.distance=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),j.subtract(e,t,NS),j.magnitude(NS)};j.distanceSquared=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),j.subtract(e,t,NS),j.magnitudeSquared(NS)};j.normalize=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=j.magnitude(e);if(t.x=e.x/n,t.y=e.y/n,isNaN(t.x)||isNaN(t.y))throw new x("normalized result is not a number");return t};j.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y};j.cross=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.y-e.y*t.x};j.multiplyComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n};j.divideComponents=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n};j.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n};j.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n};j.multiplyByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n};j.divideByScalar=function(e,t,n){return T.typeOf.object("cartesian",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n};j.negate=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t};j.abs=function(e,t){return T.typeOf.object("cartesian",e),T.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const Xz=new j;j.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),j.multiplyByScalar(t,n,Xz),i=j.multiplyByScalar(e,1-n,i),j.add(Xz,i,i)};const Kz=new j,Jz=new j;j.angleBetween=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),j.normalize(e,Kz),j.normalize(t,Jz),M.acosClamped(j.dot(Kz,Jz))};const Y_e=new j;j.mostOrthogonalAxis=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=j.normalize(e,Y_e);return j.abs(n,n),n.x<=n.y?t=j.clone(j.UNIT_X,t):t=j.clone(j.UNIT_Y,t),t};j.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y};j.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]};j.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&M.equalsEpsilon(e.x,t.x,n,i)&&M.equalsEpsilon(e.y,t.y,n,i)};j.ZERO=Object.freeze(new j(0,0));j.ONE=Object.freeze(new j(1,1));j.UNIT_X=Object.freeze(new j(1,0));j.UNIT_Y=Object.freeze(new j(0,1));j.prototype.clone=function(e){return j.clone(this,e)};j.prototype.equals=function(e){return j.equals(this,e)};j.prototype.equalsEpsilon=function(e,t,n){return j.equalsEpsilon(this,e,t,n)};j.prototype.toString=function(){return`(${this.x}, ${this.y})`};const X_e=new f,K_e=new f;function rj(e,t,n,i,o){if(!l(e))throw new x("cartesian is required.");if(!l(t))throw new x("oneOverRadii is required.");if(!l(n))throw new x("oneOverRadiiSquared is required.");if(!l(i))throw new x("centerToleranceSquared is required.");const r=e.x,s=e.y,a=e.z,c=t.x,u=t.y,d=t.z,h=r*r*c*c,m=s*s*u*u,g=a*a*d*d,p=h+m+g,y=Math.sqrt(1/p),b=f.multiplyByScalar(e,y,X_e);if(p<i)return isFinite(y)?f.clone(b,o):void 0;const C=n.x,E=n.y,w=n.z,S=K_e;S.x=b.x*C*2,S.y=b.y*E*2,S.z=b.z*w*2;let P=(1-y)*f.magnitude(e)/(.5*f.magnitude(S)),L=0,z,R,F,U,D,I,_,v,O,N,V;do{P-=L,F=1/(1+P*C),U=1/(1+P*E),D=1/(1+P*w),I=F*F,_=U*U,v=D*D,O=I*F,N=_*U,V=v*D,z=h*I+m*_+g*v-1,R=h*O*C+m*N*E+g*V*w;const k=-2*R;L=z/k}while(Math.abs(z)>M.EPSILON12);return l(o)?(o.x=r*F,o.y=s*U,o.z=a*D,o):new f(r*F,s*U,a*D)}function Ce(e,t,n){this.longitude=A(e,0),this.latitude=A(t,0),this.height=A(n,0)}Ce.fromRadians=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),n=A(n,0),l(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Ce(e,t,n)};Ce.fromDegrees=function(e,t,n,i){return T.typeOf.number("longitude",e),T.typeOf.number("latitude",t),e=M.toRadians(e),t=M.toRadians(t),Ce.fromRadians(e,t,n,i)};const J_e=new f,Q_e=new f,Z_e=new f,ege=new f(1/6378137,1/6378137,1/6356752314245179e-9),tge=new f(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),nge=M.EPSILON1;Ce.fromCartesian=function(e,t,n){const i=l(t)?t.oneOverRadii:ege,o=l(t)?t.oneOverRadiiSquared:tge,r=l(t)?t._centerToleranceSquared:nge,s=rj(e,i,o,r,Q_e);if(!l(s))return;let a=f.multiplyComponents(s,o,J_e);a=f.normalize(a,a);const c=f.subtract(e,s,Z_e),u=Math.atan2(a.y,a.x),d=Math.asin(a.z),h=M.sign(f.dot(c,e))*f.magnitude(c);return l(n)?(n.longitude=u,n.latitude=d,n.height=h,n):new Ce(u,d,h)};Ce.toCartesian=function(e,t,n){return T.defined("cartographic",e),f.fromRadians(e.longitude,e.latitude,e.height,t,n)};Ce.clone=function(e,t){if(l(e))return l(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Ce(e.longitude,e.latitude,e.height)};Ce.equals=function(e,t){return e===t||l(e)&&l(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};Ce.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(e.longitude-t.longitude)<=n&&Math.abs(e.latitude-t.latitude)<=n&&Math.abs(e.height-t.height)<=n};Ce.ZERO=Object.freeze(new Ce(0,0,0));Ce.prototype.clone=function(e){return Ce.clone(this,e)};Ce.prototype.equals=function(e){return Ce.equals(this,e)};Ce.prototype.equalsEpsilon=function(e,t){return Ce.equalsEpsilon(this,e,t)};Ce.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function sj(e,t,n,i){t=A(t,0),n=A(n,0),i=A(i,0),T.typeOf.number.greaterThanOrEquals("x",t,0),T.typeOf.number.greaterThanOrEquals("y",n,0),T.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new f(t,n,i),e._radiiSquared=new f(t*t,n*n,i*i),e._radiiToTheFourth=new f(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new f(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new f(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=M.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function me(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,sj(this,e,t,n)}Object.defineProperties(me.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}}});me.clone=function(e,t){if(!l(e))return;const n=e._radii;return l(t)?(f.clone(n,t._radii),f.clone(e._radiiSquared,t._radiiSquared),f.clone(e._radiiToTheFourth,t._radiiToTheFourth),f.clone(e._oneOverRadii,t._oneOverRadii),f.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new me(n.x,n.y,n.z)};me.fromCartesian3=function(e,t){return l(t)||(t=new me),l(e)&&sj(t,e.x,e.y,e.z),t};me.WGS84=Object.freeze(new me(6378137,6378137,6356752314245179e-9));me.UNIT_SPHERE=Object.freeze(new me(1,1,1));me.MOON=Object.freeze(new me(M.LUNAR_RADIUS,M.LUNAR_RADIUS,M.LUNAR_RADIUS));me.prototype.clone=function(e){return me.clone(this,e)};me.packedLength=f.packedLength;me.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),f.pack(e._radii,t,n),t};me.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=f.unpack(e,t);return me.fromCartesian3(i,n)};me.prototype.geocentricSurfaceNormal=f.normalize;me.prototype.geodeticSurfaceNormalCartographic=function(e,t){T.typeOf.object("cartographic",e);const 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 l(t)||(t=new f),t.x=r,t.y=s,t.z=a,f.normalize(t,t)};me.prototype.geodeticSurfaceNormal=function(e,t){if(!f.equalsEpsilon(e,f.ZERO,M.EPSILON14))return l(t)||(t=new f),t=f.multiplyComponents(e,this._oneOverRadiiSquared,t),f.normalize(t,t)};const ige=new f,oge=new f;me.prototype.cartographicToCartesian=function(e,t){const n=ige,i=oge;this.geodeticSurfaceNormalCartographic(e,n),f.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(f.dot(n,i));return f.divideByScalar(i,o,i),f.multiplyByScalar(n,e.height,n),l(t)||(t=new f),f.add(i,n,t)};me.prototype.cartographicArrayToCartesianArray=function(e,t){T.defined("cartographics",e);const n=e.length;l(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};const rge=new f,sge=new f,age=new f;me.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,sge);if(!l(n))return;const i=this.geodeticSurfaceNormal(n,rge),o=f.subtract(e,n,age),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=M.sign(f.dot(o,e))*f.magnitude(o);return l(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new Ce(r,s,a)};me.prototype.cartesianArrayToCartographicArray=function(e,t){T.defined("cartesians",e);const n=e.length;l(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};me.prototype.scaleToGeodeticSurface=function(e,t){return rj(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};me.prototype.scaleToGeocentricSurface=function(e,t){T.typeOf.object("cartesian",e),l(t)||(t=new f);const 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 f.multiplyByScalar(e,s,t)};me.prototype.transformPositionToScaledSpace=function(e,t){return l(t)||(t=new f),f.multiplyComponents(e,this._oneOverRadii,t)};me.prototype.transformPositionFromScaledSpace=function(e,t){return l(t)||(t=new f),f.multiplyComponents(e,this._radii,t)};me.prototype.equals=function(e){return this===e||l(e)&&f.equals(this._radii,e._radii)};me.prototype.toString=function(){return this._radii.toString()};me.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(T.typeOf.object("position",e),!M.equalsEpsilon(this._radii.x,this._radii.y,M.EPSILON15))throw new x("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");T.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=A(t,0);const i=this._squaredXOverSquaredZ;if(l(n)||(n=new f),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const cge=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],lge=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function Qz(e,t,n){T.typeOf.number("a",e),T.typeOf.number("b",t),T.typeOf.func("func",n);const i=.5*(t+e),o=.5*(t-e);let r=0;for(let s=0;s<5;s++){const a=o*cge[s];r+=lge[s]*(n(i+a)+n(i-a))}return r*=o,r}me.prototype.surfaceArea=function(e){T.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n<t;)n+=M.TWO_PI;const r=this._radiiSquared,s=r.x,a=r.y,c=r.z,u=s*a;return Qz(i,o,function(d){const h=Math.cos(d),m=Math.sin(d);return Math.cos(d)*Qz(t,n,function(g){const p=Math.cos(g),y=Math.sin(g);return Math.sqrt(u*m*m+c*(a*p*p+s*y*y)*h*h)})})};function nr(e){this._ellipsoid=A(e,me.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(nr.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});nr.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=e.latitude*n,r=e.height;return l(t)?(t.x=i,t.y=o,t.z=r,t):new f(i,o,r)};nr.prototype.unproject=function(e,t){if(!l(e))throw new x("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=e.y*n,r=e.z;return l(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new Ce(i,o,r)};const uge={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},xn=Object.freeze(uge);function ge(e,t,n,i){this.west=A(e,0),this.south=A(t,0),this.east=A(n,0),this.north=A(i,0)}Object.defineProperties(ge.prototype,{width:{get:function(){return ge.computeWidth(this)}},height:{get:function(){return ge.computeHeight(this)}}});ge.packedLength=4;ge.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};ge.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new ge),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};ge.computeWidth=function(e){T.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=M.TWO_PI),t-n};ge.computeHeight=function(e){return T.typeOf.object("rectangle",e),e.north-e.south};ge.fromDegrees=function(e,t,n,i,o){return e=M.toRadians(A(e,0)),t=M.toRadians(A(t,0)),n=M.toRadians(A(n,0)),i=M.toRadians(A(i,0)),l(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new ge(e,t,n,i)};ge.fromRadians=function(e,t,n,i,o){return l(o)?(o.west=A(e,0),o.south=A(t,0),o.east=A(n,0),o.north=A(i,0),o):new ge(e,t,n,i)};ge.fromCartographicArray=function(e,t){T.defined("cartographics",e);let n=Number.MAX_VALUE,i=-Number.MAX_VALUE,o=Number.MAX_VALUE,r=-Number.MAX_VALUE,s=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let c=0,u=e.length;c<u;c++){const d=e[c];n=Math.min(n,d.longitude),i=Math.max(i,d.longitude),s=Math.min(s,d.latitude),a=Math.max(a,d.latitude);const h=d.longitude>=0?d.longitude:d.longitude+M.TWO_PI;o=Math.min(o,h),r=Math.max(r,h)}return i-n>r-o&&(n=o,i=r,i>M.PI&&(i=i-M.TWO_PI),n>M.PI&&(n=n-M.TWO_PI)),l(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new ge(n,s,i,a)};ge.fromCartesianArray=function(e,t,n){T.defined("cartesians",e),t=A(t,me.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 u=0,d=e.length;u<d;u++){const h=t.cartesianToCartographic(e[u]);i=Math.min(i,h.longitude),o=Math.max(o,h.longitude),a=Math.min(a,h.latitude),c=Math.max(c,h.latitude);const m=h.longitude>=0?h.longitude:h.longitude+M.TWO_PI;r=Math.min(r,m),s=Math.max(s,m)}return o-i>s-r&&(i=r,o=s,o>M.PI&&(o=o-M.TWO_PI),i>M.PI&&(i=i-M.TWO_PI)),l(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new ge(i,a,o,c)};ge.clone=function(e,t){if(l(e))return l(t)?(t.west=e.west,t.south=e.south,t.east=e.east,t.north=e.north,t):new ge(e.west,e.south,e.east,e.north)};ge.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(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};ge.prototype.clone=function(e){return ge.clone(this,e)};ge.prototype.equals=function(e){return ge.equals(this,e)};ge.equals=function(e,t){return e===t||l(e)&&l(t)&&e.west===t.west&&e.south===t.south&&e.east===t.east&&e.north===t.north};ge.prototype.equalsEpsilon=function(e,t){return ge.equalsEpsilon(this,e,t)};ge.validate=function(e){T.typeOf.object("rectangle",e);const t=e.north;T.typeOf.number.greaterThanOrEquals("north",t,-M.PI_OVER_TWO),T.typeOf.number.lessThanOrEquals("north",t,M.PI_OVER_TWO);const n=e.south;T.typeOf.number.greaterThanOrEquals("south",n,-M.PI_OVER_TWO),T.typeOf.number.lessThanOrEquals("south",n,M.PI_OVER_TWO);const i=e.west;T.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),T.typeOf.number.lessThanOrEquals("west",i,Math.PI);const o=e.east;T.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),T.typeOf.number.lessThanOrEquals("east",o,Math.PI)};ge.southwest=function(e,t){return T.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Ce(e.west,e.south)};ge.northwest=function(e,t){return T.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Ce(e.west,e.north)};ge.northeast=function(e,t){return T.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Ce(e.east,e.north)};ge.southeast=function(e,t){return T.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Ce(e.east,e.south)};ge.center=function(e,t){T.typeOf.object("rectangle",e);let n=e.east;const i=e.west;n<i&&(n+=M.TWO_PI);const o=M.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return l(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new Ce(o,r)};ge.intersection=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=M.TWO_PI:r<s&&i>0&&(r+=M.TWO_PI),i<o&&s<0?s+=M.TWO_PI:r<s&&o<0&&(o+=M.TWO_PI);const a=M.negativePiToPi(Math.max(o,s)),c=M.negativePiToPi(Math.min(i,r));if((e.west<e.east||t.west<t.east)&&c<=a)return;const u=Math.max(e.south,t.south),d=Math.min(e.north,t.north);if(!(u>=d))return l(n)?(n.west=a,n.south=u,n.east=c,n.north=d,n):new ge(a,u,c,d)};ge.simpleIntersection=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t);const 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 l(n)?(n.west=i,n.south=o,n.east=r,n.north=s,n):new ge(i,o,r,s)};ge.union=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("otherRectangle",t),l(n)||(n=new ge);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=M.TWO_PI:r<s&&i>0&&(r+=M.TWO_PI),i<o&&s<0?s+=M.TWO_PI:r<s&&o<0&&(o+=M.TWO_PI);const a=M.negativePiToPi(Math.min(o,s)),c=M.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};ge.expand=function(e,t,n){return T.typeOf.object("rectangle",e),T.typeOf.object("cartographic",t),l(n)||(n=new ge),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};ge.contains=function(e,t){T.typeOf.object("rectangle",e),T.typeOf.object("cartographic",t);let n=t.longitude;const i=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=M.TWO_PI,n<0&&(n+=M.TWO_PI)),(n>o||M.equalsEpsilon(n,o,M.EPSILON14))&&(n<r||M.equalsEpsilon(n,r,M.EPSILON14))&&i>=e.south&&i<=e.north};const dge=new Ce;ge.subsample=function(e,t,n,i){T.typeOf.object("rectangle",e),t=A(t,me.WGS84),n=A(n,0),l(i)||(i=[]);let o=0;const r=e.north,s=e.south,a=e.east,c=e.west,u=dge;u.height=n,u.longitude=c,u.latitude=r,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.latitude=s,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=c,i[o]=t.cartographicToCartesian(u,i[o]),o++,r<0?u.latitude=r:s>0?u.latitude=s:u.latitude=0;for(let d=1;d<8;++d)u.longitude=-Math.PI+d*M.PI_OVER_TWO,ge.contains(e,u)&&(i[o]=t.cartographicToCartesian(u,i[o]),o++);return u.latitude===0&&(u.longitude=c,i[o]=t.cartographicToCartesian(u,i[o]),o++,u.longitude=a,i[o]=t.cartographicToCartesian(u,i[o]),o++),i.length=o,i};ge.subsection=function(e,t,n,i,o,r){if(T.typeOf.object("rectangle",e),T.typeOf.number.greaterThanOrEquals("westLerp",t,0),T.typeOf.number.lessThanOrEquals("westLerp",t,1),T.typeOf.number.greaterThanOrEquals("southLerp",n,0),T.typeOf.number.lessThanOrEquals("southLerp",n,1),T.typeOf.number.greaterThanOrEquals("eastLerp",i,0),T.typeOf.number.lessThanOrEquals("eastLerp",i,1),T.typeOf.number.greaterThanOrEquals("northLerp",o,0),T.typeOf.number.lessThanOrEquals("northLerp",o,1),T.typeOf.number.lessThanOrEquals("westLerp",t,i),T.typeOf.number.lessThanOrEquals("southLerp",n,o),l(r)||(r=new ge),e.west<=e.east){const a=e.east-e.west;r.west=e.west+t*a,r.east=e.west+i*a}else{const a=M.TWO_PI+e.east-e.west;r.west=M.negativePiToPi(e.west+t*a),r.east=M.negativePiToPi(e.west+i*a)}const 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};ge.MAX_VALUE=Object.freeze(new ge(-Math.PI,-M.PI_OVER_TWO,Math.PI,M.PI_OVER_TWO));function Ye(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.width=A(n,0),this.height=A(i,0)}Ye.packedLength=4;Ye.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};Ye.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new Ye),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};Ye.fromPoints=function(e,t){if(l(t)||(t=new Ye),!l(e)||e.length===0)return t.x=0,t.y=0,t.width=0,t.height=0,t;const n=e.length;let i=e[0].x,o=e[0].y,r=e[0].x,s=e[0].y;for(let a=1;a<n;a++){const c=e[a],u=c.x,d=c.y;i=Math.min(u,i),r=Math.max(u,r),o=Math.min(d,o),s=Math.max(d,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};const fge=new nr,hge=new Ce,pge=new Ce;Ye.fromRectangle=function(e,t,n){if(l(n)||(n=new Ye),!l(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;t=A(t,fge);const i=t.project(ge.southwest(e,hge)),o=t.project(ge.northeast(e,pge));return j.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};Ye.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,t):new Ye(e.x,e.y,e.width,e.height)};Ye.union=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),l(n)||(n=new Ye);const 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};Ye.expand=function(e,t,n){T.typeOf.object("rectangle",e),T.typeOf.object("point",t),n=Ye.clone(e,n);const 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};Ye.intersect=function(e,t){T.typeOf.object("left",e),T.typeOf.object("right",t);const 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?xn.OUTSIDE:xn.INTERSECTING};Ye.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height};Ye.prototype.clone=function(e){return Ye.clone(this,e)};Ye.prototype.intersect=function(e){return Ye.intersect(this,e)};Ye.prototype.equals=function(e){return Ye.equals(this,e)};const Ss={POINTS:ae.POINTS,LINES:ae.LINES,LINE_LOOP:ae.LINE_LOOP,LINE_STRIP:ae.LINE_STRIP,TRIANGLES:ae.TRIANGLES,TRIANGLE_STRIP:ae.TRIANGLE_STRIP,TRIANGLE_FAN:ae.TRIANGLE_FAN};Ss.isLines=function(e){return e===Ss.LINES||e===Ss.LINE_LOOP||e===Ss.LINE_STRIP};Ss.isTriangles=function(e){return e===Ss.TRIANGLES||e===Ss.TRIANGLE_STRIP||e===Ss.TRIANGLE_FAN};Ss.validate=function(e){return e===Ss.POINTS||e===Ss.LINES||e===Ss.LINE_LOOP||e===Ss.LINE_STRIP||e===Ss.TRIANGLES||e===Ss.TRIANGLE_STRIP||e===Ss.TRIANGLE_FAN};const Ze=Object.freeze(Ss),aj=`attribute vec4 position;
|
||
attribute vec2 textureCoordinates;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = position;
|
||
v_textureCoordinates = textureCoordinates;
|
||
}
|
||
`,Ro={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 mt(e){e=A(e,A.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=A(e.primitiveType,Ze.TRIANGLES),this._vertexArray=e.vertexArray,this._count=e.count,this._offset=A(e.offset,0),this._instanceCount=A(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=A(e.cull,!0),this.occlude=A(e.occlude,!0),this.executeInClosestFrustum=A(e.executeInClosestFrustum,!1),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.castShadows=A(e.castShadows,!1),this.receiveShadows=A(e.receiveShadows,!1),this.pickOnly=A(e.pickOnly,!1),this.depthForTranslucentClassification=A(e.depthForTranslucentClassification,!1),this.dirty=!0,this.lastDirtyTime=0,this.derivedCommands={}}function Us(e,t){return(e._flags&t)===t}function _h(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(mt.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 Us(this,Ro.CULL)},set:function(e){Us(this,Ro.CULL)!==e&&(_h(this,Ro.CULL,e),this.dirty=!0)}},occlude:{get:function(){return Us(this,Ro.OCCLUDE)},set:function(e){Us(this,Ro.OCCLUDE)!==e&&(_h(this,Ro.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 Us(this,Ro.CAST_SHADOWS)},set:function(e){Us(this,Ro.CAST_SHADOWS)!==e&&(_h(this,Ro.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return Us(this,Ro.RECEIVE_SHADOWS)},set:function(e){Us(this,Ro.RECEIVE_SHADOWS)!==e&&(_h(this,Ro.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 Us(this,Ro.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){Us(this,Ro.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(_h(this,Ro.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 Us(this,Ro.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){Us(this,Ro.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(_h(this,Ro.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 Us(this,Ro.PICK_ONLY)},set:function(e){Us(this,Ro.PICK_ONLY)!==e&&(_h(this,Ro.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return Us(this,Ro.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){Us(this,Ro.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(_h(this,Ro.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});mt.shallowClone=function(e,t){if(l(e))return l(t)||(t=new mt),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};mt.prototype.execute=function(e,t){e.draw(this,t)};const si={UNSIGNED_BYTE:ae.UNSIGNED_BYTE,UNSIGNED_SHORT:ae.UNSIGNED_SHORT,UNSIGNED_INT:ae.UNSIGNED_INT,FLOAT:ae.FLOAT,HALF_FLOAT:ae.HALF_FLOAT_OES,UNSIGNED_INT_24_8:ae.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:ae.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:ae.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:ae.UNSIGNED_SHORT_5_6_5};si.toWebGLConstant=function(e,t){switch(e){case si.UNSIGNED_BYTE:return ae.UNSIGNED_BYTE;case si.UNSIGNED_SHORT:return ae.UNSIGNED_SHORT;case si.UNSIGNED_INT:return ae.UNSIGNED_INT;case si.FLOAT:return ae.FLOAT;case si.HALF_FLOAT:return t.webgl2?ae.HALF_FLOAT:ae.HALF_FLOAT_OES;case si.UNSIGNED_INT_24_8:return ae.UNSIGNED_INT_24_8;case si.UNSIGNED_SHORT_4_4_4_4:return ae.UNSIGNED_SHORT_4_4_4_4;case si.UNSIGNED_SHORT_5_5_5_1:return ae.UNSIGNED_SHORT_5_5_5_1;case si.UNSIGNED_SHORT_5_6_5:return si.UNSIGNED_SHORT_5_6_5}};si.isPacked=function(e){return e===si.UNSIGNED_INT_24_8||e===si.UNSIGNED_SHORT_4_4_4_4||e===si.UNSIGNED_SHORT_5_5_5_1||e===si.UNSIGNED_SHORT_5_6_5};si.sizeInBytes=function(e){switch(e){case si.UNSIGNED_BYTE:return 1;case si.UNSIGNED_SHORT:case si.UNSIGNED_SHORT_4_4_4_4:case si.UNSIGNED_SHORT_5_5_5_1:case si.UNSIGNED_SHORT_5_6_5:case si.HALF_FLOAT:return 2;case si.UNSIGNED_INT:case si.FLOAT:case si.UNSIGNED_INT_24_8:return 4}};si.validate=function(e){return e===si.UNSIGNED_BYTE||e===si.UNSIGNED_SHORT||e===si.UNSIGNED_INT||e===si.FLOAT||e===si.HALF_FLOAT||e===si.UNSIGNED_INT_24_8||e===si.UNSIGNED_SHORT_4_4_4_4||e===si.UNSIGNED_SHORT_5_5_5_1||e===si.UNSIGNED_SHORT_5_6_5};const Qe=Object.freeze(si),Je={DEPTH_COMPONENT:ae.DEPTH_COMPONENT,DEPTH_STENCIL:ae.DEPTH_STENCIL,ALPHA:ae.ALPHA,RGB:ae.RGB,RGBA:ae.RGBA,LUMINANCE:ae.LUMINANCE,LUMINANCE_ALPHA:ae.LUMINANCE_ALPHA,RGB_DXT1:ae.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:ae.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:ae.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:ae.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:ae.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:ae.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:ae.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:ae.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:ae.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:ae.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:ae.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:ae.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:ae.COMPRESSED_RGBA_BPTC_UNORM};Je.componentsLength=function(e){switch(e){case Je.RGB:return 3;case Je.RGBA:return 4;case Je.LUMINANCE_ALPHA:return 2;case Je.ALPHA:case Je.LUMINANCE:return 1;default:return 1}};Je.validate=function(e){return e===Je.DEPTH_COMPONENT||e===Je.DEPTH_STENCIL||e===Je.ALPHA||e===Je.RGB||e===Je.RGBA||e===Je.LUMINANCE||e===Je.LUMINANCE_ALPHA||e===Je.RGB_DXT1||e===Je.RGBA_DXT1||e===Je.RGBA_DXT3||e===Je.RGBA_DXT5||e===Je.RGB_PVRTC_4BPPV1||e===Je.RGB_PVRTC_2BPPV1||e===Je.RGBA_PVRTC_4BPPV1||e===Je.RGBA_PVRTC_2BPPV1||e===Je.RGBA_ASTC||e===Je.RGB_ETC1||e===Je.RGB8_ETC2||e===Je.RGBA8_ETC2_EAC||e===Je.RGBA_BC7};Je.isColorFormat=function(e){return e===Je.ALPHA||e===Je.RGB||e===Je.RGBA||e===Je.LUMINANCE||e===Je.LUMINANCE_ALPHA};Je.isDepthFormat=function(e){return e===Je.DEPTH_COMPONENT||e===Je.DEPTH_STENCIL};Je.isCompressedFormat=function(e){return e===Je.RGB_DXT1||e===Je.RGBA_DXT1||e===Je.RGBA_DXT3||e===Je.RGBA_DXT5||e===Je.RGB_PVRTC_4BPPV1||e===Je.RGB_PVRTC_2BPPV1||e===Je.RGBA_PVRTC_4BPPV1||e===Je.RGBA_PVRTC_2BPPV1||e===Je.RGBA_ASTC||e===Je.RGB_ETC1||e===Je.RGB8_ETC2||e===Je.RGBA8_ETC2_EAC||e===Je.RGBA_BC7};Je.isDXTFormat=function(e){return e===Je.RGB_DXT1||e===Je.RGBA_DXT1||e===Je.RGBA_DXT3||e===Je.RGBA_DXT5};Je.isPVRTCFormat=function(e){return e===Je.RGB_PVRTC_4BPPV1||e===Je.RGB_PVRTC_2BPPV1||e===Je.RGBA_PVRTC_4BPPV1||e===Je.RGBA_PVRTC_2BPPV1};Je.isASTCFormat=function(e){return e===Je.RGBA_ASTC};Je.isETC1Format=function(e){return e===Je.RGB_ETC1};Je.isETC2Format=function(e){return e===Je.RGB8_ETC2||e===Je.RGBA8_ETC2_EAC};Je.isBC7Format=function(e){return e===Je.RGBA_BC7};Je.compressedTextureSizeInBytes=function(e,t,n){switch(e){case Je.RGB_DXT1:case Je.RGBA_DXT1:case Je.RGB_ETC1:case Je.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case Je.RGBA_DXT3:case Je.RGBA_DXT5:case Je.RGBA_ASTC:case Je.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case Je.RGB_PVRTC_4BPPV1:case Je.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case Je.RGB_PVRTC_2BPPV1:case Je.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case Je.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};Je.textureSizeInBytes=function(e,t,n,i){let o=Je.componentsLength(e);return Qe.isPacked(t)&&(o=1),o*Qe.sizeInBytes(t)*n*i};Je.alignmentInBytes=function(e,t,n){const i=Je.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};Je.createTypedArray=function(e,t,n,i){let o;const r=Qe.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===Qe.FLOAT?o=Float32Array:o=Uint32Array;const s=Je.componentsLength(e)*n*i;return new o(s)};Je.flipY=function(e,t,n,i,o){if(o===1)return e;const r=Je.createTypedArray(t,n,i,o),s=Je.componentsLength(t),a=i*s;for(let c=0;c<o;++c){const u=c*i*s,d=(o-c-1)*i*s;for(let h=0;h<a;++h)r[d+h]=e[u+h]}return r};Je.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===Je.DEPTH_STENCIL)return ae.DEPTH24_STENCIL8;if(e===Je.DEPTH_COMPONENT){if(t===Qe.UNSIGNED_SHORT)return ae.DEPTH_COMPONENT16;if(t===Qe.UNSIGNED_INT)return ae.DEPTH_COMPONENT24}if(t===Qe.FLOAT)switch(e){case Je.RGBA:return ae.RGBA32F;case Je.RGB:return ae.RGB32F;case Je.RG:return ae.RG32F;case Je.R:return ae.R32F}if(t===Qe.HALF_FLOAT)switch(e){case Je.RGBA:return ae.RGBA16F;case Je.RGB:return ae.RGB16F;case Je.RG:return ae.RG16F;case Je.R:return ae.R16F}return e};const rt=Object.freeze(Je),No={_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(No,{maximumCombinedTextureImageUnits:{get:function(){return No._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return No._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return No._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return No._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return No._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return No._maximumTextureSize}},maximumVaryingVectors:{get:function(){return No._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return No._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return No._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return No._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return No._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return No._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return No._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return No._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return No._maximumViewportWidth}},maximumViewportHeight:{get:function(){return No._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return No._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return No._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return No._maximumColorAttachments}},maximumSamples:{get:function(){return No._maximumSamples}},highpFloatSupported:{get:function(){return No._highpFloatSupported}},highpIntSupported:{get:function(){return No._highpIntSupported}}});const It=No;function i1(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function DE(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function Yr(e){e=A(e,A.EMPTY_OBJECT);const t=e.context;T.defined("options.context",t);const n=t._gl,i=It.maximumColorAttachments;if(this._gl=n,this._framebuffer=n.createFramebuffer(),this._colorTextures=[],this._colorRenderbuffers=[],this._activeColorAttachments=[],this._depthTexture=void 0,this._depthRenderbuffer=void 0,this._stencilRenderbuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this.destroyAttachments=A(e.destroyAttachments,!0),l(e.colorTextures)&&l(e.colorRenderbuffers))throw new x("Cannot have both color texture and color renderbuffer attachments.");if(l(e.depthTexture)&&l(e.depthRenderbuffer))throw new x("Cannot have both a depth texture and depth renderbuffer attachment.");if(l(e.depthStencilTexture)&&l(e.depthStencilRenderbuffer))throw new x("Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.");const o=l(e.depthTexture)||l(e.depthRenderbuffer),r=l(e.depthStencilTexture)||l(e.depthStencilRenderbuffer);if(o&&r)throw new x("Cannot have both a depth and depth-stencil attachment.");if(l(e.stencilRenderbuffer)&&r)throw new x("Cannot have both a stencil and depth-stencil attachment.");if(o&&l(e.stencilRenderbuffer))throw new x("Cannot have both a depth and stencil attachment.");this._bind();let s,a,c,u,d;if(l(e.colorTextures)){const h=e.colorTextures;if(u=this._colorTextures.length=this._activeColorAttachments.length=h.length,u>i)throw new x("The number of color attachments exceeds the number supported.");for(c=0;c<u;++c){if(s=h[c],!rt.isColorFormat(s.pixelFormat))throw new x("The color-texture pixel-format must be a color format.");if(s.pixelDatatype===Qe.FLOAT&&!t.colorBufferFloat)throw new x("The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat.");if(s.pixelDatatype===Qe.HALF_FLOAT&&!t.colorBufferHalfFloat)throw new x("The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat.");d=this._gl.COLOR_ATTACHMENT0+c,i1(this,d,s),this._activeColorAttachments[c]=d,this._colorTextures[c]=s}}if(l(e.colorRenderbuffers)){const h=e.colorRenderbuffers;if(u=this._colorRenderbuffers.length=this._activeColorAttachments.length=h.length,u>i)throw new x("The number of color attachments exceeds the number supported.");for(c=0;c<u;++c)a=h[c],d=this._gl.COLOR_ATTACHMENT0+c,DE(this,d,a),this._activeColorAttachments[c]=d,this._colorRenderbuffers[c]=a}if(l(e.depthTexture)){if(s=e.depthTexture,s.pixelFormat!==rt.DEPTH_COMPONENT)throw new x("The depth-texture pixel-format must be DEPTH_COMPONENT.");i1(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(l(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,DE(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),l(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,DE(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),l(e.depthStencilTexture)){if(s=e.depthStencilTexture,s.pixelFormat!==rt.DEPTH_STENCIL)throw new x("The depth-stencil pixel-format must be DEPTH_STENCIL.");i1(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}l(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,DE(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(Yr.prototype,{status:{get:function(){this._bind();const 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)}}});Yr.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};Yr.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};Yr.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};Yr.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};Yr.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};Yr.prototype.getColorTexture=function(e){if(!l(e)||e<0||e>=this._colorTextures.length)throw new x("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorTextures[e]};Yr.prototype.getColorRenderbuffer=function(e){if(!l(e)||e<0||e>=this._colorRenderbuffers.length)throw new x("index is required, must be greater than or equal to zero and must be less than the number of color attachments.");return this._colorRenderbuffers[e]};Yr.prototype.isDestroyed=function(){return!1};Yr.prototype.destroy=function(){if(this.destroyAttachments){let e=0;const t=this._colorTextures;let n=t.length;for(;e<n;++e){const o=t[e];l(o)&&o.destroy()}const i=this._colorRenderbuffers;for(n=i.length,e=0;e<n;++e){const o=i[e];l(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),He(this)};const Pw={CLOCKWISE:ae.CW,COUNTER_CLOCKWISE:ae.CCW};Pw.validate=function(e){return e===Pw.CLOCKWISE||e===Pw.COUNTER_CLOCKWISE};const ml=Object.freeze(Pw);function cj(e){if(typeof e!="object"||e===null)return e;let t;const n=Object.keys(e);for(let i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&t!=="_applyFunctions"&&(e[t]=cj(e[t]));return Object.freeze(e)}function Zz(e){return e===ae.FUNC_ADD||e===ae.FUNC_SUBTRACT||e===ae.FUNC_REVERSE_SUBTRACT||e===ae.MIN||e===ae.MAX}function IE(e){return e===ae.ZERO||e===ae.ONE||e===ae.SRC_COLOR||e===ae.ONE_MINUS_SRC_COLOR||e===ae.DST_COLOR||e===ae.ONE_MINUS_DST_COLOR||e===ae.SRC_ALPHA||e===ae.ONE_MINUS_SRC_ALPHA||e===ae.DST_ALPHA||e===ae.ONE_MINUS_DST_ALPHA||e===ae.CONSTANT_COLOR||e===ae.ONE_MINUS_CONSTANT_COLOR||e===ae.CONSTANT_ALPHA||e===ae.ONE_MINUS_CONSTANT_ALPHA||e===ae.SRC_ALPHA_SATURATE}function mge(e){return e===ae.FRONT||e===ae.BACK||e===ae.FRONT_AND_BACK}function _ge(e){return e===ae.NEVER||e===ae.LESS||e===ae.EQUAL||e===ae.LEQUAL||e===ae.GREATER||e===ae.NOTEQUAL||e===ae.GEQUAL||e===ae.ALWAYS}function eU(e){return e===ae.NEVER||e===ae.LESS||e===ae.EQUAL||e===ae.LEQUAL||e===ae.GREATER||e===ae.NOTEQUAL||e===ae.GEQUAL||e===ae.ALWAYS}function wg(e){return e===ae.ZERO||e===ae.KEEP||e===ae.REPLACE||e===ae.INCR||e===ae.DECR||e===ae.INVERT||e===ae.INCR_WRAP||e===ae.DECR_WRAP}function et(e){const t=A(e,A.EMPTY_OBJECT),n=A(t.cull,A.EMPTY_OBJECT),i=A(t.polygonOffset,A.EMPTY_OBJECT),o=A(t.scissorTest,A.EMPTY_OBJECT),r=A(o.rectangle,A.EMPTY_OBJECT),s=A(t.depthRange,A.EMPTY_OBJECT),a=A(t.depthTest,A.EMPTY_OBJECT),c=A(t.colorMask,A.EMPTY_OBJECT),u=A(t.blending,A.EMPTY_OBJECT),d=A(u.color,A.EMPTY_OBJECT),h=A(t.stencilTest,A.EMPTY_OBJECT),m=A(h.frontOperation,A.EMPTY_OBJECT),g=A(h.backOperation,A.EMPTY_OBJECT),p=A(t.sampleCoverage,A.EMPTY_OBJECT),y=t.viewport;if(this.frontFace=A(t.frontFace,ml.COUNTER_CLOCKWISE),this.cull={enabled:A(n.enabled,!1),face:A(n.face,ae.BACK)},this.lineWidth=A(t.lineWidth,1),this.polygonOffset={enabled:A(i.enabled,!1),factor:A(i.factor,0),units:A(i.units,0)},this.scissorTest={enabled:A(o.enabled,!1),rectangle:Ye.clone(r)},this.depthRange={near:A(s.near,0),far:A(s.far,1)},this.depthTest={enabled:A(a.enabled,!1),func:A(a.func,ae.LESS)},this.colorMask={red:A(c.red,!0),green:A(c.green,!0),blue:A(c.blue,!0),alpha:A(c.alpha,!0)},this.depthMask=A(t.depthMask,!0),this.stencilMask=A(t.stencilMask,-1),this.blending={enabled:A(u.enabled,!1),color:new H(A(d.red,0),A(d.green,0),A(d.blue,0),A(d.alpha,0)),equationRgb:A(u.equationRgb,ae.FUNC_ADD),equationAlpha:A(u.equationAlpha,ae.FUNC_ADD),functionSourceRgb:A(u.functionSourceRgb,ae.ONE),functionSourceAlpha:A(u.functionSourceAlpha,ae.ONE),functionDestinationRgb:A(u.functionDestinationRgb,ae.ZERO),functionDestinationAlpha:A(u.functionDestinationAlpha,ae.ZERO)},this.stencilTest={enabled:A(h.enabled,!1),frontFunction:A(h.frontFunction,ae.ALWAYS),backFunction:A(h.backFunction,ae.ALWAYS),reference:A(h.reference,0),mask:A(h.mask,-1),frontOperation:{fail:A(m.fail,ae.KEEP),zFail:A(m.zFail,ae.KEEP),zPass:A(m.zPass,ae.KEEP)},backOperation:{fail:A(g.fail,ae.KEEP),zFail:A(g.zFail,ae.KEEP),zPass:A(g.zPass,ae.KEEP)}},this.sampleCoverage={enabled:A(p.enabled,!1),value:A(p.value,1),invert:A(p.invert,!1)},this.viewport=l(y)?new Ye(y.x,y.y,y.width,y.height):void 0,this.lineWidth<It.minimumAliasedLineWidth||this.lineWidth>It.maximumAliasedLineWidth)throw new x("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!ml.validate(this.frontFace))throw new x("Invalid renderState.frontFace.");if(!mge(this.cull.face))throw new x("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new x("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new x("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new x("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new x("renderState.depthRange.far must be less than or equal to one.");if(!_ge(this.depthTest.func))throw new x("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new x("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!Zz(this.blending.equationRgb))throw new x("Invalid renderState.blending.equationRgb.");if(!Zz(this.blending.equationAlpha))throw new x("Invalid renderState.blending.equationAlpha.");if(!IE(this.blending.functionSourceRgb))throw new x("Invalid renderState.blending.functionSourceRgb.");if(!IE(this.blending.functionSourceAlpha))throw new x("Invalid renderState.blending.functionSourceAlpha.");if(!IE(this.blending.functionDestinationRgb))throw new x("Invalid renderState.blending.functionDestinationRgb.");if(!IE(this.blending.functionDestinationAlpha))throw new x("Invalid renderState.blending.functionDestinationAlpha.");if(!eU(this.stencilTest.frontFunction))throw new x("Invalid renderState.stencilTest.frontFunction.");if(!eU(this.stencilTest.backFunction))throw new x("Invalid renderState.stencilTest.backFunction.");if(!wg(this.stencilTest.frontOperation.fail))throw new x("Invalid renderState.stencilTest.frontOperation.fail.");if(!wg(this.stencilTest.frontOperation.zFail))throw new x("Invalid renderState.stencilTest.frontOperation.zFail.");if(!wg(this.stencilTest.frontOperation.zPass))throw new x("Invalid renderState.stencilTest.frontOperation.zPass.");if(!wg(this.stencilTest.backOperation.fail))throw new x("Invalid renderState.stencilTest.backOperation.fail.");if(!wg(this.stencilTest.backOperation.zFail))throw new x("Invalid renderState.stencilTest.backOperation.zFail.");if(!wg(this.stencilTest.backOperation.zPass))throw new x("Invalid renderState.stencilTest.backOperation.zPass.");if(l(this.viewport)){if(this.viewport.width<0)throw new x("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new x("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>It.maximumViewportWidth)throw new x(`renderState.viewport.width must be less than or equal to the maximum viewport width (${It.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>It.maximumViewportHeight)throw new x(`renderState.viewport.height must be less than or equal to the maximum viewport height (${It.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let gge=0,Zu={};et.fromCache=function(e){const t=JSON.stringify(e);let n=Zu[t];if(l(n))return++n.referenceCount,n.state;let i=new et(e);const o=JSON.stringify(i);return n=Zu[o],l(n)||(i.id=gge++,i=cj(i),n={referenceCount:0,state:i},Zu[o]=n),++n.referenceCount,Zu[t]={referenceCount:1,state:n.state},n.state};et.removeFromCache=function(e){const t=new et(e),n=JSON.stringify(t),i=Zu[n],o=JSON.stringify(e),r=Zu[o];l(r)&&(--r.referenceCount,r.referenceCount===0&&(delete Zu[o],l(i)&&--i.referenceCount)),l(i)&&i.referenceCount===0&&delete Zu[n]};et.getCache=function(){return Zu};et.clearCache=function(){Zu={}};function $_(e,t,n){n?e.enable(t):e.disable(t)}function lj(e,t){e.frontFace(t.frontFace)}function uj(e,t){const n=t.cull,i=n.enabled;$_(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function dj(e,t){e.lineWidth(t.lineWidth)}function fj(e,t){const n=t.polygonOffset,i=n.enabled;$_(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function hj(e,t,n){const i=t.scissorTest,o=l(n.scissorTest)?n.scissorTest.enabled:i.enabled;if($_(e,e.SCISSOR_TEST,o),o){const r=l(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(r.x,r.y,r.width,r.height)}}function pj(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function mj(e,t){const n=t.depthTest,i=n.enabled;$_(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function _j(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function gj(e,t){e.depthMask(t.depthMask)}function yj(e,t){e.stencilMask(t.stencilMask)}function yge(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function Aj(e,t,n){const i=t.blending,o=l(n.blendingEnabled)?n.blendingEnabled:i.enabled;$_(e,e.BLEND,o),o&&(yge(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function bj(e,t){const n=t.stencilTest,i=n.enabled;if($_(e,e.STENCIL_TEST,i),i){const 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);const c=n.frontOperation,u=c.fail,d=c.zFail,h=c.zPass;e.stencilOpSeparate(e.FRONT,u,d,h);const m=n.backOperation,g=m.fail,p=m.zFail,y=m.zPass;e.stencilOpSeparate(e.BACK,g,p,y)}}function Cj(e,t){const n=t.sampleCoverage,i=n.enabled;$_(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}const Age=new Ye;function Tj(e,t,n){let i=A(t.viewport,n.viewport);l(i)||(i=Age,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)}et.apply=function(e,t,n){lj(e,t),uj(e,t),dj(e,t),fj(e,t),pj(e,t),mj(e,t),_j(e,t),gj(e,t),yj(e,t),bj(e,t),Cj(e,t),hj(e,t,n),Aj(e,t,n),Tj(e,t,n)};function bge(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(lj),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(uj),e.lineWidth!==t.lineWidth&&n.push(dj),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(fj),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(pj),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(mj),(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(_j),e.depthMask!==t.depthMask&&n.push(gj),e.stencilMask!==t.stencilMask&&n.push(yj),(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(bj),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(Cj),n}et.partialApply=function(e,t,n,i,o,r){if(t!==n){let d=n._applyFunctions[t.id];l(d)||(d=bge(t,n),n._applyFunctions[t.id]=d);const h=d.length;for(let m=0;m<h;++m)d[m](e,n)}const s=l(i.scissorTest)?i.scissorTest:t.scissorTest,a=l(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&hj(e,n,o);const c=l(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,u=l(o.blendingEnabled)?o.blendingEnabled:n.blending.enabled;(c!==u||u&&t.blending!==n.blending)&&Aj(e,n,o),(t!==n||i!==o||i.context!==o.context)&&Tj(e,n,o)};et.getState=function(e){if(!l(e))throw new x("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle: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:H.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:l(e.viewport)?Ye.clone(e.viewport):void 0}};function dt(e,t,n,i){this[0]=A(e,0),this[1]=A(n,0),this[2]=A(t,0),this[3]=A(i,0)}dt.packedLength=4;dt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};dt.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new dt),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};dt.packArray=function(e,t){T.defined("array",e);const n=e.length,i=n*4;if(!l(t))t=new Array(i);else{if(!Array.isArray(t)&&t.length!==i)throw new x("If result is a typed array, it must have exactly array.length * 4 elements");t.length!==i&&(t.length=i)}for(let o=0;o<n;++o)dt.pack(e[o],t,o*4);return t};dt.unpackArray=function(e,t){if(T.defined("array",e),T.typeOf.number.greaterThanOrEquals("array.length",e.length,4),e.length%4!==0)throw new x("array length must be a multiple of 4.");const n=e.length;l(t)?t.length=n/4:t=new Array(n/4);for(let i=0;i<n;i+=4){const o=i/4;t[o]=dt.unpack(e,i,t[o])}return t};dt.clone=function(e,t){if(l(e))return l(t)?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):new dt(e[0],e[2],e[1],e[3])};dt.fromArray=dt.unpack;dt.fromColumnMajorArray=function(e,t){return T.defined("values",e),dt.clone(e,t)};dt.fromRowMajorArray=function(e,t){return T.defined("values",e),l(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new dt(e[0],e[1],e[2],e[3])};dt.fromScale=function(e,t){return T.typeOf.object("scale",e),l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new dt(e.x,0,0,e.y)};dt.fromUniformScale=function(e,t){return T.typeOf.number("scale",e),l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new dt(e,0,0,e)};dt.fromRotation=function(e,t){T.typeOf.number("angle",e);const n=Math.cos(e),i=Math.sin(e);return l(t)?(t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t):new dt(n,-i,i,n)};dt.toArray=function(e,t){return T.typeOf.object("matrix",e),l(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]]};dt.getElementIndex=function(e,t){return T.typeOf.number.greaterThanOrEquals("row",t,0),T.typeOf.number.lessThanOrEquals("row",t,1),T.typeOf.number.greaterThanOrEquals("column",e,0),T.typeOf.number.lessThanOrEquals("column",e,1),e*2+t};dt.getColumn=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("result",n);const i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};dt.setColumn=function(e,t,n,i){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=dt.clone(e,i);const o=t*2;return i[o]=n.x,i[o+1]=n.y,i};dt.getRow=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("result",n);const i=e[t],o=e[t+2];return n.x=i,n.y=o,n};dt.setRow=function(e,t,n,i){return T.typeOf.object("matrix",e),T.typeOf.number.greaterThanOrEquals("index",t,0),T.typeOf.number.lessThanOrEquals("index",t,1),T.typeOf.object("cartesian",n),T.typeOf.object("result",i),i=dt.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};const Cge=new j;dt.setScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n);const i=dt.getScale(e,Cge),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};const Tge=new j;dt.setUniformScale=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n);const i=dt.getScale(e,Tge),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};const tU=new j;dt.getScale=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t.x=j.magnitude(j.fromElements(e[0],e[1],tU)),t.y=j.magnitude(j.fromElements(e[2],e[3],tU)),t};const nU=new j;dt.getMaximumScale=function(e){return dt.getScale(e,nU),j.maximumComponent(nU)};const Ege=new j;dt.setRotation=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("result",n);const i=dt.getScale(e,Ege);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};const xge=new j;dt.getRotation=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const n=dt.getScale(e,xge);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};dt.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const 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};dt.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n};dt.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n};dt.multiplyByVector=function(e,t,n){T.typeOf.object("matrix",e),T.typeOf.object("cartesian",t),T.typeOf.object("result",n);const 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};dt.multiplyByScalar=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};dt.multiplyByScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.object("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t.x,n[1]=e[1]*t.x,n[2]=e[2]*t.y,n[3]=e[3]*t.y,n};dt.multiplyByUniformScale=function(e,t,n){return T.typeOf.object("matrix",e),T.typeOf.number("scale",t),T.typeOf.object("result",n),n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n};dt.negate=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};dt.transpose=function(e,t){T.typeOf.object("matrix",e),T.typeOf.object("result",t);const 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};dt.abs=function(e,t){return T.typeOf.object("matrix",e),T.typeOf.object("result",t),t[0]=Math.abs(e[0]),t[1]=Math.abs(e[1]),t[2]=Math.abs(e[2]),t[3]=Math.abs(e[3]),t};dt.equals=function(e,t){return e===t||l(e)&&l(t)&&e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]};dt.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]};dt.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(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};dt.IDENTITY=Object.freeze(new dt(1,0,0,1));dt.ZERO=Object.freeze(new dt(0,0,0,0));dt.COLUMN0ROW0=0;dt.COLUMN0ROW1=1;dt.COLUMN1ROW0=2;dt.COLUMN1ROW1=3;Object.defineProperties(dt.prototype,{length:{get:function(){return dt.packedLength}}});dt.prototype.clone=function(e){return dt.clone(this,e)};dt.prototype.equals=function(e){return dt.equals(this,e)};dt.prototype.equalsEpsilon=function(e,t){return dt.equalsEpsilon(this,e,t)};dt.prototype.toString=function(){return`(${this[0]}, ${this[2]})
|
||
(${this[1]}, ${this[3]})`};function wge(e,t,n,i){switch(t.type){case e.FLOAT:return new Ej(e,t,n,i);case e.FLOAT_VEC2:return new xj(e,t,n,i);case e.FLOAT_VEC3:return new wj(e,t,n,i);case e.FLOAT_VEC4:return new Sj(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new tM(e,t,n,i);case e.INT:case e.BOOL:return new vj(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new Dj(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new Ij(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new Pj(e,t,n,i);case e.FLOAT_MAT2:return new Oj(e,t,n,i);case e.FLOAT_MAT3:return new Lj(e,t,n,i);case e.FLOAT_MAT4:return new Bj(e,t,n,i);default:throw new Ie(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function Ej(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}Ej.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function xj(e,t,n,i){this.name=n,this.value=void 0,this._value=new j,this._gl=e,this._location=i}xj.prototype.set=function(){const e=this.value;j.equals(e,this._value)||(j.clone(e,this._value),this._gl.uniform2f(this._location,e.x,e.y))};function wj(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}wj.prototype.set=function(){const e=this.value;if(l(e.red))H.equals(e,this._value)||(this._value=H.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(l(e.x))f.equals(e,this._value)||(this._value=f.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new x(`Invalid vec3 value for uniform "${this.name}".`)};function Sj(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}Sj.prototype.set=function(){const e=this.value;if(l(e.red))H.equals(e,this._value)||(this._value=H.clone(e,this._value),this._gl.uniform4f(this._location,e.red,e.green,e.blue,e.alpha));else if(l(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));else throw new x(`Invalid vec4 value for uniform "${this.name}".`)};function tM(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}tM.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)};tM.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function vj(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}vj.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function Dj(e,t,n,i){this.name=n,this.value=void 0,this._value=new j,this._gl=e,this._location=i}Dj.prototype.set=function(){const e=this.value;j.equals(e,this._value)||(j.clone(e,this._value),this._gl.uniform2i(this._location,e.x,e.y))};function Ij(e,t,n,i){this.name=n,this.value=void 0,this._value=new f,this._gl=e,this._location=i}Ij.prototype.set=function(){const e=this.value;f.equals(e,this._value)||(f.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function Pj(e,t,n,i){this.name=n,this.value=void 0,this._value=new oe,this._gl=e,this._location=i}Pj.prototype.set=function(){const 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))};const Sge=new Float32Array(4);function Oj(e,t,n,i){this.name=n,this.value=void 0,this._value=new dt,this._gl=e,this._location=i}Oj.prototype.set=function(){if(!dt.equalsArray(this.value,this._value,0)){dt.clone(this.value,this._value);const e=dt.toArray(this.value,Sge);this._gl.uniformMatrix2fv(this._location,!1,e)}};const vge=new Float32Array(9);function Lj(e,t,n,i){this.name=n,this.value=void 0,this._value=new J,this._gl=e,this._location=i}Lj.prototype.set=function(){if(!J.equalsArray(this.value,this._value,0)){J.clone(this.value,this._value);const e=J.toArray(this.value,vge);this._gl.uniformMatrix3fv(this._location,!1,e)}};const Dge=new Float32Array(16);function Bj(e,t,n,i){this.name=n,this.value=void 0,this._value=new B,this._gl=e,this._location=i}Bj.prototype.set=function(){if(!B.equalsArray(this.value,this._value,0)){B.clone(this.value,this._value);const e=B.toArray(this.value,Dge);this._gl.uniformMatrix4fv(this._location,!1,e)}};function Ige(e,t,n,i){switch(t.type){case e.FLOAT:return new Rj(e,t,n,i);case e.FLOAT_VEC2:return new Nj(e,t,n,i);case e.FLOAT_VEC3:return new Mj(e,t,n,i);case e.FLOAT_VEC4:return new Fj(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new nM(e,t,n,i);case e.INT:case e.BOOL:return new zj(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new Uj(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new Hj(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new Vj(e,t,n,i);case e.FLOAT_MAT2:return new kj(e,t,n,i);case e.FLOAT_MAT3:return new Gj(e,t,n,i);case e.FLOAT_MAT4:return new Wj(e,t,n,i);default:throw new Ie(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function Rj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o),this._gl=e,this._location=i[0]}Rj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1fv(this._location,n)};function Nj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*2),this._gl=e,this._location=i[0]}Nj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];j.equalsArray(s,n,o)||(j.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2fv(this._location,n)};function Mj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*3),this._gl=e,this._location=i[0]}Mj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(l(s.red))(s.red!==n[o]||s.green!==n[o+1]||s.blue!==n[o+2])&&(n[o]=s.red,n[o+1]=s.green,n[o+2]=s.blue,i=!0);else if(l(s.x))f.equalsArray(s,n,o)||(f.pack(s,n,o),i=!0);else throw new x("Invalid vec3 value.");o+=3}i&&this._gl.uniform3fv(this._location,n)};function Fj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}Fj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];if(l(s.red))H.equalsArray(s,n,o)||(H.pack(s,n,o),i=!0);else if(l(s.x))oe.equalsArray(s,n,o)||(oe.pack(s,n,o),i=!0);else throw new x("Invalid vec4 value.");o+=4}i&&this._gl.uniform4fv(this._location,n)};function nM(e,t,n,i){const 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}nM.prototype.set=function(){const e=this._gl,t=e.TEXTURE0+this.textureUnitIndex,n=this.value,i=n.length;for(let o=0;o<i;++o){const r=n[o];e.activeTexture(t+o),e.bindTexture(r._target,r._texture)}};nM.prototype._setSampler=function(e){this.textureUnitIndex=e;const t=this._locations,n=t.length;for(let i=0;i<n;++i){const o=e+i;this._gl.uniform1i(t[i],o)}return e+n};function zj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o),this._gl=e,this._location=i[0]}zj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1;for(let o=0;o<t;++o){const r=e[o];r!==n[o]&&(n[o]=r,i=!0)}i&&this._gl.uniform1iv(this._location,n)};function Uj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*2),this._gl=e,this._location=i[0]}Uj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];j.equalsArray(s,n,o)||(j.pack(s,n,o),i=!0),o+=2}i&&this._gl.uniform2iv(this._location,n)};function Hj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*3),this._gl=e,this._location=i[0]}Hj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];f.equalsArray(s,n,o)||(f.pack(s,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)};function Vj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Int32Array(o*4),this._gl=e,this._location=i[0]}Vj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const 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 kj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*4),this._gl=e,this._location=i[0]}kj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];dt.equalsArray(s,n,o)||(dt.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function Gj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*9),this._gl=e,this._location=i[0]}Gj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];J.equalsArray(s,n,o)||(J.pack(s,n,o),i=!0),o+=9}i&&this._gl.uniformMatrix3fv(this._location,!1,n)};function Wj(e,t,n,i){const o=i.length;this.name=n,this.value=new Array(o),this._value=new Float32Array(o*16),this._gl=e,this._location=i[0]}Wj.prototype.set=function(){const e=this.value,t=e.length,n=this._value;let i=!1,o=0;for(let r=0;r<t;++r){const s=e[r];B.equalsArray(s,n,o)||(B.pack(s,n,o),i=!0),o+=16}i&&this._gl.uniformMatrix4fv(this._location,!1,n)};let Pge=0;function Cn(e){let t=e.vertexShaderText,n=e.fragmentShaderText;typeof spector<"u"&&(t=t.replace(/^#line/gm,"//#line"),n=n.replace(/^#line/gm,"//#line"));const i=Oge(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=Pge++}Cn.fromCache=function(e){return e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)};Cn.replaceCache=function(e){return e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(Cn.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return Ow(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return Ow(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return Ow(this),this._uniformsByName}}});function iU(e){const t=[],n=e.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o].trim(),s=r.slice(r.lastIndexOf(" ")+1);t.push(s)}}return t}function Oge(e,t){const n={};if(!It.highpFloatSupported||!It.highpIntSupported){let i,o,r,s;const a=iU(e),c=iU(t),u=a.length,d=c.length;for(i=0;i<u;i++)for(o=0;o<d;o++)if(a[i]===c[o]){r=a[i],s=`czm_mediump_${r}`;const h=new RegExp(`${r}\\b`,"g");t=t.replace(h,s),n[s]=r}}return{fragmentShaderText:t,duplicateUniformNames:n}}const Mu="[Cesium WebGL] ";function Lge(e,t){const n=t._vertexShaderText,i=t._fragmentShaderText,o=e.createShader(e.VERTEX_SHADER);e.shaderSource(o,n),e.compileShader(o);const r=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(r,i),e.compileShader(r);const s=e.createProgram();e.attachShader(s,o),e.attachShader(s,r);const a=t._attributeLocations;if(l(a))for(const m in a)a.hasOwnProperty(m)&&e.bindAttribLocation(s,a[m],m);e.linkProgram(s);let c;if(e.getProgramParameter(s,e.LINK_STATUS))return t._logShaderCompilation&&(c=e.getShaderInfoLog(o),l(c)&&c.length>0&&console.log(`${Mu}Vertex shader compile log: ${c}`),c=e.getShaderInfoLog(r),l(c)&&c.length>0&&console.log(`${Mu}Fragment shader compile log: ${c}`),c=e.getProgramInfoLog(s),l(c)&&c.length>0&&console.log(`${Mu}Shader program link log: ${c}`)),e.deleteShader(o),e.deleteShader(r),s;let u;const d=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(c=e.getProgramInfoLog(s),console.error(`${Mu}Shader program link log: ${c}`),h(o,"vertex"),h(r,"fragment"),u=`Program failed to link. Link log: ${c}`):(c=e.getShaderInfoLog(o),console.error(`${Mu}Vertex shader compile log: ${c}`),console.error(`${Mu} Vertex shader source:
|
||
${n}`),u=`Vertex shader failed to compile. Compile log: ${c}`):(c=e.getShaderInfoLog(r),console.error(`${Mu}Fragment shader compile log: ${c}`),console.error(`${Mu} Fragment shader source:
|
||
${i}`),u=`Fragment shader failed to compile. Compile log: ${c}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new Ie(u);function h(m,g){if(!l(d))return;const p=d.getTranslatedShaderSource(m);if(p===""){console.error(`${Mu}${g} shader translation failed.`);return}console.error(`${Mu}Translated ${g} shaderSource:
|
||
${p}`)}}function Bge(e,t,n){const i={};for(let o=0;o<n;++o){const 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 Rge(e,t){const n={},i=[],o=[],r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const a=e.getActiveUniform(t,s),c="[0]",u=a.name.indexOf(c,a.name.length-c.length)!==-1?a.name.slice(0,a.name.length-3):a.name;if(u.indexOf("gl_")!==0)if(a.name.indexOf("[")<0){const d=e.getUniformLocation(t,u);if(d!==null){const h=wge(e,a,u,d);n[u]=h,i.push(h),h._setSampler&&o.push(h)}}else{let d,h,m,g;const p=u.indexOf("[");if(p>=0){if(d=n[u.slice(0,p)],!l(d))continue;h=d._locations,h.length<=1&&(m=d.value,g=e.getUniformLocation(t,u),g!==null&&(h.push(g),m.push(e.getUniform(t,g))))}else{h=[];for(let y=0;y<a.size;++y)g=e.getUniformLocation(t,`${u}[${y}]`),g!==null&&h.push(g);d=Ige(e,a,u,h),n[u]=d,i.push(d),d._setSampler&&o.push(d)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function Nge(e,t){const n=[],i=[];for(const o in t)if(t.hasOwnProperty(o)){const r=t[o];let s=o;const a=e._duplicateUniformNames[s];l(a)&&(r.name=a,s=a);const c=Dw[s];l(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function Mge(e,t,n){e.useProgram(t);let i=0;const o=n.length;for(let r=0;r<o;++r)i=n[r]._setSampler(i);return e.useProgram(null),i}function Ow(e){l(e._program)||jj(e)}function jj(e){const t=e._program,n=e._gl,i=Lge(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=Rge(n,i),s=Nge(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=Bge(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=Mge(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,c,u,d){const h=e._vertexShaderText,m=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=c.replace(g," != ");try{jj(e),u(e._program)}catch(p){e._vertexShaderText=h,e._fragmentShaderText=m;const b=/(?:Compile|Link) error: ([^]*)/.exec(p.message);d(b?b[1]:p.message)}})}Cn.prototype._bind=function(){Ow(this),this._gl.useProgram(this._program)};Cn.prototype._setUniforms=function(e,t,n){let i,o;if(l(e)){const a=this._manualUniforms;for(i=a.length,o=0;o<i;++o){const c=a[o];c.value=e[c.name]()}}const r=this._automaticUniforms;for(i=r.length,o=0;o<i;++o){const a=r[o];a.uniform.value=a.automaticUniform.getValue(t)}const s=this._uniforms;for(i=s.length,o=0;o<i;++o)s[o].set();if(n){const a=this._gl,c=this._program;if(a.validateProgram(c),!a.getProgramParameter(c,a.VALIDATE_STATUS))throw new x(`Program validation failed. Program info log: ${a.getProgramInfoLog(c)}`)}};Cn.prototype.isDestroyed=function(){return!1};Cn.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};Cn.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),He(this)};function oD(e){this._context=e}let sA;const Fge=new mt({primitiveType:Ze.TRIANGLES}),zge=new co({color:new H(0,0,0,0)});function Uge(e,t){return new Yr({context:e,colorTextures:[t],destroyAttachments:!1})}function Hge(e,t){return Cn.fromCache({context:e,vertexShaderSource:aj,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function Vge(e,t){return(!l(sA)||sA.viewport.width!==e||sA.viewport.height!==t)&&(sA=et.fromCache({viewport:new Ye(0,0,e,t)})),sA}oD.prototype.execute=function(e){if(T.defined("computeCommand",e),l(e.preExecute)&&e.preExecute(e),!l(e.fragmentShaderSource)&&!l(e.shaderProgram))throw new x("computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required.");T.defined("computeCommand.outputTexture",e.outputTexture);const t=e.outputTexture,n=t.width,i=t.height,o=this._context,r=l(e.vertexArray)?e.vertexArray:o.getViewportQuadVertexArray(),s=l(e.shaderProgram)?e.shaderProgram:Hge(o,e.fragmentShaderSource),a=Uge(o,t),c=Vge(n,i),u=e.uniformMap,d=zge;d.framebuffer=a,d.renderState=c,d.execute(o);const h=Fge;h.vertexArray=r,h.renderState=c,h.shaderProgram=s,h.uniformMap=u,h.framebuffer=a,h.execute(o),a.destroy(),e.persists||(s.destroy(),l(e.vertexArray)&&r.destroy()),l(e.postExecute)&&e.postExecute(t)};oD.prototype.isDestroyed=function(){return!1};oD.prototype.destroy=function(){return He(this)};const Kt={BYTE:ae.BYTE,UNSIGNED_BYTE:ae.UNSIGNED_BYTE,SHORT:ae.SHORT,UNSIGNED_SHORT:ae.UNSIGNED_SHORT,INT:ae.INT,UNSIGNED_INT:ae.UNSIGNED_INT,FLOAT:ae.FLOAT,DOUBLE:ae.DOUBLE};Kt.getSizeInBytes=function(e){if(!l(e))throw new x("value is required.");switch(e){case Kt.BYTE:return Int8Array.BYTES_PER_ELEMENT;case Kt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Kt.SHORT:return Int16Array.BYTES_PER_ELEMENT;case Kt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Kt.INT:return Int32Array.BYTES_PER_ELEMENT;case Kt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Kt.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case Kt.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new x("componentDatatype is not a valid value.")}};Kt.fromTypedArray=function(e){if(e instanceof Int8Array)return Kt.BYTE;if(e instanceof Uint8Array)return Kt.UNSIGNED_BYTE;if(e instanceof Int16Array)return Kt.SHORT;if(e instanceof Uint16Array)return Kt.UNSIGNED_SHORT;if(e instanceof Int32Array)return Kt.INT;if(e instanceof Uint32Array)return Kt.UNSIGNED_INT;if(e instanceof Float32Array)return Kt.FLOAT;if(e instanceof Float64Array)return Kt.DOUBLE;throw new x("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};Kt.validate=function(e){return l(e)&&(e===Kt.BYTE||e===Kt.UNSIGNED_BYTE||e===Kt.SHORT||e===Kt.UNSIGNED_SHORT||e===Kt.INT||e===Kt.UNSIGNED_INT||e===Kt.FLOAT||e===Kt.DOUBLE)};Kt.createTypedArray=function(e,t){if(!l(e))throw new x("componentDatatype is required.");if(!l(t))throw new x("valuesOrLength is required.");switch(e){case Kt.BYTE:return new Int8Array(t);case Kt.UNSIGNED_BYTE:return new Uint8Array(t);case Kt.SHORT:return new Int16Array(t);case Kt.UNSIGNED_SHORT:return new Uint16Array(t);case Kt.INT:return new Int32Array(t);case Kt.UNSIGNED_INT:return new Uint32Array(t);case Kt.FLOAT:return new Float32Array(t);case Kt.DOUBLE:return new Float64Array(t);default:throw new x("componentDatatype is not a valid value.")}};Kt.createArrayBufferView=function(e,t,n,i){if(!l(e))throw new x("componentDatatype is required.");if(!l(t))throw new x("buffer is required.");switch(n=A(n,0),i=A(i,(t.byteLength-n)/Kt.getSizeInBytes(e)),e){case Kt.BYTE:return new Int8Array(t,n,i);case Kt.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case Kt.SHORT:return new Int16Array(t,n,i);case Kt.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case Kt.INT:return new Int32Array(t,n,i);case Kt.UNSIGNED_INT:return new Uint32Array(t,n,i);case Kt.FLOAT:return new Float32Array(t,n,i);case Kt.DOUBLE:return new Float64Array(t,n,i);default:throw new x("componentDatatype is not a valid value.")}};Kt.fromName=function(e){switch(e){case"BYTE":return Kt.BYTE;case"UNSIGNED_BYTE":return Kt.UNSIGNED_BYTE;case"SHORT":return Kt.SHORT;case"UNSIGNED_SHORT":return Kt.UNSIGNED_SHORT;case"INT":return Kt.INT;case"UNSIGNED_INT":return Kt.UNSIGNED_INT;case"FLOAT":return Kt.FLOAT;case"DOUBLE":return Kt.DOUBLE;default:throw new x("name is not a valid value.")}};const ee=Object.freeze(Kt),oU={};function ki(e,t){if(!l(e))throw new x("identifier is required.");l(oU[e])||(oU[e]=!0,console.warn(A(t,e)))}ki.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.";ki.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";ki.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";ki.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";function $p(e,t){if(!l(e)||!l(t))throw new x("identifier and message are required.");ki(e,t)}const kge={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},Cy=Object.freeze(kge);function Te(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0),this.w=A(i,0)}let aA=new f;Te.fromAxisAngle=function(e,t,n){T.typeOf.object("axis",e),T.typeOf.number("angle",t);const i=t/2,o=Math.sin(i);aA=f.normalize(e,aA);const r=aA.x*o,s=aA.y*o,a=aA.z*o,c=Math.cos(i);return l(n)?(n.x=r,n.y=s,n.z=a,n.w=c,n):new Te(r,s,a,c)};const Gge=[1,2,0],Wge=new Array(3);Te.fromRotationMatrix=function(e,t){T.typeOf.object("matrix",e);let n,i,o,r,s;const a=e[J.COLUMN0ROW0],c=e[J.COLUMN1ROW1],u=e[J.COLUMN2ROW2],d=a+c+u;if(d>0)n=Math.sqrt(d+1),s=.5*n,n=.5/n,i=(e[J.COLUMN1ROW2]-e[J.COLUMN2ROW1])*n,o=(e[J.COLUMN2ROW0]-e[J.COLUMN0ROW2])*n,r=(e[J.COLUMN0ROW1]-e[J.COLUMN1ROW0])*n;else{const h=Gge;let m=0;c>a&&(m=1),u>a&&u>c&&(m=2);const g=h[m],p=h[g];n=Math.sqrt(e[J.getElementIndex(m,m)]-e[J.getElementIndex(g,g)]-e[J.getElementIndex(p,p)]+1);const y=Wge;y[m]=.5*n,n=.5/n,s=(e[J.getElementIndex(p,g)]-e[J.getElementIndex(g,p)])*n,y[g]=(e[J.getElementIndex(g,m)]+e[J.getElementIndex(m,g)])*n,y[p]=(e[J.getElementIndex(p,m)]+e[J.getElementIndex(m,p)])*n,i=-y[0],o=-y[1],r=-y[2]}return l(t)?(t.x=i,t.y=o,t.z=r,t.w=s,t):new Te(i,o,r,s)};const rU=new Te;let sU=new Te,o1=new Te,aU=new Te;Te.fromHeadingPitchRoll=function(e,t){return T.typeOf.object("headingPitchRoll",e),aU=Te.fromAxisAngle(f.UNIT_X,e.roll,rU),o1=Te.fromAxisAngle(f.UNIT_Y,-e.pitch,t),t=Te.multiply(o1,aU,o1),sU=Te.fromAxisAngle(f.UNIT_Z,-e.heading,rU),Te.multiply(sU,t,t)};const PE=new f,r1=new f,kl=new Te,cU=new Te,OE=new Te;Te.packedLength=4;Te.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};Te.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new Te),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};Te.packedInterpolationLength=3;Te.convertPackedArrayForInterpolation=function(e,t,n,i){Te.unpack(e,n*4,OE),Te.conjugate(OE,OE);for(let o=0,r=n-t+1;o<r;o++){const s=o*3;Te.unpack(e,(t+o)*4,kl),Te.multiply(kl,OE,kl),kl.w<0&&Te.negate(kl,kl),Te.computeAxis(kl,PE);const a=Te.computeAngle(kl);l(i)||(i=[]),i[s]=PE.x*a,i[s+1]=PE.y*a,i[s+2]=PE.z*a}};Te.unpackInterpolationResult=function(e,t,n,i,o){l(o)||(o=new Te),f.fromArray(e,0,r1);const r=f.magnitude(r1);return Te.unpack(t,i*4,cU),r===0?Te.clone(Te.IDENTITY,kl):Te.fromAxisAngle(r1,r,kl),Te.multiply(kl,cU,o)};Te.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t):new Te(e.x,e.y,e.z,e.w)};Te.conjugate=function(e,t){return T.typeOf.object("quaternion",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};Te.magnitudeSquared=function(e){return T.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};Te.magnitude=function(e){return Math.sqrt(Te.magnitudeSquared(e))};Te.normalize=function(e,t){T.typeOf.object("result",t);const n=1/Te.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};Te.inverse=function(e,t){T.typeOf.object("result",t);const n=Te.magnitudeSquared(e);return t=Te.conjugate(e,t),Te.multiplyByScalar(t,1/n,t)};Te.add=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n.w=e.w+t.w,n};Te.subtract=function(e,t,n){return T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n.w=e.w-t.w,n};Te.negate=function(e,t){return T.typeOf.object("quaternion",e),T.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};Te.dot=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};Te.multiply=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),T.typeOf.object("result",n);const i=e.x,o=e.y,r=e.z,s=e.w,a=t.x,c=t.y,u=t.z,d=t.w,h=s*a+i*d+o*u-r*c,m=s*c-i*u+o*d+r*a,g=s*u+i*c-o*a+r*d,p=s*d-i*a-o*c-r*u;return n.x=h,n.y=m,n.z=g,n.w=p,n};Te.multiplyByScalar=function(e,t,n){return T.typeOf.object("quaternion",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n.w=e.w*t,n};Te.divideByScalar=function(e,t,n){return T.typeOf.object("quaternion",e),T.typeOf.number("scalar",t),T.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n.w=e.w/t,n};Te.computeAxis=function(e,t){T.typeOf.object("quaternion",e),T.typeOf.object("result",t);const n=e.w;if(Math.abs(n-1)<M.EPSILON6)return t.x=t.y=t.z=0,t;const i=1/Math.sqrt(1-n*n);return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t};Te.computeAngle=function(e){return T.typeOf.object("quaternion",e),Math.abs(e.w-1)<M.EPSILON6?0:2*Math.acos(e.w)};let s1=new Te;Te.lerp=function(e,t,n,i){return T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i),s1=Te.multiplyByScalar(t,n,s1),i=Te.multiplyByScalar(e,1-n,i),Te.add(s1,i,i)};let lU=new Te,a1=new Te,c1=new Te;Te.slerp=function(e,t,n,i){T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i);let o=Te.dot(e,t),r=t;if(o<0&&(o=-o,r=lU=Te.negate(t,lU)),1-o<M.EPSILON6)return Te.lerp(e,r,n,i);const s=Math.acos(o);return a1=Te.multiplyByScalar(e,Math.sin((1-n)*s),a1),c1=Te.multiplyByScalar(r,Math.sin(n*s),c1),i=Te.add(a1,c1,i),Te.multiplyByScalar(i,1/Math.sin(s),i)};Te.log=function(e,t){T.typeOf.object("quaternion",e),T.typeOf.object("result",t);const n=M.acosClamped(e.w);let i=0;return n!==0&&(i=n/Math.sin(n)),f.multiplyByScalar(e,i,t)};Te.exp=function(e,t){T.typeOf.object("cartesian",e),T.typeOf.object("result",t);const n=f.magnitude(e);let 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};const jge=new f,qge=new f,Bb=new Te,Ty=new Te;Te.computeInnerQuadrangle=function(e,t,n,i){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("q2",n),T.typeOf.object("result",i);const o=Te.conjugate(t,Bb);Te.multiply(o,n,Ty);const r=Te.log(Ty,jge);Te.multiply(o,e,Ty);const s=Te.log(Ty,qge);return f.add(r,s,r),f.multiplyByScalar(r,.25,r),f.negate(r,r),Te.exp(r,Bb),Te.multiply(t,Bb,i)};Te.squad=function(e,t,n,i,o,r){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("s0",n),T.typeOf.object("s1",i),T.typeOf.number("t",o),T.typeOf.object("result",r);const s=Te.slerp(e,t,o,Bb),a=Te.slerp(n,i,o,Ty);return Te.slerp(s,a,2*o*(1-o),r)};const $ge=new Te,qj=1.9011074535173003,MS=gn.supportsTypedArrays()?new Float32Array(8):[],FS=gn.supportsTypedArrays()?new Float32Array(8):[],Hd=gn.supportsTypedArrays()?new Float32Array(8):[],Vd=gn.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){const t=e+1,n=2*t+1;MS[e]=1/(t*n),FS[e]=t/n}MS[7]=qj/(8*17);FS[7]=qj*8/17;Te.fastSlerp=function(e,t,n,i){T.typeOf.object("start",e),T.typeOf.object("end",t),T.typeOf.number("t",n),T.typeOf.object("result",i);let o=Te.dot(e,t),r;o>=0?r=1:(r=-1,o=-o);const s=o-1,a=1-n,c=n*n,u=a*a;for(let g=7;g>=0;--g)Hd[g]=(MS[g]*c-FS[g])*s,Vd[g]=(MS[g]*u-FS[g])*s;const d=r*n*(1+Hd[0]*(1+Hd[1]*(1+Hd[2]*(1+Hd[3]*(1+Hd[4]*(1+Hd[5]*(1+Hd[6]*(1+Hd[7])))))))),h=a*(1+Vd[0]*(1+Vd[1]*(1+Vd[2]*(1+Vd[3]*(1+Vd[4]*(1+Vd[5]*(1+Vd[6]*(1+Vd[7])))))))),m=Te.multiplyByScalar(e,h,$ge);return Te.multiplyByScalar(t,d,i),Te.add(m,i,i)};Te.fastSquad=function(e,t,n,i,o,r){T.typeOf.object("q0",e),T.typeOf.object("q1",t),T.typeOf.object("s0",n),T.typeOf.object("s1",i),T.typeOf.number("t",o),T.typeOf.object("result",r);const s=Te.fastSlerp(e,t,o,Bb),a=Te.fastSlerp(n,i,o,Ty);return Te.fastSlerp(s,a,2*o*(1-o),r)};Te.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w};Te.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(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};Te.ZERO=Object.freeze(new Te(0,0,0,0));Te.IDENTITY=Object.freeze(new Te(0,0,0,1));Te.prototype.clone=function(e){return Te.clone(this,e)};Te.prototype.equals=function(e){return Te.equals(this,e)};Te.prototype.equalsEpsilon=function(e,t){return Te.equalsEpsilon(this,e,t)};Te.prototype.toString=function(){return`(${this.x}, ${this.y}, ${this.z}, ${this.w})`};function Bs(e,t,n){T.defined("array",e),T.defined("itemToFind",t),T.defined("comparator",n);let i=0,o=e.length-1,r,s;for(;i<=o;){if(r=~~((i+o)/2),s=n(e[r],t),s<0){i=r+1;continue}if(s>0){o=r-1;continue}return r}return~(o+1)}function iM(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function uT(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}function zS(e){if(e===null||isNaN(e))throw new x("year is required and must be a number.");return e%4===0&&e%100!==0||e%400===0}function $i(e,t){this.julianDate=e,this.offset=t}const Yge={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},Ni=Object.freeze(Yge),Xge={UTC:0,TAI:1},$n=Object.freeze(Xge),$j=new uT,LE=[31,28,31,30,31,30,31,31,30,31,30,31],BE=29;function oM(e,t){return ie.compare(e.julianDate,t.julianDate)}const a0=new $i;function rD(e){a0.julianDate=e;const t=ie.leapSeconds;let n=Bs(t,a0,oM);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&ie.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),ie.addSeconds(e,i,e)}function uU(e,t){a0.julianDate=e;const n=ie.leapSeconds;let i=Bs(n,a0,oM);if(i<0&&(i=~i),i===0)return ie.addSeconds(e,-n[0].offset,t);if(i>=n.length)return ie.addSeconds(e,-n[i-1].offset,t);const o=ie.secondsDifference(n[i].julianDate,e);if(o===0)return ie.addSeconds(e,-n[i].offset,t);if(!(o<=1))return ie.addSeconds(e,-n[--i].offset,t)}function Yp(e,t,n){const i=t/Ni.SECONDS_PER_DAY|0;return e+=i,t-=Ni.SECONDS_PER_DAY*i,t<0&&(e--,t+=Ni.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function rM(e,t,n,i,o,r,s){const a=(t-14)/12|0,c=e+4800+a;let u=(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);const d=r+(i*Ni.SECONDS_PER_HOUR+o*Ni.SECONDS_PER_MINUTE+s*Ni.SECONDS_PER_MILLISECOND);return d>=43200&&(u-=1),[u,d]}const Kge=/^(\d{4})$/,Jge=/^(\d{4})-(\d{2})$/,Qge=/^(\d{4})-?(\d{3})$/,Zge=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,eye=/^(\d{4})-?(\d{2})-?(\d{2})$/,sM=/([Z+\-])?(\d{2})?:?(\d{2})?$/,tye=/^(\d{2})(\.\d+)?/.source+sM.source,nye=/^(\d{2}):?(\d{2})(\.\d+)?/.source+sM.source,iye=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+sM.source,Ol="Invalid ISO 8601 date.";function ie(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=A(e,0),t=A(t,0),n=A(n,$n.UTC);const i=e|0;t=t+(e-i)*Ni.SECONDS_PER_DAY,Yp(i,t,this),n===$n.UTC&&rD(this)}ie.fromGregorianDate=function(e,t){if(!(e instanceof uT))throw new x("date must be a valid GregorianDate.");const n=rM(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return l(t)?(Yp(n[0],n[1],t),rD(t),t):new ie(n[0],n[1],$n.UTC)};ie.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new x("date must be a valid JavaScript Date.");const n=rM(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return l(t)?(Yp(n[0],n[1],t),rD(t),t):new ie(n[0],n[1],$n.UTC)};ie.fromIso8601=function(e,t){if(typeof e!="string")throw new x(Ol);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,c=0,u=0;const d=n[0],h=n[1];let m,g;if(!l(d))throw new x(Ol);let p;if(n=d.match(eye),n!==null){if(p=d.split("-").length-1,p>0&&p!==2)throw new x(Ol);i=+n[1],o=+n[2],r=+n[3]}else if(n=d.match(Jge),n!==null)i=+n[1],o=+n[2];else if(n=d.match(Kge),n!==null)i=+n[1];else{let E;if(n=d.match(Qge),n!==null){if(i=+n[1],E=+n[2],g=zS(i),E<1||g&&E>366||!g&&E>365)throw new x(Ol)}else if(n=d.match(Zge),n!==null){i=+n[1];const w=+n[2],S=+n[3]||0;if(p=d.split("-").length-1,p>0&&(!l(n[3])&&p!==1||l(n[3])&&p!==2))throw new x(Ol);const P=new Date(Date.UTC(i,0,4));E=w*7+S-P.getUTCDay()-3}else throw new x(Ol);m=new Date(Date.UTC(i,0,1)),m.setUTCDate(E),o=m.getUTCMonth()+1,r=m.getUTCDate()}if(g=zS(i),o<1||o>12||r<1||(o!==2||!g)&&r>LE[o-1]||g&&o===2&&r>BE)throw new x(Ol);let y;if(l(h)){if(n=h.match(iye),n!==null){if(p=h.split(":").length-1,p>0&&p!==2&&p!==3)throw new x(Ol);s=+n[1],a=+n[2],c=+n[3],u=+(n[4]||0)*1e3,y=5}else if(n=h.match(nye),n!==null){if(p=h.split(":").length-1,p>2)throw new x(Ol);s=+n[1],a=+n[2],c=+(n[3]||0)*60,y=4}else if(n=h.match(tye),n!==null)s=+n[1],a=+(n[2]||0)*60,y=3;else throw new x(Ol);if(a>=60||c>=61||s>24||s===24&&(a>0||c>0||u>0))throw new x(Ol);const E=n[y],w=+n[y+1],S=+(n[y+2]||0);switch(E){case"+":s=s-w,a=a-S;break;case"-":s=s+w,a=a+S;break;case"Z":break;default:a=a+new Date(Date.UTC(i,o-1,r,s,a)).getTimezoneOffset();break}}const b=c===60;for(b&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(m=g&&o===2?BE:LE[o-1];r>m;)r-=m,o++,o>12&&(o-=12,i++),m=g&&o===2?BE:LE[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),m=g&&o===2?BE:LE[o-1],r+=m;const C=rM(i,o,r,s,a,c,u);return l(t)?(Yp(C[0],C[1],t),rD(t)):t=new ie(C[0],C[1],$n.UTC),b&&ie.addSeconds(t,1,t),t};ie.now=function(e){return ie.fromDate(new Date,e)};const RE=new ie(0,0,$n.TAI);ie.toGregorianDate=function(e,t){if(!l(e))throw new x("julianDate is required.");let n=!1,i=uU(e,RE);l(i)||(ie.addSeconds(e,-1,RE),i=uU(RE,RE),n=!0);let o=i.dayNumber;const r=i.secondsOfDay;r>=43200&&(o+=1);let s=o+68569|0;const a=4*s/146097|0;s=s-((146097*a+3)/4|0)|0;const c=4e3*(s+1)/1461001|0;s=s-(1461*c/4|0)+31|0;const u=80*s/2447|0,d=s-(2447*u/80|0)|0;s=u/11|0;const h=u+2-12*s|0,m=100*(a-49)+c+s|0;let g=r/Ni.SECONDS_PER_HOUR|0,p=r-g*Ni.SECONDS_PER_HOUR;const y=p/Ni.SECONDS_PER_MINUTE|0;p=p-y*Ni.SECONDS_PER_MINUTE;let b=p|0;const C=(p-b)/Ni.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(b+=1),l(t)?(t.year=m,t.month=h,t.day=d,t.hour=g,t.minute=y,t.second=b,t.millisecond=C,t.isLeapSecond=n,t):new uT(m,h,d,g,y,b,C,n)};ie.toDate=function(e){if(!l(e))throw new x("julianDate is required.");const t=ie.toGregorianDate(e,$j);let 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))};ie.toIso8601=function(e,t){if(!l(e))throw new x("julianDate is required.");const n=ie.toGregorianDate(e,$j);let i=n.year,o=n.month,r=n.day,s=n.hour;const a=n.minute,c=n.second,u=n.millisecond;i===1e4&&o===1&&r===1&&s===0&&a===0&&c===0&&u===0&&(i=9999,o=12,r=31,s=24);let d;return!l(t)&&u!==0?(d=(u*.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")}.${d}Z`):!l(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`:(d=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${d}Z`)};ie.clone=function(e,t){if(l(e))return l(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new ie(e.dayNumber,e.secondsOfDay,$n.TAI)};ie.compare=function(e,t){if(!l(e))throw new x("left is required.");if(!l(t))throw new x("right is required.");const n=e.dayNumber-t.dayNumber;return n!==0?n:e.secondsOfDay-t.secondsOfDay};ie.equals=function(e,t){return e===t||l(e)&&l(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};ie.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(ie.secondsDifference(e,t))<=n};ie.totalDays=function(e){if(!l(e))throw new x("julianDate is required.");return e.dayNumber+e.secondsOfDay/Ni.SECONDS_PER_DAY};ie.secondsDifference=function(e,t){if(!l(e))throw new x("left is required.");if(!l(t))throw new x("right is required.");return(e.dayNumber-t.dayNumber)*Ni.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};ie.daysDifference=function(e,t){if(!l(e))throw new x("left is required.");if(!l(t))throw new x("right is required.");const n=e.dayNumber-t.dayNumber,i=(e.secondsOfDay-t.secondsOfDay)/Ni.SECONDS_PER_DAY;return n+i};ie.computeTaiMinusUtc=function(e){a0.julianDate=e;const t=ie.leapSeconds;let n=Bs(t,a0,oM);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};ie.addSeconds=function(e,t,n){if(!l(e))throw new x("julianDate is required.");if(!l(t))throw new x("seconds is required.");if(!l(n))throw new x("result is required.");return Yp(e.dayNumber,e.secondsOfDay+t,n)};ie.addMinutes=function(e,t,n){if(!l(e))throw new x("julianDate is required.");if(!l(t))throw new x("minutes is required.");if(!l(n))throw new x("result is required.");const i=e.secondsOfDay+t*Ni.SECONDS_PER_MINUTE;return Yp(e.dayNumber,i,n)};ie.addHours=function(e,t,n){if(!l(e))throw new x("julianDate is required.");if(!l(t))throw new x("hours is required.");if(!l(n))throw new x("result is required.");const i=e.secondsOfDay+t*Ni.SECONDS_PER_HOUR;return Yp(e.dayNumber,i,n)};ie.addDays=function(e,t,n){if(!l(e))throw new x("julianDate is required.");if(!l(t))throw new x("days is required.");if(!l(n))throw new x("result is required.");const i=e.dayNumber+t;return Yp(i,e.secondsOfDay,n)};ie.lessThan=function(e,t){return ie.compare(e,t)<0};ie.lessThanOrEquals=function(e,t){return ie.compare(e,t)<=0};ie.greaterThan=function(e,t){return ie.compare(e,t)>0};ie.greaterThanOrEquals=function(e,t){return ie.compare(e,t)>=0};ie.prototype.clone=function(e){return ie.clone(this,e)};ie.prototype.equals=function(e){return ie.equals(this,e)};ie.prototype.equalsEpsilon=function(e,t){return ie.equalsEpsilon(this,e,t)};ie.prototype.toString=function(){return ie.toIso8601(this)};ie.leapSeconds=[new $i(new ie(2441317,43210,$n.TAI),10),new $i(new ie(2441499,43211,$n.TAI),11),new $i(new ie(2441683,43212,$n.TAI),12),new $i(new ie(2442048,43213,$n.TAI),13),new $i(new ie(2442413,43214,$n.TAI),14),new $i(new ie(2442778,43215,$n.TAI),15),new $i(new ie(2443144,43216,$n.TAI),16),new $i(new ie(2443509,43217,$n.TAI),17),new $i(new ie(2443874,43218,$n.TAI),18),new $i(new ie(2444239,43219,$n.TAI),19),new $i(new ie(2444786,43220,$n.TAI),20),new $i(new ie(2445151,43221,$n.TAI),21),new $i(new ie(2445516,43222,$n.TAI),22),new $i(new ie(2446247,43223,$n.TAI),23),new $i(new ie(2447161,43224,$n.TAI),24),new $i(new ie(2447892,43225,$n.TAI),25),new $i(new ie(2448257,43226,$n.TAI),26),new $i(new ie(2448804,43227,$n.TAI),27),new $i(new ie(2449169,43228,$n.TAI),28),new $i(new ie(2449534,43229,$n.TAI),29),new $i(new ie(2450083,43230,$n.TAI),30),new $i(new ie(2450630,43231,$n.TAI),31),new $i(new ie(2451179,43232,$n.TAI),32),new $i(new ie(2453736,43233,$n.TAI),33),new $i(new ie(2454832,43234,$n.TAI),34),new $i(new ie(2456109,43235,$n.TAI),35),new $i(new ie(2457204,43236,$n.TAI),36),new $i(new ie(2457754,43237,$n.TAI),37)];const oye="modulepreload",rye=function(e){return"/"+e},dU={},NE=function(t,n,i){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(r=>{if(r=rye(r),r in dU)return;dU[r]=!0;const s=r.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!i)for(let d=o.length-1;d>=0;d--){const h=o[d];if(h.href===r&&(!s||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${r}"]${a}`))return;const u=document.createElement("link");if(u.rel=s?"stylesheet":oye,s||(u.as="script",u.crossOrigin=""),u.href=r,document.head.appendChild(u),s)return new Promise((d,h)=>{u.addEventListener("load",d),u.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())};var sB={},sye={get exports(){return sB},set exports(e){sB=e}},Rb={},aye={get exports(){return Rb},set exports(e){Rb=e}};/*! https://mths.be/punycode v1.4.0 by @mathias */var fU;function cye(){return fU||(fU=1,function(e,t){(function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,r=typeof By=="object"&&By;(r.global===r||r.window===r||r.self===r)&&(n=r);var s,a=2147483647,c=36,u=1,d=26,h=38,m=700,g=72,p=128,y="-",b=/^xn--/,C=/[^\x20-\x7E]/,E=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=c-u,P=Math.floor,L=String.fromCharCode,z;function R(W){throw new RangeError(w[W])}function F(W,K){for(var q=W.length,te=[];q--;)te[q]=K(W[q]);return te}function U(W,K){var q=W.split("@"),te="";q.length>1&&(te=q[0]+"@",W=q[1]),W=W.replace(E,".");var Y=W.split("."),X=F(Y,K).join(".");return te+X}function D(W){for(var K=[],q=0,te=W.length,Y,X;q<te;)Y=W.charCodeAt(q++),Y>=55296&&Y<=56319&&q<te?(X=W.charCodeAt(q++),(X&64512)==56320?K.push(((Y&1023)<<10)+(X&1023)+65536):(K.push(Y),q--)):K.push(Y);return K}function I(W){return F(W,function(K){var q="";return K>65535&&(K-=65536,q+=L(K>>>10&1023|55296),K=56320|K&1023),q+=L(K),q}).join("")}function _(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:c}function v(W,K){return W+22+75*(W<26)-((K!=0)<<5)}function O(W,K,q){var te=0;for(W=q?P(W/m):W>>1,W+=P(W/K);W>S*d>>1;te+=c)W=P(W/S);return P(te+(S+1)*W/(W+h))}function N(W){var K=[],q=W.length,te,Y=0,X=p,$=g,se,ue,re,he,ce,Q,ne,de,_e;for(se=W.lastIndexOf(y),se<0&&(se=0),ue=0;ue<se;++ue)W.charCodeAt(ue)>=128&&R("not-basic"),K.push(W.charCodeAt(ue));for(re=se>0?se+1:0;re<q;){for(he=Y,ce=1,Q=c;re>=q&&R("invalid-input"),ne=_(W.charCodeAt(re++)),(ne>=c||ne>P((a-Y)/ce))&&R("overflow"),Y+=ne*ce,de=Q<=$?u:Q>=$+d?d:Q-$,!(ne<de);Q+=c)_e=c-de,ce>P(a/_e)&&R("overflow"),ce*=_e;te=K.length+1,$=O(Y-he,te,he==0),P(Y/te)>a-X&&R("overflow"),X+=P(Y/te),Y%=te,K.splice(Y++,0,X)}return I(K)}function V(W){var K,q,te,Y,X,$,se,ue,re,he,ce,Q=[],ne,de,_e,Se;for(W=D(W),ne=W.length,K=p,q=0,X=g,$=0;$<ne;++$)ce=W[$],ce<128&&Q.push(L(ce));for(te=Y=Q.length,Y&&Q.push(y);te<ne;){for(se=a,$=0;$<ne;++$)ce=W[$],ce>=K&&ce<se&&(se=ce);for(de=te+1,se-K>P((a-q)/de)&&R("overflow"),q+=(se-K)*de,K=se,$=0;$<ne;++$)if(ce=W[$],ce<K&&++q>a&&R("overflow"),ce==K){for(ue=q,re=c;he=re<=X?u:re>=X+d?d:re-X,!(ue<he);re+=c)Se=ue-he,_e=c-he,Q.push(L(v(he+Se%_e,0))),ue=P(Se/_e);Q.push(L(v(ue,0))),X=O(q,de,te==Y),q=0,++te}++q,++K}return Q.join("")}function k(W){return U(W,function(K){return b.test(K)?N(K.slice(4).toLowerCase()):K})}function G(W){return U(W,function(K){return C.test(K)?"xn--"+V(K):K})}if(s={version:"1.3.2",ucs2:{decode:D,encode:I},decode:N,encode:V,toASCII:G,toUnicode:k},i&&o)if(e.exports==i)o.exports=s;else for(z in s)s.hasOwnProperty(z)&&(i[z]=s[z]);else n.punycode=s})(By)}(aye,Rb)),Rb}var US={},lye={get exports(){return US},set exports(e){US=e}};/*!
|
||
* 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
|
||
*
|
||
*/var hU;function uye(){return hU||(hU=1,function(e){(function(t,n){e.exports?e.exports=n():t.IPv6=n(t)})(By,function(t){var n=t&&t.IPv6;function i(r){var s=r.toLowerCase(),a=s.split(":"),c=a.length,u=8;a[0]===""&&a[1]===""&&a[2]===""?(a.shift(),a.shift()):a[0]===""&&a[1]===""?a.shift():a[c-1]===""&&a[c-2]===""&&a.pop(),c=a.length,a[c-1].indexOf(".")!==-1&&(u=7);var d;for(d=0;d<c&&a[d]!=="";d++);if(d<u)for(a.splice(d,1,"0000");a.length<u;)a.splice(d,0,"0000");for(var h,m=0;m<u;m++){h=a[m].split("");for(var g=0;g<3&&(h[0]==="0"&&h.length>1);g++)h.splice(0,1);a[m]=h.join("")}var p=-1,y=0,b=0,C=-1,E=!1;for(m=0;m<u;m++)E?a[m]==="0"?b+=1:(E=!1,b>y&&(p=C,y=b)):a[m]==="0"&&(E=!0,C=m,b=1);b>y&&(p=C,y=b),y>1&&a.splice(p,y,""),c=a.length;var w="";for(a[0]===""&&(w=":"),m=0;m<c&&(w+=a[m],m!==c-1);m++)w+=":";return a[c-1]===""&&(w+=":"),w}function o(){return t.IPv6===this&&(t.IPv6=n),this}return{best:i,noConflict:o}})}(lye)),US}var HS={},dye={get exports(){return HS},set exports(e){HS=e}};/*!
|
||
* 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
|
||
*
|
||
*/var pU;function fye(){return pU||(pU=1,function(e){(function(t,n){e.exports?e.exports=n():t.SecondLevelDomains=n(t)})(By,function(t){var n=t&&t.SecondLevelDomains,i={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(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(s+1,r)+" ")>=0:!1},is:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return!1;var s=o.lastIndexOf(".",r-1);if(s>=0)return!1;var a=i.list[o.slice(r+1)];return a?a.indexOf(" "+o.slice(0,r)+" ")>=0:!1},get:function(o){var r=o.lastIndexOf(".");if(r<=0||r>=o.length-1)return null;var s=o.lastIndexOf(".",r-1);if(s<=0||s>=r-1)return null;var a=i.list[o.slice(r+1)];return!a||a.indexOf(" "+o.slice(s+1,r)+" ")<0?null:o.slice(s+1)},noConflict:function(){return t.SecondLevelDomains===this&&(t.SecondLevelDomains=n),this}};return i})}(dye)),HS}/*!
|
||
* 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){(function(t,n){e.exports?e.exports=n(cye(),uye(),fye()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(By,function(t,n,i,o){var r=o&&o.URI;function s(_,v){var O=arguments.length>=1,N=arguments.length>=2;if(!(this instanceof s))return O?N?new s(_,v):new s(_):new s;if(_===void 0){if(O)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?_=location.href+"":_=""}if(_===null&&O)throw new TypeError("null is not a valid argument for URI");return this.href(_),v!==void 0?this.absoluteTo(v):this}function a(_){return/^[0-9]+$/.test(_)}s.version="1.19.11";var c=s.prototype,u=Object.prototype.hasOwnProperty;function d(_){return _.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function h(_){return _===void 0?"Undefined":String(Object.prototype.toString.call(_)).slice(8,-1)}function m(_){return h(_)==="Array"}function g(_,v){var O={},N,V;if(h(v)==="RegExp")O=null;else if(m(v))for(N=0,V=v.length;N<V;N++)O[v[N]]=!0;else O[v]=!0;for(N=0,V=_.length;N<V;N++){var k=O&&O[_[N]]!==void 0||!O&&v.test(_[N]);k&&(_.splice(N,1),V--,N--)}return _}function p(_,v){var O,N;if(m(v)){for(O=0,N=v.length;O<N;O++)if(!p(_,v[O]))return!1;return!0}var V=h(v);for(O=0,N=_.length;O<N;O++)if(V==="RegExp"){if(typeof _[O]=="string"&&_[O].match(v))return!0}else if(_[O]===v)return!0;return!1}function y(_,v){if(!m(_)||!m(v)||_.length!==v.length)return!1;_.sort(),v.sort();for(var O=0,N=_.length;O<N;O++)if(_[O]!==v[O])return!1;return!0}function b(_){var v=/^\/+|\/+$/g;return _.replace(v,"")}s._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,preventInvalidHostname:s.preventInvalidHostname,duplicateQueryParameters:s.duplicateQueryParameters,escapeQuerySpace:s.escapeQuerySpace}},s.preventInvalidHostname=!1,s.duplicateQueryParameters=!1,s.escapeQuerySpace=!0,s.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,s.idn_expression=/[^a-z0-9\._-]/i,s.punycode_expression=/(xn--)/i,s.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,s.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*$/,s.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,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.leading_whitespace_expression=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s.ascii_tab_whitespace=/[\u0009\u000A\u000D]+/g,s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.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"},s.getDomAttribute=function(_){if(!(!_||!_.nodeName)){var v=_.nodeName.toLowerCase();if(!(v==="input"&&_.type!=="image"))return s.domAttributes[v]}};function C(_){return escape(_)}function E(_){return encodeURIComponent(_).replace(/[!'()*]/g,C).replace(/\*/g,"%2A")}s.encode=E,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=E,s.decode=decodeURIComponent},s.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"}}}},s.encodeQuery=function(_,v){var O=s.encode(_+"");return v===void 0&&(v=s.escapeQuerySpace),v?O.replace(/%20/g,"+"):O},s.decodeQuery=function(_,v){_+="",v===void 0&&(v=s.escapeQuerySpace);try{return s.decode(v?_.replace(/\+/g,"%20"):_)}catch{return _}};var w={encode:"encode",decode:"decode"},S,P=function(_,v){return function(O){try{return s[v](O+"").replace(s.characters[_][v].expression,function(N){return s.characters[_][v].map[N]})}catch{return O}}};for(S in w)s[S+"PathSegment"]=P("pathname",w[S]),s[S+"UrnPathSegment"]=P("urnpath",w[S]);var L=function(_,v,O){return function(N){var V;O?V=function(K){return s[v](s[O](K))}:V=s[v];for(var k=(N+"").split(_),G=0,W=k.length;G<W;G++)k[G]=V(k[G]);return k.join(_)}};s.decodePath=L("/","decodePathSegment"),s.decodeUrnPath=L(":","decodeUrnPathSegment"),s.recodePath=L("/","encodePathSegment","decode"),s.recodeUrnPath=L(":","encodeUrnPathSegment","decode"),s.encodeReserved=P("reserved","encode"),s.parse=function(_,v){var O;return v||(v={preventInvalidHostname:s.preventInvalidHostname}),_=_.replace(s.leading_whitespace_expression,""),_=_.replace(s.ascii_tab_whitespace,""),O=_.indexOf("#"),O>-1&&(v.fragment=_.substring(O+1)||null,_=_.substring(0,O)),O=_.indexOf("?"),O>-1&&(v.query=_.substring(O+1)||null,_=_.substring(0,O)),_=_.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),_=_.replace(/^[/\\]{2,}/i,"//"),_.substring(0,2)==="//"?(v.protocol=null,_=_.substring(2),_=s.parseAuthority(_,v)):(O=_.indexOf(":"),O>-1&&(v.protocol=_.substring(0,O)||null,v.protocol&&!v.protocol.match(s.protocol_expression)?v.protocol=void 0:_.substring(O+1,O+3).replace(/\\/g,"/")==="//"?(_=_.substring(O+3),_=s.parseAuthority(_,v)):(_=_.substring(O+1),v.urn=!0))),v.path=_,v},s.parseHost=function(_,v){_||(_=""),_=_.replace(/\\/g,"/");var O=_.indexOf("/"),N,V;if(O===-1&&(O=_.length),_.charAt(0)==="[")N=_.indexOf("]"),v.hostname=_.substring(1,N)||null,v.port=_.substring(N+2,O)||null,v.port==="/"&&(v.port=null);else{var k=_.indexOf(":"),G=_.indexOf("/"),W=_.indexOf(":",k+1);W!==-1&&(G===-1||W<G)?(v.hostname=_.substring(0,O)||null,v.port=null):(V=_.substring(0,O).split(":"),v.hostname=V[0]||null,v.port=V[1]||null)}return v.hostname&&_.substring(O).charAt(0)!=="/"&&(O++,_="/"+_),v.preventInvalidHostname&&s.ensureValidHostname(v.hostname,v.protocol),v.port&&s.ensureValidPort(v.port),_.substring(O)||"/"},s.parseAuthority=function(_,v){return _=s.parseUserinfo(_,v),s.parseHost(_,v)},s.parseUserinfo=function(_,v){var O=_,N=_.indexOf("\\");N!==-1&&(_=_.replace(/\\/g,"/"));var V=_.indexOf("/"),k=_.lastIndexOf("@",V>-1?V:_.length-1),G;return k>-1&&(V===-1||k<V)?(G=_.substring(0,k).split(":"),v.username=G[0]?s.decode(G[0]):null,G.shift(),v.password=G[0]?s.decode(G.join(":")):null,_=O.substring(k+1)):(v.username=null,v.password=null),_},s.parseQuery=function(_,v){if(!_)return{};if(_=_.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!_)return{};for(var O={},N=_.split("&"),V=N.length,k,G,W,K=0;K<V;K++)k=N[K].split("="),G=s.decodeQuery(k.shift(),v),W=k.length?s.decodeQuery(k.join("="),v):null,G!=="__proto__"&&(u.call(O,G)?((typeof O[G]=="string"||O[G]===null)&&(O[G]=[O[G]]),O[G].push(W)):O[G]=W);return O},s.build=function(_){var v="",O=!1;return _.protocol&&(v+=_.protocol+":"),!_.urn&&(v||_.hostname)&&(v+="//",O=!0),v+=s.buildAuthority(_)||"",typeof _.path=="string"&&(_.path.charAt(0)!=="/"&&O&&(v+="/"),v+=_.path),typeof _.query=="string"&&_.query&&(v+="?"+_.query),typeof _.fragment=="string"&&_.fragment&&(v+="#"+_.fragment),v},s.buildHost=function(_){var v="";if(_.hostname)s.ip6_expression.test(_.hostname)?v+="["+_.hostname+"]":v+=_.hostname;else return"";return _.port&&(v+=":"+_.port),v},s.buildAuthority=function(_){return s.buildUserinfo(_)+s.buildHost(_)},s.buildUserinfo=function(_){var v="";return _.username&&(v+=s.encode(_.username)),_.password&&(v+=":"+s.encode(_.password)),v&&(v+="@"),v},s.buildQuery=function(_,v,O){var N="",V,k,G,W;for(k in _)if(k!=="__proto__"&&u.call(_,k))if(m(_[k]))for(V={},G=0,W=_[k].length;G<W;G++)_[k][G]!==void 0&&V[_[k][G]+""]===void 0&&(N+="&"+s.buildQueryParameter(k,_[k][G],O),v!==!0&&(V[_[k][G]+""]=!0));else _[k]!==void 0&&(N+="&"+s.buildQueryParameter(k,_[k],O));return N.substring(1)},s.buildQueryParameter=function(_,v,O){return s.encodeQuery(_,O)+(v!==null?"="+s.encodeQuery(v,O):"")},s.addQuery=function(_,v,O){if(typeof v=="object")for(var N in v)u.call(v,N)&&s.addQuery(_,N,v[N]);else if(typeof v=="string"){if(_[v]===void 0){_[v]=O;return}else typeof _[v]=="string"&&(_[v]=[_[v]]);m(O)||(O=[O]),_[v]=(_[v]||[]).concat(O)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},s.setQuery=function(_,v,O){if(typeof v=="object")for(var N in v)u.call(v,N)&&s.setQuery(_,N,v[N]);else if(typeof v=="string")_[v]=O===void 0?null:O;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},s.removeQuery=function(_,v,O){var N,V,k;if(m(v))for(N=0,V=v.length;N<V;N++)_[v[N]]=void 0;else if(h(v)==="RegExp")for(k in _)v.test(k)&&(_[k]=void 0);else if(typeof v=="object")for(k in v)u.call(v,k)&&s.removeQuery(_,k,v[k]);else if(typeof v=="string")O!==void 0?h(O)==="RegExp"?!m(_[v])&&O.test(_[v])?_[v]=void 0:_[v]=g(_[v],O):_[v]===String(O)&&(!m(O)||O.length===1)?_[v]=void 0:m(_[v])&&(_[v]=g(_[v],O)):_[v]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},s.hasQuery=function(_,v,O,N){switch(h(v)){case"String":break;case"RegExp":for(var V in _)if(u.call(_,V)&&v.test(V)&&(O===void 0||s.hasQuery(_,V,O)))return!0;return!1;case"Object":for(var k in v)if(u.call(v,k)&&!s.hasQuery(_,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(h(O)){case"Undefined":return v in _;case"Boolean":var G=Boolean(m(_[v])?_[v].length:_[v]);return O===G;case"Function":return!!O(_[v],v,_);case"Array":if(!m(_[v]))return!1;var W=N?p:y;return W(_[v],O);case"RegExp":return m(_[v])?N?p(_[v],O):!1:Boolean(_[v]&&_[v].match(O));case"Number":O=String(O);case"String":return m(_[v])?N?p(_[v],O):!1:_[v]===O;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var _=[],v=[],O=0,N=0;N<arguments.length;N++){var V=new s(arguments[N]);_.push(V);for(var k=V.segment(),G=0;G<k.length;G++)typeof k[G]=="string"&&v.push(k[G]),k[G]&&O++}if(!v.length||!O)return new s("");var W=new s("").segment(v);return(_[0].path()===""||_[0].path().slice(0,1)==="/")&&W.path("/"+W.path()),W.normalize()},s.commonPath=function(_,v){var O=Math.min(_.length,v.length),N;for(N=0;N<O;N++)if(_.charAt(N)!==v.charAt(N)){N--;break}return N<1?_.charAt(0)===v.charAt(0)&&_.charAt(0)==="/"?"/":"":((_.charAt(N)!=="/"||v.charAt(N)!=="/")&&(N=_.substring(0,N).lastIndexOf("/")),_.substring(0,N+1))},s.withinString=function(_,v,O){O||(O={});var N=O.start||s.findUri.start,V=O.end||s.findUri.end,k=O.trim||s.findUri.trim,G=O.parens||s.findUri.parens,W=/[a-z0-9-]=["']?$/i;for(N.lastIndex=0;;){var K=N.exec(_);if(!K)break;var q=K.index;if(O.ignoreHtml){var te=_.slice(Math.max(q-3,0),q);if(te&&W.test(te))continue}for(var Y=q+_.slice(q).search(V),X=_.slice(q,Y),$=-1;;){var se=G.exec(X);if(!se)break;var ue=se.index+se[0].length;$=Math.max($,ue)}if($>-1?X=X.slice(0,$)+X.slice($).replace(k,""):X=X.replace(k,""),!(X.length<=K[0].length)&&!(O.ignore&&O.ignore.test(X))){Y=q+X.length;var re=v(X,q,Y,_);if(re===void 0){N.lastIndex=Y;continue}re=String(re),_=_.slice(0,q)+re+_.slice(Y),N.lastIndex=q+re.length}}return N.lastIndex=0,_},s.ensureValidHostname=function(_,v){var O=!!_,N=!!v,V=!1;if(N&&(V=p(s.hostProtocols,v)),V&&!O)throw new TypeError("Hostname cannot be empty, if protocol is "+v);if(_&&_.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+_+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(_).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+_+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(_){if(_){var v=Number(_);if(!(a(v)&&v>0&&v<65536))throw new TypeError('Port "'+_+'" is not a valid port')}},s.noConflict=function(_){if(_){var v={URI:this.noConflict()};return o.URITemplate&&typeof o.URITemplate.noConflict=="function"&&(v.URITemplate=o.URITemplate.noConflict()),o.IPv6&&typeof o.IPv6.noConflict=="function"&&(v.IPv6=o.IPv6.noConflict()),o.SecondLevelDomains&&typeof o.SecondLevelDomains.noConflict=="function"&&(v.SecondLevelDomains=o.SecondLevelDomains.noConflict()),v}else o.URI===this&&(o.URI=r);return this},c.build=function(_){return _===!0?this._deferred_build=!0:(_===void 0||this._deferred_build)&&(this._string=s.build(this._parts),this._deferred_build=!1),this},c.clone=function(){return new s(this)},c.valueOf=c.toString=function(){return this.build(!1)._string};function z(_){return function(v,O){return v===void 0?this._parts[_]||"":(this._parts[_]=v||null,this.build(!O),this)}}function R(_,v){return function(O,N){return O===void 0?this._parts[_]||"":(O!==null&&(O=O+"",O.charAt(0)===v&&(O=O.substring(1))),this._parts[_]=O,this.build(!N),this)}}c.protocol=z("protocol"),c.username=z("username"),c.password=z("password"),c.hostname=z("hostname"),c.port=z("port"),c.query=R("query","?"),c.fragment=R("fragment","#"),c.search=function(_,v){var O=this.query(_,v);return typeof O=="string"&&O.length?"?"+O:O},c.hash=function(_,v){var O=this.fragment(_,v);return typeof O=="string"&&O.length?"#"+O:O},c.pathname=function(_,v){if(_===void 0||_===!0){var O=this._parts.path||(this._parts.hostname?"/":"");return _?(this._parts.urn?s.decodeUrnPath:s.decodePath)(O):O}else return this._parts.urn?this._parts.path=_?s.recodeUrnPath(_):"":this._parts.path=_?s.recodePath(_):"/",this.build(!v),this},c.path=c.pathname,c.href=function(_,v){var O;if(_===void 0)return this.toString();this._string="",this._parts=s._parts();var N=_ instanceof s,V=typeof _=="object"&&(_.hostname||_.path||_.pathname);if(_.nodeName){var k=s.getDomAttribute(_);_=_[k]||"",V=!1}if(!N&&V&&_.pathname!==void 0&&(_=_.toString()),typeof _=="string"||_ instanceof String)this._parts=s.parse(String(_),this._parts);else if(N||V){var G=N?_._parts:_;for(O in G)O!=="query"&&u.call(this._parts,O)&&(this._parts[O]=G[O]);G.query&&this.query(G.query,!1)}else throw new TypeError("invalid input");return this.build(!v),this},c.is=function(_){var v=!1,O=!1,N=!1,V=!1,k=!1,G=!1,W=!1,K=!this._parts.urn;switch(this._parts.hostname&&(K=!1,O=s.ip4_expression.test(this._parts.hostname),N=s.ip6_expression.test(this._parts.hostname),v=O||N,V=!v,k=V&&i&&i.has(this._parts.hostname),G=V&&s.idn_expression.test(this._parts.hostname),W=V&&s.punycode_expression.test(this._parts.hostname)),_.toLowerCase()){case"relative":return K;case"absolute":return!K;case"domain":case"name":return V;case"sld":return k;case"ip":return v;case"ip4":case"ipv4":case"inet4":return O;case"ip6":case"ipv6":case"inet6":return N;case"idn":return G;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return W}return null};var F=c.protocol,U=c.port,D=c.hostname;c.protocol=function(_,v){if(_&&(_=_.replace(/:(\/\/)?$/,""),!_.match(s.protocol_expression)))throw new TypeError('Protocol "'+_+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return F.call(this,_,v)},c.scheme=c.protocol,c.port=function(_,v){return this._parts.urn?_===void 0?"":this:(_!==void 0&&(_===0&&(_=null),_&&(_+="",_.charAt(0)===":"&&(_=_.substring(1)),s.ensureValidPort(_))),U.call(this,_,v))},c.hostname=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_!==void 0){var O={preventInvalidHostname:this._parts.preventInvalidHostname},N=s.parseHost(_,O);if(N!=="/")throw new TypeError('Hostname "'+_+'" contains characters other than [A-Z0-9.-]');_=O.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(_,this._parts.protocol)}return D.call(this,_,v)},c.origin=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0){var O=this.protocol(),N=this.authority();return N?(O?O+"://":"")+this.authority():""}else{var V=s(_);return this.protocol(V.protocol()).authority(V.authority()).build(!v),this}},c.host=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var O=s.parseHost(_,this._parts);if(O!=="/")throw new TypeError('Hostname "'+_+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},c.authority=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var O=s.parseAuthority(_,this._parts);if(O!=="/")throw new TypeError('Hostname "'+_+'" contains characters other than [A-Z0-9.-]');return this.build(!v),this},c.userinfo=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0){var O=s.buildUserinfo(this._parts);return O&&O.substring(0,O.length-1)}else return _[_.length-1]!=="@"&&(_+="@"),s.parseUserinfo(_,this._parts),this.build(!v),this},c.resource=function(_,v){var O;return _===void 0?this.path()+this.search()+this.hash():(O=s.parse(_),this._parts.path=O.path,this._parts.query=O.query,this._parts.fragment=O.fragment,this.build(!v),this)},c.subdomain=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,O)||""}else{var N=this._parts.hostname.length-this.domain().length,V=this._parts.hostname.substring(0,N),k=new RegExp("^"+d(V));if(_&&_.charAt(_.length-1)!=="."&&(_+="."),_.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return _&&s.ensureValidHostname(_,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(k,_),this.build(!v),this}},c.domain=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(typeof _=="boolean"&&(v=_,_=void 0),_===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.match(/\./g);if(O&&O.length<2)return this._parts.hostname;var N=this._parts.hostname.length-this.tld(v).length-1;return N=this._parts.hostname.lastIndexOf(".",N-1)+1,this._parts.hostname.substring(N)||""}else{if(!_)throw new TypeError("cannot set domain empty");if(_.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(_,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=_;else{var V=new RegExp(d(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(V,_)}return this.build(!v),this}},c.tld=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(typeof _=="boolean"&&(v=_,_=void 0),_===void 0){if(!this._parts.hostname||this.is("IP"))return"";var O=this._parts.hostname.lastIndexOf("."),N=this._parts.hostname.substring(O+1);return v!==!0&&i&&i.list[N.toLowerCase()]&&i.get(this._parts.hostname)||N}else{var V;if(_)if(_.match(/[^a-zA-Z0-9-]/))if(i&&i.is(_))V=new RegExp(d(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,_);else throw new TypeError('TLD "'+_+'" 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");V=new RegExp(d(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,_)}else throw new TypeError("cannot set TLD empty");return this.build(!v),this}},c.directory=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0||_===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var O=this._parts.path.length-this.filename().length-1,N=this._parts.path.substring(0,O)||(this._parts.hostname?"/":"");return _?s.decodePath(N):N}else{var V=this._parts.path.length-this.filename().length,k=this._parts.path.substring(0,V),G=new RegExp("^"+d(k));return this.is("relative")||(_||(_="/"),_.charAt(0)!=="/"&&(_="/"+_)),_&&_.charAt(_.length-1)!=="/"&&(_+="/"),_=s.recodePath(_),this._parts.path=this._parts.path.replace(G,_),this.build(!v),this}},c.filename=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(typeof _!="string"){if(!this._parts.path||this._parts.path==="/")return"";var O=this._parts.path.lastIndexOf("/"),N=this._parts.path.substring(O+1);return _?s.decodePathSegment(N):N}else{var V=!1;_.charAt(0)==="/"&&(_=_.substring(1)),_.match(/\.?\//)&&(V=!0);var k=new RegExp(d(this.filename())+"$");return _=s.recodePath(_),this._parts.path=this._parts.path.replace(k,_),V?this.normalizePath(v):this.build(!v),this}},c.suffix=function(_,v){if(this._parts.urn)return _===void 0?"":this;if(_===void 0||_===!0){if(!this._parts.path||this._parts.path==="/")return"";var O=this.filename(),N=O.lastIndexOf("."),V,k;return N===-1?"":(V=O.substring(N+1),k=/^[a-z0-9%]+$/i.test(V)?V:"",_?s.decodePathSegment(k):k)}else{_.charAt(0)==="."&&(_=_.substring(1));var G=this.suffix(),W;if(G)_?W=new RegExp(d(G)+"$"):W=new RegExp(d("."+G)+"$");else{if(!_)return this;this._parts.path+="."+s.recodePath(_)}return W&&(_=s.recodePath(_),this._parts.path=this._parts.path.replace(W,_)),this.build(!v),this}},c.segment=function(_,v,O){var N=this._parts.urn?":":"/",V=this.path(),k=V.substring(0,1)==="/",G=V.split(N);if(_!==void 0&&typeof _!="number"&&(O=v,v=_,_=void 0),_!==void 0&&typeof _!="number")throw new Error('Bad segment "'+_+'", must be 0-based integer');if(k&&G.shift(),_<0&&(_=Math.max(G.length+_,0)),v===void 0)return _===void 0?G:G[_];if(_===null||G[_]===void 0)if(m(v)){G=[];for(var W=0,K=v.length;W<K;W++)!v[W].length&&(!G.length||!G[G.length-1].length)||(G.length&&!G[G.length-1].length&&G.pop(),G.push(b(v[W])))}else(v||typeof v=="string")&&(v=b(v),G[G.length-1]===""?G[G.length-1]=v:G.push(v));else v?G[_]=b(v):G.splice(_,1);return k&&G.unshift(""),this.path(G.join(N),O)},c.segmentCoded=function(_,v,O){var N,V,k;if(typeof _!="number"&&(O=v,v=_,_=void 0),v===void 0){if(N=this.segment(_,v,O),!m(N))N=N!==void 0?s.decode(N):void 0;else for(V=0,k=N.length;V<k;V++)N[V]=s.decode(N[V]);return N}if(!m(v))v=typeof v=="string"||v instanceof String?s.encode(v):v;else for(V=0,k=v.length;V<k;V++)v[V]=s.encode(v[V]);return this.segment(_,v,O)};var I=c.query;return c.query=function(_,v){if(_===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof _=="function"){var O=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),N=_.call(this,O);return this._parts.query=s.buildQuery(N||O,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this}else return _!==void 0&&typeof _!="string"?(this._parts.query=s.buildQuery(_,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!v),this):I.call(this,_,v)},c.setQuery=function(_,v,O){var N=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof _=="string"||_ instanceof String)N[_]=v!==void 0?v:null;else if(typeof _=="object")for(var V in _)u.call(_,V)&&(N[V]=_[V]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=s.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof _!="string"&&(O=v),this.build(!O),this},c.addQuery=function(_,v,O){var N=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(N,_,v===void 0?null:v),this._parts.query=s.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof _!="string"&&(O=v),this.build(!O),this},c.removeQuery=function(_,v,O){var N=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(N,_,v),this._parts.query=s.buildQuery(N,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof _!="string"&&(O=v),this.build(!O),this},c.hasQuery=function(_,v,O){var N=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(N,_,v,O)},c.setSearch=c.setQuery,c.addSearch=c.addQuery,c.removeSearch=c.removeQuery,c.hasSearch=c.hasQuery,c.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()},c.normalizeProtocol=function(_){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!_)),this},c.normalizeHostname=function(_){return this._parts.hostname&&(this.is("IDN")&&t?this._parts.hostname=t.toASCII(this._parts.hostname):this.is("IPv6")&&n&&(this._parts.hostname=n.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!_)),this},c.normalizePort=function(_){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!_)),this},c.normalizePath=function(_){var v=this._parts.path;if(!v)return this;if(this._parts.urn)return this._parts.path=s.recodeUrnPath(this._parts.path),this.build(!_),this;if(this._parts.path==="/")return this;v=s.recodePath(v);var O,N="",V,k;for(v.charAt(0)!=="/"&&(O=!0,v="/"+v),(v.slice(-3)==="/.."||v.slice(-2)==="/.")&&(v+="/"),v=v.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),O&&(N=v.substring(1).match(/^(\.\.\/)+/)||"",N&&(N=N[0]));V=v.search(/\/\.\.(\/|$)/),V!==-1;){if(V===0){v=v.substring(3);continue}k=v.substring(0,V).lastIndexOf("/"),k===-1&&(k=V),v=v.substring(0,k)+v.substring(V+3)}return O&&this.is("relative")&&(v=N+v.substring(1)),this._parts.path=v,this.build(!_),this},c.normalizePathname=c.normalizePath,c.normalizeQuery=function(_){return typeof this._parts.query=="string"&&(this._parts.query.length?this.query(s.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!_)),this},c.normalizeFragment=function(_){return this._parts.fragment||(this._parts.fragment=null,this.build(!_)),this},c.normalizeSearch=c.normalizeQuery,c.normalizeHash=c.normalizeFragment,c.iso8859=function(){var _=s.encode,v=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=_,s.decode=v}return this},c.unicode=function(){var _=s.encode,v=s.decode;s.encode=E,s.decode=unescape;try{this.normalize()}finally{s.encode=_,s.decode=v}return this},c.readable=function(){var _=this.clone();_.username("").password("").normalize();var v="";if(_._parts.protocol&&(v+=_._parts.protocol+"://"),_._parts.hostname&&(_.is("punycode")&&t?(v+=t.toUnicode(_._parts.hostname),_._parts.port&&(v+=":"+_._parts.port)):v+=_.host()),_._parts.hostname&&_._parts.path&&_._parts.path.charAt(0)!=="/"&&(v+="/"),v+=_.path(!0),_._parts.query){for(var O="",N=0,V=_._parts.query.split("&"),k=V.length;N<k;N++){var G=(V[N]||"").split("=");O+="&"+s.decodeQuery(G[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),G[1]!==void 0&&(O+="="+s.decodeQuery(G[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}v+="?"+O.substring(1)}return v+=s.decodeQuery(_.hash(),!0),v},c.absoluteTo=function(_){var v=this.clone(),O=["protocol","username","password","hostname","port"],N,V,k;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(_ instanceof s||(_=new s(_)),v._parts.protocol||(v._parts.protocol=_._parts.protocol,this._parts.hostname))return v;for(V=0;k=O[V];V++)v._parts[k]=_._parts[k];return v._parts.path?(v._parts.path.substring(-2)===".."&&(v._parts.path+="/"),v.path().charAt(0)!=="/"&&(N=_.directory(),N=N||(_.path().indexOf("/")===0?"/":""),v._parts.path=(N?N+"/":"")+v._parts.path,v.normalizePath())):(v._parts.path=_._parts.path,v._parts.query||(v._parts.query=_._parts.query)),v.build(),v},c.relativeTo=function(_){var v=this.clone().normalize(),O,N,V,k,G;if(v._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(_=new s(_).normalize(),O=v._parts,N=_._parts,k=v.path(),G=_.path(),k.charAt(0)!=="/")throw new Error("URI is already relative");if(G.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(O.protocol===N.protocol&&(O.protocol=null),O.username!==N.username||O.password!==N.password||O.protocol!==null||O.username!==null||O.password!==null)return v.build();if(O.hostname===N.hostname&&O.port===N.port)O.hostname=null,O.port=null;else return v.build();if(k===G)return O.path="",v.build();if(V=s.commonPath(k,G),!V)return v.build();var W=N.path.substring(V.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return O.path=W+O.path.substring(V.length)||"./",v.build()},c.equals=function(_){var v=this.clone(),O=new s(_),N={},V={},k={},G,W,K;if(v.normalize(),O.normalize(),v.toString()===O.toString())return!0;if(G=v.query(),W=O.query(),v.query(""),O.query(""),v.toString()!==O.toString()||G.length!==W.length)return!1;N=s.parseQuery(G,this._parts.escapeQuerySpace),V=s.parseQuery(W,this._parts.escapeQuerySpace);for(K in N)if(u.call(N,K)){if(m(N[K])){if(!y(N[K],V[K]))return!1}else if(N[K]!==V[K])return!1;k[K]=!0}for(K in V)if(u.call(V,K)&&!k[K])return!1;return!0},c.preventInvalidHostname=function(_){return this._parts.preventInvalidHostname=!!_,this},c.duplicateQueryParameters=function(_){return this._parts.duplicateQueryParameters=!!_,this},c.escapeQuerySpace=function(_){return this._parts.escapeQuerySpace=!!_,this},s})})(sye);const Rs=sB;function hye(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}function ht(e,t){if(e===null||typeof e!="object")return e;t=A(t,!1);const n=new e.constructor;for(const i in e)if(e.hasOwnProperty(i)){let o=e[i];t&&(o=ht(o,t)),n[i]=o}return n}function hn(e,t,n){n=A(n,!1);const i={},o=l(e),r=l(t);let 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]=hn(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}function Xp(){let e,t;const n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}function dT(e,t){let n;return typeof document<"u"&&(n=document),dT._implementation(e,t,n)}dT._implementation=function(e,t,n){if(!l(e))throw new x("relative uri is required.");if(!l(t)){if(typeof n>"u")return e;t=A(n.baseURI,n.location.href)}const i=new Rs(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function pye(e,t){if(!l(e))throw new x("uri is required.");let n="";const i=e.lastIndexOf("/");return i!==-1&&(n=e.substring(0,i+1)),t&&(e=new Rs(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function mye(e){if(!l(e))throw new x("uri is required.");const t=new Rs(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}const mU={};function VS(e,t,n){l(t)||(t=e.width),l(n)||(n=e.height);let i=mU[t];l(i)||(i={},mU[t]=i);let o=i[n];if(!l(o)){const 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}const _ye=/^blob:/i;function Yj(e){return T.typeOf.string("uri",e),_ye.test(e)}let Fu;function Xj(e){l(Fu)||(Fu=document.createElement("a")),Fu.href=window.location.href;const t=Fu.host,n=Fu.protocol;return Fu.href=e,Fu.href=Fu.href,n!==Fu.protocol||t!==Fu.host}const gye=/^data:/i;function aM(e){return T.typeOf.string("uri",e),gye.test(e)}function yye(e){const t=document.createElement("script");return t.async=!0,t.src=e,new Promise((n,i)=>{window.crossOriginIsolated&&t.setAttribute("crossorigin","anonymous");const 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)})}function Aye(e){if(!l(e))throw new x("obj is required.");let t="";for(const n in e)if(e.hasOwnProperty(n)){const 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}function bye(e){if(!l(e))throw new x("queryString is required.");const t={};if(e==="")return t;const n=e.replace(/\+/g,"%20").split(/[&;]/);for(let i=0,o=n.length;i<o;++i){const r=n[i].split("="),s=decodeURIComponent(r[0]);let a=r[1];l(a)?a=decodeURIComponent(a):a="";const c=t[s];typeof c=="string"?t[s]=[c,a]:Array.isArray(c)?c.push(a):t[s]=a}return t}const Cye={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},Do=Object.freeze(Cye),Tye={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},Y_=Object.freeze(Tye);function dd(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.throttleByServer,!1),n=A(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=A(e.priority,0),this.throttle=n,this.throttleByServer=t,this.type=A(e.type,Y_.OTHER),this.serverKey=void 0,this.state=Do.UNISSUED,this.deferred=void 0,this.cancelled=!1}dd.prototype.cancel=function(){this.cancelled=!0};dd.prototype.clone=function(e){return l(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 dd(this)};function Eye(e){const t={};if(!e)return t;const n=e.split(`\r
|
||
`);for(let i=0;i<n.length;++i){const o=n[i],r=o.indexOf(": ");if(r>0){const s=o.substring(0,r),a=o.substring(r+2);t[s]=a}}return t}function c0(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=Eye(this.responseHeaders))}c0.prototype.toString=function(){let e="Request has failed.";return l(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function Ke(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties(Ke.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});Ke.prototype.addEventListener=function(e,t){T.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}};Ke.prototype.removeEventListener=function(e,t){T.typeOf.func("listener",e);const n=this._listeners,i=this._scopes;let 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 xye(e,t){return t-e}Ke.prototype.raiseEvent=function(){this._insideRaiseEvent=!0;let e;const t=this._listeners,n=this._scopes;let i=t.length;for(e=0;e<i;e++){const r=t[e];l(r)&&t[e].apply(n[e],arguments)}const o=this._toRemove;if(i=o.length,i>0){for(o.sort(xye),e=0;e<i;e++){const r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};function X_(e){T.typeOf.object("options",e),T.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(X_.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){T.typeOf.number.greaterThanOrEquals("maximumLength",e,0);const t=this._length;if(e<t){const 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 cM(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}X_.prototype.reserve=function(e){e=A(e,this._length),this._array.length=e};X_.prototype.heapify=function(e){e=A(e,0);const t=this._length,n=this._comparator,i=this._array;let o=-1,r=!0;for(;r;){const 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?(cM(i,o,e),e=o):r=!1}};X_.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};X_.prototype.insert=function(e){T.defined("element",e);const t=this._array,n=this._comparator,i=this._maximumLength;let o=this._length++;for(o<t.length?t[o]=e:t.push(e);o!==0;){const s=Math.floor((o-1)/2);if(n(t[o],t[s])<0)cM(t,o,s),o=s;else break}let r;return l(i)&&this._length>i&&(r=t[i],this._length=i),r};X_.prototype.pop=function(e){if(e=A(e,0),this._length===0)return;T.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return cM(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function wye(e,t){return e.priority-t.priority}const wi={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let Ry=20;const Zs=new X_({comparator:wye});Zs.maximumLength=Ry;Zs.reserve(Ry);const Ju=[];let Pf={};const Sye=typeof document<"u"?new Rs(document.location.href):new Rs,sD=new Ke;function bi(){}bi.maximumRequests=50;bi.maximumRequestsPerServer=6;bi.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};bi.throttleRequests=!0;bi.debugShowStatistics=!1;bi.requestCompletedEvent=sD;Object.defineProperties(bi,{statistics:{get:function(){return wi}},priorityHeapLength:{get:function(){return Ry},set:function(e){if(e<Ry)for(;Zs.length>e;){const t=Zs.pop();d_(t)}Ry=e,Zs.maximumLength=e,Zs.reserve(e)}}});function Kj(e){l(e.priorityFunction)&&(e.priority=e.priorityFunction())}bi.serverHasOpenSlots=function(e,t){t=A(t,1);const n=A(bi.requestsByServer[e],bi.maximumRequestsPerServer);return Pf[e]+t<=n};bi.heapHasOpenSlots=function(e){return Zs.length+e<=Ry};function Jj(e){return e.state===Do.UNISSUED&&(e.state=Do.ISSUED,e.deferred=Xp()),e.deferred.promise}function vye(e){return function(t){if(e.state===Do.CANCELLED)return;const n=e.deferred;--wi.numberOfActiveRequests,--Pf[e.serverKey],sD.raiseEvent(),e.state=Do.RECEIVED,e.deferred=void 0,n.resolve(t)}}function Dye(e){return function(t){e.state!==Do.CANCELLED&&(++wi.numberOfFailedRequests,--wi.numberOfActiveRequests,--Pf[e.serverKey],sD.raiseEvent(t),e.state=Do.FAILED,e.deferred.reject(t))}}function Qj(e){const t=Jj(e);return e.state=Do.ACTIVE,Ju.push(e),++wi.numberOfActiveRequests,++wi.numberOfActiveRequestsEver,++Pf[e.serverKey],e.requestFunction().then(vye(e)).catch(Dye(e)),t}function d_(e){const t=e.state===Do.ACTIVE;if(e.state=Do.CANCELLED,++wi.numberOfCancelledRequests,l(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--wi.numberOfActiveRequests,--Pf[e.serverKey],++wi.numberOfCancelledActiveRequests),l(e.cancelFunction)&&e.cancelFunction()}bi.update=function(){let e,t,n=0;const i=Ju.length;for(e=0;e<i;++e){if(t=Ju[e],t.cancelled&&d_(t),t.state!==Do.ACTIVE){++n;continue}n>0&&(Ju[e-n]=t)}Ju.length-=n;const o=Zs.internalArray,r=Zs.length;for(e=0;e<r;++e)Kj(o[e]);Zs.resort();const s=Math.max(bi.maximumRequests-Ju.length,0);let a=0;for(;a<s&&Zs.length>0;){if(t=Zs.pop(),t.cancelled){d_(t);continue}if(t.throttleByServer&&!bi.serverHasOpenSlots(t.serverKey)){d_(t);continue}Qj(t),++a}Iye()};bi.getServerKey=function(e){T.typeOf.string("url",e);let t=new Rs(e);t.scheme()===""&&(t=new Rs(e).absoluteTo(Sye),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=Pf[n];return l(i)||(Pf[n]=0),n};bi.request=function(e){if(T.typeOf.object("request",e),T.typeOf.string("request.url",e.url),T.typeOf.func("request.requestFunction",e.requestFunction),aM(e.url)||Yj(e.url))return sD.raiseEvent(),e.state=Do.RECEIVED,e.requestFunction();if(++wi.numberOfAttemptedRequests,l(e.serverKey)||(e.serverKey=bi.getServerKey(e.url)),bi.throttleRequests&&e.throttleByServer&&!bi.serverHasOpenSlots(e.serverKey))return;if(!bi.throttleRequests||!e.throttle)return Qj(e);if(Ju.length>=bi.maximumRequests)return;Kj(e);const t=Zs.insert(e);if(l(t)){if(t===e)return;d_(t)}return Jj(e)};function Iye(){bi.debugShowStatistics&&(wi.numberOfActiveRequests===0&&wi.lastNumberOfActiveRequests>0&&(wi.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${wi.numberOfAttemptedRequests}`),wi.numberOfAttemptedRequests=0),wi.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${wi.numberOfCancelledRequests}`),wi.numberOfCancelledRequests=0),wi.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${wi.numberOfCancelledActiveRequests}`),wi.numberOfCancelledActiveRequests=0),wi.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${wi.numberOfFailedRequests}`),wi.numberOfFailedRequests=0)),wi.lastNumberOfActiveRequests=wi.numberOfActiveRequests)}bi.clearForSpecs=function(){for(;Zs.length>0;){const t=Zs.pop();d_(t)}const e=Ju.length;for(let t=0;t<e;++t)d_(Ju[t]);Ju.length=0,Pf={},wi.numberOfAttemptedRequests=0,wi.numberOfActiveRequests=0,wi.numberOfCancelledRequests=0,wi.numberOfCancelledActiveRequests=0,wi.numberOfFailedRequests=0,wi.numberOfActiveRequestsEver=0,wi.lastNumberOfActiveRequests=0};bi.numberOfActiveRequestsByServer=function(e){return Pf[e]};bi.requestHeap=Zs;const fT={};let l0={};fT.add=function(e,t){if(!l(e))throw new x("host is required.");if(!l(t)||t<=0)throw new x("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;l(l0[n])||(l0[n]=!0)};fT.remove=function(e,t){if(!l(e))throw new x("host is required.");if(!l(t)||t<=0)throw new x("port is required to be greater than 0.");const n=`${e.toLowerCase()}:${t}`;l(l0[n])&&delete l0[n]};function Pye(e){const t=new Rs(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}}fT.contains=function(e){if(!l(e))throw new x("url is required.");const t=Pye(e);return!!(l(t)&&l(l0[t]))};fT.clear=function(){l0={}};const Zj=fT,eq=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function lM(e,t,n,i){const o=e.query();if(o.length===0)return{};let r;if(o.indexOf("=")===-1){const s={};s[o]=void 0,r=s}else r=bye(o);n?t._queryParameters=kS(r,t._queryParameters,i):t._queryParameters=r,e.search("")}function Oye(e,t){const n=t._queryParameters,i=Object.keys(n);i.length===1&&!l(n[i[0]])?e.search(i[0]):e.search(Aye(n))}function id(e,t){return l(e)?l(e.clone)?e.clone():ht(e):t}function uM(e){if(e.state===Do.ISSUED||e.state===Do.ACTIVE)throw new Ie("The Resource is already being fetched.");e.state=Do.UNISSUED,e.deferred=void 0}function kS(e,t,n){if(!n)return hn(e,t);const i=ht(e,!0);for(const o in t)if(t.hasOwnProperty(o)){let r=i[o];const s=t[o];l(r)?(Array.isArray(r)||(r=i[o]=[r]),i[o]=r.concat(s)):i[o]=Array.isArray(s)?s.slice():s}return i}function Me(e){e=A(e,A.EMPTY_OBJECT),typeof e=="string"&&(e={url:e}),T.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=id(e.templateValues,{}),this._queryParameters=id(e.queryParameters,{}),this.headers=id(e.headers,{}),this.request=A(e.request,new dd),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=A(e.retryAttempts,0),this._retryCount=0;const t=new Rs(e.url);lM(t,this,!0,!0),t.fragment(""),this._url=t.toString()}Me.createIfNeeded=function(e){return e instanceof Me?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new Me({url:e})};let Sg;Me.supportsImageBitmapOptions=function(){if(l(Sg))return Sg;if(typeof createImageBitmap!="function")return Sg=Promise.resolve(!1),Sg;const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";return Sg=Me.fetchBlob({url:e}).then(function(t){const n={imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"};return Promise.all([createImageBitmap(t,n),createImageBitmap(t)])}).then(function(t){const n=VS(t[0]),i=VS(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),Sg};Object.defineProperties(Me,{isBlobSupported:{get:function(){return eq}}});Object.defineProperties(Me.prototype,{queryParameters:{get:function(){return this._queryParameters}},templateValues:{get:function(){return this._templateValues}},url:{get:function(){return this.getUrlComponent(!0,!0)},set:function(e){const t=new Rs(e);lM(t,this,!1),t.fragment(""),this._url=t.toString()}},extension:{get:function(){return mye(this._url)}},isDataUri:{get:function(){return aM(this._url)}},isBlobUri:{get:function(){return Yj(this._url)}},isCrossOriginUrl:{get:function(){return Xj(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}});Me.prototype.toString=function(){return this.getUrlComponent(!0,!0)};Me.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;const n=new Rs(this._url);e&&Oye(n,this);let i=n.toString().replace(/%7B/g,"{").replace(/%7D/g,"}");const o=this._templateValues;return i=i.replace(/{(.*?)}/g,function(r,s){const a=o[s];return l(a)?encodeURIComponent(a):r}),t&&l(this.proxy)&&(i=this.proxy.getURL(i)),i};Me.prototype.setQueryParameters=function(e,t){t?this._queryParameters=kS(this._queryParameters,e,!1):this._queryParameters=kS(e,this._queryParameters,!1)};Me.prototype.appendQueryParameters=function(e){this._queryParameters=kS(e,this._queryParameters,!0)};Me.prototype.setTemplateValues=function(e,t){t?this._templateValues=hn(this._templateValues,e):this._templateValues=hn(e,this._templateValues)};Me.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,l(e.url)){const n=new Rs(e.url),i=A(e.preserveQueryParameters,!1);lM(n,t,!0,i),n.fragment(""),n.scheme()!==""?t._url=n.toString():t._url=n.absoluteTo(new Rs(dT(this._url))).toString()}return l(e.queryParameters)&&(t._queryParameters=hn(e.queryParameters,t._queryParameters)),l(e.templateValues)&&(t._templateValues=hn(e.templateValues,t.templateValues)),l(e.headers)&&(t.headers=hn(e.headers,t.headers)),l(e.proxy)&&(t.proxy=e.proxy),l(e.request)&&(t.request=e.request),l(e.retryCallback)&&(t.retryCallback=e.retryCallback),l(e.retryAttempts)&&(t.retryAttempts=e.retryAttempts),t};Me.prototype.retryOnError=function(e){const t=this.retryCallback;if(typeof t!="function"||this._retryCount>=this.retryAttempts)return Promise.resolve(!1);const n=this;return Promise.resolve(t(this,e)).then(function(i){return++n._retryCount,i})};Me.prototype.clone=function(e){return l(e)||(e=new Me({url:this._url})),e._url=this._url,e._queryParameters=ht(this._queryParameters),e._templateValues=ht(this._templateValues),e.headers=ht(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e};Me.prototype.getBaseUri=function(e){return pye(this.getUrlComponent(e),e)};Me.prototype.appendForwardSlash=function(){this._url=hye(this._url)};Me.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};Me.fetchArrayBuffer=function(e){return new Me(e).fetchArrayBuffer()};Me.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};Me.fetchBlob=function(e){return new Me(e).fetchBlob()};Me.prototype.fetchImage=function(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.preferImageBitmap,!1),n=A(e.preferBlob,!1),i=A(e.flipY,!1),o=A(e.skipColorSpaceConversion,!1);if(uM(this.request),!eq||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return aB({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!l(r))return;let s,a,c,u;return Me.supportsImageBitmapOptions().then(function(d){return s=d,a=s&&t,r}).then(function(d){if(!l(d))return;if(u=d,a)return Me.createImageBitmapFromBlob(d,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const h=window.URL.createObjectURL(d);return c=new Me({url:h}),aB({resource:c,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(d){if(l(d))return d.blob=u,a||window.URL.revokeObjectURL(c.url),d}).catch(function(d){return l(c)&&window.URL.revokeObjectURL(c.url),d.blob=u,Promise.reject(d)})};function aB(e){const 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);const c=Xp();return Me._Implementations.createImage(r,a,c,n,i,o),c.promise};const s=bi.request(r);if(l(s))return s.catch(function(a){return r.state!==Do.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(r.state=Do.UNISSUED,r.deferred=void 0,aB({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}Me.fetchImage=function(e){return new Me(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};Me.prototype.fetchText=function(){return this.fetch({responseType:"text"})};Me.fetchText=function(e){return new Me(e).fetchText()};Me.prototype.fetchJson=function(){const e=this.fetch({responseType:"text",headers:{Accept:"application/json,*/*;q=0.01"}});if(l(e))return e.then(function(t){if(l(t))return JSON.parse(t)})};Me.fetchJson=function(e){return new Me(e).fetchJson()};Me.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};Me.fetchXML=function(e){return new Me(e).fetchXML()};Me.prototype.fetchJsonp=function(e){e=A(e,"callback"),uM(this.request);let t;do t=`loadJsonp${M.nextRandomNumber().toString().substring(2,8)}`;while(l(window[t]));return tq(this,e,t)};function tq(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request;o.url=e.url,o.requestFunction=function(){const s=Xp();return window[n]=function(a){s.resolve(a);try{delete window[n]}catch{window[n]=void 0}},Me._Implementations.loadAndExecuteScript(e.url,n,s),s.promise};const r=bi.request(o);if(l(r))return r.catch(function(s){return o.state!==Do.FAILED?Promise.reject(s):e.retryOnError(s).then(function(a){return a?(o.state=Do.UNISSUED,o.deferred=void 0,tq(e,t,n)):Promise.reject(s)})})}Me.fetchJsonp=function(e){return new Me(e).fetchJsonp(e.callbackParameterName)};Me.prototype._makeRequest=function(e){const t=this;uM(t.request);const n=t.request;n.url=t.url,n.requestFunction=function(){const o=e.responseType,r=hn(e.headers,t.headers),s=e.overrideMimeType,a=e.method,c=e.data,u=Xp(),d=Me._Implementations.loadWithXhr(t.url,o,a,c,r,u,s);return l(d)&&l(d.abort)&&(n.cancelFunction=function(){d.abort()}),u.promise};const i=bi.request(n);if(l(i))return i.then(function(o){return n.cancelFunction=void 0,o}).catch(function(o){return n.cancelFunction=void 0,n.state!==Do.FAILED?Promise.reject(o):t.retryOnError(o).then(function(r){return r?(n.state=Do.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(o)})})};const Lye=/^data:(.*?)(;base64)?,(.*)$/;function Lw(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function _U(e,t){const n=Lw(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 Bye(e,t){t=A(t,"");const n=e[1],i=!!e[2],o=e[3];let r,s;switch(t){case"":case"text":return Lw(i,o);case"arraybuffer":return _U(i,o);case"blob":return r=_U(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(Lw(i,o),n);case"json":return JSON.parse(Lw(i,o));default:throw new x(`Unhandled responseType: ${t}`)}}Me.prototype.fetch=function(e){return e=id(e,{}),e.method="GET",this._makeRequest(e)};Me.fetch=function(e){return new Me(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me.prototype.delete=function(e){return e=id(e,{}),e.method="DELETE",this._makeRequest(e)};Me.delete=function(e){return new Me(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};Me.prototype.head=function(e){return e=id(e,{}),e.method="HEAD",this._makeRequest(e)};Me.head=function(e){return new Me(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me.prototype.options=function(e){return e=id(e,{}),e.method="OPTIONS",this._makeRequest(e)};Me.options=function(e){return new Me(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me.prototype.post=function(e,t){return T.defined("data",e),t=id(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};Me.post=function(e){return new Me(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me.prototype.put=function(e,t){return T.defined("data",e),t=id(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};Me.put=function(e){return new Me(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me.prototype.patch=function(e,t){return T.defined("data",e),t=id(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};Me.patch=function(e){return new Me(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Me._Implementations={};Me._Implementations.loadImageElement=function(e,t,n){const 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&&(Zj.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};Me._Implementations.createImage=function(e,t,n,i,o,r){const s=e.url;Me.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){Me._Implementations.loadImageElement(s,t,n);return}const c="blob",u="GET",d=Xp(),h=Me._Implementations.loadWithXhr(s,c,u,void 0,void 0,d,void 0,void 0,void 0);return l(h)&&l(h.abort)&&(e.cancelFunction=function(){h.abort()}),d.promise.then(function(m){if(!l(m)){n.reject(new Ie(`Successfully retrieved ${s} but it contained no content.`));return}return Me.createImageBitmapFromBlob(m,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(m){n.resolve(m)})}).catch(function(a){n.reject(a)})};Me.createImageBitmapFromBlob=function(e,t){return T.defined("options",t),T.typeOf.bool("options.flipY",t.flipY),T.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),T.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function gU(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 Rye(e,t,n,i,o,r,s){let a,c;Promise.all([NE(()=>import("./__vite-browser-external-b25bb000.js"),[]),NE(()=>import("./__vite-browser-external-b25bb000.js"),[])]).then(([u,d])=>(a=u.parse(e),c=d,a.protocol==="https:"?NE(()=>import("./__vite-browser-external-b25bb000.js"),[]):NE(()=>import("./__vite-browser-external-b25bb000.js"),[]))).then(u=>{const d={protocol:a.protocol,hostname:a.hostname,port:a.port,path:a.path,query:a.query,method:n,headers:o};u.request(d).on("response",function(h){if(h.statusCode<200||h.statusCode>=300){r.reject(new c0(h.statusCode,h,h.headers));return}const m=[];h.on("data",function(g){m.push(g)}),h.on("end",function(){const g=Buffer.concat(m);h.headers["content-encoding"]==="gzip"?c.gunzip(g,function(p,y){p?r.reject(new Ie("Error decompressing response.")):r.resolve(gU(y,t))}):r.resolve(gU(g,t))})}).on("error",function(h){r.reject(new c0)}).end()})}const Nye=typeof XMLHttpRequest>"u";Me._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=Lye.exec(e);if(a!==null){r.resolve(Bye(a,t));return}if(Nye){Rye(e,t,n,i,o,r);return}const c=new XMLHttpRequest;if(Zj.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),l(s)&&l(c.overrideMimeType)&&c.overrideMimeType(s),l(o))for(const d in o)o.hasOwnProperty(d)&&c.setRequestHeader(d,o[d]);l(t)&&(c.responseType=t);let u=!1;return typeof e=="string"&&(u=e.indexOf("file://")===0||typeof window<"u"&&window.location.origin==="file://"),c.onload=function(){if((c.status<200||c.status>=300)&&!(u&&c.status===0)){r.reject(new c0(c.status,c.response,c.getAllResponseHeaders()));return}const d=c.response,h=c.responseType;if(n==="HEAD"||n==="OPTIONS"){const g=c.getAllResponseHeaders().trim().split(/[\r\n]+/),p={};g.forEach(function(y){const b=y.split(": "),C=b.shift();p[C]=b.join(": ")}),r.resolve(p);return}if(c.status===204)r.resolve();else if(l(d)&&(!l(t)||h===t))r.resolve(d);else if(t==="json"&&typeof d=="string")try{r.resolve(JSON.parse(d))}catch(m){r.reject(m)}else(h===""||h==="document")&&l(c.responseXML)&&c.responseXML.hasChildNodes()?r.resolve(c.responseXML):(h===""||h==="text")&&l(c.responseText)?r.resolve(c.responseText):r.reject(new Ie("Invalid XMLHttpRequest response type."))},c.onerror=function(d){r.reject(new c0)},c.send(i),c};Me._Implementations.loadAndExecuteScript=function(e,t,n){return yye(e).catch(function(i){n.reject(i)})};Me._DefaultImplementations={};Me._DefaultImplementations.createImage=Me._Implementations.createImage;Me._DefaultImplementations.loadWithXhr=Me._Implementations.loadWithXhr;Me._DefaultImplementations.loadAndExecuteScript=Me._Implementations.loadAndExecuteScript;Me.DEFAULT=Object.freeze(new Me({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function AC(e){e=A(e,A.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=A(e.addNewLeapSeconds,!0),l(e.data)?yU(this,e.data):yU(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}AC.fromUrl=async function(e,t){T.defined("url",e),t=A(t,A.EMPTY_OBJECT);const n=Me.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Ie(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new AC({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};AC.NONE=Object.freeze({compute:function(e,t){return l(t)?(t.xPoleWander=0,t.yPoleWander=0,t.xPoleOffset=0,t.yPoleOffset=0,t.ut1MinusUtc=0):t=new iM(0,0,0,0,0),t}});AC.prototype.compute=function(e,t){if(!l(this._samples))return;if(l(t)||(t=new iM(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;const n=this._dates,i=this._lastIndex;let o=0,r=0;if(l(i)){const a=n[i],c=n[i+1],u=ie.lessThanOrEquals(a,e),d=!l(c),h=d||ie.greaterThanOrEquals(c,e);if(u&&h)return o=i,!d&&c.equals(e)&&++o,r=o+1,bU(this,n,this._samples,e,o,r,t),t}let s=Bs(n,e,ie.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,bU(this,n,this._samples,e,o,r,t),t};function Mye(e,t){return ie.compare(e.julianDate,t)}function yU(e,t){if(!l(t.columnNames))throw new Ie("Error in loaded EOP data: The columnNames property is required.");if(!l(t.samples))throw new Ie("Error in loaded EOP data: The samples property is required.");const 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 Ie("Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns");const u=e._samples=t.samples,d=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 h;const m=e._addNewLeapSeconds;for(let g=0,p=u.length;g<p;g+=e._columnCount){const y=u[g+n],b=u[g+c],C=y+Ni.MODIFIED_JULIAN_DATE_DIFFERENCE,E=new ie(C,b,$n.TAI);if(d.push(E),m){if(b!==h&&l(h)){const w=ie.leapSeconds,S=Bs(w,E,Mye);if(S<0){const P=new $i(E,b);w.splice(~S,0,P)}}h=b}}}function AU(e,t,n,i,o){const 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 cA(e,t,n){return t+e*(n-t)}function bU(e,t,n,i,o,r,s){const 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;const c=t[o],u=t[r];if(c.equals(u)||i.equals(c))return AU(e,n,o,a,s),s;if(i.equals(u))return AU(e,n,r,a,s),s;const d=ie.secondsDifference(i,c)/ie.secondsDifference(u,c),h=o*a,m=r*a;let g=n[h+e._ut1MinusUtcSecondsColumn],p=n[m+e._ut1MinusUtcSecondsColumn];const y=p-g;if(y>.5||y<-.5){const b=n[h+e._taiMinusUtcSecondsColumn],C=n[m+e._taiMinusUtcSecondsColumn];b!==C&&(u.equals(i)?g=p:p-=C-b)}return s.xPoleWander=cA(d,n[h+e._xPoleWanderRadiansColumn],n[m+e._xPoleWanderRadiansColumn]),s.yPoleWander=cA(d,n[h+e._yPoleWanderRadiansColumn],n[m+e._yPoleWanderRadiansColumn]),s.xPoleOffset=cA(d,n[h+e._xCelestialPoleOffsetRadiansColumn],n[m+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=cA(d,n[h+e._yCelestialPoleOffsetRadiansColumn],n[m+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=cA(d,g,p),s}function Xr(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.roll=A(n,0)}Xr.fromQuaternion=function(e,t){if(!l(e))throw new x("quaternion is required");l(t)||(t=new Xr);const 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=-M.asinClamped(n),t};Xr.fromDegrees=function(e,t,n,i){if(!l(e))throw new x("heading is required");if(!l(t))throw new x("pitch is required");if(!l(n))throw new x("roll is required");return l(i)||(i=new Xr),i.heading=e*M.RADIANS_PER_DEGREE,i.pitch=t*M.RADIANS_PER_DEGREE,i.roll=n*M.RADIANS_PER_DEGREE,i};Xr.clone=function(e,t){if(l(e))return l(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new Xr(e.heading,e.pitch,e.roll)};Xr.equals=function(e,t){return e===t||l(e)&&l(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};Xr.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&M.equalsEpsilon(e.heading,t.heading,n,i)&&M.equalsEpsilon(e.pitch,t.pitch,n,i)&&M.equalsEpsilon(e.roll,t.roll,n,i)};Xr.prototype.clone=function(e){return Xr.clone(this,e)};Xr.prototype.equals=function(e){return Xr.equals(this,e)};Xr.prototype.equalsEpsilon=function(e,t,n){return Xr.equalsEpsilon(this,e,t,n)};Xr.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const nq=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function Fye(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const i=e[t].getAttribute("src"),o=nq.exec(i);if(o!==null)return o[1]}}let vg;function iq(e){return typeof document>"u"?e:(l(vg)||(vg=document.createElement("a")),vg.href=e,vg.href=vg.href,vg.href)}let qm;function oq(){if(l(qm))return qm;let e;if(typeof CESIUM_BASE_URL<"u"?e=CESIUM_BASE_URL:typeof define=="object"&&l(define.amd)&&!define.amd.toUrlUndefined&&l(require.toUrl)?e=dT("..",An("Core/buildModuleUrl.js")):e=Fye(),!l(e))throw new x("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return qm=new Me({url:iq(e)}),qm.appendForwardSlash(),qm}function zye(e){return iq(require.toUrl(`../${e}`))}function rq(e){return oq().getDerivedResource({url:e}).url}let ME;function An(e){return l(ME)||(typeof define=="object"&&l(define.amd)&&!define.amd.toUrlUndefined&&l(require.toUrl)?ME=zye:ME=rq),ME(e)}An._cesiumScriptRegex=nq;An._buildModuleUrlFromBaseUrl=rq;An._clearBaseResource=function(){qm=void 0};An.setBaseUrl=function(e){qm=Me.DEFAULT.getDerivedResource({url:e})};An.getCesiumBaseUrl=oq;function sq(e,t,n){this.x=e,this.y=t,this.s=n}function dM(e){e=A(e,A.EMPTY_OBJECT),this._xysFileUrlTemplate=Me.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=A(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=A(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new ie(this._sampleZeroJulianEphemerisDate,0,$n.TAI),this._stepSizeDays=A(e.stepSizeDays,1),this._samplesPerXysFile=A(e.samplesPerXysFile,1e3),this._totalSamples=A(e.totalSamples,27426),this._samples=new Array(this._totalSamples*3),this._chunkDownloadsInProgress=[];const 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)}const Uye=new ie(0,0,$n.TAI);function cB(e,t,n){const i=Uye;return i.dayNumber=t,i.secondsOfDay=n,ie.daysDifference(i,e._sampleZeroDateTT)}dM.prototype.preload=function(e,t,n,i){const o=cB(this,e,t),r=cB(this,n,i);let 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);const c=s/this._samplesPerXysFile|0,u=a/this._samplesPerXysFile|0,d=[];for(let h=c;h<=u;++h)d.push(lB(this,h));return Promise.all(d)};dM.prototype.computeXysRadians=function(e,t,n){const i=cB(this,e,t);if(i<0)return;const o=i/this._stepSizeDays|0;if(o>=this._totalSamples)return;const r=this._interpolationOrder;let 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;const u=this._samples;if(l(u[s*3])||(lB(this,s/this._samplesPerXysFile|0),c=!0),l(u[a*3])||(lB(this,a/this._samplesPerXysFile|0),c=!0),c)return;l(n)?(n.x=0,n.y=0,n.s=0):n=new sq(0,0,0);const d=i-s*this._stepSizeDays,h=this._work,m=this._denominators,g=this._coef,p=this._xTable;let y,b;for(y=0;y<=r;++y)h[y]=d-p[y];for(y=0;y<=r;++y){for(g[y]=1,b=0;b<=r;++b)b!==y&&(g[y]*=h[b]);g[y]*=m[y];let C=(s+y)*3;n.x+=g[y]*u[C++],n.y+=g[y]*u[C++],n.s+=g[y]*u[C]}return n};function lB(e,t){if(e._chunkDownloadsInProgress[t])return e._chunkDownloadsInProgress[t];let n;const i=e._xysFileUrlTemplate;l(i)?n=i.getDerivedResource({templateValues:{0:t}}):n=new Me({url:An(`Assets/IAU2006_XYS/IAU2006_XYS_${t}.json`)});const o=n.fetchJson().then(function(r){e._chunkDownloadsInProgress[t]=!1;const s=e._samples,a=r.samples,c=t*e._samplesPerXysFile*3;for(let u=0,d=a.length;u<d;++u)s[c+u]=a[u]});return e._chunkDownloadsInProgress[t]=o,o}const Ti={},l1={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"}},Dg={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},u1={},za={east:new f,north:new f,up:new f,west:new f,south:new f,down:new f};let gh=new f,yh=new f,Ah=new f;Ti.localFrameToFixedFrameGenerator=function(e,t){if(!l1.hasOwnProperty(e)||!l1[e].hasOwnProperty(t))throw new x("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=l1[e][t];let i;const o=e+t;return l(u1[o])?i=u1[o]:(i=function(r,s,a){if(!l(r))throw new x("origin is required.");if(l(a)||(a=new B),f.equalsEpsilon(r,f.ZERO,M.EPSILON14))f.unpack(Dg[e],0,gh),f.unpack(Dg[t],0,yh),f.unpack(Dg[n],0,Ah);else if(M.equalsEpsilon(r.x,0,M.EPSILON14)&&M.equalsEpsilon(r.y,0,M.EPSILON14)){const c=M.sign(r.z);f.unpack(Dg[e],0,gh),e!=="east"&&e!=="west"&&f.multiplyByScalar(gh,c,gh),f.unpack(Dg[t],0,yh),t!=="east"&&t!=="west"&&f.multiplyByScalar(yh,c,yh),f.unpack(Dg[n],0,Ah),n!=="east"&&n!=="west"&&f.multiplyByScalar(Ah,c,Ah)}else{s=A(s,me.WGS84),s.geodeticSurfaceNormal(r,za.up);const c=za.up,u=za.east;u.x=-r.y,u.y=r.x,u.z=0,f.normalize(u,za.east),f.cross(c,u,za.north),f.multiplyByScalar(za.up,-1,za.down),f.multiplyByScalar(za.east,-1,za.west),f.multiplyByScalar(za.north,-1,za.south),gh=za[e],yh=za[t],Ah=za[n]}return a[0]=gh.x,a[1]=gh.y,a[2]=gh.z,a[3]=0,a[4]=yh.x,a[5]=yh.y,a[6]=yh.z,a[7]=0,a[8]=Ah.x,a[9]=Ah.y,a[10]=Ah.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},u1[o]=i),i};Ti.eastNorthUpToFixedFrame=Ti.localFrameToFixedFrameGenerator("east","north");Ti.northEastDownToFixedFrame=Ti.localFrameToFixedFrameGenerator("north","east");Ti.northUpEastToFixedFrame=Ti.localFrameToFixedFrameGenerator("north","up");Ti.northWestUpToFixedFrame=Ti.localFrameToFixedFrameGenerator("north","west");const Hye=new Te,Vye=new f(1,1,1),kye=new B;Ti.headingPitchRollToFixedFrame=function(e,t,n,i,o){T.typeOf.object("HeadingPitchRoll",t),i=A(i,Ti.eastNorthUpToFixedFrame);const r=Te.fromHeadingPitchRoll(t,Hye),s=B.fromTranslationQuaternionRotationScale(f.ZERO,r,Vye,kye);return o=i(e,n,o),B.multiply(o,s,o)};const Gye=new B,Wye=new J;Ti.headingPitchRollQuaternion=function(e,t,n,i,o){T.typeOf.object("HeadingPitchRoll",t);const r=Ti.headingPitchRollToFixedFrame(e,t,n,i,Gye),s=B.getMatrix3(r,Wye);return Te.fromRotationMatrix(s,o)};const jye=new f(1,1,1),qye=new f,CU=new B,$ye=new B,Yye=new J,Xye=new Te;Ti.fixedFrameToHeadingPitchRoll=function(e,t,n,i){T.defined("transform",e),t=A(t,me.WGS84),n=A(n,Ti.eastNorthUpToFixedFrame),l(i)||(i=new Xr);const o=B.getTranslation(e,qye);if(f.equals(o,f.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=B.inverseTransformation(n(o,t,CU),CU),s=B.setScale(e,jye,$ye);s=B.setTranslation(s,f.ZERO,s),r=B.multiply(r,s,r);let a=Te.fromRotationMatrix(B.getMatrix3(r,Yye),Xye);return a=Te.normalize(a,a),Xr.fromQuaternion(a,i)};const Kye=6*3600+41*60+50.54841,Jye=8640184812866e-6,Qye=.093104,Zye=-62e-7,e0e=11772758384668e-32,t0e=72921158553e-15,n0e=M.TWO_PI/86400;let FE=new ie;Ti.computeTemeToPseudoFixedMatrix=function(e,t){if(!l(e))throw new x("date is required.");FE=ie.addSeconds(e,-ie.computeTaiMinusUtc(e),FE);const n=FE.dayNumber,i=FE.secondsOfDay;let o;const r=n-2451545;i>=43200?o=(r+.5)/Ni.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/Ni.DAYS_PER_JULIAN_CENTURY;const a=(Kye+o*(Jye+o*(Qye+o*Zye)))*n0e%M.TWO_PI,c=t0e+e0e*(n-24515455e-1),u=(i+Ni.SECONDS_PER_DAY*.5)%Ni.SECONDS_PER_DAY,d=a+c*u,h=Math.cos(d),m=Math.sin(d);return l(t)?(t[0]=h,t[1]=-m,t[2]=0,t[3]=m,t[4]=h,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new J(h,m,0,-m,h,0,0,0,1)};Ti.iau2006XysData=new dM;Ti.earthOrientationParameters=AC.NONE;const uB=32.184,i0e=2451545;Ti.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+uB,i=e.stop.dayNumber,o=e.stop.secondsOfDay+uB;return Ti.iau2006XysData.preload(t,n,i,o)};Ti.computeIcrfToFixedMatrix=function(e,t){if(!l(e))throw new x("date is required.");l(t)||(t=new J);const n=Ti.computeFixedToIcrfMatrix(e,t);if(l(n))return J.transpose(n,t)};const o0e=new sq(0,0,0),r0e=new iM(0,0,0,0,0),d1=new J,f1=new J;Ti.computeFixedToIcrfMatrix=function(e,t){if(!l(e))throw new x("date is required.");l(t)||(t=new J);const n=Ti.earthOrientationParameters.compute(e,r0e);if(!l(n))return;const i=e.dayNumber,o=e.secondsOfDay+uB,r=Ti.iau2006XysData.computeXysRadians(i,o,o0e);if(!l(r))return;const s=r.x+n.xPoleOffset,a=r.y+n.yPoleOffset,c=1/(1+Math.sqrt(1-s*s-a*a)),u=d1;u[0]=1-c*s*s,u[3]=-c*s*a,u[6]=s,u[1]=-c*s*a,u[4]=1-c*a*a,u[7]=a,u[2]=-s,u[5]=-a,u[8]=1-c*(s*s+a*a);const d=J.fromRotationZ(-r.s,f1),h=J.multiply(u,d,d1),m=e.dayNumber,g=e.secondsOfDay-ie.computeTaiMinusUtc(e)+n.ut1MinusUtc,p=m-2451545,y=g/Ni.SECONDS_PER_DAY;let b=.779057273264+y+.00273781191135448*(p+y);b=b%1*M.TWO_PI;const C=J.fromRotationZ(b,f1),E=J.multiply(h,C,d1),w=Math.cos(n.xPoleWander),S=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),L=Math.sin(n.yPoleWander);let z=i-i0e+o/Ni.SECONDS_PER_DAY;z/=36525;const R=-47e-6*z*M.RADIANS_PER_DEGREE/3600,F=Math.cos(R),U=Math.sin(R),D=f1;return D[0]=w*F,D[1]=w*U,D[2]=P,D[3]=-S*U+L*P*F,D[4]=S*F+L*P*U,D[5]=-L*w,D[6]=-L*U-S*P*F,D[7]=L*F-S*P*U,D[8]=S*w,J.multiply(E,D,t)};const s0e=new oe;Ti.pointToWindowCoordinates=function(e,t,n,i){return i=Ti.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};Ti.pointToGLWindowCoordinates=function(e,t,n,i){if(!l(e))throw new x("modelViewProjectionMatrix is required.");if(!l(t))throw new x("viewportTransformation is required.");if(!l(n))throw new x("point is required.");l(i)||(i=new j);const o=s0e;return B.multiplyByVector(e,oe.fromElements(n.x,n.y,n.z,1,o),o),oe.multiplyByScalar(o,1/o.w,o),B.multiplyByVector(t,o,o),j.fromCartesian4(o,i)};const a0e=new f,c0e=new f,l0e=new f;Ti.rotationMatrixFromPositionVelocity=function(e,t,n,i){if(!l(e))throw new x("position is required.");if(!l(t))throw new x("velocity is required.");const o=A(n,me.WGS84).geodeticSurfaceNormal(e,a0e);let r=f.cross(t,o,c0e);f.equalsEpsilon(r,f.ZERO,M.EPSILON6)&&(r=f.clone(f.UNIT_X,r));const s=f.cross(r,t,l0e);return f.normalize(s,s),f.cross(t,s,r),f.negate(r,r),f.normalize(r,r),l(i)||(i=new J),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=r.x,i[4]=r.y,i[5]=r.z,i[6]=s.x,i[7]=s.y,i[8]=s.z,i};const aq=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),cq=new Ce,lq=new f,u0e=new f,d0e=new J,dB=new B,uq=new B;Ti.basisTo2D=function(e,t,n){if(!l(e))throw new x("projection is required.");if(!l(t))throw new x("matrix is required.");if(!l(n))throw new x("result is required.");const i=B.getTranslation(t,u0e),o=e.ellipsoid,r=o.cartesianToCartographic(i,cq),s=e.project(r,lq);f.fromElements(s.z,s.x,s.y,s);const a=Ti.eastNorthUpToFixedFrame(i,o,dB),c=B.inverseTransformation(a,uq),u=B.getMatrix3(t,d0e),d=B.multiplyByMatrix3(c,u,n);return B.multiply(aq,d,n),B.setTranslation(n,s,n),n};Ti.wgs84To2DModelMatrix=function(e,t,n){if(!l(e))throw new x("projection is required.");if(!l(t))throw new x("center is required.");if(!l(n))throw new x("result is required.");const i=e.ellipsoid,o=Ti.eastNorthUpToFixedFrame(t,i,dB),r=B.inverseTransformation(o,uq),s=i.cartesianToCartographic(t,cq),a=e.project(s,lq);f.fromElements(a.z,a.x,a.y,a);const c=B.fromTranslation(a,dB);return B.multiply(aq,r,n),B.multiply(c,n,n),n};const cn=Ti;function Lt(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=A(e.primitiveType,Ze.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=A(e.geometryType,Cy.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Lt.computeNumberOfVertices=function(e){T.typeOf.object("geometry",e);let t=-1;for(const n in e.attributes)if(e.attributes.hasOwnProperty(n)&&l(e.attributes[n])&&l(e.attributes[n].values)){const i=e.attributes[n],o=i.values.length/i.componentsPerAttribute;if(t!==o&&t!==-1)throw new x("All attribute lists must have the same number of attributes.");t=o}return t};const f0e=new Ce,h0e=new f,TU=new B,p0e=[new Ce,new Ce,new Ce],m0e=[new j,new j,new j],_0e=[new j,new j,new j],g0e=new f,y0e=new Te,A0e=new B,b0e=new dt;Lt._textureCoordinateRotationPoints=function(e,t,n,i){let o;const r=ge.center(i,f0e),s=Ce.toCartesian(r,n,h0e),a=cn.eastNorthUpToFixedFrame(s,n,TU),c=B.inverse(a,TU),u=m0e,d=p0e;d[0].longitude=i.west,d[0].latitude=i.south,d[1].longitude=i.west,d[1].latitude=i.north,d[2].longitude=i.east,d[2].latitude=i.south;let h=g0e;for(o=0;o<3;o++)Ce.toCartesian(d[o],n,h),h=B.multiplyByPointAsVector(c,h,h),u[o].x=h.x,u[o].y=h.y;const m=Te.fromAxisAngle(f.UNIT_Z,-t,y0e),g=J.fromQuaternion(m,A0e),p=e.length;let y=Number.POSITIVE_INFINITY,b=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,E=Number.NEGATIVE_INFINITY;for(o=0;o<p;o++)h=B.multiplyByPointAsVector(c,e[o],h),h=J.multiplyByVector(g,h,h),y=Math.min(y,h.x),b=Math.min(b,h.y),C=Math.max(C,h.x),E=Math.max(E,h.y);const w=dt.fromRotation(t,b0e),S=_0e;S[0].x=y,S[0].y=b,S[1].x=y,S[1].y=E,S[2].x=C,S[2].y=b;const P=u[0],L=u[2].x-P.x,z=u[1].y-P.y;for(o=0;o<3;o++){const I=S[o];dt.multiplyByVector(w,I,I),I.x=(I.x-P.x)/L,I.y=(I.y-P.y)/z}const R=S[0],F=S[1],U=S[2],D=new Array(6);return j.pack(R,D),j.pack(F,D,2),j.pack(U,D,4),D};function Ue(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.componentDatatype))throw new x("options.componentDatatype is required.");if(!l(e.componentsPerAttribute))throw new x("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new x("options.componentsPerAttribute must be between 1 and 4.");if(!l(e.values))throw new x("options.values is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=A(e.normalize,!1),this.values=e.values}function u0(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(u0.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}}});u0.clone=function(e){if(l(e))return new u0(e._format,e._datatype,e._width,e._height,e._buffer)};u0.prototype.clone=function(){return u0.clone(this)};function dq(){if(!l(Vi._canTransferArrayBuffer)){const e=new Worker(hq("Workers/transferTypedArrayTest.js"));e.postMessage=A(e.webkitPostMessage,e.postMessage);const t=99,n=new Int8Array([t]);try{e.postMessage({array:n},[n.buffer])}catch{return Vi._canTransferArrayBuffer=!1,Vi._canTransferArrayBuffer}const i=Xp();e.onmessage=function(o){const r=o.data.array,s=l(r)&&r[0]===t;i.resolve(s),e.terminate(),Vi._canTransferArrayBuffer=s},Vi._canTransferArrayBuffer=i.promise}return Vi._canTransferArrayBuffer}const fB=new Ke;function fq(e,t){--e._activeTasks;const n=t.id;if(!l(n))return;const i=e._deferreds,o=i[n];if(l(t.error)){let r=t.error;r.name==="RuntimeError"?(r=new Ie(t.error.message),r.stack=t.error.stack):r.name==="DeveloperError"&&(r=new x(t.error.message),r.stack=t.error.stack),fB.raiseEvent(r),o.reject(r)}else fB.raiseEvent(),o.resolve(t.result);delete i[n]}function hq(e){let t=An(e);if(Xj(t)){const n=`importScripts("${t}");`;let i;try{i=new Blob([n],{type:"application/javascript"})}catch{const 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}let h1;function C0e(){return l(h1)||(h1=hq("Workers/cesiumWorkerBootstrapper.js")),h1}function pq(e){const t=new Worker(C0e());t.postMessage=A(t.webkitPostMessage,t.postMessage);const n={loaderConfig:{paths:{Workers:An("Workers")},baseUrl:An.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(n),t.onmessage=function(i){fq(e,i.data)},t}function T0e(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!gn.supportsWebAssembly()){if(!l(t.fallbackModulePath))throw new Ie(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=An(t.fallbackModulePath),Promise.resolve(n)}return n.modulePath=An(t.modulePath),n.wasmBinaryFile=An(t.wasmBinaryFile),Me.fetchArrayBuffer({url:n.wasmBinaryFile}).then(function(i){return n.wasmBinary=i,n})}function Vi(e,t){const n=new Rs(e);this._workerPath=n.scheme().length!==0&&n.fragment().length===0?e:Vi._workerModulePrefix+e,this._maximumActiveTasks=A(t,Number.POSITIVE_INFINITY),this._activeTasks=0,this._deferreds={},this._nextID=0}const E0e=[];Vi.prototype.scheduleTask=function(e,t){if(l(this._worker)||(this._worker=pq(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;const n=this;return Promise.resolve(dq()).then(function(i){l(t)?i||(t.length=0):t=E0e;const o=n._nextID++,r=Xp();return n._deferreds[o]=r,n._worker.postMessage({id:o,parameters:e,canTransferArrayBuffer:i},t),r.promise})};Vi.prototype.initWebAssemblyModule=function(e){l(this._worker)||(this._worker=pq(this));const t=Xp(),n=this,i=this._worker;return T0e(this,e).then(function(o){return Promise.resolve(dq()).then(function(r){let s;const a=o.wasmBinary;l(a)&&r&&(s=[a]),i.onmessage=function(c){i.onmessage=function(u){fq(n,u.data)},t.resolve(c.data)},i.postMessage({webAssemblyConfig:o},s)})}),t.promise};Vi.prototype.isDestroyed=function(){return!1};Vi.prototype.destroy=function(){return l(this._worker)&&this._worker.terminate(),He(this)};Vi.taskCompletedEvent=fB;Vi._defaultWorkerModulePrefix="Workers/";Vi._workerModulePrefix=Vi._defaultWorkerModulePrefix;Vi._canTransferArrayBuffer=void 0;function pf(){}pf._transcodeTaskProcessor=new Vi("transcodeKTX2",Number.POSITIVE_INFINITY);pf._readyPromise=void 0;function x0e(){const e=pf._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(){return pf._transcodeTaskProcessor});pf._readyPromise=e}pf.transcode=function(e,t){return T.defined("supportedTargetFormats",t),l(pf._readyPromise)||x0e(),pf._readyPromise.then(function(n){let i;if(e instanceof ArrayBuffer){const 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){const i=n.length,o=Object.keys(n[0]),r=o.length;let s;for(s=0;s<i;s++){const a=n[s];for(let c=0;c<r;c++){const u=a[o[c]];a[o[c]]=new u0(u.internalFormat,u.datatype,u.width,u.height,u.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})};let mq;K_.setKTX2SupportedFormats=function(e,t,n,i,o,r){mq={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function K_(e){T.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=Me.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return pf.transcode(n,mq)})}function Zd(e,t,n,i,o,r,s,a,c,u,d){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=u,this._initialized=d}Object.defineProperties(Zd.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});Zd.prototype.copyFrom=function(e){T.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(T.defined("options.source",e.source),T.typeOf.number.greaterThanOrEquals("xOffset",t,0),T.typeOf.number.greaterThanOrEquals("yOffset",n,0),t+e.source.width>this._size)throw new x("xOffset + options.source.width must be less than or equal to width.");if(n+e.source.height>this._size)throw new x("yOffset + options.source.height must be less than or equal to height.");const i=e.source,o=this._context._gl,r=this._textureTarget,s=this._targetFace;o.activeTexture(o.TEXTURE0),o.bindTexture(r,this._texture);const a=i.width,c=i.height;let u=i.arrayBufferView;const d=this._size,h=this._pixelFormat,m=this._internalFormat,g=this._pixelDatatype,p=this._preMultiplyAlpha,y=this._flipY,b=A(e.skipColorSpaceConversion,!1);let C=4;l(u)&&(C=rt.alignmentInBytes(h,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,C),b?o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.NONE):o.pixelStorei(o.UNPACK_COLORSPACE_CONVERSION_WEBGL,o.BROWSER_DEFAULT_WEBGL);let E=!1;if(!this._initialized){if(t===0&&n===0&&a===d&&c===d)l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),y&&(u=rt.flipY(u,h,g,d,d)),o.texImage2D(s,0,m,d,d,0,h,Qe.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,y),o.texImage2D(s,0,m,h,Qe.toWebGLConstant(g,this._context),i)),E=!0;else{o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1);const w=rt.createTypedArray(h,g,d,d);o.texImage2D(s,0,m,d,d,0,h,Qe.toWebGLConstant(g,this._context),w)}this._initialized=!0}E||(l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),y&&(u=rt.flipY(u,h,g,a,c)),o.texSubImage2D(s,0,t,n,a,c,h,Qe.toWebGLConstant(g,this._context),u)):(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,p),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,y),o.texSubImage2D(s,0,t,n,h,Qe.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};Zd.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=A(e,0),t=A(t,0),n=A(n,0),i=A(i,0),o=A(o,this._size),r=A(r,this._size),T.typeOf.number.greaterThanOrEquals("xOffset",e,0),T.typeOf.number.greaterThanOrEquals("yOffset",t,0),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),e+o>this._size)throw new x("xOffset + source.width must be less than or equal to width.");if(t+r>this._size)throw new x("yOffset + source.height must be less than or equal to height.");if(this._pixelDatatype===Qe.FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Qe.HALF_FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");const 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};const Bw={DONT_CARE:ae.DONT_CARE,FASTEST:ae.FASTEST,NICEST:ae.NICEST,validate:function(e){return e===Bw.DONT_CARE||e===Bw.FASTEST||e===Bw.NICEST}},d0=Object.freeze(Bw),Rw={NEAREST:ae.NEAREST,LINEAR:ae.LINEAR};Rw.validate=function(e){return e===Rw.NEAREST||e===Rw.LINEAR};const Kr=Object.freeze(Rw),Uh={NEAREST:ae.NEAREST,LINEAR:ae.LINEAR,NEAREST_MIPMAP_NEAREST:ae.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:ae.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:ae.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:ae.LINEAR_MIPMAP_LINEAR};Uh.validate=function(e){return e===Uh.NEAREST||e===Uh.LINEAR||e===Uh.NEAREST_MIPMAP_NEAREST||e===Uh.LINEAR_MIPMAP_NEAREST||e===Uh.NEAREST_MIPMAP_LINEAR||e===Uh.LINEAR_MIPMAP_LINEAR};const In=Object.freeze(Uh),Nw={CLAMP_TO_EDGE:ae.CLAMP_TO_EDGE,REPEAT:ae.REPEAT,MIRRORED_REPEAT:ae.MIRRORED_REPEAT,validate:function(e){return e===Nw.CLAMP_TO_EDGE||e===Nw.REPEAT||e===Nw.MIRRORED_REPEAT}},Fi=Object.freeze(Nw);function ii(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.wrapS,Fi.CLAMP_TO_EDGE),n=A(e.wrapT,Fi.CLAMP_TO_EDGE),i=A(e.minificationFilter,In.LINEAR),o=A(e.magnificationFilter,Kr.LINEAR),r=l(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!Fi.validate(t))throw new x("Invalid sampler.wrapS.");if(!Fi.validate(n))throw new x("Invalid sampler.wrapT.");if(!In.validate(i))throw new x("Invalid sampler.minificationFilter.");if(!Kr.validate(o))throw new x("Invalid sampler.magnificationFilter.");T.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(ii.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}}});ii.equals=function(e,t){return e===t||l(e)&&l(t)&&e._wrapS===t._wrapS&&e._wrapT===t._wrapT&&e._minificationFilter===t._minificationFilter&&e._magnificationFilter===t._magnificationFilter&&e._maximumAnisotropy===t._maximumAnisotropy};ii.NEAREST=Object.freeze(new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:In.NEAREST,magnificationFilter:Kr.NEAREST}));function bu(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context);const t=e.context,n=e.source;let i,o;if(l(n)){const E=[n.positiveX,n.negativeX,n.positiveY,n.negativeY,n.positiveZ,n.negativeZ];if(!E[0]||!E[1]||!E[2]||!E[3]||!E[4]||!E[5])throw new x("options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.");i=E[0].width,o=E[0].height;for(let w=1;w<6;++w)if(Number(E[w].width)!==i||Number(E[w].height)!==o)throw new x("Each face in options.source must have the same width and height.")}else i=e.width,o=e.height;const r=i,s=A(e.pixelDatatype,Qe.UNSIGNED_BYTE),a=A(e.pixelFormat,rt.RGBA),c=rt.toInternalFormat(a,s,t);if(!l(i)||!l(o))throw new x("options requires a source field to create an initialized cube map or width and height fields to create a blank cube map.");if(i!==o)throw new x("Width must equal height.");if(r<=0)throw new x("Width and height must be greater than zero.");if(r>It.maximumCubeMapSize)throw new x(`Width and height must be less than or equal to the maximum cube map size (${It.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!rt.validate(a))throw new x("Invalid options.pixelFormat.");if(rt.isDepthFormat(a))throw new x("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!Qe.validate(s))throw new x("Invalid options.pixelDatatype.");if(s===Qe.FLOAT&&!t.floatingPointTexture)throw new x("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===Qe.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new x("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension.");const u=rt.textureSizeInBytes(a,s,r,r)*6,d=e.preMultiplyAlpha||a===rt.RGB||a===rt.LUMINANCE,h=A(e.flipY,!0),m=A(e.skipColorSpaceConversion,!1),g=t._gl,p=g.TEXTURE_CUBE_MAP,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);function b(E,w,S,P,L){let z=w.arrayBufferView;l(z)||(z=w.bufferView);let R=4;l(z)&&(R=rt.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,R),L?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),l(z)?(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1),P&&(z=rt.flipY(z,a,s,r,r)),g.texImage2D(E,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),z)):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,P),g.texImage2D(E,0,c,a,Qe.toWebGLConstant(s,t),w))}l(n)?(b(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,d,h,m),b(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,d,h,m),b(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,d,h,m),b(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,d,h,m),b(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,d,h,m),b(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,d,h,m)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,r,r,0,a,Qe.toWebGLConstant(s,t),null)),g.bindTexture(p,null),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=y,this._pixelFormat=a,this._pixelDatatype=s,this._size=r,this._hasMipmap=!1,this._sizeInBytes=u,this._preMultiplyAlpha=d,this._flipY=h,this._sampler=void 0;const C=l(n);this._positiveX=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_X,c,a,s,r,d,h,C),this._negativeX=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_X,c,a,s,r,d,h,C),this._positiveY=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Y,c,a,s,r,d,h,C),this._negativeY=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,c,a,s,r,d,h,C),this._positiveZ=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Z,c,a,s,r,d,h,C),this._negativeZ=new Zd(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,c,a,s,r,d,h,C),this.sampler=l(e.sampler)?e.sampler:new ii}Object.defineProperties(bu.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;const i=t===In.NEAREST_MIPMAP_NEAREST||t===In.NEAREST_MIPMAP_LINEAR||t===In.LINEAR_MIPMAP_NEAREST||t===In.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===Qe.FLOAT&&!o.textureFloatLinear||r===Qe.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?In.NEAREST_MIPMAP_NEAREST:In.NEAREST,n=Kr.NEAREST);const 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),l(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}}});bu.prototype.generateMipmap=function(e){if(e=A(e,d0.DONT_CARE),this._size>1&&!M.isPowerOfTwo(this._size))throw new x("width and height must be a power of two to call generateMipmap().");if(!d0.validate(e))throw new x("hint is invalid.");this._hasMipmap=!0;const 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)};bu.prototype.isDestroyed=function(){return!1};bu.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=He(this._positiveX),this._negativeX=He(this._negativeX),this._positiveY=He(this._positiveY),this._negativeY=He(this._negativeY),this._positiveZ=He(this._positiveZ),this._negativeZ=He(this._negativeZ),He(this)};function J_(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function w0e(e,t){const n=/#define OUTPUT_DECLARATION/,i=e.split(`
|
||
`);if(/#version 300 es/g.test(e))return e;let o=-1,r,s;for(r=0;r<i.length;++r)if(s=i[r],n.test(s)){o=r;break}if(o===-1)throw new x("Could not find a #define OUTPUT_DECLARATION!");const a=[];for(r=0;r<10;r++){const y=`gl_FragData\\[${r}\\]`,b=`czm_out${r}`;new RegExp(y,"g").test(e)&&(EU(b,a),Vu(y,b,i),i.splice(o,0,`layout(location = ${r}) out vec4 ${b};`),o+=1)}const c="czm_fragColor";v0e("gl_FragColor",i)&&(EU(c,a),Vu("gl_FragColor",c,i),i.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);const u=I0e(a,i),d={};for(r=0;r<i.length;r++){s=i[r];for(const y in u)u.hasOwnProperty(y)&&new RegExp(`(layout)[^]+(out)[^]+(${y})[^]+`,"g").test(s)&&(d[s]=y)}for(const y in d)if(d.hasOwnProperty(y)){const b=d[y];let C=i.indexOf(y);const E=u[b],w=E.length;for(let S=0;S<w;S++)i.splice(C,0,E[S]);C+=w+1;for(let S=w-1;S>=0;S--)i.splice(C,0,`#endif //${E[S]}`)}const h="WEBGL_2",m=`#define ${h}`,g="#version 300 es";let p=!1;for(r=0;r<i.length;r++)if(/#version/.test(i[r])){i[r]=g,p=!0;break}return p||i.splice(0,0,g),i.splice(1,0,m),p1("EXT_draw_buffers",h,i),p1("EXT_frag_depth",h,i),p1("OES_standard_derivatives",h,i),Vu("texture2D","texture",i),Vu("texture3D","texture",i),Vu("textureCube","texture",i),Vu("gl_FragDepthEXT","gl_FragDepth",i),t?Vu("varying","in",i):(Vu("attribute","in",i),Vu("varying","out",i)),D0e(i)}function Vu(e,t,n){const i=`(^|[^\\w])(${e})($|[^\\w])`,o=new RegExp(i,"g"),r=n.length;for(let s=0;s<r;++s){const a=n[s];n[s]=a.replace(o,`$1${t}$3`)}}function S0e(e,t,n){const i=n.length;for(let o=0;o<i;++o){const r=n[o];n[o]=r.replace(e,t)}}function v0e(e,t){const n=`(^|[^\\w])(${e})($|[^\\w])`,i=new RegExp(n,"g"),o=t.length;for(let r=0;r<o;++r){const s=t[r];if(i.test(s))return!0}return!1}function D0e(e){let t="";const n=e.length;for(let i=0;i<n;++i)t+=`${e[i]}
|
||
`;return t}function EU(e,t){t.indexOf(e)===-1&&t.push(e)}function I0e(e,t){const n={},i=e.length,o=[];for(let r=0;r<t.length;++r){const s=t[r],a=/(#ifdef|#if)/g.test(s),c=/#else/g.test(s),u=/#endif/g.test(s);if(a)o.push(s);else if(c){let h=o[o.length-1].replace("ifdef","ifndef");/if/g.test(h)&&(h=h.replace(/(#if\s+)(\S*)([^]*)/,"$1!($2)$3")),o.pop(),o.push(h)}else if(u)o.pop();else if(!/layout/g.test(s))for(let d=0;d<i;++d){const h=e[d];s.indexOf(h)!==-1&&(l(n[h])?n[h]=n[h].filter(function(m){return o.indexOf(m)>=0}):n[h]=o.slice())}}return n}function p1(e,t,n){const i=`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;S0e(new RegExp(i,"g"),"",n),Vu(`GL_${e}`,t,n)}const P0e=`/**
|
||
* 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;
|
||
`,O0e=`/**
|
||
* 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);
|
||
`,L0e=`/**
|
||
* 0.1
|
||
*
|
||
* @name czm_epsilon1
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon1 = 0.1;
|
||
`,B0e=`/**
|
||
* 0.01
|
||
*
|
||
* @name czm_epsilon2
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon2 = 0.01;
|
||
`,R0e=`/**
|
||
* 0.001
|
||
*
|
||
* @name czm_epsilon3
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon3 = 0.001;
|
||
`,N0e=`/**
|
||
* 0.0001
|
||
*
|
||
* @name czm_epsilon4
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon4 = 0.0001;
|
||
`,M0e=`/**
|
||
* 0.00001
|
||
*
|
||
* @name czm_epsilon5
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon5 = 0.00001;
|
||
`,F0e=`/**
|
||
* 0.000001
|
||
*
|
||
* @name czm_epsilon6
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon6 = 0.000001;
|
||
`,z0e=`/**
|
||
* 0.0000001
|
||
*
|
||
* @name czm_epsilon7
|
||
* @glslConstant
|
||
*/
|
||
const float czm_epsilon7 = 0.0000001;
|
||
`,U0e=`/**
|
||
* 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?
|
||
`,H0e=`/**
|
||
* 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;
|
||
`,V0e=`/**
|
||
* 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;
|
||
`,k0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
|
||
*
|
||
* @name czm_passCesium3DTile
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCesium3DTile = 4.0;
|
||
`,G0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
|
||
*
|
||
* @name czm_passCesium3DTileClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCesium3DTileClassification = 5.0;
|
||
`,W0e=`/**
|
||
* 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;
|
||
`,j0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}
|
||
*
|
||
* @name czm_passClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passClassification = 7.0;
|
||
`,q0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#COMPUTE}
|
||
*
|
||
* @name czm_passCompute
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passCompute = 1.0;
|
||
`,$0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}
|
||
*
|
||
* @name czm_passEnvironment
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passEnvironment = 0.0;
|
||
`,Y0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#GLOBE}
|
||
*
|
||
* @name czm_passGlobe
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passGlobe = 2.0;
|
||
`,X0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#OPAQUE}
|
||
*
|
||
* @name czm_passOpaque
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passOpaque = 7.0;
|
||
`,K0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#OVERLAY}
|
||
*
|
||
* @name czm_passOverlay
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passOverlay = 10.0;
|
||
`,J0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}
|
||
*
|
||
* @name czm_passTerrainClassification
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passTerrainClassification = 3.0;
|
||
`,Q0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#TRANSLUCENT}
|
||
*
|
||
* @name czm_passTranslucent
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passTranslucent = 8.0;
|
||
`,Z0e=`/**
|
||
* The automatic GLSL constant for {@link Pass#VOXELS}
|
||
*
|
||
* @name czm_passVoxels
|
||
* @glslConstant
|
||
*
|
||
* @see czm_pass
|
||
*/
|
||
const float czm_passVoxels = 9.0;
|
||
`,eAe=`/**
|
||
* 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;
|
||
`,tAe=`/**
|
||
* 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;
|
||
`,nAe=`/**
|
||
* 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;
|
||
`,iAe=`/**
|
||
* 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;
|
||
`,oAe=`/**
|
||
* 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;
|
||
`,rAe=`/**
|
||
* 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;
|
||
`,sAe=`/**
|
||
* 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;
|
||
`,aAe=`/**
|
||
* 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;
|
||
`,cAe=`/**
|
||
* 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;
|
||
`,lAe=`/**
|
||
* 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;
|
||
`,uAe=`/**
|
||
* 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;
|
||
`,dAe=`/**
|
||
* 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;
|
||
`,fAe=`/**
|
||
* 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;
|
||
`,hAe=`/**
|
||
* 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;
|
||
`,pAe=`/**
|
||
* @name czm_depthRangeStruct
|
||
* @glslStruct
|
||
*/
|
||
struct czm_depthRangeStruct
|
||
{
|
||
float near;
|
||
float far;
|
||
};
|
||
`,mAe=`/**
|
||
* 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;
|
||
};
|
||
`,_Ae=`/**
|
||
* 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;
|
||
};
|
||
`,gAe=`/**
|
||
* 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;
|
||
};
|
||
`,yAe=`/**
|
||
* 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;
|
||
};
|
||
`,AAe=`/**
|
||
* 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;
|
||
};
|
||
`,bAe=`/**
|
||
* DOC_TBA
|
||
*
|
||
* @name czm_ray
|
||
* @glslStruct
|
||
*/
|
||
struct czm_ray
|
||
{
|
||
vec3 origin;
|
||
vec3 direction;
|
||
};
|
||
`,CAe=`/**
|
||
* 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);
|
||
`,TAe=`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;
|
||
};
|
||
`,EAe=`/**
|
||
* 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);
|
||
}
|
||
`,xAe=`/**
|
||
* 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;
|
||
}
|
||
`,wAe=`/**
|
||
* 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);
|
||
}
|
||
`,SAe=`/**
|
||
* 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);
|
||
}
|
||
`,vAe=`/**
|
||
* 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;
|
||
}
|
||
`,DAe=`/**
|
||
* 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;
|
||
}
|
||
`,IAe=`// 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;
|
||
}
|
||
`,PAe=`/**
|
||
* @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))));
|
||
}
|
||
`,OAe=`/**
|
||
* 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);
|
||
}
|
||
`,LAe=`/**
|
||
* 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);
|
||
}
|
||
`,BAe=`/**
|
||
* 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;
|
||
}
|
||
`,RAe=`/**
|
||
* 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);
|
||
}
|
||
`,NAe=`
|
||
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;
|
||
}
|
||
`,MAe=`
|
||
uniform vec4 shadowMap_cascadeDistances;
|
||
|
||
float czm_cascadeDistance(vec4 weights)
|
||
{
|
||
return dot(shadowMap_cascadeDistances, weights);
|
||
}
|
||
`,FAe=`
|
||
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;
|
||
}
|
||
`,zAe=`
|
||
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;
|
||
}
|
||
`,UAe=`/**
|
||
* 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);
|
||
}
|
||
`,HAe=`/**
|
||
* 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();
|
||
`,VAe=`/**
|
||
* @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);
|
||
}
|
||
}
|
||
`,kAe=`/**
|
||
* 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);
|
||
}
|
||
`,GAe=`/**
|
||
* 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;
|
||
}
|
||
`,WAe=`// emulated noperspective
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
varying 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
|
||
#ifdef 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;
|
||
}
|
||
`,jAe=`/**
|
||
* 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);
|
||
}
|
||
`,qAe=`/**
|
||
* 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);
|
||
}
|
||
`,$Ae=`/**
|
||
* 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);
|
||
}
|
||
`,YAe=`/**
|
||
* 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);
|
||
}
|
||
`,XAe=`/**
|
||
* 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;
|
||
}
|
||
`,KAe=`/**
|
||
* 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;
|
||
}
|
||
`,JAe=`/**
|
||
* 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;
|
||
}
|
||
`,QAe=`/**
|
||
* 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);
|
||
}
|
||
`,ZAe=`/**
|
||
* 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;
|
||
}
|
||
`,ebe=`/**
|
||
* 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);
|
||
}
|
||
`,tbe=`/**
|
||
* 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;
|
||
}
|
||
`,nbe=`/**
|
||
* 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);
|
||
}
|
||
`,ibe=`/**
|
||
* 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));
|
||
}
|
||
`,obe=`/**
|
||
* @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 = (texture2D(normalMap, uv0)) +
|
||
(texture2D(normalMap, uv1)) +
|
||
(texture2D(normalMap, uv2)) +
|
||
(texture2D(normalMap, uv3));
|
||
|
||
// average and scale to between -1 and 1
|
||
return ((noise / 4.0) - 0.5) * 2.0;
|
||
}
|
||
`,rbe=`/**
|
||
* 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;
|
||
}
|
||
`,sbe=`/**
|
||
* 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));
|
||
}
|
||
`,abe=`/**
|
||
* 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);
|
||
}
|
||
`,cbe=`/**
|
||
* 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);
|
||
}
|
||
`,lbe=`/**
|
||
* 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;
|
||
}
|
||
`,ube=`/**
|
||
* 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);
|
||
}
|
||
`,dbe=`/**
|
||
* 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);
|
||
}
|
||
`,fbe=`/**
|
||
* 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);
|
||
}
|
||
`,hbe=`/**
|
||
* 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);
|
||
}
|
||
`,pbe=`/**
|
||
* 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;
|
||
}
|
||
`,mbe=`/**
|
||
* 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;
|
||
}
|
||
`,_be=`/**
|
||
* 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);
|
||
}
|
||
`,gbe=` /**
|
||
* 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));
|
||
}
|
||
|
||
`,ybe=`/**
|
||
* 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čius' 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;
|
||
}
|
||
`,Abe=`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;
|
||
}
|
||
`,bbe=`/**
|
||
* 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;
|
||
}
|
||
`,Cbe=`/**
|
||
* 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;
|
||
}
|
||
`,Tbe=`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 = // ...
|
||
* gl_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);
|
||
}
|
||
`,Ebe=`/**
|
||
* 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);
|
||
}
|
||
`,xbe=`/**
|
||
* 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);
|
||
}
|
||
`,wbe=`/**
|
||
* 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;
|
||
}
|
||
}
|
||
}
|
||
`,Sbe=`/**
|
||
* 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;
|
||
}
|
||
`,vbe=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
|
||
{
|
||
return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);
|
||
}
|
||
`,Dbe=`/**
|
||
* 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;
|
||
}
|
||
`,Ibe=`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;
|
||
}
|
||
`,Pbe=`/**
|
||
* 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);
|
||
}
|
||
`,Obe=`/**
|
||
* 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 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;
|
||
vec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;
|
||
vec3 color3 = texture2D(projectedMap, coord + pixel).rgb;
|
||
vec3 color4 = texture2D(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 = texture2D(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);
|
||
}
|
||
`,Lbe=`/**
|
||
* 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);
|
||
}
|
||
`,Bbe=`
|
||
float czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)
|
||
{
|
||
return czm_unpackDepth(textureCube(shadowMap, d));
|
||
}
|
||
|
||
float czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)
|
||
{
|
||
#ifdef USE_SHADOW_DEPTH_TEXTURE
|
||
return texture2D(shadowMap, uv).r;
|
||
#else
|
||
return czm_unpackDepth(texture2D(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));
|
||
}
|
||
`,Rbe=`
|
||
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
|
||
`,Nbe=`/**
|
||
* 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));
|
||
}
|
||
`,Mbe=`/**
|
||
* 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);
|
||
}
|
||
`,Fbe=`/**
|
||
* 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);
|
||
}
|
||
`,zbe=`/**
|
||
* 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 * texture2D(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);
|
||
}
|
||
`,Ube=`/**
|
||
* 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;
|
||
}
|
||
`,Hbe=`/**
|
||
* 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
|
||
* attribute vec3 positionHigh;
|
||
* attribute 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);
|
||
}
|
||
`,Vbe=`/**
|
||
* @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);
|
||
}
|
||
`,kbe=`/**
|
||
* 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]);
|
||
}
|
||
`,Gbe=`/**
|
||
* 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čius' 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));
|
||
}
|
||
`,Wbe=`/**
|
||
* 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;
|
||
}
|
||
`,jbe=`/**
|
||
* 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)));
|
||
}
|
||
`,qbe=`/**
|
||
* 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;
|
||
}
|
||
`,$be=`#ifdef LOG_DEPTH
|
||
// 1.0 at the near plane, increasing linearly from there.
|
||
varying float v_depthFromNearPlusOne;
|
||
#ifdef SHADOW_MAP
|
||
varying 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
|
||
}
|
||
`,Ybe=`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);
|
||
}
|
||
`,Xbe=`// emulated noperspective
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
varying 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.
|
||
* <p>
|
||
* The shader must enable the GL_EXT_frag_depth extension.
|
||
* </p>
|
||
*
|
||
* @name czm_writeDepthClamp
|
||
* @glslFunction
|
||
*
|
||
* @example
|
||
* gl_FragColor = color;
|
||
* czm_writeDepthClamp();
|
||
*
|
||
* @see czm_depthClamp
|
||
*/
|
||
void czm_writeDepthClamp()
|
||
{
|
||
#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)
|
||
gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
|
||
#endif
|
||
}
|
||
`,Kbe=`#ifdef LOG_DEPTH
|
||
varying 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(GL_EXT_frag_depth) && defined(LOG_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 we can't compute derivatives, just leave out the factor I guess?
|
||
#ifdef GL_OES_standard_derivatives
|
||
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_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;
|
||
|
||
#ifdef POLYGON_OFFSET
|
||
// Apply the units after the log depth.
|
||
gl_FragDepthEXT += 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
|
||
}
|
||
`,Jbe=`/**
|
||
* 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;
|
||
}
|
||
`,m1={czm_degreesPerRadian:P0e,czm_depthRange:O0e,czm_epsilon1:L0e,czm_epsilon2:B0e,czm_epsilon3:R0e,czm_epsilon4:N0e,czm_epsilon5:M0e,czm_epsilon6:F0e,czm_epsilon7:z0e,czm_infinity:U0e,czm_oneOverPi:H0e,czm_oneOverTwoPi:V0e,czm_passCesium3DTile:k0e,czm_passCesium3DTileClassification:G0e,czm_passCesium3DTileClassificationIgnoreShow:W0e,czm_passClassification:j0e,czm_passCompute:q0e,czm_passEnvironment:$0e,czm_passGlobe:Y0e,czm_passOpaque:X0e,czm_passOverlay:K0e,czm_passTerrainClassification:J0e,czm_passTranslucent:Q0e,czm_passVoxels:Z0e,czm_pi:eAe,czm_piOverFour:tAe,czm_piOverSix:nAe,czm_piOverThree:iAe,czm_piOverTwo:oAe,czm_radiansPerDegree:rAe,czm_sceneMode2D:sAe,czm_sceneMode3D:aAe,czm_sceneModeColumbusView:cAe,czm_sceneModeMorphing:lAe,czm_solarRadius:uAe,czm_threePiOver2:dAe,czm_twoPi:fAe,czm_webMercatorMaxLatitude:hAe,czm_depthRangeStruct:pAe,czm_material:mAe,czm_materialInput:_Ae,czm_modelMaterial:gAe,czm_modelVertexOutput:yAe,czm_pbrParameters:AAe,czm_ray:bAe,czm_raySegment:CAe,czm_shadowParameters:TAe,czm_HSBToRGB:EAe,czm_HSLToRGB:xAe,czm_RGBToHSB:wAe,czm_RGBToHSL:SAe,czm_RGBToXYZ:vAe,czm_XYZToRGB:DAe,czm_acesTonemapping:IAe,czm_alphaWeight:PAe,czm_antialias:OAe,czm_approximateSphericalCoordinates:LAe,czm_backFacing:BAe,czm_branchFreeTernary:RAe,czm_cascadeColor:NAe,czm_cascadeDistance:MAe,czm_cascadeMatrix:FAe,czm_cascadeWeights:zAe,czm_columbusViewMorph:UAe,czm_computePosition:HAe,czm_cosineAndSine:VAe,czm_decompressTextureCoordinates:kAe,czm_defaultPbrMaterial:GAe,czm_depthClamp:WAe,czm_eastNorthUpToEyeCoordinates:jAe,czm_ellipsoidContainsPoint:qAe,czm_ellipsoidWgs84TextureCoordinates:$Ae,czm_equalsEpsilon:YAe,czm_eyeOffset:XAe,czm_eyeToWindowCoordinates:KAe,czm_fastApproximateAtan:JAe,czm_fog:QAe,czm_gammaCorrect:ZAe,czm_geodeticSurfaceNormal:ebe,czm_getDefaultMaterial:tbe,czm_getLambertDiffuse:nbe,czm_getSpecular:ibe,czm_getWaterNoise:obe,czm_hue:rbe,czm_inverseGamma:sbe,czm_isEmpty:abe,czm_isFull:cbe,czm_latitudeToWebMercatorFraction:lbe,czm_lineDistance:ube,czm_linearToSrgb:dbe,czm_luminance:fbe,czm_metersPerPixel:hbe,czm_modelToWindowCoordinates:pbe,czm_multiplyWithColorBalance:mbe,czm_nearFarScalar:_be,czm_octDecode:gbe,czm_packDepth:ybe,czm_pbrLighting:Abe,czm_pbrMetallicRoughnessMaterial:bbe,czm_pbrSpecularGlossinessMaterial:Cbe,czm_phong:Tbe,czm_planeDistance:Ebe,czm_pointAlongRay:xbe,czm_rayEllipsoidIntersectionInterval:wbe,czm_raySphereIntersectionInterval:Sbe,czm_readDepth:vbe,czm_readNonPerspective:Dbe,czm_reverseLogDepth:Ibe,czm_round:Pbe,czm_sampleOctahedralProjection:Obe,czm_saturation:Lbe,czm_shadowDepthCompare:Bbe,czm_shadowVisibility:Rbe,czm_signNotZero:Nbe,czm_sphericalHarmonics:Mbe,czm_srgbToLinear:Fbe,czm_tangentToEyeSpaceMatrix:zbe,czm_transformPlane:Ube,czm_translateRelativeToEye:Hbe,czm_translucentPhong:Vbe,czm_transpose:kbe,czm_unpackDepth:Gbe,czm_unpackFloat:Wbe,czm_unpackUint:jbe,czm_valueTransform:qbe,czm_vertexLogDepth:$be,czm_windowToEyeCoordinates:Ybe,czm_writeDepthClamp:Xbe,czm_writeLogDepth:Kbe,czm_writeNonPerspective:Jbe};function _q(e){return e=e.replace(/\/\/.*/g,""),e.replace(/\/\*\*[\s\S]*?\*\//gm,function(t){const n=t.match(/\n/gm).length;let i="";for(let o=0;o<n;++o)i+=`
|
||
`;return i})}function gq(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return l(i)||(t=_q(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function yq(e,t){if(e.evaluated)return;e.evaluated=!0;let n=e.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);l(n)&&n!==null&&(n=n.filter(function(i,o){return n.indexOf(i)===o}),n.forEach(function(i){if(i!==e.name&&We._czmBuiltinsAndUniforms.hasOwnProperty(i)){const o=gq(i,We._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),yq(o,t)}}))}function Qbe(e){const t=[],n=[];for(;e.length>0;){const o=e.pop();n.push(o),o.requiredBy.length===0&&t.push(o)}for(;t.length>0;){const o=t.shift();e.push(o);for(let r=0;r<o.dependsOn.length;++r){const s=o.dependsOn[r],a=s.requiredBy.indexOf(o);s.requiredBy.splice(a,1),s.requiredBy.length===0&&t.push(s)}}const i=[];for(let o=0;o<n.length;++o)n[o].requiredBy.length!==0&&i.push(n[o]);if(i.length!==0){let o=`A circular dependency was found in the following built-in functions/structs/constants:
|
||
`;for(let r=0;r<i.length;++r)o=`${o+i[r].name}
|
||
`;throw new x(o)}}function Zbe(e){const t=[],n=gq("main",e,t);yq(n,t),Qbe(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
|
||
`;return i.replace(n.glslSource,"")}function Aq(e,t,n){let i,o,r="";const s=e.sources;if(l(s))for(i=0,o=s.length;i<o;++i)r+=`
|
||
#line 0
|
||
${s[i]}`;r=_q(r);let a;r=r.replace(/#version\s+(.*?)\n/gm,function(g,p){if(l(a)&&a!==p)throw new x(`inconsistent versions found: ${a} and ${p}`);return a=p,`
|
||
`});const c=[];r=r.replace(/#extension.*\n/gm,function(g){return c.push(g),`
|
||
`}),r=r.replace(/precision\s(lowp|mediump|highp)\s(float|int);/,"");const u=e.pickColorQualifier;l(u)&&(r=We.createPickFragmentShaderSource(r,u));let d="";l(a)&&(d=`#version ${a}
|
||
`);const h=c.length;for(i=0;i<h;i++)d+=c[i];t&&(d+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
|
||
precision highp float;
|
||
precision highp int;
|
||
#else
|
||
precision mediump float;
|
||
precision mediump int;
|
||
#define highp mediump
|
||
#endif
|
||
|
||
`);const m=e.defines;if(l(m))for(i=0,o=m.length;i<o;++i){const g=m[i];g.length!==0&&(d+=`#define ${g}
|
||
`)}return n.webgl2&&(d+=`#define OUTPUT_DECLARATION
|
||
|
||
`),n.textureFloatLinear&&(d+=`#define OES_texture_float_linear
|
||
|
||
`),n.floatingPointTexture&&(d+=`#define OES_texture_float
|
||
|
||
`),e.includeBuiltIns&&(d+=Zbe(r)),d+=`
|
||
#line 0
|
||
`,d+=r,n.webgl2&&(d=w0e(d,t)),d}function We(e){e=A(e,A.EMPTY_OBJECT);const t=e.pickColorQualifier;if(l(t)&&t!=="uniform"&&t!=="varying")throw new x("options.pickColorQualifier must be 'uniform' or 'varying'.");this.defines=l(e.defines)?e.defines.slice(0):[],this.sources=l(e.sources)?e.sources.slice(0):[],this.pickColorQualifier=t,this.includeBuiltIns=A(e.includeBuiltIns,!0)}We.prototype.clone=function(){return new We({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};We.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};We.prototype.getCacheKey=function(){const t=this.defines.slice().sort().join(","),n=this.pickColorQualifier,i=this.includeBuiltIns,o=this.sources.join(`
|
||
`);return`${t}:${n}:${i}:${o}`};We.prototype.createCombinedVertexShader=function(e){return Aq(this,!1,e)};We.prototype.createCombinedFragmentShader=function(e){return Aq(this,!0,e)};We._czmBuiltinsAndUniforms={};for(const e in m1)m1.hasOwnProperty(e)&&(We._czmBuiltinsAndUniforms[e]=m1[e]);for(const e in Dw)if(Dw.hasOwnProperty(e)){const t=Dw[e];typeof t.getDeclaration=="function"&&(We._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}We.createPickVertexShaderSource=function(e){return`${We.replaceMain(e,"czm_old_main")}
|
||
attribute vec4 pickColor;
|
||
varying vec4 czm_pickColor;
|
||
void main()
|
||
{
|
||
czm_old_main();
|
||
czm_pickColor = pickColor;
|
||
}`};We.createPickFragmentShaderSource=function(e,t){const n=We.replaceMain(e,"czm_old_main"),i=`${t} vec4 czm_pickColor;
|
||
void main()
|
||
{
|
||
czm_old_main();
|
||
if (gl_FragColor.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = czm_pickColor;
|
||
}`;return`${n}
|
||
${i}`};function eCe(e,t){const n=e.defines,i=n.length;for(let o=0;o<i;++o)if(n[o]===t)return!0;return!1}function bq(e,t){const n=e.sources,i=n.length;for(let o=0;o<i;++o)if(n[o].indexOf(t)!==-1)return!0;return!1}function Cq(e,t){const n=t.length;for(let i=0;i<n;++i){const o=t[i];if(bq(e,o))return o}}const tCe=["v_normalEC","v_normal"];We.findNormalVarying=function(e){return bq(e,"#ifdef HAS_NORMALS")?eCe(e,"HAS_NORMALS")?"v_normalEC":void 0:Cq(e,tCe)};const nCe=["v_positionEC"];We.findPositionVarying=function(e){return Cq(e,nCe)};function Cu(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(Cu.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});Cu.prototype.replaceShaderProgram=function(e){return l(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function iCe(e){const t=Object.keys(e).sort();return JSON.stringify(e,t)}Cu.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;typeof t=="string"&&(t=new We({sources:[t]})),typeof n=="string"&&(n=new We({sources:[n]}));const o=t.getCacheKey(),r=n.getCacheKey(),s=l(i)?iCe(i):"",a=`${o}:${r}:${s}`;let c;if(l(this._shaders[a]))c=this._shaders[a],delete this._shadersToRelease[a];else{const u=this._context,d=t.createCombinedVertexShader(u),h=n.createCombinedFragmentShader(u),m=new Cn({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:t,vertexShaderText:d,fragmentShaderSource:n,fragmentShaderText:h,attributeLocations:i});c={cache:this,shaderProgram:m,keyword:a,derivedKeywords:[],count:0},m._cachedShader=c,this._shaders[a]=c,++this._numberOfShaders}return++c.count,c.shaderProgram};Cu.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(l(r)){fM(this,r);const s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};Cu.prototype.getDerivedShaderProgram=function(e,t){const n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(l(o))return o.shaderProgram};Cu.prototype.createDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword;let r=n.vertexShaderSource,s=n.fragmentShaderSource;const a=n.attributeLocations;typeof r=="string"&&(r=new We({sources:[r]})),typeof s=="string"&&(s=new We({sources:[s]}));const c=this._context,u=r.createCombinedVertexShader(c),d=s.createCombinedFragmentShader(c),h=new Cn({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:d,attributeLocations:a}),m={cache:this,shaderProgram:h,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),h._cachedShader=m,this._shaders[o]=m,h};function fM(e,t){const n=t.derivedKeywords,i=n.length;for(let o=0;o<i;++o){const r=n[o]+t.keyword,s=e._shaders[r];fM(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}Cu.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];fM(this,n),--this._numberOfShaders}this._shadersToRelease={}};Cu.prototype.releaseShaderProgram=function(e){if(l(e)){const t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};Cu.prototype.isDestroyed=function(){return!1};Cu.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return He(this)};function Wt(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context);const t=e.context;let n=e.width,i=e.height;const o=e.source;l(o)&&(l(n)||(n=A(o.videoWidth,o.width)),l(i)||(i=A(o.videoHeight,o.height)));const r=A(e.pixelFormat,rt.RGBA),s=A(e.pixelDatatype,Qe.UNSIGNED_BYTE),a=rt.toInternalFormat(r,s,t),c=rt.isCompressedFormat(a);if(!l(n)||!l(i))throw new x("options requires a source field to create an initialized texture or width and height fields to create a blank texture.");if(T.typeOf.number.greaterThan("width",n,0),n>It.maximumTextureSize)throw new x(`Width must be less than or equal to the maximum texture size (${It.maximumTextureSize}). Check maximumTextureSize.`);if(T.typeOf.number.greaterThan("height",i,0),i>It.maximumTextureSize)throw new x(`Height must be less than or equal to the maximum texture size (${It.maximumTextureSize}). Check maximumTextureSize.`);if(!rt.validate(r))throw new x("Invalid options.pixelFormat.");if(!c&&!Qe.validate(s))throw new x("Invalid options.pixelDatatype.");if(r===rt.DEPTH_COMPONENT&&s!==Qe.UNSIGNED_SHORT&&s!==Qe.UNSIGNED_INT)throw new x("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===rt.DEPTH_STENCIL&&s!==Qe.UNSIGNED_INT_24_8)throw new x("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===Qe.FLOAT&&!t.floatingPointTexture)throw new x("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture.");if(s===Qe.HALF_FLOAT&&!t.halfFloatingPointTexture)throw new x("When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture.");if(rt.isDepthFormat(r)){if(l(o))throw new x("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.");if(!t.depthTexture)throw new x("When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture.")}if(c){if(!l(o)||!l(o.arrayBufferView))throw new x("When options.pixelFormat is compressed, options.source.arrayBufferView must be defined.");if(rt.isDXTFormat(a)&&!t.s3tc)throw new x("When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc.");if(rt.isPVRTCFormat(a)&&!t.pvrtc)throw new x("When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc.");if(rt.isASTCFormat(a)&&!t.astc)throw new x("When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc.");if(rt.isETC2Format(a)&&!t.etc)throw new x("When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc.");if(rt.isETC1Format(a)&&!t.etc1)throw new x("When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1.");if(rt.isBC7Format(a)&&!t.bc7)throw new x("When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7.");if(rt.compressedTextureSizeInBytes(a,n,i)!==o.arrayBufferView.byteLength)throw new x("The byte length of the array buffer is invalid for the compressed texture with the given width and height.")}const u=e.preMultiplyAlpha||r===rt.RGB||r===rt.LUMINANCE,d=A(e.flipY,!0),h=A(e.skipColorSpaceConversion,!1);let m=!0;const g=t._gl,p=g.TEXTURE_2D,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);let b=4;if(l(o)&&l(o.arrayBufferView)&&!c&&(b=rt.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,b),h?g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.NONE):g.pixelStorei(g.UNPACK_COLORSPACE_CONVERSION_WEBGL,g.BROWSER_DEFAULT_WEBGL),l(o))if(l(o.arrayBufferView)){g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,!1);let E=o.arrayBufferView,w,S,P;if(c){if(g.compressedTexImage2D(p,0,a,n,i,0,E),l(o.mipLevels))for(S=n,P=i,w=0;w<o.mipLevels.length;++w)S=Math.floor(S/2)|0,S<1&&(S=1),P=Math.floor(P/2)|0,P<1&&(P=1),g.compressedTexImage2D(p,w+1,a,S,P,0,o.mipLevels[w])}else if(d&&(E=rt.flipY(E,r,s,n,i)),g.texImage2D(p,0,a,n,i,0,r,Qe.toWebGLConstant(s,t),E),l(o.mipLevels))for(S=n,P=i,w=0;w<o.mipLevels.length;++w)S=Math.floor(S/2)|0,S<1&&(S=1),P=Math.floor(P/2)|0,P<1&&(P=1),g.texImage2D(p,w+1,a,S,P,0,r,Qe.toWebGLConstant(s,t),o.mipLevels[w])}else l(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(p,0,a,o.xOffset,o.yOffset,n,i,0),o.framebuffer!==t.defaultFramebuffer&&o.framebuffer._unBind()):(g.pixelStorei(g.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u),g.pixelStorei(g.UNPACK_FLIP_Y_WEBGL,d),g.texImage2D(p,0,a,r,Qe.toWebGLConstant(s,t),o));else g.texImage2D(p,0,a,n,i,0,r,Qe.toWebGLConstant(s,t),null),m=!1;g.bindTexture(p,null);let C;c?C=rt.compressedTextureSizeInBytes(r,n,i):C=rt.textureSizeInBytes(r,s,n,i),this._id=Ms(),this._context=t,this._textureFilterAnisotropic=t._textureFilterAnisotropic,this._textureTarget=p,this._texture=y,this._internalFormat=a,this._pixelFormat=r,this._pixelDatatype=s,this._width=n,this._height=i,this._dimensions=new j(n,i),this._hasMipmap=!1,this._sizeInBytes=C,this._preMultiplyAlpha=u,this._flipY=d,this._initialized=m,this._sampler=void 0,this.sampler=l(e.sampler)?e.sampler:new ii}Wt.create=function(e){return new Wt(e)};Wt.fromFramebuffer=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context);const t=e.context,n=t._gl,i=A(e.pixelFormat,rt.RGB),o=A(e.framebufferXOffset,0),r=A(e.framebufferYOffset,0),s=A(e.width,n.drawingBufferWidth),a=A(e.height,n.drawingBufferHeight),c=e.framebuffer;if(!rt.validate(i))throw new x("Invalid pixelFormat.");if(rt.isDepthFormat(i)||rt.isCompressedFormat(i))throw new x("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(T.defined("options.context",e.context),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",r,0),o+s>n.drawingBufferWidth)throw new x("framebufferXOffset + width must be less than or equal to drawingBufferWidth");if(r+a>n.drawingBufferHeight)throw new x("framebufferYOffset + height must be less than or equal to drawingBufferHeight.");return new Wt({context:t,width:s,height:a,pixelFormat:i,source:{framebuffer:l(c)?c:t.defaultFramebuffer,xOffset:o,yOffset:r,width:s,height:a}})};Object.defineProperties(Wt.prototype,{id:{get:function(){return this._id}},sampler:{get:function(){return this._sampler},set:function(e){let t=e.minificationFilter,n=e.magnificationFilter;const i=this._context,o=this._pixelFormat,r=this._pixelDatatype,s=t===In.NEAREST_MIPMAP_NEAREST||t===In.NEAREST_MIPMAP_LINEAR||t===In.LINEAR_MIPMAP_NEAREST||t===In.LINEAR_MIPMAP_LINEAR;(r===Qe.FLOAT&&!i.textureFloatLinear||r===Qe.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?In.NEAREST_MIPMAP_NEAREST:In.NEAREST,n=Kr.NEAREST),i.webgl2&&rt.isDepthFormat(o)&&(t=In.NEAREST,n=Kr.NEAREST);const 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),l(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}}});Wt.prototype.copyFrom=function(e){T.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(T.defined("options.source",e.source),rt.isDepthFormat(this._pixelFormat))throw new x("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(rt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call copyFrom with a compressed texture pixel format.");T.typeOf.number.greaterThanOrEquals("xOffset",t,0),T.typeOf.number.greaterThanOrEquals("yOffset",n,0),T.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),T.typeOf.number.lessThanOrEquals("yOffset + options.source.height",n+e.source.height,this._height);const i=e.source,o=this._context,r=o._gl,s=this._textureTarget;r.activeTexture(r.TEXTURE0),r.bindTexture(s,this._texture);const a=i.width,c=i.height;let u=i.arrayBufferView;const d=this._width,h=this._height,m=this._internalFormat,g=this._pixelFormat,p=this._pixelDatatype,y=this._preMultiplyAlpha,b=this._flipY,C=A(e.skipColorSpaceConversion,!1);let E=4;l(u)&&(E=rt.alignmentInBytes(g,p,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,E),C?r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE):r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL);let w=!1;if(!this._initialized){if(t===0&&n===0&&a===d&&c===h)l(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=rt.flipY(u,g,p,d,h)),r.texImage2D(s,0,m,d,h,0,g,Qe.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b),r.texImage2D(s,0,m,g,Qe.toWebGLConstant(p,o),i)),w=!0;else{r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1);const S=rt.createTypedArray(g,p,d,h);r.texImage2D(s,0,m,d,h,0,g,Qe.toWebGLConstant(p,o),S)}this._initialized=!0}w||(l(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),b&&(u=rt.flipY(u,g,p,a,c)),r.texSubImage2D(s,0,t,n,a,c,g,Qe.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b),r.texSubImage2D(s,0,t,n,g,Qe.toWebGLConstant(p,o),i))),r.bindTexture(s,null)};Wt.prototype.copyFromFramebuffer=function(e,t,n,i,o,r){if(e=A(e,0),t=A(t,0),n=A(n,0),i=A(i,0),o=A(o,this._width),r=A(r,this._height),rt.isDepthFormat(this._pixelFormat))throw new x("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===Qe.FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Qe.HALF_FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(rt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call copyFrom with a compressed texture pixel format.");T.typeOf.number.greaterThanOrEquals("xOffset",e,0),T.typeOf.number.greaterThanOrEquals("yOffset",t,0),T.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),T.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),T.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),T.typeOf.number.lessThanOrEquals("yOffset + height",t+r,this._height);const 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};Wt.prototype.generateMipmap=function(e){if(e=A(e,d0.DONT_CARE),rt.isDepthFormat(this._pixelFormat))throw new x("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(rt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!M.isPowerOfTwo(this._width))throw new x("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!M.isPowerOfTwo(this._height))throw new x("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!d0.validate(e))throw new x("hint is invalid.");this._hasMipmap=!0;const 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)};Wt.prototype.isDestroyed=function(){return!1};Wt.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),He(this)};function Q_(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(Q_.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});Q_.prototype.getTexture=function(e){const t=this._textures[e];if(l(t))return delete this._texturesToRelease[e],++t.count,t.texture};Q_.prototype.addTexture=function(e,t){const n={texture:t,count:1};t.finalDestroy=t.destroy;const i=this;t.destroy=function(){--n.count===0&&(i._texturesToRelease[e]=n)},this._textures[e]=n,++this._numberOfTextures};Q_.prototype.destroyReleasedTextures=function(){const e=this._texturesToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];delete this._textures[t],n.texture.finalDestroy(),--this._numberOfTextures}this._texturesToRelease={}};Q_.prototype.isDestroyed=function(){return!1};Q_.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return He(this)};function Rn(){this.high=f.clone(f.ZERO),this.low=f.clone(f.ZERO)}Rn.encode=function(e,t){T.typeOf.number("value",e),l(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};const kd={high:0,low:0};Rn.fromCartesian=function(e,t){T.typeOf.object("cartesian",e),l(t)||(t=new Rn);const n=t.high,i=t.low;return Rn.encode(e.x,kd),n.x=kd.high,i.x=kd.low,Rn.encode(e.y,kd),n.y=kd.high,i.y=kd.low,Rn.encode(e.z,kd),n.z=kd.high,i.z=kd.low,t};const _1=new Rn;Rn.writeElements=function(e,t,n){T.defined("cartesianArray",t),T.typeOf.number("index",n),T.typeOf.number.greaterThanOrEquals("index",n,0),Rn.fromCartesian(e,_1);const i=_1.high,o=_1.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};function Pt(e,t){if(T.typeOf.object("normal",e),!M.equalsEpsilon(f.magnitude(e),1,M.EPSILON6))throw new x("normal must be normalized.");T.typeOf.number("distance",t),this.normal=f.clone(e),this.distance=t}Pt.fromPointNormal=function(e,t,n){if(T.typeOf.object("point",e),T.typeOf.object("normal",t),!M.equalsEpsilon(f.magnitude(t),1,M.EPSILON6))throw new x("normal must be normalized.");const i=-f.dot(t,e);return l(n)?(f.clone(t,n.normal),n.distance=i,n):new Pt(t,i)};const oCe=new f;Pt.fromCartesian4=function(e,t){T.typeOf.object("coefficients",e);const n=f.fromCartesian4(e,oCe),i=e.w;if(!M.equalsEpsilon(f.magnitude(n),1,M.EPSILON6))throw new x("normal must be normalized.");return l(t)?(f.clone(n,t.normal),t.distance=i,t):new Pt(n,i)};Pt.getPointDistance=function(e,t){return T.typeOf.object("plane",e),T.typeOf.object("point",t),f.dot(e.normal,t)+e.distance};const rCe=new f;Pt.projectPointOntoPlane=function(e,t,n){T.typeOf.object("plane",e),T.typeOf.object("point",t),l(n)||(n=new f);const i=Pt.getPointDistance(e,t),o=f.multiplyByScalar(e.normal,i,rCe);return f.subtract(t,o,n)};const sCe=new B,aCe=new oe,cCe=new f;Pt.transform=function(e,t,n){T.typeOf.object("plane",e),T.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=B.inverseTranspose(t,sCe);let s=oe.fromElements(i.x,i.y,i.z,o,aCe);s=B.multiplyByVector(r,s,s);const a=f.fromCartesian4(s,cCe);return s=oe.divideByScalar(s,f.magnitude(a),s),Pt.fromCartesian4(s,n)};Pt.clone=function(e,t){return T.typeOf.object("plane",e),l(t)?(f.clone(e.normal,t.normal),t.distance=e.distance,t):new Pt(e.normal,e.distance)};Pt.equals=function(e,t){return T.typeOf.object("left",e),T.typeOf.object("right",t),e.distance===t.distance&&f.equals(e.normal,t.normal)};Pt.ORIGIN_XY_PLANE=Object.freeze(new Pt(f.UNIT_Z,0));Pt.ORIGIN_YZ_PLANE=Object.freeze(new Pt(f.UNIT_X,0));Pt.ORIGIN_ZX_PLANE=Object.freeze(new Pt(f.UNIT_Y,0));function ar(e){this.planes=A(e,[])}const bC=[new f,new f,new f];f.clone(f.UNIT_X,bC[0]);f.clone(f.UNIT_Y,bC[1]);f.clone(f.UNIT_Z,bC[2]);const bh=new f,lCe=new f,Tq=new Pt(new f(1,0,0),0);ar.fromBoundingSphere=function(e,t){if(!l(e))throw new x("boundingSphere is required.");l(t)||(t=new ar);const n=bC.length,i=t.planes;i.length=2*n;const o=e.center,r=e.radius;let s=0;for(let a=0;a<n;++a){const c=bC[a];let u=i[s],d=i[s+1];l(u)||(u=i[s]=new oe),l(d)||(d=i[s+1]=new oe),f.multiplyByScalar(c,-r,bh),f.add(o,bh,bh),u.x=c.x,u.y=c.y,u.z=c.z,u.w=-f.dot(c,bh),f.multiplyByScalar(c,r,bh),f.add(o,bh,bh),d.x=-c.x,d.y=-c.y,d.z=-c.z,d.w=-f.dot(f.negate(c,lCe),bh),s+=2}return t};ar.prototype.computeVisibility=function(e){if(!l(e))throw new x("boundingVolume is required.");const t=this.planes;let n=!1;for(let i=0,o=t.length;i<o;++i){const r=e.intersectPlane(Pt.fromCartesian4(t[i],Tq));if(r===xn.OUTSIDE)return xn.OUTSIDE;r===xn.INTERSECTING&&(n=!0)}return n?xn.INTERSECTING:xn.INSIDE};ar.prototype.computeVisibilityWithPlaneMask=function(e,t){if(!l(e))throw new x("boundingVolume is required.");if(!l(t))throw new x("parentPlaneMask is required.");if(t===ar.MASK_OUTSIDE||t===ar.MASK_INSIDE)return t;let n=ar.MASK_INSIDE;const i=this.planes;for(let o=0,r=i.length;o<r;++o){const s=o<31?1<<o:0;if(o<31&&!(t&s))continue;const a=e.intersectPlane(Pt.fromCartesian4(i[o],Tq));if(a===xn.OUTSIDE)return ar.MASK_OUTSIDE;a===xn.INTERSECTING&&(n|=s)}return n};ar.MASK_OUTSIDE=4294967295;ar.MASK_INSIDE=0;ar.MASK_INDETERMINATE=2147483647;function Wo(e){e=A(e,A.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=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this._cullingVolume=new ar,this._orthographicMatrix=new B}function Eq(e){if(!l(e.right)||!l(e.left)||!l(e.top)||!l(e.bottom)||!l(e.near)||!l(e.far))throw new x("right, left, top, bottom, near, or far parameters are not set.");if(e.top!==e._top||e.bottom!==e._bottom||e.left!==e._left||e.right!==e._right||e.near!==e._near||e.far!==e._far){if(e.left>e.right)throw new x("right must be greater than left.");if(e.bottom>e.top)throw new x("top must be greater than bottom.");if(e.near<=0||e.near>e.far)throw new x("near must be greater than zero and less than far.");e._left=e.left,e._right=e.right,e._top=e.top,e._bottom=e.bottom,e._near=e.near,e._far=e.far,e._orthographicMatrix=B.computeOrthographicOffCenter(e.left,e.right,e.bottom,e.top,e.near,e.far,e._orthographicMatrix)}}Object.defineProperties(Wo.prototype,{projectionMatrix:{get:function(){return Eq(this),this._orthographicMatrix}}});const uCe=new f,dCe=new f,fCe=new f,g1=new f;Wo.prototype.computeCullingVolume=function(e,t,n){if(!l(e))throw new x("position is required.");if(!l(t))throw new x("direction is required.");if(!l(n))throw new x("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,u=this.far,d=f.cross(t,n,uCe);f.normalize(d,d);const h=dCe;f.multiplyByScalar(t,c,h),f.add(e,h,h);const m=fCe;f.multiplyByScalar(d,a,m),f.add(h,m,m);let g=i[0];return l(g)||(g=i[0]=new oe),g.x=d.x,g.y=d.y,g.z=d.z,g.w=-f.dot(d,m),f.multiplyByScalar(d,s,m),f.add(h,m,m),g=i[1],l(g)||(g=i[1]=new oe),g.x=-d.x,g.y=-d.y,g.z=-d.z,g.w=-f.dot(f.negate(d,g1),m),f.multiplyByScalar(n,r,m),f.add(h,m,m),g=i[2],l(g)||(g=i[2]=new oe),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-f.dot(n,m),f.multiplyByScalar(n,o,m),f.add(h,m,m),g=i[3],l(g)||(g=i[3]=new oe),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-f.dot(f.negate(n,g1),m),g=i[4],l(g)||(g=i[4]=new oe),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-f.dot(t,h),f.multiplyByScalar(t,u,m),f.add(e,m,m),g=i[5],l(g)||(g=i[5]=new oe),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-f.dot(f.negate(t,g1),m),this._cullingVolume};Wo.prototype.getPixelDimensions=function(e,t,n,i,o){if(Eq(this),!l(e)||!l(t))throw new x("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new x("drawingBufferWidth must be greater than zero.");if(t<=0)throw new x("drawingBufferHeight must be greater than zero.");if(!l(n))throw new x("distance is required.");if(!l(i))throw new x("pixelRatio is required.");if(i<=0)throw new x("pixelRatio must be greater than zero.");if(!l(o))throw new x("A result object is required.");const 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};Wo.prototype.clone=function(e){return l(e)||(e=new Wo),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};Wo.prototype.equals=function(e){return l(e)&&e instanceof Wo&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Wo.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof Wo&&M.equalsEpsilon(this.right,e.right,t,n)&&M.equalsEpsilon(this.left,e.left,t,n)&&M.equalsEpsilon(this.top,e.top,t,n)&&M.equalsEpsilon(this.bottom,e.bottom,t,n)&&M.equalsEpsilon(this.near,e.near,t,n)&&M.equalsEpsilon(this.far,e.far,t,n)};function Gt(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new Wo,this.width=e.width,this._width=void 0,this.aspectRatio=e.aspectRatio,this._aspectRatio=void 0,this.near=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far}Gt.packedLength=4;Gt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};Gt.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new Gt),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function E_(e){if(!l(e.width)||!l(e.aspectRatio)||!l(e.near)||!l(e.far))throw new x("width, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.width!==e._width||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far){if(e.aspectRatio<0)throw new x("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new x("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._width=e.width,e._near=e.near,e._far=e.far;const 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(Gt.prototype,{projectionMatrix:{get:function(){return E_(this),this._offCenterFrustum.projectionMatrix}}});Gt.prototype.computeCullingVolume=function(e,t,n){return E_(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};Gt.prototype.getPixelDimensions=function(e,t,n,i,o){return E_(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};Gt.prototype.clone=function(e){return l(e)||(e=new Gt),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};Gt.prototype.equals=function(e){return!l(e)||!(e instanceof Gt)?!1:(E_(this),E_(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};Gt.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof Gt)?!1:(E_(this),E_(e),M.equalsEpsilon(this.width,e.width,t,n)&&M.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const hM={};function hCe(e){const t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}const pCe=32.184,mCe=2451545;function xq(e,t){t=ie.addSeconds(e,pCe,t);const n=ie.totalDays(t)-mCe;return t=ie.addSeconds(t,hCe(n),t),t}const GS=new ie(2451545,0,$n.TAI),_Ce=1e3,Yc=M.RADIANS_PER_DEGREE,nc=M.RADIANS_PER_ARCSECOND,Fs=14959787e4,xU=new J;function wq(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=M.PI),n<0||n>M.PI)throw new x("The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians.");const a=e*(1-t),c=i-o,u=o,d=yCe(r-i,t);if(gCe(t,0)==="Hyperbolic"&&Math.abs(M.negativePiToPi(d))>=Math.acos(-1/t))throw new x("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");TCe(c,n,u,xU);const m=a*(1+t),g=Math.cos(d),p=Math.sin(d),y=1+t*g;if(y<=M.Epsilon10)throw new x("elements cannot be converted to cartesian");const b=m/y;return l(s)?(s.x=b*g,s.y=b*p,s.z=0):s=new f(b*g,b*p,0),J.multiplyByVector(xU,s,s)}function gCe(e,t){if(e<0)throw new x("eccentricity cannot be negative.");return e<=t?"Circular":e<1-t?"Elliptical":e<=1+t?"Parabolic":"Hyperbolic"}function yCe(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=bCe(e,t);return CCe(n,t)}const wU=50,ACe=M.EPSILON8;function bCe(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=Math.floor(e/M.TWO_PI);e-=n*M.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<wU&&Math.abs(o-i)>ACe;++r){o=i;const s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=wU)throw new x("Kepler equation did not converge");return o=i+n*M.TWO_PI,o}function CCe(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=Math.floor(e/M.TWO_PI);e-=n*M.TWO_PI;const i=Math.cos(e)-t,o=Math.sin(e)*Math.sqrt(1-t*t);let r=Math.atan2(o,i);return r=M.zeroToTwoPi(r),e<0&&(r-=M.TWO_PI),r+=n*M.TWO_PI,r}function TCe(e,t,n,i){if(t<0||t>M.PI)throw new x("inclination out of range");const o=Math.cos(e),r=Math.sin(e),s=Math.cos(t),a=Math.sin(t),c=Math.cos(n),u=Math.sin(n);return l(i)?(i[0]=c*o-u*r*s,i[1]=u*o+c*r*s,i[2]=r*a,i[3]=-c*r-u*o*s,i[4]=-u*r+c*o*s,i[5]=o*a,i[6]=u*a,i[7]=-c*a,i[8]=s):i=new J(c*o-u*r*s,-c*r-u*o*s,u*a,u*o+c*r*s,-u*r+c*o*s,-c*a,r*a,o*a,s),i}const ECe=1.0000010178*Fs,xCe=100.46645683*Yc,wCe=129597742283429e-5*nc,SU=16002,vU=21863,DU=32004,IU=10931,PU=14529,OU=16368,LU=15318,BU=32794,SCe=64*1e-7*Fs,vCe=-152*1e-7*Fs,DCe=62*1e-7*Fs,ICe=-8*1e-7*Fs,PCe=32*1e-7*Fs,OCe=-41*1e-7*Fs,LCe=19*1e-7*Fs,BCe=-11*1e-7*Fs,RCe=-150*1e-7*Fs,NCe=-46*1e-7*Fs,MCe=68*1e-7*Fs,FCe=54*1e-7*Fs,zCe=14*1e-7*Fs,UCe=24*1e-7*Fs,HCe=-28*1e-7*Fs,VCe=22*1e-7*Fs,RU=10,NU=16002,MU=21863,FU=10931,zU=1473,UU=32004,HU=4387,VU=73,kCe=-325*1e-7,GCe=-322*1e-7,WCe=-79*1e-7,jCe=232*1e-7,qCe=-52*1e-7,$Ce=97*1e-7,YCe=55*1e-7,XCe=-41*1e-7,KCe=-105*1e-7,JCe=-137*1e-7,QCe=258*1e-7,ZCe=35*1e-7,eTe=-116*1e-7,tTe=-88*1e-7,nTe=-112*1e-7,iTe=-80*1e-7,Ny=new ie(0,0,$n.TAI);function oTe(e,t){xq(e,Ny);const i=(Ny.dayNumber-GS.dayNumber+(Ny.secondsOfDay-GS.secondsOfDay)/Ni.SECONDS_PER_DAY)/(Ni.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=ECe+SCe*Math.cos(SU*o)+RCe*Math.sin(SU*o)+vCe*Math.cos(vU*o)+NCe*Math.sin(vU*o)+DCe*Math.cos(DU*o)+MCe*Math.sin(DU*o)+ICe*Math.cos(IU*o)+FCe*Math.sin(IU*o)+PCe*Math.cos(PU*o)+zCe*Math.sin(PU*o)+OCe*Math.cos(OU*o)+UCe*Math.sin(OU*o)+LCe*Math.cos(LU*o)+HCe*Math.sin(LU*o)+BCe*Math.cos(BU*o)+VCe*Math.sin(BU*o),s=xCe+wCe*i+kCe*Math.cos(RU*o)+KCe*Math.sin(RU*o)+GCe*Math.cos(NU*o)+JCe*Math.sin(NU*o)+WCe*Math.cos(MU*o)+QCe*Math.sin(MU*o)+jCe*Math.cos(FU*o)+ZCe*Math.sin(FU*o)+qCe*Math.cos(zU*o)+eTe*Math.sin(zU*o)+$Ce*Math.cos(UU*o)+tTe*Math.sin(UU*o)+YCe*Math.cos(HU*o)+nTe*Math.sin(HU*o)+XCe*Math.cos(VU*o)+iTe*Math.sin(VU*o),a=.0167086342-.0004203654*i,c=102.93734808*Yc+11612.3529*nc*i,u=469.97289*nc*i,d=174.87317577*Yc-8679.27034*nc*i;return wq(r,a,u,c,d,s,t)}function Sq(e,t){xq(e,Ny);const i=(Ny.dayNumber-GS.dayNumber+(Ny.secondsOfDay-GS.secondsOfDay)/Ni.SECONDS_PER_DAY)/Ni.DAYS_PER_JULIAN_CENTURY,o=i*i,r=o*i,s=r*i;let a=383397.7725+.004*i,c=.055545526-16e-9*i;const u=5.15668983*Yc;let d=-8e-5*i+.02966*o-42e-6*r-13e-8*s;const h=83.35324312*Yc;let m=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s;const g=125.04455501*Yc;let p=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s;const y=218.31664563*Yc;let b=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s;const C=297.85019547*Yc+nc*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),E=93.27209062*Yc+nc*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),w=134.96340251*Yc+nc*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),S=357.52910918*Yc+nc*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),P=310.17137918*Yc-nc*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),L=2*C,z=4*C,R=6*C,F=2*w,U=3*w,D=4*w,I=2*E;a+=3400.4*Math.cos(L)-635.6*Math.cos(L-w)-235.6*Math.cos(w)+218.1*Math.cos(L-S)+181*Math.cos(L+w),c+=.014216*Math.cos(L-w)+.008551*Math.cos(L-F)-.001383*Math.cos(w)+.001356*Math.cos(L+w)-.001147*Math.cos(z-U)-914e-6*Math.cos(z-F)+869e-6*Math.cos(L-S-w)-627e-6*Math.cos(L)-394e-6*Math.cos(z-D)+282e-6*Math.cos(L-S-F)-279e-6*Math.cos(C-w)-236e-6*Math.cos(F)+231e-6*Math.cos(z)+229e-6*Math.cos(R-D)-201e-6*Math.cos(F-I),d+=486.26*Math.cos(L-I)-40.13*Math.cos(L)+37.51*Math.cos(I)+25.73*Math.cos(F-I)+19.97*Math.cos(L-S-I),m+=-55609*Math.sin(L-w)-34711*Math.sin(L-F)-9792*Math.sin(w)+9385*Math.sin(z-U)+7505*Math.sin(z-F)+5318*Math.sin(L+w)+3484*Math.sin(z-D)-3417*Math.sin(L-S-w)-2530*Math.sin(R-D)-2376*Math.sin(L)-2075*Math.sin(L-U)-1883*Math.sin(F)-1736*Math.sin(R-5*w)+1626*Math.sin(S)-1370*Math.sin(R-U),p+=-5392*Math.sin(L-I)-540*Math.sin(S)-441*Math.sin(L)+423*Math.sin(I)-288*Math.sin(F-I),b+=-3332.9*Math.sin(L)+1197.4*Math.sin(L-w)-662.5*Math.sin(S)+396.3*Math.sin(w)-218*Math.sin(L-S);const _=2*P,v=3*P;d+=46.997*Math.cos(P)*i-.614*Math.cos(L-I+P)*i+.614*Math.cos(L-I-P)*i-.0297*Math.cos(_)*o-.0335*Math.cos(P)*o+.0012*Math.cos(L-I+_)*o-16e-5*Math.cos(P)*r+4e-5*Math.cos(v)*r+4e-5*Math.cos(_)*r;const O=2.116*Math.sin(P)*i-.111*Math.sin(L-I-P)*i-.0015*Math.sin(P)*o;m+=O,b+=O,p+=-520.77*Math.sin(P)*i+13.66*Math.sin(L-I+P)*i+1.12*Math.sin(L-P)*i-1.06*Math.sin(I-P)*i+.66*Math.sin(_)*o+.371*Math.sin(P)*o-.035*Math.sin(L-I+_)*o-.015*Math.sin(L-I+P)*o+.0014*Math.sin(P)*r-.0011*Math.sin(v)*r-9e-4*Math.sin(_)*r,a*=_Ce;const N=u+d*nc,V=h+m*nc,k=y+b*nc,G=g+p*nc;return wq(a,c,N,V,G,k,t)}const kU=.012300034,rTe=kU/(kU+1)*-1;function sTe(e,t){return t=Sq(e,t),f.multiplyByScalar(t,rTe,t)}const vq=new J(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let lA=new f;hM.computeSunPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ie.now()),l(t)||(t=new f),lA=oTe(e,lA),t=f.negate(lA,t),sTe(e,lA),f.subtract(t,lA,t),J.multiplyByVector(vq,t,t),t};hM.computeMoonPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ie.now()),t=Sq(e,t),J.multiplyByVector(vq,t,t),t};const hB=hM,Mw={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};Mw.getMorphTime=function(e){return e===Mw.SCENE3D?1:e===Mw.MORPHING?void 0:0};const le=Object.freeze(Mw);function aD(e){e=A(e,A.EMPTY_OBJECT),this.color=H.clone(A(e.color,H.WHITE)),this.intensity=A(e.intensity,2)}function O0(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new Ye,this._viewportCartesian4=new oe,this._viewportDirty=!1,this._viewportOrthographicMatrix=B.clone(B.IDENTITY),this._viewportTransformation=B.clone(B.IDENTITY),this._model=B.clone(B.IDENTITY),this._view=B.clone(B.IDENTITY),this._inverseView=B.clone(B.IDENTITY),this._projection=B.clone(B.IDENTITY),this._infiniteProjection=B.clone(B.IDENTITY),this._entireFrustum=new j,this._currentFrustum=new j,this._frustumPlanes=new oe,this._farDepthFromNearPlusOne=void 0,this._log2FarDepthFromNearPlusOne=void 0,this._oneOverLog2FarDepthFromNearPlusOne=void 0,this._frameState=void 0,this._temeToPseudoFixed=J.clone(B.IDENTITY),this._view3DDirty=!0,this._view3D=new B,this._inverseView3DDirty=!0,this._inverseView3D=new B,this._inverseModelDirty=!0,this._inverseModel=new B,this._inverseTransposeModelDirty=!0,this._inverseTransposeModel=new J,this._viewRotation=new J,this._inverseViewRotation=new J,this._viewRotation3D=new J,this._inverseViewRotation3D=new J,this._inverseProjectionDirty=!0,this._inverseProjection=new B,this._modelViewDirty=!0,this._modelView=new B,this._modelView3DDirty=!0,this._modelView3D=new B,this._modelViewRelativeToEyeDirty=!0,this._modelViewRelativeToEye=new B,this._inverseModelViewDirty=!0,this._inverseModelView=new B,this._inverseModelView3DDirty=!0,this._inverseModelView3D=new B,this._viewProjectionDirty=!0,this._viewProjection=new B,this._inverseViewProjectionDirty=!0,this._inverseViewProjection=new B,this._modelViewProjectionDirty=!0,this._modelViewProjection=new B,this._inverseModelViewProjectionDirty=!0,this._inverseModelViewProjection=new B,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewProjectionRelativeToEye=new B,this._modelViewInfiniteProjectionDirty=!0,this._modelViewInfiniteProjection=new B,this._normalDirty=!0,this._normal=new J,this._normal3DDirty=!0,this._normal3D=new J,this._inverseNormalDirty=!0,this._inverseNormal=new J,this._inverseNormal3DDirty=!0,this._inverseNormal3D=new J,this._encodedCameraPositionMCDirty=!0,this._encodedCameraPositionMC=new Rn,this._cameraPosition=new f,this._sunPositionWC=new f,this._sunPositionColumbusView=new f,this._sunDirectionWC=new f,this._sunDirectionEC=new f,this._moonDirectionEC=new f,this._lightDirectionWC=new f,this._lightDirectionEC=new f,this._lightColor=new f,this._lightColorHdr=new f,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new f,this._cameraRight=new f,this._cameraUp=new f,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new j,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new H,this._brdfLut=void 0,this._environmentMap=void 0,this._sphericalHarmonicCoefficients=void 0,this._specularEnvironmentMaps=void 0,this._specularEnvironmentMapsDimensions=new j,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(O0.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);const 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 GU(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return GU(this),this._viewportTransformation}},model:{get:function(){return this._model},set:function(e){B.clone(e,this._model),this._modelView3DDirty=!0,this._inverseModelView3DDirty=!0,this._inverseModelDirty=!0,this._inverseTransposeModelDirty=!0,this._modelViewDirty=!0,this._inverseModelViewDirty=!0,this._modelViewRelativeToEyeDirty=!0,this._inverseModelViewDirty=!0,this._modelViewProjectionDirty=!0,this._inverseModelViewProjectionDirty=!0,this._modelViewProjectionRelativeToEyeDirty=!0,this._modelViewInfiniteProjectionDirty=!0,this._normalDirty=!0,this._inverseNormalDirty=!0,this._normal3DDirty=!0,this._inverseNormal3DDirty=!0,this._encodedCameraPositionMCDirty=!0}},inverseModel:{get:function(){return this._inverseModelDirty&&(this._inverseModelDirty=!1,B.inverse(this._model,this._inverseModel)),this._inverseModel}},inverseTransposeModel:{get:function(){const e=this._inverseTransposeModel;return this._inverseTransposeModelDirty&&(this._inverseTransposeModelDirty=!1,B.getMatrix3(this.inverseModel,e),J.transpose(e,e)),e}},view:{get:function(){return this._view}},view3D:{get:function(){return y1(this),this._view3D}},viewRotation:{get:function(){return y1(this),this._viewRotation}},viewRotation3D:{get:function(){return y1(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return qU(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return qU(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return _Te(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return gTe(this),this._modelView}},modelView3D:{get:function(){return yTe(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return xTe(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return ATe(this),this._inverseModelView}},inverseModelView3D:{get:function(){return bTe(this),this._inverseModelView3D}},viewProjection:{get:function(){return CTe(this),this._viewProjection}},inverseViewProjection:{get:function(){return TTe(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return ETe(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return wTe(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return STe(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return vTe(this),this._modelViewInfiniteProjection}},normal:{get:function(){return DTe(this),this._normal}},normal3D:{get:function(){return ITe(this),this._normal3D}},inverseNormal:{get:function(){return PTe(this),this._inverseNormal}},inverseNormal3D:{get:function(){return OTe(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 jU(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return jU(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 A(this._ellipsoid,me.WGS84)}}});function aTe(e,t){B.clone(t,e._view),B.getMatrix3(t,e._viewRotation),e._view3DDirty=!0,e._inverseView3DDirty=!0,e._modelViewDirty=!0,e._modelView3DDirty=!0,e._modelViewRelativeToEyeDirty=!0,e._inverseModelViewDirty=!0,e._inverseModelView3DDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0,e._modelViewInfiniteProjectionDirty=!0,e._normalDirty=!0,e._inverseNormalDirty=!0,e._normal3DDirty=!0,e._inverseNormal3DDirty=!0}function cTe(e,t){B.clone(t,e._inverseView),B.getMatrix3(t,e._inverseViewRotation)}function lTe(e,t){B.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function uTe(e,t){B.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function dTe(e,t){f.clone(t.positionWC,e._cameraPosition),f.clone(t.directionWC,e._cameraDirection),f.clone(t.rightWC,e._cameraRight),f.clone(t.upWC,e._cameraUp);const n=t.positionCartographic;l(n)?e._eyeHeight=n.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}let uA=new J;const fTe=new Ce;function hTe(e,t){l(cn.computeIcrfToFixedMatrix(t.time,uA))||(uA=cn.computeTemeToPseudoFixedMatrix(t.time,uA));let n=hB.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);J.multiplyByVector(uA,n,n),f.normalize(n,e._sunDirectionWC),n=J.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),f.normalize(n,n),n=hB.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),J.multiplyByVector(uA,n,n),J.multiplyByVector(e.viewRotation3D,n,n),f.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,fTe);i.project(r,e._sunPositionColumbusView)}O0.prototype.updateCamera=function(e){aTe(this,e.viewMatrix),cTe(this,e.inverseViewMatrix),dTe(this,e),this._entireFrustum.x=e.frustum.near,this._entireFrustum.y=e.frustum.far,this.updateFrustum(e.frustum),this._orthographicIn3D=this._mode!==le.SCENE2D&&e.frustum instanceof Gt};O0.prototype.updateFrustum=function(e){lTe(this,e.projectionMatrix),l(e.infiniteProjectionMatrix)&&uTe(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=M.log2(this._farDepthFromNearPlusOne),this._oneOverLog2FarDepthFromNearPlusOne=1/this._log2FarDepthFromNearPlusOne,l(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};O0.prototype.updatePass=function(e){this._pass=e};const pTe=[],mTe=new aD;O0.prototype.update=function(e){this._mode=e.mode,this._mapProjection=e.mapProjection,this._ellipsoid=e.mapProjection.ellipsoid,this._pixelRatio=e.pixelRatio;const t=e.camera;this.updateCamera(t),e.mode===le.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),hTe(this,e);const n=A(e.light,mTe);n instanceof aD?(this._lightDirectionWC=f.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=f.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=f.normalize(f.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=J.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=f.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=f.multiplyByScalar(o,n.intensity,o);const r=f.maximumComponent(o);r>1?f.divideByScalar(o,r,this._lightColor):f.clone(o,this._lightColor);const s=e.brdfLutGenerator,a=l(s)?s.colorTexture:void 0;this._brdfLut=a,this._environmentMap=A(e.environmentMap,e.context.defaultCubeMap),this._sphericalHarmonicCoefficients=A(e.sphericalHarmonicCoefficients,pTe),this._specularEnvironmentMaps=e.specularEnvironmentMaps,this._specularEnvironmentMapsMaximumLOD=e.specularEnvironmentMapsMaximumLOD,l(this._specularEnvironmentMaps)&&j.clone(this._specularEnvironmentMaps.dimensions,this._specularEnvironmentMapsDimensions),this._fogDensity=e.fog.density,this._invertClassificationColor=e.invertClassificationColor,this._frameState=e,this._temeToPseudoFixed=cn.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const c=t.frustum.fov,u=this._viewport;let d;l(c)?u.height>u.width?d=Math.tan(.5*c)*2/u.height:d=Math.tan(.5*c)*2/u.width:d=1/Math.max(u.width,u.height),this._geometricToleranceOverMeter=d*e.maximumScreenSpaceError,H.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function GU(e){if(e._viewportDirty){const t=e._viewport;B.computeOrthographicOffCenter(t.x,t.x+t.width,t.y,t.y+t.height,0,1,e._viewportOrthographicMatrix),B.computeViewportTransformation(t,0,1,e._viewportTransformation),e._viewportDirty=!1}}function _Te(e){e._inverseProjectionDirty&&(e._inverseProjectionDirty=!1,e._mode!==le.SCENE2D&&e._mode!==le.MORPHING&&!e._orthographicIn3D?B.inverse(e._projection,e._inverseProjection):B.clone(B.ZERO,e._inverseProjection))}function gTe(e){e._modelViewDirty&&(e._modelViewDirty=!1,B.multiplyTransformation(e._view,e._model,e._modelView))}function yTe(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,B.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function ATe(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,B.inverse(e.modelView,e._inverseModelView))}function bTe(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,B.inverse(e.modelView3D,e._inverseModelView3D))}function CTe(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,B.multiply(e._projection,e._view,e._viewProjection))}function TTe(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,B.inverse(e.viewProjection,e._inverseViewProjection))}function ETe(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,B.multiply(e._projection,e.modelView,e._modelViewProjection))}function xTe(e){if(e._modelViewRelativeToEyeDirty){e._modelViewRelativeToEyeDirty=!1;const 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 wTe(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,B.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function STe(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,B.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function vTe(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,B.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function DTe(e){if(e._normalDirty){e._normalDirty=!1;const t=e._normal;B.getMatrix3(e.inverseModelView,t),J.getRotation(t,t),J.transpose(t,t)}}function ITe(e){if(e._normal3DDirty){e._normal3DDirty=!1;const t=e._normal3D;B.getMatrix3(e.inverseModelView3D,t),J.getRotation(t,t),J.transpose(t,t)}}function PTe(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,B.getMatrix3(e.inverseModelView,e._inverseNormal),J.getRotation(e._inverseNormal,e._inverseNormal))}function OTe(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,B.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),J.getRotation(e._inverseNormal3D,e._inverseNormal3D))}const WU=new f;function jU(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,B.multiplyByPoint(e.inverseModel,e._cameraPosition,WU),Rn.fromCartesian(WU,e._encodedCameraPositionMC))}const LTe=new f,BTe=new f,RTe=new f,NTe=new f,MTe=new Ce,FTe=new f,zTe=new B;function UTe(e,t,n,i,o,r,s,a){const c=LTe;c.x=e.y,c.y=e.z,c.z=e.x;const u=BTe;u.x=n.y,u.y=n.z,u.z=n.x;const d=RTe;d.x=i.y,d.y=i.z,d.z=i.x;const h=NTe;h.x=t.y,h.y=t.z,h.z=t.x,r===le.SCENE2D&&(c.z=o*.5);const m=s.unproject(c,MTe);m.longitude=M.clamp(m.longitude,-Math.PI,Math.PI),m.latitude=M.clamp(m.latitude,-M.PI_OVER_TWO,M.PI_OVER_TWO);const g=s.ellipsoid,p=g.cartographicToCartesian(m,FTe),y=cn.eastNorthUpToFixedFrame(p,g,zTe);return B.multiplyByPointAsVector(y,u,u),B.multiplyByPointAsVector(y,d,d),B.multiplyByPointAsVector(y,h,h),l(a)||(a=new B),a[0]=u.x,a[1]=d.x,a[2]=-h.x,a[3]=0,a[4]=u.y,a[5]=d.y,a[6]=-h.y,a[7]=0,a[8]=u.z,a[9]=d.z,a[10]=-h.z,a[11]=0,a[12]=-f.dot(u,p),a[13]=-f.dot(d,p),a[14]=f.dot(h,p),a[15]=1,a}function y1(e){e._view3DDirty&&(e._mode===le.SCENE3D?B.clone(e._view,e._view3D):UTe(e._cameraPosition,e._cameraDirection,e._cameraRight,e._cameraUp,e._frustum2DWidth,e._mode,e._mapProjection,e._view3D),B.getMatrix3(e._view3D,e._viewRotation3D),e._view3DDirty=!1)}function qU(e){e._inverseView3DDirty&&(B.inverseTransformation(e.view3D,e._inverseView3D),B.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function HTe(e,t,n,i){const o=l(t.vertexBuffer),r=l(t.value),s=t.value?t.value.length:t.componentsPerAttribute;if(!o&&!r)throw new x("attribute must have a vertexBuffer or a value.");if(o&&r)throw new x("attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices.");if(s!==1&&s!==2&&s!==3&&s!==4)throw r?new x("attribute.value.length must be in the range [1, 4]."):new x("attribute.componentsPerAttribute must be in the range [1, 4].");if(l(t.componentDatatype)&&!ee.validate(t.componentDatatype))throw new x("attribute must have a valid componentDatatype or not specify it.");if(l(t.strideInBytes)&&t.strideInBytes>255)throw new x("attribute must have a strideInBytes less than or equal to 255 or not specify it.");if(l(t.instanceDivisor)&&t.instanceDivisor>0&&!i.instancedArrays)throw new x("instanced arrays is not supported");if(l(t.instanceDivisor)&&t.instanceDivisor<0)throw new x("attribute must have an instanceDivisor greater than or equal to zero");if(l(t.instanceDivisor)&&r)throw new x("attribute cannot have have an instanceDivisor if it is not backed by a buffer");if(l(t.instanceDivisor)&&t.instanceDivisor>0&&t.index===0)throw new x("attribute zero cannot have an instanceDivisor greater than 0");const a={index:A(t.index,n),enabled:A(t.enabled,!0),vertexBuffer:t.vertexBuffer,value:r?t.value.slice(0):void 0,componentsPerAttribute:s,componentDatatype:A(t.componentDatatype,ee.FLOAT),normalize:A(t.normalize,!1),offsetInBytes:A(t.offsetInBytes,0),strideInBytes:A(t.strideInBytes,0),instanceDivisor:A(t.instanceDivisor,0)};if(o)a.vertexAttrib=function(c){const u=this.index;c.bindBuffer(c.ARRAY_BUFFER,this.vertexBuffer._getBuffer()),c.vertexAttribPointer(u,this.componentsPerAttribute,this.componentDatatype,this.normalize,this.strideInBytes,this.offsetInBytes),c.enableVertexAttribArray(u),this.instanceDivisor>0&&(i.glVertexAttribDivisor(u,this.instanceDivisor),i._vertexAttribDivisors[u]=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 Dq(e,t,n){for(let i=0;i<t.length;++i){const o=t[i];o.enabled&&o.vertexAttrib(e)}l(n)&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n._getBuffer())}function ho(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context),T.defined("options.attributes",e.attributes);const t=e.context,n=t._gl,i=e.attributes,o=e.indexBuffer;let r;const s=[];let a=1,c=!1,u=!1,d=i.length;for(r=0;r<d;++r)HTe(s,i[r],r,t);for(d=s.length,r=0;r<d;++r){const g=s[r];if(l(g.vertexBuffer)&&g.instanceDivisor===0){const p=g.strideInBytes||g.componentsPerAttribute*ee.getSizeInBytes(g.componentDatatype);a=g.vertexBuffer.sizeInBytes/p;break}}for(r=0;r<d;++r)s[r].instanceDivisor>0&&(c=!0),l(s[r].value)&&(u=!0);const h={};for(r=0;r<d;++r){const g=s[r].index;if(h[g])throw new x(`Index ${g} is used by more than one attribute.`);h[g]=!0}let m;t.vertexArrayObject&&(m=t.glCreateVertexArray(),t.glBindVertexArray(m),Dq(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=c,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=m,this._attributes=s,this._indexBuffer=o}function $U(e){return e.values.length/e.componentsPerAttribute}function VTe(e){return ee.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function kTe(e){let t,n,i;const o=[];for(n in e)e.hasOwnProperty(n)&&l(e[n])&&l(e[n].values)&&(o.push(n),e[n].componentDatatype===ee.DOUBLE&&(e[n].componentDatatype=ee.FLOAT,e[n].values=ee.createTypedArray(ee.FLOAT,e[n].values)));let r;const s=o.length;if(s>0)for(r=$U(e[o[0]]),t=1;t<s;++t){const u=$U(e[o[t]]);if(u!==r)throw new Ie(`Each attribute list must have the same number of vertices. Attribute ${o[t]} has a different number of vertices (${u.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(u,d){return ee.getSizeInBytes(e[d].componentDatatype)-ee.getSizeInBytes(e[u].componentDatatype)});let a=0;const c={};for(t=0;t<s;++t)n=o[t],i=e[n],c[n]=a,a+=VTe(i);if(a>0){const u=ee.getSizeInBytes(e[o[0]].componentDatatype),d=a%u;d!==0&&(a+=u-d);const h=r*a,m=new ArrayBuffer(h),g={};for(t=0;t<s;++t){n=o[t];const p=ee.getSizeInBytes(e[n].componentDatatype);g[n]={pointer:ee.createTypedArray(e[n].componentDatatype,m),index:c[n]/p,strideInComponentType:a/p}}for(t=0;t<r;++t)for(let p=0;p<s;++p){n=o[p],i=e[n];const y=i.values,b=g[n],C=b.pointer,E=i.componentsPerAttribute;for(let w=0;w<E;++w)C[b.index+w]=y[t*E+w];b.index+=b.strideInComponentType}return{buffer:m,offsetsInBytes:c,vertexSizeInBytes:a}}}ho.fromGeometry=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context);const t=e.context,n=A(e.geometry,A.EMPTY_OBJECT),i=A(e.bufferUsage,nt.DYNAMIC_DRAW),o=A(e.attributeLocations,A.EMPTY_OBJECT),r=A(e.interleave,!1),s=e.vertexArrayAttributes;let a,c,u;const d=l(s)?s:[],h=n.attributes;if(r){const p=kTe(h);if(l(p)){u=Tt.createVertexBuffer({context:t,typedArray:p.buffer,usage:i});const y=p.offsetsInBytes,b=p.vertexSizeInBytes;for(a in h)h.hasOwnProperty(a)&&l(h[a])&&(c=h[a],l(c.values)?d.push({index:o[a],vertexBuffer:u,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:y[a],strideInBytes:b}):d.push({index:o[a],value:c.value,componentDatatype:c.componentDatatype,normalize:c.normalize}))}}else for(a in h)if(h.hasOwnProperty(a)&&l(h[a])){c=h[a];let p=c.componentDatatype;p===ee.DOUBLE&&(p=ee.FLOAT),u=void 0,l(c.values)&&(u=Tt.createVertexBuffer({context:t,typedArray:ee.createTypedArray(p,c.values),usage:i})),d.push({index:o[a],vertexBuffer:u,value:c.value,componentDatatype:p,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let m;const g=n.indices;return l(g)&&(Lt.computeNumberOfVertices(n)>=M.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?m=Tt.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:at.UNSIGNED_INT}):m=Tt.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:at.UNSIGNED_SHORT})),new ho({context:t,attributes:d,indexBuffer:m})};Object.defineProperties(ho.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});ho.prototype.getAttribute=function(e){return T.defined("index",e),this._attributes[e]};function GTe(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=It.maximumVertexAttributes;let s;if(n){const a=o.length;for(s=0;s<a;++s){const c=o[s];if(c.enabled){const u=c.instanceDivisor,d=c.index;u!==i[d]&&(t.glVertexAttribDivisor(d,u),i[d]=u)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function WTe(e,t){const n=e._attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];r.enabled&&l(r.value)&&r.vertexAttrib(t)}}ho.prototype._bind=function(){l(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&>e(this),this._hasConstantAttributes&&WTe(this,this._gl)):Dq(this._gl,this._attributes,this._indexBuffer)};ho.prototype._unBind=function(){if(l(this._vao))this._context.glBindVertexArray(null);else{const e=this._attributes,t=this._gl;for(let n=0;n<e.length;++n){const i=e[n];i.enabled&&i.disableVertexAttribArray(t)}this._indexBuffer&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,null)}};ho.prototype.isDestroyed=function(){return!1};ho.prototype.destroy=function(){const e=this._attributes;for(let n=0;n<e.length;++n){const i=e[n].vertexBuffer;l(i)&&!i.isDestroyed()&&i.vertexArrayDestroyable&&i.destroy()}const t=this._indexBuffer;return l(t)&&!t.isDestroyed()&&t.vertexArrayDestroyable&&t.destroy(),l(this._vao)&&this._context.glDeleteVertexArray(this._vao),He(this)};function Ja(e,t){T.defined("canvas",e);let n=!1;l(t)&&l(t.requestWebgl2)&&(n=t.requestWebgl2,Ja._deprecationWarning("ContextOptions.requestWebgl2","Cesium.requestWebgl2 was deprecated in CesiumJS 1.101 and will be removed in 1.102. Use Cesium.requestWebgl1 to request a WebGL1 or WebGL2 context."));const{getWebGLStub:i,requestWebgl1:o=!n,webgl:r={},allowTextureFilterAnisotropic:s=!0}=A(t,{});r.alpha=A(r.alpha,!1),r.stencil=A(r.stencil,!0),r.powerPreference=A(r.powerPreference,"high-performance");const a=l(i)?i(e,r):jTe(e,r,o),c=typeof WebGL2RenderingContext<"u"&&a instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=a,this._gl=a,this._webgl2=c,this._id=Ms(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new Cu(this),this._textureCache=new Q_;const u=a;this._stencilBits=u.getParameter(u.STENCIL_BITS),It._maximumCombinedTextureImageUnits=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),It._maximumCubeMapSize=u.getParameter(u.MAX_CUBE_MAP_TEXTURE_SIZE),It._maximumFragmentUniformVectors=u.getParameter(u.MAX_FRAGMENT_UNIFORM_VECTORS),It._maximumTextureImageUnits=u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS),It._maximumRenderbufferSize=u.getParameter(u.MAX_RENDERBUFFER_SIZE),It._maximumTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),It._maximumVaryingVectors=u.getParameter(u.MAX_VARYING_VECTORS),It._maximumVertexAttributes=u.getParameter(u.MAX_VERTEX_ATTRIBS),It._maximumVertexTextureImageUnits=u.getParameter(u.MAX_VERTEX_TEXTURE_IMAGE_UNITS),It._maximumVertexUniformVectors=u.getParameter(u.MAX_VERTEX_UNIFORM_VECTORS),It._maximumSamples=this._webgl2?u.getParameter(u.MAX_SAMPLES):0;const d=u.getParameter(u.ALIASED_LINE_WIDTH_RANGE);It._minimumAliasedLineWidth=d[0],It._maximumAliasedLineWidth=d[1];const h=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);It._minimumAliasedPointSize=h[0],It._maximumAliasedPointSize=h[1];const m=u.getParameter(u.MAX_VIEWPORT_DIMS);It._maximumViewportWidth=m[0],It._maximumViewportHeight=m[1];const g=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);It._highpFloatSupported=g.precision!==0;const p=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_INT);It._highpIntSupported=p.rangeMax!==0,this._antialias=u.getContextAttributes().antialias,this._standardDerivatives=!!Yo(u,["OES_standard_derivatives"]),this._blendMinmax=!!Yo(u,["EXT_blend_minmax"]),this._elementIndexUint=!!Yo(u,["OES_element_index_uint"]),this._depthTexture=!!Yo(u,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!Yo(u,["EXT_frag_depth"]),this._debugShaders=Yo(u,["WEBGL_debug_shaders"]),this._textureFloat=!!Yo(u,["OES_texture_float"]),this._textureHalfFloat=!!Yo(u,["OES_texture_half_float"]),this._textureFloatLinear=!!Yo(u,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!Yo(u,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!Yo(u,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!Yo(u,["EXT_float_blend"]),this._colorBufferHalfFloat=!!Yo(u,["EXT_color_buffer_half_float"]),this._s3tc=!!Yo(u,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!Yo(u,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!Yo(u,["WEBGL_compressed_texture_astc"]),this._etc=!!Yo(u,["WEBG_compressed_texture_etc"]),this._etc1=!!Yo(u,["WEBGL_compressed_texture_etc1"]),this._bc7=!!Yo(u,["EXT_texture_compression_bptc"]),K_.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const y=s?Yo(u,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=y,It._maximumTextureFilterAnisotropy=l(y)?u.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let b,C,E,w,S,P,L,z,R,F;if(c){const _=this;b=function(){return _._gl.createVertexArray()},C=function(v){_._gl.bindVertexArray(v)},E=function(v){_._gl.deleteVertexArray(v)},w=function(v,O,N,V,k){u.drawElementsInstanced(v,O,N,V,k)},S=function(v,O,N,V){u.drawArraysInstanced(v,O,N,V)},P=function(v,O){u.vertexAttribDivisor(v,O)},L=function(v){u.drawBuffers(v)}}else z=Yo(u,["OES_vertex_array_object"]),l(z)&&(b=function(){return z.createVertexArrayOES()},C=function(_){z.bindVertexArrayOES(_)},E=function(_){z.deleteVertexArrayOES(_)}),R=Yo(u,["ANGLE_instanced_arrays"]),l(R)&&(w=function(_,v,O,N,V){R.drawElementsInstancedANGLE(_,v,O,N,V)},S=function(_,v,O,N){R.drawArraysInstancedANGLE(_,v,O,N)},P=function(_,v){R.vertexAttribDivisorANGLE(_,v)}),F=Yo(u,["WEBGL_draw_buffers"]),l(F)&&(L=function(_){F.drawBuffersWEBGL(_)});this.glCreateVertexArray=b,this.glBindVertexArray=C,this.glDeleteVertexArray=E,this.glDrawElementsInstanced=w,this.glDrawArraysInstanced=S,this.glVertexAttribDivisor=P,this.glDrawBuffers=L,this._vertexArrayObject=!!z,this._instancedArrays=!!R,this._drawBuffers=!!F,It._maximumDrawBuffers=this.drawBuffers?u.getParameter(ae.MAX_DRAW_BUFFERS):1,It._maximumColorAttachments=this.drawBuffers?u.getParameter(ae.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new H(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const U=new O0,D=new J_(this),I=et.fromCache();this._defaultPassState=D,this._defaultRenderState=I,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=U,this._currentRenderState=I,this._currentPassState=D,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let _=0;_<It._maximumVertexAttributes;_++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:i,requestWebgl1:o,webgl:r,allowTextureFilterAnisotropic:s},this.cache={},et.apply(u,I,D)}function jTe(e,t,n){if(typeof WebGLRenderingContext>"u")throw new Ie("The browser does not support WebGL. Visit http://get.webgl.org.");!n&&!(typeof WebGL2RenderingContext<"u")&&(n=!0);const o=n?"webgl":"webgl2",r=e.getContext(o,t);if(!l(r))throw new Ie("The browser supports WebGL, but initialization failed.");return r}function qTe(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 $Te(e,t,n,i){let o=`${qTe(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function YTe(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new Ie($Te(e,t,n,i))}function XTe(e,t,n){return{get:function(){const i=e[t];return n(e,`get: ${t}`,i),e[t]},set:function(i){e[t]=i,n(e,`set: ${t}`,i)}}}function KTe(e,t){if(!l(t))return e;function n(o){return function(){const r=o.apply(e,arguments);return t(e,o,arguments),r}}const i={};for(const o in e){const r=e[o];r instanceof Function?i[o]=n(r):Object.defineProperty(i,o,XTe(e,o,t))}return i}function Yo(e,t){const n=t.length;for(let i=0;i<n;++i){const o=e.getExtension(t[i]);if(o)return o}}const JTe={};Object.defineProperties(Ja.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=KTe(this._originalGLContext,e?YTe:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new Wt({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 Wt({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 Wt({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){const e={width:1,height:1,arrayBufferView:new Uint8Array([255,255,255,255])};this._defaultCubeMap=new bu({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 JTe}}});function QTe(e){if(e.validateFramebuffer){const t=e._gl,n=t.checkFramebufferStatus(t.FRAMEBUFFER);if(n!==t.FRAMEBUFFER_COMPLETE){let i;switch(n){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:i="Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";break;case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:i="Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";break;case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:i="Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";break;case t.FRAMEBUFFER_UNSUPPORTED:i="Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";break}throw new x(i)}}}function Iq(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,et.partialApply(e._gl,o,t,r,n,i)}let pM;typeof WebGLRenderingContext<"u"&&(pM=[ae.BACK]);function mM(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=pM;if(l(t))t._bind(),QTe(e),n=t._getActiveColorAttachments();else{const i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}const ZTe=new co;Ja.prototype.clear=function(e,t){e=A(e,ZTe),t=A(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;l(o)&&(H.equals(this._clearColor,o)||(H.clone(o,this._clearColor),n.clearColor(o.red,o.green,o.blue,o.alpha)),i|=n.COLOR_BUFFER_BIT),l(r)&&(r!==this._clearDepth&&(this._clearDepth=r,n.clearDepth(r)),i|=n.DEPTH_BUFFER_BIT),l(s)&&(s!==this._clearStencil&&(this._clearStencil=s,n.clearStencil(s)),i|=n.STENCIL_BUFFER_BIT);const a=A(e.renderState,this._defaultRenderState);Iq(this,a,t,!0);const c=A(e.framebuffer,t.framebuffer);mM(this,c),n.clear(i)};function eEe(e,t,n,i,o){if(l(t)&&o.depthTest&&o.depthTest.enabled&&!t.hasDepthAttachment)throw new x("The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer.");mM(e,t),Iq(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function tEe(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const c=t.instanceCount;if(!Ze.validate(o))throw new x("drawCommand.primitiveType is required and must be valid.");if(T.defined("drawCommand.vertexArray",r),T.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),l(a)&&T.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),T.typeOf.number.greaterThanOrEquals("drawCommand.instanceCount",c,0),c>0&&!e.instancedArrays)throw new x("Instanced arrays extension is not supported");e._us.model=A(t._modelMatrix,B.IDENTITY),n._setUniforms(i,e._us,e.validateShaderProgram),r._bind();const u=r.indexBuffer;l(u)?(s=s*u.bytesPerIndex,a=A(a,u.numberOfIndices),c===0?e._gl.drawElements(o,a,u.indexDatatype,s):e.glDrawElementsInstanced(o,a,u.indexDatatype,s,c)):(a=A(a,r.numberOfVertices),c===0?e._gl.drawArrays(o,s,a):e.glDrawArraysInstanced(o,s,a,c)),r._unBind()}Ja.prototype.draw=function(e,t,n,i){T.defined("drawCommand",e),T.defined("drawCommand.shaderProgram",e._shaderProgram),t=A(t,this._defaultPassState);const o=A(e._framebuffer,t.framebuffer),r=A(e._renderState,this._defaultRenderState);n=A(n,e._shaderProgram),i=A(i,e._uniformMap),eEe(this,o,t,n,r),tEe(this,e,n,i)};Ja.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=pM;this.drawBuffers&&this.glDrawBuffers(t);const 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)};Ja.prototype.readPixels=function(e){const t=this._gl;e=A(e,A.EMPTY_OBJECT);const n=Math.max(A(e.x,0),0),i=Math.max(A(e.y,0),0),o=A(e.width,t.drawingBufferWidth),r=A(e.height,t.drawingBufferHeight),s=e.framebuffer;T.typeOf.number.greaterThan("readState.width",o,0),T.typeOf.number.greaterThan("readState.height",r,0);let a=Qe.UNSIGNED_BYTE;l(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);const c=rt.createTypedArray(rt.RGBA,a,o,r);return mM(this,s),t.readPixels(n,i,o,r,rt.RGBA,Qe.toWebGLConstant(a,this),c),c};const Pq={position:0,textureCoordinates:1};Ja.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!l(e)){const t=new Lt({attributes:{position:new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:Ze.TRIANGLES});e=ho.fromGeometry({context:this,geometry:t,attributeLocations:Pq,bufferUsage:nt.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Ja.prototype.createViewportQuadCommand=function(e,t){return t=A(t,A.EMPTY_OBJECT),new mt({vertexArray:this.getViewportQuadVertexArray(),primitiveType:Ze.TRIANGLES,renderState:t.renderState,shaderProgram:Cn.fromCache({context:this,vertexShaderSource:aj,fragmentShaderSource:e,attributeLocations:Pq}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Ja.prototype.getObjectByPickColor=function(e){return T.defined("pickColor",e),this._pickObjects[e.toRgba()]};function _M(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(_M.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});_M.prototype.destroy=function(){delete this._pickObjects[this.key]};Ja.prototype.createPickId=function(e){T.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(t===0)throw new Ie("Out of unique Pick IDs.");return this._pickObjects[t]=e,new _M(this._pickObjects,t,H.fromRgba(t))};Ja.prototype.isDestroyed=function(){return!1};Ja.prototype.destroy=function(){const e=this.cache;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];l(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(),He(this)};Ja._deprecationWarning=$p;function L0(e){e=A(e,A.EMPTY_OBJECT);const t=e.context,n=e.width,i=e.height;T.defined("options.context",t),T.defined("options.width",n),T.defined("options.height",i),this._width=n,this._height=i;const o=e.colorRenderbuffers,r=e.colorTextures;if(l(o)!==l(r))throw new x("Both color renderbuffer and texture attachments must be provided.");const s=e.depthStencilRenderbuffer,a=e.depthStencilTexture;if(l(s)!==l(a))throw new x("Both depth-stencil renderbuffer and texture attachments must be provided.");this._renderFramebuffer=new Yr({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new Yr({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}L0.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};L0.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};L0.prototype.blitFramebuffers=function(e,t){this._renderFramebuffer.bindRead(),this._colorFramebuffer.bindDraw();const n=e._gl;let i=0;this._colorFramebuffer._colorTextures.length>0&&(i|=n.COLOR_BUFFER_BIT),l(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)};L0.prototype.isDestroyed=function(){return!1};L0.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),He(this)};const ka={RGBA4:ae.RGBA4,RGBA8:ae.RGBA8,RGBA16F:ae.RGBA16F,RGBA32F:ae.RGBA32F,RGB5_A1:ae.RGB5_A1,RGB565:ae.RGB565,DEPTH_COMPONENT16:ae.DEPTH_COMPONENT16,STENCIL_INDEX8:ae.STENCIL_INDEX8,DEPTH_STENCIL:ae.DEPTH_STENCIL,DEPTH24_STENCIL8:ae.DEPTH24_STENCIL8,validate:function(e){return e===ka.RGBA4||e===ka.RGBA8||e===ka.RGBA16F||e===ka.RGBA32F||e===ka.RGB5_A1||e===ka.RGB565||e===ka.DEPTH_COMPONENT16||e===ka.STENCIL_INDEX8||e===ka.DEPTH_STENCIL||e===ka.DEPTH24_STENCIL8},getColorFormat:function(e){return e===ae.FLOAT?ka.RGBA32F:e===ae.HALF_FLOAT_OES?ka.RGBA16F:ka.RGBA8}},af=Object.freeze(ka);function Xl(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.context",e.context);const n=e.context._gl,i=It.maximumRenderbufferSize,o=A(e.format,af.RGBA4),r=l(e.width)?e.width:n.drawingBufferWidth,s=l(e.height)?e.height:n.drawingBufferHeight,a=A(e.numSamples,1);if(!af.validate(o))throw new x("Invalid format.");if(T.typeOf.number.greaterThan("width",r,0),r>i)throw new x(`Width must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);if(T.typeOf.number.greaterThan("height",s,0),s>i)throw new x(`Height must be less than or equal to the maximum renderbuffer size (${i}). Check maximumRenderbufferSize.`);this._gl=n,this._format=o,this._width=r,this._height=s,this._renderbuffer=this._gl.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,this._renderbuffer),a>1?n.renderbufferStorageMultisample(n.RENDERBUFFER,a,o,r,s):n.renderbufferStorage(n.RENDERBUFFER,o,r,s),n.bindRenderbuffer(n.RENDERBUFFER,null)}Object.defineProperties(Xl.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});Xl.prototype._getRenderbuffer=function(){return this._renderbuffer};Xl.prototype.isDestroyed=function(){return!1};Xl.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),He(this)};function Ln(e){if(e=A(e,A.EMPTY_OBJECT),this._numSamples=A(e.numSamples,1),this._colorAttachmentsLength=A(e.colorAttachmentsLength,1),this._color=A(e.color,!0),this._depth=A(e.depth,!1),this._depthStencil=A(e.depthStencil,!1),this._supportsDepthTexture=A(e.supportsDepthTexture,!1),!this._color&&!this._depth&&!this._depthStencil)throw new x("Must enable at least one type of framebuffer attachment.");if(this._depth&&this._depthStencil)throw new x("Cannot have both a depth and depth-stencil attachment.");this._createColorAttachments=A(e.createColorAttachments,!0),this._createDepthAttachments=A(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(Ln.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}}});Ln.prototype.isDirty=function(e,t,n,i,o){n=A(n,1);const r=this._width!==e||this._height!==t,s=this._numSamples!==n,a=l(i)&&this._pixelDatatype!==i||l(o)&&this._pixelFormat!==o,c=l(n===1?this._framebuffer:this._multisampleFramebuffer);return this._attachmentsDirty||r||s||a||!c||this._color&&!l(this._colorTextures[0])};Ln.prototype.update=function(e,t,n,i,o,r){if(!l(t)||!l(n))throw new x("width and height must be defined.");if(i=e.msaa?A(i,1):1,o=A(o,this._color?A(this._pixelDatatype,Qe.UNSIGNED_BYTE):void 0),r=A(r,this._color?A(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 Wt({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:ii.NEAREST}),this._numSamples>1){const a=af.getColorFormat(o);this._colorRenderbuffers[s]=new Xl({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new Wt({context:e,width:t,height:n,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Qe.UNSIGNED_INT_24_8,sampler:ii.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new Xl({context:e,width:t,height:n,format:af.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new Xl({context:e,width:t,height:n,format:af.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new Wt({context:e,width:t,height:n,pixelFormat:rt.DEPTH_COMPONENT,pixelDatatype:Qe.UNSIGNED_INT,sampler:ii.NEAREST}):this._depthRenderbuffer=new Xl({context:e,width:t,height:n,format:af.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new L0({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 Yr({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};Ln.prototype.getColorTexture=function(e){if(e=A(e,0),e>=this._colorAttachmentsLength)throw new x("index must be smaller than total number of color attachments.");return this._colorTextures[e]};Ln.prototype.setColorTexture=function(e,t){if(t=A(t,0),this._createColorAttachments)throw new x("createColorAttachments must be false if setColorTexture is called.");if(t>=this._colorAttachmentsLength)throw new x("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorTextures[t],this._colorTextures[t]=e};Ln.prototype.getColorRenderbuffer=function(e){if(e=A(e,0),e>=this._colorAttachmentsLength)throw new x("index must be smaller than total number of color attachments.");return this._colorRenderbuffers[e]};Ln.prototype.setColorRenderbuffer=function(e,t){if(t=A(t,0),this._createColorAttachments)throw new x("createColorAttachments must be false if setColorRenderbuffer is called.");if(t>=this._colorAttachmentsLength)throw new x("index must be smaller than total number of color attachments.");this._attachmentsDirty=e!==this._colorRenderbuffers[t],this._colorRenderbuffers[t]=e};Ln.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};Ln.prototype.setDepthRenderbuffer=function(e){if(this._createDepthAttachments)throw new x("createDepthAttachments must be false if setDepthRenderbuffer is called.");this._attachmentsDirty=e!==this._depthRenderbuffer,this._depthRenderbuffer=e};Ln.prototype.getDepthTexture=function(){return this._depthTexture};Ln.prototype.setDepthTexture=function(e){if(this._createDepthAttachments)throw new x("createDepthAttachments must be false if setDepthTexture is called.");this._attachmentsDirty=e!==this._depthTexture,this._depthTexture=e};Ln.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};Ln.prototype.setDepthStencilRenderbuffer=function(e){if(this._createDepthAttachments)throw new x("createDepthAttachments must be false if setDepthStencilRenderbuffer is called.");this._attachmentsDirty=e!==this._depthStencilRenderbuffer,this._depthStencilRenderbuffer=e};Ln.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};Ln.prototype.setDepthStencilTexture=function(e){if(this._createDepthAttachments)throw new x("createDepthAttachments must be false if setDepthStencilTexture is called.");this._attachmentsDirty=e!==this._depthStencilTexture,this._depthStencilTexture=e};Ln.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};Ln.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};Ln.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};Ln.prototype.destroy=function(){if(this._color){let e;const t=this._colorTextures.length;for(e=0;e<t;++e){const n=this._colorTextures[e];this._createColorAttachments&&l(n)&&!n.isDestroyed()&&(this._colorTextures[e].destroy(),this._colorTextures[e]=void 0),l(n)&&n.isDestroyed()&&(this._colorTextures[e]=void 0);const i=this._colorRenderbuffers[e];this._createColorAttachments&&l(i)&&!i.isDestroyed()&&(this._colorRenderbuffers[e].destroy(),this._colorRenderbuffers[e]=void 0),l(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()),l(this._depthStencilTexture)&&this._depthStencilTexture.isDestroyed()&&(this._depthStencilTexture=void 0),l(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()),l(this._depthTexture)&&this._depthTexture.isDestroyed()&&(this._depthTexture=void 0),l(this._depthRenderbuffer)&&this._depthRenderbuffer.isDestroyed()&&(this._depthRenderbuffer=void 0)),this.destroyFramebuffer()};const f_={VERTEX:0,FRAGMENT:1,BOTH:2};f_.includesVertexShader=function(e){return T.typeOf.number("destination",e),e===f_.VERTEX||e===f_.BOTH};f_.includesFragmentShader=function(e){return T.typeOf.number("destination",e),e===f_.FRAGMENT||e===f_.BOTH};const De=Object.freeze(f_);function gM(e){this.name=e,this.fields=[]}gM.prototype.addField=function(e,t){const n=` ${e} ${t};`;this.fields.push(n)};gM.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};function yM(e){this.signature=e,this.body=[]}yM.prototype.addLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new x(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this.body;if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;i++)t.push(` ${e[i]}`)}else t.push(` ${e}`)};yM.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};function _a(){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(_a.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});_a.prototype.addDefine=function(e,t,n){T.typeOf.string("identifier",e),n=A(n,De.BOTH);let i=e;l(t)&&(i+=` ${t.toString()}`),De.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),De.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};_a.prototype.addStruct=function(e,t,n){T.typeOf.string("structId",e),T.typeOf.string("structName",t),T.typeOf.number("destination",n),this._structs[e]=new gM(t),De.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),De.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};_a.prototype.addStructField=function(e,t,n){T.typeOf.string("structId",e),T.typeOf.string("type",t),T.typeOf.string("identifier",n),this._structs[e].addField(t,n)};_a.prototype.addFunction=function(e,t,n){T.typeOf.string("functionName",e),T.typeOf.string("signature",t),T.typeOf.number("destination",n),this._functions[e]=new yM(t),De.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),De.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};_a.prototype.addFunctionLines=function(e,t){if(T.typeOf.string("functionName",e),typeof t!="string"&&!Array.isArray(t))throw new x(`Expected lines to be a string or an array of strings, actual value was ${t}`);this._functions[e].addLines(t)};_a.prototype.addUniform=function(e,t,n){T.typeOf.string("type",e),T.typeOf.string("identifier",t),n=A(n,De.BOTH);const i=`uniform ${e} ${t};`;De.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),De.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};_a.prototype.setPositionAttribute=function(e,t){if(T.typeOf.string("type",e),T.typeOf.string("identifier",t),l(this._positionAttributeLine))throw new x("setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()");return this._positionAttributeLine=`attribute ${e} ${t};`,this._attributeLocations[t]=0,0};_a.prototype.addAttribute=function(e,t){T.typeOf.string("type",e),T.typeOf.string("identifier",t);const n=`attribute ${e} ${t};`;this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=iEe(e),i};_a.prototype.addVarying=function(e,t){T.typeOf.string("type",e),T.typeOf.string("identifier",t);const n=`varying ${e} ${t};`;this._vertexShaderParts.varyingLines.push(n),this._fragmentShaderParts.varyingLines.push(n)};_a.prototype.addVertexLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new x(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._vertexShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};_a.prototype.addFragmentLines=function(e){if(typeof e!="string"&&!Array.isArray(e))throw new x(`Expected lines to be a string or an array of strings, actual value was ${e}`);const t=this._fragmentShaderParts.shaderLines;Array.isArray(e)?t.push.apply(t,e):t.push(e)};_a.prototype.buildShaderProgram=function(e){T.typeOf.object("context",e);const t=l(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=nEe(this),i=oEe(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
|
||
`),r=new We({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
|
||
`),a=new We({defines:this._fragmentShaderParts.defineLines,sources:[s]});return Cn.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};_a.prototype.clone=function(){return ht(this,!0)};function nEe(e){const t=[],n=[];let 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 iEe(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function oEe(e){const t=[],n=[];let 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}}function Rr(e,t,n,i){if(T.defined("context",e),!t||t.length===0)throw new x("At least one attribute is required.");const o=Rr._verifyAttributes(t);n=A(n,0);const r=[],s={};let a,c;const u=o.length;for(let h=0;h<u;++h){const m=o[h];if(m.vertexBuffer){r.push(m);continue}c=m.usage,a=s[c],l(a)||(a=s[c]=[]),a.push(m)}function d(h,m){return ee.getSizeInBytes(m.componentDatatype)-ee.getSizeInBytes(h.componentDatatype)}this._allBuffers=[];for(c in s)if(s.hasOwnProperty(c)){a=s[c],a.sort(d);const h=Rr._vertexSizeInBytes(a),m=a[0].usage,g={vertexSizeInBytes:h,vertexBuffer:void 0,usage:m,needsCommit:!1,arrayBuffer:void 0,arrayViews:Rr._createArrayViews(a,h)};this._allBuffers.push(g)}this._size=0,this._instanced=A(i,!1),this._precreated=r,this._context=e,this.writers=void 0,this.va=void 0,this.resize(n)}Rr._verifyAttributes=function(e){const t=[];for(let i=0;i<e.length;++i){const o=e[i],r={index:A(o.index,i),enabled:A(o.enabled,!0),componentsPerAttribute:o.componentsPerAttribute,componentDatatype:A(o.componentDatatype,ee.FLOAT),normalize:A(o.normalize,!1),vertexBuffer:o.vertexBuffer,usage:A(o.usage,nt.STATIC_DRAW)};if(t.push(r),r.componentsPerAttribute!==1&&r.componentsPerAttribute!==2&&r.componentsPerAttribute!==3&&r.componentsPerAttribute!==4)throw new x("attribute.componentsPerAttribute must be in the range [1, 4].");const s=r.componentDatatype;if(!ee.validate(s))throw new x("Attribute must have a valid componentDatatype or not specify it.");if(!nt.validate(r.usage))throw new x("Attribute must have a valid usage or not specify it.")}const n=new Array(t.length);for(let i=0;i<t.length;++i){const r=t[i].index;if(n[r])throw new x(`Index ${r} is used by more than one attribute.`);n[r]=!0}return t};Rr._vertexSizeInBytes=function(e){let t=0;const n=e.length;for(let s=0;s<n;++s){const a=e[s];t+=a.componentsPerAttribute*ee.getSizeInBytes(a.componentDatatype)}const i=n>0?ee.getSizeInBytes(e[0].componentDatatype):0,o=i>0?t%i:0,r=o===0?0:i-o;return t+=r,t};Rr._createArrayViews=function(e,t){const n=[];let i=0;const o=e.length;for(let r=0;r<o;++r){const 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/ee.getSizeInBytes(a),view:void 0}),i+=s.componentsPerAttribute*ee.getSizeInBytes(a)}return n};Rr.prototype.resize=function(e){this._size=e;const t=this._allBuffers;this.writers=[];for(let n=0,i=t.length;n<i;++n){const o=t[n];Rr._resize(o,this._size),Rr._appendWriters(this.writers,o)}AM(this)};Rr._resize=function(e,t){if(e.vertexSizeInBytes>0){const n=new ArrayBuffer(t*e.vertexSizeInBytes);if(l(e.arrayBuffer)){const r=new Uint8Array(n),s=new Uint8Array(e.arrayBuffer),a=s.length;for(let c=0;c<a;++c)r[c]=s[c]}const i=e.arrayViews,o=i.length;for(let r=0;r<o;++r){const s=i[r];s.view=ee.createArrayBufferView(s.componentDatatype,n,s.offsetInBytes)}e.arrayBuffer=n}};const rEe=[function(e,t,n){return function(i,o){t[i*n]=o,e.needsCommit=!0}},function(e,t,n){return function(i,o,r){const s=i*n;t[s]=o,t[s+1]=r,e.needsCommit=!0}},function(e,t,n){return function(i,o,r,s){const 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){const c=i*n;t[c]=o,t[c+1]=r,t[c+2]=s,t[c+3]=a,e.needsCommit=!0}}];Rr._appendWriters=function(e,t){const n=t.arrayViews,i=n.length;for(let o=0;o<i;++o){const r=n[o];e[r.index]=rEe[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};Rr.prototype.commit=function(e){let t=!1;const n=this._allBuffers;let i,o,r;for(o=0,r=n.length;o<r;++o)i=n[o],t=sEe(this,i)||t;if(t||!l(this.va)){AM(this);const s=this.va=[],a=M.SIXTY_FOUR_KILOBYTES-4,c=l(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let u=0;u<c;++u){let d=[];for(o=0,r=n.length;o<r;++o){i=n[o];const h=u*(i.vertexSizeInBytes*a);Rr._appendAttributes(d,i,h,this._instanced)}d=d.concat(this._precreated),s.push({va:new ho({context:this._context,attributes:d,indexBuffer:e}),indicesCount:1.5*(u!==c-1?a:this._size%a)})}}};function sEe(e,t){if(t.needsCommit&&t.vertexSizeInBytes>0){t.needsCommit=!1;const n=t.vertexBuffer,i=e._size*t.vertexSizeInBytes,o=l(n);if(!o||n.sizeInBytes<i)return o&&n.destroy(),t.vertexBuffer=Tt.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}Rr._appendAttributes=function(e,t,n,i){const o=t.arrayViews,r=o.length;for(let s=0;s<r;++s){const 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})}};Rr.prototype.subCommit=function(e,t){if(e<0||e>=this._size)throw new x("offsetInVertices must be greater than or equal to zero and less than the vertex array size.");if(e+t>this._size)throw new x("offsetInVertices + lengthInVertices cannot exceed the vertex array size.");const n=this._allBuffers;for(let i=0,o=n.length;i<o;++i)aEe(n[i],e,t)};function aEe(e,t,n){if(e.needsCommit&&e.vertexSizeInBytes>0){const i=e.vertexSizeInBytes*t,o=e.vertexSizeInBytes*n;e.vertexBuffer.copyFromArrayView(new Uint8Array(e.arrayBuffer,i,o),i)}}Rr.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function AM(e){const t=e.va;if(!l(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].va.destroy();e.va=void 0}Rr.prototype.isDestroyed=function(){return!1};Rr.prototype.destroy=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t){const i=e[t];i.vertexBuffer=i.vertexBuffer&&i.vertexBuffer.destroy()}return AM(this),He(this)};function cEe(e,t,n){if(T.defined("context",e),!l(t)||!l(t.positiveX)||!l(t.negativeX)||!l(t.positiveY)||!l(t.negativeY)||!l(t.positiveZ)||!l(t.negativeZ))throw new x("urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");const i={flipY:!0,skipColorSpaceConversion:n,preferImageBitmap:!0},o=[Me.createIfNeeded(t.positiveX).fetchImage(i),Me.createIfNeeded(t.negativeX).fetchImage(i),Me.createIfNeeded(t.positiveY).fetchImage(i),Me.createIfNeeded(t.negativeY).fetchImage(i),Me.createIfNeeded(t.positiveZ).fetchImage(i),Me.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new bu({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}const YU=`#ifdef MRT
|
||
#extension GL_EXT_draw_buffers : enable
|
||
#endif
|
||
|
||
uniform vec4 u_bgColor;
|
||
uniform sampler2D u_depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)
|
||
{
|
||
#ifdef MRT
|
||
gl_FragData[0] = u_bgColor;
|
||
gl_FragData[1] = vec4(u_bgColor.a);
|
||
#else
|
||
gl_FragColor = u_bgColor;
|
||
#endif
|
||
return;
|
||
}
|
||
|
||
discard;
|
||
}
|
||
`,WS=`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);
|
||
}
|
||
`,lEe=`#ifdef GL_OES_standard_derivatives
|
||
#extension GL_OES_standard_derivatives : enable
|
||
#endif
|
||
|
||
uniform sampler2D u_atlas;
|
||
|
||
#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
varying vec4 v_pickColor;
|
||
varying vec4 v_color;
|
||
|
||
#ifdef SDF
|
||
varying vec4 v_outlineColor;
|
||
varying float v_outlineWidth;
|
||
#endif
|
||
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
varying vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates
|
||
varying vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs)
|
||
varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||
varying 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(texture2D(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 texture2D(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 = texture2D(u_atlas, v_textureCoordinates);
|
||
|
||
#ifdef SDF
|
||
float outlineWidth = v_outlineWidth;
|
||
vec4 outlineColor = v_outlineColor;
|
||
|
||
// Get the current distance
|
||
float distance = getDistance(v_textureCoordinates);
|
||
|
||
#ifdef 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
|
||
// 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
|
||
gl_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
|
||
|
||
}
|
||
`,uEe=`#ifdef INSTANCED
|
||
attribute vec2 direction;
|
||
#endif
|
||
attribute vec4 positionHighAndScale;
|
||
attribute vec4 positionLowAndRotation;
|
||
attribute vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
|
||
attribute vec4 compressedAttribute1; // aligned axis, translucency by distance, image width
|
||
attribute vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
|
||
attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)
|
||
attribute vec4 scaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions
|
||
attribute vec2 sdf; // sdf outline color (rgb) and width (w)
|
||
#if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
|
||
attribute vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates
|
||
#endif
|
||
#ifdef VECTOR_TILE
|
||
attribute float a_batchId;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
#ifdef FRAGMENT_DEPTH_CHECK
|
||
varying vec4 v_textureCoordinateBounds;
|
||
varying vec4 v_originTextureCoordinateAndTranslate;
|
||
varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||
varying mat2 v_rotationMatrix;
|
||
#endif
|
||
|
||
varying vec4 v_pickColor;
|
||
varying vec4 v_color;
|
||
#ifdef SDF
|
||
varying vec4 v_outlineColor;
|
||
varying 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(texture2D(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;
|
||
|
||
}
|
||
`,dEe=`varying 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()
|
||
{
|
||
gl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
|
||
}
|
||
`,fEe=`uniform sampler2D u_opaqueDepthTexture;
|
||
uniform sampler2D u_translucentDepthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
float opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;
|
||
float translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;
|
||
translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);
|
||
gl_FragColor = czm_packDepth(translucentDepth);
|
||
}
|
||
`,hEe=`/**
|
||
* 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;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 opaque = texture2D(u_opaque, v_textureCoordinates);
|
||
vec4 accum = texture2D(u_accumulation, v_textureCoordinates);
|
||
float r = texture2D(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
|
||
|
||
gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;
|
||
|
||
if (opaque != czm_backgroundColor)
|
||
{
|
||
gl_FragColor.a = 1.0;
|
||
}
|
||
}
|
||
`,pEe=`varying 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))
|
||
{
|
||
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
|
||
}
|
||
else
|
||
{
|
||
discard;
|
||
}
|
||
|
||
czm_writeLogDepth();
|
||
}
|
||
`,mEe=`attribute vec4 position;
|
||
|
||
varying vec4 positionEC;
|
||
|
||
void main()
|
||
{
|
||
positionEC = czm_modelView * position;
|
||
gl_Position = czm_projection * positionEC;
|
||
|
||
czm_vertexLogDepth();
|
||
}
|
||
`,XU=`#ifdef WRITE_DEPTH
|
||
#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
#endif
|
||
|
||
uniform vec3 u_radii;
|
||
uniform vec3 u_oneOverEllipsoidRadiiSquared;
|
||
|
||
varying 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);
|
||
|
||
gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);
|
||
gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);
|
||
|
||
#ifdef WRITE_DEPTH
|
||
#ifdef 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_FragDepthEXT = (z * (f - n) + f + n) * 0.5;
|
||
#endif
|
||
#endif
|
||
#endif
|
||
}
|
||
`,KU=`attribute vec3 position;
|
||
|
||
uniform vec3 u_radii;
|
||
|
||
varying 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.
|
||
*/const _Ee=`/**
|
||
* @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) texture2D(t, p)
|
||
// #define FxaaTexOff(t, p, o, r) texture2D(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) texture2D(t, p)
|
||
#define FxaaTexOff(t, p, o, r) texture2D(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);
|
||
}
|
||
`,gEe=`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
|
||
|
||
varying vec3 v_positionMC;
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_textureCoordinates;
|
||
varying vec3 v_normalMC;
|
||
varying vec3 v_normalEC;
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
varying float v_height;
|
||
varying float v_slope;
|
||
varying float v_aspect;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
varying float v_distance;
|
||
#endif
|
||
|
||
#if defined(GROUND_ATMOSPHERE) || defined(FOG)
|
||
varying vec3 v_atmosphereRayleighColor;
|
||
varying vec3 v_atmosphereMieColor;
|
||
varying 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 = texture2D(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 = texture2D(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
|
||
|
||
gl_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
|
||
`,yEe=`#ifdef QUANTIZATION_BITS12
|
||
attribute vec4 compressed0;
|
||
attribute float compressed1;
|
||
#else
|
||
attribute vec4 position3DAndHeight;
|
||
attribute vec4 textureCoordAndEncodedNormals;
|
||
#endif
|
||
|
||
#ifdef GEODETIC_SURFACE_NORMALS
|
||
attribute 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;
|
||
|
||
varying vec3 v_positionMC;
|
||
varying vec3 v_positionEC;
|
||
|
||
varying vec3 v_textureCoordinates;
|
||
varying vec3 v_normalMC;
|
||
varying vec3 v_normalEC;
|
||
|
||
#ifdef APPLY_MATERIAL
|
||
varying float v_slope;
|
||
varying float v_aspect;
|
||
varying float v_height;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
|
||
varying float v_distance;
|
||
#endif
|
||
|
||
#if defined(FOG) || defined(GROUND_ATMOSPHERE)
|
||
varying vec3 v_atmosphereRayleighColor;
|
||
varying vec3 v_atmosphereMieColor;
|
||
varying 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
|
||
}
|
||
`,JU=`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
|
||
);
|
||
}
|
||
`,AEe=`varying 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)
|
||
{
|
||
gl_FragColor = texture2D(texture0, uv);
|
||
}
|
||
else if(mipLevel == 1.0)
|
||
{
|
||
gl_FragColor = texture2D(texture1, uv);
|
||
}
|
||
else if(mipLevel == 2.0)
|
||
{
|
||
gl_FragColor = texture2D(texture2, uv);
|
||
}
|
||
else if(mipLevel == 3.0)
|
||
{
|
||
gl_FragColor = texture2D(texture3, uv);
|
||
}
|
||
else if(mipLevel == 4.0)
|
||
{
|
||
gl_FragColor = texture2D(texture4, uv);
|
||
}
|
||
else if(mipLevel == 5.0)
|
||
{
|
||
gl_FragColor = texture2D(texture5, uv);
|
||
}
|
||
else
|
||
{
|
||
gl_FragColor = vec4(0.0);
|
||
}
|
||
}
|
||
`,bEe=`varying vec3 v_cubeMapCoordinates;
|
||
uniform samplerCube cubeMap;
|
||
|
||
void main()
|
||
{
|
||
vec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);
|
||
#ifdef RGBA_NORMALIZED
|
||
gl_FragColor = vec4(rgba.rgb, 1.0);
|
||
#else
|
||
float m = rgba.a * 16.0;
|
||
vec3 r = rgba.rgb * m;
|
||
gl_FragColor = vec4(r * r, 1.0);
|
||
#endif
|
||
}
|
||
`,CEe=`attribute vec4 position;
|
||
attribute vec3 cubeMapCoordinates;
|
||
|
||
varying vec3 v_cubeMapCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = position;
|
||
v_cubeMapCoordinates = cubeMapCoordinates;
|
||
}
|
||
`,zE=`varying vec4 v_color;
|
||
varying vec4 v_outlineColor;
|
||
varying float v_innerPercent;
|
||
varying float v_pixelDistance;
|
||
varying 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
|
||
|
||
gl_FragColor = czm_gammaCorrect(color);
|
||
czm_writeLogDepth();
|
||
}
|
||
`,TEe=`uniform float u_maxTotalPointSize;
|
||
|
||
attribute vec4 positionHighAndSize;
|
||
attribute vec4 positionLowAndOutline;
|
||
attribute vec4 compressedAttribute0; // color, outlineColor, pick color
|
||
attribute vec4 compressedAttribute1; // show, translucency by distance, some free space
|
||
attribute vec4 scaleByDistance; // near, nearScale, far, farScale
|
||
attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance
|
||
|
||
varying vec4 v_color;
|
||
varying vec4 v_outlineColor;
|
||
varying float v_innerPercent;
|
||
varying float v_pixelDistance;
|
||
varying 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;
|
||
}
|
||
`,hT=`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);
|
||
}
|
||
`,Oq=`#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
varying 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);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#ifdef VECTOR_TILE
|
||
gl_FragColor *= u_highlightColor;
|
||
#endif
|
||
|
||
czm_writeLogDepth();
|
||
}
|
||
`,EEe=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
varying vec4 v_startPlaneNormalEcAndHalfWidth;
|
||
varying vec4 v_endPlaneNormalEcAndBatchId;
|
||
varying vec4 v_rightPlaneEC; // Technically can compute distance for this here
|
||
varying vec4 v_endEcAndStartEcX;
|
||
varying vec4 v_texcoordNormalizationAndStartEcYZ;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif
|
||
|
||
void main(void)
|
||
{
|
||
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(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
|
||
gl_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
|
||
gl_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
|
||
gl_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);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,xEe=`varying vec3 v_forwardDirectionEC;
|
||
varying vec3 v_texcoordNormalizationAndHalfWidth;
|
||
varying float v_batchId;
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#else
|
||
varying vec2 v_alignedPlaneDistances;
|
||
varying 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
|
||
gl_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);
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#endif // PER_INSTANCE_COLOR
|
||
}
|
||
`,wEe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
|
||
attribute vec4 startHiAndForwardOffsetX;
|
||
attribute vec4 startLoAndForwardOffsetY;
|
||
attribute vec4 startNormalAndForwardOffsetZ;
|
||
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
|
||
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
|
||
attribute vec4 startHiLo2D;
|
||
attribute vec4 offsetAndRight2D;
|
||
attribute vec4 startEndNormals2D;
|
||
attribute vec2 texcoordNormalization2D;
|
||
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_forwardDirectionEC;
|
||
varying vec3 v_texcoordNormalizationAndHalfWidth;
|
||
varying float v_batchId;
|
||
|
||
// For materials
|
||
#ifdef WIDTH_VARYING
|
||
varying float v_width;
|
||
#endif
|
||
#ifdef ANGLE_VARYING
|
||
varying float v_polylineAngle;
|
||
#endif
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#else
|
||
varying vec2 v_alignedPlaneDistances;
|
||
varying 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
|
||
}
|
||
`,SEe=`attribute vec3 position3DHigh;
|
||
attribute 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
|
||
attribute vec4 startHiAndForwardOffsetX;
|
||
attribute vec4 startLoAndForwardOffsetY;
|
||
attribute vec4 startNormalAndForwardOffsetZ;
|
||
attribute vec4 endNormalAndTextureCoordinateNormalizationX;
|
||
attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
|
||
#else
|
||
attribute vec4 startHiLo2D;
|
||
attribute vec4 offsetAndRight2D;
|
||
attribute vec4 startEndNormals2D;
|
||
attribute vec2 texcoordNormalization2D;
|
||
#endif
|
||
|
||
attribute float batchId;
|
||
|
||
varying vec4 v_startPlaneNormalEcAndHalfWidth;
|
||
varying vec4 v_endPlaneNormalEcAndBatchId;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying vec4 v_endEcAndStartEcX;
|
||
varying vec4 v_texcoordNormalizationAndStartEcYZ;
|
||
|
||
// For materials
|
||
#ifdef WIDTH_VARYING
|
||
varying float v_width;
|
||
#endif
|
||
#ifdef ANGLE_VARYING
|
||
varying float v_polylineAngle;
|
||
#endif
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying 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
|
||
}
|
||
`,vEe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 position2DHigh;
|
||
attribute vec3 position2DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 prevPosition2DHigh;
|
||
attribute vec3 prevPosition2DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec3 nextPosition2DHigh;
|
||
attribute vec3 nextPosition2DLow;
|
||
attribute vec4 texCoordExpandAndBatchIndex;
|
||
|
||
varying vec2 v_st;
|
||
varying float v_width;
|
||
varying vec4 v_pickColor;
|
||
varying 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;
|
||
}
|
||
`,DEe=`uniform sampler2D u_texture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(u_texture, v_textureCoordinates);
|
||
}
|
||
`,IEe=`attribute vec4 position;
|
||
attribute float webMercatorT;
|
||
|
||
uniform vec2 u_textureDimensions;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
v_textureCoordinates = vec2(position.x, webMercatorT);
|
||
gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));
|
||
}
|
||
`,Lq=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
#ifdef SPHERICAL
|
||
varying vec4 v_sphericalExtents;
|
||
#else // SPHERICAL
|
||
varying vec2 v_inversePlaneExtents;
|
||
varying vec4 v_westPlane;
|
||
varying vec4 v_southPlane;
|
||
#endif // SPHERICAL
|
||
varying vec3 v_uvMinAndSphericalLongitudeRotation;
|
||
varying vec3 v_uMaxAndInverseDistance;
|
||
varying vec3 v_vMaxAndInverseDistance;
|
||
#endif // TEXTURE_COORDINATES
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying 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(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));
|
||
float downOrLeftLogDepth = czm_unpackDepth(texture2D(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(texture2D(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) {
|
||
gl_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource
|
||
czm_writeDepthClamp();
|
||
}
|
||
#else // CULL_FRAGMENTS
|
||
gl_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
|
||
gl_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;
|
||
|
||
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
||
#endif // FLAT
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_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
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else // FLAT
|
||
gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);
|
||
#endif // FLAT
|
||
|
||
// Premultiply alpha. Required for classification primitives on translucent globe.
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
|
||
#endif // PER_INSTANCE_COLOR
|
||
czm_writeDepthClamp();
|
||
#endif // PICK
|
||
}
|
||
`,PEe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute float batchId;
|
||
|
||
#ifdef EXTRUDED_GEOMETRY
|
||
attribute vec3 extrudeDirection;
|
||
|
||
uniform float u_globeMinimumAltitude;
|
||
#endif // EXTRUDED_GEOMETRY
|
||
|
||
#ifdef PER_INSTANCE_COLOR
|
||
varying vec4 v_color;
|
||
#endif // PER_INSTANCE_COLOR
|
||
|
||
#ifdef TEXTURE_COORDINATES
|
||
#ifdef SPHERICAL
|
||
varying vec4 v_sphericalExtents;
|
||
#else // SPHERICAL
|
||
varying vec2 v_inversePlaneExtents;
|
||
varying vec4 v_westPlane;
|
||
varying vec4 v_southPlane;
|
||
#endif // SPHERICAL
|
||
varying vec3 v_uvMinAndSphericalLongitudeRotation;
|
||
varying vec3 v_uMaxAndInverseDistance;
|
||
varying 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);
|
||
}
|
||
`,pB=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
#ifdef VECTOR_TILE
|
||
uniform vec4 u_highlightColor;
|
||
#endif
|
||
|
||
void main(void)
|
||
{
|
||
#ifdef VECTOR_TILE
|
||
gl_FragColor = czm_gammaCorrect(u_highlightColor);
|
||
#else
|
||
gl_FragColor = vec4(1.0);
|
||
#endif
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,QU=`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);
|
||
}
|
||
`,OEe=`varying vec3 v_outerPositionWC;
|
||
|
||
uniform vec3 u_hsbShift;
|
||
|
||
#ifndef PER_FRAGMENT_ATMOSPHERE
|
||
varying vec3 v_mieColor;
|
||
varying vec3 v_rayleighColor;
|
||
varying float v_opacity;
|
||
varying 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);
|
||
}
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`,LEe=`attribute vec4 position;
|
||
|
||
varying vec3 v_outerPositionWC;
|
||
|
||
#ifndef PER_FRAGMENT_ATMOSPHERE
|
||
varying vec3 v_mieColor;
|
||
varying vec3 v_rayleighColor;
|
||
varying float v_opacity;
|
||
varying 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;
|
||
}
|
||
`,BEe=`uniform samplerCube u_cubeMap;
|
||
|
||
varying vec3 v_texCoord;
|
||
|
||
void main()
|
||
{
|
||
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));
|
||
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);
|
||
}
|
||
`,REe=`attribute vec3 position;
|
||
|
||
varying 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;
|
||
}
|
||
`,NEe=`uniform sampler2D u_texture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(u_texture, v_textureCoordinates);
|
||
gl_FragColor = czm_gammaCorrect(color);
|
||
}
|
||
`,MEe=`uniform float u_radiusTS;
|
||
|
||
varying 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;
|
||
|
||
gl_FragColor = clamp(color, vec4(0.0), vec4(1.0));
|
||
}
|
||
`,FEe=`attribute vec2 direction;
|
||
|
||
uniform float u_size;
|
||
|
||
varying 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;
|
||
}
|
||
`,zEe=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
varying vec4 v_startPlaneEC;
|
||
varying vec4 v_endPlaneEC;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying float v_halfWidth;
|
||
varying vec3 v_volumeUpEC;
|
||
|
||
uniform vec4 u_highlightColor;
|
||
void main()
|
||
{
|
||
float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));
|
||
|
||
// Discard for sky
|
||
if (logDepthOrDepth == 0.0) {
|
||
#ifdef DEBUG_SHOW_VOLUME
|
||
gl_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
|
||
gl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);
|
||
return;
|
||
#else // DEBUG_SHOW_VOLUME
|
||
discard;
|
||
#endif // DEBUG_SHOW_VOLUME
|
||
}
|
||
gl_FragColor = u_highlightColor;
|
||
|
||
czm_writeDepthClamp();
|
||
}
|
||
`,UEe=`attribute vec3 startEllipsoidNormal;
|
||
attribute vec3 endEllipsoidNormal;
|
||
attribute vec4 startPositionAndHeight;
|
||
attribute vec4 endPositionAndHeight;
|
||
attribute vec4 startFaceNormalAndVertexCorner;
|
||
attribute vec4 endFaceNormalAndHalfWidth;
|
||
attribute float a_batchId;
|
||
|
||
uniform mat4 u_modifiedModelView;
|
||
uniform vec2 u_minimumMaximumVectorHeights;
|
||
|
||
varying vec4 v_startPlaneEC;
|
||
varying vec4 v_endPlaneEC;
|
||
varying vec4 v_rightPlaneEC;
|
||
varying float v_halfWidth;
|
||
varying 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;
|
||
}
|
||
`,HEe=`attribute vec4 currentPosition;
|
||
attribute vec4 previousPosition;
|
||
attribute vec4 nextPosition;
|
||
attribute vec2 expandAndWidth;
|
||
attribute 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;
|
||
}
|
||
`,ZU=`attribute vec3 position;
|
||
attribute float a_batchId;
|
||
|
||
uniform mat4 u_modifiedModelViewProjection;
|
||
|
||
void main()
|
||
{
|
||
gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));
|
||
}
|
||
`;/*! @license DOMPurify 2.4.1 | (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.1/LICENSE */function Yh(e){return Yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yh(e)}function mB(e,t){return mB=Object.setPrototypeOf||function(i,o){return i.__proto__=o,i},mB(e,t)}function VEe(){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 Fw(e,t,n){return VEe()?Fw=Reflect.construct:Fw=function(o,r,s){var a=[null];a.push.apply(a,r);var c=Function.bind.apply(o,a),u=new c;return s&&mB(u,s.prototype),u},Fw.apply(null,arguments)}function Ul(e){return kEe(e)||GEe(e)||WEe(e)||jEe()}function kEe(e){if(Array.isArray(e))return _B(e)}function GEe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function WEe(e,t){if(e){if(typeof e=="string")return _B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _B(e,t)}}function _B(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function jEe(){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 qEe=Object.hasOwnProperty,e4=Object.setPrototypeOf,$Ee=Object.isFrozen,YEe=Object.getPrototypeOf,XEe=Object.getOwnPropertyDescriptor,Oa=Object.freeze,du=Object.seal,KEe=Object.create,Bq=typeof Reflect<"u"&&Reflect,jS=Bq.apply,gB=Bq.construct;jS||(jS=function(t,n,i){return t.apply(n,i)});Oa||(Oa=function(t){return t});du||(du=function(t){return t});gB||(gB=function(t,n){return Fw(t,Ul(n))});var JEe=_l(Array.prototype.forEach),t4=_l(Array.prototype.pop),dA=_l(Array.prototype.push),zw=_l(String.prototype.toLowerCase),A1=_l(String.prototype.toString),QEe=_l(String.prototype.match),Ll=_l(String.prototype.replace),ZEe=_l(String.prototype.indexOf),exe=_l(String.prototype.trim),Ca=_l(RegExp.prototype.test),b1=txe(TypeError);function _l(e){return function(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return jS(e,t,i)}}function txe(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return gB(e,n)}}function qn(e,t,n){n=n||zw,e4&&e4(e,null);for(var i=t.length;i--;){var o=t[i];if(typeof o=="string"){var r=n(o);r!==o&&($Ee(t)||(t[i]=r),o=r)}e[o]=!0}return e}function pm(e){var t=KEe(null),n;for(n in e)jS(qEe,e,[n])&&(t[n]=e[n]);return t}function UE(e,t){for(;e!==null;){var n=XEe(e,t);if(n){if(n.get)return _l(n.get);if(typeof n.value=="function")return _l(n.value)}e=YEe(e)}function i(o){return console.warn("fallback value for",o),null}return i}var n4=Oa(["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"]),C1=Oa(["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"]),T1=Oa(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nxe=Oa(["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"]),E1=Oa(["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"]),ixe=Oa(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),i4=Oa(["#text"]),o4=Oa(["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"]),x1=Oa(["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"]),r4=Oa(["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"]),HE=Oa(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),oxe=du(/\{\{[\w\W]*|[\w\W]*\}\}/gm),rxe=du(/<%[\w\W]*|[\w\W]*%>/gm),sxe=du(/\${[\w\W]*}/gm),axe=du(/^data-[\-\w.\u00B7-\uFFFF]/),cxe=du(/^aria-[\-\w]+$/),lxe=du(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),uxe=du(/^(?:\w+script|data):/i),dxe=du(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fxe=du(/^html$/i),hxe=function(){return typeof window>"u"?null:window},pxe=function(t,n){if(Yh(t)!=="object"||typeof t.createPolicy!="function")return null;var i=null,o="data-tt-policy-suffix";n.currentScript&&n.currentScript.hasAttribute(o)&&(i=n.currentScript.getAttribute(o));var r="dompurify"+(i?"#"+i:"");try{return t.createPolicy(r,{createHTML:function(a){return a},createScriptURL:function(a){return a}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}};function Rq(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hxe(),t=function(we){return Rq(we)};if(t.version="2.4.1",t.removed=[],!e||!e.document||e.document.nodeType!==9)return t.isSupported=!1,t;var n=e.document,i=e.document,o=e.DocumentFragment,r=e.HTMLTemplateElement,s=e.Node,a=e.Element,c=e.NodeFilter,u=e.NamedNodeMap,d=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,h=e.HTMLFormElement,m=e.DOMParser,g=e.trustedTypes,p=a.prototype,y=UE(p,"cloneNode"),b=UE(p,"nextSibling"),C=UE(p,"childNodes"),E=UE(p,"parentNode");if(typeof r=="function"){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var S=pxe(g,n),P=S?S.createHTML(""):"",L=i,z=L.implementation,R=L.createNodeIterator,F=L.createDocumentFragment,U=L.getElementsByTagName,D=n.importNode,I={};try{I=pm(i).documentMode?i.documentMode:{}}catch{}var _={};t.isSupported=typeof E=="function"&&z&&typeof z.createHTMLDocument<"u"&&I!==9;var v=oxe,O=rxe,N=sxe,V=axe,k=cxe,G=uxe,W=dxe,K=lxe,q=null,te=qn({},[].concat(Ul(n4),Ul(C1),Ul(T1),Ul(E1),Ul(i4))),Y=null,X=qn({},[].concat(Ul(o4),Ul(x1),Ul(r4),Ul(HE))),$=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}})),se=null,ue=null,re=!0,he=!0,ce=!1,Q=!1,ne=!1,de=!1,_e=!1,Se=!1,ve=!1,Le=!1,Ee=!0,Be=!1,Pe="user-content-",Ae=!0,xe=!1,Oe={},Ve=null,Re=qn({},["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"]),At=null,xt=qn({},["audio","video","img","source","image","track"]),Nt=null,On=qn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nn="http://www.w3.org/1998/Math/MathML",Sn="http://www.w3.org/2000/svg",un="http://www.w3.org/1999/xhtml",Ht=un,vn=!1,Pn=null,qt=qn({},[Nn,Sn,un],A1),tn,jn=["application/xhtml+xml","text/html"],hi="text/html",sn,zi=null,oo=i.createElement("form"),Wi=function(we){return we instanceof RegExp||we instanceof Function},li=function(we){zi&&zi===we||((!we||Yh(we)!=="object")&&(we={}),we=pm(we),tn=jn.indexOf(we.PARSER_MEDIA_TYPE)===-1?tn=hi:tn=we.PARSER_MEDIA_TYPE,sn=tn==="application/xhtml+xml"?A1:zw,q="ALLOWED_TAGS"in we?qn({},we.ALLOWED_TAGS,sn):te,Y="ALLOWED_ATTR"in we?qn({},we.ALLOWED_ATTR,sn):X,Pn="ALLOWED_NAMESPACES"in we?qn({},we.ALLOWED_NAMESPACES,A1):qt,Nt="ADD_URI_SAFE_ATTR"in we?qn(pm(On),we.ADD_URI_SAFE_ATTR,sn):On,At="ADD_DATA_URI_TAGS"in we?qn(pm(xt),we.ADD_DATA_URI_TAGS,sn):xt,Ve="FORBID_CONTENTS"in we?qn({},we.FORBID_CONTENTS,sn):Re,se="FORBID_TAGS"in we?qn({},we.FORBID_TAGS,sn):{},ue="FORBID_ATTR"in we?qn({},we.FORBID_ATTR,sn):{},Oe="USE_PROFILES"in we?we.USE_PROFILES:!1,re=we.ALLOW_ARIA_ATTR!==!1,he=we.ALLOW_DATA_ATTR!==!1,ce=we.ALLOW_UNKNOWN_PROTOCOLS||!1,Q=we.SAFE_FOR_TEMPLATES||!1,ne=we.WHOLE_DOCUMENT||!1,Se=we.RETURN_DOM||!1,ve=we.RETURN_DOM_FRAGMENT||!1,Le=we.RETURN_TRUSTED_TYPE||!1,_e=we.FORCE_BODY||!1,Ee=we.SANITIZE_DOM!==!1,Be=we.SANITIZE_NAMED_PROPS||!1,Ae=we.KEEP_CONTENT!==!1,xe=we.IN_PLACE||!1,K=we.ALLOWED_URI_REGEXP||K,Ht=we.NAMESPACE||un,we.CUSTOM_ELEMENT_HANDLING&&Wi(we.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&($.tagNameCheck=we.CUSTOM_ELEMENT_HANDLING.tagNameCheck),we.CUSTOM_ELEMENT_HANDLING&&Wi(we.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&($.attributeNameCheck=we.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),we.CUSTOM_ELEMENT_HANDLING&&typeof we.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&($.allowCustomizedBuiltInElements=we.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Q&&(he=!1),ve&&(Se=!0),Oe&&(q=qn({},Ul(i4)),Y=[],Oe.html===!0&&(qn(q,n4),qn(Y,o4)),Oe.svg===!0&&(qn(q,C1),qn(Y,x1),qn(Y,HE)),Oe.svgFilters===!0&&(qn(q,T1),qn(Y,x1),qn(Y,HE)),Oe.mathMl===!0&&(qn(q,E1),qn(Y,r4),qn(Y,HE))),we.ADD_TAGS&&(q===te&&(q=pm(q)),qn(q,we.ADD_TAGS,sn)),we.ADD_ATTR&&(Y===X&&(Y=pm(Y)),qn(Y,we.ADD_ATTR,sn)),we.ADD_URI_SAFE_ATTR&&qn(Nt,we.ADD_URI_SAFE_ATTR,sn),we.FORBID_CONTENTS&&(Ve===Re&&(Ve=pm(Ve)),qn(Ve,we.FORBID_CONTENTS,sn)),Ae&&(q["#text"]=!0),ne&&qn(q,["html","head","body"]),q.table&&(qn(q,["tbody"]),delete se.tbody),Oa&&Oa(we),zi=we)},mn=qn({},["mi","mo","mn","ms","mtext"]),Kn=qn({},["foreignobject","desc","title","annotation-xml"]),Hn=qn({},["title","style","font","a","script"]),dn=qn({},C1);qn(dn,T1),qn(dn,nxe);var bt=qn({},E1);qn(bt,ixe);var Ge=function(we){var $e=E(we);(!$e||!$e.tagName)&&($e={namespaceURI:Ht,tagName:"template"});var ot=zw(we.tagName),Jn=zw($e.tagName);return Pn[we.namespaceURI]?we.namespaceURI===Sn?$e.namespaceURI===un?ot==="svg":$e.namespaceURI===Nn?ot==="svg"&&(Jn==="annotation-xml"||mn[Jn]):Boolean(dn[ot]):we.namespaceURI===Nn?$e.namespaceURI===un?ot==="math":$e.namespaceURI===Sn?ot==="math"&&Kn[Jn]:Boolean(bt[ot]):we.namespaceURI===un?$e.namespaceURI===Sn&&!Kn[Jn]||$e.namespaceURI===Nn&&!mn[Jn]?!1:!bt[ot]&&(Hn[ot]||!dn[ot]):!!(tn==="application/xhtml+xml"&&Pn[we.namespaceURI]):!1},Mn=function(we){dA(t.removed,{element:we});try{we.parentNode.removeChild(we)}catch{try{we.outerHTML=P}catch{we.remove()}}},Tn=function(we,$e){try{dA(t.removed,{attribute:$e.getAttributeNode(we),from:$e})}catch{dA(t.removed,{attribute:null,from:$e})}if($e.removeAttribute(we),we==="is"&&!Y[we])if(Se||ve)try{Mn($e)}catch{}else try{$e.setAttribute(we,"")}catch{}},Qi=function(we){var $e,ot;if(_e)we="<remove></remove>"+we;else{var Jn=QEe(we,/^[\r\n\t ]+/);ot=Jn&&Jn[0]}tn==="application/xhtml+xml"&&Ht===un&&(we='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+we+"</body></html>");var Zr=S?S.createHTML(we):we;if(Ht===un)try{$e=new m().parseFromString(Zr,tn)}catch{}if(!$e||!$e.documentElement){$e=z.createDocument(Ht,"template",null);try{$e.documentElement.innerHTML=vn?"":Zr}catch{}}var xr=$e.body||$e.documentElement;return we&&ot&&xr.insertBefore(i.createTextNode(ot),xr.childNodes[0]||null),Ht===un?U.call($e,ne?"html":"body")[0]:ne?$e.documentElement:xr},Fn=function(we){return R.call(we.ownerDocument||we,we,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},ji=function(we){return we instanceof h&&(typeof we.nodeName!="string"||typeof we.textContent!="string"||typeof we.removeChild!="function"||!(we.attributes instanceof d)||typeof we.removeAttribute!="function"||typeof we.setAttribute!="function"||typeof we.namespaceURI!="string"||typeof we.insertBefore!="function"||typeof we.hasChildNodes!="function")},Lo=function(we){return Yh(s)==="object"?we instanceof s:we&&Yh(we)==="object"&&typeof we.nodeType=="number"&&typeof we.nodeName=="string"},po=function(we,$e,ot){_[we]&&JEe(_[we],function(Jn){Jn.call(t,$e,ot,zi)})},Ur=function(we){var $e;if(po("beforeSanitizeElements",we,null),ji(we)||Ca(/[\u0080-\uFFFF]/,we.nodeName))return Mn(we),!0;var ot=sn(we.nodeName);if(po("uponSanitizeElement",we,{tagName:ot,allowedTags:q}),we.hasChildNodes()&&!Lo(we.firstElementChild)&&(!Lo(we.content)||!Lo(we.content.firstElementChild))&&Ca(/<[/\w]/g,we.innerHTML)&&Ca(/<[/\w]/g,we.textContent)||ot==="select"&&Ca(/<template/i,we.innerHTML))return Mn(we),!0;if(!q[ot]||se[ot]){if(!se[ot]&&qi(ot)&&($.tagNameCheck instanceof RegExp&&Ca($.tagNameCheck,ot)||$.tagNameCheck instanceof Function&&$.tagNameCheck(ot)))return!1;if(Ae&&!Ve[ot]){var Jn=E(we)||we.parentNode,Zr=C(we)||we.childNodes;if(Zr&&Jn)for(var xr=Zr.length,_r=xr-1;_r>=0;--_r)Jn.insertBefore(y(Zr[_r],!0),b(we))}return Mn(we),!0}return we instanceof a&&!Ge(we)||(ot==="noscript"||ot==="noembed")&&Ca(/<\/no(script|embed)/i,we.innerHTML)?(Mn(we),!0):(Q&&we.nodeType===3&&($e=we.textContent,$e=Ll($e,v," "),$e=Ll($e,O," "),$e=Ll($e,N," "),we.textContent!==$e&&(dA(t.removed,{element:we.cloneNode()}),we.textContent=$e)),po("afterSanitizeElements",we,null),!1)},Zi=function(we,$e,ot){if(Ee&&($e==="id"||$e==="name")&&(ot in i||ot in oo))return!1;if(!(he&&!ue[$e]&&Ca(V,$e))){if(!(re&&Ca(k,$e))){if(!Y[$e]||ue[$e]){if(!(qi(we)&&($.tagNameCheck instanceof RegExp&&Ca($.tagNameCheck,we)||$.tagNameCheck instanceof Function&&$.tagNameCheck(we))&&($.attributeNameCheck instanceof RegExp&&Ca($.attributeNameCheck,$e)||$.attributeNameCheck instanceof Function&&$.attributeNameCheck($e))||$e==="is"&&$.allowCustomizedBuiltInElements&&($.tagNameCheck instanceof RegExp&&Ca($.tagNameCheck,ot)||$.tagNameCheck instanceof Function&&$.tagNameCheck(ot))))return!1}else if(!Nt[$e]){if(!Ca(K,Ll(ot,W,""))){if(!(($e==="src"||$e==="xlink:href"||$e==="href")&&we!=="script"&&ZEe(ot,"data:")===0&&At[we])){if(!(ce&&!Ca(G,Ll(ot,W,"")))){if(ot)return!1}}}}}}return!0},qi=function(we){return we.indexOf("-")>0},Hr=function(we){var $e,ot,Jn,Zr;po("beforeSanitizeAttributes",we,null);var xr=we.attributes;if(xr){var _r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y};for(Zr=xr.length;Zr--;){$e=xr[Zr];var uh=$e,Bo=uh.name,Fd=uh.namespaceURI;if(ot=Bo==="value"?$e.value:exe($e.value),Jn=sn(Bo),_r.attrName=Jn,_r.attrValue=ot,_r.keepAttr=!0,_r.forceKeepAttr=void 0,po("uponSanitizeAttribute",we,_r),ot=_r.attrValue,!_r.forceKeepAttr&&(Tn(Bo,we),!!_r.keepAttr)){if(Ca(/\/>/i,ot)){Tn(Bo,we);continue}Q&&(ot=Ll(ot,v," "),ot=Ll(ot,O," "),ot=Ll(ot,N," "));var Ag=sn(we.nodeName);if(Zi(Ag,Jn,ot)){if(Be&&(Jn==="id"||Jn==="name")&&(Tn(Bo,we),ot=Pe+ot),S&&Yh(g)==="object"&&typeof g.getAttributeType=="function"&&!Fd)switch(g.getAttributeType(Ag,Jn)){case"TrustedHTML":ot=S.createHTML(ot);break;case"TrustedScriptURL":ot=S.createScriptURL(ot);break}try{Fd?we.setAttributeNS(Fd,Bo,ot):we.setAttribute(Bo,ot),t4(t.removed)}catch{}}}}po("afterSanitizeAttributes",we,null)}},ba=function Ct(we){var $e,ot=Fn(we);for(po("beforeSanitizeShadowDOM",we,null);$e=ot.nextNode();)po("uponSanitizeShadowNode",$e,null),!Ur($e)&&($e.content instanceof o&&Ct($e.content),Hr($e));po("afterSanitizeShadowDOM",we,null)};return t.sanitize=function(Ct){var we=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$e,ot,Jn,Zr,xr;if(vn=!Ct,vn&&(Ct="<!-->"),typeof Ct!="string"&&!Lo(Ct)){if(typeof Ct.toString!="function")throw b1("toString is not a function");if(Ct=Ct.toString(),typeof Ct!="string")throw b1("dirty is not a string, aborting")}if(!t.isSupported){if(Yh(e.toStaticHTML)==="object"||typeof e.toStaticHTML=="function"){if(typeof Ct=="string")return e.toStaticHTML(Ct);if(Lo(Ct))return e.toStaticHTML(Ct.outerHTML)}return Ct}if(de||li(we),t.removed=[],typeof Ct=="string"&&(xe=!1),xe){if(Ct.nodeName){var _r=sn(Ct.nodeName);if(!q[_r]||se[_r])throw b1("root node is forbidden and cannot be sanitized in-place")}}else if(Ct instanceof s)$e=Qi("<!---->"),ot=$e.ownerDocument.importNode(Ct,!0),ot.nodeType===1&&ot.nodeName==="BODY"||ot.nodeName==="HTML"?$e=ot:$e.appendChild(ot);else{if(!Se&&!Q&&!ne&&Ct.indexOf("<")===-1)return S&&Le?S.createHTML(Ct):Ct;if($e=Qi(Ct),!$e)return Se?null:Le?P:""}$e&&_e&&Mn($e.firstChild);for(var uh=Fn(xe?Ct:$e);Jn=uh.nextNode();)Jn.nodeType===3&&Jn===Zr||Ur(Jn)||(Jn.content instanceof o&&ba(Jn.content),Hr(Jn),Zr=Jn);if(Zr=null,xe)return Ct;if(Se){if(ve)for(xr=F.call($e.ownerDocument);$e.firstChild;)xr.appendChild($e.firstChild);else xr=$e;return Y.shadowroot&&(xr=D.call(n,xr,!0)),xr}var Bo=ne?$e.outerHTML:$e.innerHTML;return ne&&q["!doctype"]&&$e.ownerDocument&&$e.ownerDocument.doctype&&$e.ownerDocument.doctype.name&&Ca(fxe,$e.ownerDocument.doctype.name)&&(Bo="<!DOCTYPE "+$e.ownerDocument.doctype.name+`>
|
||
`+Bo),Q&&(Bo=Ll(Bo,v," "),Bo=Ll(Bo,O," "),Bo=Ll(Bo,N," ")),S&&Le?S.createHTML(Bo):Bo},t.setConfig=function(Ct){li(Ct),de=!0},t.clearConfig=function(){zi=null,de=!1},t.isValidAttribute=function(Ct,we,$e){zi||li({});var ot=sn(Ct),Jn=sn(we);return Zi(ot,Jn,$e)},t.addHook=function(Ct,we){typeof we=="function"&&(_[Ct]=_[Ct]||[],dA(_[Ct],we))},t.removeHook=function(Ct){if(_[Ct])return t4(_[Ct])},t.removeHooks=function(Ct){_[Ct]&&(_[Ct]=[])},t.removeAllHooks=function(){_={}},t}var mxe=Rq();let _xe=0;const w1={};function ai(e,t){T.typeOf.string("html",e);let n;const i=e;l(w1[i])?n=w1[i]:(n=_xe++,w1[i]=n),t=A(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(ai.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(!l(this._element)){const e=mxe.sanitize(this._html),t=document.createElement("div");t._creditId=this._id,t.style.display="inline",t.innerHTML=e;const n=t.querySelectorAll("a");for(let i=0;i<n.length;i++)n[i].setAttribute("target","_blank");this._element=t}return this._element}}});ai.equals=function(e,t){return e===t||l(e)&&l(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};ai.prototype.equals=function(e){return ai.equals(this,e)};ai.getIonCredit=function(e){const t=l(e.collapsible)&&!e.collapsible,n=new ai(e.html,t);return n._isIon=n.html.indexOf("ion-credit.png")!==-1,n};ai.clone=function(e){if(l(e))return new ai(e.html,e.showOnScreen)};let S1;const Nq="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyZTlhMmUzMS1iZjI3LTRhMmQtYjFkZi02MDhlMDZjZDlmNDIiLCJpZCI6MjU5LCJpYXQiOjE2NzI2ODQyMDR9.GfS2oIjtP-hkhYm4g_Y6Vvpdp954z30qPWJnlNBF-co",cD={};cD.defaultAccessToken=Nq;cD.defaultServer=new Me({url:"https://api.cesium.com/"});cD.getDefaultTokenCredit=function(e){if(e===Nq){if(!l(S1)){const 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>`;S1=new ai(t,!0)}return S1}};const h_=cD;function hs(e,t){T.defined("endpoint",e),T.defined("endpointResource",t);let n;const i=e.externalType,o=l(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:gxe};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new Ie("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");Me.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Rs(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}l(Object.create)&&(hs.prototype=Object.create(Me.prototype),hs.prototype.constructor=hs);hs.fromAssetId=function(e,t){const n=hs._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new hs(i,n)})};Object.defineProperties(hs.prototype,{credits:{get:function(){return l(this._ionRoot)?this._ionRoot.credits:l(this._credits)?this._credits:(this._credits=hs.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});hs.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(ai.getIonCredit),i=h_.getDefaultTokenCredit(t.queryParameters.access_token);return l(i)&&n.push(ai.clone(i)),n};hs.prototype.clone=function(e){const t=A(this._ionRoot,this);return l(e)||(e=new hs(t._ionEndpoint,t._ionEndpointResource)),e=Me.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};hs.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},l(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Me.prototype.fetchImage.call(this,e)};hs.prototype._makeRequest=function(e){return this._isExternal||new Rs(this.url).authority()!==this._ionEndpointDomain?Me.prototype._makeRequest.call(this,e):(l(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,Me.prototype._makeRequest.call(this,e))};hs._createEndpointResource=function(e,t){T.defined("assetId",e),t=A(t,A.EMPTY_OBJECT);let n=A(t.server,h_.defaultServer);const i=A(t.accessToken,h_.defaultAccessToken);n=Me.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return l(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function gxe(e,t){const n=A(e._ionRoot,e),i=n._ionEndpointResource,o=typeof Image<"u";return!l(t)||t.statusCode!==401&&!(o&&t.target instanceof Image)?Promise.resolve(!1):(l(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}))}function aa(e){e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,me.WGS84),this._rectangle=A(e.rectangle,ge.MAX_VALUE),this._projection=new nr(this._ellipsoid),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(aa.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});aa.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};aa.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};aa.prototype.rectangleToNativeRectangle=function(e,t){T.defined("rectangle",e);const n=M.toDegrees(e.west),i=M.toDegrees(e.south),o=M.toDegrees(e.east),r=M.toDegrees(e.north);return l(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new ge(n,i,o,r)};aa.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.tileXYToRectangle(e,t,n,i);return o.west=M.toDegrees(o.west),o.south=M.toDegrees(o.south),o.east=M.toDegrees(o.east),o.north=M.toDegrees(o.north),o};aa.prototype.tileXYToRectangle=function(e,t,n,i){const o=this._rectangle,r=this.getNumberOfXTilesAtLevel(n),s=this.getNumberOfYTilesAtLevel(n),a=o.width/r,c=e*a+o.west,u=(e+1)*a+o.west,d=o.height/s,h=o.north-t*d,m=o.north-(t+1)*d;return l(i)||(i=new ge(c,m,u,h)),i.west=c,i.south=m,i.east=u,i.north=h,i};aa.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!ge.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),s=i.width/o,a=i.height/r;let c=e.longitude;i.east<i.west&&(c+=M.TWO_PI);let u=(c-i.west)/s|0;u>=o&&(u=o-1);let d=(i.north-e.latitude)/a|0;return d>=r&&(d=r-1),l(n)?(n.x=u,n.y=d,n):new j(u,d)};function yB(e){let t;const n=e.name,i=e.message;l(n)&&l(i)?t=`${n}: ${i}`:t=e.toString();const o=e.stack;return l(o)&&(t+=`
|
||
${o}`),t}function ao(e,t,n,i,o,r,s){this.provider=e,this.message=t,this.x=n,this.y=i,this.level=o,this.timesRetried=A(r,0),this.retry=!1,this.error=s}ao.reportError=function(e,t,n,i,o,r,s,a){let c=e;return l(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 ao(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${yB(i)}`),c};ao.reportSuccess=function(e){l(e)&&(e.timesRetried=-1)};function di(e){this._ellipsoid=A(e,me.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(di.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});di.mercatorAngleToGeodeticLatitude=function(e){return M.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};di.geodeticLatitudeToMercatorAngle=function(e){e>di.MaximumLatitude?e=di.MaximumLatitude:e<-di.MaximumLatitude&&(e=-di.MaximumLatitude);const t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};di.MaximumLatitude=di.mercatorAngleToGeodeticLatitude(Math.PI);di.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=di.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return l(t)?(t.x=i,t.y=o,t.z=r,t):new f(i,o,r)};di.prototype.unproject=function(e,t){if(!l(e))throw new x("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=di.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return l(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new Ce(i,o,r)};function ga(e){if(e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,me.WGS84),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1),this._projection=new di(this._ellipsoid),l(e.rectangleSouthwestInMeters)&&l(e.rectangleNortheastInMeters))this._rectangleSouthwestInMeters=e.rectangleSouthwestInMeters,this._rectangleNortheastInMeters=e.rectangleNortheastInMeters;else{const i=this._ellipsoid.maximumRadius*Math.PI;this._rectangleSouthwestInMeters=new j(-i,-i),this._rectangleNortheastInMeters=new j(i,i)}const t=this._projection.unproject(this._rectangleSouthwestInMeters),n=this._projection.unproject(this._rectangleNortheastInMeters);this._rectangle=new ge(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(ga.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});ga.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};ga.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};ga.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(ge.southwest(e)),o=n.project(ge.northeast(e));return l(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new ge(i.x,i.y,o.x,o.y)};ga.prototype.tileXYToNativeRectangle=function(e,t,n,i){const 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,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,d=this._rectangleNortheastInMeters.y-t*u,h=this._rectangleNortheastInMeters.y-(t+1)*u;return l(i)?(i.west=a,i.south=h,i.east=c,i.north=d,i):new ge(a,h,c,d)};ga.prototype.tileXYToRectangle=function(e,t,n,i){const o=this.tileXYToNativeRectangle(e,t,n,i),r=this._projection,s=r.unproject(new j(o.west,o.south)),a=r.unproject(new j(o.east,o.north));return o.west=s.longitude,o.south=s.latitude,o.east=a.longitude,o.north=a.latitude,o};ga.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!ge.contains(i,e))return;const o=this.getNumberOfXTilesAtLevel(t),r=this.getNumberOfYTilesAtLevel(t),a=(this._rectangleNortheastInMeters.x-this._rectangleSouthwestInMeters.x)/o,u=(this._rectangleNortheastInMeters.y-this._rectangleSouthwestInMeters.y)/r,h=this._projection.project(e),m=h.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-h.y;let p=m/a|0;p>=o&&(p=o-1);let y=g/u|0;return y>=r&&(y=r-1),l(n)?(n.x=p,n.y=y,n):new j(p,y)};function bM(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.missingImageUrl))throw new x("options.missingImageUrl is required.");if(!l(e.pixelsToCheck))throw new x("options.pixelsToCheck is required.");this._pixelsToCheck=e.pixelsToCheck,this._missingImagePixels=void 0,this._missingImageByteLength=void 0,this._isReady=!1;const t=Me.createIfNeeded(e.missingImageUrl),n=this;function i(r){l(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=VS(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0;const c=r.width,u=e.pixelsToCheck;for(let d=0,h=u.length;a&&d<h;++d){const m=u[d],g=m.x*4+m.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)}bM.prototype.isReady=function(){return this._isReady};bM.prototype.shouldDiscardImage=function(e){if(!this._isReady)throw new x("shouldDiscardImage must not be called before the discard policy is ready.");const t=this._pixelsToCheck,n=this._missingImagePixels;if(!l(n)||l(e.blob)&&e.blob.size!==this._missingImageByteLength)return!1;const i=VS(e),o=e.width;for(let r=0,s=t.length;r<s;++r){const a=t[r],c=a.x*4+a.y*o;for(let u=0;u<4;++u){const d=c+u;if(i[d]!==n[d])return!1}}return!0};function Kp(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}Kp.prototype.configureNameFromProperties=function(e){let t=10,n;for(const i in e)if(e.hasOwnProperty(i)&&e[i]){const 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)}l(n)&&(this.name=e[n])};Kp.prototype.configureDescriptionFromProperties=function(e){function t(n){let i='<table class="cesium-infoBox-defaultTable">';for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];l(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)};function Tu(){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,x.throwInstantiationError()}Object.defineProperties(Tu.prototype,{ready:{get:x.throwInstantiationError},readyPromise:{get:x.throwInstantiationError},rectangle:{get:x.throwInstantiationError},tileWidth:{get:x.throwInstantiationError},tileHeight:{get:x.throwInstantiationError},maximumLevel:{get:x.throwInstantiationError},minimumLevel:{get:x.throwInstantiationError},tilingScheme:{get:x.throwInstantiationError},tileDiscardPolicy:{get:x.throwInstantiationError},errorEvent:{get:x.throwInstantiationError},credit:{get:x.throwInstantiationError},proxy:{get:x.throwInstantiationError},hasAlphaChannel:{get:x.throwInstantiationError}});Tu.prototype.getTileCredits=function(e,t,n){x.throwInstantiationError()};Tu.prototype.requestImage=function(e,t,n,i){x.throwInstantiationError()};Tu.prototype.pickFeatures=function(e,t,n,i,o){x.throwInstantiationError()};const yxe=/\.ktx2$/i;Tu.loadImage=function(e,t){T.defined("url",t);const n=Me.createIfNeeded(t);return yxe.test(n.url)?K_(n):l(e)&&l(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};function up(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new x("options.url 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;const t=Me.createIfNeeded(e.url);t.appendForwardSlash(),l(e.token)&&t.setQueryParameters({token:e.token}),this._resource=t,this._tileDiscardPolicy=e.tileDiscardPolicy,this._tileWidth=A(e.tileWidth,256),this._tileHeight=A(e.tileHeight,256),this._maximumLevel=e.maximumLevel,this._tilingScheme=A(e.tilingScheme,new aa({ellipsoid:e.ellipsoid})),this._useTiles=A(e.usePreCachedTilesIfAvailable,!0),this._rectangle=A(e.rectangle,this._tilingScheme.rectangle),this._layers=e.layers;let n=e.credit;typeof n=="string"&&(n=new ai(n)),this._credit=n,this.enablePickFeatures=A(e.enablePickFeatures,!0),this._errorEvent=new Ke,this._ready=!1;const i=this;let o;function r(c){const u=c.tileInfo;if(!l(u))i._useTiles=!1;else{if(i._tileWidth=u.rows,i._tileHeight=u.cols,u.spatialReference.wkid===102100||u.spatialReference.wkid===102113)i._tilingScheme=new ga({ellipsoid:e.ellipsoid});else if(c.tileInfo.spatialReference.wkid===4326)i._tilingScheme=new aa({ellipsoid:e.ellipsoid});else{const d=`Tile spatial reference WKID ${c.tileInfo.spatialReference.wkid} is not supported.`;return o=ao.reportError(o,i,i._errorEvent,d,void 0,void 0,void 0),o.retry?a():Promise.reject(new Ie(d))}if(i._maximumLevel=c.tileInfo.lods.length-1,l(c.fullExtent)){if(l(c.fullExtent.spatialReference)&&l(c.fullExtent.spatialReference.wkid))if(c.fullExtent.spatialReference.wkid===102100||c.fullExtent.spatialReference.wkid===102113){const d=new di,h=c.fullExtent,m=d.unproject(new f(Math.max(h.xmin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(h.ymin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),g=d.unproject(new f(Math.min(h.xmax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(h.ymax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));i._rectangle=new ge(m.longitude,m.latitude,g.longitude,g.latitude)}else if(c.fullExtent.spatialReference.wkid===4326)i._rectangle=ge.fromDegrees(c.fullExtent.xmin,c.fullExtent.ymin,c.fullExtent.xmax,c.fullExtent.ymax);else{const d=`fullExtent.spatialReference WKID ${c.fullExtent.spatialReference.wkid} is not supported.`;return o=ao.reportError(o,i,i._errorEvent,d,void 0,void 0,void 0),o.retry?a():Promise.reject(new Ie(d))}}else i._rectangle=i._tilingScheme.rectangle;l(i._tileDiscardPolicy)||(i._tileDiscardPolicy=new bM({missingImageUrl:Mq(i,0,0,i._maximumLevel).url,pixelsToCheck:[new j(0,0),new j(200,20),new j(20,200),new j(80,110),new j(160,130)],disableCheckIfAllPixelsAreTransparent:!0})),i._useTiles=!0}return l(c.copyrightText)&&c.copyrightText.length>0&&(i._credit=new ai(c.copyrightText)),i._ready=!0,ao.reportSuccess(o),Promise.resolve(!0)}function s(c){const u=`An error occurred while accessing ${i._resource.url}.`;return o=ao.reportError(o,i,i._errorEvent,u,void 0,void 0,void 0),Promise.reject(new Ie(u))}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 Mq(e,t,n,i,o){let r;if(e._useTiles)r=e._resource.getDerivedResource({url:`tile/${i}/${n}/${t}`,request:o});else{const 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 nr?(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(up.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(){if(!this._ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this._ready)throw new x("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.");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}}});up.prototype.getTileCredits=function(e,t,n){};up.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new x("requestImage must not be called before the imagery provider is ready.");return Tu.loadImage(this,Mq(this,e,t,n,i))};up.prototype.pickFeatures=function(e,t,n,i,o){if(!this._ready)throw new x("pickFeatures must not be called before the imagery provider is ready.");if(!this.enablePickFeatures)return;const r=this._tilingScheme.tileXYToNativeRectangle(e,t,n);let s,a,c;if(this._tilingScheme.projection instanceof nr)s=M.toDegrees(i),a=M.toDegrees(o),c="4326";else{const m=this._tilingScheme.projection.project(new Ce(i,o,0));s=m.x,a=m.y,c="3857"}let u="visible";l(this._layers)&&(u+=`:${this._layers}`);const d={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:u};return this._resource.getDerivedResource({url:"identify",queryParameters:d}).fetchJson().then(function(m){const g=[],p=m.results;if(!l(p))return g;for(let y=0;y<p.length;++y){const b=p[y],C=new Kp;if(C.data=b,C.name=b.value,C.properties=b.attributes,C.configureDescriptionFromProperties(b.attributes),b.geometryType==="esriGeometryPoint"&&b.geometry){const E=b.geometry.spatialReference&&b.geometry.spatialReference.wkid?b.geometry.spatialReference.wkid:4326;if(E===4326||E===4283)C.position=Ce.fromDegrees(b.geometry.x,b.geometry.y,b.geometry.z);else if(E===102100||E===900913||E===3857){const w=new di;C.position=w.unproject(new f(b.geometry.x,b.geometry.y,b.geometry.z))}}g.push(C)}return g})};const Axe={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"},bxe=Object.freeze(Axe);function f0(e){}f0.prototype.isReady=function(){return!0};f0.prototype.shouldDiscardImage=function(e){return f0.EMPTY_IMAGE===e};let VE;Object.defineProperties(f0,{EMPTY_IMAGE:{get:function(){return l(VE)||(VE=new Image,VE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),VE}}});function fs(e){e=A(e,A.EMPTY_OBJECT);const t=e.key;if(!l(e.url))throw new x("options.url is required.");if(!l(t))throw new x("options.key 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=1,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0,this._key=t,this._resource=Me.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=A(e.mapStyle,bxe.AERIAL),this._culture=A(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,l(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new f0),this._proxy=e.proxy,this._credit=new ai(`<a href="http://www.bing.com"><img src="${fs.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new ga({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 Ke,this._ready=!1;let n=this._tileProtocol;l(n)?n.length>0&&n[n.length-1]===":"&&(n=n.substr(0,n.length-1)):n=document.location.protocol==="http:"?"http":"https";const i=this._resource.getDerivedResource({url:`REST/v1/Imagery/Metadata/${this._mapStyle}`,queryParameters:{incl:"ImageryProviders",key:this._key,uriScheme:n}}),o=this;let r;function s(h){if(h.resourceSets.length!==1)return a();const m=h.resourceSets[0].resources[0];o._tileWidth=m.imageWidth,o._tileHeight=m.imageHeight,o._maximumLevel=m.zoomMax-1,o._imageUrlSubdomains=m.imageUrlSubdomains,o._imageUrlTemplate=m.imageUrl;let g=o._attributionList=m.imageryProviders;g||(g=o._attributionList=[]);for(let p=0,y=g.length;p<y;++p){const b=g[p];if(b.credit instanceof ai)break;b.credit=new ai(b.attribution);const C=b.coverageAreas;for(let E=0,w=b.coverageAreas.length;E<w;++E){const S=C[E],P=S.bbox;S.bbox=new ge(M.toRadians(P[1]),M.toRadians(P[0]),M.toRadians(P[3]),M.toRadians(P[2]))}}return o._ready=!0,ao.reportSuccess(r),Promise.resolve(!0)}function a(h){const m=`An error occurred while accessing ${i.url}.`;return r=ao.reportError(r,o,o._errorEvent,m,void 0,void 0,void 0),r.retry?u():Promise.reject(new Ie(m))}const c=i.url;function u(){const h=i.fetchJsonp("jsonp");return fs._metadataCache[c]=h,h.then(s).catch(a)}const d=fs._metadataCache[c];l(d)?this._readyPromise=d.then(s).catch(a):this._readyPromise=u()}Object.defineProperties(fs.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},key:{get:function(){return this._key}},mapStyle:{get:function(){return this._mapStyle}},culture:{get:function(){return this._culture}},tileWidth:{get:function(){if(!this._ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this._ready)throw new x("rectangle must not be called before the imagery provider is ready.");return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.");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}}});const Cxe=new ge;fs.prototype.getTileCredits=function(e,t,n){if(!this._ready)throw new x("getTileCredits must not be called before the imagery provider is ready.");const i=this._tilingScheme.tileXYToRectangle(e,t,n,Cxe);return xxe(this._attributionList,n,i)};fs.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new x("requestImage must not be called before the imagery provider is ready.");const o=Tu.loadImage(this,Txe(this,e,t,n,i));if(l(o))return o.catch(function(r){return l(r.blob)&&r.blob.size===0?f0.EMPTY_IMAGE:Promise.reject(r)})};fs.prototype.pickFeatures=function(e,t,n,i,o){};fs.tileXYToQuadKey=function(e,t,n){let i="";for(let o=n;o>=0;--o){const r=1<<o;let s=0;e&r&&(s|=1),t&r&&(s|=2),i+=s}return i};fs.quadKeyToTileXY=function(e){let t=0,n=0;const i=e.length-1;for(let o=i;o>=0;--o){const r=1<<o,s=+e[i-o];s&1&&(t|=r),s&2&&(n|=r)}return{x:t,y:n,level:i}};fs._logoUrl=void 0;Object.defineProperties(fs,{logoUrl:{get:function(){return l(fs._logoUrl)||(fs._logoUrl=An("Assets/Images/bing_maps_credit.png")),fs._logoUrl},set:function(e){T.defined("value",e),fs._logoUrl=e}}});function Txe(e,t,n,i,o){const r=e._imageUrlTemplate,s=e._imageUrlSubdomains,a=(t+n+i)%s.length;return e._resource.getDerivedResource({url:r,request:o,templateValues:{quadkey:fs.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}const Exe=new ge;function xxe(e,t,n){++t;const i=[];for(let o=0,r=e.length;o<r;++o){const s=e[o],a=s.coverageAreas;let c=!1;for(let u=0,d=s.coverageAreas.length;!c&&u<d;++u){const h=a[u];if(t>=h.zoomMin&&t<=h.zoomMax){const m=ge.intersection(n,h.bbox,Exe);l(m)&&(c=!0)}}c&&i.push(s.credit)}return i}fs._metadataCache={};const Fq=/{[^}]+}/g,zq={x:Dxe,y:Pxe,z:Bxe,s:Rxe,reverseX:Ixe,reverseY:Oxe,reverseZ:Lxe,westDegrees:Nxe,southDegrees:Mxe,eastDegrees:Fxe,northDegrees:zxe,westProjected:Uxe,southProjected:Hxe,eastProjected:Vxe,northProjected:kxe,width:Gxe,height:Wxe},wxe=hn(zq,{i:jxe,j:qxe,reverseI:$xe,reverseJ:Yxe,longitudeDegrees:Kxe,latitudeDegrees:Jxe,longitudeProjected:Qxe,latitudeProjected:Zxe,format:twe});function $a(e){if(!l(e))throw new x("options is required.");if(!l(e.then)&&!l(e.url))throw new x("options is required.");this._errorEvent=new Ke,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($a.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(){if(!this.ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this.ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this.ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this.ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return this._minimumLevel}},tilingScheme:{get:function(){if(!this.ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){if(!this.ready)throw new x("rectangle must not be called before the imagery provider is ready.");return this._rectangle}},tileDiscardPolicy:{get:function(){if(!this.ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},ready:{get:function(){return l(this._resource)}},readyPromise:{get:function(){return this._readyPromise}},credit:{get:function(){if(!this.ready)throw new x("credit must not be called before the imagery provider is ready.");return this._credit}},hasAlphaChannel:{get:function(){if(!this.ready)throw new x("hasAlphaChannel must not be called before the imagery provider is ready.");return this._hasAlphaChannel}}});$a.prototype.reinitialize=function(e){const t=this;t._readyPromise=Promise.resolve(e).then(function(n){if(!l(n))throw new x("options is required.");if(!l(n.url))throw new x("options.url is required.");const i=n.customTags,o=hn(zq,i),r=hn(wxe,i),s=Me.createIfNeeded(n.url),a=Me.createIfNeeded(n.pickFeaturesUrl);t.enablePickFeatures=A(n.enablePickFeatures,t.enablePickFeatures),t._urlSchemeZeroPadding=A(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():l(t._subdomains)&&t._subdomains.length>0?t._subdomains=t._subdomains.split(""):t._subdomains=["a","b","c"],t._tileWidth=A(n.tileWidth,256),t._tileHeight=A(n.tileHeight,256),t._minimumLevel=A(n.minimumLevel,0),t._maximumLevel=n.maximumLevel,t._tilingScheme=A(n.tilingScheme,new ga({ellipsoid:n.ellipsoid})),t._rectangle=A(n.rectangle,t._tilingScheme.rectangle),t._rectangle=ge.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=A(n.hasAlphaChannel,!0);let c=n.credit;return typeof c=="string"&&(c=new ai(c)),t._credit=c,t._resource=s,t._tags=o,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0})};$a.prototype.getTileCredits=function(e,t,n){if(!this.ready)throw new x("getTileCredits must not be called before the imagery provider is ready.")};$a.prototype.requestImage=function(e,t,n,i){if(!this.ready)throw new x("requestImage must not be called before the imagery provider is ready.");return Tu.loadImage(this,Sxe(this,e,t,n,i))};$a.prototype.pickFeatures=function(e,t,n,i,o){if(!this.ready)throw new x("pickFeatures must not be called before the imagery provider is ready.");if(!this.enablePickFeatures||!l(this._pickFeaturesResource)||this._getFeatureInfoFormats.length===0)return;let r=0;const s=this;function a(u,d){return u.callback(d)}function c(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const u=s._getFeatureInfoFormats[r],d=vxe(s,e,t,n,i,o,u.format);return++r,u.type==="json"?d.fetchJson().then(u.callback).catch(c):u.type==="xml"?d.fetchXML().then(u.callback).catch(c):u.type==="text"||u.type==="html"?d.fetchText().then(u.callback).catch(c):d.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(c)}return c()};let qS=!1;const ic=new ge;let $S=!1;const pT=new ge;function Sxe(e,t,n,i,o){qS=!1,$S=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,c={},u=s.match(Fq);return l(u)&&u.forEach(function(d){const h=d.substring(1,d.length-1);l(a[h])&&(c[h]=a[h](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:c})}let AB=!1;const h0=new j;let bB=!1;function vxe(e,t,n,i,o,r,s){qS=!1,$S=!1,AB=!1,bB=!1;const a=e._pickFeaturesResource,c=a.getUrlComponent(!0),u=e._pickFeaturesTags,d={},h=c.match(Fq);return l(h)&&h.forEach(function(m){const g=m.substring(1,m.length-1);l(u[g])&&(d[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:d})}function B0(e,t,n){if(e&&e.urlSchemeZeroPadding&&e.urlSchemeZeroPadding.hasOwnProperty(t)){const i=e.urlSchemeZeroPadding[t];if(typeof i=="string"){const o=i.length;o>1&&(n=n.length>=o?n:new Array(o-n.toString().length+1).join("0")+n)}}return n}function Dxe(e,t,n,i){return B0(e,"{x}",t)}function Ixe(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return B0(e,"{reverseX}",o)}function Pxe(e,t,n,i){return B0(e,"{y}",n)}function Oxe(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return B0(e,"{reverseY}",o)}function Lxe(e,t,n,i){const o=e.maximumLevel,r=l(o)&&i<o?o-i-1:i;return B0(e,"{reverseZ}",r)}function Bxe(e,t,n,i){return B0(e,"{z}",i)}function Rxe(e,t,n,i){const o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function lD(e,t,n,i){qS||(e.tilingScheme.tileXYToRectangle(t,n,i,ic),ic.west=M.toDegrees(ic.west),ic.south=M.toDegrees(ic.south),ic.east=M.toDegrees(ic.east),ic.north=M.toDegrees(ic.north),qS=!0)}function Nxe(e,t,n,i){return lD(e,t,n,i),ic.west}function Mxe(e,t,n,i){return lD(e,t,n,i),ic.south}function Fxe(e,t,n,i){return lD(e,t,n,i),ic.east}function zxe(e,t,n,i){return lD(e,t,n,i),ic.north}function uD(e,t,n,i){$S||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,pT),$S=!0)}function Uxe(e,t,n,i){return uD(e,t,n,i),pT.west}function Hxe(e,t,n,i){return uD(e,t,n,i),pT.south}function Vxe(e,t,n,i){return uD(e,t,n,i),pT.east}function kxe(e,t,n,i){return uD(e,t,n,i),pT.north}function Gxe(e,t,n,i){return e.tileWidth}function Wxe(e,t,n,i){return e.tileHeight}function jxe(e,t,n,i,o,r,s){return dD(e,t,n,i,o,r),h0.x}function qxe(e,t,n,i,o,r,s){return dD(e,t,n,i,o,r),h0.y}function $xe(e,t,n,i,o,r,s){return dD(e,t,n,i,o,r),e.tileWidth-h0.x-1}function Yxe(e,t,n,i,o,r,s){return dD(e,t,n,i,o,r),e.tileHeight-h0.y-1}const Xxe=new ge,My=new f;function dD(e,t,n,i,o,r,s){if(AB)return;CM(e,t,n,i,o,r);const a=My,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,Xxe);h0.x=e.tileWidth*(a.x-c.west)/c.width|0,h0.y=e.tileHeight*(c.north-a.y)/c.height|0,AB=!0}function Kxe(e,t,n,i,o,r,s){return M.toDegrees(o)}function Jxe(e,t,n,i,o,r,s){return M.toDegrees(r)}function Qxe(e,t,n,i,o,r,s){return CM(e,t,n,i,o,r),My.x}function Zxe(e,t,n,i,o,r,s){return CM(e,t,n,i,o,r),My.y}const ewe=new Ce;function CM(e,t,n,i,o,r,s){if(!bB){if(e.tilingScheme.projection instanceof nr)My.x=M.toDegrees(o),My.y=M.toDegrees(r);else{const a=ewe;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,My)}bB=!0}}function twe(e,t,n,i,o,r,s){return s}function mf(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new x("options.url is required.");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;const n=this,i=Promise.resolve(e.url).then(function(o){return t=Me.createIfNeeded(o),t.appendForwardSlash(),n._tmsResource=t,n._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),n._requestMetadata()}).catch(o=>Promise.reject(o));$a.call(this,i),this._promise=i}l(Object.create)&&(mf.prototype=Object.create($a.prototype),mf.prototype.constructor=mf);mf.prototype._requestMetadata=function(){return this._xmlResource.fetchXML().then(this._metadataSuccess).catch(e=>e instanceof c0?this._metadataFailure():Promise.reject(e))};function Uq(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 Hq(e,t,n){const i=e.positionToTileXY(ge.southwest(t),n),o=e.positionToTileXY(ge.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}mf.prototype._metadataSuccess=function(e){const t=/tileformat/i,n=/tileset/i,i=/tilesets/i,o=/boundingbox/i;let r,s,a;const c=[],u=this._xmlResource;let d=this._metadataError;const h=this._requestMetadata,m=e.childNodes[0].childNodes;for(let R=0;R<m.length;R++)if(t.test(m.item(R).nodeName))r=m.item(R);else if(i.test(m.item(R).nodeName)){a=m.item(R);const F=m.item(R).childNodes;for(let U=0;U<F.length;U++)n.test(F.item(U).nodeName)&&c.push(F.item(U))}else o.test(m.item(R).nodeName)&&(s=m.item(R));let g;if(!l(a)||!l(s))return g=`Unable to find expected tilesets or bbox attributes in ${u.url}.`,d=ao.reportError(d,this,this.errorEvent,g),d.retry?(this._metadataError=d,h()):Promise.reject(new Ie(g));const p=this._options,y=A(p.fileExtension,r.getAttribute("extension")),b=A(p.tileWidth,parseInt(r.getAttribute("width"),10)),C=A(p.tileHeight,parseInt(r.getAttribute("height"),10));let E=A(p.minimumLevel,parseInt(c[0].getAttribute("order"),10));const w=A(p.maximumLevel,parseInt(c[c.length-1].getAttribute("order"),10)),S=a.getAttribute("profile");let P=p.tilingScheme;if(!l(P))if(S==="geodetic"||S==="global-geodetic")P=new aa({ellipsoid:p.ellipsoid});else if(S==="mercator"||S==="global-mercator")P=new ga({ellipsoid:p.ellipsoid});else return g=`${u.url}specifies an unsupported profile attribute, ${S}.`,d=ao.reportError(d,this,this.errorEvent,g),d.retry?(this._metadataError=d,h()):Promise.reject(new Ie(g));let L=ge.clone(p.rectangle);if(!l(L)){let R,F,U,D;A(p.flipXY,!1)?(U=new j(parseFloat(s.getAttribute("miny")),parseFloat(s.getAttribute("minx"))),D=new j(parseFloat(s.getAttribute("maxy")),parseFloat(s.getAttribute("maxx")))):(U=new j(parseFloat(s.getAttribute("minx")),parseFloat(s.getAttribute("miny"))),D=new j(parseFloat(s.getAttribute("maxx")),parseFloat(s.getAttribute("maxy"))));const _=S==="geodetic"||S==="mercator";if(P.projection instanceof nr||_)R=Ce.fromDegrees(U.x,U.y),F=Ce.fromDegrees(D.x,D.y);else{const v=P.projection;R=v.unproject(U),F=v.unproject(D)}L=new ge(R.longitude,R.latitude,F.longitude,F.latitude)}L=Uq(L,P),E=Hq(P,L,E);const z=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${y}`});return Promise.resolve({url:z,tilingScheme:P,rectangle:L,tileWidth:b,tileHeight:C,minimumLevel:E,maximumLevel:w,tileDiscardPolicy:p.tileDiscardPolicy,credit:p.credit})};mf.prototype._metadataFailure=function(){const e=this._options,t=A(e.fileExtension,"png"),n=A(e.tileWidth,256),i=A(e.tileHeight,256),o=e.maximumLevel,r=l(e.tilingScheme)?e.tilingScheme:new ga({ellipsoid:e.ellipsoid});let s=A(e.rectangle,r.rectangle);s=Uq(s,r);const a=Hq(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})};function nl(e){if(e=A(e,{}),!l(e.url))throw new x("options.url is required.");if(!l(e.channel))throw new x("options.channel 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=1.9,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const t=e.url,n=A(e.path,"/default_map"),i=Me.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 ai(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${nl.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 Ke,this._ready=!1;const o=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),r=this;let s;function a(d){let h;try{h=JSON.parse(d)}catch{h=JSON.parse(d.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let m;for(let p=0;p<h.layers.length;p++)if(h.layers[p].id===r._channel){m=h.layers[p];break}let g;if(!l(m))return g=`Could not find layer with channel (id) of ${r._channel}.`,s=ao.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Ie(g));if(!l(m.version))return g=`Could not find a version in channel (id) ${r._channel}.`,s=ao.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Ie(g));if(r._version=m.version,l(h.projection)&&h.projection==="flat")r._tilingScheme=new aa({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new ge(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else if(!l(h.projection)||h.projection==="mercator")r._tilingScheme=new ga({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid});else return g=`Unsupported projection ${h.projection}.`,s=ao.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Ie(g));return r._ready=!0,ao.reportSuccess(s),Promise.resolve(!0)}function c(d){const h=A(d.message,`An error occurred while accessing ${o.url}.`);return s=ao.reportError(s,r,r._errorEvent,h),Promise.reject(new Ie(h))}function u(){return o.fetchText().then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(nl.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(){if(!this._ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return this._maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},version:{get:function(){if(!this._ready)throw new x("version must not be called before the imagery provider is ready.");return this._version}},requestType:{get:function(){if(!this._ready)throw new x("requestType must not be called before the imagery provider is ready.");return this._requestType}},rectangle:{get:function(){if(!this._ready)throw new x("rectangle must not be called before the imagery provider is ready.");return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.");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}}});nl.prototype.getTileCredits=function(e,t,n){};nl.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new x("requestImage must not be called before the imagery provider is ready.");const 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 Tu.loadImage(this,o)};nl.prototype.pickFeatures=function(e,t,n,i,o){};nl._logoUrl=void 0;Object.defineProperties(nl,{logoUrl:{get:function(){return l(nl._logoUrl)||(nl._logoUrl=An("Assets/Images/google_earth_credit.png")),nl._logoUrl},set:function(e){T.defined("value",e),nl._logoUrl=e}}});const nwe=/\/$/,Vq=new ai('© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function R0(e){e=A(e,A.EMPTY_OBJECT);const t=e.mapId;if(!l(t))throw new x("options.mapId is required.");const n=e.accessToken;if(!l(n))throw new x("options.accessToken is required.");this.defaultAlpha=void 0,this.defaultNightAlpha=void 0,this.defaultDayAlpha=void 0,this.defaultBrightness=void 0,this.defaultContrast=void 0,this.defaultHue=void 0,this.defaultSaturation=void 0,this.defaultGamma=void 0,this.defaultMinificationFilter=void 0,this.defaultMagnificationFilter=void 0;const i=Me.createIfNeeded(A(e.url,"https://{s}.tiles.mapbox.com/v4/"));this._mapId=t,this._accessToken=n;let o=A(e.format,"png");/\./.test(o)||(o=`.${o}`),this._format=o;let r=i.getUrlComponent();nwe.test(r)||(r+="/"),r+=`${t}/{z}/{x}/{y}${this._format}`,i.url=r,i.setQueryParameters({access_token:n});let s;l(e.credit)?(s=e.credit,typeof s=="string"&&(s=new ai(s))):s=Vq,this._resource=i,this._imageryProvider=new $a({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(R0.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}}});R0.prototype.getTileCredits=function(e,t,n){};R0.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};R0.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};R0._defaultCredit=Vq;function mT(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new x("options.url 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;const t=Me.createIfNeeded(e.url),n=A(e.rectangle,ge.MAX_VALUE),i=new aa({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 Ke,this._ready=!1;let o=e.credit;typeof o=="string"&&(o=new ai(o)),this._credit=o;const r=this;let s;function a(d){return r._image=d,r._tileWidth=d.width,r._tileHeight=d.height,r._ready=!0,ao.reportSuccess(r._errorEvent),Promise.resolve(!0)}function c(d){const h=`Failed to load image ${t.url}.`;return s=ao.reportError(s,r,r._errorEvent,h,0,0,0),s.retry?u():Promise.reject(new Ie(h))}function u(){return Tu.loadImage(null,t).then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(mT.prototype,{url:{get:function(){return this._resource.url}},proxy:{get:function(){return this._resource.proxy}},tileWidth:{get:function(){if(!this._ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return 0}},minimumLevel:{get:function(){if(!this._ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return 0}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._tilingScheme}},rectangle:{get:function(){return this._tilingScheme.rectangle}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.")}},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}}});mT.prototype.getTileCredits=function(e,t,n){};mT.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new x("requestImage must not be called before the imagery provider is ready.");if(l(this._image))return Promise.resolve(this._image)};mT.prototype.pickFeatures=function(e,t,n,i,o){};function v1(e,t,n){if(!l(e))throw new x("type is required.");if(this.type=e,!l(t))if(e==="json")t="application/json";else if(e==="xml")t="text/xml";else if(e==="html")t="text/html";else if(e==="text")t="text/plain";else throw new x('format is required when type is not "json", "xml", "html", or "text".');if(this.format=t,!l(n))if(e==="json")n=iwe;else if(e==="xml")n=awe;else if(e==="html")n=s4;else if(e==="text")n=s4;else throw new x('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function iwe(e){const t=[],n=e.features;for(let i=0;i<n.length;++i){const o=n[i],r=new Kp;if(r.data=o,r.properties=o.properties,r.configureNameFromProperties(o.properties),r.configureDescriptionFromProperties(o.properties),l(o.geometry)&&o.geometry.type==="Point"){const s=o.geometry.coordinates[0],a=o.geometry.coordinates[1];r.position=Ce.fromDegrees(s,a)}t.push(r)}return t}const CB="http://www.mapinfo.com/mxp",owe="http://www.esri.com/wms",rwe="http://www.opengis.net/wfs",swe="http://www.opengis.net/gml";function awe(e){const t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===CB)return cwe(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===owe)return lwe(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===rwe)return uwe(e);if(t.localName==="ServiceExceptionReport")throw new Ie(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?dwe(e):fwe(e)}function cwe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(CB,"Feature");for(let o=0;o<i.length;++o){const r=i[o],s={},a=r.getElementsByTagNameNS(CB,"Val");for(let u=0;u<a.length;++u){const d=a[u];if(d.hasAttribute("ref")){const h=d.getAttribute("ref"),m=d.textContent.trim();s[h]=m}}const c=new Kp;c.data=r,c.properties=s,c.configureNameFromProperties(s),c.configureDescriptionFromProperties(s),t.push(c)}return t}function lwe(e){const t=e.documentElement,n=[];let i;const o=t.getElementsByTagNameNS("*","FIELDS");if(o.length>0)for(let r=0;r<o.length;++r){const s=o[r];i={};const a=s.attributes;for(let c=0;c<a.length;++c){const u=a[c];i[u.name]=u.value}n.push(YS(s,i))}else{const r=t.getElementsByTagNameNS("*","FeatureInfo");for(let s=0;s<r.length;++s){const a=r[s];i={};const c=a.childNodes;for(let u=0;u<c.length;++u){const d=c[u];d.nodeType===Node.ELEMENT_NODE&&(i[d.localName]=d.textContent)}n.push(YS(a,i))}}return n}function uwe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(swe,"featureMember");for(let o=0;o<i.length;++o){const r=i[o],s={};TM(r,s),t.push(YS(r,s))}return t}function dwe(e){const t=[];let n;const i=e.documentElement.childNodes;for(let r=0;r<i.length;r++)if(i[r].nodeType===Node.ELEMENT_NODE){n=i[r];break}if(!l(n))throw new Ie("Unable to find first child of the feature info xml document");const o=n.childNodes;for(let r=0;r<o.length;++r){const s=o[r];if(s.nodeType===Node.ELEMENT_NODE){const a={};TM(s,a),t.push(YS(s,a))}}return t}function TM(e,t){let n=!0;for(let i=0;i<e.childNodes.length;++i){const 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()&&TM(o,t)&&(t[o.localName]=o.textContent)}return n}function YS(e,t){const n=new Kp;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function fwe(e){const t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const o=new Kp;return o.data=e,o.description=n.innerHTML,[o]}const hwe=/<body>\s*<\/body>/im,pwe=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,mwe=/<title>([\s\S]*)<\/title>/im;function s4(e){if(hwe.test(e)||pwe.test(e))return;let t;const n=mwe.exec(e);n&&n.length>1&&(t=n[1]);const i=new Kp;return i.name=t,i.description=e,i.data=e,[i]}function N0(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.clock",e.clock),T.typeOf.object("options.times",e.times),T.typeOf.func("options.requestImageFunction",e.requestImageFunction),T.typeOf.func("options.reloadFunction",e.reloadFunction),this._tileCache={},this._tilesRequestedForInterval=[];const 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(N0.prototype,{clock:{get:function(){return this._clock},set:function(e){if(!l(e))throw new x("value is required.");this._clock!==e&&(this._clock=e,this._clockOnTick(e),this._reloadFunction())}},times:{get:function(){return this._times},set:function(e){if(!l(e))throw new x("value is required.");this._times!==e&&(this._times=e,this._clockOnTick(this._clock),this._reloadFunction())}},currentInterval:{get:function(){return this._times.get(this._currentIntervalIndex)}}});N0.prototype.getFromCache=function(e,t,n,i){const o=kq(e,t,n);let r;const s=this._tileCache[this._currentIntervalIndex];if(l(s)&&l(s[o])){const a=s[o];r=a.promise.catch(function(c){throw i.state=a.request.state,c}),delete s[o]}return r};N0.prototype.checkApproachingInterval=function(e,t,n,i){const o=kq(e,t,n),r=this._tilesRequestedForInterval,s=Gq(this),a={key:o,priorityFunction:i.priorityFunction};(!l(s)||!Wq(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};N0.prototype._clockOnTick=function(e){const t=e.currentTime,i=this._times.indexOf(t),o=this._currentIntervalIndex;if(i!==o){const s=this._tileCache[o];for(const a in s)s.hasOwnProperty(a)&&s[a].request.cancel();delete this._tileCache[o],this._tilesRequestedForInterval=[],this._currentIntervalIndex=i,this._reloadFunction();return}const r=Gq(this);if(l(r)){const s=this._tilesRequestedForInterval;let a=!0;for(;a&&s.length!==0;){const c=s.pop();a=Wq(this,c,r),a||s.push(c)}}};function kq(e,t,n){return`${e}-${t}-${n}`}function _we(e){const t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function Gq(e){const t=e._times;if(!l(t))return;const 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;const c=t.get(a);return r>0?(s=ie.secondsDifference(c.stop,i),++a):(s=ie.secondsDifference(c.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function Wq(e,t,n){const i=e._times.indexOf(n.start),o=e._tileCache;let r=o[i];l(r)||(r=o[i]={});const s=t.key;if(l(r[s]))return!0;const a=_we(s),c=new dd({throttle:!1,throttleByServer:!0,type:Y_.IMAGERY,priorityFunction:t.priorityFunction}),u=e._requestImageFunction(a.x,a.y,a.level,c,n);return l(u)?(r[s]={promise:u,request:c},!0):!1}const gwe=[3034,3035,3042,3043,3044],ywe=[4471,4559];function tu(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new x("options.url is required.");if(!l(e.layers))throw new x("options.layers is required.");if(l(e.times)&&!l(e.clock))throw new x("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=A(e.getFeatureInfoUrl,e.url);const t=Me.createIfNeeded(e.url),n=Me.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(tu.DefaultParameters,!0),n.setQueryParameters(tu.GetFeatureInfoDefaultParameters,!0),l(e.parameters)&&t.setQueryParameters(a4(e.parameters)),l(e.getFeatureInfoParameters)&&n.setQueryParameters(a4(e.getFeatureInfoParameters));const i=this;this._reload=void 0,l(e.times)&&(this._timeDynamicImagery=new N0({clock:e.clock,times:e.times,requestImageFunction:function(s,a,c,u,d){return jq(i,s,a,c,u,d)},reloadFunction:function(){l(i._reload)&&i._reload()}}));const 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=A(e.crs,e.tilingScheme&&e.tilingScheme.projection instanceof di?"EPSG:3857":"CRS:84");const s=o.crs.split(":");if(s[0]==="EPSG"&&s.length===2){const a=Number(s[1]);(a>=4e3&&a<5e3&&!ywe.includes(a)||gwe.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=A(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof di?"EPSG:3857":"EPSG:4326");t.setQueryParameters(o,!0),n.setQueryParameters(o,!0);const 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 $a({url:t,pickFeaturesUrl:n,tilingScheme:A(e.tilingScheme,new aa({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:A(e.getFeatureInfoFormats,tu.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function jq(e,t,n,i,o,r){const s=l(r)?r.data:void 0,a=e._tileProvider;return l(s)&&a._resource.setQueryParameters(s),a.requestImage(t,n,i,o)}function Awe(e,t,n,i,o,r,s){const a=l(s)?s.data:void 0,c=e._tileProvider;return l(a)&&c._pickFeaturesResource.setQueryParameters(a),c.pickFeatures(t,n,i,o,r)}Object.defineProperties(tu.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}}});tu.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};tu.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return l(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),l(o)||(o=jq(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};tu.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery,s=l(r)?r.currentInterval:void 0;return Awe(this,e,t,n,i,o,s)};tu.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});tu.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});tu.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new v1("json","application/json")),Object.freeze(new v1("xml","text/xml")),Object.freeze(new v1("text","text/html"))]);function a4(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}const bwe=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function _T(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url))throw new x("options.url is required.");if(!l(e.layer))throw new x("options.layer is required.");if(!l(e.style))throw new x("options.style is required.");if(!l(e.tileMatrixSetID))throw new x("options.tileMatrixSetID is required.");if(l(e.times)&&!l(e.clock))throw new x("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;const t=Me.createIfNeeded(e.url),n=e.style,i=e.tileMatrixSetID,o=t.url,r=o.match(/{/g);if(!l(r)||r.length===1&&/{s}/.test(o))t.setQueryParameters(bwe),this._useKvp=!0;else{const h={style:n,Style:n,TileMatrixSet:i};t.setTemplateValues(h),this._useKvp=!1}this._resource=t,this._layer=e.layer,this._style=n,this._tileMatrixSetID=i,this._tileMatrixLabels=e.tileMatrixLabels,this._format=A(e.format,"image/jpeg"),this._tileDiscardPolicy=e.tileDiscardPolicy,this._tilingScheme=l(e.tilingScheme)?e.tilingScheme:new ga({ellipsoid:e.ellipsoid}),this._tileWidth=A(e.tileWidth,256),this._tileHeight=A(e.tileHeight,256),this._minimumLevel=A(e.minimumLevel,0),this._maximumLevel=e.maximumLevel,this._rectangle=A(e.rectangle,this._tilingScheme.rectangle),this._dimensions=e.dimensions;const s=this;this._reload=void 0,l(e.times)&&(this._timeDynamicImagery=new N0({clock:e.clock,times:e.times,requestImageFunction:function(h,m,g,p,y){return qq(s,h,m,g,p,y)},reloadFunction:function(){l(s._reload)&&s._reload()}})),this._readyPromise=Promise.resolve(!0);const a=this._tilingScheme.positionToTileXY(ge.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(ge.northeast(this._rectangle),this._minimumLevel),u=(Math.abs(c.x-a.x)+1)*(Math.abs(c.y-a.y)+1);if(u>4)throw new x(`The imagery provider's rectangle and minimumLevel indicate that there are ${u} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);this._errorEvent=new Ke;const d=e.credit;this._credit=typeof d=="string"?new ai(d):d,this._subdomains=e.subdomains,Array.isArray(this._subdomains)?this._subdomains=this._subdomains.slice():l(this._subdomains)&&this._subdomains.length>0?this._subdomains=this._subdomains.split(""):this._subdomains=["a","b","c"]}function qq(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=l(s)?s[i]:i.toString(),c=e._subdomains,u=e._dimensions,d=l(r)?r.data:void 0;let h,m;if(!e._useKvp)m={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({request:o}),h.setTemplateValues(m),l(u)&&h.setTemplateValues(u),l(d)&&h.setTemplateValues(d);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,l(u)&&(g=hn(g,u)),l(d)&&(g=hn(g,d)),m={s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({queryParameters:g,request:o}),h.setTemplateValues(m)}return Tu.loadImage(e,h)}Object.defineProperties(_T.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,l(this._reload)&&this._reload())}}});_T.prototype.getTileCredits=function(e,t,n){};_T.prototype.requestImage=function(e,t,n,i){let o;const r=this._timeDynamicImagery;let s;return l(r)&&(s=r.currentInterval,o=r.getFromCache(e,t,n,i)),l(o)||(o=qq(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};_T.prototype.pickFeatures=function(e,t,n,i,o){};function Gd(e){return function(t){return new e(t)}}const Cwe={ARCGIS_MAPSERVER:Gd(up),BING:Gd(fs),GOOGLE_EARTH:Gd(nl),MAPBOX:Gd(R0),SINGLE_TILE:Gd(mT),TMS:Gd(mf),URL_TEMPLATE:Gd($a),WMS:Gd(tu),WMTS:Gd(_T)};function nu(e){e=A(e,A.EMPTY_OBJECT);const t=e.assetId;T.typeOf.number("options.assetId",t),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 Ke;const n=this,i=hs._createEndpointResource(t,e),o=e.assetId.toString()+e.accessToken+e.server;let r=nu._endpointCache[o];l(r)||(r=i.fetchJson(),nu._endpointCache[o]=r),this._readyPromise=r.then(function(s){if(s.type!=="IMAGERY")return Promise.reject(new Ie(`Cesium ion asset ${t} is not an imagery asset.`));let a;const c=s.externalType;if(!l(c))a=new mf({url:new hs(s,i)});else{const u=Cwe[c];if(!l(u))return Promise.reject(new Ie(`Unrecognized Cesium ion imagery type: ${c}`));a=u(s.options)}return n._tileCredits=hs.getCreditsFromEndpoint(s,i),a.errorEvent.addEventListener(function(u){u.provider=n,n._errorEvent.raiseEvent(u)}),n._imageryProvider=a,a.readyPromise.then(function(){return n._ready=!0,!0})})}Object.defineProperties(nu.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},rectangle:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._imageryProvider.rectangle}},tileWidth:{get:function(){if(!this._ready)throw new x("tileWidth must not be called before the imagery provider is ready.");return this._imageryProvider.tileWidth}},tileHeight:{get:function(){if(!this._ready)throw new x("tileHeight must not be called before the imagery provider is ready.");return this._imageryProvider.tileHeight}},maximumLevel:{get:function(){if(!this._ready)throw new x("maximumLevel must not be called before the imagery provider is ready.");return this._imageryProvider.maximumLevel}},minimumLevel:{get:function(){if(!this._ready)throw new x("minimumLevel must not be called before the imagery provider is ready.");return this._imageryProvider.minimumLevel}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the imagery provider is ready.");return this._imageryProvider.tilingScheme}},tileDiscardPolicy:{get:function(){if(!this._ready)throw new x("tileDiscardPolicy must not be called before the imagery provider is ready.");return this._imageryProvider.tileDiscardPolicy}},errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){if(!this._ready)throw new x("credit must not be called before the imagery provider is ready.");return this._imageryProvider.credit}},hasAlphaChannel:{get:function(){if(!this._ready)throw new x("hasAlphaChannel must not be called before the imagery provider is ready.");return this._imageryProvider.hasAlphaChannel},proxy:{get:function(){}}}});nu.prototype.getTileCredits=function(e,t,n){if(!this._ready)throw new x("getTileCredits must not be called before the imagery provider is ready.");const i=this._imageryProvider.getTileCredits(e,t,n);return l(i)?this._tileCredits.concat(i):this._tileCredits};nu.prototype.requestImage=function(e,t,n,i){if(!this._ready)throw new x("requestImage must not be called before the imagery provider is ready.");return this._imageryProvider.requestImage(e,t,n,i)};nu.prototype.pickFeatures=function(e,t,n,i,o){if(!this._ready)throw new x("pickFeatures must not be called before the imagery provider is ready.");return this._imageryProvider.pickFeatures(e,t,n,i,o)};nu._endpointCache={};const Twe={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},Uw=Object.freeze(Twe);function Hw(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.style,Uw.AERIAL);return new nu({assetId:t})}const Ewe={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},dp=Object.freeze(Ewe),xwe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},Xs=Object.freeze(xwe);let TB;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?TB=function(){return performance.now()}:TB=function(){return Date.now()};const fr=TB;function gT(e){e=A(e,A.EMPTY_OBJECT);let t=e.currentTime,n=e.startTime,i=e.stopTime;if(l(t)?t=ie.clone(t):l(n)?t=ie.clone(n):l(i)?t=ie.addDays(i,-1,new ie):t=ie.now(),l(n)?n=ie.clone(n):n=ie.clone(t),l(i)?i=ie.clone(i):i=ie.addDays(n,1,new ie),ie.greaterThan(n,i))throw new x("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=A(e.clockRange,dp.UNBOUNDED),this.canAnimate=A(e.canAnimate,!0),this.onTick=new Ke,this.onStop=new Ke,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=fr(),this.currentTime=t,this.multiplier=A(e.multiplier,1),this.shouldAnimate=A(e.shouldAnimate,!1),this.clockStep=A(e.clockStep,Xs.SYSTEM_CLOCK_MULTIPLIER)}Object.defineProperties(gT.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){ie.equals(this._currentTime,e)||(this._clockStep===Xs.SYSTEM_CLOCK&&(this._clockStep=Xs.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===Xs.SYSTEM_CLOCK&&(this._clockStep=Xs.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===Xs.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=ie.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===Xs.SYSTEM_CLOCK&&(this._clockStep=Xs.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});gT.prototype.tick=function(){const e=fr();let t=ie.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===Xs.SYSTEM_CLOCK)t=ie.now(t);else{const i=this._multiplier;if(n===Xs.TICK_DEPENDENT)t=ie.addSeconds(t,i,t);else{const a=e-this._lastSystemTime;t=ie.addSeconds(t,i*(a/1e3),t)}const o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===dp.CLAMPED)ie.lessThan(t,r)?t=ie.clone(r,t):ie.greaterThan(t,s)&&(t=ie.clone(s,t),this.onStop.raiseEvent(this));else if(o===dp.LOOP_STOP)for(ie.lessThan(t,r)&&(t=ie.clone(r,t));ie.greaterThan(t,s);)t=ie.addSeconds(r,ie.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};function Ar(e){if(typeof e=="string"){const t=document.getElementById(e);if(t===null)throw new x(`Element with id "${e}" does not exist in the document.`);e=t}return e}function Jh(e,t){this.start=A(e,0),this.stop=A(t,0)}function fe(e,t){this.center=f.clone(A(e,f.ZERO)),this.radius=A(t,0)}const EM=new f,xM=new f,wM=new f,SM=new f,vM=new f,DM=new f,IM=new f,as=new f,PM=new f,OM=new f,LM=new f,BM=new f,wwe=4/3*M.PI;fe.fromPoints=function(e,t){if(l(t)||(t=new fe),!l(e)||e.length===0)return t.center=f.clone(f.ZERO,t.center),t.radius=0,t;const n=f.clone(e[0],IM),i=f.clone(n,EM),o=f.clone(n,xM),r=f.clone(n,wM),s=f.clone(n,SM),a=f.clone(n,vM),c=f.clone(n,DM),u=e.length;let d;for(d=1;d<u;d++){f.clone(e[d],n);const R=n.x,F=n.y,U=n.z;R<i.x&&f.clone(n,i),R>s.x&&f.clone(n,s),F<o.y&&f.clone(n,o),F>a.y&&f.clone(n,a),U<r.z&&f.clone(n,r),U>c.z&&f.clone(n,c)}const h=f.magnitudeSquared(f.subtract(s,i,as)),m=f.magnitudeSquared(f.subtract(a,o,as)),g=f.magnitudeSquared(f.subtract(c,r,as));let p=i,y=s,b=h;m>b&&(b=m,p=o,y=a),g>b&&(b=g,p=r,y=c);const C=PM;C.x=(p.x+y.x)*.5,C.y=(p.y+y.y)*.5,C.z=(p.z+y.z)*.5;let E=f.magnitudeSquared(f.subtract(y,C,as)),w=Math.sqrt(E);const S=OM;S.x=i.x,S.y=o.y,S.z=r.z;const P=LM;P.x=s.x,P.y=a.y,P.z=c.z;const L=f.midpoint(S,P,BM);let z=0;for(d=0;d<u;d++){f.clone(e[d],n);const R=f.magnitude(f.subtract(n,L,as));R>z&&(z=R);const F=f.magnitudeSquared(f.subtract(n,C,as));if(F>E){const U=Math.sqrt(F);w=(w+U)*.5,E=w*w;const D=U-w;C.x=(w*C.x+D*n.x)/U,C.y=(w*C.y+D*n.y)/U,C.z=(w*C.z+D*n.z)/U}}return w<z?(f.clone(C,t.center),t.radius=w):(f.clone(L,t.center),t.radius=z),t};const Swe=new nr,vwe=new f,Dwe=new f,D1=new Ce,I1=new Ce;fe.fromRectangle2D=function(e,t,n){return fe.fromRectangleWithHeights2D(e,t,0,0,n)};fe.fromRectangleWithHeights2D=function(e,t,n,i,o){if(l(o)||(o=new fe),!l(e))return o.center=f.clone(f.ZERO,o.center),o.radius=0,o;t=A(t,Swe),ge.southwest(e,D1),D1.height=n,ge.northeast(e,I1),I1.height=i;const r=t.project(D1,vwe),s=t.project(I1,Dwe),a=s.x-r.x,c=s.y-r.y,u=s.z-r.z;o.radius=Math.sqrt(a*a+c*c+u*u)*.5;const d=o.center;return d.x=r.x+a*.5,d.y=r.y+c*.5,d.z=r.z+u*.5,o};const Iwe=[];fe.fromRectangle3D=function(e,t,n,i){if(t=A(t,me.WGS84),n=A(n,0),l(i)||(i=new fe),!l(e))return i.center=f.clone(f.ZERO,i.center),i.radius=0,i;const o=ge.subsample(e,t,n,Iwe);return fe.fromPoints(o,i)};fe.fromVertices=function(e,t,n,i){if(l(i)||(i=new fe),!l(e)||e.length===0)return i.center=f.clone(f.ZERO,i.center),i.radius=0,i;t=A(t,f.ZERO),n=A(n,3),T.typeOf.number.greaterThanOrEquals("stride",n,3);const o=IM;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;const r=f.clone(o,EM),s=f.clone(o,xM),a=f.clone(o,wM),c=f.clone(o,SM),u=f.clone(o,vM),d=f.clone(o,DM),h=e.length;let m;for(m=0;m<h;m+=n){const U=e[m]+t.x,D=e[m+1]+t.y,I=e[m+2]+t.z;o.x=U,o.y=D,o.z=I,U<r.x&&f.clone(o,r),U>c.x&&f.clone(o,c),D<s.y&&f.clone(o,s),D>u.y&&f.clone(o,u),I<a.z&&f.clone(o,a),I>d.z&&f.clone(o,d)}const g=f.magnitudeSquared(f.subtract(c,r,as)),p=f.magnitudeSquared(f.subtract(u,s,as)),y=f.magnitudeSquared(f.subtract(d,a,as));let b=r,C=c,E=g;p>E&&(E=p,b=s,C=u),y>E&&(E=y,b=a,C=d);const w=PM;w.x=(b.x+C.x)*.5,w.y=(b.y+C.y)*.5,w.z=(b.z+C.z)*.5;let S=f.magnitudeSquared(f.subtract(C,w,as)),P=Math.sqrt(S);const L=OM;L.x=r.x,L.y=s.y,L.z=a.z;const z=LM;z.x=c.x,z.y=u.y,z.z=d.z;const R=f.midpoint(L,z,BM);let F=0;for(m=0;m<h;m+=n){o.x=e[m]+t.x,o.y=e[m+1]+t.y,o.z=e[m+2]+t.z;const U=f.magnitude(f.subtract(o,R,as));U>F&&(F=U);const D=f.magnitudeSquared(f.subtract(o,w,as));if(D>S){const I=Math.sqrt(D);P=(P+I)*.5,S=P*P;const _=I-P;w.x=(P*w.x+_*o.x)/I,w.y=(P*w.y+_*o.y)/I,w.z=(P*w.z+_*o.z)/I}}return P<F?(f.clone(w,i.center),i.radius=P):(f.clone(R,i.center),i.radius=F),i};fe.fromEncodedCartesianVertices=function(e,t,n){if(l(n)||(n=new fe),!l(e)||!l(t)||e.length!==t.length||e.length===0)return n.center=f.clone(f.ZERO,n.center),n.radius=0,n;const i=IM;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const o=f.clone(i,EM),r=f.clone(i,xM),s=f.clone(i,wM),a=f.clone(i,SM),c=f.clone(i,vM),u=f.clone(i,DM),d=e.length;let h;for(h=0;h<d;h+=3){const F=e[h]+t[h],U=e[h+1]+t[h+1],D=e[h+2]+t[h+2];i.x=F,i.y=U,i.z=D,F<o.x&&f.clone(i,o),F>a.x&&f.clone(i,a),U<r.y&&f.clone(i,r),U>c.y&&f.clone(i,c),D<s.z&&f.clone(i,s),D>u.z&&f.clone(i,u)}const m=f.magnitudeSquared(f.subtract(a,o,as)),g=f.magnitudeSquared(f.subtract(c,r,as)),p=f.magnitudeSquared(f.subtract(u,s,as));let y=o,b=a,C=m;g>C&&(C=g,y=r,b=c),p>C&&(C=p,y=s,b=u);const E=PM;E.x=(y.x+b.x)*.5,E.y=(y.y+b.y)*.5,E.z=(y.z+b.z)*.5;let w=f.magnitudeSquared(f.subtract(b,E,as)),S=Math.sqrt(w);const P=OM;P.x=o.x,P.y=r.y,P.z=s.z;const L=LM;L.x=a.x,L.y=c.y,L.z=u.z;const z=f.midpoint(P,L,BM);let R=0;for(h=0;h<d;h+=3){i.x=e[h]+t[h],i.y=e[h+1]+t[h+1],i.z=e[h+2]+t[h+2];const F=f.magnitude(f.subtract(i,z,as));F>R&&(R=F);const U=f.magnitudeSquared(f.subtract(i,E,as));if(U>w){const D=Math.sqrt(U);S=(S+D)*.5,w=S*S;const I=D-S;E.x=(S*E.x+I*i.x)/D,E.y=(S*E.y+I*i.y)/D,E.z=(S*E.z+I*i.z)/D}}return S<R?(f.clone(E,n.center),n.radius=S):(f.clone(z,n.center),n.radius=R),n};fe.fromCornerPoints=function(e,t,n){T.typeOf.object("corner",e),T.typeOf.object("oppositeCorner",t),l(n)||(n=new fe);const i=f.midpoint(e,t,n.center);return n.radius=f.distance(i,t),n};fe.fromEllipsoid=function(e,t){return T.typeOf.object("ellipsoid",e),l(t)||(t=new fe),f.clone(f.ZERO,t.center),t.radius=e.maximumRadius,t};const Pwe=new f;fe.fromBoundingSpheres=function(e,t){if(l(t)||(t=new fe),!l(e)||e.length===0)return t.center=f.clone(f.ZERO,t.center),t.radius=0,t;const n=e.length;if(n===1)return fe.clone(e[0],t);if(n===2)return fe.union(e[0],e[1],t);const i=[];let o;for(o=0;o<n;o++)i.push(e[o].center);t=fe.fromPoints(i,t);const r=t.center;let s=t.radius;for(o=0;o<n;o++){const a=e[o];s=Math.max(s,f.distance(r,a.center,Pwe)+a.radius)}return t.radius=s,t};const Owe=new f,Lwe=new f,Bwe=new f;fe.fromOrientedBoundingBox=function(e,t){T.defined("orientedBoundingBox",e),l(t)||(t=new fe);const n=e.halfAxes,i=J.getColumn(n,0,Owe),o=J.getColumn(n,1,Lwe),r=J.getColumn(n,2,Bwe);return f.add(i,o,i),f.add(i,r,i),t.center=f.clone(e.center,t.center),t.radius=f.magnitude(i),t};const Rwe=new f,Nwe=new f;fe.fromTransformation=function(e,t){T.typeOf.object("transformation",e),l(t)||(t=new fe);const n=B.getTranslation(e,Rwe),i=B.getScale(e,Nwe),o=.5*f.magnitude(i);return t.center=f.clone(n,t.center),t.radius=o,t};fe.clone=function(e,t){if(l(e))return l(t)?(t.center=f.clone(e.center,t.center),t.radius=e.radius,t):new fe(e.center,e.radius)};fe.packedLength=4;fe.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=A(n,0);const i=e.center;return t[n++]=i.x,t[n++]=i.y,t[n++]=i.z,t[n]=e.radius,t};fe.unpack=function(e,t,n){T.defined("array",e),t=A(t,0),l(n)||(n=new fe);const i=n.center;return i.x=e[t++],i.y=e[t++],i.z=e[t++],n.radius=e[t],n};const Mwe=new f,Fwe=new f;fe.union=function(e,t,n){T.typeOf.object("left",e),T.typeOf.object("right",t),l(n)||(n=new fe);const i=e.center,o=e.radius,r=t.center,s=t.radius,a=f.subtract(r,i,Mwe),c=f.magnitude(a);if(o>=c+s)return e.clone(n),n;if(s>=c+o)return t.clone(n),n;const u=(o+c+s)*.5,d=f.multiplyByScalar(a,(-o+u)/c,Fwe);return f.add(d,i,d),f.clone(d,n.center),n.radius=u,n};const zwe=new f;fe.expand=function(e,t,n){T.typeOf.object("sphere",e),T.typeOf.object("point",t),n=fe.clone(e,n);const i=f.magnitude(f.subtract(t,n.center,zwe));return i>n.radius&&(n.radius=i),n};fe.intersectPlane=function(e,t){T.typeOf.object("sphere",e),T.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=f.dot(o,n)+t.distance;return r<-i?xn.OUTSIDE:r<i?xn.INTERSECTING:xn.INSIDE};fe.transform=function(e,t,n){return T.typeOf.object("sphere",e),T.typeOf.object("transform",t),l(n)||(n=new fe),n.center=B.multiplyByPoint(t,e.center,n.center),n.radius=B.getMaximumScale(t)*e.radius,n};const Uwe=new f;fe.distanceSquaredTo=function(e,t){T.typeOf.object("sphere",e),T.typeOf.object("cartesian",t);const n=f.subtract(e.center,t,Uwe),i=f.magnitude(n)-e.radius;return i<=0?0:i*i};fe.transformWithoutScale=function(e,t,n){return T.typeOf.object("sphere",e),T.typeOf.object("transform",t),l(n)||(n=new fe),n.center=B.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const Hwe=new f;fe.computePlaneDistances=function(e,t,n,i){T.typeOf.object("sphere",e),T.typeOf.object("position",t),T.typeOf.object("direction",n),l(i)||(i=new Jh);const o=f.subtract(e.center,t,Hwe),r=f.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};const c4=new f,Vwe=new f,kwe=new f,Gwe=new f,Wwe=new f,jwe=new Ce,$q=new Array(8);for(let e=0;e<8;++e)$q[e]=new f;const qwe=new nr;fe.projectTo2D=function(e,t,n){T.typeOf.object("sphere",e),t=A(t,qwe);const i=t.ellipsoid;let o=e.center;const r=e.radius;let s;f.equals(o,f.ZERO)?s=f.clone(f.UNIT_X,c4):s=i.geodeticSurfaceNormal(o,c4);const a=f.cross(f.UNIT_Z,s,Vwe);f.normalize(a,a);const c=f.cross(s,a,kwe);f.normalize(c,c),f.multiplyByScalar(s,r,s),f.multiplyByScalar(c,r,c),f.multiplyByScalar(a,r,a);const u=f.negate(c,Wwe),d=f.negate(a,Gwe),h=$q;let m=h[0];f.add(s,c,m),f.add(m,a,m),m=h[1],f.add(s,c,m),f.add(m,d,m),m=h[2],f.add(s,u,m),f.add(m,d,m),m=h[3],f.add(s,u,m),f.add(m,a,m),f.negate(s,s),m=h[4],f.add(s,c,m),f.add(m,a,m),m=h[5],f.add(s,c,m),f.add(m,d,m),m=h[6],f.add(s,u,m),f.add(m,d,m),m=h[7],f.add(s,u,m),f.add(m,a,m);const g=h.length;for(let C=0;C<g;++C){const E=h[C];f.add(o,E,E);const w=i.cartesianToCartographic(E,jwe);t.project(w,E)}n=fe.fromPoints(h,n),o=n.center;const p=o.x,y=o.y,b=o.z;return o.x=b,o.y=p,o.z=y,n};fe.isOccluded=function(e,t){return T.typeOf.object("sphere",e),T.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)};fe.equals=function(e,t){return e===t||l(e)&&l(t)&&f.equals(e.center,t.center)&&e.radius===t.radius};fe.prototype.intersectPlane=function(e){return fe.intersectPlane(this,e)};fe.prototype.distanceSquaredTo=function(e){return fe.distanceSquaredTo(this,e)};fe.prototype.computePlaneDistances=function(e,t,n){return fe.computePlaneDistances(this,e,t,n)};fe.prototype.isOccluded=function(e){return fe.isOccluded(this,e)};fe.prototype.equals=function(e){return fe.equals(this,e)};fe.prototype.clone=function(e){return fe.clone(this,e)};fe.prototype.volume=function(){const e=this.radius;return wwe*e*e*e};const $we={NONE:0,LERC:1},EB=Object.freeze($we);function Ns(e,t,n){this.minimum=f.clone(A(e,f.ZERO)),this.maximum=f.clone(A(t,f.ZERO)),l(n)?n=f.clone(n):n=f.midpoint(this.minimum,this.maximum,new f),this.center=n}Ns.fromCorners=function(e,t,n){return T.defined("minimum",e),T.defined("maximum",t),l(n)||(n=new Ns),n.minimum=f.clone(e,n.minimum),n.maximum=f.clone(t,n.maximum),n.center=f.midpoint(e,t,n.center),n};Ns.fromPoints=function(e,t){if(l(t)||(t=new Ns),!l(e)||e.length===0)return t.minimum=f.clone(f.ZERO,t.minimum),t.maximum=f.clone(f.ZERO,t.maximum),t.center=f.clone(f.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;const c=e.length;for(let h=1;h<c;h++){const m=e[h],g=m.x,p=m.y,y=m.z;n=Math.min(g,n),r=Math.max(g,r),i=Math.min(p,i),s=Math.max(p,s),o=Math.min(y,o),a=Math.max(y,a)}const u=t.minimum;u.x=n,u.y=i,u.z=o;const d=t.maximum;return d.x=r,d.y=s,d.z=a,t.center=f.midpoint(u,d,t.center),t};Ns.clone=function(e,t){if(l(e))return l(t)?(t.minimum=f.clone(e.minimum,t.minimum),t.maximum=f.clone(e.maximum,t.maximum),t.center=f.clone(e.center,t.center),t):new Ns(e.minimum,e.maximum,e.center)};Ns.equals=function(e,t){return e===t||l(e)&&l(t)&&f.equals(e.center,t.center)&&f.equals(e.minimum,t.minimum)&&f.equals(e.maximum,t.maximum)};let kE=new f;Ns.intersectPlane=function(e,t){T.defined("box",e),T.defined("plane",t),kE=f.subtract(e.maximum,e.minimum,kE);const n=f.multiplyByScalar(kE,.5,kE),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=f.dot(e.center,i)+t.distance;return r-o>0?xn.INSIDE:r+o<0?xn.OUTSIDE:xn.INTERSECTING};Ns.prototype.clone=function(e){return Ns.clone(this,e)};Ns.prototype.intersectPlane=function(e){return Ns.intersectPlane(this,e)};Ns.prototype.equals=function(e){return Ns.equals(this,e)};function El(e,t){T.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new f,this._cameraPositionInScaledSpace=new f,this._distanceToLimbInScaledSpaceSquared=0,l(t)&&(this.cameraPosition=t)}Object.defineProperties(El.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},cameraPosition:{get:function(){return this._cameraPosition},set:function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,this._cameraPositionInScaledSpace),i=f.magnitudeSquared(n)-1;f.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});const Yq=new f;El.prototype.isPointVisible=function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,Yq);return RM(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};El.prototype.isScaledSpacePointVisible=function(e){return RM(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const Ywe=new f;El.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,o;return l(t)&&t<0&&n.minimumRadius>-t?(o=Ywe,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),RM(e,o,i)};El.prototype.computeHorizonCullingPoint=function(e,t,n){return Jq(this._ellipsoid,e,t,n)};const Xq=me.clone(me.UNIT_SPHERE);El.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){const o=Kq(this._ellipsoid,n,Xq);return Jq(o,e,t,i)};El.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return Qq(this._ellipsoid,e,t,n,i,o)};El.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){const s=Kq(this._ellipsoid,o,Xq);return Qq(s,e,t,n,i,r)};const Xwe=[];El.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){T.typeOf.object("rectangle",e);const i=ge.subsample(e,t,0,Xwe),o=fe.fromPoints(i);if(!(f.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const Kwe=new f;function Kq(e,t,n){if(l(t)&&t<0&&e.minimumRadius>-t){const i=f.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,Kwe);e=me.fromCartesian3(i,n)}return e}function Jq(e,t,n,i){T.typeOf.object("directionToPoint",t),T.defined("positions",n),l(i)||(i=new f);const o=t7(e,t);let r=0;for(let s=0,a=n.length;s<a;++s){const c=n[s],u=Zq(e,c,o);if(u<0)return;r=Math.max(r,u)}return e7(o,r,i)}const GE=new f;function Qq(e,t,n,i,o,r){T.typeOf.object("directionToPoint",t),T.defined("vertices",n),T.typeOf.number("stride",i),l(r)||(r=new f),i=A(i,3),o=A(o,f.ZERO);const s=t7(e,t);let a=0;for(let c=0,u=n.length;c<u;c+=i){GE.x=n[c]+o.x,GE.y=n[c+1]+o.y,GE.z=n[c+2]+o.z;const d=Zq(e,GE,s);if(d<0)return;a=Math.max(a,d)}return e7(s,a,r)}function RM(e,t,n){const i=t,o=n,r=f.subtract(e,i,Yq),s=-f.dot(r,i);return!(o<0?s>0:s>o&&s*s/f.magnitudeSquared(r)>o)}const Jwe=new f,Qwe=new f;function Zq(e,t,n){const i=e.transformPositionToScaledSpace(t,Jwe);let o=f.magnitudeSquared(i),r=Math.sqrt(o);const s=f.divideByScalar(i,r,Qwe);o=Math.max(1,o),r=Math.max(1,r);const a=f.dot(s,n),c=f.magnitude(f.cross(s,n,s)),u=1/r,d=Math.sqrt(o-1)*u;return 1/(a*u-c*d)}function e7(e,t,n){if(!(t<=0||t===1/0||t!==t))return f.multiplyByScalar(e,t,n)}const P1=new f;function t7(e,t){return f.equals(t,f.ZERO)?t:(e.transformPositionToScaledSpace(t,P1),f.normalize(P1,P1))}const NM={};NM.computeDiscriminant=function(e,t,n){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");return t*t-4*e*n};function l4(e,t,n){const i=e+t;return M.sign(e)!==M.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}NM.computeRealRoots=function(e,t,n){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");let i;if(e===0)return t===0?[]:[-n/t];if(t===0){if(n===0)return[0,0];const c=Math.abs(n),u=Math.abs(e);if(c<u&&c/u<M.EPSILON14)return[0,0];if(c>u&&u/c<M.EPSILON14)return[];if(i=-n/e,i<0)return[];const d=Math.sqrt(i);return[-d,d]}else if(n===0)return i=-t/e,i<0?[i,0]:[0,i];const o=t*t,r=4*e*n,s=l4(o,-r,M.EPSILON14);if(s<0)return[];const a=-.5*l4(t,M.sign(t)*Math.sqrt(s),M.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};const _f=NM,MM={};MM.computeDiscriminant=function(e,t,n,i){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");if(typeof i!="number")throw new x("d is a required number.");const 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 O1(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,c=o*s,u=r*a,d=r*r,h=s*s,m=o*s-d,g=o*a-r*s,p=r*a-h,y=4*m*p-g*g;let b,C;if(y<0){let K,q,te;d*u>=c*h?(K=o,q=m,te=-2*r*m+o*g):(K=a,q=p,te=-a*g+2*s*p);const X=-(te<0?-1:1)*Math.abs(K)*Math.sqrt(-y);C=-te+X;const $=C/2,se=$<0?-Math.pow(-$,1/3):Math.pow($,1/3),ue=C===X?-se:-q/se;return b=q<=0?se+ue:-te/(se*se+ue*ue+q),d*u>=c*h?[(b-r)/o]:[-a/(b+s)]}const E=m,w=-2*r*m+o*g,S=p,P=-a*g+2*s*p,L=Math.sqrt(y),z=Math.sqrt(3)/2;let R=Math.abs(Math.atan2(o*L,-w)/3);b=2*Math.sqrt(-E);let F=Math.cos(R);C=b*F;let U=b*(-F/2-z*Math.sin(R));const D=C+U>2*r?C-r:U-r,I=o,_=D/I;R=Math.abs(Math.atan2(a*L,-P)/3),b=2*Math.sqrt(-S),F=Math.cos(R),C=b*F,U=b*(-F/2-z*Math.sin(R));const v=-a,O=C+U<2*s?C+s:U+s,N=v/O,V=I*O,k=-D*O-I*v,G=D*v,W=(s*k-r*G)/(-r*k+s*V);return _<=W?_<=N?W<=N?[_,W,N]:[_,N,W]:[N,_,W]:_<=N?[W,_,N]:W<=N?[W,N,_]:[N,W,_]}MM.computeRealRoots=function(e,t,n,i){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");if(typeof i!="number")throw new x("d is a required number.");let o,r;if(e===0)return _f.computeRealRoots(t,n,i);if(t===0){if(n===0){if(i===0)return[0,0,0];r=-i/e;const s=r<0?-Math.pow(-r,1/3):Math.pow(r,1/3);return[s,s,s]}else if(i===0)return o=_f.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return O1(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):O1(e,t,0,i);if(i===0)return o=_f.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 O1(e,t,n,i)};const FM=MM,zM={};zM.computeDiscriminant=function(e,t,n,i,o){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");if(typeof i!="number")throw new x("d is a required number.");if(typeof o!="number")throw new x("e is a required number.");const r=e*e,s=r*e,a=t*t,c=a*t,u=n*n,d=u*n,h=i*i,m=h*i,g=o*o,p=g*o;return a*u*h-4*c*m-4*e*d*h+18*e*t*n*m-27*r*h*h+256*s*p+o*(18*c*n*i-4*a*d+16*e*u*u-80*e*t*u*i-6*e*a*h+144*r*n*h)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function Bl(e,t,n,i){const 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=FM.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(c.length>0){const u=-e/4,d=c[c.length-1];if(Math.abs(d)<M.EPSILON14){const h=_f.computeRealRoots(1,r,a);if(h.length===2){const m=h[0],g=h[1];let p;if(m>=0&&g>=0){const y=Math.sqrt(m),b=Math.sqrt(g);return[u-b,u-y,u+y,u+b]}else{if(m>=0&&g<0)return p=Math.sqrt(m),[u-p,u+p];if(m<0&&g>=0)return p=Math.sqrt(g),[u-p,u+p]}}return[]}else if(d>0){const h=Math.sqrt(d),m=(r+d-s/h)/2,g=(r+d+s/h)/2,p=_f.computeRealRoots(1,h,m),y=_f.computeRealRoots(1,-h,g);return p.length!==0?(p[0]+=u,p[1]+=u,y.length!==0?(y[0]+=u,y[1]+=u,p[1]<=y[0]?[p[0],p[1],y[0],y[1]]:y[1]<=p[0]?[y[0],y[1],p[0],p[1]]:p[0]>=y[0]&&p[1]<=y[1]?[y[0],p[0],p[1],y[1]]:y[0]>=p[0]&&y[1]<=p[1]?[p[0],y[0],y[1],p[1]]:p[0]>y[0]&&p[0]<y[1]?[y[0],p[0],y[1],p[1]]:[p[0],y[0],p[1],y[1]]):p):y.length!==0?(y[0]+=u,y[1]+=u,y):[]}}return[]}function fA(e,t,n,i){const o=n*n,r=t*t,s=e*e,a=-2*t,c=n*e+r-4*i,u=s*i-n*t*e+o,d=FM.computeRealRoots(1,a,c,u);if(d.length>0){const h=d[0],m=t-h,g=m*m,p=e/2,y=m/2,b=g-4*i,C=g+4*Math.abs(i),E=s-4*h,w=s+4*Math.abs(h);let S,P;if(h<0||b*w<E*C){const I=Math.sqrt(E);S=I/2,P=I===0?0:(e*y-n)/I}else{const I=Math.sqrt(b);S=I===0?0:(e*y-n)/I,P=I/2}let L,z;p===0&&S===0?(L=0,z=0):M.sign(p)===M.sign(S)?(L=p+S,z=h/L):(z=p-S,L=h/z);let R,F;y===0&&P===0?(R=0,F=0):M.sign(y)===M.sign(P)?(R=y+P,F=i/R):(F=y-P,R=i/F);const U=_f.computeRealRoots(1,L,R),D=_f.computeRealRoots(1,z,F);if(U.length!==0)return D.length!==0?U[1]<=D[0]?[U[0],U[1],D[0],D[1]]:D[1]<=U[0]?[D[0],D[1],U[0],U[1]]:U[0]>=D[0]&&U[1]<=D[1]?[D[0],U[0],U[1],D[1]]:D[0]>=U[0]&&D[1]<=U[1]?[U[0],D[0],D[1],U[1]]:U[0]>D[0]&&U[0]<D[1]?[D[0],U[0],D[1],U[1]]:[U[0],D[0],U[1],D[1]]:U;if(D.length!==0)return D}return[]}zM.computeRealRoots=function(e,t,n,i,o){if(typeof e!="number")throw new x("a is a required number.");if(typeof t!="number")throw new x("b is a required number.");if(typeof n!="number")throw new x("c is a required number.");if(typeof i!="number")throw new x("d is a required number.");if(typeof o!="number")throw new x("e is a required number.");if(Math.abs(e)<M.EPSILON15)return FM.computeRealRoots(t,n,i,o);const r=t/e,s=n/e,a=i/e,c=o/e;let u=r<0?1:0;switch(u+=s<0?u+1:u,u+=a<0?u+1:u,u+=c<0?u+1:u,u){case 0:return Bl(r,s,a,c);case 1:return fA(r,s,a,c);case 2:return fA(r,s,a,c);case 3:return Bl(r,s,a,c);case 4:return Bl(r,s,a,c);case 5:return fA(r,s,a,c);case 6:return Bl(r,s,a,c);case 7:return Bl(r,s,a,c);case 8:return fA(r,s,a,c);case 9:return Bl(r,s,a,c);case 10:return Bl(r,s,a,c);case 11:return fA(r,s,a,c);case 12:return Bl(r,s,a,c);case 13:return Bl(r,s,a,c);case 14:return Bl(r,s,a,c);case 15:return Bl(r,s,a,c);default:return}};const Zwe=zM;function Un(e,t){t=f.clone(A(t,f.ZERO)),f.equals(t,f.ZERO)||f.normalize(t,t),this.origin=f.clone(A(e,f.ZERO)),this.direction=t}Un.clone=function(e,t){if(l(e))return l(t)?(t.origin=f.clone(e.origin),t.direction=f.clone(e.direction),t):new Un(e.origin,e.direction)};Un.getPoint=function(e,t,n){return T.typeOf.object("ray",e),T.typeOf.number("t",t),l(n)||(n=new f),n=f.multiplyByScalar(e.direction,t,n),f.add(e.origin,n,n)};const To={};To.rayPlane=function(e,t,n){if(!l(e))throw new x("ray is required.");if(!l(t))throw new x("plane is required.");l(n)||(n=new f);const i=e.origin,o=e.direction,r=t.normal,s=f.dot(r,o);if(Math.abs(s)<M.EPSILON15)return;const a=(-t.distance-f.dot(r,i))/s;if(!(a<0))return n=f.multiplyByScalar(o,a,n),f.add(i,n,n)};const eSe=new f,tSe=new f,n7=new f,u4=new f,d4=new f;To.rayTriangleParametric=function(e,t,n,i,o){if(!l(e))throw new x("ray is required.");if(!l(t))throw new x("p0 is required.");if(!l(n))throw new x("p1 is required.");if(!l(i))throw new x("p2 is required.");o=A(o,!1);const r=e.origin,s=e.direction,a=f.subtract(n,t,eSe),c=f.subtract(i,t,tSe),u=f.cross(s,c,n7),d=f.dot(a,u);let h,m,g,p,y;if(o){if(d<M.EPSILON6||(h=f.subtract(r,t,u4),g=f.dot(h,u),g<0||g>d)||(m=f.cross(h,a,d4),p=f.dot(s,m),p<0||g+p>d))return;y=f.dot(c,m)/d}else{if(Math.abs(d)<M.EPSILON6)return;const b=1/d;if(h=f.subtract(r,t,u4),g=f.dot(h,u)*b,g<0||g>1||(m=f.cross(h,a,d4),p=f.dot(s,m)*b,p<0||g+p>1))return;y=f.dot(c,m)*b}return y};To.rayTriangle=function(e,t,n,i,o,r){const s=To.rayTriangleParametric(e,t,n,i,o);if(!(!l(s)||s<0))return l(r)||(r=new f),f.multiplyByScalar(e.direction,s,r),f.add(e.origin,r,r)};const nSe=new Un;To.lineSegmentTriangle=function(e,t,n,i,o,r,s){if(!l(e))throw new x("v0 is required.");if(!l(t))throw new x("v1 is required.");if(!l(n))throw new x("p0 is required.");if(!l(i))throw new x("p1 is required.");if(!l(o))throw new x("p2 is required.");const a=nSe;f.clone(e,a.origin),f.subtract(t,e,a.direction),f.normalize(a.direction,a.direction);const c=To.rayTriangleParametric(a,n,i,o,r);if(!(!l(c)||c<0||c>f.distance(e,t)))return l(s)||(s=new f),f.multiplyByScalar(a.direction,c,s),f.add(a.origin,s,s)};function iSe(e,t,n,i){const o=t*t-4*e*n;if(o<0)return;if(o>0){const s=1/(2*e),a=Math.sqrt(o),c=(-t+a)*s,u=(-t-a)*s;return c<u?(i.root0=c,i.root1=u):(i.root0=u,i.root1=c),i}const r=-t/(2*e);if(r!==0)return i.root0=i.root1=r,i}const oSe={root0:0,root1:0};function i7(e,t,n){l(n)||(n=new Jh);const i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=f.subtract(i,r,n7),c=f.dot(o,o),u=2*f.dot(o,a),d=f.magnitudeSquared(a)-s,h=iSe(c,u,d,oSe);if(l(h))return n.start=h.root0,n.stop=h.root1,n}To.raySphere=function(e,t,n){if(!l(e))throw new x("ray is required.");if(!l(t))throw new x("sphere is required.");if(n=i7(e,t,n),!(!l(n)||n.stop<0))return n.start=Math.max(n.start,0),n};const rSe=new Un;To.lineSegmentSphere=function(e,t,n,i){if(!l(e))throw new x("p0 is required.");if(!l(t))throw new x("p1 is required.");if(!l(n))throw new x("sphere is required.");const o=rSe;f.clone(e,o.origin);const r=f.subtract(t,e,o.direction),s=f.magnitude(r);if(f.normalize(r,r),i=i7(o,n,i),!(!l(i)||i.stop<0||i.start>s))return i.start=Math.max(i.start,0),i.stop=Math.min(i.stop,s),i};const sSe=new f,aSe=new f;To.rayEllipsoid=function(e,t){if(!l(e))throw new x("ray is required.");if(!l(t))throw new x("ellipsoid is required.");const n=t.oneOverRadii,i=f.multiplyComponents(n,e.origin,sSe),o=f.multiplyComponents(n,e.direction,aSe),r=f.magnitudeSquared(i),s=f.dot(i,o);let a,c,u,d,h;if(r>1){if(s>=0)return;const m=s*s;if(a=r-1,c=f.magnitudeSquared(o),u=c*a,m<u)return;if(m>u){d=s*s-u,h=-s+Math.sqrt(d);const p=h/c,y=a/h;return p<y?new Jh(p,y):{start:y,stop:p}}const g=Math.sqrt(a/c);return new Jh(g,g)}else if(r<1)return a=r-1,c=f.magnitudeSquared(o),u=c*a,d=s*s-u,h=-s+Math.sqrt(d),new Jh(0,h/c);if(s<0)return c=f.magnitudeSquared(o),new Jh(0,-s/c)};function mm(e,t,n){const i=e+t;return M.sign(e)!==M.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}function cSe(e,t,n,i,o){const r=i*i,s=o*o,a=(e[J.COLUMN1ROW1]-e[J.COLUMN2ROW2])*s,c=o*(i*mm(e[J.COLUMN1ROW0],e[J.COLUMN0ROW1],M.EPSILON15)+t.y),u=e[J.COLUMN0ROW0]*r+e[J.COLUMN2ROW2]*s+i*t.x+n,d=s*mm(e[J.COLUMN2ROW1],e[J.COLUMN1ROW2],M.EPSILON15),h=o*(i*mm(e[J.COLUMN2ROW0],e[J.COLUMN0ROW2])+t.z);let m;const g=[];if(h===0&&d===0){if(m=_f.computeRealRoots(a,c,u),m.length===0)return g;const R=m[0],F=Math.sqrt(Math.max(1-R*R,0));if(g.push(new f(i,o*R,o*-F)),g.push(new f(i,o*R,o*F)),m.length===2){const U=m[1],D=Math.sqrt(Math.max(1-U*U,0));g.push(new f(i,o*U,o*-D)),g.push(new f(i,o*U,o*D))}return g}const p=h*h,y=d*d,b=a*a,C=h*d,E=b+y,w=2*(c*a+C),S=2*u*a+c*c-y+p,P=2*(u*c-C),L=u*u-p;if(E===0&&w===0&&S===0&&P===0)return g;m=Zwe.computeRealRoots(E,w,S,P,L);const z=m.length;if(z===0)return g;for(let R=0;R<z;++R){const F=m[R],U=F*F,D=Math.max(1-U,0),I=Math.sqrt(D);let _;M.sign(a)===M.sign(u)?_=mm(a*U+u,c*F,M.EPSILON12):M.sign(u)===M.sign(c*F)?_=mm(a*U,c*F+u,M.EPSILON12):_=mm(a*U+c*F,u,M.EPSILON12);const v=mm(d*F,h,M.EPSILON15),O=_*v;O<0?g.push(new f(i,o*F,o*I)):O>0?g.push(new f(i,o*F,o*-I)):I!==0?(g.push(new f(i,o*F,o*-I)),g.push(new f(i,o*F,o*I)),++R):g.push(new f(i,o*F,o*I))}return g}const L1=new f,f4=new f,h4=new f,WE=new f,lSe=new f,uSe=new J,dSe=new J,fSe=new J,hSe=new J,pSe=new J,p4=new J,m4=new J,_4=new f,mSe=new f,_Se=new Ce;To.grazingAltitudeLocation=function(e,t){if(!l(e))throw new x("ray is required.");if(!l(t))throw new x("ellipsoid is required.");const n=e.origin,i=e.direction;if(!f.equals(n,f.ZERO)){const L=t.geodeticSurfaceNormal(n,L1);if(f.dot(i,L)>=0)return n}const o=l(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,L1),s=f.normalize(r,r),a=f.mostOrthogonalAxis(r,WE),c=f.normalize(f.cross(a,s,f4),f4),u=f.normalize(f.cross(s,c,h4),h4),d=uSe;d[0]=s.x,d[1]=s.y,d[2]=s.z,d[3]=c.x,d[4]=c.y,d[5]=c.z,d[6]=u.x,d[7]=u.y,d[8]=u.z;const h=J.transpose(d,dSe),m=J.fromScale(t.radii,fSe),g=J.fromScale(t.oneOverRadii,hSe),p=pSe;p[0]=0,p[1]=-i.z,p[2]=i.y,p[3]=i.z,p[4]=0,p[5]=-i.x,p[6]=-i.y,p[7]=i.x,p[8]=0;const y=J.multiply(J.multiply(h,g,p4),p,p4),b=J.multiply(J.multiply(y,m,m4),d,m4),C=J.multiplyByVector(y,n,lSe),E=cSe(b,f.negate(C,L1),0,0,1);let w,S;const P=E.length;if(P>0){let L=f.clone(f.ZERO,mSe),z=Number.NEGATIVE_INFINITY;for(let F=0;F<P;++F){w=J.multiplyByVector(m,J.multiplyByVector(d,E[F],_4),_4);const U=f.normalize(f.subtract(w,n,WE),WE),D=f.dot(U,i);D>z&&(z=D,L=f.clone(w,L))}const R=t.cartesianToCartographic(L,_Se);return z=M.clamp(z,0,1),S=f.magnitude(f.subtract(L,n,WE))*Math.sqrt(1-z*z),S=o?-S:S,R.height=S,t.cartographicToCartesian(R,new f)}};const gSe=new f;To.lineSegmentPlane=function(e,t,n,i){if(!l(e))throw new x("endPoint0 is required.");if(!l(t))throw new x("endPoint1 is required.");if(!l(n))throw new x("plane is required.");l(i)||(i=new f);const o=f.subtract(t,e,gSe),r=n.normal,s=f.dot(r,o);if(Math.abs(s)<M.EPSILON6)return;const a=f.dot(r,e),c=-(n.distance+a)/s;if(!(c<0||c>1))return f.multiplyByScalar(o,c,i),f.add(e,i,i),i};To.trianglePlaneIntersection=function(e,t,n,i){if(!l(e)||!l(t)||!l(n)||!l(i))throw new x("p0, p1, p2, and plane are required.");const o=i.normal,r=i.distance,s=f.dot(o,e)+r<0,a=f.dot(o,t)+r<0,c=f.dot(o,n)+r<0;let u=0;u+=s?1:0,u+=a?1:0,u+=c?1:0;let d,h;if((u===1||u===2)&&(d=new f,h=new f),u===1){if(s)return To.lineSegmentPlane(e,t,i,d),To.lineSegmentPlane(e,n,i,h),{positions:[e,t,n,d,h],indices:[0,3,4,1,2,4,1,4,3]};if(a)return To.lineSegmentPlane(t,n,i,d),To.lineSegmentPlane(t,e,i,h),{positions:[e,t,n,d,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return To.lineSegmentPlane(n,e,i,d),To.lineSegmentPlane(n,t,i,h),{positions:[e,t,n,d,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!c)return To.lineSegmentPlane(e,n,i,d),To.lineSegmentPlane(t,n,i,h),{positions:[e,t,n,d,h],indices:[0,1,4,0,4,3,2,3,4]}}else return To.lineSegmentPlane(n,t,i,d),To.lineSegmentPlane(e,t,i,h),{positions:[e,t,n,d,h],indices:[2,0,4,2,4,3,1,3,4]};else return To.lineSegmentPlane(t,e,i,d),To.lineSegmentPlane(n,e,i,h),{positions:[e,t,n,d,h],indices:[1,2,4,1,4,3,0,3,4]}};const pr=To,B1=new oe;function ys(e,t){if(T.defined("origin",e),t=A(t,me.WGS84),e=t.scaleToGeodeticSurface(e),!l(e))throw new x("origin must not be at the center of the ellipsoid.");const n=cn.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=f.fromCartesian4(B.getColumn(n,0,B1)),this._yAxis=f.fromCartesian4(B.getColumn(n,1,B1));const i=f.fromCartesian4(B.getColumn(n,2,B1));this._plane=Pt.fromPointNormal(e,i)}Object.defineProperties(ys.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}}});const ySe=new Ns;ys.fromPoints=function(e,t){T.defined("cartesians",e);const n=Ns.fromPoints(e,ySe);return new ys(n.center,t)};const o7=new Un,XS=new f;ys.prototype.projectPointOntoPlane=function(e,t){T.defined("cartesian",e);const n=o7;n.origin=e,f.normalize(e,n.direction);let i=pr.rayPlane(n,this._plane,XS);if(l(i)||(f.negate(n.direction,n.direction),i=pr.rayPlane(n,this._plane,XS)),l(i)){const o=f.subtract(i,this._origin,i),r=f.dot(this._xAxis,o),s=f.dot(this._yAxis,o);return l(t)?(t.x=r,t.y=s,t):new j(r,s)}};ys.prototype.projectPointsOntoPlane=function(e,t){T.defined("cartesians",e),l(t)||(t=[]);let n=0;const i=e.length;for(let o=0;o<i;o++){const r=this.projectPointOntoPlane(e[o],t[n]);l(r)&&(t[n]=r,n++)}return t.length=n,t};ys.prototype.projectPointToNearestOnPlane=function(e,t){T.defined("cartesian",e),l(t)||(t=new j);const n=o7;n.origin=e,f.clone(this._plane.normal,n.direction);let i=pr.rayPlane(n,this._plane,XS);l(i)||(f.negate(n.direction,n.direction),i=pr.rayPlane(n,this._plane,XS));const o=f.subtract(i,this._origin,i),r=f.dot(this._xAxis,o),s=f.dot(this._yAxis,o);return t.x=r,t.y=s,t};ys.prototype.projectPointsToNearestOnPlane=function(e,t){T.defined("cartesians",e),l(t)||(t=[]);const n=e.length;t.length=n;for(let i=0;i<n;i++)t[i]=this.projectPointToNearestOnPlane(e[i],t[i]);return t};const ASe=new f;ys.prototype.projectPointOntoEllipsoid=function(e,t){T.defined("cartesian",e),l(t)||(t=new f);const n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=ASe;return f.multiplyByScalar(o,e.x,s),t=f.add(i,s,t),f.multiplyByScalar(r,e.y,s),f.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};ys.prototype.projectPointsOntoEllipsoid=function(e,t){T.defined("cartesians",e);const n=e.length;l(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};function zt(e,t){this.center=f.clone(A(e,f.ZERO)),this.halfAxes=J.clone(A(t,J.ZERO))}zt.packedLength=f.packedLength+J.packedLength;zt.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),f.pack(e.center,t,n),J.pack(e.halfAxes,t,n+f.packedLength),t};zt.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new zt),f.unpack(e,t,n.center),J.unpack(e,t+f.packedLength,n.halfAxes),n};const bSe=new f,CSe=new f,TSe=new f,ESe=new f,xSe=new f,wSe=new f,SSe=new J,vSe={unitary:new J,diagonal:new J};zt.fromPoints=function(e,t){if(l(t)||(t=new zt),!l(e)||e.length===0)return t.halfAxes=J.ZERO,t.center=f.ZERO,t;let n;const i=e.length,o=f.clone(e[0],bSe);for(n=1;n<i;n++)f.add(o,e[n],o);const r=1/i;f.multiplyByScalar(o,r,o);let s=0,a=0,c=0,u=0,d=0,h=0,m;for(n=0;n<i;n++)m=f.subtract(e[n],o,CSe),s+=m.x*m.x,a+=m.x*m.y,c+=m.x*m.z,u+=m.y*m.y,d+=m.y*m.z,h+=m.z*m.z;s*=r,a*=r,c*=r,u*=r,d*=r,h*=r;const g=SSe;g[0]=s,g[1]=a,g[2]=c,g[3]=a,g[4]=u,g[5]=d,g[6]=c,g[7]=d,g[8]=h;const p=J.computeEigenDecomposition(g,vSe),y=J.clone(p.unitary,t.halfAxes);let b=J.getColumn(y,0,ESe),C=J.getColumn(y,1,xSe),E=J.getColumn(y,2,wSe),w=-Number.MAX_VALUE,S=-Number.MAX_VALUE,P=-Number.MAX_VALUE,L=Number.MAX_VALUE,z=Number.MAX_VALUE,R=Number.MAX_VALUE;for(n=0;n<i;n++)m=e[n],w=Math.max(f.dot(b,m),w),S=Math.max(f.dot(C,m),S),P=Math.max(f.dot(E,m),P),L=Math.min(f.dot(b,m),L),z=Math.min(f.dot(C,m),z),R=Math.min(f.dot(E,m),R);b=f.multiplyByScalar(b,.5*(L+w),b),C=f.multiplyByScalar(C,.5*(z+S),C),E=f.multiplyByScalar(E,.5*(R+P),E);const F=f.add(b,C,t.center);f.add(F,E,F);const U=TSe;return U.x=w-L,U.y=S-z,U.z=P-R,f.multiplyByScalar(U,.5,U),J.multiplyByScale(t.halfAxes,U,t.halfAxes),t};const r7=new f,DSe=new f;function g4(e,t,n,i,o,r,s,a,c,u,d){if(!l(o)||!l(r)||!l(s)||!l(a)||!l(c)||!l(u))throw new x("all extents (minimum/maximum X/Y/Z) are required.");l(d)||(d=new zt);const h=d.halfAxes;J.setColumn(h,0,t,h),J.setColumn(h,1,n,h),J.setColumn(h,2,i,h);let m=r7;m.x=(o+r)/2,m.y=(s+a)/2,m.z=(c+u)/2;const g=DSe;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(u-c)/2;const p=d.center;return m=J.multiplyByVector(h,m,m),f.add(e,m,p),J.multiplyByScale(h,g,h),d}const y4=new Ce,ISe=new f,PSe=new Ce,OSe=new Ce,LSe=new Ce,BSe=new Ce,RSe=new Ce,NSe=new f,A4=new f,MSe=new f,b4=new f,FSe=new f,zSe=new j,USe=new j,HSe=new j,VSe=new j,kSe=new j,GSe=new f,WSe=new f,jSe=new f,qSe=new f,$Se=new j,YSe=new f,XSe=new f,KSe=new f,JSe=new Pt(f.UNIT_X,0);zt.fromRectangle=function(e,t,n,i,o){if(!l(e))throw new x("rectangle is required");if(e.width<0||e.width>M.TWO_PI)throw new x("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>M.PI)throw new x("Rectangle height must be between 0 and pi");if(l(i)&&!M.equalsEpsilon(i.radii.x,i.radii.y,M.EPSILON15))throw new x("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");t=A(t,0),n=A(n,0),i=A(i,me.WGS84);let r,s,a,c,u,d,h;if(e.width<=M.PI){const z=ge.center(e,y4),R=i.cartographicToCartesian(z,ISe),F=new ys(R,i);h=F.plane;const U=z.longitude,D=e.south<0&&e.north>0?0:z.latitude,I=Ce.fromRadians(U,e.north,n,PSe),_=Ce.fromRadians(e.west,e.north,n,OSe),v=Ce.fromRadians(e.west,D,n,LSe),O=Ce.fromRadians(e.west,e.south,n,BSe),N=Ce.fromRadians(U,e.south,n,RSe),V=i.cartographicToCartesian(I,NSe);let k=i.cartographicToCartesian(_,A4);const G=i.cartographicToCartesian(v,MSe);let W=i.cartographicToCartesian(O,b4);const K=i.cartographicToCartesian(N,FSe),q=F.projectPointToNearestOnPlane(V,zSe),te=F.projectPointToNearestOnPlane(k,USe),Y=F.projectPointToNearestOnPlane(G,HSe),X=F.projectPointToNearestOnPlane(W,VSe),$=F.projectPointToNearestOnPlane(K,kSe);return r=Math.min(te.x,Y.x,X.x),s=-r,c=Math.max(te.y,q.y),a=Math.min(X.y,$.y),_.height=O.height=t,k=i.cartographicToCartesian(_,A4),W=i.cartographicToCartesian(O,b4),u=Math.min(Pt.getPointDistance(h,k),Pt.getPointDistance(h,W)),d=n,g4(F.origin,F.xAxis,F.yAxis,F.zAxis,r,s,a,c,u,d,o)}const m=e.south>0,g=e.north<0,p=m?e.south:g?e.north:0,y=ge.center(e,y4).longitude,b=f.fromRadians(y,p,n,i,GSe);b.z=0;const E=Math.abs(b.x)<M.EPSILON10&&Math.abs(b.y)<M.EPSILON10?f.UNIT_X:f.normalize(b,WSe),w=f.UNIT_Z,S=f.cross(E,w,jSe);h=Pt.fromPointNormal(b,E,JSe);const P=f.fromRadians(y+M.PI_OVER_TWO,p,n,i,qSe);s=f.dot(Pt.projectPointOntoPlane(h,P,$Se),S),r=-s,c=f.fromRadians(0,e.north,g?t:n,i,YSe).z,a=f.fromRadians(0,e.south,m?t:n,i,XSe).z;const L=f.fromRadians(e.east,p,n,i,KSe);return u=Pt.getPointDistance(h,L),d=0,g4(b,S,w,E,r,s,a,c,u,d,o)};zt.fromTransformation=function(e,t){return T.typeOf.object("transformation",e),l(t)||(t=new zt),t.center=B.getTranslation(e,t.center),t.halfAxes=B.getMatrix3(e,t.halfAxes),t.halfAxes=J.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};zt.clone=function(e,t){if(l(e))return l(t)?(f.clone(e.center,t.center),J.clone(e.halfAxes,t.halfAxes),t):new zt(e.center,e.halfAxes)};zt.intersectPlane=function(e,t){if(!l(e))throw new x("box is required.");if(!l(t))throw new x("plane is required.");const n=e.center,i=t.normal,o=e.halfAxes,r=i.x,s=i.y,a=i.z,c=Math.abs(r*o[J.COLUMN0ROW0]+s*o[J.COLUMN0ROW1]+a*o[J.COLUMN0ROW2])+Math.abs(r*o[J.COLUMN1ROW0]+s*o[J.COLUMN1ROW1]+a*o[J.COLUMN1ROW2])+Math.abs(r*o[J.COLUMN2ROW0]+s*o[J.COLUMN2ROW1]+a*o[J.COLUMN2ROW2]),u=f.dot(i,n)+t.distance;return u<=-c?xn.OUTSIDE:u>=c?xn.INSIDE:xn.INTERSECTING};const s7=new f,a7=new f,c7=new f,QSe=new f,C4=new f,ZSe=new f;zt.distanceSquaredTo=function(e,t){if(!l(e))throw new x("box is required.");if(!l(t))throw new x("cartesian is required.");const n=f.subtract(t,e.center,r7),i=e.halfAxes;let o=J.getColumn(i,0,s7),r=J.getColumn(i,1,a7),s=J.getColumn(i,2,c7);const a=f.magnitude(o),c=f.magnitude(r),u=f.magnitude(s);let d=!0,h=!0,m=!0;a>0?f.divideByScalar(o,a,o):d=!1,c>0?f.divideByScalar(r,c,r):h=!1,u>0?f.divideByScalar(s,u,s):m=!1;const g=!d+!h+!m;let p,y,b;if(g===1){let S=o;p=r,y=s,h?m||(S=s,y=o):(S=r,p=o),b=f.cross(p,y,C4),S===o?o=b:S===r?r=b:S===s&&(s=b)}else if(g===2){p=o,h?p=r:m&&(p=s);let S=f.UNIT_Y;S.equalsEpsilon(p,M.EPSILON3)&&(S=f.UNIT_X),y=f.cross(p,S,QSe),f.normalize(y,y),b=f.cross(p,y,C4),f.normalize(b,b),p===o?(r=y,s=b):p===r?(s=y,o=b):p===s&&(o=y,r=b)}else g===3&&(o=f.UNIT_X,r=f.UNIT_Y,s=f.UNIT_Z);const C=ZSe;C.x=f.dot(n,o),C.y=f.dot(n,r),C.z=f.dot(n,s);let E=0,w;return C.x<-a?(w=C.x+a,E+=w*w):C.x>a&&(w=C.x-a,E+=w*w),C.y<-c?(w=C.y+c,E+=w*w):C.y>c&&(w=C.y-c,E+=w*w),C.z<-u?(w=C.z+u,E+=w*w):C.z>u&&(w=C.z-u,E+=w*w),E};const eve=new f,tve=new f;zt.computePlaneDistances=function(e,t,n,i){if(!l(e))throw new x("box is required.");if(!l(t))throw new x("position is required.");if(!l(n))throw new x("direction is required.");l(i)||(i=new Jh);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,c=J.getColumn(a,0,s7),u=J.getColumn(a,1,a7),d=J.getColumn(a,2,c7),h=f.add(c,u,eve);f.add(h,d,h),f.add(h,s,h);const m=f.subtract(h,t,tve);let g=f.dot(n,m);return o=Math.min(g,o),r=Math.max(g,r),f.add(s,c,h),f.add(h,u,h),f.subtract(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.add(s,c,h),f.subtract(h,u,h),f.add(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.add(s,c,h),f.subtract(h,u,h),f.subtract(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.subtract(s,c,h),f.add(h,u,h),f.add(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.subtract(s,c,h),f.add(h,u,h),f.subtract(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.subtract(s,c,h),f.subtract(h,u,h),f.add(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),f.subtract(s,c,h),f.subtract(h,u,h),f.subtract(h,d,h),f.subtract(h,t,m),g=f.dot(n,m),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};const nve=new f,ive=new f,ove=new f;zt.computeCorners=function(e,t){T.typeOf.object("box",e),l(t)||(t=[new f,new f,new f,new f,new f,new f,new f,new f]);const n=e.center,i=e.halfAxes,o=J.getColumn(i,0,nve),r=J.getColumn(i,1,ive),s=J.getColumn(i,2,ove);return f.clone(n,t[0]),f.subtract(t[0],o,t[0]),f.subtract(t[0],r,t[0]),f.subtract(t[0],s,t[0]),f.clone(n,t[1]),f.subtract(t[1],o,t[1]),f.subtract(t[1],r,t[1]),f.add(t[1],s,t[1]),f.clone(n,t[2]),f.subtract(t[2],o,t[2]),f.add(t[2],r,t[2]),f.subtract(t[2],s,t[2]),f.clone(n,t[3]),f.subtract(t[3],o,t[3]),f.add(t[3],r,t[3]),f.add(t[3],s,t[3]),f.clone(n,t[4]),f.add(t[4],o,t[4]),f.subtract(t[4],r,t[4]),f.subtract(t[4],s,t[4]),f.clone(n,t[5]),f.add(t[5],o,t[5]),f.subtract(t[5],r,t[5]),f.add(t[5],s,t[5]),f.clone(n,t[6]),f.add(t[6],o,t[6]),f.add(t[6],r,t[6]),f.subtract(t[6],s,t[6]),f.clone(n,t[7]),f.add(t[7],o,t[7]),f.add(t[7],r,t[7]),f.add(t[7],s,t[7]),t};const rve=new J;zt.computeTransformation=function(e,t){T.typeOf.object("box",e),l(t)||(t=new B);const n=e.center,i=J.multiplyByUniformScale(e.halfAxes,2,rve);return B.fromRotationTranslation(i,n,t)};const sve=new fe;zt.isOccluded=function(e,t){if(!l(e))throw new x("box is required.");if(!l(t))throw new x("occluder is required.");const n=fe.fromOrientedBoundingBox(e,sve);return!t.isBoundingSphereVisible(n)};zt.prototype.intersectPlane=function(e){return zt.intersectPlane(this,e)};zt.prototype.distanceSquaredTo=function(e){return zt.distanceSquaredTo(this,e)};zt.prototype.computePlaneDistances=function(e,t,n){return zt.computePlaneDistances(this,e,t,n)};zt.prototype.computeCorners=function(e){return zt.computeCorners(this,e)};zt.prototype.computeTransformation=function(e){return zt.computeTransformation(this,e)};zt.prototype.isOccluded=function(e){return zt.isOccluded(this,e)};zt.equals=function(e,t){return e===t||l(e)&&l(t)&&f.equals(e.center,t.center)&&J.equals(e.halfAxes,t.halfAxes)};zt.prototype.clone=function(e){return zt.clone(this,e)};zt.prototype.equals=function(e){return zt.equals(this,e)};const vi={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};vi.getMathType=function(e){switch(e){case vi.SCALAR:return Number;case vi.VEC2:return j;case vi.VEC3:return f;case vi.VEC4:return oe;case vi.MAT2:return dt;case vi.MAT3:return J;case vi.MAT4:return B;default:throw new x("attributeType is not a valid value.")}};vi.getNumberOfComponents=function(e){switch(e){case vi.SCALAR:return 1;case vi.VEC2:return 2;case vi.VEC3:return 3;case vi.VEC4:case vi.MAT2:return 4;case vi.MAT3:return 9;case vi.MAT4:return 16;default:throw new x("attributeType is not a valid value.")}};vi.getAttributeLocationCount=function(e){switch(e){case vi.SCALAR:case vi.VEC2:case vi.VEC3:case vi.VEC4:return 1;case vi.MAT2:return 2;case vi.MAT3:return 3;case vi.MAT4:return 4;default:throw new x("attributeType is not a valid value.")}};vi.getGlslType=function(e){switch(T.typeOf.string("attributeType",e),e){case vi.SCALAR:return"float";case vi.VEC2:return"vec2";case vi.VEC3:return"vec3";case vi.VEC4:return"vec4";case vi.MAT2:return"mat2";case vi.MAT3:return"mat3";case vi.MAT4:return"mat4";default:throw new x("attributeType is not a valid value.")}};const _n=Object.freeze(vi),T4=1/256,E4=256,Ki={};Ki.octEncodeInRange=function(e,t,n){T.defined("vector",e),T.defined("result",n);const i=f.magnitudeSquared(e);if(Math.abs(i-1)>M.EPSILON6)throw new x("vector must be normalized.");if(n.x=e.x/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),n.y=e.y/(Math.abs(e.x)+Math.abs(e.y)+Math.abs(e.z)),e.z<0){const o=n.x,r=n.y;n.x=(1-Math.abs(r))*M.signNotZero(o),n.y=(1-Math.abs(o))*M.signNotZero(r)}return n.x=M.toSNorm(n.x,t),n.y=M.toSNorm(n.y,t),n};Ki.octEncode=function(e,t){return Ki.octEncodeInRange(e,255,t)};const hA=new j,x4=new Uint8Array(1);function jE(e){return x4[0]=e,x4[0]}Ki.octEncodeToCartesian4=function(e,t){return Ki.octEncodeInRange(e,65535,hA),t.x=jE(hA.x*T4),t.y=jE(hA.x),t.z=jE(hA.y*T4),t.w=jE(hA.y),t};Ki.octDecodeInRange=function(e,t,n,i){if(T.defined("result",i),e<0||e>n||t<0||t>n)throw new x(`x and y must be unsigned normalized integers between 0 and ${n}`);if(i.x=M.fromSNorm(e,n),i.y=M.fromSNorm(t,n),i.z=1-(Math.abs(i.x)+Math.abs(i.y)),i.z<0){const o=i.x;i.x=(1-Math.abs(i.y))*M.signNotZero(o),i.y=(1-Math.abs(o))*M.signNotZero(i.y)}return f.normalize(i,i)};Ki.octDecode=function(e,t,n){return Ki.octDecodeInRange(e,t,255,n)};Ki.octDecodeFromCartesian4=function(e,t){T.typeOf.object("encoded",e),T.typeOf.object("result",t);const n=e.x,i=e.y,o=e.z,r=e.w;if(n<0||n>255||i<0||i>255||o<0||o>255||r<0||r>255)throw new x("x, y, z, and w must be unsigned normalized integers between 0 and 255");const s=n*E4+i,a=o*E4+r;return Ki.octDecodeInRange(s,a,65535,t)};Ki.octPackFloat=function(e){return T.defined("encoded",e),256*e.x+e.y};const xB=new j;Ki.octEncodeFloat=function(e){return Ki.octEncode(e,xB),Ki.octPackFloat(xB)};Ki.octDecodeFloat=function(e,t){T.defined("value",e);const n=e/256,i=Math.floor(n),o=(n-i)*256;return Ki.octDecode(i,o,t)};Ki.octPack=function(e,t,n,i){T.defined("v1",e),T.defined("v2",t),T.defined("v3",n),T.defined("result",i);const o=Ki.octEncodeFloat(e),r=Ki.octEncodeFloat(t),s=Ki.octEncode(n,xB);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};Ki.octUnpack=function(e,t,n,i){T.defined("packed",e),T.defined("v1",t),T.defined("v2",n),T.defined("v3",i);let o=e.x/65536;const r=Math.floor(o),s=(o-r)*65536;o=e.y/65536;const a=Math.floor(o),c=(o-a)*65536;Ki.octDecodeFloat(s,t),Ki.octDecodeFloat(c,n),Ki.octDecode(r,a,i)};Ki.compressTextureCoordinates=function(e){T.defined("textureCoordinates",e);const t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};Ki.decompressTextureCoordinates=function(e,t){T.defined("compressed",e),T.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function R1(e){return e>>1^-(e&1)}Ki.zigZagDeltaDecode=function(e,t,n){T.defined("uBuffer",e),T.defined("vBuffer",t),T.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),l(n)&&T.typeOf.number.equals("uBuffer.length","heightBuffer.length",e.length,n.length);const i=e.length;let o=0,r=0,s=0;for(let a=0;a<i;++a)o+=R1(e[a]),r+=R1(t[a]),e[a]=o,t[a]=r,l(n)&&(s+=R1(n[a]),n[a]=s)};Ki.dequantize=function(e,t,n,i){T.defined("typedArray",e),T.defined("componentDatatype",t),T.defined("type",n),T.defined("count",i);const o=_n.getNumberOfComponents(n);let r;switch(t){case ee.BYTE:r=127;break;case ee.UNSIGNED_BYTE:r=255;break;case ee.SHORT:r=32767;break;case ee.UNSIGNED_SHORT:r=65535;break;case ee.INT:r=2147483647;break;case ee.UNSIGNED_INT:r=4294967295;break;default:throw new x(`Cannot dequantize component datatype: ${t}`)}const s=new Float32Array(i*o);for(let a=0;a<i;a++)for(let c=0;c<o;c++){const u=a*o+c;s[u]=Math.max(e[u]/r,-1)}return s};Ki.decodeRGB565=function(e,t){T.defined("typedArray",e);const n=e.length*3;l(t)&&T.typeOf.number.equals("result.length","typedArray.length * 3",t.length,n);const i=e.length;l(t)||(t=new Float32Array(i*3));const o=(1<<5)-1,r=(1<<6)-1,s=1/31,a=1/63;for(let c=0;c<i;c++){const u=e[c],d=u>>11,h=u>>5&r,m=u&o,g=3*c;t[g]=d*s,t[g+1]=h*a,t[g+2]=m*s}return t};const mi=Ki,KS={};KS.getHeight=function(e,t,n){return(e-n)*t+n};const ave=new f;KS.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,ave),s=KS.getHeight(r.height,n,i);return f.fromRadians(r.longitude,r.latitude,s,t,o)};const fp=KS,cve={NONE:0,BITS12:1},fc=Object.freeze(cve),$m=new f,lve=new f,Kc=new j,qE=new B,uve=new B,dve=Math.pow(2,12);function Cr(e,t,n,i,o,r,s,a,c,u){let d=fc.NONE,h,m;if(l(t)&&l(n)&&l(i)&&l(o)){const g=t.minimum,p=t.maximum,y=f.subtract(p,g,lve),b=i-n;Math.max(f.maximumComponent(y),b)<dve-1?d=fc.BITS12:d=fc.NONE,h=B.inverseTransformation(o,new B);const E=f.negate(g,$m);B.multiply(B.fromTranslation(E,qE),h,h);const w=$m;w.x=1/y.x,w.y=1/y.y,w.z=1/y.z,B.multiply(B.fromScale(w,qE),h,h),m=B.clone(o),B.setTranslation(m,f.ZERO,m),o=B.clone(o,new B);const S=B.fromTranslation(g,qE),P=B.fromScale(y,uve),L=B.multiply(S,P,qE);B.multiply(o,L,o),B.multiply(m,L,m)}this.quantization=d,this.minimumHeight=n,this.maximumHeight=i,this.center=f.clone(e),this.toScaledENU=h,this.fromScaledENU=o,this.matrix=m,this.hasVertexNormals=r,this.hasWebMercatorT=A(s,!1),this.hasGeodeticSurfaceNormals=A(a,!1),this.exaggeration=A(c,1),this.exaggerationRelativeHeight=A(u,0),this.stride=0,this._offsetGeodeticSurfaceNormal=0,this._offsetVertexNormal=0,this._calculateStrideAndOffsets()}Cr.prototype.encode=function(e,t,n,i,o,r,s,a){const c=i.x,u=i.y;if(this.quantization===fc.BITS12){n=B.multiplyByPoint(this.toScaledENU,n,$m),n.x=M.clamp(n.x,0,1),n.y=M.clamp(n.y,0,1),n.z=M.clamp(n.z,0,1);const d=this.maximumHeight-this.minimumHeight,h=M.clamp((o-this.minimumHeight)/d,0,1);j.fromElements(n.x,n.y,Kc);const m=mi.compressTextureCoordinates(Kc);j.fromElements(n.z,h,Kc);const g=mi.compressTextureCoordinates(Kc);j.fromElements(c,u,Kc);const p=mi.compressTextureCoordinates(Kc);if(e[t++]=m,e[t++]=g,e[t++]=p,this.hasWebMercatorT){j.fromElements(s,0,Kc);const y=mi.compressTextureCoordinates(Kc);e[t++]=y}}else f.subtract(n,this.center,$m),e[t++]=$m.x,e[t++]=$m.y,e[t++]=$m.z,e[t++]=o,e[t++]=c,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=mi.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const fve=new f,l7=new f;Cr.prototype.addGeodeticSurfaceNormals=function(e,t,n){if(this.hasGeodeticSurfaceNormals)return;const i=this.stride,o=e.length/i;this.hasGeodeticSurfaceNormals=!0,this._calculateStrideAndOffsets();const r=this.stride;for(let s=0;s<o;s++){for(let d=0;d<i;d++){const h=s*i+d,m=s*r+d;t[m]=e[h]}const a=this.decodePosition(t,s,fve),c=n.geodeticSurfaceNormal(a,l7),u=s*r+this._offsetGeodeticSurfaceNormal;t[u]=c.x,t[u+1]=c.y,t[u+2]=c.z}};Cr.prototype.removeGeodeticSurfaceNormals=function(e,t){if(!this.hasGeodeticSurfaceNormals)return;const n=this.stride,i=e.length/n;this.hasGeodeticSurfaceNormals=!1,this._calculateStrideAndOffsets();const o=this.stride;for(let r=0;r<i;r++)for(let s=0;s<o;s++){const a=r*n+s,c=r*o+s;t[c]=e[a]}};Cr.prototype.decodePosition=function(e,t,n){if(l(n)||(n=new f),t*=this.stride,this.quantization===fc.BITS12){const i=mi.decompressTextureCoordinates(e[t],Kc);n.x=i.x,n.y=i.y;const o=mi.decompressTextureCoordinates(e[t+1],Kc);return n.z=o.x,B.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],f.add(n,this.center,n)};Cr.prototype.getExaggeratedPosition=function(e,t,n){n=this.decodePosition(e,t,n);const i=this.exaggeration,o=this.exaggerationRelativeHeight;if(i!==1&&this.hasGeodeticSurfaceNormals){const s=this.decodeGeodeticSurfaceNormal(e,t,l7),a=this.decodeHeight(e,t),c=fp.getHeight(a,i,o)-a;n.x+=s.x*c,n.y+=s.y*c,n.z+=s.z*c}return n};Cr.prototype.decodeTextureCoordinates=function(e,t,n){return l(n)||(n=new j),t*=this.stride,this.quantization===fc.BITS12?mi.decompressTextureCoordinates(e[t+2],n):j.fromElements(e[t+4],e[t+5],n)};Cr.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===fc.BITS12?mi.decompressTextureCoordinates(e[t+1],Kc).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};Cr.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===fc.BITS12?mi.decompressTextureCoordinates(e[t+3],Kc).x:e[t+6]};Cr.prototype.getOctEncodedNormal=function(e,t,n){t=t*this.stride+this._offsetVertexNormal;const i=e[t]/256,o=Math.floor(i),r=(i-o)*256;return j.fromElements(o,r,n)};Cr.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};Cr.prototype._calculateStrideAndOffsets=function(){let e=0;switch(this.quantization){case fc.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};const Vw={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},kw={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};Cr.prototype.getAttributes=function(e){const t=ee.FLOAT,n=ee.getSizeInBytes(t),i=this.stride*n;let o=0;const 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===fc.NONE){s(Vw.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(Vw.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(Vw.geodeticSurfaceNormal,3)}else{const a=this.hasWebMercatorT||this.hasVertexNormals,c=this.hasWebMercatorT&&this.hasVertexNormals;s(kw.compressed0,a?4:3),c&&s(kw.compressed1,1),this.hasGeodeticSurfaceNormals&&s(kw.geodeticSurfaceNormal,3)}return r};Cr.prototype.getAttributeLocations=function(){return this.quantization===fc.NONE?Vw:kw};Cr.clone=function(e,t){if(l(e))return l(t)||(t=new Cr),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=f.clone(e.center),t.toScaledENU=B.clone(e.toScaledENU),t.fromScaledENU=B.clone(e.fromScaledENU),t.matrix=B.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};const ku={};ku.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const N1=new f,hve=new B,pve=new f,mve=new f;ku.computeVertices=function(e){if(!l(e)||!l(e.heightmap))throw new x("options.heightmap is required.");if(!l(e.width)||!l(e.height))throw new x("options.width and options.height are required.");if(!l(e.nativeRectangle))throw new x("options.nativeRectangle is required.");if(!l(e.skirtHeight))throw new x("options.skirtHeight is required.");const t=Math.cos,n=Math.sin,i=Math.sqrt,o=Math.atan,r=Math.exp,s=M.PI_OVER_TWO,a=M.toRadians,c=e.heightmap,u=e.width,d=e.height,h=e.skirtHeight,m=h>0,g=A(e.isGeographic,!0),p=A(e.ellipsoid,me.WGS84),y=1/p.maximumRadius,b=ge.clone(e.nativeRectangle),C=ge.clone(e.rectangle);let E,w,S,P;l(C)?(E=C.west,w=C.south,S=C.east,P=C.north):g?(E=a(b.west),w=a(b.south),S=a(b.east),P=a(b.north)):(E=b.west*y,w=s-2*o(r(-b.south*y)),S=b.east*y,P=s-2*o(r(-b.north*y)));let L=e.relativeToCenter;const z=l(L);L=z?L:f.ZERO;const R=A(e.includeWebMercatorT,!1),F=A(e.exaggeration,1),U=A(e.exaggerationRelativeHeight,0),I=F!==1,_=A(e.structure,ku.DEFAULT_STRUCTURE),v=A(_.heightScale,ku.DEFAULT_STRUCTURE.heightScale),O=A(_.heightOffset,ku.DEFAULT_STRUCTURE.heightOffset),N=A(_.elementsPerHeight,ku.DEFAULT_STRUCTURE.elementsPerHeight),V=A(_.stride,ku.DEFAULT_STRUCTURE.stride),k=A(_.elementMultiplier,ku.DEFAULT_STRUCTURE.elementMultiplier),G=A(_.isBigEndian,ku.DEFAULT_STRUCTURE.isBigEndian);let W=ge.computeWidth(b),K=ge.computeHeight(b);const q=W/(u-1),te=K/(d-1);g||(W*=y,K*=y);const Y=p.radiiSquared,X=Y.x,$=Y.y,se=Y.z;let ue=65536,re=-65536;const he=cn.eastNorthUpToFixedFrame(L,p),ce=B.inverseTransformation(he,hve);let Q,ne;R&&(Q=di.geodeticLatitudeToMercatorAngle(w),ne=1/(di.geodeticLatitudeToMercatorAngle(P)-Q));const de=pve;de.x=Number.POSITIVE_INFINITY,de.y=Number.POSITIVE_INFINITY,de.z=Number.POSITIVE_INFINITY;const _e=mve;_e.x=Number.NEGATIVE_INFINITY,_e.y=Number.NEGATIVE_INFINITY,_e.z=Number.NEGATIVE_INFINITY;let Se=Number.POSITIVE_INFINITY;const ve=u*d,Le=h>0?u*2+d*2:0,Ee=ve+Le,Be=new Array(Ee),Pe=new Array(Ee),Ae=new Array(Ee),xe=R?new Array(Ee):[],Oe=I?new Array(Ee):[];let Ve=0,Re=d,At=0,xt=u;m&&(--Ve,++Re,--At,++xt);const Nt=1e-5;for(let qt=Ve;qt<Re;++qt){let tn=qt;tn<0&&(tn=0),tn>=d&&(tn=d-1);let jn=b.north-te*tn;g?jn=a(jn):jn=s-2*o(r(-jn*y));let hi=(jn-w)/(P-w);hi=M.clamp(hi,0,1);const sn=qt===Ve,zi=qt===Re-1;h>0&&(sn?jn+=Nt*K:zi&&(jn-=Nt*K));const oo=t(jn),Wi=n(jn),li=se*Wi;let mn;R&&(mn=(di.geodeticLatitudeToMercatorAngle(jn)-Q)*ne);for(let Kn=At;Kn<xt;++Kn){let Hn=Kn;Hn<0&&(Hn=0),Hn>=u&&(Hn=u-1);const dn=tn*(u*V)+Hn*V;let bt;if(N===1)bt=c[dn];else{bt=0;let Ct;if(G)for(Ct=0;Ct<N;++Ct)bt=bt*k+c[dn+Ct];else for(Ct=N-1;Ct>=0;--Ct)bt=bt*k+c[dn+Ct]}bt=bt*v+O,re=Math.max(re,bt),ue=Math.min(ue,bt);let Ge=b.west+q*Hn;g?Ge=a(Ge):Ge=Ge*y;let Mn=(Ge-E)/(S-E);Mn=M.clamp(Mn,0,1);let Tn=tn*u+Hn;if(h>0){const Ct=Kn===At,we=Kn===xt-1,$e=sn||zi||Ct||we;if((sn||zi)&&(Ct||we))continue;$e&&(bt-=h,Ct?(Tn=ve+(d-tn-1),Ge-=Nt*W):zi?Tn=ve+d+(u-Hn-1):we?(Tn=ve+d+u+tn,Ge+=Nt*W):sn&&(Tn=ve+d+u+d+Hn))}const Qi=oo*t(Ge),Fn=oo*n(Ge),ji=X*Qi,Lo=$*Fn,Ur=1/i(ji*Qi+Lo*Fn+li*Wi),Zi=ji*Ur,qi=Lo*Ur,Hr=li*Ur,ba=new f;ba.x=Zi+Qi*bt,ba.y=qi+Fn*bt,ba.z=Hr+Wi*bt,B.multiplyByPoint(ce,ba,N1),f.minimumByComponent(N1,de,de),f.maximumByComponent(N1,_e,_e),Se=Math.min(Se,bt),Be[Tn]=ba,Ae[Tn]=new j(Mn,hi),Pe[Tn]=bt,R&&(xe[Tn]=mn),I&&(Oe[Tn]=p.geodeticSurfaceNormal(ba))}}const On=fe.fromPoints(Be);let Nn;l(C)&&(Nn=zt.fromRectangle(C,ue,re,p));let Sn;z&&(Sn=new El(p).computeHorizonCullingPointPossiblyUnderEllipsoid(L,Be,ue));const un=new Ns(de,_e,L),Ht=new Cr(L,un,Se,re,he,!1,R,I,F,U),vn=new Float32Array(Ee*Ht.stride);let Pn=0;for(let qt=0;qt<Ee;++qt)Pn=Ht.encode(vn,Pn,Be[qt],Ae[qt],Pe[qt],void 0,xe[qt],Oe[qt]);return{vertices:vn,maximumHeight:re,minimumHeight:ue,encoding:Ht,boundingSphere3D:On,orientedBoundingBox:Nn,occludeePointInScaledSpace:Sn}};const u7=ku;function bd(){x.throwInstantiationError()}Object.defineProperties(bd.prototype,{credits:{get:x.throwInstantiationError},waterMask:{get:x.throwInstantiationError}});bd.prototype.interpolateHeight=x.throwInstantiationError;bd.prototype.isChildAvailable=x.throwInstantiationError;bd.prototype.createMesh=x.throwInstantiationError;bd.prototype.upsample=x.throwInstantiationError;bd.prototype.wasCreatedByUpsampling=x.throwInstantiationError;bd.maximumAsynchronousTasks=5;function fD(e,t,n,i,o,r,s,a,c,u,d,h,m,g,p,y){this.center=e,this.vertices=t,this.stride=A(u,6),this.indices=n,this.indexCountWithoutSkirts=i,this.vertexCountWithoutSkirts=o,this.minimumHeight=r,this.maximumHeight=s,this.boundingSphere3D=a,this.occludeePointInScaledSpace=c,this.orientedBoundingBox=d,this.encoding=h,this.westIndicesSouthToNorth=m,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=p,this.northIndicesWestToEast=y}function tr(){x.throwInstantiationError()}Object.defineProperties(tr.prototype,{errorEvent:{get:x.throwInstantiationError},credit:{get:x.throwInstantiationError},tilingScheme:{get:x.throwInstantiationError},ready:{get:x.throwInstantiationError},readyPromise:{get:x.throwInstantiationError},hasWaterMask:{get:x.throwInstantiationError},hasVertexNormals:{get:x.throwInstantiationError},availability:{get:x.throwInstantiationError}});const w4=[];tr.getRegularGridIndices=function(e,t){if(e*t>=M.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=w4[e];l(n)||(w4[e]=n=[]);let i=n[t];return l(i)||(e*t<M.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),f7(e,t,i,0)),i};const S4=[];tr.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=M.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=S4[e];l(n)||(S4[e]=n=[]);let i=n[t];if(!l(i)){const o=tr.getRegularGridIndices(e,t),r=d7(e,t),s=r.westIndicesSouthToNorth,a=r.southIndicesEastToWest,c=r.eastIndicesNorthToSouth,u=r.northIndicesWestToEast;i=n[t]={indices:o,westIndicesSouthToNorth:s,southIndicesEastToWest:a,eastIndicesNorthToSouth:c,northIndicesWestToEast:u}}return i};const v4=[];tr.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=M.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=v4[e];l(n)||(v4[e]=n=[]);let i=n[t];if(!l(i)){const o=e*t,r=(e-1)*(t-1)*6,s=e*2+t*2,a=Math.max(0,s-4)*6,c=o+s,u=r+a,d=d7(e,t),h=d.westIndicesSouthToNorth,m=d.southIndicesEastToWest,g=d.eastIndicesNorthToSouth,p=d.northIndicesWestToEast,y=at.createTypedArray(c,u);f7(e,t,y,0),tr.addSkirtIndices(h,m,g,p,o,y,r),i=n[t]={indices:y,westIndicesSouthToNorth:h,southIndicesEastToWest:m,eastIndicesNorthToSouth:g,northIndicesWestToEast:p,indexCountWithoutSkirts:r}}return i};tr.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=$E(e,a,r,s),a+=e.length,s=$E(t,a,r,s),a+=t.length,s=$E(n,a,r,s),a+=n.length,$E(i,a,r,s)};function d7(e,t){const n=new Array(t),i=new Array(e),o=new Array(t),r=new Array(e);let 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 f7(e,t,n,i){let o=0;for(let r=0;r<t-1;++r){for(let s=0;s<e-1;++s){const a=o,c=a+e,u=c+1,d=a+1;n[i++]=a,n[i++]=c,n[i++]=d,n[i++]=d,n[i++]=c,n[i++]=u,++o}++o}}function $E(e,t,n,i){let o=e[0];const r=e.length;for(let s=1;s<r;++s){const 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}tr.heightmapTerrainQuality=.25;tr.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*tr.heightmapTerrainQuality/(t*n)};tr.prototype.requestTileGeometry=x.throwInstantiationError;tr.prototype.getLevelMaximumGeometricError=x.throwInstantiationError;tr.prototype.getTileDataAvailable=x.throwInstantiationError;tr.prototype.loadTileDataAvailability=x.throwInstantiationError;function fu(e){if(!l(e)||!l(e.buffer))throw new x("options.buffer is required.");if(!l(e.width))throw new x("options.width is required.");if(!l(e.height))throw new x("options.height is required.");this._buffer=e.buffer,this._width=e.width,this._height=e.height,this._childTileMask=A(e.childTileMask,15),this._encoding=A(e.encoding,EB.NONE);const t=u7.DEFAULT_STRUCTURE;let n=e.structure;l(n)?n!==t&&(n.heightScale=A(n.heightScale,t.heightScale),n.heightOffset=A(n.heightOffset,t.heightOffset),n.elementsPerHeight=A(n.elementsPerHeight,t.elementsPerHeight),n.stride=A(n.stride,t.stride),n.elementMultiplier=A(n.elementMultiplier,t.elementMultiplier),n.isBigEndian=A(n.isBigEndian,t.isBigEndian)):n=t,this._structure=n,this._createdByUpsampling=A(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._skirtHeight=void 0,this._bufferType=this._encoding===EB.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties(fu.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const h7="createVerticesFromHeightmap",_ve=new Vi(h7),gve=new Vi(h7,bd.maximumAsynchronousTasks);fu.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=A(e.throttle,!0),c=t.ellipsoid,u=t.tileXYToNativeRectangle(n,i,o),d=t.tileXYToRectangle(n,i,o),h=c.cartographicToCartesian(ge.center(d)),m=this._structure,p=tr.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(p*4,1e3);const b=(a?gve:_ve).scheduleTask({heightmap:this._buffer,structure:m,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:u,rectangle:d,relativeToCenter:h,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof nr,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!l(b))return;const C=this;return Promise.resolve(b).then(function(E){let w;C._skirtHeight>0?w=tr.getRegularGridAndSkirtIndicesAndEdgeIndices(E.gridWidth,E.gridHeight):w=tr.getRegularGridIndicesAndEdgeIndices(E.gridWidth,E.gridHeight);const S=E.gridWidth*E.gridHeight;return C._mesh=new fD(h,new Float32Array(E.vertices),w.indices,w.indexCountWithoutSkirts,S,E.minimumHeight,E.maximumHeight,fe.clone(E.boundingSphere3D),f.clone(E.occludeePointInScaledSpace),E.numberOfAttributes,zt.clone(E.orientedBoundingBox),Cr.clone(E.encoding),w.westIndicesSouthToNorth,w.southIndicesEastToWest,w.eastIndicesNorthToSouth,w.northIndicesWestToEast),C._buffer=void 0,C._mesh})};fu.prototype._createMeshSync=function(e){T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=t.ellipsoid,c=t.tileXYToNativeRectangle(n,i,o),u=t.tileXYToRectangle(n,i,o),d=a.cartographicToCartesian(ge.center(u)),h=this._structure,g=tr.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);const p=u7.computeVertices({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:u,relativeToCenter:d,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof nr,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let y;this._skirtHeight>0?y=tr.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):y=tr.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const b=p.gridWidth*p.gridHeight;return this._mesh=new fD(d,p.vertices,y.indices,y.indexCountWithoutSkirts,b,p.minimumHeight,p.maximumHeight,p.boundingSphere3D,p.occludeePointInScaledSpace,p.encoding.stride,p.orientedBoundingBox,p.encoding,y.westIndicesSouthToNorth,y.southIndicesEastToWest,y.eastIndicesNorthToSouth,y.northIndicesWestToEast),this._mesh};fu.prototype.interpolateHeight=function(e,t,n){const i=this._width,o=this._height,r=this._structure,s=r.stride,a=r.elementsPerHeight,c=r.elementMultiplier,u=r.isBigEndian,d=r.heightOffset,h=r.heightScale,m=l(this._mesh),g=this._encoding===EB.LERC;if(!m&&g)return;let y;if(m){const b=this._mesh.vertices,C=this._mesh.encoding;y=p7(b,C,d,h,e,i,o,t,n)}else y=yve(this._buffer,a,c,s,u,e,i,o,t,n),y=y*h+d;return y};fu.prototype.upsample=function(e,t,n,i,o,r,s){if(!l(e))throw new x("tilingScheme is required.");if(!l(t))throw new x("thisX is required.");if(!l(n))throw new x("thisY is required.");if(!l(i))throw new x("thisLevel is required.");if(!l(o))throw new x("descendantX is required.");if(!l(r))throw new x("descendantY is required.");if(!l(s))throw new x("descendantLevel is required.");if(s-i>1)throw new x("Upsampling through more than one level at a time is not currently supported.");const c=this._mesh;if(!l(c))return;const u=this._width,d=this._height,h=this._structure,m=h.stride,g=new this._bufferType(u*d*m),p=c.vertices,y=c.encoding,b=e.tileXYToRectangle(t,n,i),C=e.tileXYToRectangle(o,r,s),E=h.heightOffset,w=h.heightScale,S=h.elementsPerHeight,P=h.elementMultiplier,L=h.isBigEndian,z=Math.pow(P,S-1);for(let R=0;R<d;++R){const F=M.lerp(C.north,C.south,R/(d-1));for(let U=0;U<u;++U){const D=M.lerp(C.west,C.east,U/(u-1));let I=p7(p,y,E,w,b,u,d,D,F);I=I<h.lowestEncodedHeight?h.lowestEncodedHeight:I,I=I>h.highestEncodedHeight?h.highestEncodedHeight:I,Ave(g,S,P,z,m,L,R*u+U,I)}}return Promise.resolve(new fu({buffer:g,width:u,height:d,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};fu.prototype.isChildAvailable=function(e,t,n,i){if(!l(e))throw new x("thisX is required.");if(!l(t))throw new x("thisY is required.");if(!l(n))throw new x("childX is required.");if(!l(i))throw new x("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};fu.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function yve(e,t,n,i,o,r,s,a,c,u){const d=(c-r.west)*(s-1)/(r.east-r.west),h=(u-r.south)*(a-1)/(r.north-r.south);let m=d|0,g=m+1;g>=s&&(g=s-1,m=s-2);let p=h|0,y=p+1;y>=a&&(y=a-1,p=a-2);const b=d-m,C=h-p;p=a-1-p,y=a-1-y;const E=YE(e,t,n,i,o,p*s+m),w=YE(e,t,n,i,o,p*s+g),S=YE(e,t,n,i,o,y*s+m),P=YE(e,t,n,i,o,y*s+g);return m7(b,C,E,w,S,P)}function p7(e,t,n,i,o,r,s,a,c){const u=(a-o.west)*(r-1)/(o.east-o.west),d=(c-o.south)*(s-1)/(o.north-o.south);let h=u|0,m=h+1;m>=r&&(m=r-1,h=r-2);let g=d|0,p=g+1;p>=s&&(p=s-1,g=s-2);const y=u-h,b=d-g;g=s-1-g,p=s-1-p;const C=(t.decodeHeight(e,g*r+h)-n)/i,E=(t.decodeHeight(e,g*r+m)-n)/i,w=(t.decodeHeight(e,p*r+h)-n)/i,S=(t.decodeHeight(e,p*r+m)-n)/i;return m7(y,b,C,E,w,S)}function m7(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function YE(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 Ave(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}function Jp(e){e=A(e,A.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,l(this._tilingScheme)||(this._tilingScheme=new aa({ellipsoid:A(e.ellipsoid,me.WGS84)})),this._levelZeroMaximumGeometricError=tr.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new Ke,this._readyPromise=Promise.resolve(!0)}Object.defineProperties(Jp.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(){}}});Jp.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new fu({buffer:new Uint8Array(16*16),width:16,height:16}))};Jp.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};Jp.prototype.getTileDataAvailable=function(e,t,n){};Jp.prototype.loadTileDataAvailability=function(e,t,n){};function kt(e,t,n,i){this.near=A(e,0),this.nearValue=A(t,0),this.far=A(n,1),this.farValue=A(i,0)}kt.clone=function(e,t){if(l(e))return l(t)?(t.near=e.near,t.nearValue=e.nearValue,t.far=e.far,t.farValue=e.farValue,t):new kt(e.near,e.nearValue,e.far,e.farValue)};kt.packedLength=4;kt.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),t[n++]=e.near,t[n++]=e.nearValue,t[n++]=e.far,t[n]=e.farValue,t};kt.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new kt),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};kt.equals=function(e,t){return e===t||l(e)&&l(t)&&e.near===t.near&&e.nearValue===t.nearValue&&e.far===t.far&&e.farValue===t.farValue};kt.prototype.clone=function(e){return kt.clone(this,e)};kt.prototype.equals=function(e){return kt.equals(this,e)};function Sp(e,t){T.typeOf.object("normal",e),T.typeOf.number("distance",t),this._distance=t,this._normal=new _7(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(Sp.prototype,{distance:{get:function(){return this._distance},set:function(e){T.typeOf.number("value",e),l(this.onChangeCallback)&&e!==this._distance&&this.onChangeCallback(this.index),this._distance=e}},normal:{get:function(){return this._normal},set:function(e){T.typeOf.object("value",e),l(this.onChangeCallback)&&!f.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),f.clone(e,this._normal._cartesian3)}}});Sp.fromPlane=function(e,t){return T.typeOf.object("plane",e),l(t)?(t.normal=e.normal,t.distance=e.distance):t=new Sp(e.normal,e.distance),t};Sp.clone=function(e,t){return l(t)?(t.normal=e.normal,t.distance=e.distance,t):new Sp(e.normal,e.distance)};function _7(e,t){this._clippingPlane=t,this._cartesian3=f.clone(e)}Object.defineProperties(_7.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){T.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.x&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.x=e}},y:{get:function(){return this._cartesian3.y},set:function(e){T.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.y&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.y=e}},z:{get:function(){return this._cartesian3.z},set:function(e){T.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});function Io(e){e=A(e,A.EMPTY_OBJECT),this._planes=[],this._dirtyIndex=-1,this._multipleDirtyPlanes=!1,this._enabled=A(e.enabled,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this.edgeColor=H.clone(A(e.edgeColor,H.WHITE)),this.edgeWidth=A(e.edgeWidth,0),this.planeAdded=new Ke,this.planeRemoved=new Ke,this._owner=void 0;const t=A(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?g7:y7,this._uint8View=void 0,this._float32View=void 0,this._clippingPlanesTexture=void 0;const n=e.planes;if(l(n)){const i=n.length;for(let o=0;o<i;++o)this.add(n[o])}}function g7(e){return e===xn.OUTSIDE}function y7(e){return e===xn.INSIDE}Object.defineProperties(Io.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?g7:y7)}},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 D4(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}Io.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(i){D4(n,i)},e.index=t,D4(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};Io.prototype.get=function(e){return T.typeOf.number("index",e),this._planes[e]};function A7(e,t){const n=e.length;for(let i=0;i<n;++i)if(Pt.equals(e[i],t))return i;return-1}Io.prototype.contains=function(e){return A7(this._planes,e)!==-1};Io.prototype.remove=function(e){const t=this._planes,n=A7(t,e);if(n===-1)return!1;e instanceof Sp&&(e.onChangeCallback=void 0,e.index=-1);const i=t.length-1;for(let o=n;o<i;++o){const r=t[o+1];t[o]=r,r instanceof Sp&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};Io.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const i=e[n];i instanceof Sp&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const bve=new oe,Cve=new oe;function I4(e,t,n){const i=e._uint8View,o=e._planes;let r=0;for(let s=t;s<n;++s){const a=o[s],c=mi.octEncodeToCartesian4(a.normal,Cve);i[r]=c.x,i[r+1]=c.y,i[r+2]=c.z,i[r+3]=c.w;const u=oe.packFloat(a.distance,bve);i[r+4]=u.x,i[r+5]=u.y,i[r+6]=u.z,i[r+7]=u.w,r+=8}}function P4(e,t,n){const i=e._float32View,o=e._planes;let r=0;for(let s=t;s<n;++s){const 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 b7(e,t){const n=It.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const Tve=new j;Io.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=Io.useFloatTexture(n),o=i?this.length:this.length*2;if(l(t)){const 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(!l(t)){const s=b7(o,Tve);s.y*=2,i?(t=new Wt({context:n,width:s.x,height:s.y,pixelFormat:rt.RGBA,pixelDatatype:Qe.FLOAT,sampler:ii.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new Wt({context:n,width:s.x,height:s.y,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,sampler:ii.NEAREST,flipY:!1}),this._uint8View=new Uint8Array(s.x*s.y*4)),this._clippingPlanesTexture=t,this._multipleDirtyPlanes=!0}const r=this._dirtyIndex;if(!(!this._multipleDirtyPlanes&&r===-1)){if(this._multipleDirtyPlanes)i?(P4(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(I4(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),P4(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),I4(this,r,r+1),t.copyFrom({source:{width:2,height:1,arrayBufferView:this._uint8View},xOffset:s,yOffset:a}))}this._multipleDirtyPlanes=!1,this._dirtyIndex=-1}};const Eve=new B,O4=new Pt(f.UNIT_X,0);Io.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let o=this.modelMatrix;l(t)&&(o=B.multiply(t,o,Eve));let r=xn.INSIDE;!this.unionClippingRegions&&i>0&&(r=xn.OUTSIDE);for(let s=0;s<i;++s){const a=n[s];Pt.transform(a,o,O4);const c=e.intersectPlane(O4);if(c===xn.INTERSECTING)r=c;else if(this._testIntersection(c))return c}return r};Io.setOwner=function(e,t,n){if(e!==t[n]&&(t[n]=t[n]&&t[n].destroy(),l(e))){if(l(e._owner))throw new x("ClippingPlaneCollection should only be assigned to one object");e._owner=t,t[n]=e}};Io.useFloatTexture=function(e){return e.floatingPointTexture};Io.getTextureResolution=function(e,t,n){const i=e.texture;if(l(i))return n.x=i.width,n.y=i.height,n;const o=Io.useFloatTexture(t)?e.length:e.length*2,r=b7(o,n);return r.y*=2,r};Io.prototype.isDestroyed=function(){return!1};Io.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),He(this)};const xve=new j;function UM(e,t){T.typeOf.object("clippingPlaneCollection",e),T.typeOf.object("context",t);const n=e.unionClippingRegions,i=e.length,o=Io.useFloatTexture(t),r=Io.getTextureResolution(e,t,xve),s=r.x,a=r.y;let c=o?vve(s,a):Dve(s,a);return c+=`
|
||
`,c+=n?wve(i):Sve(i),c}function wve(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 Sve(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 vve(e,t){const n=1/e,i=1/t;let 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 = texture2D(packedClippingPlanes, vec2(u, v));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
`}function Dve(e,t){const n=1/e,i=1/t;let 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 = texture2D(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(texture2D(packedClippingPlanes, vec2(u + ${o}, v)));
|
||
return czm_transformPlane(plane, transform);
|
||
}
|
||
`}function Ive(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function HM(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function Pve(e){const 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); }";let o;switch(e){case le.SCENE3D:o=t;break;case le.SCENE2D:case le.COLUMBUS_VIEW:o=n;break;case le.MORPHING:o=i;break}return o}function Ove(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}HM.prototype.getShaderProgram=function(e){const t=e.frameState,n=e.surfaceTile,i=e.numberOfDayTextures,o=e.applyBrightness,r=e.applyContrast,s=e.applyHue,a=e.applySaturation,c=e.applyGamma,u=e.applyAlpha,d=e.applyDayNightAlpha,h=e.applySplit,m=e.showReflectiveOcean,g=e.showOceanWaves,p=e.enableLighting,y=e.dynamicAtmosphereLighting,b=e.dynamicAtmosphereLightingFromSun,C=e.showGroundAtmosphere,E=e.perFragmentGroundAtmosphere,w=e.hasVertexNormals,S=e.useWebMercatorProjection,P=e.enableFog,L=e.enableClippingPlanes,z=e.clippingPlanes,R=e.clippedByBoundaries,F=e.hasImageryLayerCutout,U=e.colorCorrect,D=e.highlightFillTile,I=e.colorToAlpha,_=e.hasGeodeticSurfaceNormals,v=e.hasExaggeration,O=e.showUndergroundColor,N=e.translucent;let V=0,k="";const W=n.renderedMesh.encoding;W.quantization===fc.BITS12&&(V=1,k="QUANTIZATION_BITS12");let q=0,te="";R&&(q=1,te="TILE_LIMIT_RECTANGLE");let Y=0,X="";F&&(Y=1,X="APPLY_IMAGERY_CUTOUT");const $=t.mode,se=$|o<<2|r<<3|s<<4|a<<5|c<<6|u<<7|m<<8|g<<9|p<<10|y<<11|b<<12|C<<13|E<<14|w<<15|S<<16|P<<17|V<<18|h<<19|L<<20|q<<21|Y<<22|U<<23|D<<24|I<<25|_<<26|v<<27|O<<28|N<<29|d<<30;let ue=0;l(z)&&z.length>0&&(ue=L?z.clippingPlanesState:0);let re=n.surfaceShader;if(l(re)&&re.numberOfDayTextures===i&&re.flags===se&&re.material===this.material&&re.clippingShaderState===ue)return re.shaderProgram;let he=this._shadersByTexturesFlags[i];if(l(he)||(he=this._shadersByTexturesFlags[i]=[]),re=he[se],!l(re)||re.material!==this.material||re.clippingShaderState!==ue){const ce=this.baseVertexShaderSource.clone(),Q=this.baseFragmentShaderSource.clone();ue!==0&&Q.sources.unshift(UM(z,t.context)),ce.defines.push(k),Q.defines.push(`TEXTURE_UNITS ${i}`,te,X),o&&Q.defines.push("APPLY_BRIGHTNESS"),r&&Q.defines.push("APPLY_CONTRAST"),s&&Q.defines.push("APPLY_HUE"),a&&Q.defines.push("APPLY_SATURATION"),c&&Q.defines.push("APPLY_GAMMA"),u&&Q.defines.push("APPLY_ALPHA"),d&&Q.defines.push("APPLY_DAY_NIGHT_ALPHA"),m&&(Q.defines.push("SHOW_REFLECTIVE_OCEAN"),ce.defines.push("SHOW_REFLECTIVE_OCEAN")),g&&Q.defines.push("SHOW_OCEAN_WAVES"),I&&Q.defines.push("APPLY_COLOR_TO_ALPHA"),O&&(ce.defines.push("UNDERGROUND_COLOR"),Q.defines.push("UNDERGROUND_COLOR")),N&&(ce.defines.push("TRANSLUCENT"),Q.defines.push("TRANSLUCENT")),p&&(w?(ce.defines.push("ENABLE_VERTEX_LIGHTING"),Q.defines.push("ENABLE_VERTEX_LIGHTING")):(ce.defines.push("ENABLE_DAYNIGHT_SHADING"),Q.defines.push("ENABLE_DAYNIGHT_SHADING"))),y&&(ce.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),Q.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING"),b&&(ce.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),Q.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),C&&(ce.defines.push("GROUND_ATMOSPHERE"),Q.defines.push("GROUND_ATMOSPHERE"),E&&(ce.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"),Q.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE"))),ce.defines.push("INCLUDE_WEB_MERCATOR_Y"),Q.defines.push("INCLUDE_WEB_MERCATOR_Y"),P&&(ce.defines.push("FOG"),Q.defines.push("FOG")),h&&Q.defines.push("APPLY_SPLIT"),L&&Q.defines.push("ENABLE_CLIPPING_PLANES"),U&&Q.defines.push("COLOR_CORRECT"),D&&Q.defines.push("HIGHLIGHT_FILL_TILE"),_&&ce.defines.push("GEODETIC_SURFACE_NORMALS"),v&&ce.defines.push("EXAGGERATION");let ne=` vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
|
||
{
|
||
vec4 color = initialColor;
|
||
`;F&&(ne+=` vec4 cutoutAndColorResult;
|
||
bool texelUnclipped;
|
||
`);for(let _e=0;_e<i;++_e)F?ne+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${_e}];
|
||
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
|
||
cutoutAndColorResult = sampleAndBlend(
|
||
`:ne+=` color = sampleAndBlend(
|
||
`,ne+=` color,
|
||
u_dayTextures[${_e}],
|
||
u_dayTextureUseWebMercatorT[${_e}] ? textureCoordinates.xz : textureCoordinates.xy,
|
||
u_dayTextureTexCoordsRectangle[${_e}],
|
||
u_dayTextureTranslationAndScale[${_e}],
|
||
${u?`u_dayTextureAlpha[${_e}]`:"1.0"},
|
||
${d?`u_dayTextureNightAlpha[${_e}]`:"1.0"},
|
||
${d?`u_dayTextureDayAlpha[${_e}]`:"1.0"},
|
||
${o?`u_dayTextureBrightness[${_e}]`:"0.0"},
|
||
${r?`u_dayTextureContrast[${_e}]`:"0.0"},
|
||
${s?`u_dayTextureHue[${_e}]`:"0.0"},
|
||
${a?`u_dayTextureSaturation[${_e}]`:"0.0"},
|
||
${c?`u_dayTextureOneOverGamma[${_e}]`:"0.0"},
|
||
${h?`u_dayTextureSplit[${_e}]`:"0.0"},
|
||
${I?`u_colorsToAlpha[${_e}]`:"vec4(0.0)"},
|
||
nightBlend );
|
||
`,F&&(ne+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
|
||
`);ne+=` return color;
|
||
}`,Q.sources.push(ne),ce.sources.push(Pve($)),ce.sources.push(Ove(S));const de=Cn.fromCache({context:t.context,vertexShaderSource:ce,fragmentShaderSource:Q,attributeLocations:W.getAttributeLocations()});re=he[se]=new Ive(i,se,this.material,de,ue)}return n.surfaceShader=re,re.shaderProgram};HM.prototype.destroy=function(){let e,t;const n=this._shadersByTexturesFlags;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];if(!l(o))continue;for(e in o)o.hasOwnProperty(e)&&(t=o[e],l(t)&&t.shaderProgram.destroy())}return He(this)};function Ji(e){e=A(e,A.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}const Lve={NONE:0,TOP:1,ALL:2},yn=Object.freeze(Lve),Bve=new f;function Tc(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(T.typeOf.object("min",t),T.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===yn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=f.clone(t),this._max=f.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}Tc.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;T.typeOf.object("dimensions",t),T.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),T.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),T.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=f.multiplyByScalar(t,.5,new f);return new Tc({minimum:f.negate(n,new f),maximum:n,offsetAttribute:e.offsetAttribute})};Tc.fromAxisAlignedBoundingBox=function(e){return T.typeOf.object("boundindBox",e),new Tc({minimum:e.minimum,maximum:e.maximum})};Tc.packedLength=2*f.packedLength+1;Tc.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),f.pack(e._min,t,n),f.pack(e._max,t,n+f.packedLength),t[n+f.packedLength*2]=A(e._offsetAttribute,-1),t};const C7=new f,T7=new f,L4={minimum:C7,maximum:T7,offsetAttribute:void 0};Tc.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=f.unpack(e,t,C7),o=f.unpack(e,t+f.packedLength,T7),r=e[t+f.packedLength*2];return l(n)?(n._min=f.clone(i,n._min),n._max=f.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(L4.offsetAttribute=r===-1?void 0:r,new Tc(L4))};Tc.createGeometry=function(e){const t=e._min,n=e._max;if(f.equals(t,n))return;const i=new Ji,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 Ue({componentDatatype:ee.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;const s=f.subtract(n,t,Bve),a=f.magnitude(s)*.5;if(l(e._offsetAttribute)){const c=r.length,u=e._offsetAttribute===yn.NONE?0:1,d=new Uint8Array(c/3).fill(u);i.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:d})}return new Lt({attributes:i,indices:o,primitiveType:Ze.LINES,boundingSphere:new fe(f.ZERO,a),offsetAttribute:e._offsetAttribute})};function pn(e,t,n,i){e=A(e,1),t=A(t,1),n=A(n,1),i=A(i,1),this.value=new Uint8Array([H.floatToByte(e),H.floatToByte(t),H.floatToByte(n),H.floatToByte(i)])}Object.defineProperties(pn.prototype,{componentDatatype:{get:function(){return ee.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});pn.fromColor=function(e){if(!l(e))throw new x("color is required.");return new pn(e.red,e.green,e.blue,e.alpha)};pn.toValue=function(e,t){if(!l(e))throw new x("color is required.");return l(t)?e.toBytes(t):new Uint8Array(e.toBytes())};pn.equals=function(e,t){return e===t||l(e)&&l(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]};function ln(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.geometry))throw new x("options.geometry is required.");this.geometry=e.geometry,this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this.id=e.id,this.pickPrimitive=e.pickPrimitive,this.attributes=A(e.attributes,{}),this.westHemisphereGeometry=void 0,this.eastHemisphereGeometry=void 0}const B4=new f,R4=new f,N4=new f;function Rve(e,t,n,i,o){T.defined("point",e),T.defined("p0",t),T.defined("p1",n),T.defined("p2",i),l(o)||(o=new f);let r,s,a,c,u,d,h,m;if(l(t.z)){if(f.equalsEpsilon(e,t,M.EPSILON14))return f.clone(f.UNIT_X,o);if(f.equalsEpsilon(e,n,M.EPSILON14))return f.clone(f.UNIT_Y,o);if(f.equalsEpsilon(e,i,M.EPSILON14))return f.clone(f.UNIT_Z,o);r=f.subtract(n,t,B4),s=f.subtract(i,t,R4),a=f.subtract(e,t,N4),c=f.dot(r,r),u=f.dot(r,s),d=f.dot(r,a),h=f.dot(s,s),m=f.dot(s,a)}else{if(j.equalsEpsilon(e,t,M.EPSILON14))return f.clone(f.UNIT_X,o);if(j.equalsEpsilon(e,n,M.EPSILON14))return f.clone(f.UNIT_Y,o);if(j.equalsEpsilon(e,i,M.EPSILON14))return f.clone(f.UNIT_Z,o);r=j.subtract(n,t,B4),s=j.subtract(i,t,R4),a=j.subtract(e,t,N4),c=j.dot(r,r),u=j.dot(r,s),d=j.dot(r,a),h=j.dot(s,s),m=j.dot(s,a)}o.y=h*d-u*m,o.z=c*m-u*d;const g=c*h-u*u;if(g!==0)return o.y/=g,o.z/=g,o.x=1-o.y-o.z,o}const VM={};VM.calculateACMR=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.indices;let n=e.maximumIndex;const i=A(e.cacheSize,24);if(!l(t))throw new x("indices is required.");const o=t.length;if(o<3||o%3!==0)throw new x("indices length must be a multiple of three.");if(n<=0)throw new x("maximumIndex must be greater than zero.");if(i<3)throw new x("cacheSize must be greater than two.");if(!l(n)){n=0;let a=0,c=t[a];for(;a<o;)c>n&&(n=c),++a,c=t[a]}const 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)};VM.tipsify=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.indices,n=e.maximumIndex,i=A(e.cacheSize,24);let o;function r(D,I,_,v){for(;I.length>=1;){const O=I[I.length-1];if(I.splice(I.length-1,1),D[O].numLiveTriangles>0)return O}for(;o<v;){if(D[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(D,I,_,v,O,N,V){let k=-1,G,W=-1,K=0;for(;K<_.length;){const q=_[K];v[q].numLiveTriangles&&(G=0,O-v[q].timeStamp+2*v[q].numLiveTriangles<=I&&(G=O-v[q].timeStamp),(G>W||W===-1)&&(W=G,k=q)),++K}return k===-1?r(v,N,D,V):k}if(!l(t))throw new x("indices is required.");const a=t.length;if(a<3||a%3!==0)throw new x("indices length must be a multiple of three.");if(n<=0)throw new x("maximumIndex must be greater than zero.");if(i<3)throw new x("cacheSize must be greater than two.");let c=0,u=0,d=t[u];const h=a;if(l(n))c=n+1;else{for(;u<h;)d>c&&(c=d),++u,d=t[u];if(c===-1)return 0;++c}const m=[];let g;for(g=0;g<c;g++)m[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};u=0;let p=0;for(;u<h;)m[t[u]].vertexTriangles.push(p),++m[t[u]].numLiveTriangles,m[t[u+1]].vertexTriangles.push(p),++m[t[u+1]].numLiveTriangles,m[t[u+2]].vertexTriangles.push(p),++m[t[u+2]].numLiveTriangles,++p,u+=3;let y=0,b=i+1;o=1;let C=[];const E=[];let w,S,P=0;const L=[],z=a/3,R=[];for(g=0;g<z;g++)R[g]=!1;let F,U;for(;y!==-1;){C=[],S=m[y],U=S.vertexTriangles.length;for(let D=0;D<U;++D)if(p=S.vertexTriangles[D],!R[p]){R[p]=!0,u=p+p+p;for(let I=0;I<3;++I)F=t[u],C.push(F),E.push(F),L[P]=F,++P,w=m[F],--w.numLiveTriangles,b-w.timeStamp>i&&(w.timeStamp=b,++b),++u}y=s(t,i,C,m,b,E,c)}return L};const Nve=VM,Ra={};function JS(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function Mve(e){const t=e.length,n=t/3*6,i=at.createTypedArray(t,n);let o=0;for(let r=0;r<t;r+=3,o+=6)JS(i,o,e[r],e[r+1],e[r+2]);return i}function Fve(e){const t=e.length;if(t>=3){const n=(t-2)*6,i=at.createTypedArray(t,n);JS(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)JS(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function zve(e){if(e.length>0){const t=e.length-1,n=(t-1)*6,i=at.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;s<t;++s,r+=6)JS(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}Ra.toWireframe=function(e){if(!l(e))throw new x("geometry is required.");const t=e.indices;if(l(t)){switch(e.primitiveType){case Ze.TRIANGLES:e.indices=Mve(t);break;case Ze.TRIANGLE_STRIP:e.indices=Fve(t);break;case Ze.TRIANGLE_FAN:e.indices=zve(t);break;default:throw new x("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=Ze.LINES}return e};Ra.createLineSegmentsForVectors=function(e,t,n){if(t=A(t,"normal"),!l(e))throw new x("geometry is required.");if(!l(e.attributes.position))throw new x("geometry.attributes.position is required.");if(!l(e.attributes[t]))throw new x(`geometry.attributes must have an attribute with the same name as the attributeName parameter, ${t}.`);n=A(n,1e4);const i=e.attributes.position.values,o=e.attributes[t].values,r=i.length,s=new Float64Array(2*r);let a=0;for(let d=0;d<r;d+=3)s[a++]=i[d],s[a++]=i[d+1],s[a++]=i[d+2],s[a++]=i[d]+o[d]*n,s[a++]=i[d+1]+o[d+1]*n,s[a++]=i[d+2]+o[d+2]*n;let c;const u=e.boundingSphere;return l(u)&&(c=new fe(u.center,u.radius+n)),new Lt({attributes:{position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:Ze.LINES,boundingSphere:c})};Ra.createAttributeLocations=function(e){if(!l(e))throw new x("geometry is required.");const t=["position","positionHigh","positionLow","position3DHigh","position3DLow","position2DHigh","position2DLow","pickColor","normal","st","tangent","bitangent","extrudeDirection","compressedAttributes"],n=e.attributes,i={};let o=0,r;const s=t.length;for(r=0;r<s;++r){const a=t[r];l(n[a])&&(i[a]=o++)}for(const a in n)n.hasOwnProperty(a)&&!l(i[a])&&(i[a]=o++);return i};Ra.reorderForPreVertexCache=function(e){if(!l(e))throw new x("geometry is required.");const t=Lt.computeNumberOfVertices(e),n=e.indices;if(l(n)){const i=new Int32Array(t);for(let m=0;m<t;m++)i[m]=-1;const o=n,r=o.length,s=at.createTypedArray(t,r);let a=0,c=0,u=0,d;for(;a<r;)d=i[o[a]],d!==-1?s[c]=d:(d=o[a],i[d]=u,s[c]=u,++u),++a,++c;e.indices=s;const h=e.attributes;for(const m in h)if(h.hasOwnProperty(m)&&l(h[m])&&l(h[m].values)){const g=h[m],p=g.values;let y=0;const b=g.componentsPerAttribute,C=ee.createTypedArray(g.componentDatatype,u*b);for(;y<t;){const E=i[y];if(E!==-1)for(let w=0;w<b;w++)C[b*E+w]=p[b*y+w];++y}g.values=C}}return e};Ra.reorderForPostVertexCache=function(e,t){if(!l(e))throw new x("geometry is required.");const n=e.indices;if(e.primitiveType===Ze.TRIANGLES&&l(n)){const i=n.length;let o=0;for(let r=0;r<i;r++)n[r]>o&&(o=n[r]);e.indices=Nve.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function M4(e){const t={};for(const n in e)if(e.hasOwnProperty(n)&&l(e[n])&&l(e[n].values)){const i=e[n];t[n]=new Ue({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function Uve(e,t,n){for(const i in t)if(t.hasOwnProperty(i)&&l(t[i])&&l(t[i].values)){const o=t[i];for(let r=0;r<o.componentsPerAttribute;++r)e[i].values.push(o.values[n*o.componentsPerAttribute+r])}}Ra.fitToUnsignedShortIndices=function(e){if(!l(e))throw new x("geometry is required.");if(l(e.indices)&&e.primitiveType!==Ze.TRIANGLES&&e.primitiveType!==Ze.LINES&&e.primitiveType!==Ze.POINTS)throw new x("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");const t=[],n=Lt.computeNumberOfVertices(e);if(l(e.indices)&&n>=M.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=M4(e.attributes);const a=e.indices,c=a.length;let u;e.primitiveType===Ze.TRIANGLES?u=3:e.primitiveType===Ze.LINES?u=2:e.primitiveType===Ze.POINTS&&(u=1);for(let d=0;d<c;d+=u){for(let h=0;h<u;++h){const m=a[d+h];let g=i[m];l(g)||(g=r++,i[m]=g,Uve(s,e.attributes,m)),o.push(g)}r+u>=M.SIXTY_FOUR_KILOBYTES&&(t.push(new Lt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=M4(e.attributes))}o.length!==0&&t.push(new Lt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const F4=new f,Hve=new Ce;Ra.projectTo2D=function(e,t,n,i,o){if(!l(e))throw new x("geometry is required.");if(!l(t))throw new x("attributeName is required.");if(!l(n))throw new x("attributeName3D is required.");if(!l(i))throw new x("attributeName2D is required.");if(!l(e.attributes[t]))throw new x(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==ee.DOUBLE)throw new x("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const r=e.attributes[t];o=l(o)?o:new nr;const s=o.ellipsoid,a=r.values,c=new Float64Array(a.length);let u=0;for(let d=0;d<a.length;d+=3){const h=f.fromArray(a,d,F4),m=s.cartesianToCartographic(h,Hve);if(!l(m))throw new x(`Could not project point (${h.x}, ${h.y}, ${h.z}) to 2D.`);const g=o.project(m,F4);c[u++]=g.x,c[u++]=g.y,c[u++]=g.z}return e.attributes[n]=r,e.attributes[i]=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};const M1={high:0,low:0};Ra.encodeAttribute=function(e,t,n,i){if(!l(e))throw new x("geometry is required.");if(!l(t))throw new x("attributeName is required.");if(!l(n))throw new x("attributeHighName is required.");if(!l(i))throw new x("attributeLowName is required.");if(!l(e.attributes[t]))throw new x(`geometry must have attribute matching the attributeName argument: ${t}.`);if(e.attributes[t].componentDatatype!==ee.DOUBLE)throw new x("The attribute componentDatatype must be ComponentDatatype.DOUBLE.");const o=e.attributes[t],r=o.values,s=r.length,a=new Float32Array(s),c=new Float32Array(s);for(let d=0;d<s;++d)Rn.encode(r[d],M1),a[d]=M1.high,c[d]=M1.low;const u=o.componentsPerAttribute;return e.attributes[n]=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:u,values:a}),e.attributes[i]=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:u,values:c}),delete e.attributes[t],e};let Wl=new f;function F1(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)f.unpack(n,o,Wl),B.multiplyByPoint(e,Wl,Wl),f.pack(Wl,n,o)}}function z1(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)f.unpack(n,o,Wl),J.multiplyByVector(e,Wl,Wl),Wl=f.normalize(Wl,Wl),f.pack(Wl,n,o)}}const XE=new B,KE=new J;Ra.transformToWorldCoordinates=function(e){if(!l(e))throw new x("instance is required.");const t=e.modelMatrix;if(B.equals(t,B.IDENTITY))return e;const n=e.geometry.attributes;F1(t,n.position),F1(t,n.prevPosition),F1(t,n.nextPosition),(l(n.normal)||l(n.tangent)||l(n.bitangent))&&(B.inverse(t,XE),B.transpose(XE,XE),B.getMatrix3(XE,KE),z1(KE,n.normal),z1(KE,n.tangent),z1(KE,n.bitangent));const i=e.geometry.boundingSphere;return l(i)&&(e.geometry.boundingSphere=fe.transform(i,t,i)),e.modelMatrix=B.clone(B.IDENTITY),e};function Vve(e,t){const n=e.length,i={},o=e[0][t].attributes;let r;for(r in o)if(o.hasOwnProperty(r)&&l(o[r])&&l(o[r].values)){const s=o[r];let a=s.values.length,c=!0;for(let u=1;u<n;++u){const d=e[u][t].attributes[r];if(!l(d)||s.componentDatatype!==d.componentDatatype||s.componentsPerAttribute!==d.componentsPerAttribute||s.normalize!==d.normalize){c=!1;break}a+=d.values.length}c&&(i[r]=new Ue({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:ee.createTypedArray(s.componentDatatype,a)}))}return i}const kve=new f;function U1(e,t){const n=e.length;let i,o,r,s;const a=e[0].modelMatrix,c=l(e[0][t].indices),u=e[0][t].primitiveType;for(o=1;o<n;++o){if(!B.equals(e[o].modelMatrix,a))throw new x("All instances must have the same modelMatrix.");if(l(e[o][t].indices)!==c)throw new x("All instance geometries must have an indices or not have one.");if(e[o][t].primitiveType!==u)throw new x("All instance geometries must have the same primitiveType.")}const d=Vve(e,t);let h,m,g;for(i in d)if(d.hasOwnProperty(i))for(h=d[i].values,s=0,o=0;o<n;++o)for(m=e[o][t].attributes[i].values,g=m.length,r=0;r<g;++r)h[s++]=m[r];let p;if(c){let E=0;for(o=0;o<n;++o)E+=e[o][t].indices.length;const w=Lt.computeNumberOfVertices(new Lt({attributes:d,primitiveType:Ze.POINTS})),S=at.createTypedArray(w,E);let P=0,L=0;for(o=0;o<n;++o){const z=e[o][t].indices,R=z.length;for(s=0;s<R;++s)S[P++]=L+z[s];L+=Lt.computeNumberOfVertices(e[o][t])}p=S}let y=new f,b=0,C;for(o=0;o<n;++o){if(C=e[o][t].boundingSphere,!l(C)){y=void 0;break}f.add(C.center,y,y)}if(l(y))for(f.divideByScalar(y,n,y),o=0;o<n;++o){C=e[o][t].boundingSphere;const E=f.magnitude(f.subtract(C.center,y,kve))+C.radius;E>b&&(b=E)}return new Lt({attributes:d,indices:p,primitiveType:u,boundingSphere:l(y)?new fe(y,b):void 0})}Ra.combineInstances=function(e){if(!l(e)||e.length<1)throw new x("instances is required and must have length greater than zero.");const t=[],n=[],i=e.length;for(let r=0;r<i;++r){const s=e[r];l(s.geometry)?t.push(s):l(s.westHemisphereGeometry)&&l(s.eastHemisphereGeometry)&&n.push(s)}const o=[];return t.length>0&&o.push(U1(t,"geometry")),n.length>0&&(o.push(U1(n,"westHemisphereGeometry")),o.push(U1(n,"eastHemisphereGeometry"))),o};const Hc=new f,pA=new f,Ig=new f,Pg=new f;Ra.computeNormal=function(e){if(!l(e))throw new x("geometry is required.");if(!l(e.attributes.position)||!l(e.attributes.position.values))throw new x("geometry.attributes.position.values is required.");if(!l(e.indices))throw new x("geometry.indices is required.");if(e.indices.length<2||e.indices.length%3!==0)throw new x("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Ze.TRIANGLES)throw new x("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const 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);let u;for(u=0;u<o;u++)s[u]={indexOffset:0,count:0,currentCount:0};let d=0;for(u=0;u<r;u+=3){const p=t[u],y=t[u+1],b=t[u+2],C=p*3,E=y*3,w=b*3;pA.x=i[C],pA.y=i[C+1],pA.z=i[C+2],Ig.x=i[E],Ig.y=i[E+1],Ig.z=i[E+2],Pg.x=i[w],Pg.y=i[w+1],Pg.z=i[w+2],s[p].count++,s[y].count++,s[b].count++,f.subtract(Ig,pA,Ig),f.subtract(Pg,pA,Pg),a[d]=f.cross(Ig,Pg,new f),d++}let h=0;for(u=0;u<o;u++)s[u].indexOffset+=h,h+=s[u].count;d=0;let m;for(u=0;u<r;u+=3){m=s[t[u]];let p=m.indexOffset+m.currentCount;c[p]=d,m.currentCount++,m=s[t[u+1]],p=m.indexOffset+m.currentCount,c[p]=d,m.currentCount++,m=s[t[u+2]],p=m.indexOffset+m.currentCount,c[p]=d,m.currentCount++,d++}const g=new Float32Array(o*3);for(u=0;u<o;u++){const p=u*3;if(m=s[u],f.clone(f.ZERO,Hc),m.count>0){for(d=0;d<m.count;d++)f.add(Hc,a[c[m.indexOffset+d]],Hc);f.equalsEpsilon(f.ZERO,Hc,M.EPSILON10)&&f.clone(a[c[m.indexOffset]],Hc)}f.equalsEpsilon(f.ZERO,Hc,M.EPSILON10)&&(Hc.z=1),f.normalize(Hc,Hc),g[p]=Hc.x,g[p+1]=Hc.y,g[p+2]=Hc.z}return e.attributes.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g}),e};const Gve=new f,z4=new f,Wve=new f;Ra.computeTangentAndBitangent=function(e){if(!l(e))throw new x("geometry is required.");const t=e.attributes,n=e.indices;if(!l(t.position)||!l(t.position.values))throw new x("geometry.attributes.position.values is required.");if(!l(t.normal)||!l(t.normal.values))throw new x("geometry.attributes.normal.values is required.");if(!l(t.st)||!l(t.st.values))throw new x("geometry.attributes.st.values is required.");if(!l(n))throw new x("geometry.indices is required.");if(n.length<2||n.length%3!==0)throw new x("geometry.indices length must be greater than 0 and be a multiple of 3.");if(e.primitiveType!==Ze.TRIANGLES)throw new x("geometry.primitiveType must be PrimitiveType.TRIANGLES.");const 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);let u;for(u=0;u<c.length;u++)c[u]=0;let d,h,m;for(u=0;u<a;u+=3){const y=n[u],b=n[u+1],C=n[u+2];d=y*3,h=b*3,m=C*3;const E=y*2,w=b*2,S=C*2,P=i[d],L=i[d+1],z=i[d+2],R=r[E],F=r[E+1],U=r[w+1]-F,D=r[S+1]-F,I=1/((r[w]-R)*D-(r[S]-R)*U),_=(D*(i[h]-P)-U*(i[m]-P))*I,v=(D*(i[h+1]-L)-U*(i[m+1]-L))*I,O=(D*(i[h+2]-z)-U*(i[m+2]-z))*I;c[d]+=_,c[d+1]+=v,c[d+2]+=O,c[h]+=_,c[h+1]+=v,c[h+2]+=O,c[m]+=_,c[m+1]+=v,c[m+2]+=O}const g=new Float32Array(s*3),p=new Float32Array(s*3);for(u=0;u<s;u++){d=u*3,h=d+1,m=d+2;const y=f.fromArray(o,d,Gve),b=f.fromArray(c,d,Wve),C=f.dot(y,b);f.multiplyByScalar(y,C,z4),f.normalize(f.subtract(b,z4,b),b),g[d]=b.x,g[h]=b.y,g[m]=b.z,f.normalize(f.cross(y,b,b),b),p[d]=b.x,p[h]=b.y,p[m]=b.z}return e.attributes.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p}),e};const mA=new j,Rl=new f,U4=new f,H4=new f;let JE=new j;Ra.compressVertices=function(e){if(!l(e))throw new x("geometry is required.");const t=e.attributes.extrudeDirection;let n,i;if(l(t)){const L=t.values;i=L.length/3;const z=new Float32Array(i*2);let R=0;for(n=0;n<i;++n){if(f.fromArray(L,n*3,Rl),f.equals(Rl,f.ZERO)){R+=2;continue}JE=mi.octEncodeInRange(Rl,65535,JE),z[R++]=JE.x,z[R++]=JE.y}return e.attributes.compressedAttributes=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:z}),delete e.attributes.extrudeDirection,e}const o=e.attributes.normal,r=e.attributes.st,s=l(o),a=l(r);if(!s&&!a)return e;const c=e.attributes.tangent,u=e.attributes.bitangent,d=l(c),h=l(u);let m,g,p,y;s&&(m=o.values),a&&(g=r.values),d&&(p=c.values),h&&(y=u.values),i=(s?m.length:g.length)/(s?3:2);let E=i,w=a&&s?2:1;w+=d||h?1:0,E*=w;const S=new Float32Array(E);let P=0;for(n=0;n<i;++n){a&&(j.fromArray(g,n*2,mA),S[P++]=mi.compressTextureCoordinates(mA));const L=n*3;s&&l(p)&&l(y)?(f.fromArray(m,L,Rl),f.fromArray(p,L,U4),f.fromArray(y,L,H4),mi.octPack(Rl,U4,H4,mA),S[P++]=mA.x,S[P++]=mA.y):(s&&(f.fromArray(m,L,Rl),S[P++]=mi.octEncodeFloat(Rl)),d&&(f.fromArray(p,L,Rl),S[P++]=mi.octEncodeFloat(Rl)),h&&(f.fromArray(y,L,Rl),S[P++]=mi.octEncodeFloat(Rl)))}return e.attributes.compressedAttributes=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:w,values:S}),s&&delete e.attributes.normal,a&&delete e.attributes.st,h&&delete e.attributes.bitangent,d&&delete e.attributes.tangent,e};function jve(e){if(l(e.indices))return e;const t=Lt.computeNumberOfVertices(e);if(t<3)throw new x("The number of vertices must be at least three.");if(t%3!==0)throw new x("The number of vertices must be a multiple of three.");const n=at.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function qve(e){const t=Lt.computeNumberOfVertices(e);if(t<3)throw new x("The number of vertices must be at least three.");const n=at.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=Ze.TRIANGLES,e}function $ve(e){const t=Lt.computeNumberOfVertices(e);if(t<3)throw new x("The number of vertices must be at least 3.");const n=at.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=Ze.TRIANGLES,e}function Yve(e){if(l(e.indices))return e;const t=Lt.computeNumberOfVertices(e);if(t<2)throw new x("The number of vertices must be at least two.");if(t%2!==0)throw new x("The number of vertices must be a multiple of 2.");const n=at.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function Xve(e){const t=Lt.computeNumberOfVertices(e);if(t<2)throw new x("The number of vertices must be at least two.");const n=at.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=Ze.LINES,e}function Kve(e){const t=Lt.computeNumberOfVertices(e);if(t<2)throw new x("The number of vertices must be at least two.");const n=at.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=Ze.LINES,e}function Jve(e){switch(e.primitiveType){case Ze.TRIANGLE_FAN:return qve(e);case Ze.TRIANGLE_STRIP:return $ve(e);case Ze.TRIANGLES:return jve(e);case Ze.LINE_STRIP:return Xve(e);case Ze.LINE_LOOP:return Kve(e);case Ze.LINES:return Yve(e)}return e}function jh(e,t){Math.abs(e.y)<M.EPSILON6&&(t?e.y=-M.EPSILON6:e.y=M.EPSILON6)}function Qve(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){jh(e,e.y<0),jh(t,t.y<0),jh(n,n.y<0);return}const i=Math.abs(e.y),o=Math.abs(t.y),r=Math.abs(n.y);let s;i>o?i>r?s=M.sign(e.y):s=M.sign(n.y):o>r?s=M.sign(t.y):s=M.sign(n.y);const a=s<0;jh(e,a),jh(t,a),jh(n,a)}const V4=new f;function Vc(e,t,n,i){f.add(e,f.multiplyByScalar(f.subtract(t,e,V4),e.y/(e.y-t.y),V4),n),f.clone(n,i),jh(n,!0),jh(i,!1)}const _m=new f,gm=new f,ym=new f,Am=new f,H1={positions:new Array(7),indices:new Array(3*3)};function Zve(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;Qve(e,t,n);const i=e.y<0,o=t.y<0,r=n.y<0;let s=0;s+=i?1:0,s+=o?1:0,s+=r?1:0;const a=H1.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(Vc(e,t,_m,ym),Vc(e,n,gm,Am),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(Vc(t,n,_m,ym),Vc(t,e,gm,Am),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(Vc(n,e,_m,ym),Vc(n,t,gm,Am),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||(Vc(n,e,_m,ym),Vc(n,t,gm,Am),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(Vc(t,n,_m,ym),Vc(t,e,gm,Am),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(Vc(e,t,_m,ym),Vc(e,n,gm,Am),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const c=H1.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,(s===1||s===2)&&(c[3]=_m,c[4]=gm,c[5]=ym,c[6]=Am,c.length=7),H1}function k4(e,t){const n=e.attributes;if(n.position.values.length===0)return;for(const o in n)if(n.hasOwnProperty(o)&&l(n[o])&&l(n[o].values)){const r=n[o];r.values=ee.createTypedArray(r.componentDatatype,r.values)}const i=Lt.computeNumberOfVertices(e);return e.indices=at.createTypedArray(i,e.indices),t&&(e.boundingSphere=fe.fromVertices(n.position.values)),e}function p0(e){const t=e.attributes,n={};for(const i in t)if(t.hasOwnProperty(i)&&l(t[i])&&l(t[i].values)){const o=t[i];n[i]=new Ue({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new Lt({attributes:n,indices:[],primitiveType:e.primitiveType})}function kM(e,t,n){const i=l(e.geometry.boundingSphere);t=k4(t,i),n=k4(n,i),l(n)&&!l(t)?e.geometry=n:!l(n)&&l(t)?e.geometry=t:(e.westHemisphereGeometry=t,e.eastHemisphereGeometry=n,e.geometry=void 0)}function GM(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,c,u,d,h,m){const g=e.fromArray(u,r*t,n),p=e.fromArray(u,s*t,i),y=e.fromArray(u,a*t,o);e.multiplyByScalar(g,c.x,g),e.multiplyByScalar(p,c.y,p),e.multiplyByScalar(y,c.z,y);const b=e.add(g,p,g);e.add(b,y,b),m&&e.normalize(b,b),e.pack(b,d,h*t)}}const eDe=GM(oe,4),Gw=GM(f,3),E7=GM(j,2),tDe=function(e,t,n,i,o,r,s){const a=o[e]*i.x,c=o[t]*i.y,u=o[n]*i.z;r[s]=a+c+u>M.EPSILON6?1:0},Nb=new f,wB=new f,SB=new f,nDe=new f;function QE(e,t,n,i,o,r,s,a,c,u,d,h,m,g,p,y){if(!l(r)&&!l(s)&&!l(a)&&!l(c)&&!l(u)&&g===0)return;const b=f.fromArray(o,e*3,Nb),C=f.fromArray(o,t*3,wB),E=f.fromArray(o,n*3,SB),w=Rve(i,b,C,E,nDe);if(l(w)){if(l(r)&&Gw(e,t,n,w,r,h.normal.values,y,!0),l(u)){const S=f.fromArray(u,e*3,Nb),P=f.fromArray(u,t*3,wB),L=f.fromArray(u,n*3,SB);f.multiplyByScalar(S,w.x,S),f.multiplyByScalar(P,w.y,P),f.multiplyByScalar(L,w.z,L);let z;!f.equals(S,f.ZERO)||!f.equals(P,f.ZERO)||!f.equals(L,f.ZERO)?(z=f.add(S,P,S),f.add(z,L,z),f.normalize(z,z)):(z=Nb,z.x=0,z.y=0,z.z=0),f.pack(z,h.extrudeDirection.values,y*3)}if(l(d)&&tDe(e,t,n,w,d,h.applyOffset.values,y),l(s)&&Gw(e,t,n,w,s,h.tangent.values,y,!0),l(a)&&Gw(e,t,n,w,a,h.bitangent.values,y,!0),l(c)&&E7(e,t,n,w,c,h.st.values,y),g>0)for(let S=0;S<g;S++){const P=m[S];iDe(e,t,n,w,y,p[P],h[P])}}}function iDe(e,t,n,i,o,r,s){const a=r.componentsPerAttribute,c=r.values,u=s.values;switch(a){case 4:eDe(e,t,n,i,c,u,o,!1);break;case 3:Gw(e,t,n,i,c,u,o,!1);break;case 2:E7(e,t,n,i,c,u,o,!1);break;default:u[o]=c[e]*i.x+c[t]*i.y+c[n]*i.z}}function qu(e,t,n,i,o,r){const s=e.position.values.length/3;if(o!==-1){const 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}const oDe={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function G4(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=l(n.normal)?n.normal.values:void 0,r=l(n.bitangent)?n.bitangent.values:void 0,s=l(n.tangent)?n.tangent.values:void 0,a=l(n.st)?n.st.values:void 0,c=l(n.extrudeDirection)?n.extrudeDirection.values:void 0,u=l(n.applyOffset)?n.applyOffset.values:void 0,d=t.indices,h=[];for(const z in n)n.hasOwnProperty(z)&&!oDe[z]&&l(n[z])&&h.push(z);const m=h.length,g=p0(t),p=p0(t);let y,b,C,E,w;const S=[];S.length=i.length/3;const P=[];for(P.length=i.length/3,w=0;w<S.length;++w)S[w]=-1,P[w]=-1;const L=d.length;for(w=0;w<L;w+=3){const z=d[w],R=d[w+1],F=d[w+2];let U=f.fromArray(i,z*3),D=f.fromArray(i,R*3),I=f.fromArray(i,F*3);const _=Zve(U,D,I);if(l(_)&&_.positions.length>3){const v=_.positions,O=_.indices,N=O.length;for(let V=0;V<N;++V){const k=O[V],G=v[k];G.y<0?(y=p.attributes,b=p.indices,C=S):(y=g.attributes,b=g.indices,C=P),E=qu(y,b,C,d,k<3?w+k:-1,G),QE(z,R,F,G,i,o,s,r,a,c,u,y,h,m,n,E)}}else l(_)&&(U=_.positions[0],D=_.positions[1],I=_.positions[2]),U.y<0?(y=p.attributes,b=p.indices,C=S):(y=g.attributes,b=g.indices,C=P),E=qu(y,b,C,d,w,U),QE(z,R,F,U,i,o,s,r,a,c,u,y,h,m,n,E),E=qu(y,b,C,d,w+1,D),QE(z,R,F,D,i,o,s,r,a,c,u,y,h,m,n,E),E=qu(y,b,C,d,w+2,I),QE(z,R,F,I,i,o,s,r,a,c,u,y,h,m,n,E)}kM(e,p,g)}const x7=Pt.fromPointNormal(f.ZERO,f.UNIT_Y),rDe=new f,sDe=new f;function Og(e,t,n,i,o,r,s){if(!l(s))return;const a=f.fromArray(i,e*3,Nb);f.equalsEpsilon(a,n,M.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function W4(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=l(n.applyOffset)?n.applyOffset.values:void 0,r=t.indices,s=p0(t),a=p0(t);let c;const u=r.length,d=[];d.length=i.length/3;const h=[];for(h.length=i.length/3,c=0;c<d.length;++c)d[c]=-1,h[c]=-1;for(c=0;c<u;c+=2){const m=r[c],g=r[c+1],p=f.fromArray(i,m*3,Nb),y=f.fromArray(i,g*3,wB);let b;Math.abs(p.y)<M.EPSILON6&&(p.y<0?p.y=-M.EPSILON6:p.y=M.EPSILON6),Math.abs(y.y)<M.EPSILON6&&(y.y<0?y.y=-M.EPSILON6:y.y=M.EPSILON6);let C=s.attributes,E=s.indices,w=h,S=a.attributes,P=a.indices,L=d;const z=pr.lineSegmentPlane(p,y,x7,SB);if(l(z)){const R=f.multiplyByScalar(f.UNIT_Y,5*M.EPSILON9,rDe);p.y<0&&(f.negate(R,R),C=a.attributes,E=a.indices,w=d,S=s.attributes,P=s.indices,L=h);const F=f.add(z,R,sDe);b=qu(C,E,w,r,c,p),Og(m,g,p,i,b,C,o),b=qu(C,E,w,r,-1,F),Og(m,g,F,i,b,C,o),f.negate(R,R),f.add(z,R,F),b=qu(S,P,L,r,-1,F),Og(m,g,F,i,b,S,o),b=qu(S,P,L,r,c+1,y),Og(m,g,y,i,b,S,o)}else{let R,F,U;p.y<0?(R=a.attributes,F=a.indices,U=d):(R=s.attributes,F=s.indices,U=h),b=qu(R,F,U,r,c,p),Og(m,g,p,i,b,R,o),b=qu(R,F,U,r,c+1,y),Og(m,g,y,i,b,R,o)}}kM(e,a,s)}const j4=new j,aDe=new j,w7=new f,S7=new f,vB=new f,cDe=new f,lDe=new f,uDe=new f,q4=new oe;function $4(e){const 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){const a=f.unpack(n,s,w7);if(a.x>0)continue;const c=f.unpack(i,s,S7);(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]):f.pack(a,i,s));const u=f.unpack(o,s,vB);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):f.pack(a,o,s))}}const dDe=5*M.EPSILON9,ZE=M.EPSILON6;function fDe(e){const t=e.geometry,n=t.attributes,i=n.position.values,o=n.prevPosition.values,r=n.nextPosition.values,s=n.expandAndWidth.values,a=l(n.st)?n.st.values:void 0,c=l(n.color)?n.color.values:void 0,u=p0(t),d=p0(t);let h,m,g,p=!1;const y=i.length/3;for(h=0;h<y;h+=4){const b=h,C=h+2,E=f.fromArray(i,b*3,w7),w=f.fromArray(i,C*3,S7);if(Math.abs(E.y)<ZE)for(E.y=ZE*(w.y<0?-1:1),i[h*3+1]=E.y,i[(h+1)*3+1]=E.y,m=b*3;m<b*3+4*3;m+=3)o[m]=i[h*3],o[m+1]=i[h*3+1],o[m+2]=i[h*3+2];if(Math.abs(w.y)<ZE)for(w.y=ZE*(E.y<0?-1:1),i[(h+2)*3+1]=w.y,i[(h+3)*3+1]=w.y,m=b*3;m<b*3+4*3;m+=3)r[m]=i[(h+2)*3],r[m+1]=i[(h+2)*3+1],r[m+2]=i[(h+2)*3+2];let S=u.attributes,P=u.indices,L=d.attributes,z=d.indices;const R=pr.lineSegmentPlane(E,w,x7,cDe);if(l(R)){p=!0;const F=f.multiplyByScalar(f.UNIT_Y,dDe,lDe);E.y<0&&(f.negate(F,F),S=d.attributes,P=d.indices,L=u.attributes,z=u.indices);const U=f.add(R,F,uDe);S.position.values.push(E.x,E.y,E.z,E.x,E.y,E.z),S.position.values.push(U.x,U.y,U.z),S.position.values.push(U.x,U.y,U.z),S.prevPosition.values.push(o[b*3],o[b*3+1],o[b*3+2]),S.prevPosition.values.push(o[b*3+3],o[b*3+4],o[b*3+5]),S.prevPosition.values.push(E.x,E.y,E.z,E.x,E.y,E.z),S.nextPosition.values.push(U.x,U.y,U.z),S.nextPosition.values.push(U.x,U.y,U.z),S.nextPosition.values.push(U.x,U.y,U.z),S.nextPosition.values.push(U.x,U.y,U.z),f.negate(F,F),f.add(R,F,U),L.position.values.push(U.x,U.y,U.z),L.position.values.push(U.x,U.y,U.z),L.position.values.push(w.x,w.y,w.z,w.x,w.y,w.z),L.prevPosition.values.push(U.x,U.y,U.z),L.prevPosition.values.push(U.x,U.y,U.z),L.prevPosition.values.push(U.x,U.y,U.z),L.prevPosition.values.push(U.x,U.y,U.z),L.nextPosition.values.push(w.x,w.y,w.z,w.x,w.y,w.z),L.nextPosition.values.push(r[C*3],r[C*3+1],r[C*3+2]),L.nextPosition.values.push(r[C*3+3],r[C*3+4],r[C*3+5]);const D=j.fromArray(s,b*2,j4),I=Math.abs(D.y);S.expandAndWidth.values.push(-1,I,1,I),S.expandAndWidth.values.push(-1,-I,1,-I),L.expandAndWidth.values.push(-1,I,1,I),L.expandAndWidth.values.push(-1,-I,1,-I);let _=f.magnitudeSquared(f.subtract(R,E,vB));if(_/=f.magnitudeSquared(f.subtract(w,E,vB)),l(c)){const v=oe.fromArray(c,b*4,q4),O=oe.fromArray(c,C*4,q4),N=M.lerp(v.x,O.x,_),V=M.lerp(v.y,O.y,_),k=M.lerp(v.z,O.z,_),G=M.lerp(v.w,O.w,_);for(m=b*4;m<b*4+2*4;++m)S.color.values.push(c[m]);for(S.color.values.push(N,V,k,G),S.color.values.push(N,V,k,G),L.color.values.push(N,V,k,G),L.color.values.push(N,V,k,G),m=C*4;m<C*4+2*4;++m)L.color.values.push(c[m])}if(l(a)){const v=j.fromArray(a,b*2,j4),O=j.fromArray(a,(h+3)*2,aDe),N=M.lerp(v.x,O.x,_);for(m=b*2;m<b*2+2*2;++m)S.st.values.push(a[m]);for(S.st.values.push(N,v.y),S.st.values.push(N,O.y),L.st.values.push(N,v.y),L.st.values.push(N,O.y),m=C*2;m<C*2+2*2;++m)L.st.values.push(a[m])}g=S.position.values.length/3-4,P.push(g,g+2,g+1),P.push(g+1,g+2,g+3),g=L.position.values.length/3-4,z.push(g,g+2,g+1),z.push(g+1,g+2,g+3)}else{let F,U;for(E.y<0?(F=d.attributes,U=d.indices):(F=u.attributes,U=u.indices),F.position.values.push(E.x,E.y,E.z),F.position.values.push(E.x,E.y,E.z),F.position.values.push(w.x,w.y,w.z),F.position.values.push(w.x,w.y,w.z),m=h*3;m<h*3+4*3;++m)F.prevPosition.values.push(o[m]),F.nextPosition.values.push(r[m]);for(m=h*2;m<h*2+4*2;++m)F.expandAndWidth.values.push(s[m]),l(a)&&F.st.values.push(a[m]);if(l(c))for(m=h*4;m<h*4+4*4;++m)F.color.values.push(c[m]);g=F.position.values.length/3-4,U.push(g,g+2,g+1),U.push(g+1,g+2,g+3)}}p&&($4(d),$4(u)),kM(e,d,u)}Ra.splitLongitude=function(e){if(!l(e))throw new x("instance is required.");const t=e.geometry,n=t.boundingSphere;if(l(n)&&(n.center.x-n.radius>0||fe.intersectPlane(n,Pt.ORIGIN_ZX_PLANE)!==xn.INTERSECTING))return e;if(t.geometryType!==Cy.NONE)switch(t.geometryType){case Cy.POLYLINES:fDe(e);break;case Cy.TRIANGLES:G4(e);break;case Cy.LINES:W4(e);break}else Jve(t),t.primitiveType===Ze.TRIANGLES?G4(e):t.primitiveType===Ze.LINES&&W4(e);return e};const Yi=Ra,hDe=new f(1,1,1),ex=Math.cos,tx=Math.sin;function Ec(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,hDe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,M.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,M.PI),a=Math.round(A(e.stackPartitions,10)),c=Math.round(A(e.slicePartitions,8)),u=Math.round(A(e.subdivisions,128));if(a<1)throw new x("options.stackPartitions cannot be less than 1");if(c<0)throw new x("options.slicePartitions cannot be less than 0");if(u<0)throw new x("options.subdivisions must be greater than or equal to zero.");if(l(e.offsetAttribute)&&e.offsetAttribute===yn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=f.clone(t),this._innerRadii=f.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._subdivisions=u,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}Ec.packedLength=2*f.packedLength+8;Ec.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),f.pack(e._radii,t,n),n+=f.packedLength,f.pack(e._innerRadii,t,n),n+=f.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]=A(e._offsetAttribute,-1),t};const v7=new f,D7=new f,Wd={radii:v7,innerRadii:D7,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};Ec.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=f.unpack(e,t,v7);t+=f.packedLength;const o=f.unpack(e,t,D7);t+=f.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],m=e[t];return l(n)?(n._radii=f.clone(i,n._radii),n._innerRadii=f.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=c,n._stackPartitions=u,n._slicePartitions=d,n._subdivisions=h,n._offsetAttribute=m===-1?void 0:m,n):(Wd.minimumClock=r,Wd.maximumClock=s,Wd.minimumCone=a,Wd.maximumCone=c,Wd.stackPartitions=u,Wd.slicePartitions=d,Wd.subdivisions=h,Wd.offsetAttribute=m===-1?void 0:m,new Ec(Wd))};Ec.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._subdivisions,c=me.fromCartesian3(t);let u=e._slicePartitions+1,d=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/M.TWO_PI),d=Math.round(d*Math.abs(s-r)/M.PI),u<2&&(u=2),d<2&&(d=2);let h=0,m=1;const g=n.x!==t.x||n.y!==t.y||n.z!==t.z;let p=!1,y=!1;g&&(m=2,r>0&&(p=!0,h+=u),s<Math.PI&&(y=!0,h+=u));const b=a*m*(d+u),C=new Float64Array(b*3),E=2*(b+h-(u+d)*m),w=at.createTypedArray(b,E);let S,P,L,z,R=0;const F=new Array(d),U=new Array(d);for(S=0;S<d;S++)z=r+S*(s-r)/(d-1),F[S]=tx(z),U[S]=ex(z);const D=new Array(a),I=new Array(a);for(S=0;S<a;S++)L=i+S*(o-i)/(a-1),D[S]=tx(L),I[S]=ex(L);for(S=0;S<d;S++)for(P=0;P<a;P++)C[R++]=t.x*F[S]*I[P],C[R++]=t.y*F[S]*D[P],C[R++]=t.z*U[S];if(g)for(S=0;S<d;S++)for(P=0;P<a;P++)C[R++]=n.x*F[S]*I[P],C[R++]=n.y*F[S]*D[P],C[R++]=n.z*U[S];for(F.length=a,U.length=a,S=0;S<a;S++)z=r+S*(s-r)/(a-1),F[S]=tx(z),U[S]=ex(z);for(D.length=u,I.length=u,S=0;S<u;S++)L=i+S*(o-i)/(u-1),D[S]=tx(L),I[S]=ex(L);for(S=0;S<a;S++)for(P=0;P<u;P++)C[R++]=t.x*F[S]*I[P],C[R++]=t.y*F[S]*D[P],C[R++]=t.z*U[S];if(g)for(S=0;S<a;S++)for(P=0;P<u;P++)C[R++]=n.x*F[S]*I[P],C[R++]=n.y*F[S]*D[P],C[R++]=n.z*U[S];for(R=0,S=0;S<d*m;S++){const O=S*a;for(P=0;P<a-1;P++)w[R++]=O+P,w[R++]=O+P+1}let _=d*a*m;for(S=0;S<u;S++)for(P=0;P<a-1;P++)w[R++]=_+S+P*u,w[R++]=_+S+(P+1)*u;if(g)for(_=d*a*m+u*a,S=0;S<u;S++)for(P=0;P<a-1;P++)w[R++]=_+S+P*u,w[R++]=_+S+(P+1)*u;if(g){let O=d*a*m,N=O+a*u;if(p)for(S=0;S<u;S++)w[R++]=O+S,w[R++]=N+S;if(y)for(O+=a*u-u,N+=a*u-u,S=0;S<u;S++)w[R++]=O+S,w[R++]=N+S}const v=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:C})});if(l(e._offsetAttribute)){const O=C.length,N=e._offsetAttribute===yn.NONE?0:1,V=new Uint8Array(O/3).fill(N);v.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:V})}return new Lt({attributes:v,indices:w,primitiveType:Ze.LINES,boundingSphere:fe.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})};function vp(e){const t=A(e.radius,1),i={radii:new f(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new Ec(i),this._workerName="createSphereOutlineGeometry"}vp.packedLength=Ec.packedLength;vp.pack=function(e,t,n){return T.typeOf.object("value",e),Ec.pack(e._ellipsoidGeometry,t,n)};const pDe=new Ec,bm={radius:void 0,radii:new f,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};vp.unpack=function(e,t,n){const i=Ec.unpack(e,t,pDe);return bm.stackPartitions=i._stackPartitions,bm.slicePartitions=i._slicePartitions,bm.subdivisions=i._subdivisions,l(n)?(f.clone(i._radii,bm.radii),n._ellipsoidGeometry=new Ec(bm),n):(bm.radius=i._radii.x,new vp(bm))};vp.createGeometry=function(e){return Ec.createGeometry(e._ellipsoidGeometry)};const mDe={NONE:-1,PARTIAL:0,FULL:1},Wr=Object.freeze(mDe),_De={ADD:ae.FUNC_ADD,SUBTRACT:ae.FUNC_SUBTRACT,REVERSE_SUBTRACT:ae.FUNC_REVERSE_SUBTRACT,MIN:ae.MIN,MAX:ae.MAX},Jc=Object.freeze(_De),gDe={ZERO:ae.ZERO,ONE:ae.ONE,SOURCE_COLOR:ae.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:ae.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:ae.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:ae.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:ae.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:ae.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:ae.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:ae.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:ae.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:ae.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:ae.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:ae.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:ae.SRC_ALPHA_SATURATE},Mo=Object.freeze(gDe),yDe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.SOURCE_ALPHA,functionSourceAlpha:Mo.ONE,functionDestinationRgb:Mo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Mo.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.ONE,functionSourceAlpha:Mo.ONE,functionDestinationRgb:Mo.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:Mo.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.SOURCE_ALPHA,functionSourceAlpha:Mo.ONE,functionDestinationRgb:Mo.ONE,functionDestinationAlpha:Mo.ONE})},Gi=Object.freeze(yDe),ADe={NEVER:ae.NEVER,LESS:ae.LESS,EQUAL:ae.EQUAL,LESS_OR_EQUAL:ae.LEQUAL,GREATER:ae.GREATER,NOT_EQUAL:ae.NOTEQUAL,GREATER_OR_EQUAL:ae.GEQUAL,ALWAYS:ae.ALWAYS},x_=Object.freeze(ADe),bDe={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},Ai=Object.freeze(bDe),CDe={START:0,LOADING:1,DONE:2,FAILED:3},gl=Object.freeze(CDe),TDe={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},mo=Object.freeze(TDe);function Mi(){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 f,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=mo.UNLOADED,this.mesh=void 0,this.fill=void 0,this.pickBoundingSphere=new fe,this.surfaceShader=void 0,this.isClipped=!0,this.clippedByBoundaries=!1}Object.defineProperties(Mi.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let n=!(e===mo.RECEIVING||e===mo.TRANSFORMING);const i=this.imagery;for(let o=0,r=i.length;n&&o<r;++o){const s=i[o];n=!l(s.loadingImagery)||s.loadingImagery.state!==Ai.TRANSITIONING}return n}},renderedMesh:{get:function(){if(l(this.vertexArray))return this.mesh;if(l(this.fill))return this.fill.mesh}}});const EDe=new Ce;function V1(e,t,n,i,o,r){let s=e.getExaggeratedPosition(i,o,r);if(l(t)&&t!==le.SCENE3D){const c=n.ellipsoid.cartesianToCartographic(s,EDe);s=n.project(c,r),s=f.fromElements(s.z,s.x,s.y,r)}return s}const xDe=new f,wDe=new f,SDe=new f;Mi.prototype.pick=function(e,t,n,i,o){const r=this.renderedMesh;if(!l(r))return;const s=r.vertices,a=r.indices,c=r.encoding,u=a.length;let d=Number.MAX_VALUE;for(let h=0;h<u;h+=3){const m=a[h],g=a[h+1],p=a[h+2],y=V1(c,t,n,s,m,xDe),b=V1(c,t,n,s,g,wDe),C=V1(c,t,n,s,p,SDe),E=pr.rayTriangleParametric(e,y,b,C,i);l(E)&&E<d&&E>=0&&(d=E)}return d!==Number.MAX_VALUE?Un.getPoint(e,d,o):void 0};Mi.prototype.freeResources=function(){l(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();const e=this.imagery;for(let t=0,n=e.length;t<n;++t)e[t].freeResources();this.imagery.length=0,this.freeVertexArray()};Mi.prototype.freeVertexArray=function(){Mi._freeVertexArray(this.vertexArray),this.vertexArray=void 0,Mi._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};Mi.initialize=function(e,t,n){let i=e.data;l(i)||(i=e.data=new Mi),e.state===gl.START&&(vDe(e,t,n),e.state=gl.LOADING)};Mi.processStateMachine=function(e,t,n,i,o,r,s){Mi.initialize(e,n,i);const a=e.data;if(e.state===gl.LOADING&&DDe(e,t,n,i,o,r),s)return;const c=e.renderable;e.renderable=l(a.vertexArray);const u=a.terrainState===mo.READY;e.upsampledFromParent=l(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();const d=a.processImagery(e,n,t);if(u&&d){const h=e._loadedCallbacks,m={};for(const g in h)h.hasOwnProperty(g)&&(h[g](e)||(m[g]=h[g]));e._loadedCallbacks=m,e.state=gl.DONE}c&&(e.renderable=!0)};Mi.prototype.processImagery=function(e,t,n,i){const o=e.data;let r=e.upsampledFromParent,s=!1,a=!0;const c=o.imagery;let u,d;for(u=0,d=c.length;u<d;++u){const h=c[u];if(!l(h.loadingImagery)){r=!1;continue}if(h.loadingImagery.state===Ai.PLACEHOLDER){const g=h.loadingImagery.imageryLayer;if(g.imageryProvider.ready){h.freeResources(),c.splice(u,1),g._createTileImagerySkeletons(e,t,u),--u,d=c.length;continue}else r=!1}const m=h.processStateMachine(e,n,i);a=a&&m,s=s||m||l(h.readyImagery),r=r&&l(h.loadingImagery)&&(h.loadingImagery.state===Ai.FAILED||h.loadingImagery.state===Ai.INVALID)}return e.upsampledFromParent=r,e.renderable=e.renderable&&(s||a),a};function I7(e,t,n,i){const o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride;let c=Cr.clone(s);c.hasGeodeticSurfaceNormals=t,c=Cr.clone(c);const u=c.stride,d=new Float32Array(a*u);t?s.addGeodeticSurfaceNormals(r,d,n):s.removeGeodeticSurfaceNormals(r,d),o.vertices=d,o.stride=u,o!==e.mesh?(Mi._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=Mi._createVertexArrayForMesh(i.context,o)):(Mi._freeVertexArray(e.vertexArray),e.vertexArray=Mi._createVertexArrayForMesh(i.context,o)),Mi._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}Mi.prototype.addGeodeticSurfaceNormals=function(e,t){I7(this,!0,e,t)};Mi.prototype.removeGeodeticSurfaceNormals=function(e){I7(this,!1,void 0,e)};Mi.prototype.updateExaggeration=function(e,t,n){const i=this,o=i.renderedMesh;if(o===void 0)return;const r=t.terrainExaggeration,s=t.terrainExaggerationRelativeHeight,a=r!==1,c=o.encoding,u=c.exaggeration!==r,d=c.exaggerationRelativeHeight!==s;if(u||d){if(u)if(a&&!c.hasGeodeticSurfaceNormals){const h=e.tilingScheme.ellipsoid;i.addGeodeticSurfaceNormals(h,t)}else!a&&c.hasGeodeticSurfaceNormals&&i.removeGeodeticSurfaceNormals(t);if(c.exaggeration=r,c.exaggerationRelativeHeight=s,n!==void 0){n._tileToUpdateHeights.push(e);const h=e.customData,m=h.length;for(let g=0;g<m;g++){const p=h[g];p.level=-1}}}};function vDe(e,t,n){let i=t.getTileDataAvailable(e.x,e.y,e.level);if(!l(i)&&l(e.parent)){const o=e.parent,r=o.data;l(r)&&l(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){const s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function DDe(e,t,n,i,o,r){const 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||Mi.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===mo.FAILED&&IDe(s,e,t,n,e.x,e.y,e.level),s.terrainState===mo.UNLOADED&&PDe(s,n,e.x,e.y,e.level),s.terrainState===mo.RECEIVED&&LDe(s,t,n,e.x,e.y,e.level),s.terrainState===mo.TRANSFORMED&&(BDe(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)NDe(t.context,s);else{const u=s._findAncestorTileWithTerrainData(e);l(u)&&l(u.data.waterMaskTexture)&&(s.waterMaskTexture=u.data.waterMaskTexture,++s.waterMaskTexture.referenceCount,s._computeWaterMaskTranslationAndScale(e,u,s.waterMaskTranslationAndScale))}}function IDe(e,t,n,i,o,r,s){const a=t.parent;if(!a){t.state=gl.FAILED;return}const c=a.data.terrainData,u=a.x,d=a.y,h=a.level;if(!l(c))return;const m=c.upsample(i.tilingScheme,u,d,h,o,r,s);l(m)&&(e.terrainState=mo.RECEIVING,Promise.resolve(m).then(function(g){e.terrainData=g,e.terrainState=mo.RECEIVED}).catch(function(){e.terrainState=mo.FAILED}))}function PDe(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===Do.CANCELLED){e.terrainData=void 0,e.terrainState=mo.UNLOADED,e.request=void 0;return}e.terrainState=mo.FAILED,e.request=void 0;const u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${c}"`;t._requestError=ao.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){const c=new dd({throttle:!1,throttleByServer:!0,type:Y_.TERRAIN});e.request=c;const u=t.requestTileGeometry(n,i,o,c);l(u)?(e.terrainState=mo.RECEIVING,Promise.resolve(u).then(function(d){r(d)}).catch(function(d){s(d)})):(e.terrainState=mo.UNLOADED,e.request=void 0)}a()}const ODe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function LDe(e,t,n,i,o,r){const s=n.tilingScheme,a=ODe;a.tilingScheme=s,a.x=i,a.y=o,a.level=r,a.exaggeration=t.terrainExaggeration,a.exaggerationRelativeHeight=t.terrainExaggerationRelativeHeight,a.throttle=!0;const u=e.terrainData.createMesh(a);l(u)&&(e.terrainState=mo.TRANSFORMING,Promise.resolve(u).then(function(d){e.mesh=d,e.terrainState=mo.TRANSFORMED}).catch(function(){e.terrainState=mo.FAILED}))}Mi._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=Tt.createVertexBuffer({context:e,typedArray:n,usage:nt.STATIC_DRAW}),o=t.encoding.getAttributes(i),r=t.indices.indexBuffers||{};let s=r[e.id];if(!l(s)||s.isDestroyed()){const a=t.indices;s=Tt.createIndexBuffer({context:e,typedArray:a,usage:nt.STATIC_DRAW,indexDatatype:at.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new ho({context:e,attributes:o,indexBuffer:s})};Mi._freeVertexArray=function(e){if(l(e)){const t=e.indexBuffer;e.isDestroyed()||e.destroy(),l(t)&&!t.isDestroyed()&&l(t.referenceCount)&&(--t.referenceCount,t.referenceCount===0&&t.destroy())}};function BDe(e,t,n,i,o,r,s){e.vertexArray=Mi._createVertexArrayForMesh(t,e.mesh),e.terrainState=mo.READY,e.fill=e.fill&&e.fill.destroy(s)}function RDe(e){let t=e.cache.tile_waterMaskData;if(!l(t)){const n=Wt.create({context:e,pixelFormat:rt.LUMINANCE,pixelDatatype:Qe.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;const i=new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:In.LINEAR,magnificationFilter:Kr.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function NDe(e,t){const n=t.terrainData.waterMask,i=RDe(e);let o;const r=n.length;if(r===1)if(n[0]!==0)o=i.allWaterTexture;else return;else{const s=Math.sqrt(r);o=Wt.create({context:e,pixelFormat:rt.LUMINANCE,pixelDatatype:Qe.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)}Mi.prototype._findAncestorTileWithTerrainData=function(e){let t=e.parent;for(;l(t)&&(!l(t.data)||!l(t.data.terrainData)||t.data.terrainData.wasCreatedByUpsampling());)t=t.parent;return t};Mi.prototype._computeWaterMaskTranslationAndScale=function(e,t,n){const 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};function w_(e,t,n,i,o){if(this.imageryLayer=e,this.x=t,this.y=n,this.level=i,this.request=void 0,i!==0){const r=t/2|0,s=n/2|0,a=i-1;this.parent=e.getImageryFromCache(r,s,a)}this.state=Ai.UNLOADED,this.imageUrl=void 0,this.image=void 0,this.texture=void 0,this.textureWebMercator=void 0,this.credits=void 0,this.referenceCount=0,!l(o)&&e.imageryProvider.ready&&(o=e.imageryProvider.tilingScheme.tileXYToRectangle(t,n,i)),this.rectangle=o}w_.createPlaceholder=function(e){const t=new w_(e,0,0,0);return t.addReference(),t.state=Ai.PLACEHOLDER,t};w_.prototype.addReference=function(){++this.referenceCount};w_.prototype.releaseReference=function(){return--this.referenceCount,this.referenceCount===0?(this.imageryLayer.removeImageryFromCache(this),l(this.parent)&&this.parent.releaseReference(),l(this.image)&&l(this.image.destroy)&&this.image.destroy(),l(this.texture)&&this.texture.destroy(),l(this.textureWebMercator)&&this.texture!==this.textureWebMercator&&this.textureWebMercator.destroy(),He(this),0):this.referenceCount};w_.prototype.processStateMachine=function(e,t,n){this.state===Ai.UNLOADED&&!n&&(this.state=Ai.TRANSITIONING,this.imageryLayer._requestImagery(this)),this.state===Ai.RECEIVED&&(this.state=Ai.TRANSITIONING,this.imageryLayer._createTexture(e.context,this));const i=this.state===Ai.READY&&t&&!this.texture;(this.state===Ai.TEXTURE_LOADED||i)&&(this.state=Ai.TRANSITIONING,this.imageryLayer._reprojectTexture(e,this,t))};const MDe={LEFT:-1,NONE:0,RIGHT:1},Z_=Object.freeze(MDe);function hD(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}hD.prototype.freeResources=function(){l(this.readyImagery)&&this.readyImagery.releaseReference(),l(this.loadingImagery)&&this.loadingImagery.releaseReference()};hD.prototype.processStateMachine=function(e,t,n){const i=this.loadingImagery,o=i.imageryLayer;if(i.processStateMachine(t,!this.useWebMercatorT,n),i.state===Ai.READY)return l(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(;l(r)&&(r.state!==Ai.READY||!this.useWebMercatorT&&!l(r.texture));)r.state!==Ai.FAILED&&r.state!==Ai.INVALID&&(s=s||r),r=r.parent;return this.readyImagery!==r&&(l(this.readyImagery)&&this.readyImagery.releaseReference(),this.readyImagery=r,l(r)&&(r.addReference(),this.textureTranslationAndScale=o._calculateTextureTranslationAndScale(e,this))),i.state===Ai.FAILED||i.state===Ai.INVALID?l(s)?(s.processStateMachine(t,!this.useWebMercatorT,n),!1):!0:!1};function Vn(e,t){this._imageryProvider=e,t=A(t,A.EMPTY_OBJECT),this.alpha=A(t.alpha,A(e.defaultAlpha,1)),this.nightAlpha=A(t.nightAlpha,A(e.defaultNightAlpha,1)),this.dayAlpha=A(t.dayAlpha,A(e.defaultDayAlpha,1)),this.brightness=A(t.brightness,A(e.defaultBrightness,Vn.DEFAULT_BRIGHTNESS)),this.contrast=A(t.contrast,A(e.defaultContrast,Vn.DEFAULT_CONTRAST)),this.hue=A(t.hue,A(e.defaultHue,Vn.DEFAULT_HUE)),this.saturation=A(t.saturation,A(e.defaultSaturation,Vn.DEFAULT_SATURATION)),this.gamma=A(t.gamma,A(e.defaultGamma,Vn.DEFAULT_GAMMA)),this.splitDirection=A(t.splitDirection,A(e.defaultSplit,Vn.DEFAULT_SPLIT)),this.minificationFilter=A(t.minificationFilter,A(e.defaultMinificationFilter,Vn.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=A(t.magnificationFilter,A(e.defaultMagnificationFilter,Vn.DEFAULT_MAGNIFICATION_FILTER)),this.show=A(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=A(t.rectangle,ge.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new hD(w_.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=A(t.colorToAlphaThreshold,Vn.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(Vn.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}});Vn.DEFAULT_BRIGHTNESS=1;Vn.DEFAULT_CONTRAST=1;Vn.DEFAULT_HUE=0;Vn.DEFAULT_SATURATION=1;Vn.DEFAULT_GAMMA=1;Vn.DEFAULT_SPLIT=Z_.NONE;Vn.DEFAULT_MINIFICATION_FILTER=In.LINEAR;Vn.DEFAULT_MAGNIFICATION_FILTER=Kr.LINEAR;Vn.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;Vn.prototype.isBaseLayer=function(){return this._isBaseLayer};Vn.prototype.isDestroyed=function(){return!1};Vn.prototype.destroy=function(){return He(this)};const P7=new ge,Y4=new ge,k1=new ge,O7=new ge;Vn.prototype.getViewableRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return ge.intersection(e.rectangle,t)})};Vn.prototype._createTileImagerySkeletons=function(e,t,n){const i=e.data;if(l(this._minimumTerrainLevel)&&e.level<this._minimumTerrainLevel||l(this._maximumTerrainLevel)&&e.level>this._maximumTerrainLevel)return!1;const o=this._imageryProvider;if(l(n)||(n=i.imagery.length),!o.ready)return this._skeletonPlaceholder.loadingImagery.addReference(),i.imagery.splice(n,0,this._skeletonPlaceholder),!0;const r=o.tilingScheme.projection instanceof di&&e.rectangle.north<di.MaximumLatitude&&e.rectangle.south>-di.MaximumLatitude,s=ge.intersection(o.rectangle,this._rectangle,P7);let a=ge.intersection(e.rectangle,s,Y4);if(!l(a)){if(!this.isBaseLayer())return!1;const _=s,v=e.rectangle;a=Y4,v.south>=_.north?a.north=a.south=_.north:v.north<=_.south?a.north=a.south=_.south:(a.south=Math.max(v.south,_.south),a.north=Math.min(v.north,_.north)),v.west>=_.east?a.west=a.east=_.east:v.east<=_.west?a.west=a.east=_.west:(a.west=Math.max(v.west,_.west),a.east=Math.min(v.east,_.east))}let c=0;a.south>0?c=a.south:a.north<0&&(c=a.north);const d=1*t.getLevelMaximumGeometricError(e.level);let h=UDe(this,d,c);h=Math.max(0,h);const m=o.maximumLevel;if(h>m&&(h=m),l(o.minimumLevel)){const _=o.minimumLevel;h<_&&(h=_)}const g=o.tilingScheme,p=g.positionToTileXY(ge.northwest(a),h),y=g.positionToTileXY(ge.southeast(a),h);let b=e.rectangle.width/512,C=e.rectangle.height/512;const E=g.tileXYToRectangle(p.x,p.y,h);Math.abs(E.south-e.rectangle.north)<C&&p.y<y.y&&++p.y,Math.abs(E.east-e.rectangle.west)<b&&p.x<y.x&&++p.x;const w=g.tileXYToRectangle(y.x,y.y,h);Math.abs(w.north-e.rectangle.south)<C&&y.y>p.y&&--y.y,Math.abs(w.west-e.rectangle.east)<b&&y.x>p.x&&--y.x;const S=ge.clone(e.rectangle,O7);let P=g.tileXYToRectangle(p.x,p.y,h),L=ge.intersection(P,s,k1),z;r?(g.rectangleToNativeRectangle(S,S),g.rectangleToNativeRectangle(P,P),g.rectangleToNativeRectangle(L,L),g.rectangleToNativeRectangle(s,s),z=g.tileXYToNativeRectangle.bind(g),b=S.width/512,C=S.height/512):z=g.tileXYToRectangle.bind(g);let R,F=0,U=1,D;!this.isBaseLayer()&&Math.abs(L.west-S.west)>=b&&(F=Math.min(1,(L.west-S.west)/S.width)),!this.isBaseLayer()&&Math.abs(L.north-S.north)>=C&&(U=Math.max(0,(L.north-S.south)/S.height));const I=U;for(let _=p.x;_<=y.x;_++)if(R=F,P=z(_,p.y,h),L=ge.simpleIntersection(P,s,k1),!!l(L)){F=Math.min(1,(L.east-S.west)/S.width),_===y.x&&(this.isBaseLayer()||Math.abs(L.east-S.east)<b)&&(F=1),U=I;for(let v=p.y;v<=y.y;v++){if(D=U,P=z(_,v,h),L=ge.simpleIntersection(P,s,k1),!l(L))continue;U=Math.max(0,(L.south-S.south)/S.height),v===y.y&&(this.isBaseLayer()||Math.abs(L.south-S.south)<C)&&(U=0);const O=new oe(R,U,F,D),N=this.getImageryFromCache(_,v,h);i.imagery.splice(n,0,new hD(N,O,r)),++n}}return!0};Vn.prototype._calculateTextureTranslationAndScale=function(e,t){let n=t.readyImagery.rectangle,i=e.rectangle;if(t.useWebMercatorT){const c=t.readyImagery.imageryLayer.imageryProvider.tilingScheme;n=c.rectangleToNativeRectangle(n,P7),i=c.rectangleToNativeRectangle(i,O7)}const 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)};Vn.prototype._requestImagery=function(e){const t=this._imageryProvider,n=this;function i(s){if(!l(s))return o();e.image=s,e.state=Ai.RECEIVED,e.request=void 0,ao.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===Do.CANCELLED){e.state=Ai.UNLOADED,e.request=void 0;return}e.state=Ai.FAILED,e.request=void 0;const a=`Failed to obtain image tile X: ${e.x} Y: ${e.y} Level: ${e.level}.`;n._requestImageError=ao.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){const s=new dd({throttle:!1,throttleByServer:!0,type:Y_.IMAGERY});e.request=s,e.state=Ai.TRANSITIONING;const a=t.requestImage(e.x,e.y,e.level,s);if(!l(a)){e.state=Ai.UNLOADED,e.request=void 0;return}l(t.getTileCredits)&&(e.credits=t.getTileCredits(e.x,e.y,e.level)),a.then(function(c){i(c)}).catch(function(c){o(c)})}r()};Vn.prototype._createTextureWebGL=function(e,t){const n=new ii({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return l(i.internalFormat)?new Wt({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new Wt({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?rt.RGBA:rt.RGB,sampler:n})};Vn.prototype._createTexture=function(e,t){const n=this._imageryProvider,i=t.image;if(l(n.tileDiscardPolicy)){const r=n.tileDiscardPolicy;if(l(r)){if(!r.isReady()){t.state=Ai.RECEIVED;return}if(r.shouldDiscardImage(i)){t.state=Ai.INVALID;return}}}if(this.minificationFilter!==In.NEAREST&&this.minificationFilter!==In.LINEAR)throw new x("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof di?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=Ai.TEXTURE_LOADED};function X4(e,t,n){return`${e}:${t}:${n}`}Vn.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===In.LINEAR&&i===Kr.LINEAR&&!rt.isCompressedFormat(t.pixelFormat)&&M.isPowerOfTwo(t.width)&&M.isPowerOfTwo(t.height)){n=In.LINEAR_MIPMAP_LINEAR;const r=It.maximumTextureFilterAnisotropy,s=Math.min(r,A(this._maximumAnisotropy,r)),a=X4(n,i,s);let c=e.cache.imageryLayerMipmapSamplers;l(c)||(c={},e.cache.imageryLayerMipmapSamplers=c);let u=c[a];l(u)||(u=c[a]=new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(d0.NICEST),t.sampler=u}else{const r=X4(n,i,0);let s=e.cache.imageryLayerNonMipmapSamplers;l(s)||(s={},e.cache.imageryLayerNonMipmapSamplers=s);let a=s[r];l(a)||(a=s[r]=new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};Vn.prototype._reprojectTexture=function(e,t,n){const i=t.textureWebMercator||t.texture,o=t.rectangle,r=e.context;if(n=A(n,!0),n&&!(this._imageryProvider.tilingScheme.projection instanceof nr)&&o.width/i.width>1e-5){const s=this;t.addReference();const a=new yC({persists:!0,owner:this,preExecute:function(c){zDe(c,r,i,t.rectangle)},postExecute:function(c){t.texture=c,s._finalizeReprojectTexture(r,c),t.state=Ai.READY,t.releaseReference()},canceled:function(){t.state=Ai.TEXTURE_LOADED,t.releaseReference()}});this._reprojectComputeCommands.push(a)}else n&&(t.texture=i),this._finalizeReprojectTexture(r,i),t.state=Ai.READY};Vn.prototype.queueReprojectionCommands=function(e){const t=this._reprojectComputeCommands,n=t.length;for(let i=0;i<n;++i)e.commandList.push(t[i]);t.length=0};Vn.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){l(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};Vn.prototype.getImageryFromCache=function(e,t,n,i){const o=L7(e,t,n);let r=this._imageryCache[o];return l(r)||(r=new w_(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};Vn.prototype.removeImageryFromCache=function(e){const t=L7(e.x,e.y,e.level);delete this._imageryCache[t]};function L7(e,t,n){return JSON.stringify([e,t,n])}const nx={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new j,texture:void 0},FDe=gn.supportsTypedArrays()?new Float32Array(2*64):void 0;function zDe(e,t,n,i){let o=t.cache.imageryLayer_reproject;if(!l(o)){o=t.cache.imageryLayer_reproject={vertexArray:void 0,shaderProgram:void 0,sampler:void 0,destroy:function(){l(this.framebuffer)&&this.framebuffer.destroy(),l(this.vertexArray)&&this.vertexArray.destroy(),l(this.shaderProgram)&&this.shaderProgram.destroy()}};const b=new Float32Array(2*64*2);let C=0;for(let L=0;L<64;++L){const z=L/63;b[C++]=0,b[C++]=z,b[C++]=1,b[C++]=z}const E={position:0,webMercatorT:1},w=tr.getRegularGridIndices(2,64),S=Tt.createIndexBuffer({context:t,typedArray:w,usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT});o.vertexArray=new ho({context:t,attributes:[{index:E.position,vertexBuffer:Tt.createVertexBuffer({context:t,typedArray:b,usage:nt.STATIC_DRAW}),componentsPerAttribute:2},{index:E.webMercatorT,vertexBuffer:Tt.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:nt.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:S});const P=new We({sources:[IEe]});o.shaderProgram=Cn.fromCache({context:t,vertexShaderSource:P,fragmentShaderSource:DEe,attributeLocations:E}),o.sampler=new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:In.LINEAR,magnificationFilter:Kr.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;nx.textureDimensions.x=r,nx.textureDimensions.y=s,nx.texture=n;let a=Math.sin(i.south);const c=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const d=1/(.5*Math.log((1+a)/(1-a))-c),h=new Wt({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});M.isPowerOfTwo(r)&&M.isPowerOfTwo(s)&&h.generateMipmap(d0.NICEST);const m=i.south,g=i.north,p=FDe;let y=0;for(let b=0;b<64;++b){const C=b/63,E=M.lerp(m,g,C);a=Math.sin(E);const S=(.5*Math.log((1+a)/(1-a))-c)*d;p[y++]=S,p[y++]=S}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=o.shaderProgram,e.outputTexture=h,e.uniformMap=nx,e.vertexArray=o.vertexArray}function UDe(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof nr?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,d=Math.log(u)/Math.log(2);return Math.round(d)|0}function Fe(e){e=A(e,A.EMPTY_OBJECT),this.position=A(e.position,!1),this.normal=A(e.normal,!1),this.st=A(e.st,!1),this.bitangent=A(e.bitangent,!1),this.tangent=A(e.tangent,!1),this.color=A(e.color,!1)}Fe.POSITION_ONLY=Object.freeze(new Fe({position:!0}));Fe.POSITION_AND_NORMAL=Object.freeze(new Fe({position:!0,normal:!0}));Fe.POSITION_NORMAL_AND_ST=Object.freeze(new Fe({position:!0,normal:!0,st:!0}));Fe.POSITION_AND_ST=Object.freeze(new Fe({position:!0,st:!0}));Fe.POSITION_AND_COLOR=Object.freeze(new Fe({position:!0,color:!0}));Fe.ALL=Object.freeze(new Fe({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));Fe.DEFAULT=Fe.POSITION_NORMAL_AND_ST;Fe.packedLength=6;Fe.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(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};Fe.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new Fe),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};Fe.clone=function(e,t){if(l(e))return l(t)||(t=new Fe),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};const HDe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying 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;
|
||
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
}
|
||
`,VDe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying 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;
|
||
}
|
||
`,B7=`varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
}
|
||
`,kDe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying vec4 v_color;
|
||
|
||
void main()
|
||
{
|
||
vec4 p = czm_computePosition();
|
||
|
||
v_color = color;
|
||
|
||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||
}
|
||
`,GDe={FRONT:ae.FRONT,BACK:ae.BACK,FRONT_AND_BACK:ae.FRONT_AND_BACK},Ho=Object.freeze(GDe);function Tr(e){e=A(e,A.EMPTY_OBJECT),this.material=e.material,this.translucent=A(e.translucent,!0),this._vertexShaderSource=e.vertexShaderSource,this._fragmentShaderSource=e.fragmentShaderSource,this._renderState=e.renderState,this._closed=A(e.closed,!1)}Object.defineProperties(Tr.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}}});Tr.prototype.getFragmentShaderSource=function(){const e=[];return this.flat&&e.push("#define FLAT"),this.faceForward&&e.push("#define FACE_FORWARD"),l(this.material)&&e.push(this.material.shaderSource),e.push(this.fragmentShaderSource),e.join(`
|
||
`)};Tr.prototype.isTranslucent=function(){return l(this.material)&&this.material.isTranslucent()||!l(this.material)&&this.translucent};Tr.prototype.getRenderState=function(){const e=this.isTranslucent(),t=ht(this.renderState,!1);return e?(t.depthMask=!1,t.blending=Gi.ALPHA_BLEND):t.depthMask=!0,t};Tr.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=Gi.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:Ho.BACK}),l(n)&&(i=hn(n,i,!0)),i};function wn(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=A(e.closed,!1),i=A(e.flat,!1),o=i?kDe:VDe,r=i?B7:HDe,s=i?wn.FLAT_VERTEX_FORMAT:wn.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,o),this._fragmentShaderSource=A(e.fragmentShaderSource,r),this._renderState=Tr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=A(e.faceForward,!n)}Object.defineProperties(wn.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}}});wn.VERTEX_FORMAT=Fe.POSITION_AND_NORMAL;wn.FLAT_VERTEX_FORMAT=Fe.POSITION_ONLY;wn.prototype.getFragmentShaderSource=Tr.prototype.getFragmentShaderSource;wn.prototype.isTranslucent=Tr.prototype.isTranslucent;wn.prototype.getRenderState=Tr.prototype.getRenderState;function WDe(e,t){if(!l(e))throw new x("array is required.");if(!l(t)||t<1)throw new x("numberOfArrays must be greater than 0.");const n=[],i=e.length;let o=0;for(;o<i;){const r=Math.ceil((i-o)/t--);n.push(e.slice(o,o+r)),o+=r}return n}function Cd(e,t,n){if(!l(e))throw new x("context is required");if(!l(t))throw new x("attributes is required");if(!l(n))throw new x("numberOfInstances is required");if(this._attributes=t,this._numberOfInstances=n,t.length===0)return;const i=jDe(t),o=e.floatingPointTexture,r=i===Qe.FLOAT&&!o,s=qDe(t,r),a=$De(s,t,r),c=Math.floor(It.maximumTextureSize/a),u=Math.min(n,c),d=a*u,h=Math.ceil(n/u),m=1/d,g=m*.5,p=1/h,y=p*.5;this._textureDimensions=new j(d,h),this._textureStep=new oe(m,g,p,y),this._pixelDatatype=r?Qe.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;const b=4*d*h;this._batchValues=i===Qe.FLOAT&&!r?new Float32Array(b):new Uint8Array(b),this._batchValuesDirty=!1}Object.defineProperties(Cd.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function jDe(e){let t=!1;const n=e.length;for(let i=0;i<n;++i)if(e[i].componentDatatype!==ee.UNSIGNED_BYTE){t=!0;break}return t?Qe.FLOAT:Qe.UNSIGNED_BYTE}function R7(e,t){const n=e[t].componentsPerAttribute;return n===2?j:n===3?f:n===4?oe:Number}function qDe(e,t){const n=new Array(e.length);let i=0;const o=e.length;for(let r=0;r<o;++r){const a=e[r].componentDatatype;n[r]=i,a!==ee.UNSIGNED_BYTE&&t?i+=4:++i}return n}function $De(e,t,n){const i=e.length,o=e[i-1];return t[i-1].componentDatatype!==ee.UNSIGNED_BYTE&&n?o+4:o+1}const ob=new oe;function YDe(e,t,n){let i=oe.unpack(e,t,ob);const o=oe.unpackFloat(i);i=oe.unpack(e,t+4,ob);const r=oe.unpackFloat(i);i=oe.unpack(e,t+8,ob);const s=oe.unpackFloat(i);i=oe.unpack(e,t+12,ob);const a=oe.unpackFloat(i);return oe.fromElements(o,r,s,a,n)}function XDe(e,t,n){let i=oe.packFloat(e.x,ob);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)}const K4=new oe;Cd.prototype.getBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new x("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new x("attributeIndex is out of range");const i=this._attributes,o=this._offsets[t],s=4*this._stride*e+4*o;let a;this._packFloats&&i[t].componentDatatype!==Qe.UNSIGNED_BYTE?a=YDe(this._batchValues,s,K4):a=oe.unpack(this._batchValues,s,K4);const c=R7(i,t);return l(c.fromCartesian4)?c.fromCartesian4(a,n):l(c.clone)?c.clone(a,n):a.x};const KDe=[void 0,void 0,new j,new f,new oe],JDe=new oe;Cd.prototype.setBatchedAttribute=function(e,t,n){if(e<0||e>=this._numberOfInstances)throw new x("instanceIndex is out of range.");if(t<0||t>=this._attributes.length)throw new x("attributeIndex is out of range");if(!l(n))throw new x("value is required.");const i=this._attributes,o=KDe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=R7(this._attributes,t);if(l(s.equals)?s.equals(r,n):r===n)return;const c=JDe;c.x=l(n.x)?n.x:n,c.y=l(n.y)?n.y:0,c.z=l(n.z)?n.z:0,c.w=l(n.w)?n.w:0;const u=this._offsets[t],h=4*this._stride*e+4*u;this._packFloats&&i[t].componentDatatype!==Qe.UNSIGNED_BYTE?XDe(c,this._batchValues,h):oe.pack(c,this._batchValues,h),this._batchValuesDirty=!0};function QDe(e,t){const n=e._textureDimensions;e._texture=new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:ii.NEAREST,flipY:!1})}function ZDe(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}Cd.prototype.update=function(e){l(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,l(this._texture)||QDe(this,e.context),ZDe(this))};Cd.prototype.getUniformMapCallback=function(){const e=this;return function(t){return e._attributes.length===0?t:hn(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function eIe(e){const 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 tIe(e){return e===1?"float":`vec${e}`}function nIe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function iIe(e,t){const i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=tIe(o),a=nIe(o),c=e._offsets[t];let u=`${s} ${r}(float batchId)
|
||
{
|
||
vec2 st = computeSt(batchId);
|
||
st.x += batchTextureStep.x * float(${c});
|
||
`;return e._packFloats&&i.componentDatatype!==Qe.UNSIGNED_BYTE?u+=`vec4 textureValue;
|
||
textureValue.x = czm_unpackFloat(texture2D(batchTexture, st));
|
||
textureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0)));
|
||
textureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0)));
|
||
textureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0)));
|
||
`:u+=` vec4 textureValue = texture2D(batchTexture, st);
|
||
`,u+=` ${s} value = textureValue${a};
|
||
`,e._pixelDatatype===Qe.UNSIGNED_BYTE&&i.componentDatatype===ee.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
|
||
`:e._pixelDatatype===Qe.FLOAT&&i.componentDatatype===ee.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
|
||
`),u+=` return value;
|
||
}
|
||
`,u}Cd.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
|
||
`;t+=`${eIe(this)}
|
||
`;const n=e.length;for(let i=0;i<n;++i)t+=iIe(this,i);return function(i){const o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
|
||
${t}
|
||
${s}`}};Cd.prototype.isDestroyed=function(){return!1};Cd.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),He(this)};function jo(e,t,n){e=A(e,0),t=A(t,0),n=A(n,0),this.value=new Float32Array([e,t,n])}Object.defineProperties(jo.prototype,{componentDatatype:{get:function(){return ee.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});jo.fromCartesian3=function(e){return T.defined("offset",e),new jo(e.x,e.y,e.z)};jo.toValue=function(e,t){return T.defined("offset",e),l(t)||(t=new Float32Array([e.x,e.y,e.z])),t[0]=e.x,t[1]=e.y,t[2]=e.z,t};function oIe(e,t,n){let i=!n;const o=e.length;let r;if(!i&&o>1){const s=e[0].modelMatrix;for(r=1;r<o;++r)if(!B.equals(s,e[r].modelMatrix)){i=!0;break}}if(i)for(r=0;r<o;++r)l(e[r].geometry)&&Yi.transformToWorldCoordinates(e[r]);else B.multiplyTransformation(t,e[0].modelMatrix,t)}function G1(e,t){const n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:1,values:new Float32Array(o)});const r=n.batchId.values;for(let s=0;s<o;++s)r[s]=t}function rIe(e){const t=e.length;for(let n=0;n<t;++n){const i=e[n];l(i.geometry)?G1(i.geometry,n):l(i.westHemisphereGeometry)&&l(i.eastHemisphereGeometry)&&(G1(i.westHemisphereGeometry,n),G1(i.eastHemisphereGeometry,n))}}function sIe(e){const t=e.instances,n=e.projection,i=e.elementIndexUintSupported,o=e.scene3DOnly,r=e.vertexCacheOptimize,s=e.compressVertices,a=e.modelMatrix;let c,u,d,h=t.length;for(c=0;c<h;++c)if(l(t[c].geometry)){d=t[c].geometry.primitiveType;break}for(c=1;c<h;++c)if(l(t[c].geometry)&&t[c].geometry.primitiveType!==d)throw new x("All instance geometries must have the same primitiveType.");if(oIe(t,a,o),!o)for(c=0;c<h;++c)l(t[c].geometry)&&Yi.splitLongitude(t[c]);if(rIe(t),r)for(c=0;c<h;++c){const g=t[c];l(g.geometry)?(Yi.reorderForPostVertexCache(g.geometry),Yi.reorderForPreVertexCache(g.geometry)):l(g.westHemisphereGeometry)&&l(g.eastHemisphereGeometry)&&(Yi.reorderForPostVertexCache(g.westHemisphereGeometry),Yi.reorderForPreVertexCache(g.westHemisphereGeometry),Yi.reorderForPostVertexCache(g.eastHemisphereGeometry),Yi.reorderForPreVertexCache(g.eastHemisphereGeometry))}let m=Yi.combineInstances(t);for(h=m.length,c=0;c<h;++c){u=m[c];const g=u.attributes;if(o)for(const p in g)g.hasOwnProperty(p)&&g[p].componentDatatype===ee.DOUBLE&&Yi.encodeAttribute(u,p,`${p}3DHigh`,`${p}3DLow`);else for(const p in g)if(g.hasOwnProperty(p)&&g[p].componentDatatype===ee.DOUBLE){const y=`${p}3D`,b=`${p}2D`;Yi.projectTo2D(u,p,y,b,n),l(u.boundingSphere)&&p==="position"&&(u.boundingSphereCV=fe.fromVertices(u.attributes.position2D.values)),Yi.encodeAttribute(u,y,`${y}High`,`${y}Low`),Yi.encodeAttribute(u,b,`${b}High`,`${b}Low`)}s&&Yi.compressVertices(u)}if(!i){let g=[];for(h=m.length,c=0;c<h;++c)u=m[c],g=g.concat(Yi.fitToUnsignedShortIndices(u));m=g}return m}function W1(e,t,n,i){let o,r,s;const a=i.length-1;if(a>=0){const u=i[a];o=u.offset+u.count,s=u.index,r=n[s].indices.length}else o=0,s=0,r=n[s].indices.length;const c=e.length;for(let u=0;u<c;++u){const h=e[u][t];if(!l(h))continue;const m=h.indices.length;o+m>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:m}),o+=m}}function aIe(e,t){const n=[];return W1(e,"geometry",t,n),W1(e,"westHemisphereGeometry",t,n),W1(e,"eastHemisphereGeometry",t,n),n}const Of={};Of.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=sIe(e),t.length>0&&(n=Yi.createAttributeLocations(t[0]),e.createPickOffsets&&(r=aIe(i,t))),l(i[0].attributes)&&l(i[0].attributes.offset)&&(s=new Array(o),a=!0));const c=new Array(o),u=new Array(o);for(let d=0;d<o;++d){const h=i[d],m=h.geometry;l(m)&&(c[d]=m.boundingSphere,u[d]=m.boundingSphereCV,a&&(s[d]=h.geometry.offsetAttribute));const g=h.eastHemisphereGeometry,p=h.westHemisphereGeometry;l(g)&&l(p)&&(l(g.boundingSphere)&&l(p.boundingSphere)&&(c[d]=fe.union(g.boundingSphere,p.boundingSphere)),l(g.boundingSphereCV)&&l(p.boundingSphereCV)&&(u[d]=fe.union(g.boundingSphereCV,p.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:u}};function cIe(e,t){const n=e.attributes;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i];l(o)&&l(o.values)&&t.push(o.values.buffer)}l(e.indices)&&t.push(e.indices.buffer)}function lIe(e,t){const n=e.length;for(let i=0;i<n;++i)cIe(e[i],t)}function uIe(e){let t=1;const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(++t,!l(o))continue;const r=o.attributes;t+=7+2*fe.packedLength+(l(o.indices)?o.indices.length:0);for(const s in r)if(r.hasOwnProperty(s)&&l(r[s])){const a=r[s];t+=5+a.values.length}}return t}Of.packCreateGeometryResults=function(e,t){const n=new Float64Array(uIe(e)),i=[],o={},r=e.length;let s=0;n[s++]=r;for(let a=0;a<r;a++){const c=e[a],u=l(c);if(n[s++]=u?1:0,!u)continue;n[s++]=c.primitiveType,n[s++]=c.geometryType,n[s++]=A(c.offsetAttribute,-1);const d=l(c.boundingSphere)?1:0;n[s++]=d,d&&fe.pack(c.boundingSphere,n,s),s+=fe.packedLength;const h=l(c.boundingSphereCV)?1:0;n[s++]=h,h&&fe.pack(c.boundingSphereCV,n,s),s+=fe.packedLength;const m=c.attributes,g=[];for(const y in m)m.hasOwnProperty(y)&&l(m[y])&&(g.push(y),l(o[y])||(o[y]=i.length,i.push(y)));n[s++]=g.length;for(let y=0;y<g.length;y++){const b=g[y],C=m[b];n[s++]=o[b],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}const p=l(c.indices)?c.indices.length:0;n[s++]=p,p>0&&(n.set(c.indices,s),s+=p)}return t.push(n.buffer),{stringTable:i,packedData:n}};Of.unpackCreateGeometryResults=function(e){const t=e.stringTable,n=e.packedData;let i;const o=new Array(n[0]);let r=0,s=1;for(;s<n.length;){if(!(n[s++]===1)){o[r++]=void 0;continue}const c=n[s++],u=n[s++];let d=n[s++];d===-1&&(d=void 0);let h,m;n[s++]===1&&(h=fe.unpack(n,s)),s+=fe.packedLength,n[s++]===1&&(m=fe.unpack(n,s)),s+=fe.packedLength;let y,b,C;const E=new Ji,w=n[s++];for(i=0;i<w;i++){const P=t[n[s++]],L=n[s++];C=n[s++];const z=n[s++]!==0;y=n[s++],b=ee.createTypedArray(L,y);for(let R=0;R<y;R++)b[R]=n[s++];E[P]=new Ue({componentDatatype:L,componentsPerAttribute:C,normalize:z,values:b})}let S;if(y=n[s++],y>0){const P=b.length/C;for(S=at.createTypedArray(P,y),i=0;i<y;i++)S[i]=n[s++]}o[r++]=new Lt({primitiveType:c,geometryType:u,boundingSphere:h,boundingSphereCV:m,indices:S,attributes:E,offsetAttribute:d})}return o};function dIe(e,t){const n=e.length,i=new Float64Array(1+n*19);let o=0;i[o++]=n;for(let r=0;r<n;r++){const s=e[r];if(B.pack(s.modelMatrix,i,o),o+=B.packedLength,l(s.attributes)&&l(s.attributes.offset)){const 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 fIe(e){const t=e,n=new Array(t[0]);let i=0,o=1;for(;o<t.length;){const r=B.unpack(t,o);let s;o+=B.packedLength,l(t[o])&&(s={offset:new jo(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}Of.packCombineGeometryParameters=function(e,t){const n=e.createGeometryResults,i=n.length;for(let o=0;o<i;o++)t.push(n[o].packedData.buffer);return{createGeometryResults:e.createGeometryResults,packedInstances:dIe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof nr,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};Of.unpackCombineGeometryParameters=function(e){const t=fIe(e.packedInstances),n=e.createGeometryResults,i=n.length;let o=0;for(let a=0;a<i;a++){const c=Of.unpackCreateGeometryResults(n[a]),u=c.length;for(let d=0;d<u;d++){const h=c[d],m=t[o];m.geometry=h,++o}}const r=me.clone(e.ellipsoid),s=e.isGeographic?new nr(r):new di(r);return{instances:t,ellipsoid:r,projection:s,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:B.clone(e.modelMatrix),createPickOffsets:e.createPickOffsets}};function J4(e){const t=e.length,n=1+(fe.packedLength+1)*t,i=new Float32Array(n);let o=0;i[o++]=t;for(let r=0;r<t;++r){const s=e[r];l(s)?(i[o++]=1,fe.pack(e[r],i,o)):i[o++]=0,o+=fe.packedLength}return i}function Q4(e){const t=new Array(e[0]);let n=0,i=1;for(;i<e.length;)e[i++]===1&&(t[n]=fe.unpack(e,i)),++n,i+=fe.packedLength;return t}Of.packCombineGeometryResults=function(e,t){l(e.geometries)&&lIe(e.geometries,t);const n=J4(e.boundingSpheres),i=J4(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}};Of.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:Q4(e.boundingSpheres),boundingSpheresCV:Q4(e.boundingSpheresCV)}};const DB=Of,hIe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},Dr=Object.freeze(hIe),ac={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};ac.NUMBER_OF_SHADOW_MODES=4;ac.castShadows=function(e){return e===ac.ENABLED||e===ac.CAST_ONLY};ac.receiveShadows=function(e){return e===ac.ENABLED||e===ac.RECEIVE_ONLY};ac.fromCastReceive=function(e,t){return e&&t?ac.ENABLED:e?ac.CAST_ONLY:t?ac.RECEIVE_ONLY:ac.DISABLED};const Po=Object.freeze(ac);function Jt(e){if(e=A(e,A.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this.appearance=e.appearance,this._appearance=void 0,this._material=void 0,this.depthFailAppearance=e.depthFailAppearance,this._depthFailAppearance=void 0,this._depthFailMaterial=void 0,this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=new B,this.show=A(e.show,!0),this._vertexCacheOptimize=A(e.vertexCacheOptimize,!1),this._interleave=A(e.interleave,!1),this._releaseGeometryInstances=A(e.releaseGeometryInstances,!0),this._allowPicking=A(e.allowPicking,!0),this._asynchronous=A(e.asynchronous,!0),this._compressVertices=A(e.compressVertices,!0),this.cull=A(e.cull,!0),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.rtcCenter=e.rtcCenter,l(this.rtcCenter)&&(!l(this.geometryInstances)||Array.isArray(this.geometryInstances)&&this.geometryInstances.length!==1))throw new x("Relative-to-center rendering only supports one geometry instance.");this.shadows=A(e.shadows,Po.DISABLED),this._translucent=void 0,this._state=Dr.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;const 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===Dr.COMPLETE||t._state===Dr.FAILED,!l(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(Jt.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 pIe(e){const t=e.length,n=[],i=e[0].attributes;let o;for(o in i)if(i.hasOwnProperty(o)&&l(i[o])){const r=i[o];let s=!0;for(let a=1;a<t;++a){const c=e[a].attributes[o];if(!l(c)||r.componentDatatype!==c.componentDatatype||r.componentsPerAttribute!==c.componentsPerAttribute||r.normalize!==c.normalize){s=!1;break}}s&&n.push(o)}return n}const mIe=new j,_Ie=new f,N7=new oe;function M7(e){const t=e.length;if(t===1)return e[0];if(t===2)return j.unpack(e,0,mIe);if(t===3)return f.unpack(e,0,_Ie);if(t===4)return oe.unpack(e,0,N7)}function gIe(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;const r=pIe(i),s=r.length,a=[],c={},u={};let d,m=i[0].attributes,g,p,y;for(g=0;g<s;++g)p=r[g],y=m[p],c[p]=g,a.push({functionName:`czm_batchTable_${p}`,componentDatatype:y.componentDatatype,componentsPerAttribute:y.componentsPerAttribute,normalize:y.normalize});r.indexOf("distanceDisplayCondition")!==-1&&(a.push({functionName:"czm_batchTable_boundingSphereCenter3DHigh",componentDatatype:ee.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter3DLow",componentDatatype:ee.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DHigh",componentDatatype:ee.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereCenter2DLow",componentDatatype:ee.FLOAT,componentsPerAttribute:3},{functionName:"czm_batchTable_boundingSphereRadius",componentDatatype:ee.FLOAT,componentsPerAttribute:1}),u.center3DHigh=a.length-5,u.center3DLow=a.length-4,u.center2DHigh=a.length-3,u.center2DLow=a.length-2,u.radius=a.length-1),r.indexOf("offset")!==-1&&(a.push({functionName:"czm_batchTable_offset2D",componentDatatype:ee.FLOAT,componentsPerAttribute:3}),d=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const b=a.length,C=new Cd(t,a,o);for(g=0;g<o;++g){const E=i[g];m=E.attributes;for(let z=0;z<s;++z){p=r[z],y=m[p];const R=M7(y.value),F=c[p];C.setBatchedAttribute(g,F,R)}const w={primitive:A(E.pickPrimitive,e)};l(E.id)&&(w.id=E.id);const S=t.createPickId(w);e._pickIds.push(S);const P=S.color,L=N7;L.x=H.floatToByte(P.red),L.y=H.floatToByte(P.green),L.z=H.floatToByte(P.blue),L.w=H.floatToByte(P.alpha),C.setBatchedAttribute(g,b-1,L)}e._batchTable=C,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=u,e._batchTableOffsetAttribute2DIndex=d}function yIe(e){let t;return Array.isArray(e.values)?t=e.values.slice(0):t=new e.values.constructor(e.values),new Ue({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function AIe(e){const t=e.attributes,n=new Ji;for(const o in t)t.hasOwnProperty(o)&&l(t[o])&&(n[o]=yIe(t[o]));let i;if(l(e.indices)){const o=e.indices;Array.isArray(o)?i=o.slice(0):i=new o.constructor(o)}return new Lt({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:fe.clone(e.boundingSphere)})}function bIe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:B.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const CIe=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;Jt._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=CIe.exec(t))!==null;){const a=i[1],c=`vec4 czm_compute${a[0].toUpperCase()}${a.substr(1)}()`;c!=="vec4 czm_computePosition()"&&(o+=`${c};
|
||
`),l(e.rtcCenter)?(t=t.replace(/attribute\s+vec(?:3|4)\s+position3DHigh;/g,""),t=t.replace(/attribute\s+vec(?:3|4)\s+position3DLow;/g,""),o+=`uniform mat4 u_modifiedModelView;
|
||
`,r+=`attribute 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+=`attribute vec3 ${a}2DHigh;
|
||
attribute 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(`
|
||
`)};Jt._appendShowToShader=function(e,t){return l(e._batchTableAttributeIndices.show)?`${We.replaceMain(t,"czm_non_show_main")}
|
||
void main()
|
||
{
|
||
czm_non_show_main();
|
||
gl_Position *= czm_batchTable_show(batchId);
|
||
}`:t};Jt._updateColorAttribute=function(e,t,n){if(!l(e._batchTableAttributeIndices.color)&&!l(e._batchTableAttributeIndices.depthFailColor)||t.search(/attribute\s+vec4\s+color;/g)===-1)return t;if(n&&!l(e._batchTableAttributeIndices.depthFailColor))throw new x("A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute.");let i=t;return i=i.replace(/attribute\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 Z4(e){return`${We.replaceMain(e,"czm_non_pick_main")}
|
||
varying vec4 v_pickColor;
|
||
void main()
|
||
{
|
||
czm_non_pick_main();
|
||
v_pickColor = czm_batchTable_pickColor(batchId);
|
||
}`}function eH(e){return`varying vec4 v_pickColor;
|
||
${e}`}Jt._updatePickColorAttribute=function(e){let t=e.replace(/attribute\s+vec4\s+pickColor;/g,"");return t=t.replace(/(\b)pickColor(\b)/g,"$1czm_batchTable_pickColor(batchId)$2"),t};Jt._appendOffsetToShader=function(e,t){if(!l(e._batchTableAttributeIndices.offset))return t;let n=`attribute float batchId;
|
||
`;n+="attribute float applyOffset;";let i=t.replace(/attribute\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};Jt._appendDistanceDisplayConditionToShader=function(e,t,n){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition))return t;const i=We.replaceMain(t,"czm_non_distanceDisplayCondition_main");let 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 tH(e,t){if(!e.compressVertices)return t;const n=t.search(/attribute\s+vec3\s+normal;/g)!==-1,i=t.search(/attribute\s+vec2\s+st;/g)!==-1;if(!n&&!i)return t;const o=t.search(/attribute\s+vec3\s+tangent;/g)!==-1,r=t.search(/attribute\s+vec3\s+bitangent;/g)!==-1;let s=i&&n?2:1;s+=o||r?1:0;const a=s>1?`vec${s}`:"float",c="compressedAttributes",u=`attribute ${a} ${c};`;let d="",h="";if(i){d+=`vec2 st;
|
||
`;const p=s>1?`${c}.x`:c;h+=` st = czm_decompressTextureCoordinates(${p});
|
||
`}n&&o&&r?(d+=`vec3 normal;
|
||
vec3 tangent;
|
||
vec3 bitangent;
|
||
`,h+=` czm_octDecode(${c}.${i?"yz":"xy"}, normal, tangent, bitangent);
|
||
`):(n&&(d+=`vec3 normal;
|
||
`,h+=` normal = czm_octDecode(${c}${s>1?`.${i?"y":"x"}`:""});
|
||
`),o&&(d+=`vec3 tangent;
|
||
`,h+=` tangent = czm_octDecode(${c}.${i&&n?"z":"y"});
|
||
`),r&&(d+=`vec3 bitangent;
|
||
`,h+=` bitangent = czm_octDecode(${c}.${i&&n?"z":"y"});
|
||
`));let m=t;m=m.replace(/attribute\s+vec3\s+normal;/g,""),m=m.replace(/attribute\s+vec2\s+st;/g,""),m=m.replace(/attribute\s+vec3\s+tangent;/g,""),m=m.replace(/attribute\s+vec3\s+bitangent;/g,""),m=We.replaceMain(m,"czm_non_compressed_main");const g=`void main()
|
||
{
|
||
${h} czm_non_compressed_main();
|
||
}`;return[u,d,m,g].join(`
|
||
`)}function TIe(e){let t=We.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
||
czm_non_depth_clamp_main();
|
||
gl_Position = czm_depthClamp(gl_Position);}
|
||
`,t}function EIe(e){let t=We.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
|
||
czm_non_depth_clamp_main();
|
||
#if defined(GL_EXT_frag_depth)
|
||
#if defined(LOG_DEPTH)
|
||
czm_writeLogDepth();
|
||
#else
|
||
czm_writeDepthClamp();
|
||
#endif
|
||
#endif
|
||
}
|
||
`,t=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
${t}`,t}function nH(e,t){const n=e.vertexAttributes;for(const i in n)if(n.hasOwnProperty(i)&&!l(t[i]))throw new x(`Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${i}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`)}function xIe(e,t){return function(){return e[t]}}const j1=Math.max(gn.hardwareConcurrency-1,1);let ix;const wIe=new Vi("combineGeometry");function SIe(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===Dr.READY){n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const a=e._numberOfInstances=n.length,c=[];let u=[];for(o=0;o<a;++o){if(i=n[o].geometry,s.push(n[o].id),!l(i._workerName))throw new x("_workerName must be defined for asynchronous geometry.");u.push({moduleName:i._workerName,geometry:i})}if(!l(ix))for(ix=new Array(j1),o=0;o<j1;o++)ix[o]=new Vi("createGeometry");let d;for(u=WDe(u,j1),o=0;o<u.length;o++){let h=0;const m=u[o],g=m.length;for(r=0;r<g;++r)d=m[r],i=d.geometry,l(i.constructor.pack)&&(d.offset=h,h+=A(i.constructor.packedLength,i.packedLength));let p;if(h>0){const y=new Float64Array(h);for(p=[y.buffer],r=0;r<g;++r)d=m[r],i=d.geometry,l(i.constructor.pack)&&(i.constructor.pack(i,y,d.offset),d.geometry=y)}c.push(ix[o].scheduleTask({subTasks:u[o]},p))}e._state=Dr.CREATING,Promise.all(c).then(function(h){e._createGeometryResults=h,e._state=Dr.CREATED}).catch(function(h){Mb(e,t,Dr.FAILED,h)})}else if(e._state===Dr.CREATED){const a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const c=t.scene3DOnly,u=t.mapProjection,d=wIe.scheduleTask(DB.packCombineGeometryParameters({createGeometryResults:e._createGeometryResults,instances:n,ellipsoid:u.ellipsoid,projection:u,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=Dr.COMBINING,Promise.resolve(d).then(function(h){const m=DB.unpackCombineGeometryResults(h);e._geometries=m.geometries,e._attributeLocations=m.attributeLocations,e.modelMatrix=B.clone(m.modelMatrix,e.modelMatrix),e._pickOffsets=m.pickOffsets,e._offsetInstanceExtend=m.offsetInstanceExtend,e._instanceBoundingSpheres=m.boundingSpheres,e._instanceBoundingSpheresCV=m.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Dr.COMBINED):Mb(e,t,Dr.FAILED,void 0)}).catch(function(h){Mb(e,t,Dr.FAILED,h)})}}function vIe(e,t){const n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances],i=e._numberOfInstances=n.length,o=new Array(i),r=e._instanceIds;let s,a,c=0;for(a=0;a<i;a++){s=n[a];const m=s.geometry;let g;l(m.attributes)&&l(m.primitiveType)?g=AIe(m):g=m.constructor.createGeometry(m),o[c++]=bIe(s,g),r.push(s.id)}o.length=c;const u=t.scene3DOnly,d=t.mapProjection,h=DB.combineGeometry({instances:o,ellipsoid:d.ellipsoid,projection:d,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=h.geometries,e._attributeLocations=h.attributeLocations,e.modelMatrix=B.clone(h.modelMatrix,e.modelMatrix),e._pickOffsets=h.pickOffsets,e._offsetInstanceExtend=h.offsetInstanceExtend,e._instanceBoundingSpheres=h.boundingSpheres,e._instanceBoundingSpheresCV=h.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=Dr.COMBINED):Mb(e,t,Dr.FAILED,void 0)}function DIe(e,t){const n=e._batchTableAttributeIndices.offset;if(!e._recomputeBoundingSpheres||!l(n)){e._recomputeBoundingSpheres=!1;return}let i;const o=e._offsetInstanceExtend,r=e._instanceBoundingSpheres,s=r.length;let a=e._tempBoundingSpheres;if(!l(a)){for(a=new Array(s),i=0;i<s;i++)a[i]=new fe;e._tempBoundingSpheres=a}for(i=0;i<s;++i){let y=a[i];const b=e._batchTable.getBatchedAttribute(i,n,new f);y=r[i].clone(y),H7(y,b,o[i])}const c=[],u=[],d=[];for(i=0;i<s;++i){const y=a[i];y.center.x-y.radius>0||fe.intersectPlane(y,Pt.ORIGIN_ZX_PLANE)!==xn.INTERSECTING?c.push(y):(u.push(y),d.push(y))}let h=c[0],m=d[0],g=u[0];for(i=1;i<c.length;i++)h=fe.union(h,c[i]);for(i=1;i<d.length;i++)m=fe.union(m,d[i]);for(i=1;i<u.length;i++)g=fe.union(g,u[i]);const p=[];for(l(h)&&p.push(h),l(m)&&p.push(m),l(g)&&p.push(g),i=0;i<p.length;i++){const y=p[i].clone(e._boundingSpheres[i]);e._boundingSpheres[i]=y,e._boundingSphereCV[i]=fe.projectTo2D(y,t.mapProjection,e._boundingSphereCV[i])}Jt._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const iH=new Rn,F7=new Ce,z7=new f,U7=new fe;function IIe(e,t){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition)||e._batchTableBoundingSpheresUpdated)return;const i=e._batchTableBoundingSphereAttributeIndices,o=i.center3DHigh,r=i.center3DLow,s=i.center2DHigh,a=i.center2DLow,c=i.radius,u=t.mapProjection,d=u.ellipsoid,h=e._batchTable,m=e._instanceBoundingSpheres,g=m.length;for(let p=0;p<g;++p){let y=m[p];if(!l(y))continue;const b=e.modelMatrix;l(b)&&(y=fe.transform(y,b,U7));const C=y.center,E=y.radius;let w=Rn.fromCartesian(C,iH);if(h.setBatchedAttribute(p,o,w.high),h.setBatchedAttribute(p,r,w.low),!t.scene3DOnly){const S=d.cartesianToCartographic(C,F7),P=u.project(S,z7);w=Rn.fromCartesian(P,iH),h.setBatchedAttribute(p,s,w.high),h.setBatchedAttribute(p,a,w.low)}h.setBatchedAttribute(p,c,E)}e._batchTableBoundingSpheresUpdated=!0}const q1=new f,PIe=new f;function oH(e,t){if(!l(e._batchTableAttributeIndices.offset)||e._batchTableOffsetsUpdated||t.scene3DOnly)return;const i=e._batchTableOffsetAttribute2DIndex,o=t.mapProjection,r=o.ellipsoid,s=e._batchTable,a=e._instanceBoundingSpheres,c=a.length;for(let u=0;u<c;++u){let d=a[u];if(!l(d))continue;const h=s.getBatchedAttribute(u,e._batchTableAttributeIndices.offset);if(f.equals(h,f.ZERO)){s.setBatchedAttribute(u,i,f.ZERO);continue}const m=e.modelMatrix;l(m)&&(d=fe.transform(d,m,U7));let g=d.center;g=r.scaleToGeodeticSurface(g,PIe);let p=r.cartesianToCartographic(g,F7);const y=o.project(p,z7),b=f.add(h,g,q1);p=r.cartesianToCartographic(b,p);const C=o.project(p,q1),E=f.subtract(C,y,q1),w=E.x;E.x=E.z,E.z=E.y,E.y=w,s.setBatchedAttribute(u,i,E)}e._batchTableOffsetsUpdated=!0}function OIe(e,t){const n=e._attributeLocations,i=e._geometries,o=t.scene3DOnly,r=t.context,s=[],a=i.length;for(let c=0;c<a;++c){const u=i[c];if(s.push(ho.fromGeometry({context:r,geometry:u,attributeLocations:n,bufferUsage:nt.STATIC_DRAW,interleave:e._interleave})),l(e._createBoundingVolumeFunction))e._createBoundingVolumeFunction(t,u);else if(e._boundingSpheres.push(fe.clone(u.boundingSphere)),e._boundingSphereWC.push(new fe),!o){const d=u.boundingSphereCV.center,h=d.x,m=d.y,g=d.z;d.x=g,d.y=h,d.z=m,e._boundingSphereCV.push(fe.clone(u.boundingSphereCV)),e._boundingSphere2D.push(new fe),e._boundingSphereMorph.push(new fe)}}e._va=s,e._primitiveType=i[0].primitiveType,e.releaseGeometryInstances&&(e.geometryInstances=void 0),e._geometries=void 0,Mb(e,t,Dr.COMPLETE,void 0)}function LIe(e,t,n,i){let o=n.getRenderState(),r;i?(r=ht(o,!1),r.cull={enabled:!0,face:Ho.BACK},e._frontFaceRS=et.fromCache(r),r.cull.face=Ho.FRONT,e._backFaceRS=et.fromCache(r)):(e._frontFaceRS=et.fromCache(o),e._backFaceRS=e._frontFaceRS),r=ht(o,!1),l(e._depthFailAppearance)&&(r.depthTest.enabled=!1),l(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=ht(o,!1),r.depthTest.func=x_.GREATER,i?(r.cull={enabled:!0,face:Ho.BACK},e._frontFaceDepthFailRS=et.fromCache(r),r.cull.face=Ho.FRONT,e._backFaceDepthFailRS=et.fromCache(r)):(e._frontFaceDepthFailRS=et.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function BIe(e,t,n){const i=t.context,o=e._attributeLocations;let r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=Jt._appendOffsetToShader(e,r),r=Jt._appendShowToShader(e,r),r=Jt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=Z4(r),r=Jt._updateColorAttribute(e,r,!1),r=tH(e,r),r=Jt._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=eH(s),e._sp=Cn.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),nH(e._sp,o),l(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=Jt._appendShowToShader(e,r),r=Jt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=Z4(r),r=Jt._updateColorAttribute(e,r,!0),r=tH(e,r),r=Jt._modifyShaderPosition(e,r,t.scene3DOnly),r=TIe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=eH(s),s=EIe(s),e._spDepthFail=Cn.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),nH(e._spDepthFail,o))}const _A=new B,rH=new f;function sH(e,t,n,i){const o=l(n)?n._uniforms:void 0,r={},s=t.uniforms;if(l(s)){for(const c in s)if(s.hasOwnProperty(c)){if(l(o)&&l(o[c]))throw new x(`Appearance and material have a uniform with the same name: ${c}`);r[c]=xIe(s,c)}}let a=hn(r,o);return a=e._batchTable.getUniformMapCallback()(a),l(e.rtcCenter)&&(a.u_modifiedModelView=function(){const c=i.context.uniformState.view;return B.multiply(c,e._modelMatrix,_A),B.multiplyByPoint(_A,e.rtcCenter,rH),B.setTranslation(_A,rH,_A),_A}),a}function RIe(e,t,n,i,o,r,s,a){const c=sH(e,t,n,a);let u;l(e._depthFailAppearance)&&(u=sH(e,e._depthFailAppearance,e._depthFailAppearance.material,a));const d=i?Ne.TRANSLUCENT:Ne.OPAQUE;let h=o?2:1;h*=l(e._depthFailAppearance)?2:1,r.length=e._va.length*h;const m=r.length;let g=0;for(let p=0;p<m;++p){let y;o&&(y=r[p],l(y)||(y=r[p]=new mt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=d,++p),y=r[p],l(y)||(y=r[p]=new mt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=d,l(e._depthFailAppearance)&&(o&&(++p,y=r[p],l(y)||(y=r[p]=new mt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=d),++p,y=r[p],l(y)||(y=r[p]=new mt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=d),++g}}Jt._updateBoundingVolumes=function(e,t,n,i){let o,r,s;if(i||!B.equals(n,e._modelMatrix))for(B.clone(n,e._modelMatrix),r=e._boundingSpheres.length,o=0;o<r;++o)s=e._boundingSpheres[o],l(s)&&(e._boundingSphereWC[o]=fe.transform(s,n,e._boundingSphereWC[o]),t.scene3DOnly||(e._boundingSphere2D[o]=fe.clone(e._boundingSphereCV[o],e._boundingSphere2D[o]),e._boundingSphere2D[o].center.x=0,e._boundingSphereMorph[o]=fe.union(e._boundingSphereWC[o],e._boundingSphereCV[o])));const a=e.appearance.pixelSize;if(l(a))for(r=e._boundingSpheres.length,o=0;o<r;++o){s=e._boundingSpheres[o];const c=e._boundingSphereWC[o],d=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;c.radius=s.radius+d}};function NIe(e,t,n,i,o,r,s,a){if(t.mode!==le.SCENE3D&&!B.equals(o,B.IDENTITY))throw new x("Primitive.modelMatrix is only supported in 3D mode.");Jt._updateBoundingVolumes(e,t,o);let c;t.mode===le.SCENE3D?c=e._boundingSphereWC:t.mode===le.COLUMBUS_VIEW?c=e._boundingSphereCV:t.mode===le.SCENE2D&&l(e._boundingSphere2D)?c=e._boundingSphere2D:l(e._boundingSphereMorph)&&(c=e._boundingSphereMorph);const u=t.commandList,d=t.passes;if(d.render||d.pick){const h=e.allowPicking,m=Po.castShadows(e.shadows),g=Po.receiveShadows(e.shadows),p=n.length;let y=a?2:1;y*=l(e._depthFailAppearance)?2:1;for(let b=0;b<p;++b){const C=Math.floor(b/y),E=n[b];E.modelMatrix=o,E.boundingVolume=c[C],E.cull=r,E.debugShowBoundingVolume=s,E.castShadows=m,E.receiveShadows=g,h?E.pickId="v_pickColor":E.pickId=void 0,u.push(E)}}}Jt.prototype.update=function(e){if(!l(this.geometryInstances)&&this._va.length===0||l(this.geometryInstances)&&Array.isArray(this.geometryInstances)&&this.geometryInstances.length===0||!l(this.appearance)||e.mode!==le.SCENE3D&&e.scene3DOnly||!e.passes.render&&!e.passes.pick)return;if(l(this._error))throw this._error;if(l(this.rtcCenter)&&!e.scene3DOnly)throw new x("RTC rendering is only available for 3D only scenes.");if(this._state===Dr.FAILED)return;const t=e.context;if(l(this._batchTable)||gIe(this,t),this._batchTable.attributes.length>0){if(It.maximumVertexTextureImageUnits===0)throw new Ie("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!==Dr.COMPLETE&&this._state!==Dr.COMBINED&&(this.asynchronous?SIe(this,e):vIe(this,e)),this._state===Dr.COMBINED&&(IIe(this,e),oH(this,e),OIe(this,e)),!this.show||this._state!==Dr.COMPLETE)return;this._batchTableOffsetsUpdated||oH(this,e),this._recomputeBoundingSpheres&&DIe(this,e);const n=this.appearance,i=n.material;let 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);const s=this.depthFailAppearance,a=l(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);const c=this._appearance.isTranslucent();this._translucent!==c&&(this._translucent=c,o=!0),l(this._material)&&this._material.update(t);const u=n.closed&&c;o&&A(this._createRenderStatesFunction,LIe)(this,t,n,u),r&&A(this._createShaderProgramFunction,BIe)(this,e,n),(o||r)&&A(this._createCommandsFunction,RIe)(this,n,i,c,u,this._colorCommands,this._pickCommands,e),A(this._updateAndQueueCommandsFunction,NIe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};const MIe=new fe,FIe=new fe;function H7(e,t,n){if(n===yn.TOP){const i=fe.clone(e,MIe),o=fe.clone(e,FIe);o.center=f.add(o.center,t,o.center),e=fe.union(i,o,e)}else n===yn.ALL&&(e.center=f.add(e.center,t,e.center));return e}function zIe(e,t,n){return function(){const i=e.getBatchedAttribute(t,n),o=e.attributes[n],r=o.componentsPerAttribute,s=ee.createTypedArray(o.componentDatatype,r);return l(i.constructor.pack)?i.constructor.pack(i,s,0):s[0]=i,s}}function UIe(e,t,n,i,o){return function(r){if(!l(r)||!l(r.length)||r.length<1||r.length>4)throw new x("value must be and array with length between 1 and 4.");const s=M7(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const HIe=new f;function VIe(e,t,n){t.boundingSphere={get:function(){let i=e._instanceBoundingSpheres[n];if(l(i)){i=i.clone();const o=e.modelMatrix,r=t.offset;l(r)&&H7(i,f.fromArray(r.get(),0,HIe),e._offsetInstanceExtend[n]),l(o)&&(i=fe.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]}}}Jt.prototype.getGeometryInstanceAttributes=function(e){if(!l(e))throw new x("id is required");if(!l(this._batchTable))throw new x("must call update before calling getGeometryInstanceAttributes");let t=-1;const n=this._lastPerInstanceAttributeIndex,i=this._instanceIds,o=i.length;for(let u=0;u<o;++u){const d=(n+u)%o;if(e===i[d]){t=d;break}}if(t===-1)return;let r=this._perInstanceAttributeCache[t];if(l(r))return r;const s=this._batchTable,a=this._batchTableAttributeIndices;r={};const c={};for(const u in a)if(a.hasOwnProperty(u)){const d=a[u];c[u]={get:zIe(s,t,d),set:UIe(s,t,d,this,u)}}return VIe(this,c,t),kIe(this,c,t),Object.defineProperties(r,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=r,r};Jt.prototype.isDestroyed=function(){return!1};Jt.prototype.destroy=function(){let e,t;this._sp=this._sp&&this._sp.destroy(),this._spDepthFail=this._spDepthFail&&this._spDepthFail.destroy();const n=this._va;for(e=n.length,t=0;t<e;++t)n[t].destroy();this._va=void 0;const 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,He(this)};function Mb(e,t,n,i){e._completeLoad(t,n,i)}function Td(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(Td.prototype,{length:{get:function(){return this._length}}});Td.prototype.enqueue=function(e){this._array.push(e),this._length++};Td.prototype.dequeue=function(){if(this._length===0)return;const e=this._array;let t=this._offset;const 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};Td.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};Td.prototype.contains=function(e){return this._array.indexOf(e)!==-1};Td.prototype.clear=function(){this._array.length=this._offset=this._length=0};Td.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const GIe={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},Qt=GIe,V7={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>=V7.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},ni=V7;function eg(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}eg.prototype.update=function(e,t,n){this.changedThisFrame&&(k7(e,t,this.tile,n),this.changedThisFrame=!1)};eg.prototype.destroy=function(e){this._destroyVertexArray(e),l(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};eg.prototype._destroyVertexArray=function(e){l(this.vertexArray)&&(l(e)?e.push(this.vertexArray):Mi._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const WIe=new Td;eg.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=WIe;a.clear();for(let u=0;u<t.length;++u){const d=t[u];l(d.data.vertexArray)&&a.enqueue(t[u])}let c=a.dequeue();for(;c!==void 0;){const u=c.findTileToWest(r),d=c.findTileToSouth(r),h=c.findTileToEast(r),m=c.findTileToNorth(r);wr(e,n,c,u,s,Qt.EAST,!1,a,i),wr(e,n,c,d,s,Qt.NORTH,!1,a,i),wr(e,n,c,h,s,Qt.WEST,!1,a,i),wr(e,n,c,m,s,Qt.SOUTH,!1,a,i);const g=u.findTileToNorth(r),p=u.findTileToSouth(r),y=h.findTileToNorth(r),b=h.findTileToSouth(r);wr(e,n,c,g,s,Qt.SOUTHEAST,!1,a,i),wr(e,n,c,y,s,Qt.SOUTHWEST,!1,a,i),wr(e,n,c,p,s,Qt.NORTHEAST,!1,a,i),wr(e,n,c,b,s,Qt.NORTHWEST,!1,a,i),c=a.dequeue()}};function wr(e,t,n,i,o,r,s,a,c){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||ni.wasKicked(u._lastSelectionResult)||ni.originalResult(u._lastSelectionResult)===ni.CULLED);){if(s)return;const d=u.parent;if(r>=Qt.NORTHWEST&&d!==void 0)switch(r){case Qt.NORTHWEST:u=u===d.northwestChild?d:void 0;break;case Qt.NORTHEAST:u=u===d.northeastChild?d:void 0;break;case Qt.SOUTHWEST:u=u===d.southwestChild?d:void 0;break;case Qt.SOUTHEAST:u=u===d.southeastChild?d:void 0;break}else u=d}if(u!==void 0){if(u._lastSelectionResult===ni.RENDERED){if(l(u.data.vertexArray))return;jIe(e,t,n,u,r,o,a,c);return}if(ni.originalResult(i._lastSelectionResult)!==ni.CULLED)switch(r){case Qt.WEST:wr(e,t,n,i.northwestChild,o,r,!0,a,c),wr(e,t,n,i.southwestChild,o,r,!0,a,c);break;case Qt.EAST:wr(e,t,n,i.southeastChild,o,r,!0,a,c),wr(e,t,n,i.northeastChild,o,r,!0,a,c);break;case Qt.SOUTH:wr(e,t,n,i.southwestChild,o,r,!0,a,c),wr(e,t,n,i.southeastChild,o,r,!0,a,c);break;case Qt.NORTH:wr(e,t,n,i.northeastChild,o,r,!0,a,c),wr(e,t,n,i.northwestChild,o,r,!0,a,c);break;case Qt.NORTHWEST:wr(e,t,n,i.northwestChild,o,r,!0,a,c);break;case Qt.NORTHEAST:wr(e,t,n,i.northeastChild,o,r,!0,a,c);break;case Qt.SOUTHWEST:wr(e,t,n,i.southwestChild,o,r,!0,a,c);break;case Qt.SOUTHEAST:wr(e,t,n,i.southeastChild,o,r,!0,a,c);break;default:throw new x("Invalid edge")}}}function jIe(e,t,n,i,o,r,s,a){const c=i.data;if(c.fill===void 0)c.fill=new eg(i);else if(c.fill.visitedFrame===r)return;c.fill.enqueuedFrame!==r&&(c.fill.enqueuedFrame=r,c.fill.changedThisFrame=!1,s.enqueue(i)),qIe(e,t,n,i,o,a)}function qIe(e,t,n,i,o,r){const s=i.data.fill;let a;const c=n.data.fill;l(c)?(c.visitedFrame=t.frameNumber,c.changedThisFrame&&(k7(e,t,n,r),c.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,d;switch(o){case Qt.WEST:u=s.westMeshes,d=s.westTiles;break;case Qt.SOUTH:u=s.southMeshes,d=s.southTiles;break;case Qt.EAST:u=s.eastMeshes,d=s.eastTiles;break;case Qt.NORTH:u=s.northMeshes,d=s.northTiles;break;case Qt.NORTHWEST:s.changedThisFrame=s.changedThisFrame||s.northwestMesh!==a,s.northwestMesh=a,s.northwestTile=n;return;case Qt.NORTHEAST:s.changedThisFrame=s.changedThisFrame||s.northeastMesh!==a,s.northeastMesh=a,s.northeastTile=n;return;case Qt.SOUTHWEST:s.changedThisFrame=s.changedThisFrame||s.southwestMesh!==a,s.southwestMesh=a,s.southwestTile=n;return;case Qt.SOUTHEAST:s.changedThisFrame=s.changedThisFrame||s.southeastMesh!==a,s.southeastMesh=a,s.southeastTile=n;return}if(n.level<=i.level){s.changedThisFrame=s.changedThisFrame||u[0]!==a||u.length!==1,u[0]=a,d[0]=n,u.length=1,d.length=1;return}let h,m,g,p;const y=n.rectangle;let b;const C=i.rectangle;switch(o){case Qt.WEST:for(b=(C.north-C.south)*M.EPSILON5,h=0;h<d.length&&(g=d[h],p=g.rectangle,!M.greaterThan(y.north,p.south,b));++h);for(m=h;m<d.length&&(g=d[m],p=g.rectangle,!M.greaterThanOrEquals(y.south,p.north,b));++m);break;case Qt.SOUTH:for(b=(C.east-C.west)*M.EPSILON5,h=0;h<d.length&&(g=d[h],p=g.rectangle,!M.lessThan(y.west,p.east,b));++h);for(m=h;m<d.length&&(g=d[m],p=g.rectangle,!M.lessThanOrEquals(y.east,p.west,b));++m);break;case Qt.EAST:for(b=(C.north-C.south)*M.EPSILON5,h=0;h<d.length&&(g=d[h],p=g.rectangle,!M.lessThan(y.south,p.north,b));++h);for(m=h;m<d.length&&(g=d[m],p=g.rectangle,!M.lessThanOrEquals(y.north,p.south,b));++m);break;case Qt.NORTH:for(b=(C.east-C.west)*M.EPSILON5,h=0;h<d.length&&(g=d[h],p=g.rectangle,!M.greaterThan(y.east,p.west,b));++h);for(m=h;m<d.length&&(g=d[m],p=g.rectangle,!M.greaterThanOrEquals(y.west,p.east,b));++m);break}m-h===1?(s.changedThisFrame=s.changedThisFrame||u[h]!==a,u[h]=a,d[h]=n):(s.changedThisFrame=!0,u.splice(h,m-h,a),d.splice(h,m-h,n))}const t_=new Ce,$Ie=new Ce,Fy=new f,WM=new f,IB=new j,PB=new j,oc=new j;function pD(){this.height=0,this.encodedNormal=new j}function ox(e,t,n,i,o,r,s,a,c){if(l(o))return o;let u;if(l(r)&&l(s))u=(r.height+s.height)*.5;else if(l(r))u=r.height;else if(l(s))u=s.height;else if(l(a))u=a.height;else{const h=e.tile.data.tileBoundingRegion;let m=0,g=0;l(h)&&(m=h.minimumHeight,g=h.maximumHeight),u=(m+g)*.5}return G7(e,t,n,i,u,c),c}const YIe={minimumHeight:0,maximumHeight:0},XIe=new f,aH=new pD,cH=new pD,lH=new pD,uH=new pD,KIe=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,JIe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function k7(e,t,n,i){Mi.initialize(n,e.terrainProvider,e._imageryLayers);const o=n.data,r=o.fill,s=n.rectangle,a=t.terrainExaggeration,c=t.terrainExaggerationRelativeHeight,u=a!==1,d=n.tilingScheme.ellipsoid;let h=sx(r,d,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,lH),m=sx(r,d,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,aH),g=sx(r,d,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,cH),p=sx(r,d,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,uH);h=ox(r,d,0,1,h,m,p,g,lH),m=ox(r,d,0,0,m,h,g,p,aH),g=ox(r,d,1,1,g,m,p,h,cH),p=ox(r,d,1,1,p,g,h,m,uH);const y=m.height,b=g.height,C=h.height,E=p.height;let w=Math.min(y,b,C,E),S=Math.max(y,b,C,E);const P=(w+S)*.5;let L,z;const R=e.getLevelMaximumGeometricError(n.level),F=d.maximumRadius-R;let U=Math.acos(F/d.maximumRadius)*4;if(U*=1.5,s.width>U&&S-w<=R){const _=new fu({width:9,height:9,buffer:KIe,structure:{heightOffset:S}}),v=JIe;v.tilingScheme=n.tilingScheme,v.x=n.x,v.y=n.y,v.level=n.level,v.exaggeration=a,v.exaggerationRelativeHeight=c,r.mesh=_._createMeshSync(v)}else{const _=u,v=ge.center(s,$Ie);v.height=P;const O=d.cartographicToCartesian(v,XIe),N=new Cr(O,void 0,void 0,void 0,void 0,!0,!0,_,a,c);let V=5,k;for(k=r.westMeshes,L=0,z=k.length;L<z;++L)V+=k[L].eastIndicesNorthToSouth.length;for(k=r.southMeshes,L=0,z=k.length;L<z;++L)V+=k[L].northIndicesWestToEast.length;for(k=r.eastMeshes,L=0,z=k.length;L<z;++L)V+=k[L].westIndicesSouthToNorth.length;for(k=r.northMeshes,L=0,z=k.length;L<z;++L)V+=k[L].southIndicesEastToWest.length;const G=YIe;G.minimumHeight=w,G.maximumHeight=S;const W=N.stride;let K=new Float32Array(V*W),q=0;const te=q;q=rx(d,s,N,K,q,0,1,h.height,h.encodedNormal,1,G),q=cx(r,d,N,K,q,r.westTiles,r.westMeshes,Qt.EAST,G);const Y=q;q=rx(d,s,N,K,q,0,0,m.height,m.encodedNormal,0,G),q=cx(r,d,N,K,q,r.southTiles,r.southMeshes,Qt.NORTH,G);const X=q;q=rx(d,s,N,K,q,1,0,g.height,g.encodedNormal,0,G),q=cx(r,d,N,K,q,r.eastTiles,r.eastMeshes,Qt.WEST,G);const $=q;q=rx(d,s,N,K,q,1,1,p.height,p.encodedNormal,1,G),q=cx(r,d,N,K,q,r.northTiles,r.northMeshes,Qt.SOUTH,G),w=G.minimumHeight,S=G.maximumHeight;const se=zt.fromRectangle(s,w,S,n.tilingScheme.ellipsoid),ue=di.geodeticLatitudeToMercatorAngle(s.south),re=1/(di.geodeticLatitudeToMercatorAngle(s.north)-ue),he=(di.geodeticLatitudeToMercatorAngle(v.latitude)-ue)*re,ce=d.geodeticSurfaceNormalCartographic(t_,WM),Q=mi.octEncode(ce,IB),ne=q;N.encode(K,q*W,se.center,j.fromElements(.5,.5,oc),P,Q,he,ce),++q;const de=q,_e=de<256?1:2,Se=(de-1)*3,ve=Se*_e,Le=(K.length-de*W)*Float32Array.BYTES_PER_ELEMENT;let Ee;if(Le>=ve){const Ve=de*W*Float32Array.BYTES_PER_ELEMENT;Ee=de<256?new Uint8Array(K.buffer,Ve,Se):new Uint16Array(K.buffer,Ve,Se)}else Ee=de<256?new Uint8Array(Se):new Uint16Array(Se);K=new Float32Array(K.buffer,0,de*W);let Be=0;for(L=0;L<de-2;++L)Ee[Be++]=ne,Ee[Be++]=L,Ee[Be++]=L+1;Ee[Be++]=ne,Ee[Be++]=L,Ee[Be++]=0;const Pe=[];for(L=Y;L>=te;--L)Pe.push(L);const Ae=[];for(L=X;L>=Y;--L)Ae.push(L);const xe=[];for(L=$;L>=X;--L)xe.push(L);const Oe=[];for(Oe.push(0),L=ne-1;L>=$;--L)Oe.push(L);r.mesh=new fD(N.center,K,Ee,Se,de,w,S,fe.fromOrientedBoundingBox(se),o1e(e,se.center,s,w,S),N.stride,se,N,Pe,Ae,xe,Oe)}const D=t.context;r._destroyVertexArray(i),r.vertexArray=Mi._createVertexArrayForMesh(D,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const I=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const _=o._findAncestorTileWithTerrainData(n);l(_)&&l(_.data.waterMaskTexture)&&(r.waterMaskTexture=_.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,_,r.waterMaskTranslationAndScale))}l(I)&&(--I.referenceCount,I.referenceCount===0&&I.destroy())}function rx(e,t,n,i,o,r,s,a,c,u,d){const h=t_;h.longitude=M.lerp(t.west,t.east,r),h.latitude=M.lerp(t.south,t.north,s),h.height=a;const m=e.cartographicToCartesian(h,Fy);let g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(m,WM));const p=PB;return p.x=r,p.y=s,n.encode(i,o*n.stride,m,p,a,c,u,g),d.minimumHeight=Math.min(d.minimumHeight,a),d.maximumHeight=Math.max(d.maximumHeight,a),o+1}const QS=new ge;function CC(e,t,n,i){let o=e.rectangle;const r=t.rectangle;t.x===0&&n.x===1&&e.x===e.tilingScheme.getNumberOfXTilesAtLevel(e.level)-1?(o=ge.clone(e.rectangle,QS),o.west-=M.TWO_PI,o.east-=M.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=ge.clone(e.rectangle,QS),o.west+=M.TWO_PI,o.east+=M.TWO_PI);const s=o.east-o.west,a=(r.west-o.west)/s,c=(r.east-o.west)/s,u=o.north-o.south,d=(r.south-o.south)/u,h=(r.north-o.south)/u;let m=(n.x-a)/(c-a),g=(n.y-d)/(h-d);return Math.abs(m)<Math.EPSILON5?m=0:Math.abs(m-1)<Math.EPSILON5&&(m=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=m,i.y=g,i}const QIe=new j;function OB(e,t,n,i,o){const r=e.encoding,s=e.vertices;if(o.height=r.decodeHeight(s,t),r.hasVertexNormals)r.getOctEncodedNormal(s,t,o.encodedNormal);else{const a=o.encodedNormal;a.x=0,a.y=0}}const ZIe=new j,e1e=new f;function t1e(e,t,n,i,o,r,s,a,c,u){const d=i.encoding,h=i.vertices,m=CC(t,n,d.decodeTextureCoordinates(h,o,oc),oc),g=CC(t,n,d.decodeTextureCoordinates(h,r,PB),PB);let p;c?p=(s-m.x)/(g.x-m.x):p=(a-m.y)/(g.y-m.y);const y=d.decodeHeight(h,o),b=d.decodeHeight(h,r),C=n.rectangle;t_.longitude=M.lerp(C.west,C.east,s),t_.latitude=M.lerp(C.south,C.north,a),u.height=t_.height=M.lerp(y,b,p);let E;if(d.hasVertexNormals){const w=d.getOctEncodedNormal(h,o,QIe),S=d.getOctEncodedNormal(h,r,ZIe),P=mi.octDecode(w.x,w.y,Fy),L=mi.octDecode(S.x,S.y,e1e);E=f.lerp(P,L,p,Fy),f.normalize(E,E),mi.octEncode(E,u.encodedNormal)}else E=e.geodeticSurfaceNormalCartographic(t_,Fy),mi.octEncode(E,u.encodedNormal)}function G7(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(t_,Fy);mi.octEncode(s,r.encodedNormal)}function sx(e,t,n,i,o,r,s,a,c,u,d){if(fH(e,t,a,s,!1,n,i,d)||fH(e,t,u,c,!0,n,i,d))return d;let m;if(jM(o,r))return n===0?i===0?m=r.eastIndicesNorthToSouth[0]:m=r.southIndicesEastToWest[0]:i===0?m=r.northIndicesWestToEast[0]:m=r.westIndicesSouthToNorth[0],OB(r,m,n,i,d),d;let g;if(n===0?i===0?g=ax(e.westMeshes,e.westTiles,Qt.EAST,e.southMeshes,e.southTiles,Qt.NORTH):g=ax(e.northMeshes,e.northTiles,Qt.SOUTH,e.westMeshes,e.westTiles,Qt.EAST):i===0?g=ax(e.southMeshes,e.southTiles,Qt.NORTH,e.eastMeshes,e.eastTiles,Qt.WEST):g=ax(e.eastMeshes,e.eastTiles,Qt.WEST,e.northMeshes,e.northTiles,Qt.SOUTH),l(g))return G7(e,t,n,i,g,d),d}function ax(e,t,n,i,o,r,s,a){const c=dH(e,t,!1,n),u=dH(i,o,!0,r);return l(c)&&l(u)?(c+u)*.5:l(c)?c:u}function cx(e,t,n,i,o,r,s,a,c){for(let u=0;u<r.length;++u)o=n1e(e,t,n,i,o,r[u],s[u],a,c);return o}function n1e(e,t,n,i,o,r,s,a,c){let u=r.rectangle;a===Qt.EAST&&e.tile.x===0?(u=ge.clone(r.rectangle,QS),u.west-=M.TWO_PI,u.east-=M.TWO_PI):a===Qt.WEST&&r.x===0&&(u=ge.clone(r.rectangle,QS),u.west+=M.TWO_PI,u.east+=M.TWO_PI);const d=e.tile.rectangle;let h,m;o>0&&(n.decodeTextureCoordinates(i,o-1,oc),h=oc.x,m=oc.y);let g,p;switch(a){case Qt.WEST:g=s.westIndicesSouthToNorth,p=!1;break;case Qt.NORTH:g=s.northIndicesWestToEast,p=!0;break;case Qt.EAST:g=s.eastIndicesNorthToSouth,p=!1;break;case Qt.SOUTH:g=s.southIndicesEastToWest,p=!0;break}const y=r,b=e.tile,C=s.encoding,E=s.vertices,w=n.stride;let S,P;C.hasWebMercatorT&&(S=di.geodeticLatitudeToMercatorAngle(d.south),P=1/(di.geodeticLatitudeToMercatorAngle(d.north)-S));for(let L=0;L<g.length;++L){const z=g[L],R=C.decodeTextureCoordinates(E,z,oc);CC(y,b,R,R);const F=R.x,U=R.y,D=p?F:U;if(D<0||D>1||Math.abs(F-h)<M.EPSILON5&&Math.abs(U-m)<M.EPSILON5)continue;const I=Math.abs(F)<M.EPSILON5||Math.abs(F-1)<M.EPSILON5,_=Math.abs(U)<M.EPSILON5||Math.abs(U-1)<M.EPSILON5;if(I&&_)continue;const v=C.decodePosition(E,z,Fy),O=C.decodeHeight(E,z);let N;C.hasVertexNormals?N=C.getOctEncodedNormal(E,z,IB):(N=IB,N.x=0,N.y=0);let V=U;if(C.hasWebMercatorT){const G=M.lerp(d.south,d.north,U);V=(di.geodeticLatitudeToMercatorAngle(G)-S)*P}let k;n.hasGeodeticSurfaceNormals&&(k=t.geodeticSurfaceNormal(v,WM)),n.encode(i,o*w,v,R,O,N,V,k),c.minimumHeight=Math.min(c.minimumHeight,O),c.maximumHeight=Math.max(c.maximumHeight,O),++o}return o}function dH(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 u=s;u!==a;u+=c){const d=e[u],h=t[u];if(!jM(h,d))continue;let m;switch(i){case Qt.WEST:m=d.westIndicesSouthToNorth;break;case Qt.SOUTH:m=d.southIndicesEastToWest;break;case Qt.EAST:m=d.eastIndicesNorthToSouth;break;case Qt.NORTH:m=d.northIndicesWestToEast;break}const g=m[n?0:m.length-1];if(l(g))return d.encoding.decodeHeight(d.vertices,g)}}function jM(e,t){return l(t)&&(!l(e.data.fill)||!e.data.fill.changedThisFrame)}function fH(e,t,n,i,o,r,s,a){let c,u,d,h,m;const g=i[o?0:n.length-1],p=n[o?0:n.length-1];if(jM(g,p)&&(r===0?s===0?(c=o?p.northIndicesWestToEast:p.eastIndicesNorthToSouth,u=o,d=o):(c=o?p.eastIndicesNorthToSouth:p.southIndicesEastToWest,u=!o,d=!1):s===0?(c=o?p.westIndicesSouthToNorth:p.northIndicesWestToEast,u=!o,d=!0):(c=o?p.southIndicesEastToWest:p.westIndicesSouthToNorth,u=o,d=!o),c.length>0)){h=o?0:c.length-1,m=c[h],p.encoding.decodeTextureCoordinates(p.vertices,m,oc);const y=CC(g,e.tile,oc,oc);if(y.x===r&&y.y===s)return OB(p,m,r,s,a),!0;if(h=Bs(c,u?r:s,function(b,C){p.encoding.decodeTextureCoordinates(p.vertices,b,oc);const E=CC(g,e.tile,oc,oc);return d?u?E.x-r:E.y-s:u?r-E.x:s-E.y}),h<0){if(h=~h,h>0&&h<c.length)return t1e(t,g,e.tile,p,c[h-1],c[h],r,s,u,a),!0}else return OB(p,c[h],r,s,a),!0}return!1}const i1e=[new f,new f,new f,new f];function o1e(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=i1e;return f.fromRadians(n.west,n.south,o,a,c[0]),f.fromRadians(n.east,n.south,o,a,c[1]),f.fromRadians(n.west,n.north,o,a,c[2]),f.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}var ZS={},r1e={get exports(){return ZS},set exports(e){ZS=e}};r1e.exports=mD;ZS.default=mD;function mD(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=W7(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,u,d,h,m,g;if(i&&(r=u1e(e,t,r,n)),e.length>80*n){a=u=e[0],c=d=e[1];for(var p=n;p<o;p+=n)h=e[p],m=e[p+1],h<a&&(a=h),m<c&&(c=m),h>u&&(u=h),m>d&&(d=m);g=Math.max(u-a,d-c),g=g!==0?32767/g:0}return TC(r,s,n,a,c,g,0),s}function W7(e,t,n,i,o){var r,s;if(o===RB(e,t,n,i)>0)for(r=t;r<n;r+=i)s=hH(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=hH(r,e[r],e[r+1],s);return s&&_D(s,s.next)&&(xC(s),s=s.next),s}function S_(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(_D(n,n.next)||Qo(n.prev,n,n.next)===0)){if(xC(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function TC(e,t,n,i,o,r,s){if(e){!s&&r&&m1e(e,i,o,r);for(var a=e,c,u;e.prev!==e.next;){if(c=e.prev,u=e.next,r?a1e(e,i,o,r):s1e(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),xC(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=c1e(S_(e),t,n),TC(e,t,n,i,o,r,2)):s===2&&l1e(e,t,n,i,o,r):TC(S_(e),t,n,i,o,r,1);break}}}}function s1e(e){var t=e.prev,n=e,i=e.next;if(Qo(t,n,i)>=0)return!1;for(var o=t.x,r=n.x,s=i.x,a=t.y,c=n.y,u=i.y,d=o<r?o<s?o:s:r<s?r:s,h=a<c?a<u?a:u:c<u?c:u,m=o>r?o>s?o:s:r>s?r:s,g=a>c?a>u?a:u:c>u?c:u,p=i.next;p!==t;){if(p.x>=d&&p.x<=m&&p.y>=h&&p.y<=g&&Ey(o,a,r,c,s,u,p.x,p.y)&&Qo(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function a1e(e,t,n,i){var o=e.prev,r=e,s=e.next;if(Qo(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,u=s.x,d=o.y,h=r.y,m=s.y,g=a<c?a<u?a:u:c<u?c:u,p=d<h?d<m?d:m:h<m?h:m,y=a>c?a>u?a:u:c>u?c:u,b=d>h?d>m?d:m:h>m?h:m,C=LB(g,p,t,n,i),E=LB(y,b,t,n,i),w=e.prevZ,S=e.nextZ;w&&w.z>=C&&S&&S.z<=E;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=b&&w!==o&&w!==s&&Ey(a,d,c,h,u,m,w.x,w.y)&&Qo(w.prev,w,w.next)>=0||(w=w.prevZ,S.x>=g&&S.x<=y&&S.y>=p&&S.y<=b&&S!==o&&S!==s&&Ey(a,d,c,h,u,m,S.x,S.y)&&Qo(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;w&&w.z>=C;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=b&&w!==o&&w!==s&&Ey(a,d,c,h,u,m,w.x,w.y)&&Qo(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;S&&S.z<=E;){if(S.x>=g&&S.x<=y&&S.y>=p&&S.y<=b&&S!==o&&S!==s&&Ey(a,d,c,h,u,m,S.x,S.y)&&Qo(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function c1e(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!_D(o,r)&&j7(o,i,i.next,r)&&EC(o,r)&&EC(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),xC(i),xC(i.next),i=e=r),i=i.next}while(i!==e);return S_(i)}function l1e(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&y1e(s,a)){var c=q7(s,a);s=S_(s,s.next),c=S_(c,c.next),TC(s,t,n,i,o,r,0),TC(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function u1e(e,t,n,i){var o=[],r,s,a,c,u;for(r=0,s=t.length;r<s;r++)a=t[r]*i,c=r<s-1?t[r+1]*i:e.length,u=W7(e,a,c,i,!1),u===u.next&&(u.steiner=!0),o.push(g1e(u));for(o.sort(d1e),r=0;r<o.length;r++)n=f1e(o[r],n);return n}function d1e(e,t){return e.x-t.x}function f1e(e,t){var n=h1e(e,t);if(!n)return t;var i=q7(n,e);return S_(i,i.next),S_(n,n.next)}function h1e(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,u=s.x,d=s.y,h=1/0,m;n=s;do i>=n.x&&n.x>=u&&i!==n.x&&Ey(o<d?i:r,o,u,d,o<d?r:i,o,n.x,n.y)&&(m=Math.abs(o-n.y)/(i-n.x),EC(n,e)&&(m<h||m===h&&(n.x>s.x||n.x===s.x&&p1e(s,n)))&&(s=n,h=m)),n=n.next;while(n!==c);return s}function p1e(e,t){return Qo(e.prev,e,t.prev)<0&&Qo(t.next,e,e.next)<0}function m1e(e,t,n,i){var o=e;do o.z===0&&(o.z=LB(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,_1e(o)}function _1e(e){var t,n,i,o,r,s,a,c,u=1;do{for(n=e,e=null,r=null,s=0;n;){for(s++,i=n,a=0,t=0;t<u&&(a++,i=i.nextZ,!!i);t++);for(c=u;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,u*=2}while(s>1);return e}function LB(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 g1e(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 Ey(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 y1e(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!A1e(e,t)&&(EC(e,t)&&EC(t,e)&&b1e(e,t)&&(Qo(e.prev,e,t.prev)||Qo(e,t.prev,t))||_D(e,t)&&Qo(e.prev,e,e.next)>0&&Qo(t.prev,t,t.next)>0)}function Qo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function _D(e,t){return e.x===t.x&&e.y===t.y}function j7(e,t,n,i){var o=ux(Qo(e,t,n)),r=ux(Qo(e,t,i)),s=ux(Qo(n,i,e)),a=ux(Qo(n,i,t));return!!(o!==r&&s!==a||o===0&&lx(e,n,t)||r===0&&lx(e,i,t)||s===0&&lx(n,e,i)||a===0&&lx(n,t,i))}function lx(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 ux(e){return e>0?1:e<0?-1:0}function A1e(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&&j7(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function EC(e,t){return Qo(e.prev,e,e.next)<0?Qo(e,t,e.next)>=0&&Qo(e,e.prev,t)>=0:Qo(e,t,e.prev)<0||Qo(e,e.next,t)<0}function b1e(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 q7(e,t){var n=new BB(e.i,e.x,e.y),i=new BB(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 hH(e,t,n,i){var o=new BB(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 xC(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 BB(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}mD.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(RB(e,0,r,n));if(o)for(var a=0,c=t.length;a<c;a++){var u=t[a]*n,d=a<c-1?t[a+1]*n:e.length;s-=Math.abs(RB(e,u,d,n))}var h=0;for(a=0;a<i.length;a+=3){var m=i[a]*n,g=i[a+1]*n,p=i[a+2]*n;h+=Math.abs((e[m]-e[p])*(e[g+1]-e[m+1])-(e[m]-e[g])*(e[p+1]-e[m+1]))}return s===0&&h===0?0:Math.abs((h-s)/s)};function RB(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}mD.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};function NB(e,t,n){if(e===0)return t*n;const i=e*e,o=i*i,r=o*i,s=r*i,a=s*i,c=a*i,u=n,d=Math.sin(2*u),h=Math.sin(4*u),m=Math.sin(6*u),g=Math.sin(8*u),p=Math.sin(10*u),y=Math.sin(12*u);return t*((1-i/4-3*o/64-5*r/256-175*s/16384-441*a/65536-4851*c/1048576)*u-(3*i/8+3*o/32+45*r/1024+105*s/4096+2205*a/131072+6237*c/524288)*d+(15*o/256+45*r/1024+525*s/16384+1575*a/65536+155925*c/8388608)*h-(35*r/3072+175*s/12288+3675*a/262144+13475*c/1048576)*m+(315*s/131072+2205*a/524288+43659*c/8388608)*g-(693*a/1310720+6237*c/5242880)*p+1001*c/8388608*y)}function C1e(e,t,n){const i=e/n;if(t===0)return i;const o=i*i,r=o*i,s=r*i,a=t,c=a*a,u=c*c,d=u*c,h=d*c,m=h*c,g=m*c,p=Math.sin(2*i),y=Math.cos(2*i),b=Math.sin(4*i),C=Math.cos(4*i),E=Math.sin(6*i),w=Math.cos(6*i),S=Math.sin(8*i),P=Math.cos(8*i),L=Math.sin(10*i),z=Math.cos(10*i),R=Math.sin(12*i);return i+i*c/4+7*i*u/64+15*i*d/256+579*i*h/16384+1515*i*m/65536+16837*i*g/1048576+(3*i*u/16+45*i*d/256-i*(32*o-561)*h/4096-i*(232*o-1677)*m/16384+i*(399985-90560*o+512*s)*g/5242880)*y+(21*i*d/256+483*i*h/4096-i*(224*o-1969)*m/16384-i*(33152*o-112599)*g/1048576)*C+(151*i*h/4096+4681*i*m/65536+1479*i*g/16384-453*r*g/32768)*w+(1097*i*m/65536+42783*i*g/1048576)*P+8011*i*g/1048576*z+(3*c/8+3*u/16+213*d/2048-3*o*d/64+255*h/4096-33*o*h/512+20861*m/524288-33*o*m/512+s*m/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*p+(21*u/256+21*d/256+533*h/8192-21*o*h/512+197*m/4096-315*o*m/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*b+(151*d/6144+151*h/4096+5019*m/131072-453*o*m/16384+26965*g/786432-8607*o*g/131072)*E+(1097*h/131072+1097*m/65536+225797*g/10485760-1097*o*g/65536)*S+(8011*m/2621440+8011*g/1048576)*L+293393*g/251658240*R}function m0(e,t){if(e===0)return Math.log(Math.tan(.5*(M.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(M.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function T1e(e,t,n,i,o){const r=m0(e._ellipticity,n),s=m0(e._ellipticity,o);return Math.atan2(M.negativePiToPi(i-t),s-r)}function E1e(e,t,n,i,o,r,s){const a=e._heading,c=r-i;let u=0;if(M.equalsEpsilon(Math.abs(a),M.PI_OVER_TWO,M.EPSILON8))if(t===n)u=t*Math.cos(o)*M.negativePiToPi(c);else{const d=Math.sin(o);u=t*Math.cos(o)*M.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*d*d)}else{const d=NB(e._ellipticity,t,o);u=(NB(e._ellipticity,t,s)-d)/Math.cos(a)}return Math.abs(u)}const x1e=new f,$1=new f;function $7(e,t,n,i){const o=f.normalize(i.cartographicToCartesian(t,$1),x1e),r=f.normalize(i.cartographicToCartesian(n,$1),$1);T.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(f.angleBetween(o,r))-Math.PI),.0125);const s=i.maximumRadius,a=i.minimumRadius,c=s*s,u=a*a;e._ellipticitySquared=(c-u)/c,e._ellipticity=Math.sqrt(e._ellipticitySquared),e._start=Ce.clone(t,e._start),e._start.height=0,e._end=Ce.clone(n,e._end),e._end.height=0,e._heading=T1e(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=E1e(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function Y7(e,t,n,i,o,r){if(n===0)return Ce.clone(e,r);const s=o*o;let a,c,u;if(Math.abs(M.PI_OVER_TWO-Math.abs(t))>M.EPSILON8){const d=NB(o,i,e.latitude),h=n*Math.cos(t),m=d+h;c=C1e(m,o,i);const g=m0(o,e.latitude),p=m0(o,c);u=Math.tan(t)*(p-g),a=M.negativePiToPi(e.longitude+u)}else{c=e.latitude;let d;if(o===0)d=i*Math.cos(e.latitude);else{const h=Math.sin(e.latitude);d=i*Math.cos(e.latitude)/Math.sqrt(1-s*h*h)}u=n/d,t>0?a=M.negativePiToPi(e.longitude+u):a=M.negativePiToPi(e.longitude-u)}return l(r)?(r.longitude=a,r.latitude=c,r.height=0,r):new Ce(a,c,0)}function ps(e,t,n){const i=A(n,me.WGS84);this._ellipsoid=i,this._start=new Ce,this._end=new Ce,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,l(e)&&l(t)&&$7(this,e,t,i)}Object.defineProperties(ps.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return T.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return T.defined("distance",this._distance),this._heading}}});ps.fromStartHeadingDistance=function(e,t,n,i,o){T.defined("start",e),T.defined("heading",t),T.defined("distance",n),T.typeOf.number.greaterThan("distance",n,0);const r=A(i,me.WGS84),s=r.maximumRadius,a=r.minimumRadius,c=s*s,u=a*a,d=Math.sqrt((c-u)/c);t=M.negativePiToPi(t);const h=Y7(e,t,n,r.maximumRadius,d);return!l(o)||l(i)&&!i.equals(o.ellipsoid)?new ps(e,h,r):(o.setEndPoints(e,h),o)};ps.prototype.setEndPoints=function(e,t){T.defined("start",e),T.defined("end",t),$7(this,e,t,this._ellipsoid)};ps.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};ps.prototype.interpolateUsingSurfaceDistance=function(e,t){if(T.typeOf.number("distance",e),!l(this._distance)||this._distance===0)throw new x("EllipsoidRhumbLine must have distinct start and end set.");return Y7(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};ps.prototype.findIntersectionWithLongitude=function(e,t){if(T.typeOf.number("intersectionLongitude",e),!l(this._distance)||this._distance===0)throw new x("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=Math.abs(i),r=this._start;if(e=M.negativePiToPi(e),M.equalsEpsilon(Math.abs(e),Math.PI,M.EPSILON14)&&(e=M.sign(r.longitude)*Math.PI),l(t)||(t=new Ce),Math.abs(M.PI_OVER_TWO-o)<=M.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(M.equalsEpsilon(Math.abs(M.PI_OVER_TWO-o),M.PI_OVER_TWO,M.EPSILON8))return M.equalsEpsilon(e,r.longitude,M.EPSILON12)?void 0:(t.longitude=e,t.latitude=M.PI_OVER_TWO*M.sign(M.PI_OVER_TWO-i),t.height=0,t);const s=r.latitude,a=n*Math.sin(s),c=Math.tan(.5*(M.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a);let d=r.latitude,h;do{h=d;const m=n*Math.sin(h),g=(1+m)/(1-m);d=2*Math.atan(c*Math.pow(g/u,n/2))-M.PI_OVER_TWO}while(!M.equalsEpsilon(d,h,M.EPSILON12));return t.longitude=e,t.latitude=d,t.height=0,t};ps.prototype.findIntersectionWithLatitude=function(e,t){if(T.typeOf.number("intersectionLatitude",e),!l(this._distance)||this._distance===0)throw new x("EllipsoidRhumbLine must have distinct start and end set.");const n=this._ellipticity,i=this._heading,o=this._start;if(M.equalsEpsilon(Math.abs(i),M.PI_OVER_TWO,M.EPSILON8))return;const r=m0(n,o.latitude),s=m0(n,e),a=Math.tan(i)*(s-r),c=M.negativePiToPi(o.longitude+a);return l(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new Ce(c,e,0)};const w1e=new f,S1e=new f,Dp={};Dp.computeArea2D=function(e){T.defined("positions",e),T.typeOf.number.greaterThanOrEquals("positions.length",e.length,3);const t=e.length;let n=0;for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];n+=r.x*s.y-s.x*r.y}return n*.5};Dp.computeWindingOrder2D=function(e){return Dp.computeArea2D(e)>0?ml.COUNTER_CLOCKWISE:ml.CLOCKWISE};Dp.triangulate=function(e,t){T.defined("positions",e);const n=j.packArray(e);return ZS(n,t,2)};const X7=new f,K7=new f,J7=new f,pH=new f,mH=new f,_H=new f,ef=new f,Q7=new j,Z7=new j,e$=new j,zy=new j;Dp.computeSubdivision=function(e,t,n,i,o){o=A(o,M.RADIANS_PER_DEGREE);const r=l(i);T.typeOf.object("ellipsoid",e),T.defined("positions",t),T.defined("indices",n),T.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),T.typeOf.number.equals("indices.length % 3","0",n.length%3,0),T.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),d=new Array(c*2);let h=0,m=0;for(a=0;a<c;a++){const w=t[a];if(u[h++]=w.x,u[h++]=w.y,u[h++]=w.z,r){const S=i[a];d[m++]=S.x,d[m++]=S.y}}const g=[],p={},y=e.maximumRadius,b=M.chordLength(o,y),C=b*b;for(;s.length>0;){const w=s.pop(),S=s.pop(),P=s.pop(),L=f.fromArray(u,P*3,X7),z=f.fromArray(u,S*3,K7),R=f.fromArray(u,w*3,J7);let F,U,D;r&&(F=j.fromArray(d,P*2,Q7),U=j.fromArray(d,S*2,Z7),D=j.fromArray(d,w*2,e$));const I=f.multiplyByScalar(f.normalize(L,pH),y,pH),_=f.multiplyByScalar(f.normalize(z,mH),y,mH),v=f.multiplyByScalar(f.normalize(R,_H),y,_H),O=f.magnitudeSquared(f.subtract(I,_,ef)),N=f.magnitudeSquared(f.subtract(_,v,ef)),V=f.magnitudeSquared(f.subtract(v,I,ef)),k=Math.max(O,N,V);let G,W,K;k>C?O===k?(G=`${Math.min(P,S)} ${Math.max(P,S)}`,a=p[G],l(a)||(W=f.add(L,z,ef),f.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,p[G]=a,r&&(K=j.add(F,U,zy),j.multiplyByScalar(K,.5,K),d.push(K.x,K.y))),s.push(P,a,w),s.push(a,S,w)):N===k?(G=`${Math.min(S,w)} ${Math.max(S,w)}`,a=p[G],l(a)||(W=f.add(z,R,ef),f.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,p[G]=a,r&&(K=j.add(U,D,zy),j.multiplyByScalar(K,.5,K),d.push(K.x,K.y))),s.push(S,a,P),s.push(a,w,P)):V===k&&(G=`${Math.min(w,P)} ${Math.max(w,P)}`,a=p[G],l(a)||(W=f.add(R,L,ef),f.multiplyByScalar(W,.5,W),u.push(W.x,W.y,W.z),a=u.length/3-1,p[G]=a,r&&(K=j.add(D,F,zy),j.multiplyByScalar(K,.5,K),d.push(K.x,K.y))),s.push(w,a,S),s.push(a,P,S)):(g.push(P),g.push(S),g.push(w))}const E={attributes:{position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Ze.TRIANGLES};return r&&(E.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:d})),new Lt(E)};const v1e=new Ce,D1e=new Ce,I1e=new Ce,Y1=new Ce;Dp.computeRhumbLineSubdivision=function(e,t,n,i,o){o=A(o,M.RADIANS_PER_DEGREE);const r=l(i);T.typeOf.object("ellipsoid",e),T.defined("positions",t),T.defined("indices",n),T.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),T.typeOf.number.equals("indices.length % 3","0",n.length%3,0),T.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),d=new Array(c*2);let h=0,m=0;for(a=0;a<c;a++){const P=t[a];if(u[h++]=P.x,u[h++]=P.y,u[h++]=P.z,r){const L=i[a];d[m++]=L.x,d[m++]=L.y}}const g=[],p={},y=e.maximumRadius,b=M.chordLength(o,y),C=new ps(void 0,void 0,e),E=new ps(void 0,void 0,e),w=new ps(void 0,void 0,e);for(;s.length>0;){const P=s.pop(),L=s.pop(),z=s.pop(),R=f.fromArray(u,z*3,X7),F=f.fromArray(u,L*3,K7),U=f.fromArray(u,P*3,J7);let D,I,_;r&&(D=j.fromArray(d,z*2,Q7),I=j.fromArray(d,L*2,Z7),_=j.fromArray(d,P*2,e$));const v=e.cartesianToCartographic(R,v1e),O=e.cartesianToCartographic(F,D1e),N=e.cartesianToCartographic(U,I1e);C.setEndPoints(v,O);const V=C.surfaceDistance;E.setEndPoints(O,N);const k=E.surfaceDistance;w.setEndPoints(N,v);const G=w.surfaceDistance,W=Math.max(V,k,G);let K,q,te,Y,X;W>b?V===W?(K=`${Math.min(z,L)} ${Math.max(z,L)}`,a=p[K],l(a)||(q=C.interpolateUsingFraction(.5,Y1),te=(v.height+O.height)*.5,Y=f.fromRadians(q.longitude,q.latitude,te,e,ef),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(D,I,zy),j.multiplyByScalar(X,.5,X),d.push(X.x,X.y))),s.push(z,a,P),s.push(a,L,P)):k===W?(K=`${Math.min(L,P)} ${Math.max(L,P)}`,a=p[K],l(a)||(q=E.interpolateUsingFraction(.5,Y1),te=(O.height+N.height)*.5,Y=f.fromRadians(q.longitude,q.latitude,te,e,ef),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(I,_,zy),j.multiplyByScalar(X,.5,X),d.push(X.x,X.y))),s.push(L,a,z),s.push(a,P,z)):G===W&&(K=`${Math.min(P,z)} ${Math.max(P,z)}`,a=p[K],l(a)||(q=w.interpolateUsingFraction(.5,Y1),te=(N.height+v.height)*.5,Y=f.fromRadians(q.longitude,q.latitude,te,e,ef),u.push(Y.x,Y.y,Y.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(_,D,zy),j.multiplyByScalar(X,.5,X),d.push(X.x,X.y))),s.push(P,a,L),s.push(a,z,L)):(g.push(z),g.push(L),g.push(P))}const S={attributes:{position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Ze.TRIANGLES};return r&&(S.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:d})),new Lt(S)};Dp.scaleToGeodeticHeight=function(e,t,n,i){n=A(n,me.WGS84);let o=w1e,r=S1e;if(t=A(t,0),i=A(i,!0),l(e)){const s=e.length;for(let a=0;a<s;a+=3)f.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),f.multiplyByScalar(o,t,o),f.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};const no=Dp,gH=Math.cos,yH=Math.sin,P1e=Math.sqrt,qM={};qM.computePosition=function(e,t,n,i,o,r,s){const a=t.radiiSquared,c=e.nwCorner,u=e.boundingRectangle;let d=c.latitude-e.granYCos*i+o*e.granXSin;const h=gH(d),m=yH(d),g=a.z*m;let p=c.longitude+i*e.granYSin+o*e.granXCos;const y=h*gH(p),b=h*yH(p),C=a.x*y,E=a.y*b,w=P1e(C*y+E*b+g*m);if(r.x=C/w,r.y=E/w,r.z=g/w,n){const S=e.stNwCorner;l(S)?(d=S.latitude-e.stGranYCos*i+o*e.stGranXSin,p=S.longitude+i*e.stGranYSin+o*e.stGranXCos,s.x=(p-e.stWest)*e.lonScalar,s.y=(d-e.stSouth)*e.latScalar):(s.x=(p-u.west)*e.lonScalar,s.y=(d-u.south)*e.latScalar)}};const O1e=new dt;let kc=new f;const L1e=new Ce;let ev=new f;const MB=new nr;function AH(e,t,n,i,o,r,s){const a=Math.cos(t),c=i*a,u=n*a,d=Math.sin(t),h=i*d,m=n*d;kc=MB.project(e,kc),kc=f.subtract(kc,ev,kc);const g=dt.fromRotation(t,O1e);kc=dt.multiplyByVector(g,kc,kc),kc=f.add(kc,ev,kc),e=MB.unproject(kc,e),r-=1,s-=1;const p=e.latitude,y=p+r*m,b=p-c*s,C=p-c*s+r*m,E=Math.max(p,y,b,C),w=Math.min(p,y,b,C),S=e.longitude,P=S+r*u,L=S+s*h,z=S+s*h+r*u,R=Math.max(S,P,L,z),F=Math.min(S,P,L,z);return{north:E,south:w,east:R,west:F,granYCos:c,granYSin:h,granXCos:u,granXSin:m,nwCorner:e}}qM.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,c=e.west,u=e.north,d=e.south,h=!1,m=!1;u===M.PI_OVER_TWO&&(h=!0),d===-M.PI_OVER_TWO&&(m=!0);let g;const p=u-d;c>a?g=M.TWO_PI-c+a:g=a-c;const y=Math.ceil(g/t)+1,b=Math.ceil(p/t)+1,C=g/(y-1),E=p/(b-1),w=ge.northwest(e,r),S=ge.center(e,L1e);(n!==0||i!==0)&&(S.longitude<w.longitude&&(S.longitude+=M.TWO_PI),ev=MB.project(S,ev));const P=E,L=C,z=0,R=0,F=ge.clone(e,o),U={granYCos:P,granYSin:z,granXCos:L,granXSin:R,nwCorner:w,boundingRectangle:F,width:y,height:b,northCap:h,southCap:m};if(n!==0){const D=AH(w,n,C,E,S,y,b);if(u=D.north,d=D.south,a=D.east,c=D.west,u<-M.PI_OVER_TWO||u>M.PI_OVER_TWO||d<-M.PI_OVER_TWO||d>M.PI_OVER_TWO)throw new x("Rotated rectangle is invalid. It crosses over either the north or south pole.");U.granYCos=D.granYCos,U.granYSin=D.granYSin,U.granXCos=D.granXCos,U.granXSin=D.granXSin,F.north=u,F.south=d,F.east=a,F.west=c}if(i!==0){n=n-i;const D=ge.northwest(F,s),I=AH(D,n,C,E,S,y,b);U.stGranYCos=I.granYCos,U.stGranXCos=I.granXCos,U.stGranYSin=I.granYSin,U.stGranXSin=I.granXSin,U.stNwCorner=D,U.stWest=I.west,U.stSouth=I.south}return U};const va=qM,B1e=new fe,R1e=new fe,N1e=new f,M1e=new ge;function t$(e,t){const n=e._ellipsoid,i=t.height,o=t.width,r=t.northCap,s=t.southCap;let a=i,c=2,u=0,d=4;r&&(c-=1,a-=1,u+=1,d-=2),s&&(c-=1,a-=1,u+=1,d-=2),u+=c*o+2*a-d;const h=new Float64Array(u*3);let m=0,g=0,p;const y=N1e;if(r)va.computePosition(t,n,!1,g,0,y),h[m++]=y.x,h[m++]=y.y,h[m++]=y.z;else for(p=0;p<o;p++)va.computePosition(t,n,!1,g,p,y),h[m++]=y.x,h[m++]=y.y,h[m++]=y.z;for(p=o-1,g=1;g<i;g++)va.computePosition(t,n,!1,g,p,y),h[m++]=y.x,h[m++]=y.y,h[m++]=y.z;if(g=i-1,!s)for(p=o-2;p>=0;p--)va.computePosition(t,n,!1,g,p,y),h[m++]=y.x,h[m++]=y.y,h[m++]=y.z;for(p=0,g=i-2;g>0;g--)va.computePosition(t,n,!1,g,p,y),h[m++]=y.x,h[m++]=y.y,h[m++]=y.z;const b=h.length/3*2,C=at.createTypedArray(h.length/3,b);let E=0;for(let S=0;S<h.length/3-1;S++)C[E++]=S,C[E++]=S+1;C[E++]=h.length/3-1,C[E++]=0;const w=new Lt({attributes:new Ji,primitiveType:Ze.LINES});return w.attributes.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h}),w.indices=C,w}function F1e(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=i,s=n,a=t$(e,t),c=t.height,u=t.width,d=no.scaleToGeodeticHeight(a.attributes.position.values,s,o,!1);let h=d.length;const m=new Float64Array(h*2);m.set(d);const g=no.scaleToGeodeticHeight(a.attributes.position.values,r,o);m.set(g,h),a.attributes.position.values=m;const p=t.northCap,y=t.southCap;let b=4;p&&(b-=1),y&&(b-=1);const C=(m.length/3+b)*2,E=at.createTypedArray(m.length/3,C);h=m.length/6;let w=0;for(let P=0;P<h-1;P++)E[w++]=P,E[w++]=P+1,E[w++]=P+h,E[w++]=P+h+1;E[w++]=h-1,E[w++]=0,E[w++]=h+h-1,E[w++]=h,E[w++]=0,E[w++]=h;let S;if(p)S=c-1;else{const P=u-1;E[w++]=P,E[w++]=P+h,S=u+c-2}if(E[w++]=S,E[w++]=S+h,!y){const P=u+S-1;E[w++]=P,E[w]=P+h}return a.indices=E,a}function v_(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle,n=A(e.granularity,M.RADIANS_PER_DEGREE),i=A(e.ellipsoid,me.WGS84),o=A(e.rotation,0);if(!l(t))throw new x("rectangle is required.");if(ge.validate(t),t.north<t.south)throw new x("options.rectangle.north must be greater than options.rectangle.south");const r=A(e.height,0),s=A(e.extrudedHeight,r);this._rectangle=ge.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"}v_.packedLength=ge.packedLength+me.packedLength+5;v_.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),ge.pack(e._rectangle,t,n),n+=ge.packedLength,me.pack(e._ellipsoid,t,n),n+=me.packedLength,t[n++]=e._granularity,t[n++]=e._surfaceHeight,t[n++]=e._rotation,t[n++]=e._extrudedHeight,t[n]=A(e._offsetAttribute,-1),t};const n$=new ge,i$=me.clone(me.UNIT_SPHERE),Lg={rectangle:n$,ellipsoid:i$,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};v_.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=ge.unpack(e,t,n$);t+=ge.packedLength;const o=me.unpack(e,t,i$);t+=me.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t];return l(n)?(n._rectangle=ge.clone(i,n._rectangle),n._ellipsoid=me.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=c,n._offsetAttribute=u===-1?void 0:u,n):(Lg.granularity=r,Lg.height=s,Lg.rotation=a,Lg.extrudedHeight=c,Lg.offsetAttribute=u===-1?void 0:u,new v_(Lg))};const z1e=new Ce;v_.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=va.computeOptions(t,e._granularity,e._rotation,0,M1e,z1e);let o,r;if(M.equalsEpsilon(t.north,t.south,M.EPSILON10)||M.equalsEpsilon(t.east,t.west,M.EPSILON10))return;const s=e._surfaceHeight,a=e._extrudedHeight,c=!M.equalsEpsilon(s,a,0,M.EPSILON2);let u;if(c){if(o=F1e(e,i),l(e._offsetAttribute)){const m=o.attributes.position.values.length/3;let g=new Uint8Array(m);e._offsetAttribute===yn.TOP?g=g.fill(1,0,m/2):(u=e._offsetAttribute===yn.NONE?0:1,g=g.fill(u)),o.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}const d=fe.fromRectangle3D(t,n,s,R1e),h=fe.fromRectangle3D(t,n,a,B1e);r=fe.union(d,h)}else{if(o=t$(e,i),o.attributes.position.values=no.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),l(e._offsetAttribute)){const d=o.attributes.position.values.length;u=e._offsetAttribute===yn.NONE?0:1;const h=new Uint8Array(d/3).fill(u);o.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}r=fe.fromRectangle3D(t,n,s)}return new Lt({attributes:o.attributes,indices:o.indices,primitiveType:Ze.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};function fd(e){T.typeOf.object("options",e),T.typeOf.object("options.rectangle",e.rectangle),this.rectangle=ge.clone(e.rectangle),this.minimumHeight=A(e.minimumHeight,0),this.maximumHeight=A(e.maximumHeight,0),this.southwestCornerCartesian=new f,this.northeastCornerCartesian=new f,this.westNormal=new f,this.southNormal=new f,this.eastNormal=new f,this.northNormal=new f;const t=A(e.ellipsoid,me.WGS84);G1e(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,A(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(fd.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});fd.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=zt.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=fe.fromOrientedBoundingBox(this._orientedBoundingBox)};const bH=new f,dx=new f,CH=new f,U1e=new f,H1e=new f,V1e=new f,k1e=new f,Gc=new Ce,TH=new Pt(f.UNIT_X,0),Bg=new Un;function G1e(e,t,n){n.cartographicToCartesian(ge.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(ge.northeast(t),e.northeastCornerCartesian),Gc.longitude=t.west,Gc.latitude=(t.south+t.north)*.5,Gc.height=0;const i=n.cartographicToCartesian(Gc,V1e),o=f.cross(i,f.UNIT_Z,U1e);f.normalize(o,e.westNormal),Gc.longitude=t.east;const r=n.cartographicToCartesian(Gc,k1e),s=f.cross(f.UNIT_Z,r,bH);f.normalize(s,e.eastNormal);let a=f.subtract(i,r,bH);f.magnitude(a)===0&&(a=f.clone(o,a));const c=f.normalize(a,H1e),u=t.south;let d;if(u>0){Gc.longitude=(t.west+t.east)*.5,Gc.latitude=u;const y=n.cartographicToCartesian(Gc,Bg.origin);f.clone(c,Bg.direction);const b=Pt.fromPointNormal(e.southwestCornerCartesian,e.westNormal,TH);pr.rayPlane(Bg,b,e.southwestCornerCartesian),d=n.geodeticSurfaceNormal(y,dx)}else d=n.geodeticSurfaceNormalCartographic(ge.southeast(t),dx);const h=f.cross(d,a,CH);f.normalize(h,e.southNormal);const m=t.north;let g;if(m<0){Gc.longitude=(t.west+t.east)*.5,Gc.latitude=m;const y=n.cartographicToCartesian(Gc,Bg.origin);f.negate(c,Bg.direction);const b=Pt.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,TH);pr.rayPlane(Bg,b,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(y,dx)}else g=n.geodeticSurfaceNormalCartographic(ge.northwest(t),dx);const p=f.cross(a,g,CH);f.normalize(p,e.northNormal)}const W1e=new f,j1e=new f,q1e=new f(0,-1,0),$1e=new f(0,0,-1),EH=new f;function Y1e(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r=0;if(!ge.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,d=e.northeastCornerCartesian,h=e.westNormal,m=e.southNormal,g=e.eastNormal,p=e.northNormal;t.mode!==le.SCENE3D&&(u=t.mapProjection.project(ge.southwest(e.rectangle),W1e),u.z=u.y,u.y=u.x,u.x=0,d=t.mapProjection.project(ge.northeast(e.rectangle),j1e),d.z=d.y,d.y=d.x,d.x=0,h=q1e,g=f.UNIT_Y,m=$1e,p=f.UNIT_Z);const y=f.subtract(i,u,EH),b=f.dot(y,h),C=f.dot(y,m),E=f.subtract(i,d,EH),w=f.dot(E,g),S=f.dot(E,p);b>0?r+=b*b:w>0&&(r+=w*w),C>0?r+=C*C:S>0&&(r+=S*S)}let s,a,c;if(t.mode===le.SCENE3D?(s=o.height,a=e.minimumHeight,c=e.maximumHeight):(s=i.x,a=0,c=0),s>c){const u=s-c;r+=u*u}else if(s<a){const u=a-s;r+=u*u}return Math.sqrt(r)}fd.prototype.distanceToCamera=function(e){T.defined("frameState",e);const t=Y1e(this,e);if(e.mode===le.SCENE3D&&l(this._orientedBoundingBox)){const n=Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC));return Math.max(t,n)}return t};fd.prototype.intersectPlane=function(e){return T.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};fd.prototype.createDebugVolume=function(e){T.defined("color",e);const t=new B.clone(B.IDENTITY),n=new v_({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new ln({geometry:n,id:"outline",modelMatrix:t,attributes:{color:pn.fromColor(e)}});return new Jt({geometryInstances:i,appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})};function _o(e){if(!l(e))throw new x("options is required.");if(l(e.terrainProvider))if(l(e.imageryLayers)){if(!l(e.surfaceShaderSet))throw new x("options.surfaceShaderSet is required.")}else throw new x("options.imageryLayers is required.");else throw new x("options.terrainProvider is required.");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=Po.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 Ke,this._imageryLayers.layerAdded.addEventListener(_o.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(_o.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(_o.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(_o.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new Ke,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 H(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=ge.clone(ge.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}Object.defineProperties(_o.prototype,{baseColor:{get:function(){return this._baseColor},set:function(e){if(!l(e))throw new x("value is required.");this._baseColor=e,this._firstPassInitialColor=oe.fromColor(e,this._firstPassInitialColor)}},quadtree:{get:function(){return this._quadtree},set:function(e){if(!l(e))throw new x("value is required.");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){if(this._terrainProvider!==e){if(!l(e))throw new x("terrainProvider is required.");this._terrainProvider=e,l(this._quadtree)&&this._quadtree.invalidateAllTiles()}}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Io.setOwner(e,this,"_clippingPlanes")}}});function X1e(e,t){let n=e.loadingImagery;l(n)||(n=e.readyImagery);let i=t.loadingImagery;return l(i)||(i=t.readyImagery),n.imageryLayer._layerIndex-i.imageryLayer._layerIndex}_o.prototype.update=function(e){this._imageryLayers._update()};function K1e(e,t){const n=t.creditDisplay;e._terrainProvider.ready&&l(e._terrainProvider.credit)&&n.addCredit(e._terrainProvider.credit);const i=e._imageryLayers;for(let o=0,r=i.length;o<r;++o){const s=i.get(o).imageryProvider;s.ready&&l(s.credit)&&n.addCredit(s.credit)}}_o.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(X1e)})),K1e(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)Mi._freeVertexArray(t[i]);t.length=0};_o.prototype.beginUpdate=function(e){const t=this._tilesToRenderByTextureCount;for(let i=0,o=t.length;i<o;++i){const r=t[i];l(r)&&(r.length=0)}const n=this._clippingPlanes;l(n)&&n.enabled&&n.update(e),this._usedDrawCommands=0,this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1};_o.prototype.endUpdate=function(e){if(!l(this._renderState)){this._renderState=et.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:x_.LESS}}),this._blendRenderState=et.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:x_.LESS_OR_EQUAL},blending:Gi.ALPHA_BLEND});let s=ht(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=et.fromCache(s),s=ht(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=et.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&eg.updateFillTiles(this,this._quadtree._tilesToRender,e,this._vertexArraysToDestroy);const 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)});const r=this._tilesToRenderByTextureCount;for(let s=0,a=r.length;s<a;++s){const c=r[s];if(l(c))for(let u=0,d=c.length;u<d;++u){const h=c[u],m=h.data.tileBoundingRegion;bPe(this,h,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,m.minimumHeight)}}};function o$(e,t){const n=t.globeTranslucencyState;if(n.translucent){const i=e.renderState.blending.enabled;n.pushDerivedCommands(e,i,t)}else t.commandList.push(e)}_o.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)o$(t[n],e)};_o.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};_o.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)};_o.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;l(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===ni.CULLED_BUT_NEEDED,o=n.terrainState),Mi.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)!==Wr.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,Mi.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};const J1e=new fe,r$=new ge,Q1e=new ge,Z1e=new Ce;function Ww(e,t){if(t.west<t.east)return t;const n=ge.clone(t,Q1e);return ge.center(e,Z1e).longitude>0?n.east=M.PI:n.west=-M.PI,n}function s$(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;return!!(l(n)&&n.enabled||!ge.equals(e.cartographicLimitRectangle,ge.MAX_VALUE))}_o.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=s$(this,t);if(t.fog.enabled&&!o&&M.fog(i,t.fog.density)>=1)return Wr.NONE;const r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return Wr.PARTIAL;const a=t.cullingVolume;let c=s.boundingVolume;l(c)||(c=s.boundingSphere),r.clippedByBoundaries=!1;const u=Ww(e.rectangle,this.cartographicLimitRectangle),d=ge.simpleIntersection(u,e.rectangle,r$);if(!l(d))return Wr.NONE;if(ge.equals(d,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==le.SCENE3D&&(c=J1e,fe.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,c),f.fromElements(c.center.z,c.center.x,c.center.y,c.center),t.mode===le.MORPHING&&l(r.renderedMesh)&&(c=fe.union(s.boundingSphere,c,c))),!l(c))return Wr.PARTIAL;const h=this._clippingPlanes;if(l(h)&&h.enabled){const y=h.computeIntersectionWithBoundingVolume(c);if(e.isClipped=y!==xn.INSIDE,y===xn.OUTSIDE)return Wr.NONE}let m;const g=a.computeVisibility(c);if(g===xn.OUTSIDE?m=Wr.NONE:g===xn.INTERSECTING?m=Wr.PARTIAL:g===xn.INSIDE&&(m=Wr.FULL),m===Wr.NONE)return m;const p=t.mode===le.SCENE3D&&t.camera.frustum instanceof Gt;if(t.mode===le.SCENE3D&&!p&&l(n)&&!o){const y=r.occludeePointInScaledSpace;return!l(y)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(y,s.minimumHeight)?m:Wr.NONE}return m};_o.prototype.canRefine=function(e){return l(e.data.terrainData)?!0:this.terrainProvider.getTileDataAvailable(e.x*2,e.y*2,e.level+1)!==void 0};const ePe=[],tPe=[];_o.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=ePe;i.length=this._imageryLayers.length;let o=!1,r=!1,s;l(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(l(s))for(a=0,c=s.length;a<c;++a){const h=s[a],m=h.loadingImagery,g=!l(m)||m.state===Ai.FAILED||m.state===Ai.INVALID,p=(h.loadingImagery||h.readyImagery).imageryLayer._layerIndex;i[p]=g&&i[p]}const u=this.quadtree._lastSelectionFrameNumber,d=tPe;for(d.length=0,d.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);d.length>0;){const h=d.pop(),m=h._lastSelectionResultFrame===u?h._lastSelectionResult:ni.NONE;if(m===ni.RENDERED){const g=h.data;if(!l(g))continue;if(!o&&h.data.terrainState===mo.READY)return!1;const p=h.data.imagery;for(a=0,c=p.length;a<c;++a){const y=p[a],b=y.loadingImagery,C=!l(b)||b.state===Ai.FAILED||b.state===Ai.INVALID,E=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(C&&!i[E])return!1}}else m===ni.REFINED&&d.push(h.southwestChild,h.southeastChild,h.northwestChild,h.northeastChild)}return!0};const nPe=new f;_o.prototype.computeTileLoadPriority=function(e,t){const n=e.data;if(n===void 0)return 0;const i=n.tileBoundingRegion.boundingVolume;if(i===void 0)return 0;const o=t.camera.positionWC,r=t.camera.directionWC,s=f.subtract(i.center,o,nPe),a=f.magnitude(s);return a<M.EPSILON5?0:(f.divideByScalar(s,a,s),(1-f.dot(s,r))*e._distance)};const xH=new B,fx=new B,iPe=new oe,oPe=new oe,rPe=new oe,sPe=new f,wH=new f,aPe=new f,cPe=new f;_o.prototype.showTileThisFrame=function(e,t){let n=0;const i=e.data.imagery;for(let a=0,c=i.length;a<c;++a){const u=i[a];l(u.readyImagery)&&u.readyImagery.imageryLayer.alpha!==0&&++n}let o=this._tilesToRenderByTextureCount[n];l(o)||(o=[],this._tilesToRenderByTextureCount[n]=o),o.push(e);const r=e.data;l(r.vertexArray)?this._hasLoadedTilesThisFrame=!0:this._hasFillTilesThisFrame=!0;const s=this._debug;++s.tilesRendered,s.texturesRendered+=n};const lPe=[new f,new f,new f,new f];function SH(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=lPe;return f.fromRadians(n.west,n.south,o,a,c[0]),f.fromRadians(n.east,n.south,o,a,c[1]),f.fromRadians(n.west,n.north,o,a,c[2]),f.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}_o.prototype.computeDistanceToTile=function(e,t){uPe(e,this,t);const n=e.data;if(n.boundingVolumeSourceTile===void 0)return 9999999999;const o=n.tileBoundingRegion,r=o.minimumHeight,s=o.maximumHeight;if(n.boundingVolumeSourceTile!==e){const c=t.camera.positionCartographic.height,u=Math.abs(c-r),d=Math.abs(c-s);u>d?(o.minimumHeight=r,o.maximumHeight=r):(o.minimumHeight=s,o.maximumHeight=s)}const a=o.distanceToCamera(t);return o.minimumHeight=r,o.maximumHeight=s,a};function uPe(e,t,n){let i=e.data;i===void 0&&(i=e.data=new Mi);const o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new fd({computeBoundingVolumes:!1,rectangle:e.rectangle,ellipsoid:o,minimumHeight:0,maximumHeight:0}));const r=i.tileBoundingRegion,s=r.minimumHeight,a=r.maximumHeight;let c=!1,u=e;const d=i.mesh,h=i.terrainData;if(d!==void 0&&d.minimumHeight!==void 0&&d.maximumHeight!==void 0)r.minimumHeight=d.minimumHeight,r.maximumHeight=d.maximumHeight,c=!0;else if(h!==void 0&&h._minimumHeight!==void 0&&h._maximumHeight!==void 0)r.minimumHeight=h._minimumHeight,r.maximumHeight=h._maximumHeight;else{r.minimumHeight=Number.NaN,r.maximumHeight=Number.NaN;let m=e.parent;for(;m!==void 0;){const g=m.data;if(g!==void 0){const p=g.mesh,y=g.terrainData;if(p!==void 0&&p.minimumHeight!==void 0&&p.maximumHeight!==void 0){r.minimumHeight=p.minimumHeight,r.maximumHeight=p.maximumHeight;break}else if(y!==void 0&&y._minimumHeight!==void 0&&y._maximumHeight!==void 0){r.minimumHeight=y._minimumHeight,r.maximumHeight=y._maximumHeight;break}}m=m.parent}u=m}if(u!==void 0){const m=n.terrainExaggeration,g=n.terrainExaggerationRelativeHeight;if(m!==1&&(c=!1,r.minimumHeight=fp.getHeight(r.minimumHeight,m,g),r.maximumHeight=fp.getHeight(r.maximumHeight,m,g)),c)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=zt.clone(d.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=fe.clone(d.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=f.clone(d.occludeePointInScaledSpace,i.occludeePointInScaledSpace),l(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=SH(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace)));else{const y=r._orientedBoundingBox===void 0||r._boundingSphere===void 0;(r.minimumHeight!==s||r.maximumHeight!==a||y)&&(r.computeBoundingVolumes(o),i.occludeePointInScaledSpace=SH(t,r._orientedBoundingBox.center,e.rectangle,r.minimumHeight,r.maximumHeight,i.occludeePointInScaledSpace))}i.boundingVolumeSourceTile=u,i.boundingVolumeIsFromMesh=c}else i.boundingVolumeSourceTile=void 0,i.boundingVolumeIsFromMesh=!1}_o.prototype.isDestroyed=function(){return!1};_o.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),He(this)};function dPe(e,t,n){return function(i){let o,r,s=-1;const a=i.data.imagery,c=a.length;let u;for(u=0;u<c;++u)if(o=a[u],r=A(o.readyImagery,o.loadingImagery),r.imageryLayer===t){s=u;break}if(s!==-1){const d=s+e;if(o=a[d],r=l(o)?A(o.readyImagery,o.loadingImagery):void 0,!l(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,d);for(u=s;u<d;++u)a[u].freeResources();a.splice(s,e)}return!0}}_o.prototype._onLayerAdded=function(e,t){if(e.show){const n=this._terrainProvider,i=this,o=e.imageryProvider,r=this._imageryLayersUpdatedEvent;o._reload=function(){e._imageryCache={},i._quadtree.forEachLoadedTile(function(s){if(l(s._loadedCallbacks[e._layerIndex]))return;let a;const c=s.data.imagery,u=c.length;let d=-1,h=0;for(a=0;a<u;++a){const g=c[a];if(A(g.readyImagery,g.loadingImagery).imageryLayer===e)d===-1&&(d=a),++h;else if(d!==-1)break}if(d===-1)return;const m=d+h;e._createTileImagerySkeletons(s,n,m)&&(s._loadedCallbacks[e._layerIndex]=dPe(h,e,n),s.state=gl.LOADING)})},this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=gl.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==ni.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,r.raiseEvent()}};_o.prototype._onLayerRemoved=function(e,t){this._quadtree.forEachLoadedTile(function(n){const i=n.data.imagery;let o=-1,r=0;for(let s=0,a=i.length;s<a;++s){const c=i[s];let u=c.loadingImagery;if(l(u)||(u=c.readyImagery),u.imageryLayer===e)o===-1&&(o=s),c.freeResources(),++r;else if(o!==-1)break}o!==-1&&i.splice(o,r)}),l(e.imageryProvider)&&(e.imageryProvider._reload=void 0),this._imageryLayersUpdatedEvent.raiseEvent()};_o.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};_o.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const fPe=new B,hPe=new B;function vH(e,t){const 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(){const i=e.context.uniformState.view,o=B.multiplyByPoint(i,this.properties.rtc,wH);return B.setTranslation(i,o,xH),xH},u_modifiedModelViewProjection:function(){const i=e.context.uniformState.view,o=e.context.uniformState.projection,r=B.multiplyByPoint(i,this.properties.rtc,wH);return B.setTranslation(i,r,fx),B.multiply(o,fx,fx),fx},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(){const i=t._clippingPlanes;return l(i)&&l(i.texture)?i.texture:e.context.defaultTexture},u_cartographicLimitRectangle:function(){return this.properties.localizedCartographicLimitRectangle},u_clippingPlanesMatrix:function(){const i=t._clippingPlanes,o=l(i)?B.multiply(e.context.uniformState.view,i.modelMatrix,fPe):B.IDENTITY;return B.inverseTranspose(o,hPe)},u_clippingPlanesEdgeStyle:function(){const 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 H(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new j(65e5,9e6),nightFadeDistance:new j(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new f(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new f(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new f,center3D:void 0,rtc:new f,modifiedModelView:new B,tileRectangle:new oe,terrainExaggerationAndRelativeHeight:new j(1,0),dayTextures:[],dayTextureTranslationAndScale:[],dayTextureTexCoordsRectangle:[],dayTextureUseWebMercatorT:[],dayTextureAlpha:[],dayTextureNightAlpha:[],dayTextureDayAlpha:[],dayTextureBrightness:[],dayTextureContrast:[],dayTextureHue:[],dayTextureSaturation:[],dayTextureOneOverGamma:[],dayTextureSplit:[],dayTextureCutoutRectangles:[],dayIntensity:0,colorsToAlpha:[],southAndNorthLatitude:new j,southMercatorYAndOneOverHeight:new j,waterMask:void 0,waterMaskTranslationAndScale:new oe,minMaxHeight:new j,scaleAndBias:new B,clippingPlanesEdgeColor:H.clone(H.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new oe,frontFaceAlphaByDistance:new oe,backFaceAlphaByDistance:new oe,localizedTranslucencyRectangle:new oe,undergroundColor:H.clone(H.TRANSPARENT),undergroundColorAlphaByDistance:new oe,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return l(t.materialUniformMap)?hn(n,t.materialUniformMap):n}function pPe(e,t,n){const i=n.data;let o,r;if(l(i.vertexArray)?(o=i.mesh,r=i.vertexArray):l(i.fill)&&l(i.fill.vertexArray)&&(o=i.fill.mesh,r=i.fill.vertexArray),!(!l(o)||!l(r))){if(l(i.wireframeVertexArray)){if(i.wireframeVertexArray.mesh===o)return;i.wireframeVertexArray.destroy(),i.wireframeVertexArray=void 0}i.wireframeVertexArray=mPe(e,r,o),i.wireframeVertexArray.mesh=o}}function mPe(e,t,n){const o={indices:n.indices,primitiveType:Ze.TRIANGLES};Yi.toWireframe(o);const r=o.indices,s=Tt.createIndexBuffer({context:e,typedArray:r,usage:nt.STATIC_DRAW,indexDatatype:at.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new ho({context:e,attributes:t._attributes,indexBuffer:s})}let a$,c$,jw;(function(){const e=new ln({geometry:Tc.fromDimensions({dimensions:new f(2,2,2)})}),t=new ln({geometry:new vp({radius:1})});let n=new B,i,o;function r(s){return new Jt({geometryInstances:s,appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})}a$=function(s,a){return s===i||(jw(),i=s,n=B.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=pn.fromColor(a),o=r(e)),o},c$=function(s,a){return s===i||(jw(),i=s,n=B.fromTranslation(s.center,n),n=B.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=pn.fromColor(a),o=r(t)),o},jw=function(){l(o)&&(o.destroy(),o=void 0,i=void 0)}})();const _Pe=new oe(0,0,0,0),gPe={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},yPe=H.TRANSPARENT,APe=new kt;function bPe(e,t,n){const i=t.data;l(i.vertexArray)||(i.fill===void 0&&(i.fill=new eg(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(l(r)&&l(r.credits)){const xe=r.credits;for(let Oe=0,Ve=xe.length;Oe<Ve;++Oe)o.addCredit(xe[Oe])}let s=It.maximumTextureImageUnits,a=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!l(a)&&l(i.fill)&&(a=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);const u=n.cameraUnderground,d=n.globeTranslucencyState,h=d.translucent,m=d.frontFaceAlphaByDistance,g=d.backFaceAlphaByDistance,p=d.rectangle,y=A(e.undergroundColor,yPe),b=A(e.undergroundColorAlphaByDistance,APe),C=s$(e,n)&&n.mode===le.SCENE3D&&y.alpha>0&&(b.nearValue>0||b.farValue>0),E=e.lambertDiffuseMultiplier,w=e.vertexShadowDarkness,S=e.hasWaterMask&&l(a),P=e.oceanNormalMap,L=S&&l(P),z=e.terrainProvider.ready&&e.terrainProvider.hasVertexNormals,R=n.fog.enabled&&n.fog.renderable&&!u,F=e.showGroundAtmosphere&&n.mode===le.SCENE3D,U=Po.castShadows(e.shadows)&&!h,D=Po.receiveShadows(e.shadows)&&!h,I=e.hueShift,_=e.saturationShift,v=e.brightnessShift;let O=!(M.equalsEpsilon(I,0,M.EPSILON7)&&M.equalsEpsilon(_,0,M.EPSILON7)&&M.equalsEpsilon(v,0,M.EPSILON7)),N=!1;if(F){const xe=f.magnitude(n.camera.positionWC),Oe=e.nightFadeOutDistance;N=xe>Oe}S&&--s,L&&--s,l(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,l(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,s-=d.numberOfTextureUniforms;const V=i.renderedMesh;let k=V.center;const G=V.encoding,W=i.tileBoundingRegion,K=n.terrainExaggeration,q=n.terrainExaggerationRelativeHeight,te=K!==1,Y=G.hasGeodeticSurfaceNormals,X=iPe;let $=0,se=0,ue=0,re=0,he=!1;if(n.mode!==le.SCENE3D){const xe=n.mapProjection,Oe=xe.project(ge.southwest(t.rectangle),aPe),Ve=xe.project(ge.northeast(t.rectangle),cPe);if(X.x=Oe.x,X.y=Oe.y,X.z=Ve.x,X.w=Ve.y,n.mode!==le.MORPHING&&(k=sPe,k.x=0,k.y=(X.z+X.x)*.5,k.z=(X.w+X.y)*.5,X.x-=k.y,X.y-=k.z,X.z-=k.y,X.w-=k.z),n.mode===le.SCENE2D&&G.quantization===fc.BITS12){const Re=1/(Math.pow(2,12)-1)*.5,At=(X.z-X.x)*Re,xt=(X.w-X.y)*Re;X.x-=At,X.y-=xt,X.z+=At,X.w+=xt}xe instanceof di&&($=t.rectangle.south,se=t.rectangle.north,ue=di.geodeticLatitudeToMercatorAngle($),re=1/(di.geodeticLatitudeToMercatorAngle(se)-ue),he=!0)}const ce=gPe;ce.frameState=n,ce.surfaceTile=i,ce.showReflectiveOcean=S,ce.showOceanWaves=L,ce.enableLighting=e.enableLighting,ce.dynamicAtmosphereLighting=e.dynamicAtmosphereLighting,ce.dynamicAtmosphereLightingFromSun=e.dynamicAtmosphereLightingFromSun,ce.showGroundAtmosphere=F,ce.atmosphereLightIntensity=e.atmosphereLightIntensity,ce.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,ce.atmosphereMieCoefficient=e.atmosphereMieCoefficient,ce.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,ce.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,ce.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,ce.perFragmentGroundAtmosphere=N,ce.hasVertexNormals=z,ce.useWebMercatorProjection=he,ce.clippedByBoundaries=i.clippedByBoundaries,ce.hasGeodeticSurfaceNormals=Y,ce.hasExaggeration=te;const Q=i.imagery;let ne=0;const de=Q.length,_e=e.showSkirts&&!u&&!h,Se=e.backFaceCulling&&!u&&!h,ve=Se?e._renderState:e._disableCullingRenderState,Le=Se?e._blendRenderState:e._disableCullingBlendRenderState;let Ee=ve,Be=e._firstPassInitialColor;const Pe=n.context;if(l(e._debug.boundingSphereTile)||jw(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const xe=e._drawCommands.length;for(let Oe=0;Oe<xe;++Oe)e._uniformMaps[Oe]=vH(n,e)}do{let xe=0,Oe,Ve;if(e._drawCommands.length<=e._usedDrawCommands?(Oe=new mt,Oe.owner=t,Oe.cull=!1,Oe.boundingVolume=new fe,Oe.orientedBoundingBox=void 0,Ve=vH(n,e),e._drawCommands.push(Oe),e._uniformMaps.push(Ve)):(Oe=e._drawCommands[e._usedDrawCommands],Ve=e._uniformMaps[e._usedDrawCommands]),Oe.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const Tn=W.boundingVolume,Qi=W.boundingSphere;l(Tn)?a$(Tn,H.RED).update(n):l(Qi)&&c$(Qi,H.RED).update(n)}const Re=Ve.properties;oe.clone(Be,Re.initialColor),Re.oceanNormalMap=P,Re.lightingFadeDistance.x=e.lightingFadeOutDistance,Re.lightingFadeDistance.y=e.lightingFadeInDistance,Re.nightFadeDistance.x=e.nightFadeOutDistance,Re.nightFadeDistance.y=e.nightFadeInDistance,Re.atmosphereLightIntensity=e.atmosphereLightIntensity,Re.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,Re.atmosphereMieCoefficient=e.atmosphereMieCoefficient,Re.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,Re.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,Re.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,Re.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const At=u?g:m,xt=u?m:g;l(At)&&(oe.fromElements(At.near,At.nearValue,At.far,At.farValue,Re.frontFaceAlphaByDistance),oe.fromElements(xt.near,xt.nearValue,xt.far,xt.farValue,Re.backFaceAlphaByDistance)),oe.fromElements(b.near,b.nearValue,b.far,b.farValue,Re.undergroundColorAlphaByDistance),H.clone(y,Re.undergroundColor),Re.lambertDiffuseMultiplier=E,Re.vertexShadowDarkness=w;const Nt=!l(i.vertexArray)&&l(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Nt&&H.clone(e.fillHighlightColor,Re.fillHighlightColor),Re.terrainExaggerationAndRelativeHeight.x=K,Re.terrainExaggerationAndRelativeHeight.y=q,Re.center3D=V.center,f.clone(k,Re.rtc),oe.clone(X,Re.tileRectangle),Re.southAndNorthLatitude.x=$,Re.southAndNorthLatitude.y=se,Re.southMercatorYAndOneOverHeight.x=ue,Re.southMercatorYAndOneOverHeight.y=re;const On=oPe,Nn=Ww(t.rectangle,e.cartographicLimitRectangle),Sn=rPe,un=Ww(t.rectangle,p);f.fromElements(I,_,v,Re.hsbShift);const Ht=t.rectangle,vn=1/Ht.width,Pn=1/Ht.height;On.x=(Nn.west-Ht.west)*vn,On.y=(Nn.south-Ht.south)*Pn,On.z=(Nn.east-Ht.west)*vn,On.w=(Nn.north-Ht.south)*Pn,oe.clone(On,Re.localizedCartographicLimitRectangle),Sn.x=(un.west-Ht.west)*vn,Sn.y=(un.south-Ht.south)*Pn,Sn.z=(un.east-Ht.west)*vn,Sn.w=(un.north-Ht.south)*Pn,oe.clone(Sn,Re.localizedTranslucencyRectangle);const qt=R&&M.fog(t._distance,n.fog.density)>M.EPSILON3;O=O&&(qt||F);let tn=!1,jn=!1,hi=!1,sn=!1,zi=!1,oo=!1,Wi=!1,li=!1,mn=!1,Kn=!1;for(;xe<s&&ne<de;){const Tn=Q[ne],Qi=Tn.readyImagery;if(++ne,!l(Qi)||Qi.imageryLayer.alpha===0)continue;const Fn=Tn.useWebMercatorT?Qi.textureWebMercator:Qi.texture;if(!l(Fn))throw new x("readyImagery is not actually ready!");const ji=Qi.imageryLayer;l(Tn.textureTranslationAndScale)||(Tn.textureTranslationAndScale=ji._calculateTextureTranslationAndScale(t,Tn)),Re.dayTextures[xe]=Fn,Re.dayTextureTranslationAndScale[xe]=Tn.textureTranslationAndScale,Re.dayTextureTexCoordsRectangle[xe]=Tn.textureCoordinateRectangle,Re.dayTextureUseWebMercatorT[xe]=Tn.useWebMercatorT,Re.dayTextureAlpha[xe]=ji.alpha,oo=oo||Re.dayTextureAlpha[xe]!==1,Re.dayTextureNightAlpha[xe]=ji.nightAlpha,Wi=Wi||Re.dayTextureNightAlpha[xe]!==1,Re.dayTextureDayAlpha[xe]=ji.dayAlpha,Wi=Wi||Re.dayTextureDayAlpha[xe]!==1,Re.dayTextureBrightness[xe]=ji.brightness,tn=tn||Re.dayTextureBrightness[xe]!==Vn.DEFAULT_BRIGHTNESS,Re.dayTextureContrast[xe]=ji.contrast,jn=jn||Re.dayTextureContrast[xe]!==Vn.DEFAULT_CONTRAST,Re.dayTextureHue[xe]=ji.hue,hi=hi||Re.dayTextureHue[xe]!==Vn.DEFAULT_HUE,Re.dayTextureSaturation[xe]=ji.saturation,sn=sn||Re.dayTextureSaturation[xe]!==Vn.DEFAULT_SATURATION,Re.dayTextureOneOverGamma[xe]=1/ji.gamma,zi=zi||Re.dayTextureOneOverGamma[xe]!==1/Vn.DEFAULT_GAMMA,Re.dayTextureSplit[xe]=ji.splitDirection,li=li||Re.dayTextureSplit[xe]!==0;let Lo=Re.dayTextureCutoutRectangles[xe];if(l(Lo)||(Lo=Re.dayTextureCutoutRectangles[xe]=new oe),oe.clone(oe.ZERO,Lo),l(ji.cutoutRectangle)){const Zi=Ww(Ht,ji.cutoutRectangle),qi=ge.simpleIntersection(Zi,Ht,r$);mn=l(qi)||mn,Lo.x=(Zi.west-Ht.west)*vn,Lo.y=(Zi.south-Ht.south)*Pn,Lo.z=(Zi.east-Ht.west)*vn,Lo.w=(Zi.north-Ht.south)*Pn}let po=Re.colorsToAlpha[xe];l(po)||(po=Re.colorsToAlpha[xe]=new oe);const Ur=l(ji.colorToAlpha)&&ji.colorToAlphaThreshold>0;if(Kn=Kn||Ur,Ur){const Zi=ji.colorToAlpha;po.x=Zi.red,po.y=Zi.green,po.z=Zi.blue,po.w=ji.colorToAlphaThreshold}else po.w=-1;if(l(Qi.credits)){const Zi=Qi.credits;for(let qi=0,Hr=Zi.length;qi<Hr;++qi)o.addCredit(Zi[qi])}++xe}Re.dayTextures.length=xe,Re.waterMask=a,oe.clone(c,Re.waterMaskTranslationAndScale),Re.minMaxHeight.x=G.minimumHeight,Re.minMaxHeight.y=G.maximumHeight,B.clone(G.matrix,Re.scaleAndBias);const Hn=e._clippingPlanes,dn=l(Hn)&&Hn.enabled&&t.isClipped;dn&&(Re.clippingPlanesEdgeColor=H.clone(Hn.edgeColor,Re.clippingPlanesEdgeColor),Re.clippingPlanesEdgeWidth=Hn.edgeWidth),ce.numberOfDayTextures=xe,ce.applyBrightness=tn,ce.applyContrast=jn,ce.applyHue=hi,ce.applySaturation=sn,ce.applyGamma=zi,ce.applyAlpha=oo,ce.applyDayNightAlpha=Wi,ce.applySplit=li,ce.enableFog=qt,ce.enableClippingPlanes=dn,ce.clippingPlanes=Hn,ce.hasImageryLayerCutout=mn,ce.colorCorrect=O,ce.highlightFillTile=Nt,ce.colorToAlpha=Kn,ce.showUndergroundColor=C,ce.translucent=h;let bt=i.renderedMesh.indices.length;_e||(bt=i.renderedMesh.indexCountWithoutSkirts),Oe.shaderProgram=e._surfaceShaderSet.getShaderProgram(ce),Oe.castShadows=U,Oe.receiveShadows=D,Oe.renderState=Ee,Oe.primitiveType=Ze.TRIANGLES,Oe.vertexArray=i.vertexArray||i.fill.vertexArray,Oe.count=bt,Oe.uniformMap=Ve,Oe.pass=Ne.GLOBE,e._debug.wireframe&&(pPe(Pe,e,t),l(i.wireframeVertexArray)&&(Oe.vertexArray=i.wireframeVertexArray,Oe.primitiveType=Ze.LINES,Oe.count=bt*2));let Ge=Oe.boundingVolume;const Mn=Oe.orientedBoundingBox;n.mode!==le.SCENE3D?(fe.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,W.minimumHeight,W.maximumHeight,Ge),f.fromElements(Ge.center.z,Ge.center.x,Ge.center.y,Ge.center),n.mode===le.MORPHING&&(Ge=fe.union(W.boundingSphere,Ge,Ge))):(Oe.boundingVolume=fe.clone(W.boundingSphere,Ge),Oe.orientedBoundingBox=zt.clone(W.boundingVolume,Mn)),Oe.dirty=!0,h&&d.updateDerivedCommands(Oe,n),o$(Oe,n),Ee=Le,Be=_Pe}while(ne<de)}function l$(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=ge.clone(ge.MAX_VALUE)}Object.defineProperties(l$.prototype,{enabled:{get:function(){return this._enabled},set:function(e){T.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){T.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),T.typeOf.number.lessThanOrEquals("frontFaceAlpha",e,1),this._frontFaceAlpha=e}},frontFaceAlphaByDistance:{get:function(){return this._frontFaceAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new x("far distance must be greater than near distance.");this._frontFaceAlphaByDistance=kt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){T.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),T.typeOf.number.lessThanOrEquals("backFaceAlpha",e,1),this._backFaceAlpha=e}},backFaceAlphaByDistance:{get:function(){return this._backFaceAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new x("far distance must be greater than near distance.");this._backFaceAlphaByDistance=kt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){l(e)||(e=ge.clone(ge.MAX_VALUE)),ge.clone(e,this._rectangle)}}});function Fr(){this._layers=[],this.layerAdded=new Ke,this.layerRemoved=new Ke,this.layerMoved=new Ke,this.layerShownOrHidden=new Ke}Object.defineProperties(Fr.prototype,{length:{get:function(){return this._layers.length}}});Fr.prototype.add=function(e,t){const n=l(t);if(!l(e))throw new x("layer is required.");if(n){if(t<0)throw new x("index must be greater than or equal to zero.");if(t>this._layers.length)throw new x("index must be less than or equal to the number of layers.")}n?this._layers.splice(t,0,e):(t=this._layers.length,this._layers.push(e)),this._update(),this.layerAdded.raiseEvent(e,t)};Fr.prototype.addImageryProvider=function(e,t){if(!l(e))throw new x("imageryProvider is required.");const n=new Vn(e);return this.add(n,t),n};Fr.prototype.remove=function(e,t){t=A(t,!0);const 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};Fr.prototype.removeAll=function(e){e=A(e,!0);const t=this._layers;for(let n=0,i=t.length;n<i;n++){const o=t[n];this.layerRemoved.raiseEvent(o,n),e&&o.destroy()}this._layers=[]};Fr.prototype.contains=function(e){return this.indexOf(e)!==-1};Fr.prototype.indexOf=function(e){return this._layers.indexOf(e)};Fr.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._layers[e]};function gD(e,t){if(!l(t))throw new x("layer is required.");const n=e.indexOf(t);if(n===-1)throw new x("layer is not in this collection.");return n}function u$(e,t,n){const i=e._layers;if(t=M.clamp(t,0,i.length-1),n=M.clamp(n,0,i.length-1),t===n)return;const o=i[t];i[t]=i[n],i[n]=o,e._update(),e.layerMoved.raiseEvent(o,n,t)}Fr.prototype.raise=function(e){const t=gD(this._layers,e);u$(this,t,t+1)};Fr.prototype.lower=function(e){const t=gD(this._layers,e);u$(this,t,t-1)};Fr.prototype.raiseToTop=function(e){const t=gD(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))};Fr.prototype.lowerToBottom=function(e){const t=gD(this._layers,e);t!==0&&(this._layers.splice(t,1),this._layers.splice(0,0,e),this._update(),this.layerMoved.raiseEvent(e,0,t))};const CPe=new ge;function d$(e,t,n,i){const o=e.globe._surface._tilesToRender;let r;for(let a=0;!l(r)&&a<o.length;++a){const c=o[a];ge.contains(c.rectangle,t)&&(r=c)}if(!l(r))return;const s=r.data.imagery;for(let a=s.length-1;a>=0;--a){const c=s[a],u=c.readyImagery;if(!l(u))continue;const d=u.imageryLayer.imageryProvider;if(n&&!l(d.pickFeatures)||!ge.contains(u.rectangle,t))continue;const h=CPe,m=1/1024;h.west=M.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.x-m),h.east=M.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.z+m),h.south=M.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.y-m),h.north=M.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.w+m),ge.contains(h,t)&&i(u)}}Fr.prototype.pickImageryLayers=function(e,t){const n=t.globe.pick(e,t);if(!l(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[];if(d$(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};Fr.prototype.pickImageryLayerFeatures=function(e,t){const n=t.globe.pick(e,t);if(!l(n))return;const i=t.globe.ellipsoid.cartesianToCartographic(n),o=[],r=[];if(d$(t,i,!0,function(s){const c=s.imageryLayer.imageryProvider.pickFeatures(s.x,s.y,s.level,i.longitude,i.latitude);l(c)&&(o.push(c),r.push(s.imageryLayer))}),o.length!==0)return Promise.all(o).then(function(s){const a=[];for(let c=0;c<s.length;++c){const u=s[c],d=r[c];if(l(u)&&u.length>0)for(let h=0;h<u.length;++h){const m=u[h];m.imageryLayer=d,l(m.position)||(m.position=i),a.push(m)}}return a})};Fr.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};Fr.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};Fr.prototype.isDestroyed=function(){return!1};Fr.prototype.destroy=function(){return this.removeAll(!0),He(this)};Fr.prototype._update=function(){let e=!0;const t=this._layers;let 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&&(l(i._show)&&(l(n)||(n=[]),n.push(i)),i._show=i.show);if(l(n))for(o=0,r=n.length;o<r;++o)i=n[o],this.layerShownOrHidden.raiseEvent(i,i._layerIndex,i.show)};function f$(e){this._ellipsoid=new El(e.ellipsoid,f.ZERO)}Object.defineProperties(f$.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});function Da(e){if(!l(e))throw new x("options is required.");if(l(e.x))if(l(e.y)){if(e.x<0||e.y<0)throw new x("options.x and options.y must be greater than or equal to zero.")}else throw new x("options.y is required.");else throw new x("options.x is required.");if(!l(e.level))throw new x("options.level is required and must be greater than or equal to zero.");if(!l(e.tilingScheme))throw new x("options.tilingScheme is required.");this._tilingScheme=e.tilingScheme,this._x=e.x,this._y=e.y,this._level=e.level,this._parent=e.parent,this._rectangle=this._tilingScheme.tileXYToRectangle(this._x,this._y,this._level),this._southwestChild=void 0,this._southeastChild=void 0,this._northwestChild=void 0,this._northeastChild=void 0,this.replacementPrevious=void 0,this.replacementNext=void 0,this._distance=0,this._loadPriority=0,this._customData=[],this._frameUpdated=void 0,this._lastSelectionResult=ni.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=gl.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}Da.createLevelZeroTiles=function(e){if(!l(e))throw new x("tilingScheme is required.");const t=e.getNumberOfXTilesAtLevel(0),n=e.getNumberOfYTilesAtLevel(0),i=new Array(t*n);let o=0;for(let r=0;r<n;++r)for(let s=0;s<t;++s)i[o++]=new Da({tilingScheme:e,x:s,y:r,level:0});return i};Da.prototype._updateCustomData=function(e,t,n){let i=this.customData,o,r,s;if(l(t)&&l(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],ge.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=e}else{const a=this._parent;if(l(a)&&this._frameUpdated!==a._frameUpdated){i.length=0,s=this._rectangle;const c=a.customData;for(o=0;o<c.length;++o)r=c[o],ge.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(Da.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 l(this._southwestChild)||(this._southwestChild=new Da({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2+1,level:this.level+1,parent:this})),this._southwestChild}},southeastChild:{get:function(){return l(this._southeastChild)||(this._southeastChild=new Da({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 l(this._northwestChild)||(this._northwestChild=new Da({tilingScheme:this.tilingScheme,x:this.x*2,y:this.y*2,level:this.level+1,parent:this})),this._northwestChild}},northeastChild:{get:function(){return l(this._northeastChild)||(this._northeastChild=new Da({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<gl.DONE}},eligibleForUnloading:{get:function(){let e=!0;return l(this.data)&&(e=this.data.eligibleForUnloading,l(e)||(e=!0)),e}}});Da.prototype.findLevelZeroTile=function(e,t,n){const 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]};Da.prototype.findTileToWest=function(e){const 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;const n=t.findTileToWest(e);if(n!==void 0)return t.southwestChild===this?n.southeastChild:n.northeastChild};Da.prototype.findTileToEast=function(e){const 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;const n=t.findTileToEast(e);if(n!==void 0)return t.southeastChild===this?n.southwestChild:n.northwestChild};Da.prototype.findTileToSouth=function(e){const 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;const n=t.findTileToSouth(e);if(n!==void 0)return t.southwestChild===this?n.northwestChild:n.northeastChild};Da.prototype.findTileToNorth=function(e){const 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;const n=t.findTileToNorth(e);if(n!==void 0)return t.northwestChild===this?n.southwestChild:n.southeastChild};Da.prototype.freeResources=function(){this.state=gl.START,this.renderable=!1,this.upsampledFromParent=!1,l(this.data)&&l(this.data.freeResources)&&this.data.freeResources(),hx(this._southwestChild),this._southwestChild=void 0,hx(this._southeastChild),this._southeastChild=void 0,hx(this._northwestChild),this._northwestChild=void 0,hx(this._northeastChild),this._northeastChild=void 0};function hx(e){l(e)&&e.freeResources()}function yD(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}yD.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};yD.prototype.trimTiles=function(e){let t=this.tail,n=!0;for(;n&&l(this._lastBeforeStartOfFrame)&&this.count>e&&l(t);){n=t!==this._lastBeforeStartOfFrame;const i=t.replacementPrevious;t.eligibleForUnloading&&(t.freeResources(),h$(this,t)),t=i}};function h$(e,t){const 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}yD.prototype.markTileRendered=function(e){const t=this.head;if(t===e){e===this._lastBeforeStartOfFrame&&(this._lastBeforeStartOfFrame=e.replacementNext);return}if(++this.count,!l(t)){e.replacementPrevious=void 0,e.replacementNext=void 0,this.head=e,this.tail=e;return}(l(e.replacementPrevious)||l(e.replacementNext))&&h$(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};function xl(e){if(!l(e)||!l(e.tileProvider))throw new x("options.tileProvider is required.");if(l(e.tileProvider.quadtree))throw new x("A QuadtreeTileProvider can only be used with a single QuadtreePrimitive");this._tileProvider=e.tileProvider,this._tileProvider.quadtree=this,this._debug={enableDebugOutput:!1,maxDepth:0,maxDepthVisited:0,tilesVisited:0,tilesCulled:0,tilesRendered:0,tilesWaitingForChildren:0,lastMaxDepth:-1,lastMaxDepthVisited:-1,lastTilesVisited:-1,lastTilesCulled:-1,lastTilesRendered:-1,lastTilesWaitingForChildren:-1,suspendLodUpdate:!1};const n=this._tileProvider.tilingScheme.ellipsoid;this._tilesToRender=[],this._tileLoadQueueHigh=[],this._tileLoadQueueMedium=[],this._tileLoadQueueLow=[],this._tileReplacementQueue=new yD,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=A(e.maximumScreenSpaceError,2),this.tileCacheSize=A(e.tileCacheSize,100),this.loadingDescendantLimit=20,this.preloadAncestors=!0,this.preloadSiblings=!1,this._occluders=new f$({ellipsoid:n}),this._tileLoadProgressEvent=new Ke,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(xl.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});xl.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function TPe(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,p$(e);const n=e._levelZeroTiles;if(l(n))for(let i=0;i<n.length;++i){const r=n[i].customData,s=r.length;for(let a=0;a<s;++a){const c=r[a];c.level=0,e._addHeightCallbacks.push(c)}n[i].freeResources()}e._levelZeroTiles=void 0,e._tileProvider.cancelReprojections()}xl.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;l(t);)t.state!==gl.START&&e(t),t=t.replacementNext};xl.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};xl.prototype.updateHeight=function(e,t){const n=this,i={positionOnEllipsoidSurface:void 0,positionCartographic:e,level:-1,callback:t};return i.removeFunc=function(){const 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};xl.prototype.update=function(e){l(this._tileProvider.update)&&this._tileProvider.update(e)};function p$(e){const 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}xl.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(TPe(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),p$(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};xl.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),SPe(this,e),MPe(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function EPe(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const o=Ke.prototype.raiseEvent.bind(e._tileLoadProgressEvent,n);t.afterRender.push(()=>(o(),!0)),e._lastTileLoadQueueLength=n}const 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))}xl.prototype.endFrame=function(e){!e.passes.render||e.mode===le.MORPHING||(LPe(this,e),NPe(this,e),EPe(this,e))};xl.prototype.isDestroyed=function(){return!1};xl.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};let rb;const DH=new Ce;function xPe(e,t){let n=ge.center(e.rectangle,DH);const i=n.longitude-rb.longitude,o=n.latitude-rb.latitude;n=ge.center(t.rectangle,DH);const r=n.longitude-rb.longitude,s=n.latitude-rb.latitude;return i*i+o*o-(r*r+s*s)}const wPe=new f;let gA=[];function SPe(e,t){const n=e._debug;if(n.suspendLodUpdate)return;const i=e._tilesToRender;i.length=0;let o;const r=e._tileProvider;if(!l(e._levelZeroTiles))if(r.ready){const y=r.tilingScheme;e._levelZeroTiles=Da.createLevelZeroTiles(y);const b=e._levelZeroTiles.length;if(gA.length<b)for(gA=new Array(b),o=0;o<b;++o)gA[o]===void 0&&(gA[o]=new sb)}else return;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s;const a=e._levelZeroTiles,c=a.length>1?e._occluders:void 0;rb=t.camera.positionCartographic,a.sort(xPe);const u=e._addHeightCallbacks,d=e._removeHeightCallbacks,h=t.frameNumber;let m;if(u.length>0||d.length>0){for(o=0,m=a.length;o<m;++o)s=a[o],s._updateCustomData(h,u,d);u.length=0,d.length=0}const g=t.camera;e._cameraPositionCartographic=g.positionCartographic;const p=B.getTranslation(g.transform,wPe);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),o=0,m=a.length;o<m;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?Es(e,s,r,t,c,!1,gA[o]):(tf(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=h}function tf(e,t,n,i){n.needsLoading&&(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function sb(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function m$(){this.southwest=new sb,this.southeast=new sb,this.northwest=new sb,this.northeast=new sb}m$.prototype.combine=function(e){const 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};const FB=new Array(31);for(let e=0;e<FB.length;++e)FB[e]=new m$;function vPe(e,t,n,i,o){const r=e._debug;++r.tilesVisited,e._tileReplacementQueue.markTileRendered(n),n._updateCustomData(t.frameNumber),n.level>r.maxDepthVisited&&(r.maxDepthVisited=n.level);const s=PPe(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,c=n.southeastChild,u=n.northwestChild,d=n.northeastChild,h=e._lastSelectionFrameNumber,m=n._lastSelectionResultFrame===h?n._lastSelectionResult:ni.NONE,g=e.tileProvider;if(s||i){const p=ni.originalResult(m)===ni.RENDERED,y=ni.originalResult(m)===ni.CULLED||m===ni.NONE,b=n.state===gl.DONE;let C=p||y||b;if(C||l(g.canRenderWithoutLosingDetail)&&(C=g.canRenderWithoutLosingDetail(n)),C){s&&tf(e,e._tileLoadQueueMedium,n,t),px(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=m===ni.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=ni.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&tf(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent&&d.upsampledFromParent){px(e,n),tf(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(d),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=m===ni.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=ni.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=ni.REFINED;const y=e._tilesToRender.length,b=e._tileLoadQueueLow.length,C=e._tileLoadQueueMedium.length,E=e._tileLoadQueueHigh.length,w=e._tileToUpdateHeights.length;if(DPe(e,a,c,u,d,t,i,o),y!==e._tilesToRender.length){const S=o.allAreRenderable,P=o.anyWereRenderedLastFrame,L=o.notYetRenderableCount;let z=!1;if(!S&&!P){const R=e._tilesToRender;for(let U=y;U<R.length;++U){let D=R[U];for(;D!==void 0&&D._lastSelectionResult!==ni.KICKED&&D!==n;)D._lastSelectionResult=ni.kick(D._lastSelectionResult),D=D.parent}e._tilesToRender.length=y,e._tileToUpdateHeights.length=w,px(e,n),n._lastSelectionResult=ni.RENDERED;const F=m===ni.RENDERED;!F&&L>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=b,e._tileLoadQueueMedium.length=C,e._tileLoadQueueHigh.length=E,tf(e,e._tileLoadQueueMedium,n,t),o.notYetRenderableCount=n.renderable?0:1,z=!0),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=F,F||e._tileToUpdateHeights.push(n),++r.tilesWaitingForChildren}e.preloadAncestors&&!z&&tf(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=ni.RENDERED,px(e,n),tf(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=m===ni.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function DPe(e,t,n,i,o,r,s,a){const c=r.camera.positionCartographic,u=e._tileProvider,d=e._occluders,h=FB[t.level],m=h.southwest,g=h.southeast,p=h.northwest,y=h.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(Es(e,t,u,r,d,s,m),Es(e,n,u,r,d,s,g),Es(e,i,u,r,d,s,p),Es(e,o,u,r,d,s,y)):(Es(e,i,u,r,d,s,p),Es(e,t,u,r,d,s,m),Es(e,o,u,r,d,s,y),Es(e,n,u,r,d,s,g)):c.latitude<t.rectangle.north?(Es(e,n,u,r,d,s,g),Es(e,t,u,r,d,s,m),Es(e,o,u,r,d,s,y),Es(e,i,u,r,d,s,p)):(Es(e,o,u,r,d,s,y),Es(e,i,u,r,d,s,p),Es(e,n,u,r,d,s,g),Es(e,t,u,r,d,s,m)),h.combine(a)}function IPe(e,t){const n=t.rectangle;return l(e._cameraPositionCartographic)&&ge.contains(n,e._cameraPositionCartographic)||l(e._cameraReferenceFrameOriginCartographic)&&ge.contains(n,e._cameraReferenceFrameOriginCartographic)}function Es(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==Wr.NONE)return vPe(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,IPe(e,t)){(!l(t.data)||!l(t.data.vertexArray))&&tf(e,e._tileLoadQueueMedium,t,i);const a=e._lastSelectionFrameNumber,c=t._lastSelectionResultFrame===a?t._lastSelectionResult:ni.NONE;c!==ni.CULLED_BUT_NEEDED&&c!==ni.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=ni.CULLED_BUT_NEEDED}else(e.preloadSiblings||t.level===0)&&tf(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=ni.CULLED;t._lastSelectionResultFrame=i.frameNumber}function PPe(e,t,n){if(t.mode===le.SCENE2D||t.camera.frustum instanceof Gt||t.camera.frustum instanceof Wo)return OPe(e,t,n);const i=e._tileProvider.getLevelMaximumGeometricError(n.level),o=n._distance,r=t.context.drawingBufferHeight,s=t.camera.frustum.sseDenominator;let a=i*r/(o*s);return t.fog.enabled&&(a-=M.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function OPe(e,t,n){let o=t.camera.frustum;l(o._offCenterFrustum)&&(o=o._offCenterFrustum);const r=t.context,s=r.drawingBufferWidth,a=r.drawingBufferHeight,c=e._tileProvider.getLevelMaximumGeometricError(n.level),u=Math.max(o.top-o.bottom,o.right-o.left)/Math.max(s,a);let d=c/u;return t.fog.enabled&&t.mode!==le.SCENE2D&&(d-=M.fog(n._distance,t.fog.density)*t.fog.sse),d/=t.pixelRatio,d}function px(e,t){e._tilesToRender.push(t)}function LPe(e,t){const 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);const r=fr()+e._loadQueueTimeSlice,s=e._tileProvider;let a=X1(e,t,s,r,n,!1);a=X1(e,t,s,r,i,a),X1(e,t,s,r,o,a)}function BPe(e,t){return e._loadPriority-t._loadPriority}function X1(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(BPe);for(let s=0,a=o.length;s<a&&(fr()<i||!r);++s){const c=o[s];e._tileReplacementQueue.markTileRendered(c),n.loadTile(t,c),r=!0}return r}const Rg=new Un,K1=new Ce,Ch=new f,RPe=[];function NPe(e,t){if(!e.tileProvider.ready)return;const n=RPe;n.length=0;const i=e._tileToUpdateHeights,o=fr(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,c=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid;let d;for(;i.length>0;){const h=i[0];if(!l(h.data)||!l(h.data.mesh)){const y=h._lastSelectionResultFrame===e._lastSelectionFrameNumber?h._lastSelectionResult:ni.NONE;(y===ni.RENDERED||y===ni.CULLED_BUT_NEEDED)&&n.push(h),i.shift(),e._lastTileIndex=0;continue}const m=h.customData,g=m.length;let p=!1;for(d=e._lastTileIndex;d<g;++d){const y=m[d],b=h.data.terrainData,C=l(b)&&b.wasCreatedByUpsampling();if(h.level>y.level&&!C){if(l(y.positionOnEllipsoidSurface)||(y.positionOnEllipsoidSurface=f.fromRadians(y.positionCartographic.longitude,y.positionCartographic.latitude,0,u)),a===le.SCENE3D){const w=u.geodeticSurfaceNormal(y.positionOnEllipsoidSurface,Rg.direction),S=u.getSurfaceNormalIntersectionWithZAxis(y.positionOnEllipsoidSurface,11500,Rg.origin);if(!l(S)){let P=0;l(h.data.tileBoundingRegion)&&(P=h.data.tileBoundingRegion.minimumHeight);const L=Math.min(P,-11500),z=f.multiplyByScalar(w,Math.abs(L)+1,Ch);f.subtract(y.positionOnEllipsoidSurface,z,Rg.origin)}}else Ce.clone(y.positionCartographic,K1),K1.height=-11500,c.project(K1,Ch),f.fromElements(Ch.z,Ch.x,Ch.y,Ch),f.clone(Ch,Rg.origin),f.clone(f.UNIT_X,Rg.direction);const E=h.data.pick(Rg,a,c,!1,Ch);l(E)&&(l(y.callback)&&y.callback(E),y.level=h.level)}if(fr()>=s){p=!0;break}}if(p){e._lastTileIndex=d;break}else e._lastTileIndex=0,i.shift()}for(d=0;d<n.length;d++)i.push(n[d])}function MPe(e,t){const n=e._tileProvider,i=e._tilesToRender;for(let o=0,r=i.length;o<r;++o){const s=i[o];n.showTileThisFrame(s,t)}}function Eu(e){e=A(e,me.WGS84);const t=new Jp({ellipsoid:e}),n=new Fr;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new HM,this._material=void 0,this._surface=new xl({tileProvider:new _o({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new Ke,this._undergroundColor=H.clone(H.BLACK),this._undergroundColorAlphaByDistance=new kt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new l$,zB(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Me({url:An("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 f(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new f(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=Po.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(Eu.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 l(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){l(e)||(e=ge.clone(ge.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),l(this._material)&&zB(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,zB(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=H.clone(e,this._undergroundColor)}},undergroundColorAlphaByDistance:{get:function(){return this._undergroundColorAlphaByDistance},set:function(e){if(l(e)&&e.far<e.near)throw new x("far distance must be greater than near distance.");this._undergroundColorAlphaByDistance=kt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function zB(e){const t=[],n=l(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),i=[WS,JU];l(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(gEe),e._surfaceShaderSet.baseVertexShaderSource=new We({sources:[WS,JU,yEe],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new We({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function FPe(e){return function(t,n){const i=fe.distanceSquaredTo(t.pickBoundingSphere,e),o=fe.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}const zPe=[],UPe={start:0,stop:0};Eu.prototype.pickWorldCoordinates=function(e,t,n,i){if(!l(e))throw new x("ray is required");if(!l(t))throw new x("scene is required");n=A(n,!0);const o=t.mode,r=t.mapProjection,s=zPe;s.length=0;const a=this._surface._tilesToRender;let c=a.length,u,d;for(d=0;d<c;++d){u=a[d];const m=u.data;if(!l(m))continue;let g=m.pickBoundingSphere;if(o!==le.SCENE3D)m.pickBoundingSphere=g=fe.fromRectangleWithHeights2D(u.rectangle,r,m.tileBoundingRegion.minimumHeight,m.tileBoundingRegion.maximumHeight,g),f.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(l(m.renderedMesh))fe.clone(m.tileBoundingRegion.boundingSphere,g);else continue;const p=pr.raySphere(e,g,UPe);l(p)&&s.push(m)}s.sort(FPe(e.origin));let h;for(c=s.length,d=0;d<c&&(h=s[d].pick(e,t.mode,t.mapProjection,n,i),!l(h));++d);return h};const HPe=new Ce;Eu.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),l(n)&&t.mode!==le.SCENE3D){n=f.fromElements(n.y,n.z,n.x,n);const i=t.mapProjection.unproject(n,HPe);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};const VPe=new f,IH=new f,kPe=new Ce,GPe=new Un;function J1(e,t){return l(e)&&ge.contains(e.rectangle,t)?e:void 0}Eu.prototype.getHeight=function(e){if(!l(e))throw new x("cartographic is required");const t=this._surface._levelZeroTiles;if(!l(t))return;let n,i;const o=t.length;for(i=0;i<o&&(n=t[i],!ge.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;l(n);)n=J1(n._southwestChild,e)||J1(n._southeastChild,e)||J1(n._northwestChild,e)||n._northeastChild,l(n)&&l(n.data)&&l(n.data.renderedMesh)&&(r=n);if(n=r,!l(n)||!l(n.data)||!l(n.data.renderedMesh))return;const s=this._surface._tileProvider.tilingScheme.projection,a=this._surface._tileProvider.tilingScheme.ellipsoid,c=f.fromRadians(e.longitude,e.latitude,0,a,VPe),u=GPe,d=a.geodeticSurfaceNormal(c,u.direction),h=a.getSurfaceNormalIntersectionWithZAxis(c,11500,u.origin);if(!l(h)){let g;l(n.data.tileBoundingRegion)&&(g=n.data.tileBoundingRegion.minimumHeight);const p=Math.min(A(g,0),-11500),y=f.multiplyByScalar(d,Math.abs(p)+1,IH);f.subtract(c,y,u.origin)}const m=n.data.pick(u,void 0,s,!1,IH);if(l(m))return a.cartesianToCartographic(m,kPe).height};Eu.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)};Eu.prototype.beginFrame=function(e){const t=this._surface,n=t.tileProvider,i=this.terrainProvider,o=this.showWaterEffect&&i.ready&&i.hasWaterMask;if(o&&this._oceanNormalMapResourceDirty){this._oceanNormalMapResourceDirty=!1;const a=this._oceanNormalMapResource,c=a.url;if(l(c)){const u=this;a.fetchImage().then(function(d){c===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new Wt({context:e.context,source:d}))})}else this._oceanNormalMap=this._oceanNormalMap&&this._oceanNormalMap.destroy()}const 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===le.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))};Eu.prototype.render=function(e){this.show&&(l(this._material)&&this._material.update(e.context),this._surface.render(e))};Eu.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)};Eu.prototype.isDestroyed=function(){return!1};Eu.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(),He(this)};function WPe(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}const _$={},jPe=32.184,qPe=2451545,PH=-.0529921,OH=-.1059842,LH=13.0120009,BH=13.3407154,RH=.9856003,NH=26.4057084,MH=13.064993,FH=.3287146,zH=1.7484877,UH=-.1589763,HH=.0036096,VH=.1643573,kH=12.9590088;let Q1=new ie;_$.ComputeMoon=function(e,t){l(e)||(e=ie.now()),Q1=ie.addSeconds(e,jPe,Q1);const n=ie.totalDays(Q1)-qPe,i=n/Ni.DAYS_PER_JULIAN_CENTURY,o=(125.045+PH*n)*M.RADIANS_PER_DEGREE,r=(250.089+OH*n)*M.RADIANS_PER_DEGREE,s=(260.008+LH*n)*M.RADIANS_PER_DEGREE,a=(176.625+BH*n)*M.RADIANS_PER_DEGREE,c=(357.529+RH*n)*M.RADIANS_PER_DEGREE,u=(311.589+NH*n)*M.RADIANS_PER_DEGREE,d=(134.963+MH*n)*M.RADIANS_PER_DEGREE,h=(276.617+FH*n)*M.RADIANS_PER_DEGREE,m=(34.226+zH*n)*M.RADIANS_PER_DEGREE,g=(15.134+UH*n)*M.RADIANS_PER_DEGREE,p=(119.743+HH*n)*M.RADIANS_PER_DEGREE,y=(239.961+VH*n)*M.RADIANS_PER_DEGREE,b=(25.053+kH*n)*M.RADIANS_PER_DEGREE,C=Math.sin(o),E=Math.sin(r),w=Math.sin(s),S=Math.sin(a),P=Math.sin(c),L=Math.sin(u),z=Math.sin(d),R=Math.sin(h),F=Math.sin(m),U=Math.sin(g),D=Math.sin(p),I=Math.sin(y),_=Math.sin(b),v=Math.cos(o),O=Math.cos(r),N=Math.cos(s),V=Math.cos(a),k=Math.cos(c),G=Math.cos(u),W=Math.cos(d),K=Math.cos(h),q=Math.cos(m),te=Math.cos(g),Y=Math.cos(p),X=Math.cos(y),$=Math.cos(b),se=(269.9949+.0031*i-3.8787*C-.1204*E+.07*w-.0172*S+.0072*L-.0052*U+.0043*_)*M.RADIANS_PER_DEGREE,ue=(66.5392+.013*i+1.5419*v+.0239*O-.0278*N+.0068*V-.0029*G+9e-4*W+8e-4*te-9e-4*$)*M.RADIANS_PER_DEGREE,re=(38.3213+13.17635815*n-14e-13*n*n+3.561*C+.1208*E-.0642*w+.0158*S+.0252*P-.0066*L-.0047*z-.0046*R+.0028*F+.0052*U+.004*D+.0019*I-.0044*_)*M.RADIANS_PER_DEGREE,he=(13.17635815-14e-13*(2*n)+3.561*v*PH+.1208*O*OH-.0642*N*LH+.0158*V*BH+.0252*k*RH-.0066*G*NH-.0047*W*MH-.0046*K*FH+.0028*q*zH+.0052*te*UH+.004*Y*HH+.0019*X*VH-.0044*$*kH)/86400*M.RADIANS_PER_DEGREE;return l(t)||(t=new WPe),t.rightAscension=se,t.declination=ue,t.rotation=re,t.rotationRate=he,t};const $Pe=_$;function g$(e){(!l(e)||typeof e!="function")&&(e=$Pe.ComputeMoon),this._computeFunction=e}const YPe=new f,XPe=new f,KPe=new f;function JPe(e,t,n){const i=YPe;i.x=Math.cos(e+M.PI_OVER_TWO),i.y=Math.sin(e+M.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=KPe;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=f.cross(r,i,XPe);return l(n)||(n=new J),n[0]=i.x,n[1]=s.x,n[2]=r.x,n[3]=i.y,n[4]=s.y,n[5]=r.y,n[6]=i.z,n[7]=s.z,n[8]=r.z,n}const QPe=new J,ZPe=new Te;g$.prototype.evaluate=function(e,t){l(e)||(e=ie.now());const n=this._computeFunction(e),i=JPe(n.rightAscension,n.declination,t),o=M.zeroToTwoPi(n.rotation),r=Te.fromAxisAngle(f.UNIT_Z,o,ZPe),s=J.fromQuaternion(Te.conjugate(r,r),QPe);return J.multiply(s,i,i)};const eOe=new f;function qr(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(T.typeOf.object("min",t),T.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===yn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");const i=A(e.vertexFormat,Fe.DEFAULT);this._minimum=f.clone(t),this._maximum=f.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}qr.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;T.typeOf.object("dimensions",t),T.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),T.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),T.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=f.multiplyByScalar(t,.5,new f);return new qr({minimum:f.negate(n,new f),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};qr.fromAxisAlignedBoundingBox=function(e){return T.typeOf.object("boundingBox",e),new qr({minimum:e.minimum,maximum:e.maximum})};qr.packedLength=2*f.packedLength+Fe.packedLength+1;qr.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),f.pack(e._minimum,t,n),f.pack(e._maximum,t,n+f.packedLength),Fe.pack(e._vertexFormat,t,n+2*f.packedLength),t[n+2*f.packedLength+Fe.packedLength]=A(e._offsetAttribute,-1),t};const y$=new f,A$=new f,b$=new Fe,GH={minimum:y$,maximum:A$,vertexFormat:b$,offsetAttribute:void 0};qr.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=f.unpack(e,t,y$),o=f.unpack(e,t+f.packedLength,A$),r=Fe.unpack(e,t+2*f.packedLength,b$),s=e[t+2*f.packedLength+Fe.packedLength];return l(n)?(n._minimum=f.clone(i,n._minimum),n._maximum=f.clone(o,n._maximum),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(GH.offsetAttribute=s===-1?void 0:s,new qr(GH))};qr.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(f.equals(t,n))return;const o=new Ji;let 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 Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})),i.normal){const u=new Float32Array(72);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=0,u[5]=1,u[6]=0,u[7]=0,u[8]=1,u[9]=0,u[10]=0,u[11]=1,u[12]=0,u[13]=0,u[14]=-1,u[15]=0,u[16]=0,u[17]=-1,u[18]=0,u[19]=0,u[20]=-1,u[21]=0,u[22]=0,u[23]=-1,u[24]=1,u[25]=0,u[26]=0,u[27]=1,u[28]=0,u[29]=0,u[30]=1,u[31]=0,u[32]=0,u[33]=1,u[34]=0,u[35]=0,u[36]=-1,u[37]=0,u[38]=0,u[39]=-1,u[40]=0,u[41]=0,u[42]=-1,u[43]=0,u[44]=0,u[45]=-1,u[46]=0,u[47]=0,u[48]=0,u[49]=1,u[50]=0,u[51]=0,u[52]=1,u[53]=0,u[54]=0,u[55]=1,u[56]=0,u[57]=0,u[58]=1,u[59]=0,u[60]=0,u[61]=-1,u[62]=0,u[63]=0,u[64]=-1,u[65]=0,u[66]=0,u[67]=-1,u[68]=0,u[69]=0,u[70]=-1,u[71]=0,o.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:u})}if(i.st){const u=new Float32Array(48);u[0]=0,u[1]=0,u[2]=1,u[3]=0,u[4]=1,u[5]=1,u[6]=0,u[7]=1,u[8]=1,u[9]=0,u[10]=0,u[11]=0,u[12]=0,u[13]=1,u[14]=1,u[15]=1,u[16]=0,u[17]=0,u[18]=1,u[19]=0,u[20]=1,u[21]=1,u[22]=0,u[23]=1,u[24]=1,u[25]=0,u[26]=0,u[27]=0,u[28]=0,u[29]=1,u[30]=1,u[31]=1,u[32]=1,u[33]=0,u[34]=0,u[35]=0,u[36]=0,u[37]=1,u[38]=1,u[39]=1,u[40]=0,u[41]=0,u[42]=1,u[43]=0,u[44]=1,u[45]=1,u[46]=0,u[47]=1,o.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:u})}if(i.tangent){const u=new Float32Array(72);u[0]=1,u[1]=0,u[2]=0,u[3]=1,u[4]=0,u[5]=0,u[6]=1,u[7]=0,u[8]=0,u[9]=1,u[10]=0,u[11]=0,u[12]=-1,u[13]=0,u[14]=0,u[15]=-1,u[16]=0,u[17]=0,u[18]=-1,u[19]=0,u[20]=0,u[21]=-1,u[22]=0,u[23]=0,u[24]=0,u[25]=1,u[26]=0,u[27]=0,u[28]=1,u[29]=0,u[30]=0,u[31]=1,u[32]=0,u[33]=0,u[34]=1,u[35]=0,u[36]=0,u[37]=-1,u[38]=0,u[39]=0,u[40]=-1,u[41]=0,u[42]=0,u[43]=-1,u[44]=0,u[45]=0,u[46]=-1,u[47]=0,u[48]=-1,u[49]=0,u[50]=0,u[51]=-1,u[52]=0,u[53]=0,u[54]=-1,u[55]=0,u[56]=0,u[57]=-1,u[58]=0,u[59]=0,u[60]=1,u[61]=0,u[62]=0,u[63]=1,u[64]=0,u[65]=0,u[66]=1,u[67]=0,u[68]=0,u[69]=1,u[70]=0,u[71]=0,o.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:u})}if(i.bitangent){const u=new Float32Array(72);u[0]=0,u[1]=1,u[2]=0,u[3]=0,u[4]=1,u[5]=0,u[6]=0,u[7]=1,u[8]=0,u[9]=0,u[10]=1,u[11]=0,u[12]=0,u[13]=1,u[14]=0,u[15]=0,u[16]=1,u[17]=0,u[18]=0,u[19]=1,u[20]=0,u[21]=0,u[22]=1,u[23]=0,u[24]=0,u[25]=0,u[26]=1,u[27]=0,u[28]=0,u[29]=1,u[30]=0,u[31]=0,u[32]=1,u[33]=0,u[34]=0,u[35]=1,u[36]=0,u[37]=0,u[38]=1,u[39]=0,u[40]=0,u[41]=1,u[42]=0,u[43]=0,u[44]=1,u[45]=0,u[46]=0,u[47]=1,u[48]=0,u[49]=0,u[50]=1,u[51]=0,u[52]=0,u[53]=1,u[54]=0,u[55]=0,u[56]=1,u[57]=0,u[58]=0,u[59]=1,u[60]=0,u[61]=0,u[62]=1,u[63]=0,u[64]=0,u[65]=1,u[66]=0,u[67]=0,u[68]=1,u[69]=0,u[70]=0,u[71]=1,o.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:u})}r=new Uint16Array(6*2*3),r[0]=0,r[1]=1,r[2]=2,r[3]=0,r[4]=2,r[5]=3,r[6]=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 Ue({componentDatatype:ee.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;const a=f.subtract(n,t,eOe),c=f.magnitude(a)*.5;if(l(e._offsetAttribute)){const u=s.length,d=e._offsetAttribute===yn.NONE?0:1,h=new Uint8Array(u/3).fill(d);o.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new Lt({attributes:o,indices:r,primitiveType:Ze.TRIANGLES,boundingSphere:new fe(f.ZERO,c),offsetAttribute:e._offsetAttribute})};let Z1;qr.getUnitBox=function(){return l(Z1)||(Z1=qr.createGeometry(qr.fromDimensions({dimensions:new f(1,1,1),vertexFormat:Fe.POSITION_ONLY}))),Z1};const tOe=`uniform sampler2D image;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
vec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,nOe=`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 = texture2D(image, centerPixel).channel;
|
||
|
||
float imageWidth = float(imageDimensions.x);
|
||
vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));
|
||
float rightBump = texture2D(image, rightPixel).channel;
|
||
|
||
float imageHeight = float(imageDimensions.y);
|
||
vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));
|
||
float topBump = texture2D(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;
|
||
}
|
||
`,iOe=`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;
|
||
}
|
||
`,oOe=`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;
|
||
}
|
||
`,rOe=`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 texture2D(heights, uv).x;
|
||
#else
|
||
return czm_unpackFloat(texture2D(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 = texture2D(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;
|
||
}
|
||
`,sOe=`#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);
|
||
|
||
#ifdef GL_OES_standard_derivatives
|
||
float dxc = abs(dFdx(materialInput.height));
|
||
float dyc = abs(dFdy(materialInput.height));
|
||
float dF = max(dxc, dyc) * czm_pixelRatio * width;
|
||
float alpha = (distanceToContour < dF) ? 1.0 : 0.0;
|
||
#else
|
||
float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;
|
||
#endif
|
||
|
||
vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));
|
||
material.diffuse = outColor.rgb;
|
||
material.alpha = outColor.a;
|
||
|
||
return material;
|
||
}
|
||
`,aOe=`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 = texture2D(image, vec2(scaledHeight, 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,cOe=`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;
|
||
}
|
||
`,lOe=`#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;
|
||
#ifdef GL_OES_standard_derivatives
|
||
// Fuzz Factor - Controls blurriness of lines
|
||
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
|
||
// Fuzz Factor - Controls blurriness of lines
|
||
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;
|
||
}
|
||
`,uOe=`uniform sampler2D image;
|
||
uniform float strength;
|
||
uniform vec2 repeat;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
|
||
vec4 textureValue = texture2D(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;
|
||
}
|
||
`,dOe=`#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;
|
||
|
||
#ifdef GL_OES_standard_derivatives
|
||
float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;
|
||
#else
|
||
float base = 0.975; // 2.5% of the line will be the arrow head
|
||
#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;
|
||
}
|
||
`,fOe=`uniform vec4 color;
|
||
uniform vec4 gapColor;
|
||
uniform float dashLength;
|
||
uniform float dashPattern;
|
||
varying 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;
|
||
}
|
||
`,hOe=`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;
|
||
}
|
||
`,pOe=`uniform vec4 color;
|
||
uniform vec4 outlineColor;
|
||
uniform float outlineWidth;
|
||
|
||
varying 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;
|
||
}
|
||
`,mOe=`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;
|
||
}
|
||
`,_Oe=`uniform sampler2D image;
|
||
|
||
czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||
vec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));
|
||
rampColor = czm_gammaCorrect(rampColor);
|
||
material.diffuse = rampColor.rgb;
|
||
material.alpha = rampColor.a;
|
||
return material;
|
||
}
|
||
`,gOe=`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;
|
||
}
|
||
`,yOe=`// 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 = texture2D(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 ze(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=A(e.minificationFilter,In.LINEAR),this._magnificationFilter=A(e.magnificationFilter,Kr.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,AOe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),l(ze._uniformList[this.type])||(ze._uniformList[this.type]=Object.keys(this._uniforms))}ze._uniformList={};ze.fromType=function(e,t){if(!l(ze._materialCache.getMaterial(e)))throw new x(`material with type '${e}' does not exist.`);const n=new ze({fabric:{type:e}});if(l(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};ze.prototype.isTranslucent=function(){if(l(this.translucent))return typeof this.translucent=="function"?this.translucent():this.translucent;let e=!0;const t=this._translucentFunctions,n=t.length;for(let i=0;i<n;++i){const o=t[i];if(typeof o=="function"?e=e&&o():e=e&&o,!e)break}return e};ze.prototype.update=function(e){this._defaultTexture=e.defaultTexture;let t,n;const i=this._loadedImages;let o=i.length;for(t=0;t<o;++t){const c=i[t];n=c.id;let u=c.image,d;Array.isArray(u)&&(d=u.slice(1,u.length).map(function(y){return y.bufferView}),u=u[0]);const h=new ii({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let m;l(u.internalFormat)?m=new Wt({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:d},sampler:h}):m=new Wt({context:e,source:u,sampler:h});const g=this._textures[n];l(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=m;const p=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(p)){const y=this.uniforms[p];y.x=m._width,y.y=m._height}}i.length=0;const r=this._loadedCubeMaps;for(o=r.length,t=0;t<o;++t){const c=r[t];n=c.id;const u=c.images,d=new bu({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new ii({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=d}r.length=0;const s=this._updateFunctions;for(o=s.length,t=0;t<o;++t)s[t](this,e);const a=this.materials;for(const c in a)a.hasOwnProperty(c)&&a[c].update(e)};ze.prototype.isDestroyed=function(){return!1};ze.prototype.destroy=function(){const e=this._textures;for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];i!==this._defaultTexture&&i.destroy()}const t=this.materials;for(const n in t)t.hasOwnProperty(n)&&t[n].destroy();return He(this)};function AOe(e,t){e=A(e,A.EMPTY_OBJECT),t._strict=A(e.strict,!1),t._count=A(e.count,0),t._template=ht(A(e.fabric,A.EMPTY_OBJECT)),t._template.uniforms=ht(A(t._template.uniforms,A.EMPTY_OBJECT)),t._template.materials=ht(A(t._template.materials,A.EMPTY_OBJECT)),t.type=l(t._template.type)?t._template.type:Ms(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n;const i=ze._materialCache.getMaterial(t.type);if(l(i)){const r=ht(i.fabric,!0);t._template=hn(t._template,r,!0),n=i.translucent}EOe(t),l(i)||ze._materialCache.addMaterial(t.type,t),wOe(t),IOe(t),OOe(t);const o=t._translucentFunctions.length===0?!0:void 0;if(n=A(n,o),n=A(e.translucent,n),l(n))if(typeof n=="function"){const r=function(){return n(t)};t._translucentFunctions.push(r)}else t._translucentFunctions.push(n)}function eP(e,t,n,i){if(l(e)){for(const o in e)if(e.hasOwnProperty(o)){const r=t.indexOf(o)!==-1;(i&&!r||!i&&r)&&n(o,t)}}}function WH(e,t){let n=`fabric: property name '${e}' is not valid. It should be `;for(let i=0;i<t.length;i++){const o=`'${t[i]}'`;n+=i===t.length-1?`or ${o}.`:`${o}, `}throw new x(n)}function bOe(e,t){const n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new x(n)}const COe=["type","materials","uniforms","components","source"],TOe=["diffuse","specular","shininess","normal","emission","alpha"];function EOe(e){const t=e._template,n=t.uniforms,i=t.materials,o=t.components;if(l(o)&&l(t.source))throw new x("fabric: cannot have source and components in the same template.");eP(t,COe,WH,!0),eP(o,TOe,WH,!0);const r=[];for(const s in i)i.hasOwnProperty(s)&&r.push(s);eP(n,r,bOe,!1)}function xOe(e,t){const n=t._template.materials;for(const i in n)if(n.hasOwnProperty(i)&&e.indexOf(i)>-1)return!0;return!1}function wOe(e){const t=e._template.components,n=e._template.source;if(l(n))e.shaderSource+=`${n}
|
||
`;else{if(e.shaderSource+=`czm_material czm_getMaterial(czm_materialInput materialInput)
|
||
{
|
||
`,e.shaderSource+=`czm_material material = czm_getDefaultMaterial(materialInput);
|
||
`,l(t)){const i=Object.keys(e._template.materials).length>0;for(const o in t)if(t.hasOwnProperty(o))if(o==="diffuse"||o==="emission"){const s=i&&xOe(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;
|
||
}
|
||
`}}const jH={mat2:dt,mat3:J,mat4:B},SOe=/\.ktx2$/i;function vOe(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!l(r)||r===ze.DefaultImageId;t=r;let c=n._textures[e],u,d;if(r instanceof HTMLVideoElement){if(r.readyState>=2){if(s&&l(c)&&(c!==i.defaultTexture&&c.destroy(),c=void 0),!l(c)||c===i.defaultTexture){const m=new ii({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});c=new Wt({context:i,source:r,sampler:m}),n._textures[e]=c;return}c.copyFrom({source:r})}else l(c)||(n._textures[e]=i.defaultTexture);return}if(r instanceof Wt&&r!==c){n._texturePaths[e]=void 0;const m=n._textures[e];l(m)&&m!==n._defaultTexture&&m.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(d=o[u],d.x=r._width,d.y=r._height);return}if(s&&l(c)&&a&&(c!==n._defaultTexture&&c.destroy(),c=void 0),l(c)||(n._texturePaths[e]=void 0,c=n._textures[e]=n._defaultTexture,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(d=o[u],d.x=c._width,d.y=c._height)),a)return;const h=r instanceof Me;if(!l(n._texturePaths[e])||h&&r.url!==n._texturePaths[e].url||!h&&r!==n._texturePaths[e]){if(typeof r=="string"||h){const m=h?r:Me.createIfNeeded(r);let g;SOe.test(m.url)?g=K_(m.url):g=m.fetchImage(),Promise.resolve(g).then(function(p){n._loadedImages.push({id:e,image:p})}).catch(function(){l(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 DOe(e){return function(t,n){const i=t.uniforms[e];if(i instanceof bu){const r=t._textures[e];r!==t._defaultTexture&&r.destroy(),t._texturePaths[e]=void 0,t._textures[e]=i;return}if(l(t._textures[e])||(t._texturePaths[e]=void 0,t._textures[e]=n.defaultCubeMap),i===ze.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const r=[Me.createIfNeeded(i.positiveX).fetchImage(),Me.createIfNeeded(i.negativeX).fetchImage(),Me.createIfNeeded(i.positiveY).fetchImage(),Me.createIfNeeded(i.negativeY).fetchImage(),Me.createIfNeeded(i.positiveZ).fetchImage(),Me.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function IOe(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&C$(e,n)}function C$(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=POe(o);if(!l(r))throw new x(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=wC(e,t,o,!1),s===0&&n)throw new x(`strict: shader source does not use channels '${t}'.`)}else{if(r==="sampler2D"){const u=`${t}Dimensions`;LOe(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},C$(e,u))}if(!new RegExp(`uniform\\s+${r}\\s+${t}\\s*;`).test(e.shaderSource)){const u=`uniform ${r} ${t};`;e.shaderSource=u+e.shaderSource}const c=`${t}_${e._count++}`;if(s=wC(e,t,c),s===1&&n)throw new x(`strict: shader source does not use uniform '${t}'.`);if(e.uniforms[t]=o,r==="sampler2D")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(vOe(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(DOe(t));else if(r.indexOf("mat")!==-1){const u=new jH[r];e._uniforms[c]=function(){return jH[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function POe(e){let t=e.type;if(!l(t)){const n=typeof e;if(n==="number")t="float";else if(n==="boolean")t="bool";else if(n==="string"||e instanceof Me||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===ze.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(const o in e)e.hasOwnProperty(o)&&(i+=1);i>=2&&i<=4?t=`vec${i}`:i===6&&(t="samplerCube")}}return t}function OOe(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new ze({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=hn(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;wC(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;const a=`${s}(materialInput)`;if(wC(e,i,a)===0&&t)throw new x(`strict: shader source does not use material '${i}'.`)}}function wC(e,t,n,i){i=A(i,!0);let o=0;const r="([\\w])?",s=`([\\w${i?".":""}])?`,a=new RegExp(s+t+r,"g");return e.shaderSource=e.shaderSource.replace(a,function(c,u,d){return u||d?c:(o+=1,n)}),o}function LOe(e,t,n){return wC(e,t,t,n)}ze._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};ze.DefaultImageId="czm_defaultImage";ze.DefaultCubeMapId="czm_defaultCubeMap";ze.ColorType="Color";ze._materialCache.addMaterial(ze.ColorType,{fabric:{type:ze.ColorType,uniforms:{color:new H(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});ze.ImageType="Image";ze._materialCache.addMaterial(ze.ImageType,{fabric:{type:ze.ImageType,uniforms:{image:ze.DefaultImageId,repeat:new j(1,1),color:new H(1,1,1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",alpha:"texture2D(image, fract(repeat * materialInput.st)).a * color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});ze.DiffuseMapType="DiffuseMap";ze._materialCache.addMaterial(ze.DiffuseMapType,{fabric:{type:ze.DiffuseMapType,uniforms:{image:ze.DefaultImageId,channels:"rgb",repeat:new j(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});ze.AlphaMapType="AlphaMap";ze._materialCache.addMaterial(ze.AlphaMapType,{fabric:{type:ze.AlphaMapType,uniforms:{image:ze.DefaultImageId,channel:"a",repeat:new j(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});ze.SpecularMapType="SpecularMap";ze._materialCache.addMaterial(ze.SpecularMapType,{fabric:{type:ze.SpecularMapType,uniforms:{image:ze.DefaultImageId,channel:"r",repeat:new j(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});ze.EmissionMapType="EmissionMap";ze._materialCache.addMaterial(ze.EmissionMapType,{fabric:{type:ze.EmissionMapType,uniforms:{image:ze.DefaultImageId,channels:"rgb",repeat:new j(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});ze.BumpMapType="BumpMap";ze._materialCache.addMaterial(ze.BumpMapType,{fabric:{type:ze.BumpMapType,uniforms:{image:ze.DefaultImageId,channel:"r",strength:.8,repeat:new j(1,1)},source:nOe},translucent:!1});ze.NormalMapType="NormalMap";ze._materialCache.addMaterial(ze.NormalMapType,{fabric:{type:ze.NormalMapType,uniforms:{image:ze.DefaultImageId,channels:"rgb",strength:.8,repeat:new j(1,1)},source:uOe},translucent:!1});ze.GridType="Grid";ze._materialCache.addMaterial(ze.GridType,{fabric:{type:ze.GridType,uniforms:{color:new H(0,1,0,1),cellAlpha:.1,lineCount:new j(8,8),lineThickness:new j(1,1),lineOffset:new j(0,0)},source:lOe},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});ze.StripeType="Stripe";ze._materialCache.addMaterial(ze.StripeType,{fabric:{type:ze.StripeType,uniforms:{horizontal:!0,evenColor:new H(1,1,1,.5),oddColor:new H(0,0,1,.5),offset:0,repeat:5},source:gOe},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});ze.CheckerboardType="Checkerboard";ze._materialCache.addMaterial(ze.CheckerboardType,{fabric:{type:ze.CheckerboardType,uniforms:{lightColor:new H(1,1,1,.5),darkColor:new H(0,0,0,.5),repeat:new j(5,5)},source:iOe},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});ze.DotType="Dot";ze._materialCache.addMaterial(ze.DotType,{fabric:{type:ze.DotType,uniforms:{lightColor:new H(1,1,0,.75),darkColor:new H(0,1,1,.75),repeat:new j(5,5)},source:oOe},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});ze.WaterType="Water";ze._materialCache.addMaterial(ze.WaterType,{fabric:{type:ze.WaterType,uniforms:{baseWaterColor:new H(.2,.3,.6,1),blendColor:new H(0,1,.699,1),specularMap:ze.DefaultImageId,normalMap:ze.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:yOe},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});ze.RimLightingType="RimLighting";ze._materialCache.addMaterial(ze.RimLightingType,{fabric:{type:ze.RimLightingType,uniforms:{color:new H(1,0,0,.7),rimColor:new H(1,1,1,.4),width:.3},source:mOe},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});ze.FadeType="Fade";ze._materialCache.addMaterial(ze.FadeType,{fabric:{type:ze.FadeType,uniforms:{fadeInColor:new H(1,0,0,1),fadeOutColor:new H(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new j(.5,.5)},source:cOe},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});ze.PolylineArrowType="PolylineArrow";ze._materialCache.addMaterial(ze.PolylineArrowType,{fabric:{type:ze.PolylineArrowType,uniforms:{color:new H(1,1,1,1)},source:dOe},translucent:!0});ze.PolylineDashType="PolylineDash";ze._materialCache.addMaterial(ze.PolylineDashType,{fabric:{type:ze.PolylineDashType,uniforms:{color:new H(1,0,1,1),gapColor:new H(0,0,0,0),dashLength:16,dashPattern:255},source:fOe},translucent:!0});ze.PolylineGlowType="PolylineGlow";ze._materialCache.addMaterial(ze.PolylineGlowType,{fabric:{type:ze.PolylineGlowType,uniforms:{color:new H(0,.5,1,1),glowPower:.25,taperPower:1},source:hOe},translucent:!0});ze.PolylineOutlineType="PolylineOutline";ze._materialCache.addMaterial(ze.PolylineOutlineType,{fabric:{type:ze.PolylineOutlineType,uniforms:{color:new H(1,1,1,1),outlineColor:new H(1,0,0,1),outlineWidth:1},source:pOe},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});ze.ElevationContourType="ElevationContour";ze._materialCache.addMaterial(ze.ElevationContourType,{fabric:{type:ze.ElevationContourType,uniforms:{spacing:100,color:new H(1,0,0,1),width:1},source:sOe},translucent:!1});ze.ElevationRampType="ElevationRamp";ze._materialCache.addMaterial(ze.ElevationRampType,{fabric:{type:ze.ElevationRampType,uniforms:{image:ze.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:aOe},translucent:!1});ze.SlopeRampMaterialType="SlopeRamp";ze._materialCache.addMaterial(ze.SlopeRampMaterialType,{fabric:{type:ze.SlopeRampMaterialType,uniforms:{image:ze.DefaultImageId},source:_Oe},translucent:!1});ze.AspectRampMaterialType="AspectRamp";ze._materialCache.addMaterial(ze.AspectRampMaterialType,{fabric:{type:ze.AspectRampMaterialType,uniforms:{image:ze.DefaultImageId},source:tOe},translucent:!1});ze.ElevationBandType="ElevationBand";ze._materialCache.addMaterial(ze.ElevationBandType,{fabric:{type:ze.ElevationBandType,uniforms:{heights:ze.DefaultImageId,colors:ze.DefaultImageId},source:rOe},translucent:!0});const UB={position:0};function AD(e){e=A(e,A.EMPTY_OBJECT),this.center=f.clone(A(e.center,f.ZERO)),this._center=new f,this.radii=f.clone(e.radii),this._radii=new f,this._oneOverEllipsoidRadiiSquared=new f,this._boundingSphere=new fe,this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=new B,this._computedModelMatrix=new B,this.show=A(e.show,!0),this.material=A(e.material,ze.fromType(ze.ColorType)),this._material=void 0,this._translucent=void 0,this.id=e.id,this._id=void 0,this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.onlySunLighting=A(e.onlySunLighting,!1),this._onlySunLighting=!1,this._depthTestEnabled=A(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 mt({owner:A(e._owner,this)}),this._pickCommand=new mt({owner:A(e._owner,this),pickOnly:!0});const 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 BOe(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(l(t))return t;const n=qr.createGeometry(qr.fromDimensions({dimensions:new f(2,2,2),vertexFormat:Fe.POSITION_ONLY}));return t=ho.fromGeometry({context:e,geometry:n,attributeLocations:UB,bufferUsage:nt.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}const qH=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`;AD.prototype.update=function(e){if(!this.show||e.mode!==le.SCENE3D||!l(this.center)||!l(this.radii))return;if(!l(this.material))throw new x("this.material must be defined.");const t=e.context,n=this.material.isTranslucent(),i=this._translucent!==n;(!l(this._rs)||i)&&(this._translucent=n,this._rs=et.fromCache({cull:{enabled:!0,face:Ho.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?Gi.ALPHA_BLEND:void 0})),l(this._va)||(this._va=BOe(t));let o=!1;const r=this.radii;if(!f.equals(this._radii,r)){f.clone(r,this._radii);const y=this._oneOverEllipsoidRadiiSquared;y.x=1/(r.x*r.x),y.y=1/(r.y*r.y),y.z=1/(r.z*r.z),o=!0}(!B.equals(this.modelMatrix,this._modelMatrix)||!f.equals(this.center,this._center))&&(B.clone(this.modelMatrix,this._modelMatrix),f.clone(this.center,this._center),B.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(f.clone(f.ZERO,this._boundingSphere.center),this._boundingSphere.radius=f.maximumComponent(r),fe.transform(this._boundingSphere,this._computedModelMatrix,this._boundingSphere));const s=this._material!==this.material;this._material=this.material,this._material.update(t);const a=this.onlySunLighting!==this._onlySunLighting;this._onlySunLighting=this.onlySunLighting;const c=e.useLogDepth,u=this._useLogDepth!==c;this._useLogDepth=c;const d=this._colorCommand;let h,m;(s||a||i||u)&&(h=new We({sources:[KU]}),m=new We({sources:[this.material.shaderSource,XU]}),this.onlySunLighting&&m.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&m.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),m.defines.push("LOG_DEPTH"),m.sources.push(qH)),this._sp=Cn.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:h,fragmentShaderSource:m,attributeLocations:UB}),d.vertexArray=this._va,d.renderState=this._rs,d.shaderProgram=this._sp,d.uniformMap=hn(this._uniforms,this.material._uniforms),d.executeInClosestFrustum=n);const g=e.commandList,p=e.passes;if(p.render&&(d.boundingVolume=this._boundingSphere,d.debugShowBoundingVolume=this.debugShowBoundingVolume,d.modelMatrix=this._computedModelMatrix,d.pass=n?Ne.TRANSLUCENT:Ne.OPAQUE,g.push(d)),p.pick){const y=this._pickCommand;(!l(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||!l(this._pickSP)||u)&&(h=new We({sources:[KU]}),m=new We({sources:[this.material.shaderSource,XU],pickColorQualifier:"uniform"}),this.onlySunLighting&&m.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&m.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),m.defines.push("LOG_DEPTH"),m.sources.push(qH)),this._pickSP=Cn.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:h,fragmentShaderSource:m,attributeLocations:UB}),y.vertexArray=this._va,y.renderState=this._rs,y.shaderProgram=this._pickSP,y.uniformMap=hn(hn(this._uniforms,this._pickUniforms),this.material._uniforms),y.executeInClosestFrustum=n),y.boundingVolume=this._boundingSphere,y.modelMatrix=this._computedModelMatrix,y.pass=n?Ne.TRANSLUCENT:Ne.OPAQUE,g.push(y)}};AD.prototype.isDestroyed=function(){return!1};AD.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(),He(this)};function yT(e){e=A(e,A.EMPTY_OBJECT);let t=e.textureUrl;l(t)||(t=An("Assets/Textures/moonSmall.jpg")),this.show=A(e.show,!0),this.textureUrl=t,this._ellipsoid=A(e.ellipsoid,me.MOON),this.onlySunLighting=A(e.onlySunLighting,!0),this._ellipsoidPrimitive=new AD({radii:this.ellipsoid.radii,material:ze.fromType(ze.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new g$}Object.defineProperties(yT.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const mx=new J,ROe=new J,NOe=new f,_x=[];yT.prototype.update=function(e){if(!this.show)return;const t=this._ellipsoidPrimitive;t.material.uniforms.image=this.textureUrl,t.onlySunLighting=this.onlySunLighting;const n=e.time;l(cn.computeIcrfToFixedMatrix(n,mx))||cn.computeTemeToPseudoFixedMatrix(n,mx);const i=this._axes.evaluate(n,ROe);J.transpose(i,i),J.multiply(mx,i,i);const o=hB.computeMoonPositionInEarthInertialFrame(n,NOe);J.multiplyByVector(mx,o,o),B.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=_x,_x.length=0,t.update(e),e.commandList=r,_x.length===1?_x[0]:void 0};yT.prototype.isDestroyed=function(){return!1};yT.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),He(this)};const MOe=new f,FOe=new f,zOe=new f,UOe=new f,HOe=new f,VOe=new f(1,1,1),$H=Math.cos,YH=Math.sin;function hc(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,VOe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,M.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,M.PI),a=Math.round(A(e.stackPartitions,64)),c=Math.round(A(e.slicePartitions,64)),u=A(e.vertexFormat,Fe.DEFAULT);if(c<3)throw new x("options.slicePartitions cannot be less than three.");if(a<3)throw new x("options.stackPartitions cannot be less than three.");this._radii=f.clone(t),this._innerRadii=f.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._vertexFormat=Fe.clone(u),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}hc.packedLength=2*f.packedLength+Fe.packedLength+7;hc.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),f.pack(e._radii,t,n),n+=f.packedLength,f.pack(e._innerRadii,t,n),n+=f.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.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]=A(e._offsetAttribute,-1),t};const T$=new f,E$=new f,x$=new Fe,Th={radii:T$,innerRadii:E$,vertexFormat:x$,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};hc.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=f.unpack(e,t,T$);t+=f.packedLength;const o=f.unpack(e,t,E$);t+=f.packedLength;const r=Fe.unpack(e,t,x$);t+=Fe.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],m=e[t];return l(n)?(n._radii=f.clone(i,n._radii),n._innerRadii=f.clone(o,n._innerRadii),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=c,n._maximumCone=u,n._stackPartitions=d,n._slicePartitions=h,n._offsetAttribute=m===-1?void 0:m,n):(Th.minimumClock=s,Th.maximumClock=a,Th.minimumCone=c,Th.maximumCone=u,Th.stackPartitions=d,Th.slicePartitions=h,Th.offsetAttribute=m===-1?void 0:m,new hc(Th))};hc.createGeometry=function(e){const t=e._radii;if(t.x<=0||t.y<=0||t.z<=0)return;const n=e._innerRadii;if(n.x<=0||n.y<=0||n.z<=0)return;const i=e._minimumClock,o=e._maximumClock,r=e._minimumCone,s=e._maximumCone,a=e._vertexFormat;let c=e._slicePartitions+1,u=e._stackPartitions+1;c=Math.round(c*Math.abs(o-i)/M.TWO_PI),u=Math.round(u*Math.abs(s-r)/M.PI),c<2&&(c=2),u<2&&(u=2);let d,h,m=0;const g=[r],p=[i];for(d=0;d<u;d++)g.push(r+d*(s-r)/(u-1));for(g.push(s),h=0;h<c;h++)p.push(i+h*(o-i)/(c-1));p.push(o);const y=g.length,b=p.length;let C=0,E=1;const w=n.x!==t.x||n.y!==t.y||n.z!==t.z;let S=!1,P=!1,L=!1;w&&(E=2,r>0&&(S=!0,C+=c-1),s<Math.PI&&(P=!0,C+=c-1),(o-i)%M.TWO_PI?(L=!0,C+=(u-1)*2+1):C+=1);const z=b*y*E,R=new Float64Array(z*3),F=new Array(z).fill(!1),U=new Array(z).fill(!1),D=c*u*E,I=6*(D+C+1-(c+u)*E),_=at.createTypedArray(D,I),v=a.normal?new Float32Array(z*3):void 0,O=a.tangent?new Float32Array(z*3):void 0,N=a.bitangent?new Float32Array(z*3):void 0,V=a.st?new Float32Array(z*2):void 0,k=new Array(y),G=new Array(y);for(d=0;d<y;d++)k[d]=YH(g[d]),G[d]=$H(g[d]);const W=new Array(b),K=new Array(b);for(h=0;h<b;h++)K[h]=$H(p[h]),W[h]=YH(p[h]);for(d=0;d<y;d++)for(h=0;h<b;h++)R[m++]=t.x*k[d]*K[h],R[m++]=t.y*k[d]*W[h],R[m++]=t.z*G[d];let q=z/2;if(w)for(d=0;d<y;d++)for(h=0;h<b;h++)R[m++]=n.x*k[d]*K[h],R[m++]=n.y*k[d]*W[h],R[m++]=n.z*G[d],F[q]=!0,d>0&&d!==y-1&&h!==0&&h!==b-1&&(U[q]=!0),q++;m=0;let te,Y;for(d=1;d<y-2;d++)for(te=d*b,Y=(d+1)*b,h=1;h<b-2;h++)_[m++]=Y+h,_[m++]=Y+h+1,_[m++]=te+h+1,_[m++]=Y+h,_[m++]=te+h+1,_[m++]=te+h;if(w){const Se=y*b;for(d=1;d<y-2;d++)for(te=Se+d*b,Y=Se+(d+1)*b,h=1;h<b-2;h++)_[m++]=Y+h,_[m++]=te+h,_[m++]=te+h+1,_[m++]=Y+h,_[m++]=te+h+1,_[m++]=Y+h+1}let X,$;if(w){if(S)for($=y*b,d=1;d<b-2;d++)_[m++]=d,_[m++]=d+1,_[m++]=$+d+1,_[m++]=d,_[m++]=$+d+1,_[m++]=$+d;if(P)for(X=y*b-b,$=y*b*E-b,d=1;d<b-2;d++)_[m++]=X+d+1,_[m++]=X+d,_[m++]=$+d,_[m++]=X+d+1,_[m++]=$+d,_[m++]=$+d+1}if(L){for(d=1;d<y-2;d++)$=b*y+b*d,X=b*d,_[m++]=$,_[m++]=X+b,_[m++]=X,_[m++]=$,_[m++]=$+b,_[m++]=X+b;for(d=1;d<y-2;d++)$=b*y+b*(d+1)-1,X=b*(d+1)-1,_[m++]=X+b,_[m++]=$,_[m++]=X,_[m++]=X+b,_[m++]=$+b,_[m++]=$}const se=new Ji;a.position&&(se.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:R}));let ue=0,re=0,he=0,ce=0;const Q=z/2;let ne;const de=me.fromCartesian3(t),_e=me.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(d=0;d<z;d++){ne=F[d]?_e:de;const Se=f.fromArray(R,d*3,MOe),ve=ne.geodeticSurfaceNormal(Se,FOe);if(U[d]&&f.negate(ve,ve),a.st){const Le=j.negate(ve,HOe);V[ue++]=Math.atan2(Le.y,Le.x)/M.TWO_PI+.5,V[ue++]=Math.asin(ve.z)/Math.PI+.5}if(a.normal&&(v[re++]=ve.x,v[re++]=ve.y,v[re++]=ve.z),a.tangent||a.bitangent){const Le=zOe;let Ee=0,Be;if(F[d]&&(Ee=Q),!S&&d>=Ee&&d<Ee+b*2?Be=f.UNIT_X:Be=f.UNIT_Z,f.cross(Be,ve,Le),f.normalize(Le,Le),a.tangent&&(O[he++]=Le.x,O[he++]=Le.y,O[he++]=Le.z),a.bitangent){const Pe=f.cross(ve,Le,UOe);f.normalize(Pe,Pe),N[ce++]=Pe.x,N[ce++]=Pe.y,N[ce++]=Pe.z}}}a.st&&(se.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:V})),a.normal&&(se.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:v})),a.tangent&&(se.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:O})),a.bitangent&&(se.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:N}))}if(l(e._offsetAttribute)){const Se=R.length,ve=e._offsetAttribute===yn.NONE?0:1,Le=new Uint8Array(Se/3).fill(ve);se.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:Le})}return new Lt({attributes:se,indices:_,primitiveType:Ze.TRIANGLES,boundingSphere:fe.fromEllipsoid(de),offsetAttribute:e._offsetAttribute})};let tP;hc.getUnitEllipsoid=function(){return l(tP)||(tP=hc.createGeometry(new hc({radii:new f(1,1,1),vertexFormat:Fe.POSITION_ONLY}))),tP};const HB=[],VB=[];function kOe(e,t,n,i,o,r){const s=o-i+1,a=r-o,c=HB,u=VB;let d,h;for(d=0;d<s;++d)c[d]=e[i+d];for(h=0;h<a;++h)u[h]=e[o+h+1];d=0,h=0;for(let m=i;m<=r;++m){const g=c[d],p=u[h];d<s&&(h>=a||t(g,p,n)<=0)?(e[m]=g,++d):h<a&&(e[m]=p,++h)}}function kB(e,t,n,i,o){if(i>=o)return;const r=Math.floor((i+o)*.5);kB(e,t,n,i,r),kB(e,t,n,r+1,o),kOe(e,t,n,i,r,o)}function $M(e,t,n){if(!l(e))throw new x("array is required.");if(!l(t))throw new x("comparator is required.");const i=e.length,o=Math.ceil(i*.5);HB.length=o,VB.length=o,kB(e,t,n,0,i-1),HB.length=0,VB.length=0}function oa(e,t){if(!l(e))throw new x("occluderBoundingSphere is required.");if(!l(t))throw new x("camera position is required.");this._occluderPosition=f.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}const gx=new f;Object.defineProperties(oa.prototype,{position:{get:function(){return this._occluderPosition}},radius:{get:function(){return this._occluderRadius}},cameraPosition:{set:function(e){if(!l(e))throw new x("cameraPosition is required.");e=f.clone(e,this._cameraPosition);const t=f.subtract(this._occluderPosition,e,gx);let n=f.magnitudeSquared(t);const i=this._occluderRadius*this._occluderRadius;let o,r,s;if(n>i){o=Math.sqrt(n-i),n=1/Math.sqrt(n),r=f.multiplyByScalar(t,n,gx);const a=o*o*n;s=f.add(e,f.multiplyByScalar(r,a,gx),gx)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});oa.fromBoundingSphere=function(e,t,n){if(!l(e))throw new x("occluderBoundingSphere is required.");if(!l(t))throw new x("camera position is required.");return l(n)?(f.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new oa(e,t)};const w$=new f;oa.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=f.subtract(e,this._occluderPosition,w$),n=this._occluderRadius;if(n=f.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=f.subtract(e,this._cameraPosition,t),n*n>f.magnitudeSquared(t)}return!1};const GOe=new f;oa.prototype.isBoundingSphereVisible=function(e){const t=f.clone(e.center,GOe),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=f.subtract(t,this._occluderPosition,w$),o=this._occluderRadius-n;if(o=f.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=f.subtract(t,this._cameraPosition,i),o*o+n*n>f.magnitudeSquared(i)):!1;if(o>0){i=f.subtract(t,this._cameraPosition,i);const r=f.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};const WOe=new f;oa.prototype.computeVisibility=function(e){if(!l(e))throw new x("occludeeBS is required.");const t=f.clone(e.center),n=e.radius;if(n>this._occluderRadius)return Wr.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=f.subtract(t,this._occluderPosition,WOe),o=this._occluderRadius-n;const r=f.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=f.subtract(t,this._cameraPosition,i);const s=f.magnitudeSquared(i);return o*o+n*n<s?Wr.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?Wr.FULL:Wr.PARTIAL):(i=f.subtract(t,this._horizonPlanePosition,i),f.dot(i,this._horizonPlaneNormal)>-n?Wr.PARTIAL:Wr.FULL))}}return Wr.NONE};const yx=new f;oa.computeOccludeePoint=function(e,t,n){if(!l(e))throw new x("occluderBoundingSphere is required.");if(!l(n))throw new x("positions is required.");if(n.length===0)throw new x("positions must contain at least one element");const i=f.clone(t),o=f.clone(e.center),r=e.radius,s=n.length;if(f.equals(o,t))throw new x("occludeePosition must be different than occluderBoundingSphere.center");const a=f.normalize(f.subtract(i,o,yx),yx),c=-f.dot(a,o),u=oa._anyRotationVector(o,a,c);let d=oa._horizonToPlaneNormalDotProduct(e,a,c,u,n[0]);if(!d)return;let h;for(let g=1;g<s;++g){if(h=oa._horizonToPlaneNormalDotProduct(e,a,c,u,n[g]),!h)return;h<d&&(d=h)}if(d<.0017453283658983088)return;const m=r/d;return f.add(o,f.multiplyByScalar(a,m,yx),yx)};const jOe=[];oa.computeOccludeePointFromRectangle=function(e,t){if(!l(e))throw new x("rectangle is required.");t=A(t,me.WGS84);const n=ge.subsample(e,t,0,jOe),i=fe.fromPoints(n),o=f.ZERO;if(!f.equals(o,i.center))return oa.computeOccludeePoint(new fe(o,t.minimumRadius),i.center,n)};const qOe=new f;oa._anyRotationVector=function(e,t,n){const i=f.abs(t,qOe);let o=i.x>i.y?0:1;(o===0&&i.z>i.x||o===1&&i.z>i.y)&&(o=2);const r=new f;let s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=f.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=f.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=f.UNIT_Z);const a=(f.dot(t,i)+n)/-f.dot(t,s);return f.normalize(f.subtract(f.add(i,f.multiplyByScalar(s,a,r),i),e,i),i)};const $Oe=new f;oa._rotationVector=function(e,t,n,i,o){let r=f.subtract(i,e,$Oe);if(r=f.normalize(r,r),f.dot(t,r)<.9999999847691291){const s=f.cross(t,r,r);if(f.magnitude(s)>M.EPSILON13)return f.normalize(s,new f)}return o};const nP=new f,YOe=new f,Ax=new f,XH=new f;oa._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=f.clone(o,nP),s=f.clone(e.center,YOe),a=e.radius;let c=f.subtract(s,r,Ax);const u=f.magnitudeSquared(c),d=a*a;if(u<d)return!1;const h=u-d,m=Math.sqrt(h),p=1/Math.sqrt(u),b=m*p*m;c=f.normalize(c,c);const C=f.add(r,f.multiplyByScalar(c,b,XH),XH),E=Math.sqrt(h-b*b);let w=this._rotationVector(s,t,n,r,i),S=f.fromElements(w.x*w.x*c.x+(w.x*w.y-w.z)*c.y+(w.x*w.z+w.y)*c.z,(w.x*w.y+w.z)*c.x+w.y*w.y*c.y+(w.y*w.z-w.x)*c.z,(w.x*w.z-w.y)*c.x+(w.y*w.z+w.x)*c.y+w.z*w.z*c.z,nP);S=f.normalize(S,S);const P=f.multiplyByScalar(S,E,nP);w=f.normalize(f.subtract(f.add(C,P,Ax),s,Ax),Ax);const L=f.dot(t,w);w=f.normalize(f.subtract(f.subtract(C,P,w),s,w),w);const z=f.dot(t,w);return L<z?L:z};function ca(e){e=A(e,A.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=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this._cullingVolume=new ar,this._perspectiveMatrix=new B,this._infinitePerspective=new B}function GB(e){if(!l(e.right)||!l(e.left)||!l(e.top)||!l(e.bottom)||!l(e.near)||!l(e.far))throw new x("right, left, top, bottom, near, or far parameters are not set.");const t=e.top,n=e.bottom,i=e.right,o=e.left,r=e.near,s=e.far;if(t!==e._top||n!==e._bottom||o!==e._left||i!==e._right||r!==e._near||s!==e._far){if(e.near<=0||e.near>e.far)throw new x("near must be greater than zero and less than far.");e._left=o,e._right=i,e._top=t,e._bottom=n,e._near=r,e._far=s,e._perspectiveMatrix=B.computePerspectiveOffCenter(o,i,n,t,r,s,e._perspectiveMatrix),e._infinitePerspective=B.computeInfinitePerspectiveOffCenter(o,i,n,t,r,e._infinitePerspective)}}Object.defineProperties(ca.prototype,{projectionMatrix:{get:function(){return GB(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return GB(this),this._infinitePerspective}}});const XOe=new f,KOe=new f,JOe=new f,QOe=new f;ca.prototype.computeCullingVolume=function(e,t,n){if(!l(e))throw new x("position is required.");if(!l(t))throw new x("direction is required.");if(!l(n))throw new x("up is required.");const i=this._cullingVolume.planes,o=this.top,r=this.bottom,s=this.right,a=this.left,c=this.near,u=this.far,d=f.cross(t,n,XOe),h=KOe;f.multiplyByScalar(t,c,h),f.add(e,h,h);const m=JOe;f.multiplyByScalar(t,u,m),f.add(e,m,m);const g=QOe;f.multiplyByScalar(d,a,g),f.add(h,g,g),f.subtract(g,e,g),f.normalize(g,g),f.cross(g,n,g),f.normalize(g,g);let p=i[0];return l(p)||(p=i[0]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-f.dot(g,e),f.multiplyByScalar(d,s,g),f.add(h,g,g),f.subtract(g,e,g),f.cross(n,g,g),f.normalize(g,g),p=i[1],l(p)||(p=i[1]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-f.dot(g,e),f.multiplyByScalar(n,r,g),f.add(h,g,g),f.subtract(g,e,g),f.cross(d,g,g),f.normalize(g,g),p=i[2],l(p)||(p=i[2]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-f.dot(g,e),f.multiplyByScalar(n,o,g),f.add(h,g,g),f.subtract(g,e,g),f.cross(g,d,g),f.normalize(g,g),p=i[3],l(p)||(p=i[3]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-f.dot(g,e),p=i[4],l(p)||(p=i[4]=new oe),p.x=t.x,p.y=t.y,p.z=t.z,p.w=-f.dot(t,h),f.negate(t,g),p=i[5],l(p)||(p=i[5]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-f.dot(g,m),this._cullingVolume};ca.prototype.getPixelDimensions=function(e,t,n,i,o){if(GB(this),!l(e)||!l(t))throw new x("Both drawingBufferWidth and drawingBufferHeight are required.");if(e<=0)throw new x("drawingBufferWidth must be greater than zero.");if(t<=0)throw new x("drawingBufferHeight must be greater than zero.");if(!l(n))throw new x("distance is required.");if(!l(i))throw new x("pixelRatio is required");if(i<=0)throw new x("pixelRatio must be greater than zero.");if(!l(o))throw new x("A result object is required.");const r=1/this.near;let s=this.top*r;const a=2*i*n*s/t;s=this.right*r;const c=2*i*n*s/e;return o.x=c,o.y=a,o};ca.prototype.clone=function(e){return l(e)||(e=new ca),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};ca.prototype.equals=function(e){return l(e)&&e instanceof ca&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};ca.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof ca&&M.equalsEpsilon(this.right,e.right,t,n)&&M.equalsEpsilon(this.left,e.left,t,n)&&M.equalsEpsilon(this.top,e.top,t,n)&&M.equalsEpsilon(this.bottom,e.bottom,t,n)&&M.equalsEpsilon(this.near,e.near,t,n)&&M.equalsEpsilon(this.far,e.far,t,n)};function Yn(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new ca,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=A(e.near,1),this._near=this.near,this.far=A(e.far,5e8),this._far=this.far,this.xOffset=A(e.xOffset,0),this._xOffset=this.xOffset,this.yOffset=A(e.yOffset,0),this._yOffset=this.yOffset}Yn.packedLength=6;Yn.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(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};Yn.unpack=function(e,t,n){return T.defined("array",e),t=A(t,0),l(n)||(n=new Yn),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 ed(e){if(!l(e.fov)||!l(e.aspectRatio)||!l(e.near)||!l(e.far))throw new x("fov, aspectRatio, near, or far parameters are not set.");const t=e._offCenterFrustum;if(e.fov!==e._fov||e.aspectRatio!==e._aspectRatio||e.near!==e._near||e.far!==e._far||e.xOffset!==e._xOffset||e.yOffset!==e._yOffset){if(e.fov<0||e.fov>=Math.PI)throw new x("fov must be in the range [0, PI).");if(e.aspectRatio<0)throw new x("aspectRatio must be positive.");if(e.near<0||e.near>e.far)throw new x("near must be greater than zero and less than far.");e._aspectRatio=e.aspectRatio,e._fov=e.fov,e._fovy=e.aspectRatio<=1?e.fov:Math.atan(Math.tan(e.fov*.5)/e.aspectRatio)*2,e._near=e.near,e._far=e.far,e._sseDenominator=2*Math.tan(.5*e._fovy),e._xOffset=e.xOffset,e._yOffset=e.yOffset,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(Yn.prototype,{projectionMatrix:{get:function(){return ed(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return ed(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return ed(this),this._fovy}},sseDenominator:{get:function(){return ed(this),this._sseDenominator}}});Yn.prototype.computeCullingVolume=function(e,t,n){return ed(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};Yn.prototype.getPixelDimensions=function(e,t,n,i,o){return ed(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};Yn.prototype.clone=function(e){return l(e)||(e=new Yn),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};Yn.prototype.equals=function(e){return!l(e)||!(e instanceof Yn)?!1:(ed(this),ed(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};Yn.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof Yn)?!1:(ed(this),ed(e),M.equalsEpsilon(this.fov,e.fov,t,n)&&M.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};function AT(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(AT.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function ZOe(e,t,n){const i=t.createViewportQuadCommand(dEe,{framebuffer:n,renderState:et.fromCache({viewport:new Ye(0,0,256,256)})});e._drawCommand=i}AT.prototype.update=function(e){if(!l(this._colorTexture)){const t=e.context,n=new Wt({context:t,width:256,height:256,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,sampler:ii.NEAREST});this._colorTexture=n;const i=new Yr({context:t,colorTextures:[n],destroyAttachments:!1});ZOe(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};AT.prototype.isDestroyed=function(){return!1};AT.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),He(this)};var pi={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-pi.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?pi.Bounce.In(e*2)*.5:pi.Bounce.Out(e*2-1)*.5+.5}}},ab;typeof self>"u"&&typeof process<"u"&&process.hrtime?ab=function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?ab=self.performance.now.bind(self.performance):Date.now!==void 0?ab=Date.now:ab=function(){return new Date().getTime()};var sy=ab,eLe=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=sy()),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}(),cb={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=cb.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=cb.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=cb.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=cb.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}}},S$=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),v$=new eLe,tLe=function(){function e(t,n){n===void 0&&(n=v$),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=pi.Linear.None,this._interpolationFunction=cb.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=S$.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"?sy()+parseFloat(t):t:sy(),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,u=!a&&Array.isArray(i[r]);if(!(c==="undefined"||c==="function")){if(u){var d=i[r];if(d.length===0)continue;d=d.map(this._handleRelativeValue.bind(this,s)),i[r]=[s].concat(d)}if((c==="object"||a)&&s&&!u){n[r]=a?[]:{};for(var h in s)n[r][h]=s[h];o[r]=a?[]:{},this._setupProperties(s,n[r],i[r],o[r])}else typeof n[r]>"u"&&(n[r]=s),a||(n[r]*=1),u?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=sy()),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=sy()),!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=sy()),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]),u=Array.isArray(a),d=!c&&u;d?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}();S$.nextId;var hd=v$;hd.getAll.bind(hd);hd.removeAll.bind(hd);hd.add.bind(hd);hd.remove.bind(hd);hd.update.bind(hd);const nLe={LINEAR_NONE:pi.Linear.None,QUADRATIC_IN:pi.Quadratic.In,QUADRATIC_OUT:pi.Quadratic.Out,QUADRATIC_IN_OUT:pi.Quadratic.InOut,CUBIC_IN:pi.Cubic.In,CUBIC_OUT:pi.Cubic.Out,CUBIC_IN_OUT:pi.Cubic.InOut,QUARTIC_IN:pi.Quartic.In,QUARTIC_OUT:pi.Quartic.Out,QUARTIC_IN_OUT:pi.Quartic.InOut,QUINTIC_IN:pi.Quintic.In,QUINTIC_OUT:pi.Quintic.Out,QUINTIC_IN_OUT:pi.Quintic.InOut,SINUSOIDAL_IN:pi.Sinusoidal.In,SINUSOIDAL_OUT:pi.Sinusoidal.Out,SINUSOIDAL_IN_OUT:pi.Sinusoidal.InOut,EXPONENTIAL_IN:pi.Exponential.In,EXPONENTIAL_OUT:pi.Exponential.Out,EXPONENTIAL_IN_OUT:pi.Exponential.InOut,CIRCULAR_IN:pi.Circular.In,CIRCULAR_OUT:pi.Circular.Out,CIRCULAR_IN_OUT:pi.Circular.InOut,ELASTIC_IN:pi.Elastic.In,ELASTIC_OUT:pi.Elastic.Out,ELASTIC_IN_OUT:pi.Elastic.InOut,BACK_IN:pi.Back.In,BACK_OUT:pi.Back.Out,BACK_IN_OUT:pi.Back.InOut,BOUNCE_IN:pi.Bounce.In,BOUNCE_OUT:pi.Bounce.Out,BOUNCE_IN_OUT:pi.Bounce.InOut},xc=Object.freeze(nLe);function iLe(e){const 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),u=c*a,d=Math.atan2(a,r),h=c*s,m=h*h,g=1-m,p=Math.sqrt(g),y=t/4,b=y*y,C=b*y,E=b*b,w=1+y-3*b/4+5*C/4-175*E/64,S=1-y+15*b/8-35*C/8,P=1-3*y+35*b/4,L=1-5*y,z=w*d-S*Math.sin(2*d)*y/2-P*Math.sin(4*d)*b/16-L*Math.sin(6*d)*C/48-Math.sin(8*d)*5*E/512,R=e._constants;R.a=n,R.b=i,R.f=o,R.cosineHeading=r,R.sineHeading=s,R.tanU=a,R.cosineU=c,R.sineU=u,R.sigma=d,R.sineAlpha=h,R.sineSquaredAlpha=m,R.cosineSquaredAlpha=g,R.cosineAlpha=p,R.u2Over4=y,R.u4Over16=b,R.u6Over64=C,R.u8Over256=E,R.a0=w,R.a1=S,R.a2=P,R.a3=L,R.distanceRatio=z}function oLe(e,t){return e*t*(4+e*(4-3*t))/16}function D$(e,t,n,i,o,r,s){const a=oLe(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function rLe(e,t,n,i,o,r,s){const a=(t-n)/t,c=r-i,u=Math.atan((1-a)*Math.tan(o)),d=Math.atan((1-a)*Math.tan(s)),h=Math.cos(u),m=Math.sin(u),g=Math.cos(d),p=Math.sin(d),y=h*g,b=h*p,C=m*p,E=m*g;let w=c,S=M.TWO_PI,P=Math.cos(w),L=Math.sin(w),z,R,F,U,D;do{P=Math.cos(w),L=Math.sin(w);const W=b-E*P;F=Math.sqrt(g*g*L*L+W*W),R=C+y*P,z=Math.atan2(F,R);let K;F===0?(K=0,U=1):(K=y*L/F,U=1-K*K),S=w,D=R-2*C/U,isFinite(D)||(D=0),w=c+D$(a,K,U,z,F,R,D)}while(Math.abs(w-S)>M.EPSILON12);const I=U*(t*t-n*n)/(n*n),_=1+I*(4096+I*(I*(320-175*I)-768))/16384,v=I*(256+I*(I*(74-47*I)-128))/1024,O=D*D,N=v*F*(D+v*(R*(2*O-1)-v*D*(4*F*F-3)*(4*O-3)/6)/4),V=n*_*(z-N),k=Math.atan2(g*L,b-E*P),G=Math.atan2(h*L,b*P-E);e._distance=V,e._startHeading=k,e._endHeading=G,e._uSquared=I}const sLe=new f,iP=new f;function I$(e,t,n,i){const o=f.normalize(i.cartographicToCartesian(t,iP),sLe),r=f.normalize(i.cartographicToCartesian(n,iP),iP);T.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(f.angleBetween(o,r))-Math.PI),.0125),rLe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=Ce.clone(t,e._start),e._end=Ce.clone(n,e._end),e._start.height=0,e._end.height=0,iLe(e)}function qf(e,t,n){const i=A(n,me.WGS84);this._ellipsoid=i,this._start=new Ce,this._end=new Ce,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,l(e)&&l(t)&&I$(this,e,t,i)}Object.defineProperties(qf.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return T.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return T.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return T.defined("distance",this._distance),this._endHeading}}});qf.prototype.setEndPoints=function(e,t){T.defined("start",e),T.defined("end",t),I$(this,e,t,this._ellipsoid)};qf.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};qf.prototype.interpolateUsingSurfaceDistance=function(e,t){T.defined("distance",this._distance);const 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),u=Math.sin(6*i),d=Math.sin(8*i),h=i*i,m=i*h,g=n.u8Over256,p=n.u2Over4,y=n.u6Over64,b=n.u4Over16;let C=2*m*g*o/3+i*(1-p+7*b/4-15*y/4+579*g/64-(b-15*y/4+187*g/16)*o-(5*y/4-115*g/16)*r-29*g*s/16)+(p/2-b+71*y/32-85*g/16)*a+(5*b/16-5*y/4+383*g/96)*c-h*((y-11*g/2)*a+5*g*c/2)+(29*y/96-29*g/16)*u+539*g*d/1536;const E=Math.asin(Math.sin(C)*n.cosineAlpha),w=Math.atan(n.a/n.b*Math.tan(E));C=C-n.sigma;const S=Math.cos(2*n.sigma+C),P=Math.sin(C),L=Math.cos(C),z=n.cosineU*L,R=n.sineU*P,U=Math.atan2(P*n.sineHeading,z-R*n.cosineHeading)-D$(n.f,n.sineAlpha,n.cosineSquaredAlpha,C,P,L,S);return l(t)?(t.longitude=this._start.longitude+U,t.latitude=w,t.height=0,t):new Ce(this._start.longitude+U,w,0)};function D_(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.range=A(n,0)}D_.clone=function(e,t){if(l(e))return l(t)||(t=new D_),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const P$={};function aLe(e,t,n){let i,o,r;if(e instanceof Yn){const 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 ca)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}const cLe=new f,KH=new f;function O$(e,t,n,i){if(l(i)&&n(.5)>i){const o=n(0),r=n(1),s=n(.5),a=s-o,c=s-r;return function(u){const d=n(u);if(u<=.5){const m=(d-o)/a;return M.lerp(e,-M.PI_OVER_TWO,m)}const h=(d-r)/c;return M.lerp(-M.PI_OVER_TWO,t,1-h)}}return function(o){return M.lerp(e,t,o)}}function YM(e,t,n,i,o){let r=o;const s=Math.max(n,i);if(!l(r)){const a=e.position,c=t,u=e.up,d=e.right,h=e.frustum,m=f.subtract(a,c,cLe),g=f.magnitude(f.multiplyByScalar(u,f.dot(m,u),KH)),p=f.magnitude(f.multiplyByScalar(d,f.dot(m,d),KH));r=Math.min(aLe(h,g,p)*.2,1e9)}if(s<r){const u=-Math.pow((r-n)*1e6,.125),d=Math.pow((r-i)*1e6,1/8);return function(h){const m=h*(d-u)+u;return-Math.pow(m,8)/1e6+r}}return function(a){return M.lerp(n,i,a)}}function SC(e,t){return M.equalsEpsilon(e,M.TWO_PI,M.EPSILON11)&&(e=0),t>e+Math.PI?e+=M.TWO_PI:t<e-Math.PI&&(e-=M.TWO_PI),e}const L$=new f;function lLe(e,t,n,i,o,r,s,a){const c=e.camera,u=f.clone(c.position,L$),d=c.pitch,h=SC(c.heading,i),m=SC(c.roll,r),g=YM(c,n,u.z,n.z,s),p=O$(d,o,g,a);function y(b){const C=b.time/t;c.setView({orientation:{heading:M.lerp(h,i,C),pitch:p(C),roll:M.lerp(m,r,C)}}),j.lerp(u,n,C,c.position),c.position.z=g(C)}return y}function uLe(e,t){e.longitude<t.longitude?e.longitude+=M.TWO_PI:t.longitude+=M.TWO_PI}function dLe(e,t){const n=e.longitude-t.longitude;n<-M.PI?e.longitude+=M.TWO_PI:n>M.PI&&(t.longitude+=M.TWO_PI)}const fLe=new Ce,hLe=new Ce;function pLe(e,t,n,i,o,r,s,a,c,u){const d=e.camera,m=e.mapProjection.ellipsoid,g=Ce.clone(d.positionCartographic,fLe),p=d.pitch,y=SC(d.heading,i),b=SC(d.roll,r),C=m.cartesianToCartographic(n,hLe);g.longitude=M.zeroToTwoPi(g.longitude),C.longitude=M.zeroToTwoPi(C.longitude);let E=!1;if(l(a)){const L=M.zeroToTwoPi(a),z=Math.min(g.longitude,C.longitude),R=Math.max(g.longitude,C.longitude),F=L>=z&&L<=R;if(l(c)){const U=Math.abs(g.longitude-C.longitude),D=M.TWO_PI-U;(F?U:D)<(F?D:U)*c&&!F&&(E=!0)}else F||(E=!0)}E?uLe(g,C):dLe(g,C);const w=YM(d,n,g.height,C.height,s),S=O$(p,o,w,u);function P(){const L=g.longitude,z=C.longitude,R=g.latitude,F=C.latitude;return function(D){const I=D.time/t,_=f.fromRadians(M.lerp(L,z,I),M.lerp(R,F,I),w(I),m);d.setView({destination:_,orientation:{heading:M.lerp(y,i,I),pitch:S(I),roll:M.lerp(b,r,I)}})}}return P()}function mLe(e,t,n,i,o,r,s){const a=e.camera,c=f.clone(a.position,L$),u=SC(a.heading,i),d=a.frustum.right-a.frustum.left,h=YM(a,n,d,n.z,s);function m(g){const p=g.time/t;a.setView({orientation:{heading:M.lerp(u,i,p)}}),j.lerp(c,n,p,a.position);const y=h(p),b=a.frustum,C=b.top/b.right,E=(y-(b.right-b.left))*.5;b.right+=E,b.left-=E,b.top=C*b.right,b.bottom=-b.top}return m}const JH=new Ce,_Le=new f;function oP(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function QH(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}P$.createTween=function(e,t){t=A(t,A.EMPTY_OBJECT);let n=t.destination;if(!l(e))throw new x("scene is required.");if(!l(n))throw new x("destination is required.");const i=e.mode;if(i===le.MORPHING)return oP();const o=A(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,c=t.flyOverLongitude,u=t.flyOverLongitudeWeight,d=t.pitchAdjustHeight;let h=t.easingFunction;o&&i!==le.SCENE3D&&(s.cartesianToCartographic(n,JH),n=r.project(JH,_Le));const m=e.camera,g=t.endTransform;l(g)&&m._setTransform(g);let p=t.duration;l(p)||(p=Math.ceil(f.distance(m.position,n)/1e6)+2,p=Math.min(p,3));const y=A(t.heading,0),b=A(t.pitch,-M.PI_OVER_TWO),C=A(t.roll,0),E=e.screenSpaceCameraController;E.enableInputs=!1;const w=QH(E,t.complete),S=QH(E,t.cancel),P=m.frustum;let L=e.mode===le.SCENE2D;if(L=L&&j.equalsEpsilon(m.position,n,M.EPSILON6),L=L&&M.equalsEpsilon(Math.max(P.right-P.left,P.top-P.bottom),n.z,M.EPSILON6),L=L||e.mode!==le.SCENE2D&&f.equalsEpsilon(n,m.position,M.EPSILON10),L=L&&M.equalsEpsilon(M.negativePiToPi(y),M.negativePiToPi(m.heading),M.EPSILON10)&&M.equalsEpsilon(M.negativePiToPi(b),M.negativePiToPi(m.pitch),M.EPSILON10)&&M.equalsEpsilon(M.negativePiToPi(C),M.negativePiToPi(m.roll),M.EPSILON10),L)return oP(w,S);const z=new Array(4);if(z[le.SCENE2D]=mLe,z[le.SCENE3D]=pLe,z[le.COLUMBUS_VIEW]=lLe,p<=0)return oP(function(){z[i](e,1,n,y,b,C,a,c,u,d)({time:1}),typeof w=="function"&&w()},S);const R=z[i](e,p,n,y,b,C,a,c,u,d);if(!l(h)){const F=m.positionCartographic.height,U=i===le.SCENE3D?s.cartesianToCartographic(n).height:n.z;F>U&&F>11500?h=xc.CUBIC_OUT:h=xc.QUINTIC_IN_OUT}return{duration:p,easingFunction:h,startObject:{time:0},stopObject:{time:p},update:R,complete:w,cancel:S}};const gLe=P$,yLe={ROTATE:0,INFINITE_SCROLL:1},Ip=Object.freeze(yLe);function ct(e){if(!l(e))throw new x("scene is required.");this._scene=e,this._transform=B.clone(B.IDENTITY),this._invTransform=B.clone(B.IDENTITY),this._actualTransform=B.clone(B.IDENTITY),this._actualInvTransform=B.clone(B.IDENTITY),this._transformChanged=!1,this.position=new f,this._position=new f,this._positionWC=new f,this._positionCartographic=new Ce,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new f,this._direction=new f,this._directionWC=new f,this.up=new f,this._up=new f,this._upWC=new f,this.right=new f,this._right=new f,this._rightWC=new f,this.frustum=new Yn,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=M.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 Ke,this._moveEnd=new Ke,this._changed=new Ke,this._changedPosition=void 0,this._changedDirection=void 0,this._changedFrustum=void 0,this._changedHeading=void 0,this.percentageChanged=.5,this._viewMatrix=new B,this._invViewMatrix=new B,B$(this),this._mode=le.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Ce(Math.PI,M.PI_OVER_TWO)),this._max2Dfrustum=void 0,j$(this,ct.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=f.magnitude(this.position);n+=n*ct.DEFAULT_VIEW_FACTOR,f.normalize(this.position,this.position),f.multiplyByScalar(this.position,n,this.position)}ct.TRANSFORM_2D=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);ct.TRANSFORM_2D_INVERSE=B.inverseTransformation(ct.TRANSFORM_2D,new B);ct.DEFAULT_VIEW_RECTANGLE=ge.fromDegrees(-95,-20,-70,90);ct.DEFAULT_VIEW_FACTOR=.5;ct.DEFAULT_OFFSET=new D_(0,-M.PI_OVER_FOUR,0);function B$(e){B.computeView(e._position,e._direction,e._up,e._right,e._viewMatrix),B.multiply(e._viewMatrix,e._actualInvTransform,e._viewMatrix),B.inverseTransformation(e._viewMatrix,e._invViewMatrix)}function ALe(e){if(!l(e._oldPositionWC))e._oldPositionWC=f.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=f.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=f.magnitude(t),e._oldPositionWC=f.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=fr()):e.timeSinceMoved=Math.max(fr()-e._lastMovedTimestamp,0)/1e3}}ct.prototype.canPreloadFlight=function(){return l(this._currentFlight)&&this._mode!==le.SCENE2D};ct.prototype._updateCameraChanged=function(){const e=this;if(ALe(e),e._changed.numberOfListeners===0)return;const t=e.percentageChanged,n=e.heading;l(e._changedHeading)||(e._changedHeading=n);let i=Math.abs(e._changedHeading-n)%M.TWO_PI;i=i>M.PI?M.TWO_PI-i:i;const o=i/Math.PI;if(o>t&&(e._changed.raiseEvent(o),e._changedHeading=n),e._mode===le.SCENE2D){if(!l(e._changedFrustum)){e._changedPosition=f.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}const u=e.position,d=e._changedPosition,h=e.frustum,m=e._changedFrustum,g=u.x+h.left,p=u.x+h.right,y=d.x+m.left,b=d.x+m.right,C=u.y+h.bottom,E=u.y+h.top,w=d.y+m.bottom,S=d.y+m.top,P=Math.max(g,y),L=Math.min(p,b),z=Math.max(C,w),R=Math.min(E,S);let F;if(P>=L||z>=E)F=1;else{let U=m;g<y&&p>b&&C<w&&E>S&&(U=h),F=1-(L-P)*(R-z)/((U.right-U.left)*(U.top-U.bottom))}F>t&&(e._changed.raiseEvent(F),e._changedPosition=f.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!l(e._changedDirection)){e._changedPosition=f.clone(e.positionWC,e._changedPosition),e._changedDirection=f.clone(e.directionWC,e._changedDirection);return}const r=M.acosClamped(f.dot(e.directionWC,e._changedDirection));let s;l(e.frustum.fovy)?s=r/(e.frustum.fovy*.5):s=r;const c=f.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(s>t||c>t)&&(e._changed.raiseEvent(Math.max(s,c)),e._changedPosition=f.clone(e.positionWC,e._changedPosition),e._changedDirection=f.clone(e.directionWC,e._changedDirection))};function bLe(e){cn.basisTo2D(e._projection,e._transform,e._actualTransform)}const CLe=new Ce,TLe=new f,bx=new f,ELe=new oe,xLe=new oe,wLe=new oe,SLe=new oe,vLe=new oe;function DLe(e){const t=e._projection,n=t.ellipsoid,i=B.getColumn(e._transform,3,ELe),o=n.cartesianToCartographic(i,CLe),r=t.project(o,TLe),s=xLe;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=oe.clone(oe.UNIT_X,vLe),c=oe.add(B.getColumn(e._transform,0,bx),i,bx);n.cartesianToCartographic(c,o),t.project(o,r);const u=wLe;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,f.subtract(u,s,u),u.x=0;const d=SLe;if(f.magnitudeSquared(u)>M.EPSILON10)f.cross(a,u,d);else{const h=oe.add(B.getColumn(e._transform,1,bx),i,bx);n.cartesianToCartographic(h,o),t.project(o,r),d.x=r.z,d.y=r.x,d.z=r.y,d.w=0,f.subtract(d,s,d),d.x=0,f.magnitudeSquared(d)<M.EPSILON10&&(oe.clone(oe.UNIT_Y,u),oe.clone(oe.UNIT_Z,d))}f.cross(d,a,u),f.normalize(u,u),f.cross(a,u,d),f.normalize(d,d),B.setColumn(e._actualTransform,0,u,e._actualTransform),B.setColumn(e._actualTransform,1,d,e._actualTransform),B.setColumn(e._actualTransform,2,a,e._actualTransform),B.setColumn(e._actualTransform,3,s,e._actualTransform)}const rP=new f;function Ys(e){const t=e._mode;let n=!1,i=0;t===le.SCENE2D&&(i=e.frustum.right-e.frustum.left,n=i!==e._positionCartographic.height);let o=e._position;const r=!f.equals(o,e.position)||n;r&&(o=f.clone(e.position,e._position));let s=e._direction;const a=!f.equals(s,e.direction);a&&(f.normalize(e.direction,e.direction),s=f.clone(e.direction,e._direction));let c=e._up;const u=!f.equals(c,e.up);u&&(f.normalize(e.up,e.up),c=f.clone(e.up,e._up));let d=e._right;const h=!f.equals(d,e.right);h&&(f.normalize(e.right,e.right),d=f.clone(e.right,e._right));const m=e._transformChanged||e._modeChanged;e._transformChanged=!1,m&&(B.inverseTransformation(e._transform,e._invTransform),e._mode===le.COLUMBUS_VIEW||e._mode===le.SCENE2D?B.equals(B.IDENTITY,e._transform)?B.clone(ct.TRANSFORM_2D,e._actualTransform):e._mode===le.COLUMBUS_VIEW?bLe(e):DLe(e):B.clone(e._transform,e._actualTransform),B.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const g=e._actualTransform;if(r||m)if(e._positionWC=B.multiplyByPoint(g,o,e._positionWC),t===le.SCENE3D||t===le.MORPHING)e._positionCartographic=e._projection.ellipsoid.cartesianToCartographic(e._positionWC,e._positionCartographic);else{const p=rP;p.x=e._positionWC.y,p.y=e._positionWC.z,p.z=e._positionWC.x,t===le.SCENE2D&&(p.z=i),e._projection.unproject(p,e._positionCartographic)}if(a||u||h){const p=f.dot(s,f.cross(c,d,rP));if(Math.abs(1-p)>M.EPSILON2){const y=1/f.magnitudeSquared(c),b=f.dot(c,s)*y,C=f.multiplyByScalar(s,b,rP);c=f.normalize(f.subtract(c,C,e._up),e._up),f.clone(c,e.up),d=f.cross(s,c,e._right),f.clone(d,e.right)}}(a||m)&&(e._directionWC=B.multiplyByPointAsVector(g,s,e._directionWC),f.normalize(e._directionWC,e._directionWC)),(u||m)&&(e._upWC=B.multiplyByPointAsVector(g,c,e._upWC),f.normalize(e._upWC,e._upWC)),(h||m)&&(e._rightWC=B.multiplyByPointAsVector(g,d,e._rightWC),f.normalize(e._rightWC,e._rightWC)),(r||a||u||h||m)&&B$(e)}function R$(e,t){let n;return M.equalsEpsilon(Math.abs(e.z),1,M.EPSILON3)?n=Math.atan2(t.y,t.x)-M.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-M.PI_OVER_TWO,M.TWO_PI-M.zeroToTwoPi(n)}function N$(e){return M.PI_OVER_TWO-M.acosClamped(e.z)}function M$(e,t,n){let i=0;return M.equalsEpsilon(Math.abs(e.z),1,M.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=M.zeroToTwoPi(i+M.TWO_PI)),i}const qw=new B,$w=new B;Object.defineProperties(ct.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return Ys(this),this._invTransform}},viewMatrix:{get:function(){return Ys(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return Ys(this),this._invViewMatrix}},positionCartographic:{get:function(){return Ys(this),this._positionCartographic}},positionWC:{get:function(){return Ys(this),this._positionWC}},directionWC:{get:function(){return Ys(this),this._directionWC}},upWC:{get:function(){return Ys(this),this._upWC}},rightWC:{get:function(){return Ys(this),this._rightWC}},heading:{get:function(){if(this._mode!==le.MORPHING){const e=this._projection.ellipsoid,t=B.clone(this._transform,qw),n=cn.eastNorthUpToFixedFrame(this.positionWC,e,$w);this._setTransform(n);const i=R$(this.direction,this.up);return this._setTransform(t),i}}},pitch:{get:function(){if(this._mode!==le.MORPHING){const e=this._projection.ellipsoid,t=B.clone(this._transform,qw),n=cn.eastNorthUpToFixedFrame(this.positionWC,e,$w);this._setTransform(n);const i=N$(this.direction);return this._setTransform(t),i}}},roll:{get:function(){if(this._mode!==le.MORPHING){const e=this._projection.ellipsoid,t=B.clone(this._transform,qw),n=cn.eastNorthUpToFixedFrame(this.positionWC,e,$w);this._setTransform(n);const i=M$(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}}});ct.prototype.update=function(e){if(!l(e))throw new x("mode is required.");if(e===le.SCENE2D&&!(this.frustum instanceof Wo))throw new x("An OrthographicOffCenterFrustum is required in 2D.");if((e===le.SCENE3D||e===le.COLUMBUS_VIEW)&&!(this.frustum instanceof Yn)&&!(this.frustum instanceof Gt))throw new x("A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view");let t=!1;if(e!==this._mode&&(this._mode=e,this._modeChanged=e!==le.MORPHING,t=this._mode===le.SCENE2D),t){const n=this._max2Dfrustum=this.frustum.clone();if(!(n instanceof Wo))throw new x("The camera frustum is expected to be orthographic for 2D camera control.");const 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===le.SCENE2D&&H$(this,this.position)};const ILe=new f,PLe=new f,OLe=new f;ct.prototype._setTransform=function(e){const t=f.clone(this.positionWC,ILe),n=f.clone(this.upWC,PLe),i=f.clone(this.directionWC,OLe);B.clone(e,this._transform),this._transformChanged=!0,Ys(this);const o=this._actualInvTransform;B.multiplyByPoint(o,t,this.position),B.multiplyByPointAsVector(o,i,this.direction),B.multiplyByPointAsVector(o,n,this.up),f.cross(this.direction,this.up,this.right),Ys(this)};const LLe=new j,BLe=new Un,RLe=new f,NLe=new f;function F$(e){if(!B.equals(B.IDENTITY,e.transform))return f.magnitude(e.position);const t=e._scene,n=t.globe,i=LLe;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(l(n)){const a=e.getPickRay(i,BLe);o=n.pickWorldCoordinates(a,t,!0,RLe)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,NLe));let s;if(l(o)||l(r)){const a=l(r)?f.distance(r,e.positionWC):Number.POSITIVE_INFINITY,c=l(o)?f.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,c)}else s=Math.max(e.positionCartographic.height,0);return s}ct.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof Gt&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=F$(this)))};const tv=new f,XM=new B,MLe=new B,KM=new Te,JM=new J,z$=new Ce;function FLe(e,t,n){const i=B.clone(e.transform,XM),o=cn.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,MLe);e._setTransform(o),f.clone(f.ZERO,e.position),n.heading=n.heading-M.PI_OVER_TWO;const r=Te.fromHeadingPitchRoll(n,KM),s=J.fromQuaternion(r,JM);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),f.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function zLe(e,t,n,i){const o=B.clone(e.transform,XM);if(e._setTransform(B.IDENTITY),!f.equals(t,e.positionWC)){if(i){const a=e._projection,c=a.ellipsoid.cartesianToCartographic(t,z$);t=a.project(c,tv)}f.clone(t,e.position)}n.heading=n.heading-M.PI_OVER_TWO;const r=Te.fromHeadingPitchRoll(n,KM),s=J.fromQuaternion(r,JM);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),f.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function ULe(e,t,n,i){const o=B.clone(e.transform,XM);if(e._setTransform(B.IDENTITY),!f.equals(t,e.positionWC)){if(i){const c=e._projection,u=c.ellipsoid.cartesianToCartographic(t,z$);t=c.project(u,tv)}j.clone(t,e.position);const r=-t.z*.5,s=-r,a=e.frustum;if(s>r){const c=a.top/a.right;a.right=s,a.left=r,a.top=a.right*c,a.bottom=-a.top}}if(e._scene.mapMode2D===Ip.ROTATE){n.heading=n.heading-M.PI_OVER_TWO,n.pitch=-M.PI_OVER_TWO,n.roll=0;const r=Te.fromHeadingPitchRoll(n,KM),s=J.fromQuaternion(r,JM);J.getColumn(s,2,e.up),f.cross(e.direction,e.up,e.right)}e._setTransform(o)}const HLe=new f,VLe=new f,kLe=new f;function U$(e,t,n,i){const o=f.clone(n.direction,HLe),r=f.clone(n.up,VLe);if(e._scene.mode===le.SCENE3D){const a=e._projection.ellipsoid,c=cn.eastNorthUpToFixedFrame(t,a,qw),u=B.inverseTransformation(c,$w);B.multiplyByPointAsVector(u,o,o),B.multiplyByPointAsVector(u,r,r)}const s=f.cross(o,r,kLe);return i.heading=R$(o,r),i.pitch=N$(o),i.roll=M$(o,r,s),i}const WB={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},Ng=new Xr;ct.prototype.setView=function(e){e=A(e,A.EMPTY_OBJECT);let t=A(e.orientation,A.EMPTY_OBJECT);const n=this._mode;if(n===le.MORPHING)return;l(e.endTransform)&&this._setTransform(e.endTransform);let i=A(e.convert,!0),o=A(e.destination,f.clone(this.positionWC,tv));l(o)&&l(o.west)&&(o=this.getRectangleCameraCoordinates(o,tv),i=!1),l(t.direction)&&(t=U$(this,o,t,WB.orientation)),Ng.heading=A(t.heading,0),Ng.pitch=A(t.pitch,-M.PI_OVER_TWO),Ng.roll=A(t.roll,0),n===le.SCENE3D?FLe(this,o,Ng):n===le.SCENE2D?ULe(this,o,Ng,i):zLe(this,o,Ng,i)};const GLe=new f;ct.prototype.flyHome=function(e){const t=this._mode;if(t===le.MORPHING&&this._scene.completeMorph(),t===le.SCENE2D)this.flyTo({destination:ct.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:B.IDENTITY});else if(t===le.SCENE3D){const n=this.getRectangleCameraCoordinates(ct.DEFAULT_VIEW_RECTANGLE);let i=f.magnitude(n);i+=i*ct.DEFAULT_VIEW_FACTOR,f.normalize(n,n),f.multiplyByScalar(n,i,n),this.flyTo({destination:n,duration:e,endTransform:B.IDENTITY})}else if(t===le.COLUMBUS_VIEW){const n=this._projection.ellipsoid.maximumRadius;let i=new f(0,-1,1);i=f.multiplyByScalar(f.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(f.normalize(i,GLe).z),roll:0},endTransform:B.IDENTITY,convert:!1})}};ct.prototype.worldToCameraCoordinates=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new oe),Ys(this),B.multiplyByVector(this._actualInvTransform,e,t)};ct.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new f),Ys(this),B.multiplyByPoint(this._actualInvTransform,e,t)};ct.prototype.worldToCameraCoordinatesVector=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new f),Ys(this),B.multiplyByPointAsVector(this._actualInvTransform,e,t)};ct.prototype.cameraToWorldCoordinates=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new oe),Ys(this),B.multiplyByVector(this._actualTransform,e,t)};ct.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new f),Ys(this),B.multiplyByPoint(this._actualTransform,e,t)};ct.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new f),Ys(this),B.multiplyByPointAsVector(this._actualTransform,e,t)};function H$(e,t){const n=e._scene.mapMode2D===Ip.ROTATE,i=e._maxCoord.x,o=e._maxCoord.y;let 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)}const ZH=new f;ct.prototype.move=function(e,t){if(!l(e))throw new x("direction is required.");const n=this.position;f.multiplyByScalar(e,t,ZH),f.add(n,ZH,n),this._mode===le.SCENE2D&&H$(this,n),this._adjustOrthographicFrustum(!0)};ct.prototype.moveForward=function(e){e=A(e,this.defaultMoveAmount),this._mode===le.SCENE2D?bD(this,e):this.move(this.direction,e)};ct.prototype.moveBackward=function(e){e=A(e,this.defaultMoveAmount),this._mode===le.SCENE2D?bD(this,-e):this.move(this.direction,-e)};ct.prototype.moveUp=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,e)};ct.prototype.moveDown=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,-e)};ct.prototype.moveRight=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,e)};ct.prototype.moveLeft=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,-e)};ct.prototype.lookLeft=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.up,-e)};ct.prototype.lookRight=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.up,e)};ct.prototype.lookUp=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.right,-e)};ct.prototype.lookDown=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.right,e)};const WLe=new Te,jLe=new J;ct.prototype.look=function(e,t){if(!l(e))throw new x("axis is required.");const n=A(t,this.defaultLookAmount),i=Te.fromAxisAngle(e,-n,WLe),o=J.fromQuaternion(i,jLe),r=this.direction,s=this.up,a=this.right;J.multiplyByVector(o,r,r),J.multiplyByVector(o,s,s),J.multiplyByVector(o,a,a)};ct.prototype.twistLeft=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,e)};ct.prototype.twistRight=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,-e)};const qLe=new Te,$Le=new J;ct.prototype.rotate=function(e,t){if(!l(e))throw new x("axis is required.");const n=A(t,this.defaultRotateAmount),i=Te.fromAxisAngle(e,-n,qLe),o=J.fromQuaternion(i,$Le);J.multiplyByVector(o,this.position,this.position),J.multiplyByVector(o,this.direction,this.direction),J.multiplyByVector(o,this.up,this.up),f.cross(this.direction,this.up,this.right),f.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};ct.prototype.rotateDown=function(e){e=A(e,this.defaultRotateAmount),V$(this,e)};ct.prototype.rotateUp=function(e){e=A(e,this.defaultRotateAmount),V$(this,-e)};const YLe=new f,XLe=new f,KLe=new f,eV=new f;function V$(e,t){const n=e.position;if(l(e.constrainedAxis)&&!f.equalsEpsilon(e.position,f.ZERO,M.EPSILON2)){const i=f.normalize(n,YLe),o=f.equalsEpsilon(i,e.constrainedAxis,M.EPSILON2),r=f.equalsEpsilon(i,f.negate(e.constrainedAxis,eV),M.EPSILON2);if(!o&&!r){const s=f.normalize(e.constrainedAxis,XLe);let a=f.dot(i,s),c=M.acosClamped(a);t>0&&t>c&&(t=c-M.EPSILON4),a=f.dot(i,f.negate(s,eV)),c=M.acosClamped(a),t<0&&-t>c&&(t=-c+M.EPSILON4);const u=f.cross(s,i,KLe);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}ct.prototype.rotateRight=function(e){e=A(e,this.defaultRotateAmount),k$(this,-e)};ct.prototype.rotateLeft=function(e){e=A(e,this.defaultRotateAmount),k$(this,e)};function k$(e,t){l(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function bD(e,t){const n=e.frustum;if(!(n instanceof Wo)||!l(n.left)||!l(n.right)||!l(n.bottom)||!l(n.top))throw new x("The camera frustum is expected to be orthographic for 2D camera control.");let i;if(t=t*.5,Math.abs(n.top)+Math.abs(n.bottom)>Math.abs(n.left)+Math.abs(n.right)){let o=n.top-t,r=n.bottom+t,s=e._maxCoord.y;e._scene.mapMode2D===Ip.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===Ip.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 G$(e,t){e.move(e.direction,t)}ct.prototype.zoomIn=function(e){e=A(e,this.defaultZoomAmount),this._mode===le.SCENE2D?bD(this,e):G$(this,e)};ct.prototype.zoomOut=function(e){e=A(e,this.defaultZoomAmount),this._mode===le.SCENE2D?bD(this,-e):G$(this,-e)};ct.prototype.getMagnitude=function(){if(this._mode===le.SCENE3D)return f.magnitude(this.position);if(this._mode===le.COLUMBUS_VIEW)return Math.abs(this.position.z);if(this._mode===le.SCENE2D)return Math.max(this.frustum.right-this.frustum.left,this.frustum.top-this.frustum.bottom)};const JLe=new B;ct.prototype.lookAt=function(e,t){if(!l(e))throw new x("target is required");if(!l(t))throw new x("offset is required");if(this._mode===le.MORPHING)throw new x("lookAt is not supported while morphing.");const n=cn.eastNorthUpToFixedFrame(e,me.WGS84,JLe);this.lookAtTransform(n,t)};const QLe=new f,ZLe=new Te,eBe=new Te,tBe=new J;function W$(e,t,n){t=M.clamp(t,-M.PI_OVER_TWO,M.PI_OVER_TWO),e=M.zeroToTwoPi(e)-M.PI_OVER_TWO;const i=Te.fromAxisAngle(f.UNIT_Y,-t,ZLe),o=Te.fromAxisAngle(f.UNIT_Z,-e,eBe),r=Te.multiply(o,i,o),s=J.fromQuaternion(r,tBe),a=f.clone(f.UNIT_X,QLe);return J.multiplyByVector(s,a,a),f.negate(a,a),f.multiplyByScalar(a,n,a),a}ct.prototype.lookAtTransform=function(e,t){if(!l(e))throw new x("transform is required");if(this._mode===le.MORPHING)throw new x("lookAtTransform is not supported while morphing.");if(this._setTransform(e),!l(t))return;let n;if(l(t.heading)?n=W$(t.heading,t.pitch,t.range):n=t,this._mode===le.SCENE2D){j.clone(j.ZERO,this.position),f.negate(n,this.up),this.up.z=0,f.magnitudeSquared(this.up)<M.EPSILON10&&f.clone(f.UNIT_Y,this.up),f.normalize(this.up,this.up),this._setTransform(B.IDENTITY),f.negate(f.UNIT_Z,this.direction),f.cross(this.direction,this.up,this.right),f.normalize(this.right,this.right);const i=this.frustum,o=i.top/i.right;i.right=f.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}f.clone(n,this.position),f.negate(this.position,this.direction),f.normalize(this.direction,this.direction),f.cross(this.direction,f.UNIT_Z,this.right),f.magnitudeSquared(this.right)<M.EPSILON10&&f.clone(f.UNIT_X,this.right),f.normalize(this.right,this.right),f.cross(this.right,this.direction,this.up),f.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const yA=new Ce,nBe=new Ce,iBe=new f,oBe=new f,rBe=new f,sBe=new f,aBe=new f,cBe=new f,lBe=new f,sP=new f,uBe={direction:new f,right:new f,up:new f};let tV;function Hs(e,t,n,i){return Math.abs(f.dot(t,n))/i-f.dot(e,n)}function j$(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:uBe,s=t.north,a=t.south;let c=t.east;const u=t.west;u>c&&(c+=M.TWO_PI);const d=(u+c)*.5;let h;if(a<-M.PI_OVER_TWO+M.RADIANS_PER_DEGREE&&s>M.PI_OVER_TWO-M.RADIANS_PER_DEGREE)h=0;else{const F=yA;F.longitude=d,F.latitude=s,F.height=0;const U=nBe;U.longitude=d,U.latitude=a,U.height=0;let D=tV;(!l(D)||D.ellipsoid!==o)&&(tV=D=new qf(void 0,void 0,o)),D.setEndPoints(F,U),h=D.interpolateUsingFraction(.5,yA).latitude}const m=yA;m.longitude=d,m.latitude=h,m.height=0;const g=o.cartographicToCartesian(m,lBe),p=yA;p.longitude=c,p.latitude=s;const y=o.cartographicToCartesian(p,iBe);p.longitude=u;const b=o.cartographicToCartesian(p,rBe);p.longitude=d;const C=o.cartographicToCartesian(p,aBe);p.latitude=a;const E=o.cartographicToCartesian(p,cBe);p.longitude=c;const w=o.cartographicToCartesian(p,sBe);p.longitude=u;const S=o.cartographicToCartesian(p,oBe);f.subtract(b,g,b),f.subtract(w,g,w),f.subtract(y,g,y),f.subtract(S,g,S),f.subtract(C,g,C),f.subtract(E,g,E);const P=o.geodeticSurfaceNormal(g,r.direction);f.negate(P,P);const L=f.cross(P,f.UNIT_Z,r.right);f.normalize(L,L);const z=f.cross(L,P,r.up);let R;if(e.frustum instanceof Gt){const F=Math.max(f.distance(y,b),f.distance(w,S)),U=Math.max(f.distance(y,w),f.distance(b,S));let D,I;const _=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,v=U*_;F>v?(D=F,I=D/_):(I=U,D=v),R=Math.max(D,I)}else{const F=Math.tan(e.frustum.fovy*.5),U=e.frustum.aspectRatio*F;if(R=Math.max(Hs(P,z,b,F),Hs(P,z,w,F),Hs(P,z,y,F),Hs(P,z,S,F),Hs(P,z,C,F),Hs(P,z,E,F),Hs(P,L,b,U),Hs(P,L,w,U),Hs(P,L,y,U),Hs(P,L,S,U),Hs(P,L,C,U),Hs(P,L,E,U)),a<0&&s>0){const D=yA;D.longitude=u,D.latitude=0,D.height=0;let I=o.cartographicToCartesian(D,sP);f.subtract(I,g,I),R=Math.max(R,Hs(P,z,I,F),Hs(P,L,I,U)),D.longitude=c,I=o.cartographicToCartesian(D,sP),f.subtract(I,g,I),R=Math.max(R,Hs(P,z,I,F),Hs(P,L,I,U))}}return f.add(g,f.multiplyByScalar(P,-R,sP),n)}const dBe=new Ce,fBe=new f,hBe=new f;function pBe(e,t,n){const i=e._projection;t.west>t.east&&(t=ge.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=dBe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,fBe);B.multiplyByPoint(o,a,a),B.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const c=i.project(s,hBe);if(B.multiplyByPoint(o,c,c),B.multiplyByPoint(r,c,c),n.x=(a.x-c.x)*.5+c.x,n.y=(a.y-c.y)*.5+c.y,l(e.frustum.fovy)){const u=Math.tan(e.frustum.fovy*.5),d=e.frustum.aspectRatio*u;n.z=Math.max((a.x-c.x)/d,(a.y-c.y)/u)*.5}else{const u=a.x-c.x,d=a.y-c.y;n.z=Math.max(u,d)}return n}const mBe=new Ce,_Be=new f,gBe=new f;function yBe(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===Ip.INFINITE_SCROLL?o+=M.TWO_PI:(t=ge.MAX_VALUE,o=t.east));let r=mBe;r.longitude=o,r.latitude=t.north;const s=i.project(r,_Be);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,gBe),c=Math.abs(s.x-a.x)*.5;let u=Math.abs(s.y-a.y)*.5,d,h;const m=e.frustum.right/e.frustum.top,g=u*m;return c>g?(d=c,h=d/m):(h=u,d=g),u=Math.max(2*d,2*h),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}ct.prototype.getRectangleCameraCoordinates=function(e,t){if(!l(e))throw new x("rectangle is required");const n=this._mode;if(l(t)||(t=new f),n===le.SCENE3D)return j$(this,e,t);if(n===le.COLUMBUS_VIEW)return pBe(this,e,t);if(n===le.SCENE2D)return yBe(this,e,t)};const ABe=new Un;function bBe(e,t,n,i){n=A(n,me.WGS84);const o=e.getPickRay(t,ABe),r=pr.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return Un.getPoint(o,s,i)}const CBe=new Un;function TBe(e,t,n,i){let r=e.getPickRay(t,CBe).origin;r=f.fromElements(r.y,r.z,0,r);const s=n.unproject(r);if(!(s.latitude<-M.PI_OVER_TWO||s.latitude>M.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}const EBe=new Un;function xBe(e,t,n,i){const o=e.getPickRay(t,EBe),r=-o.origin.x/o.direction.x;Un.getPoint(o,r,i);const s=n.unproject(new f(i.y,i.z,0));if(!(s.latitude<-M.PI_OVER_TWO||s.latitude>M.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}ct.prototype.pickEllipsoid=function(e,t,n){if(!l(e))throw new x("windowPosition is required.");const i=this._scene.canvas;if(!(i.clientWidth===0||i.clientHeight===0)){if(l(n)||(n=new f),t=A(t,me.WGS84),this._mode===le.SCENE3D)n=bBe(this,e,t,n);else if(this._mode===le.SCENE2D)n=TBe(this,e,this._projection,n);else if(this._mode===le.COLUMBUS_VIEW)n=xBe(this,e,this._projection,n);else return;return n}};const wBe=new f,SBe=new f,vBe=new f;function DBe(e,t,n){const 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,u=2/o*t.x-1,d=2/r*(r-t.y)-1,h=e.positionWC;f.clone(h,n.origin);const m=f.multiplyByScalar(e.directionWC,c,wBe);f.add(h,m,m);const g=f.multiplyByScalar(e.rightWC,u*c*a,SBe),p=f.multiplyByScalar(e.upWC,d*c*s,vBe),y=f.add(m,g,n.direction);return f.add(y,p,y),f.subtract(y,h,y),f.normalize(y,y),n}const Cx=new f;function IBe(e,t,n){const i=e._scene.canvas,o=i.clientWidth,r=i.clientHeight;let s=e.frustum;l(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;const u=n.origin;return f.clone(e.position,u),f.multiplyByScalar(e.right,a,Cx),f.add(Cx,u,u),f.multiplyByScalar(e.up,c,Cx),f.add(Cx,u,u),f.clone(e.directionWC,n.direction),(e._mode===le.COLUMBUS_VIEW||e._mode===le.SCENE2D)&&f.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}ct.prototype.getPickRay=function(e,t){if(!l(e))throw new x("windowPosition is required.");l(t)||(t=new Un);const n=this._scene.canvas;if(n.clientWidth<=0||n.clientHeight<=0)return;const i=this.frustum;return l(i.aspectRatio)&&l(i.fov)&&l(i.near)?DBe(this,e,t):IBe(this,e,t)};const PBe=new f,OBe=new f;ct.prototype.distanceToBoundingSphere=function(e){if(!l(e))throw new x("boundingSphere is required.");const t=f.subtract(this.positionWC,e.center,PBe),n=f.multiplyByScalar(this.directionWC,f.dot(t,this.directionWC),OBe);return Math.max(0,f.magnitude(n)-e.radius)};const LBe=new j;ct.prototype.getPixelSize=function(e,t,n){if(!l(e))throw new x("boundingSphere is required.");if(!l(t))throw new x("drawingBufferWidth is required.");if(!l(n))throw new x("drawingBufferHeight is required.");const i=this.distanceToBoundingSphere(e),o=this.frustum.getPixelDimensions(t,n,i,this._scene.pixelRatio,LBe);return Math.max(o.x,o.y)};function BBe(e,t,n,i,o,r){const s=f.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){const u=f.lerp(t,s,c.time,new f);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:xc.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}const RBe=new f,nV=new f,NBe=new f,MBe=new f;function FBe(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(f.UNIT_X,RBe),r=-f.dot(o,n)/f.dot(o,i),s=f.add(n,f.multiplyByScalar(i,r,nV),nV);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,NBe);const a=Math.tan(e.frustum.fovy*.5),c=e.frustum.aspectRatio*a,u=f.magnitude(f.subtract(n,s,MBe)),d=c*u,h=a*u,m=e._maxCoord.x,g=e._maxCoord.y,p=Math.max(d-m,m),y=Math.max(h-g,g);if(n.z<-p||n.z>p||n.y<-y||n.y>y){const b=s.y<-p||s.y>p,C=s.z<-y||s.z>y;if(b||C)return BBe(e,n,s,p,y,t)}}ct.prototype.createCorrectPositionTween=function(e){if(!l(e))throw new x("duration is required.");if(this._mode===le.COLUMBUS_VIEW)return FBe(this,e)};const zBe=new f,kr={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};ct.prototype.cancelFlight=function(){l(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};ct.prototype.completeFlight=function(){if(l(this._currentFlight)){this._currentFlight.cancelTween();const e={destination:void 0,orientation:{heading:void 0,pitch:void 0,roll:void 0}};e.destination=kr.destination,e.orientation.heading=kr.heading,e.orientation.pitch=kr.pitch,e.orientation.roll=kr.roll,this.setView(e),l(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};ct.prototype.flyTo=function(e){e=A(e,A.EMPTY_OBJECT);let t=e.destination;if(!l(t))throw new x("destination is required.");if(this._mode===le.MORPHING)return;this.cancelFlight();const i=t instanceof ge;i&&(t=this.getRectangleCameraCoordinates(t,zBe));let o=A(e.orientation,A.EMPTY_OBJECT);if(l(o.direction)&&(o=U$(this,t,o,WB.orientation)),l(e.duration)&&e.duration<=0){const d=WB;d.destination=e.destination,d.orientation.heading=o.heading,d.orientation.pitch=o.pitch,d.orientation.roll=o.roll,d.convert=e.convert,d.endTransform=e.endTransform,this.setView(d),typeof e.complete=="function"&&e.complete();return}const r=this;let s;kr.destination=t,kr.heading=o.heading,kr.pitch=o.pitch,kr.roll=o.roll,kr.duration=e.duration,kr.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),l(e.complete)&&e.complete()},kr.cancel=e.cancel,kr.endTransform=e.endTransform,kr.convert=i?!1:e.convert,kr.maximumHeight=e.maximumHeight,kr.pitchAdjustHeight=e.pitchAdjustHeight,kr.flyOverLongitude=e.flyOverLongitude,kr.flyOverLongitudeWeight=e.flyOverLongitudeWeight,kr.easingFunction=e.easingFunction;const a=this._scene,c=gLe.createTween(a,kr);if(c.duration===0){typeof c.complete=="function"&&c.complete();return}s=a.tweens.add(c),this._currentFlight=s;let u=this._scene.preloadFlightCamera;this._mode!==le.SCENE2D&&(l(u)||(u=ct.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function UBe(e,t){const n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function HBe(e,t){let n=e.frustum;l(n._offCenterFrustum)&&(n=n._offCenterFrustum);let i,o;const 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}const VBe=100;function q$(e,t,n){n=D_.clone(l(n)?n:ct.DEFAULT_OFFSET);const i=e._scene.screenSpaceCameraController.minimumZoomDistance,o=e._scene.screenSpaceCameraController.maximumZoomDistance,r=n.range;if(!l(r)||r===0){const s=t.radius;s===0?n.range=VBe:e.frustum instanceof Gt||e._mode===le.SCENE2D?n.range=HBe(e,s):n.range=UBe(e,s),n.range=M.clamp(n.range,i,o)}return n}ct.prototype.viewBoundingSphere=function(e,t){if(!l(e))throw new x("boundingSphere is required.");if(this._mode===le.MORPHING)throw new x("viewBoundingSphere is not supported while morphing.");t=q$(this,e,t),this.lookAt(e.center,t)};const kBe=new B,GBe=new f,WBe=new f,jBe=new f,qBe=new f,$Be=new oe,YBe=new Te,XBe=new J;ct.prototype.flyToBoundingSphere=function(e,t){if(!l(e))throw new x("boundingSphere is required.");t=A(t,A.EMPTY_OBJECT);const n=this._mode===le.SCENE2D||this._mode===le.COLUMBUS_VIEW;this._setTransform(B.IDENTITY);const i=q$(this,e,t.offset);let o;n?o=f.multiplyByScalar(f.UNIT_Z,i.range,GBe):o=W$(i.heading,i.pitch,i.range);const r=cn.eastNorthUpToFixedFrame(e.center,me.WGS84,kBe);B.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=f.subtract(e.center,o,WBe),f.normalize(s,s),a=B.multiplyByPointAsVector(r,f.UNIT_Z,jBe),1-Math.abs(f.dot(s,a))<M.EPSILON6){const u=Te.fromAxisAngle(s,i.heading,YBe),d=J.fromQuaternion(u,XBe);f.fromCartesian4(B.getColumn(r,1,$Be),a),J.multiplyByVector(d,a,a)}const c=f.cross(s,a,qBe);f.cross(c,s,a),f.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})};const iV=new f,oV=new f,aP=new f,rV=new f,AA=[new f,new f,new f,new f];function KBe(e,t){const n=t.radii,i=e.positionWC,o=f.multiplyComponents(t.oneOverRadii,i,iV),r=f.magnitude(o),s=f.normalize(o,oV);let a,c;f.equalsEpsilon(s,f.UNIT_Z,M.EPSILON10)?(a=new f(0,1,0),c=new f(0,0,1)):(a=f.normalize(f.cross(f.UNIT_Z,s,aP),aP),c=f.normalize(f.cross(s,a,rV),rV));const u=Math.sqrt(f.magnitudeSquared(o)-1),d=f.multiplyByScalar(s,1/r,iV),h=u/r,m=f.multiplyByScalar(a,h,oV),g=f.multiplyByScalar(c,h,aP),p=f.add(d,g,AA[0]);f.subtract(p,m,p),f.multiplyComponents(n,p,p);const y=f.subtract(d,g,AA[1]);f.subtract(y,m,y),f.multiplyComponents(n,y,y);const b=f.subtract(d,g,AA[2]);f.add(b,m,b),f.multiplyComponents(n,b,b);const C=f.add(d,g,AA[3]);return f.add(C,m,C),f.multiplyComponents(n,C,C),AA}const cP=new j,JBe=new f,Qh=[new Ce,new Ce,new Ce,new Ce];function Tx(e,t,n,i,o,r){cP.x=e,cP.y=t;const s=i.pickEllipsoid(cP,o,JBe);return l(s)?(Qh[n]=o.cartesianToCartographic(s,Qh[n]),1):(Qh[n]=o.cartesianToCartographic(r[n],Qh[n]),0)}ct.prototype.computeViewRectangle=function(e,t){e=A(e,me.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new fe(f.ZERO,e.maximumRadius);if(n.computeVisibility(i)===xn.OUTSIDE)return;const r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight;let c=0;const u=KBe(this,e);if(c+=Tx(0,0,0,this,e,u),c+=Tx(0,a,1,this,e,u),c+=Tx(s,a,2,this,e,u),c+=Tx(s,0,3,this,e,u),c<2)return ge.MAX_VALUE;t=ge.fromCartographicArray(Qh,t);let d=0,h=Qh[3].longitude;for(let m=0;m<4;++m){const g=Qh[m].longitude,p=Math.abs(g-h);p>M.PI?d+=M.TWO_PI-p:d+=p,h=g}return M.equalsEpsilon(Math.abs(d),M.TWO_PI,M.EPSILON9)&&(t.west=-M.PI,t.east=M.PI,Qh[0].latitude>=0?t.north=M.PI_OVER_TWO:t.south=-M.PI_OVER_TWO),t};ct.prototype.switchToPerspectiveFrustum=function(){if(this._mode===le.SCENE2D||this.frustum instanceof Yn)return;const e=this._scene;this.frustum=new Yn,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=M.toRadians(60)};ct.prototype.switchToOrthographicFrustum=function(){if(this._mode===le.SCENE2D||this.frustum instanceof Gt)return;const e=F$(this),t=this._scene;this.frustum=new Gt,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};ct.clone=function(e,t){return l(t)||(t=new ct(e._scene)),f.clone(e.position,t.position),f.clone(e.direction,t.direction),f.clone(e.up,t.up),f.clone(e.right,t.right),B.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};function la(e){e=A(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(la.prototype,{length:{get:function(){return this._length},set:function(e){T.typeOf.number.greaterThanOrEquals("length",e,0);const 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}}});la.prototype.get=function(e){return T.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};la.prototype.set=function(e,t){T.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};la.prototype.peek=function(){return this._array[this._length-1]};la.prototype.push=function(e){const t=this.length++;this._array[t]=e};la.prototype.pop=function(){if(this._length===0)return;const e=this._array[this._length-1];return--this.length,e};la.prototype.reserve=function(e){T.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};la.prototype.resize=function(e){T.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};la.prototype.trim=function(e){e=A(e,this._length),this._array.length=e};const QBe={ADD:0,REPLACE:1},Pa=Object.freeze(QBe);function QM(){}const bA={stack:new la,stackMaximumLength:0};QM.selectTiles=function(e,t){e._selectedTiles.length=0,e._requestedTiles.length=0,e._hasMixedContent=!1;let n=!0;const i=e.root;if(i.updateVisibility(t),!$$(i))return n;const o=bA.stack;for(o.push(e.root);o.length>0;){bA.stackMaximumLength=Math.max(bA.stackMaximumLength,o.length);const r=o.pop(),s=r.refine===Pa.ADD,a=r.refine===Pa.REPLACE,c=eRe(e,r);c&&tRe(e,r,o,t),(s||a&&!c)&&(nRe(e,r),iRe(e,r,t),rRe(e,r,t),!Y$(r)&&!r.contentAvailable&&(n=!1)),oRe(e)}return bA.stack.trim(bA.stackMaximumLength),n};function $$(e){return e._visible&&e._inRequestVolume}function Y$(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function ZBe(e){return!Y$(e)&&e.contentUnloaded}function eRe(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0)}function tRe(e,t,n,i){const o=t.children,r=o.length;for(let s=0;s<r;++s){const a=o[s];a.updateVisibility(i),$$(a)&&n.push(a)}}function nRe(e,t){(ZBe(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function iRe(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function oRe(e){++e.statistics.visited}function rRe(e,t,n){t.contentAvailable&&t.contentVisibility(n)!==xn.OUTSIDE&&e._selectedTiles.push(t)}const sRe={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},xy=Object.freeze(sRe);function tg(){}function ng(e){return e._visible&&e._inRequestVolume}const Fb={stack:new la,stackMaximumLength:0},zb={stack:new la,stackMaximumLength:0},Ub={stack:new la,stackMaximumLength:0},$u={stack:new la,stackMaximumLength:0,ancestorStack:new la,ancestorStackMaximumLength:0},aRe=2;tg.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;const n=e.root;if(TD(e,n,t),!ng(n)||n.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;vC(e)?e.immediatelyLoadDesiredLevelOfDetail?lRe(e,n,t):uRe(e,n,t):cRe(e,n,t),Fb.stack.trim(Fb.stackMaximumLength),zb.stack.trim(zb.stackMaximumLength),Ub.stack.trim(Ub.stackMaximumLength),$u.stack.trim($u.stackMaximumLength),$u.ancestorStack.trim($u.ancestorStackMaximumLength);const i=e._requestedTiles,o=i.length;for(let r=0;r<o;++r)i[r].updatePriority()};function cRe(e,t,n){const i=e._maximumScreenSpaceError,o=e._maximumScreenSpaceError;e2(e,t,i,o,n)}function lRe(e,t,n){const i=Number.MAX_VALUE,o=e._maximumScreenSpaceError;e2(e,t,i,o,n),Q$(e,t,n)}function uRe(e,t,n){const i=Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),o=e.maximumScreenSpaceError;e2(e,t,i,o,n),Q$(e,t,n)}function vC(e){return e._skipLevelOfDetail}function dRe(e,t){e._emptyTiles.push(t)}function Hb(e,t,n){if(t.contentVisibility(n)!==xn.OUTSIDE){const 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 fRe(e,t,n){const i=Ub.stack;for(i.push(t);i.length>0;){Ub.stackMaximumLength=Math.max(Ub.stackMaximumLength,i.length);const r=i.pop().children,s=r.length;for(let a=0;a<s;++a){const c=r[a];ng(c)&&(c.contentAvailable?(TD(e,c,n),CD(e,c,n),Hb(e,c,n)):c._depth-t._depth<aRe&&i.push(c))}}}function Ex(e,t,n){if(!vC(e)){t.contentAvailable&&Hb(e,t,n);return}const i=t.contentAvailable?t:t._ancestorWithContentAvailable;l(i)?i._shouldSelect=!0:fRe(e,t,n)}function hRe(e,t,n){++e._statistics.visited,t._visitedFrame=n.frameNumber}function CD(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function pRe(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 mRe(e,t,n){if(!e._cullRequestsWhileMoving)return!0;const 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 Ym(e,t,n){if(t._requestedFrame===n.frameNumber||!J$(t)&&!t.contentExpired||!mRe(e,t,n))return;const i=n.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&i||(t._requestedFrame=n.frameNumber,e._requestedTiles.push(t))}function X$(e,t,n){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(n),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function _Re(e,t,n){let i=!1;const o=t.children,r=o.length;for(let s=0;s<r;++s){const a=o[s];X$(e,a,n),i=i||ng(a)}return i}function gRe(e,t,n){const i=t.parent;return!l(i)||i.hasTilesetContent||i.hasImplicitContent||i.refine!==Pa.ADD?!1:t.getScreenSpaceError(n,!0)<=e._maximumScreenSpaceError}function K$(e,t,n){if(X$(e,t,n),!ng(t))return;const i=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&i){const s=t.children[0];K$(e,s,n),t._visible=s._visible;return}if(gRe(e,t,n)){t._visible=!1;return}const o=t.refine===Pa.REPLACE,r=t._optimChildrenWithinParent===xy.USE_OPTIMIZATION;if(o&&r&&i&&!_Re(e,t,n)){++e._statistics.numberOfTilesCulledWithChildrenUnion,t._visible=!1;return}}function TD(e,t,n){K$(e,t,n),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,pRe(e,t),t._shouldSelect=!1,t._finalResolution=!0}function yRe(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const n=e.parent;if(l(n)){const i=!J$(n)||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}}function DC(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function J$(e){return!DC(e)&&e.contentUnloaded}function ARe(e,t){const n=t._ancestorWithContent;return!e.immediatelyLoadDesiredLevelOfDetail&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf||l(n)&&t._screenSpaceError<n._screenSpaceError/e.skipScreenSpaceErrorFactor&&t._depth>n._depth+e.skipLevels)}function bRe(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function CRe(e,t,n,i){let o;const r=t.refine===Pa.REPLACE,s=t.children,a=s.length;for(o=0;o<a;++o)TD(e,s[o],i);s.sort(bRe);const c=!vC(e)&&r&&!DC(t);let u=!0,d=!1,h=-1,m=Number.MAX_VALUE,g;for(o=0;o<a;++o)if(g=s[o],ng(g)?(n.push(g),g._foveatedFactor<m&&(h=o,m=g._foveatedFactor),d=!0):(c||e.loadSiblings)&&(g._foveatedFactor<m&&(h=o,m=g._foveatedFactor),Ym(e,g,i),CD(e,g,i)),c){let p;g._inRequestVolume?DC(g)?p=ERe(e,g,i):p=g.contentAvailable:p=!1,u=u&&p}if(d||(u=!1),h!==-1&&!vC(e)&&r){const p=s[h];p._wasMinPriorityChild=!0;const y=(t._wasMinPriorityChild||t===e.root)&&m<=t._priorityHolder._foveatedFactor?t._priorityHolder:t;for(y._foveatedFactor=Math.min(p._foveatedFactor,y._foveatedFactor),y._distanceToCamera=Math.min(p._distanceToCamera,y._distanceToCamera),o=0;o<a;++o)g=s[o],g._priorityHolder=y}return u}function TRe(e,t,n){return vC(e)?e.immediatelyLoadDesiredLevelOfDetail?!1:l(t._ancestorWithContent)?t._screenSpaceError===0?t.parent._screenSpaceError>n:t._screenSpaceError>n:!0:!0}function ZM(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError}function e2(e,t,n,i,o){const r=Fb.stack;for(r.push(t);r.length>0;){Fb.stackMaximumLength=Math.max(Fb.stackMaximumLength,r.length);const s=r.pop();yRe(s,o);const a=TRe(e,s,n),c=s.refine===Pa.ADD,u=s.refine===Pa.REPLACE,d=s.parent,h=!l(d)||d._refines;let m=!1;ZM(e,s)&&(m=CRe(e,s,r,o)&&h);const g=!m&&h;DC(s)?(dRe(e,s),Ym(e,s,o),g&&Ex(e,s,o)):c?(Ex(e,s,o),Ym(e,s,o)):u&&(a?(Ym(e,s,o),g&&Ex(e,s,o)):g?(Ex(e,s,o),Ym(e,s,o)):ARe(e,s)&&Ym(e,s,o)),hRe(e,s,o),CD(e,s,o),s._refines=m}}function ERe(e,t,n){let i=!0;const o=zb.stack;for(o.push(t);o.length>0;){zb.stackMaximumLength=Math.max(zb.stackMaximumLength,o.length);const r=o.pop(),s=r.children,a=s.length,c=DC(r),u=c&&ZM(e,r),d=c&&r.children.length===0;if(!u&&!r.contentAvailable&&!d&&(i=!1),TD(e,r,n),ng(r)||(Ym(e,r,n),CD(e,r,n)),u)for(let h=0;h<a;++h){const m=s[h];o.push(m)}}return i}function Q$(e,t,n){const i=$u.stack,o=$u.ancestorStack;let r;for(i.push(t);i.length>0||o.length>0;){if($u.stackMaximumLength=Math.max($u.stackMaximumLength,i.length),$u.ancestorStackMaximumLength=Math.max($u.ancestorStackMaximumLength,o.length),o.length>0){const m=o.peek();if(m._stackLength===i.length){o.pop(),m!==r&&(m._finalResolution=!1),Hb(e,m,n);continue}}const s=i.pop();if(!l(s))continue;const a=s.refine===Pa.ADD,c=s._shouldSelect,u=s.children,d=u.length,h=ZM(e,s);if(c)if(a)Hb(e,s,n);else{if(s._selectionDepth=o.length,s._selectionDepth>0&&(e._hasMixedContent=!0),r=s,!h){Hb(e,s,n);continue}o.push(s),s._stackLength=i.length}if(h)for(let m=0;m<d;++m){const g=u[m];ng(g)&&i.push(g)}}}const xu={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},$f=new Array(xu.NUMBER_OF_PASSES);$f[xu.RENDER]=Object.freeze({traversal:tg,isRender:!0,requestTiles:!0,ignoreCommands:!1});$f[xu.PICK]=Object.freeze({traversal:tg,isRender:!1,requestTiles:!1,ignoreCommands:!1});$f[xu.SHADOW]=Object.freeze({traversal:tg,isRender:!1,requestTiles:!0,ignoreCommands:!1});$f[xu.PRELOAD]=Object.freeze({traversal:tg,isRender:!1,requestTiles:!0,ignoreCommands:!0});$f[xu.PRELOAD_FLIGHT]=Object.freeze({traversal:tg,isRender:!1,requestTiles:!0,ignoreCommands:!0});$f[xu.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:tg,isRender:!1,requestTiles:!0,ignoreCommands:!0});$f[xu.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:QM,isRender:!1,requestTiles:!0,ignoreCommands:!0});$f[xu.MOST_DETAILED_PICK]=Object.freeze({traversal:QM,isRender:!1,requestTiles:!1,ignoreCommands:!1});xu.getPassOptions=function(e){return $f[e]};const ra=Object.freeze(xu);function ig(e){T.typeOf.object("options",e),T.typeOf.number("options.pass",e.pass),this.pass=e.pass,this.commandList=e.commandList,this.camera=e.camera,this.cullingVolume=e.cullingVolume,this.ready=!1}function vt(){this._array=[],this._hash={}}Object.defineProperties(vt.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});vt.prototype.contains=function(e){if(typeof e!="string"&&typeof e!="number")throw new x("key is required to be a string or number.");return l(this._hash[e])};vt.prototype.set=function(e,t){if(typeof e!="string"&&typeof e!="number")throw new x("key is required to be a string or number.");const n=this._hash[e];t!==n&&(this.remove(e),this._hash[e]=t,this._array.push(t))};vt.prototype.get=function(e){if(typeof e!="string"&&typeof e!="number")throw new x("key is required to be a string or number.");return this._hash[e]};vt.prototype.remove=function(e){if(l(e)&&typeof e!="string"&&typeof e!="number")throw new x("key is required to be a string or number.");const t=this._hash[e],n=l(t);if(n){const i=this._array;i.splice(i.indexOf(t),1),delete this._hash[e]}return n};vt.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)};const sV=576,xRe=100,CA="#ffffff",lP="#48b";function Z$(e,t){this.credit=e,this.count=A(t,1)}function wRe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(ai.equals(o,t))return!0}return!1}function SRe(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;ai.equals(n,t)||(l(t)&&e._cesiumCreditContainer.removeChild(t.element),l(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const eY="cesium-credit-delimiter";function aV(e){const t=document.createElement("span");return t.textContent=e,t.className=eY,t}function cV(e,t){if(l(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function lV(e,t,n,i){const o=e.childNodes;let r=-1;t.sort(function(s,a){return a.count-s.count});for(let s=0;s<t.length;++s){const a=t[s].credit;if(l(a)){if(r=s,l(n)&&(r*=2,s>0)){const u=r-1;if(o.length<=u)e.appendChild(aV(n));else{const d=o[u];d.className!==eY&&e.replaceChild(aV(n),d)}}const c=a.element;if(o.length<=r)e.appendChild(cV(c,i));else{const u=o[r];u._creditId!==a._id&&e.replaceChild(cV(c,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function vRe(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<sV?(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>=sV&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function Vs(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` }
|
||
`,n}function DRe(){let e="";e+=Vs(".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+=Vs(".cesium-credit-lightbox",{"background-color":"#303336",color:CA,position:"relative","min-height":`${xRe}px`,margin:"auto"}),e+=Vs(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:CA}),e+=Vs(".cesium-credit-lightbox > ul > li a:hover",{color:lP}),e+=Vs(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=Vs(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=Vs(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=Vs(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:CA}),e+=Vs(".cesium-credit-lightbox-close:hover",{color:lP}),e+=Vs(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=Vs(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=Vs(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=Vs(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:CA}),e+=Vs(".cesium-credit-expand-link:hover",{color:lP}),e+=Vs(".cesium-credit-text",{color:CA}),e+=Vs(".cesium-credit-textContainer *, .cesium-credit-logoContainer *",{display:"inline"});const t=document.head,n=document.createElement("style");n.innerHTML=e,t.insertBefore(n,t.firstChild)}function Vo(e,t,n){T.defined("container",e);const i=this;n=A(n,document.body);const o=document.createElement("div");o.className="cesium-credit-lightbox-overlay",n.appendChild(o);const r=document.createElement("div");r.className="cesium-credit-lightbox",o.appendChild(r);function s(p){r.contains(p.target)||i.hideLightbox()}o.addEventListener("click",s,!1);const a=document.createElement("div");a.className="cesium-credit-lightbox-title",a.textContent="Data provided by:",r.appendChild(a);const c=document.createElement("a");c.onclick=this.hideLightbox.bind(this),c.innerHTML="×",c.className="cesium-credit-lightbox-close",r.appendChild(c);const u=document.createElement("ul");r.appendChild(u);const d=document.createElement("div");d.className="cesium-credit-logoContainer",d.style.display="inline",e.appendChild(d);const h=document.createElement("div");h.className="cesium-credit-textContainer",h.style.display="inline",e.appendChild(h);const m=document.createElement("a");m.className="cesium-credit-expand-link",m.onclick=this.showLightbox.bind(this),m.textContent="Data attribution",e.appendChild(m),DRe();const g=ai.clone(Vo.cesiumCredit);this._delimiter=A(t," • "),this._screenContainer=h,this._cesiumCreditContainer=d,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=m,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new vt,lightboxCredits:new vt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function tY(e,t,n,i){i=A(i,1);let o=t.get(n.id);if(l(o))o.count<Number.MAX_VALUE&&(o.count+=i);else{const r=e._creditDisplayElementPool,s=e._creditDisplayElementPoolIndex;s<r.length?(o=r[s],o.credit=n,o.count=i):(o=new Z$(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}Vo.prototype.addCredit=function(e){if(T.defined("credit",e),e._isIon){l(this._defaultCredit)||(this._defaultCredit=ai.clone(nY())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,tY(this,t,e)};Vo.prototype.addDefaultCredit=function(e){T.defined("credit",e);const t=this._defaultCredits;wRe(t,e)||t.push(e)};Vo.prototype.removeDefaultCredit=function(e){T.defined("credit",e);const t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};Vo.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};Vo.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};Vo.prototype.update=function(){this._expanded&&vRe(this)};Vo.prototype.beginFrame=function(){const e=this._currentFrameCredits;this._creditDisplayElementPoolIndex=0;const t=e.screenCredits;t.removeAll();const n=this._defaultCredits;for(let i=0;i<n.length;++i){const o=n[i];tY(this,t,o,Number.MAX_VALUE)}e.lightboxCredits.removeAll(),ai.equals(Vo.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=ai.clone(Vo.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};Vo.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;lV(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",lV(this._creditList,t,void 0,"li"),SRe(this)};Vo.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),He(this)};Vo.prototype.isDestroyed=function(){return!1};Vo._cesiumCredit=void 0;Vo._cesiumCreditInitialized=!1;let xx;function nY(){if(!l(xx)){let e=An("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new Rs(e).path()),xx=new ai(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return Vo._cesiumCreditInitialized||(Vo._cesiumCredit=xx,Vo._cesiumCreditInitialized=!0),xx}Object.defineProperties(Vo,{cesiumCredit:{get:function(){return nY(),Vo._cesiumCredit},set:function(e){Vo._cesiumCredit=e,Vo._cesiumCreditInitialized=!0}}});Vo.CreditDisplayElement=Z$;const ED=0,IRe=1;function Pp(e){T.typeOf.object("options",e),T.typeOf.object("options.frustum",e.frustum),T.typeOf.object("options.origin",e.origin),T.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=A(e.vertexFormat,Fe.DEFAULT),r=A(e._drawNearPlane,!0);let s,a;t instanceof Yn?(s=ED,a=Yn.packedLength):t instanceof Gt&&(s=IRe,a=Gt.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=f.clone(i),this._orientation=Te.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+f.packedLength+Te.packedLength+Fe.packedLength}Pp.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===ED?(Yn.pack(o,t,n),n+=Yn.packedLength):(Gt.pack(o,t,n),n+=Gt.packedLength),f.pack(e._origin,t,n),n+=f.packedLength,Te.pack(e._orientation,t,n),n+=Te.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n]=e._drawNearPlane?1:0,t};const PRe=new Yn,ORe=new Gt,LRe=new Te,BRe=new f,RRe=new Fe;Pp.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=e[t++];let o;i===ED?(o=Yn.unpack(e,t,PRe),t+=Yn.packedLength):(o=Gt.unpack(e,t,ORe),t+=Gt.packedLength);const r=f.unpack(e,t,BRe);t+=f.packedLength;const s=Te.unpack(e,t,LRe);t+=Te.packedLength;const a=Fe.unpack(e,t,RRe);t+=Fe.packedLength;const c=e[t]===1;if(!l(n))return new Pp({frustum:o,origin:r,orientation:s,vertexFormat:a,_drawNearPlane:c});const u=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(u),n._frustumType=i,n._origin=f.clone(r,n._origin),n._orientation=Te.clone(s,n._orientation),n._vertexFormat=Fe.clone(a,n._vertexFormat),n._drawNearPlane=c,n};function Mg(e,t,n,i,o,r,s,a){const c=e/3*2;for(let u=0;u<4;++u)l(t)&&(t[e]=r.x,t[e+1]=r.y,t[e+2]=r.z),l(n)&&(n[e]=s.x,n[e+1]=s.y,n[e+2]=s.z),l(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}const NRe=new J,MRe=new B,uP=new B,iY=new f,oY=new f,rY=new f,FRe=new f,zRe=new f,URe=new f,Eh=new Array(3),bT=new Array(4);bT[0]=new oe(-1,-1,1,1);bT[1]=new oe(1,-1,1,1);bT[2]=new oe(1,1,1,1);bT[3]=new oe(-1,1,1,1);const sY=new Array(4);for(let e=0;e<4;++e)sY[e]=new oe;Pp._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const c=J.fromQuaternion(t,NRe);let u=A(r,iY),d=A(s,oY),h=A(a,rY);u=J.getColumn(c,0,u),d=J.getColumn(c,1,d),h=J.getColumn(c,2,h),f.normalize(u,u),f.normalize(d,d),f.normalize(h,h),f.negate(u,u);const m=B.computeView(e,h,d,u,MRe);let g,p;if(n===ED){const y=i.projectionMatrix,b=B.multiply(y,m,uP);p=B.inverse(b,uP)}else g=B.inverseTransformation(m,uP);l(p)?(Eh[0]=i.near,Eh[1]=i.far):(Eh[0]=0,Eh[1]=i.near,Eh[2]=i.far);for(let y=0;y<2;++y)for(let b=0;b<4;++b){let C=oe.clone(bT[b],sY[b]);if(l(p)){C=B.multiplyByVector(p,C,C);const E=1/C.w;f.multiplyByScalar(C,E,C),f.subtract(C,e,C),f.normalize(C,C);const w=f.dot(h,C);f.multiplyByScalar(C,Eh[y]/w,C),f.add(C,e,C)}else{l(i._offCenterFrustum)&&(i=i._offCenterFrustum);const E=Eh[y],w=Eh[y+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*(E-w)-E-w)*.5,C.w=1,B.multiplyByVector(g,C,C)}o[12*y+b*3]=C.x,o[12*y+b*3+1]=C.y,o[12*y+b*3+2]=C.z}};Pp.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=e._vertexFormat,a=r?6:5;let c=new Float64Array(3*4*6);Pp._computeNearFarPlanes(i,o,t,n,c);let u=3*4*2;c[u]=c[3*4],c[u+1]=c[3*4+1],c[u+2]=c[3*4+2],c[u+3]=c[0],c[u+4]=c[1],c[u+5]=c[2],c[u+6]=c[3*3],c[u+7]=c[3*3+1],c[u+8]=c[3*3+2],c[u+9]=c[3*7],c[u+10]=c[3*7+1],c[u+11]=c[3*7+2],u+=3*4,c[u]=c[3*5],c[u+1]=c[3*5+1],c[u+2]=c[3*5+2],c[u+3]=c[3],c[u+4]=c[3+1],c[u+5]=c[3+2],c[u+6]=c[0],c[u+7]=c[1],c[u+8]=c[2],c[u+9]=c[3*4],c[u+10]=c[3*4+1],c[u+11]=c[3*4+2],u+=3*4,c[u]=c[3],c[u+1]=c[3+1],c[u+2]=c[3+2],c[u+3]=c[3*5],c[u+4]=c[3*5+1],c[u+5]=c[3*5+2],c[u+6]=c[3*6],c[u+7]=c[3*6+1],c[u+8]=c[3*6+2],c[u+9]=c[3*2],c[u+10]=c[3*2+1],c[u+11]=c[3*2+2],u+=3*4,c[u]=c[3*2],c[u+1]=c[3*2+1],c[u+2]=c[3*2+2],c[u+3]=c[3*6],c[u+4]=c[3*6+1],c[u+5]=c[3*6+2],c[u+6]=c[3*7],c[u+7]=c[3*7+1],c[u+8]=c[3*7+2],c[u+9]=c[3*3],c[u+10]=c[3*3+1],c[u+11]=c[3*3+2],r||(c=c.subarray(3*4));const d=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})});if(l(s.normal)||l(s.tangent)||l(s.bitangent)||l(s.st)){const m=l(s.normal)?new Float32Array(12*a):void 0,g=l(s.tangent)?new Float32Array(3*4*a):void 0,p=l(s.bitangent)?new Float32Array(3*4*a):void 0,y=l(s.st)?new Float32Array(2*4*a):void 0,b=iY,C=oY,E=rY,w=f.negate(b,FRe),S=f.negate(C,zRe),P=f.negate(E,URe);u=0,r&&(Mg(u,m,g,p,y,P,b,C),u+=3*4),Mg(u,m,g,p,y,E,w,C),u+=3*4,Mg(u,m,g,p,y,w,P,C),u+=3*4,Mg(u,m,g,p,y,S,P,w),u+=3*4,Mg(u,m,g,p,y,b,E,C),u+=3*4,Mg(u,m,g,p,y,C,E,w),l(m)&&(d.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:m})),l(g)&&(d.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),l(p)&&(d.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),l(y)&&(d.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:y}))}const h=new Uint16Array(6*a);for(let m=0;m<a;++m){const g=m*6,p=m*4;h[g]=p,h[g+1]=p+1,h[g+2]=p+2,h[g+3]=p,h[g+4]=p+2,h[g+5]=p+3}return new Lt({attributes:d,indices:h,primitiveType:Ze.TRIANGLES,boundingSphere:fe.fromVertices(c)})};const t2=0,HRe=1;function IC(e){T.typeOf.object("options",e),T.typeOf.object("options.frustum",e.frustum),T.typeOf.object("options.origin",e.origin),T.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=A(e._drawNearPlane,!0);let r,s;t instanceof Yn?(r=t2,s=Yn.packedLength):t instanceof Gt&&(r=HRe,s=Gt.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=f.clone(i),this._orientation=Te.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+f.packedLength+Te.packedLength}IC.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===t2?(Yn.pack(o,t,n),n+=Yn.packedLength):(Gt.pack(o,t,n),n+=Gt.packedLength),f.pack(e._origin,t,n),n+=f.packedLength,Te.pack(e._orientation,t,n),n+=Te.packedLength,t[n]=e._drawNearPlane?1:0,t};const VRe=new Yn,kRe=new Gt,GRe=new Te,WRe=new f;IC.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=e[t++];let o;i===t2?(o=Yn.unpack(e,t,VRe),t+=Yn.packedLength):(o=Gt.unpack(e,t,kRe),t+=Gt.packedLength);const r=f.unpack(e,t,WRe);t+=f.packedLength;const s=Te.unpack(e,t,GRe);t+=Te.packedLength;const a=e[t]===1;if(!l(n))return new IC({frustum:o,origin:r,orientation:s,_drawNearPlane:a});const c=i===n._frustumType?n._frustum:void 0;return n._frustum=o.clone(c),n._frustumType=i,n._origin=f.clone(r,n._origin),n._orientation=Te.clone(s,n._orientation),n._drawNearPlane=a,n};IC.createGeometry=function(e){const t=e._frustumType,n=e._frustum,i=e._origin,o=e._orientation,r=e._drawNearPlane,s=new Float64Array(3*4*2);Pp._computeNearFarPlanes(i,o,t,n,s);const a=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})});let c,u;const d=r?2:1,h=new Uint16Array(8*(d+1));let m=r?0:1;for(;m<2;++m)c=r?m*8:0,u=m*4,h[c]=u,h[c+1]=u+1,h[c+2]=u+1,h[c+3]=u+2,h[c+4]=u+2,h[c+5]=u+3,h[c+6]=u+3,h[c+7]=u;for(m=0;m<2;++m)c=(d+m)*8,u=m*4,h[c]=u,h[c+1]=u+4,h[c+2]=u+1,h[c+3]=u+5,h[c+4]=u+2,h[c+5]=u+6,h[c+6]=u+3,h[c+7]=u+7;return new Lt({attributes:a,indices:h,primitiveType:Ze.LINES,boundingSphere:fe.fromVertices(s)})};function Zh(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.camera))throw new x("options.camera is required.");this._camera=e.camera,this._frustumSplits=e.frustumSplits,this._color=A(e.color,H.CYAN),this._updateOnChange=A(e.updateOnChange,!0),this.show=A(e.show,!0),this.id=e.id,this._id=void 0,this._outlinePrimitives=[],this._planesPrimitives=[]}const jRe=new f,qRe=new J,$Re=new Te,YRe=new Yn,XRe=new ca,KRe=new Gt,JRe=new Wo,QRe=new H,ZRe=[1,1e5];Zh.prototype.update=function(e){if(!this.show)return;const t=this._planesPrimitives,n=this._outlinePrimitives;let 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){const r=this._camera,s=r.frustum;let a;s instanceof Yn?a=YRe:s instanceof ca?a=XRe:s instanceof Gt?a=KRe:a=JRe,a=s.clone(a);let c,u=this._frustumSplits;!l(u)||u.length<=1?(u=ZRe,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,c=1):c=u.length-1;const d=r.positionWC,h=r.directionWC,m=r.upWC;let g=r.rightWC;g=f.negate(g,jRe);const p=qRe;J.setColumn(p,0,g,p),J.setColumn(p,1,m,p),J.setColumn(p,2,h,p);const y=Te.fromRotationMatrix(p,$Re);for(t.length=n.length=c,i=0;i<c;++i)a.near=u[i],a.far=u[i+1],t[i]=new Jt({geometryInstances:new ln({geometry:new Pp({origin:d,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:pn.fromColor(H.fromAlpha(this._color,.1,QRe))},id:this.id,pickPrimitive:this}),appearance:new wn({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Jt({geometryInstances:new ln({geometry:new IC({origin:d,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:pn.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};Zh.prototype.isDestroyed=function(){return!1};Zh.prototype.destroy=function(){const 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 He(this)};function CT(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=A(e,0)}const TA=gn.supportsTypedArrays()?new Float32Array(12):[],uV=new f,dV=new f,dP=new f,fV=new f,wx=new f;function eNe(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof Gt)o=f.ZERO,r=i.rightWC,s=i.upWC;else{const h=i.positionWC,m=f.multiplyComponents(e.oneOverRadii,h,uV),g=f.normalize(m,dV),p=f.normalize(f.cross(f.UNIT_Z,m,dP),dP),y=f.normalize(f.cross(g,p,fV),fV),b=f.magnitude(m),C=Math.sqrt(b*b-1);o=f.multiplyByScalar(g,1/b,uV);const E=C/b;r=f.multiplyByScalar(p,E,dV),s=f.multiplyByScalar(y,E,dP)}const a=f.add(o,s,wx);f.subtract(a,r,a),f.multiplyComponents(n,a,a),f.pack(a,TA,0);const c=f.subtract(o,s,wx);f.subtract(c,r,c),f.multiplyComponents(n,c,c),f.pack(c,TA,3);const u=f.add(o,s,wx);f.add(u,r,u),f.multiplyComponents(n,u,u),f.pack(u,TA,6);const d=f.subtract(o,s,wx);return f.add(d,r,d),f.multiplyComponents(n,d,d),f.pack(d,TA,9),TA}CT.prototype.update=function(e){if(this._mode=e.mode,e.mode!==le.SCENE3D)return;const t=e.context,n=e.mapProjection.ellipsoid.radii,i=new me(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(l(this._command)||(this._rs=et.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new mt({renderState:this._rs,boundingVolume:new fe(f.ZERO,i.maximumRadius),pass:Ne.OPAQUE,owner:this})),!l(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const s=new We({sources:[mEe]}),a=new We({sources:[pEe]});if(o){const c=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`;a.sources.push(c),a.defines.push("LOG_DEPTH"),s.defines.push("LOG_DEPTH")}this._sp=Cn.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=eNe(i,e);if(l(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const s=new Lt({attributes:{position:new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:Ze.TRIANGLES});this._va=ho.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:nt.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};CT.prototype.execute=function(e,t){this._mode===le.SCENE3D&&this._command.execute(e,t)};CT.prototype.isDestroyed=function(){return!1};CT.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};function gf(){}const tNe=/\bgl_FragDepthEXT\b/,nNe=/\bdiscard\b/;function iNe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"depthOnly");if(!l(n)){const i=t._attributeLocations;let o=t.fragmentShaderSource,r,s=!1;const a=o.sources;let c=a.length;for(r=0;r<c;++r)if(tNe.test(a[r])||nNe.test(a[r])){s=!0;break}let u=!1;const d=o.defines;for(c=d.length,r=0;r<c;++r)if(d[r]==="LOG_DEPTH"){u=!0;break}let h;!s&&!u?(h=`void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
}
|
||
`,o=new We({sources:[h]})):!s&&u&&(h=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
czm_writeLogDepth();
|
||
}
|
||
`,o=new We({defines:["LOG_DEPTH"],sources:[h]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function oNe(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!l(i)){const o=et.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=et.fromCache(o),n[t.id]=i}return i}gf.createDepthOnlyDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.depthOnlyCommand)&&(o=i.depthOnlyCommand.shaderProgram,r=i.depthOnlyCommand.renderState),i.depthOnlyCommand=mt.shallowClone(t,i.depthOnlyCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=iNe(n,t.shaderProgram),i.depthOnlyCommand.renderState=oNe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};const rNe=/\s+czm_writeLogDepth\(/,sNe=/\s+czm_vertexLogDepth\(/,aNe=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function cNe(e,t){if(t.fragmentShaderSource.defines.indexOf("LOG_DEPTH_READ_ONLY")>=0)return t;let i=e.shaderCache.getDerivedShaderProgram(t,"logDepth");if(!l(i)){const o=t._attributeLocations,r=t.vertexShaderSource.clone(),s=t.fragmentShaderSource.clone();r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("LOG_DEPTH"),s.defines=l(s.defines)?s.defines.slice(0):[],s.defines.push("LOG_DEPTH");let a,c,u=!1,d=r.sources,h=d.length;for(a=0;a<h;++a)if(sNe.test(d[a])){u=!0;break}if(!u){for(a=0;a<h;++a)d[a]=We.replaceMain(d[a],"czm_log_depth_main");c=`
|
||
|
||
void main()
|
||
{
|
||
czm_log_depth_main();
|
||
czm_vertexLogDepth();
|
||
}
|
||
`,d.push(c)}for(d=s.sources,h=d.length,u=!1,a=0;a<h;++a)rNe.test(d[a])&&(u=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(u=!0);let m=!0;for(a=0;a<h;++a)aNe.test(d[a])&&(m=!1);let g="";if(m&&(g+=`#ifdef GL_EXT_frag_depth
|
||
#extension GL_EXT_frag_depth : enable
|
||
#endif
|
||
|
||
`),!u){for(a=0;a<h;a++)d[a]=We.replaceMain(d[a],"czm_log_depth_main");g+=`
|
||
void main()
|
||
{
|
||
czm_log_depth_main();
|
||
czm_writeLogDepth();
|
||
}
|
||
`}d.push(g),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}gf.createLogDepthCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=mt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=cNe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function lNe(e,t,n){let i=e.shaderCache.getDerivedShaderProgram(t,"pick");if(!l(i)){const o=t._attributeLocations;let r=t.fragmentShaderSource;const s=r.sources,a=s.length,c=`void main()
|
||
{
|
||
czm_non_pick_main();
|
||
if (gl_FragColor.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = ${n};
|
||
}
|
||
`,u=new Array(a+1);for(let d=0;d<a;++d)u[d]=We.replaceMain(s[d],"czm_non_pick_main");u[a]=c,r=new We({sources:u,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function uNe(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!l(i)){const o=et.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=et.fromCache(o),n[t.id]=i}return i}gf.createPickDerivedCommand=function(e,t,n,i){l(i)||(i={});let o,r;return l(i.pickCommand)&&(o=i.pickCommand.shaderProgram,r=i.pickCommand.renderState),i.pickCommand=mt.shallowClone(t,i.pickCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=lNe(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=uNe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function dNe(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"HDR");if(!l(n)){const i=t._attributeLocations,o=t.vertexShaderSource.clone(),r=t.fragmentShaderSource.clone();o.defines=l(o.defines)?o.defines.slice(0):[],o.defines.push("HDR"),r.defines=l(r.defines)?r.defines.slice(0):[],r.defines.push("HDR"),n=e.shaderCache.createDerivedShaderProgram(t,"HDR",{vertexShaderSource:o,fragmentShaderSource:r,attributeLocations:i})}return n}gf.createHdrCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=mt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=dNe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function xD(e){if(!l(e))throw new x("scene is required.");this._scene=e,this._lastAlpha=void 0,this._lastBeta=void 0,this._lastGamma=void 0,this._alpha=void 0,this._beta=void 0,this._gamma=void 0;const t=this;function n(i){const o=i.alpha;if(!l(o)){t._alpha=void 0,t._beta=void 0,t._gamma=void 0;return}t._alpha=M.toRadians(o),t._beta=M.toRadians(i.beta),t._gamma=M.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}const fNe=new Te,hV=new Te,hNe=new J;function pNe(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=Te.fromAxisAngle(o,n,hV),c=Te.fromAxisAngle(r,i,fNe),u=Te.multiply(c,a,c),d=Te.fromAxisAngle(s,t,hV);Te.multiply(d,u,u);const h=J.fromQuaternion(u,hNe);J.multiplyByVector(h,r,r),J.multiplyByVector(h,s,s),J.multiplyByVector(h,o,o)}xD.prototype.update=function(){if(!l(this._alpha))return;l(this._lastAlpha)||(this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma);const e=this._lastAlpha-this._alpha,t=this._lastBeta-this._beta,n=this._lastGamma-this._gamma;pNe(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};xD.prototype.isDestroyed=function(){return!1};xD.prototype.destroy=function(){return this._removeListener(),He(this)};function aY(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}const Yw=[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],od=[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<od.length;++e)od[e]*=1e6;const cY=od[1],jB=od[od.length-1];for(let e=0;e<od.length;++e)od[e]=(od[e]-jB)/(cY-jB);let es=0;function mNe(e){const t=Yw,n=t.length;if(e<t[0])return es=0,es;if(e>t[n-1])return es=n-2,es;if(e>=t[es]){if(es+1<n&&e<t[es+1])return es;if(es+2<n&&e<t[es+2])return++es,es}else if(es-1>=0&&e>=t[es-1])return--es,es;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return es=i,es}const _Ne=new f;aY.prototype.update=function(e){if(!(e.fog.enabled=this.enabled))return;e.fog.renderable=this.renderable;const n=e.camera,i=n.positionCartographic;if(!l(i)||i.height>8e5||e.mode!==le.SCENE3D){e.fog.enabled=!1;return}const o=i.height,r=mNe(o),s=M.clamp((o-Yw[r])/(Yw[r+1]-Yw[r]),0,1);let a=M.lerp(od[r],od[r+1],s);const c=this.density*1e6,u=c/cY*jB;a=a*(c-u)*1e-6;const d=f.normalize(n.positionWC,_Ne),h=Math.abs(f.dot(n.directionWC,d));a*=1-h,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};function gNe(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=le.SCENE3D,this.morphTime=le.getMorphTime(le.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}const is={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},n_=is.DERIVED_COMMANDS_MAXIMUM_LENGTH,lY=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function og(){this._frontFaceAlphaByDistance=new kt(0,1,0,1),this._backFaceAlphaByDistance=new kt(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=ge.clone(ge.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(n_),this._derivedBlendCommandTypes=new Array(n_),this._derivedPickCommandTypes=new Array(n_),this._derivedCommandTypesToUpdate=new Array(n_),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(og.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}}});og.prototype.update=function(e){const t=e.globe;if(!l(t)||!t.show){this._frontFaceTranslucent=!1,this._backFaceTranslucent=!1,this._sunVisibleThroughGlobe=!0,this._environmentVisible=!0,this._useDepthPlane=!1;return}this._frontFaceAlphaByDistance=pV(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=pV(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=mV(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=mV(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=CNe(this,e,t),this._sunVisibleThroughGlobe=yNe(this,e),this._environmentVisible=ANe(this,e),this._useDepthPlane=bNe(this,e),this._numberOfTextureUniforms=TNe(this),this._rectangle=ge.clone(t.translucency.rectangle,this._rectangle),ENe(this,e)};function pV(e,t,n,i){return e?l(n)?(kt.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 mV(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function yNe(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function ANe(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function bNe(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function CNe(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==le.SCENE2D&&t.context.depthTexture}function TNe(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function ENe(e,t){e._derivedCommandsLength=fP(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=fP(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=fP(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<n_;++n)(i&1<<n)>0&&(e._derivedCommandTypesToUpdate[o++]=n);e._derivedCommandsToUpdateLength=o;const r=i!==e._derivedCommandKey;e._derivedCommandKey=i,e._derivedCommandsDirty=r,!l(e._derivedCommandPacks)&&e._frontFaceTranslucent&&(e._derivedCommandPacks=zNe())}function fP(e,t,n,i,o){let r=0;const s=e._frontFaceTranslucent,a=e._backFaceTranslucent;if(!s)return r;const c=t.cameraUnderground,u=e._requiresManualDepthTest,d=i?is.PICK_FRONT_FACE:u?is.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:is.TRANSLUCENT_FRONT_FACE,h=i?is.PICK_BACK_FACE:u?is.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:is.TRANSLUCENT_BACK_FACE;return t.mode===le.SCENE2D?(o[r++]=is.DEPTH_ONLY_FRONT_FACE,o[r++]=d,r):(a?(n||(o[r++]=is.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(o[r++]=d,o[r++]=h):(o[r++]=h,o[r++]=d)):c?(n||(o[r++]=is.DEPTH_ONLY_BACK_FACE),o[r++]=is.OPAQUE_FRONT_FACE,o[r++]=h):(n||(o[r++]=is.DEPTH_ONLY_FRONT_FACE),o[r++]=is.OPAQUE_BACK_FACE,o[r++]=d),r)}function Qc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function _V(e,t){return e.indexOf(t)>-1}function xNe(e,t){Qc(e.defines,"TRANSLUCENT"),Qc(t.defines,"TRANSLUCENT")}function wNe(e,t){Qc(e.defines,"GROUND_ATMOSPHERE"),Qc(t.defines,"GROUND_ATMOSPHERE"),Qc(e.defines,"FOG"),Qc(t.defines,"FOG"),Qc(e.defines,"TRANSLUCENT"),Qc(t.defines,"TRANSLUCENT")}function hP(e,t){if(_V(t.defines,"TILE_LIMIT_RECTANGLE")||_V(t.defines,"ENABLE_CLIPPING_PLANES"))return;const n=`void main()
|
||
{
|
||
gl_FragColor = vec4(1.0);
|
||
}
|
||
`;t.sources=[n]}function n2(e,t){const n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=We.replaceMain(n[r],"czm_globe_translucency_main");const o=`
|
||
|
||
uniform sampler2D u_classificationTexture;
|
||
void main()
|
||
{
|
||
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
||
#ifdef MANUAL_DEPTH_TEST
|
||
float logDepthOrDepth = czm_unpackDepth(texture2D(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 = texture2D(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;
|
||
}
|
||
gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a);
|
||
}
|
||
`;n.push(o)}function uY(e,t){n2(e,t),Qc(e.defines,"GROUND_ATMOSPHERE"),Qc(t.defines,"GROUND_ATMOSPHERE"),Qc(e.defines,"FOG"),Qc(t.defines,"FOG")}function SNe(e,t){n2(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function vNe(e,t){uY(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function gV(e,t){const n=`uniform sampler2D u_classificationTexture;
|
||
void main()
|
||
{
|
||
vec2 st = gl_FragCoord.xy / czm_viewport.zw;
|
||
vec4 pickColor = texture2D(u_classificationTexture, st);
|
||
if (pickColor == vec4(0.0))
|
||
{
|
||
discard;
|
||
}
|
||
gl_FragColor = pickColor;
|
||
}
|
||
`;t.sources=[n]}function DNe(e,t,n,i,o,r){if(!l(o))return t;if(!i&&l(n))return n;let s=e.shaderCache.getDerivedShaderProgram(t,r);if(!l(s)){const a=t._attributeLocations,c=t.vertexShaderSource.clone(),u=t.fragmentShaderSource.clone();c.defines=l(c.defines)?c.defines.slice(0):[],u.defines=l(u.defines)?u.defines.slice(0):[],o(c,u),s=e.shaderCache.createDerivedShaderProgram(t,r,{vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:a})}return s}function INe(e){e.cull.face=Ho.BACK,e.cull.enabled=!0}function PNe(e){e.cull.face=Ho.FRONT,e.cull.enabled=!0}function ONe(e){e.cull.face=Ho.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function LNe(e){e.cull.face=Ho.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function BNe(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function yV(e){e.cull.face=Ho.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=Gi.ALPHA_BLEND}function AV(e){e.cull.face=Ho.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=Gi.ALPHA_BLEND}function RNe(e){e.cull.face=Ho.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function NNe(e){e.cull.face=Ho.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function MNe(e,t,n,i,o){if(!l(i))return e;if(!n&&l(t))return t;let r=o[e.id];if(!l(r)){const s=et.getState(e);i(s),r=et.fromCache(s),o[e.id]=r}return r}function Fg(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function FNe(e,t,n,i,o){return l(o)?!i&&l(n)?n:hn(t,o(e),!1):t}function Nl(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function zNe(){return[new Nl({pass:Ne.GLOBE,pickOnly:!1,getShaderProgramFunction:xNe,getRenderStateFunction:INe,getUniformMapFunction:void 0}),new Nl({pass:Ne.GLOBE,pickOnly:!1,getShaderProgramFunction:wNe,getRenderStateFunction:PNe,getUniformMapFunction:void 0}),new Nl({pass:Ne.GLOBE,pickOnly:!1,getShaderProgramFunction:hP,getRenderStateFunction:ONe,getUniformMapFunction:void 0}),new Nl({pass:Ne.GLOBE,pickOnly:!1,getShaderProgramFunction:hP,getRenderStateFunction:LNe,getUniformMapFunction:void 0}),new Nl({pass:Ne.GLOBE,pickOnly:!1,getShaderProgramFunction:hP,getRenderStateFunction:BNe,getUniformMapFunction:void 0}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:n2,getRenderStateFunction:yV,getUniformMapFunction:Fg}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:uY,getRenderStateFunction:AV,getUniformMapFunction:Fg}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:SNe,getRenderStateFunction:yV,getUniformMapFunction:Fg}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:vNe,getRenderStateFunction:AV,getUniformMapFunction:Fg}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:gV,getRenderStateFunction:RNe,getUniformMapFunction:Fg}),new Nl({pass:Ne.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:gV,getRenderStateFunction:NNe,getUniformMapFunction:Fg})]}const bV=new Array(n_),CV=new Array(n_);og.prototype.updateDerivedCommands=function(e,t){const n=this._derivedCommandTypesToUpdate,i=this._derivedCommandsToUpdateLength;if(i!==0){for(let o=0;o<i;++o)CV[o]=this._derivedCommandPacks[n[o]],bV[o]=lY[n[o]];UNe(this,e,i,n,bV,CV,t)}};function UNe(e,t,n,i,o,r,s){let a=t.derivedCommands.globeTranslucency;const c=e._derivedCommandsDirty;if(t.dirty||!l(a)||c){t.dirty=!1,l(a)||(a={},t.derivedCommands.globeTranslucency=a);const u=s.frameNumber,d=A(a.uniformMapDirtyFrame,0),h=A(a.shaderProgramDirtyFrame,0),m=A(a.renderStateDirtyFrame,0),g=a.uniformMap!==t.uniformMap,p=a.shaderProgramId!==t.shaderProgram.id,y=a.renderStateId!==t.renderState.id;g&&(a.uniformMapDirtyFrame=u),p&&(a.shaderProgramDirtyFrame=u),y&&(a.renderStateDirtyFrame=u),a.uniformMap=t.uniformMap,a.shaderProgramId=t.shaderProgram.id,a.renderStateId=t.renderState.id;for(let b=0;b<n;++b){const C=r[b],E=i[b],w=o[b];let S=a[w],P,L,z;l(S)?(P=S.uniformMap,L=S.shaderProgram,z=S.renderState):(P=void 0,L=void 0,z=void 0),S=mt.shallowClone(t,S),a[w]=S;const R=A(S.derivedCommands.uniformMapDirtyFrame,0),F=A(S.derivedCommands.shaderProgramDirtyFrame,0),U=A(S.derivedCommands.renderStateDirtyFrame,0),D=g||R<d,I=p||F<h,_=y||U<m;D&&(S.derivedCommands.uniformMapDirtyFrame=u),I&&(S.derivedCommands.shaderProgramDirtyFrame=u),_&&(S.derivedCommands.renderStateDirtyFrame=u),S.derivedCommands.type=E,S.pass=C.pass,S.pickOnly=C.pickOnly,S.uniformMap=FNe(e,t.uniformMap,P,D,C.getUniformMapFunction),S.shaderProgram=DNe(s.context,t.shaderProgram,L,I,C.getShaderProgramFunction,w),S.renderState=MNe(t.renderState,z,_,C.getRenderStateFunction,C.renderStateCache)}}}og.prototype.pushDerivedCommands=function(e,t,n){const 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}const s=e.derivedCommands.globeTranslucency;for(let a=0;a<r;++a){const c=lY[o[a]];n.commandList.push(s[c])}};function dY(e,t,n,i,o,r,s){for(let a=0;a<t;++a){const c=e[a],u=c.derivedCommands.type;(!l(s)||s.indexOf(u)>-1)&&n(c,i,o,r)}}function TV(e,t,n,i,o,r){for(let s=0;s<t;++s)n(e[s],i,o,r)}const HNe=[is.OPAQUE_FRONT_FACE,is.OPAQUE_BACK_FACE],VNe=[is.DEPTH_ONLY_FRONT_FACE,is.DEPTH_ONLY_BACK_FACE,is.DEPTH_ONLY_FRONT_AND_BACK_FACE];og.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[Ne.GLOBE],a=e.indices[Ne.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),dY(s,a,t,i,r,o,HNe))};og.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[Ne.GLOBE],a=e.indices[Ne.GLOBE],c=e.commands[Ne.TERRAIN_CLASSIFICATION],u=e.indices[Ne.TERRAIN_CLASSIFICATION];if(a===0||u===0)return;const d=this._frontFaceTranslucent,h=this._backFaceTranslucent;if((!d||!h)&&TV(c,u,t,i,r,o),!d&&!h)return;this._globeTranslucencyFramebuffer=n;const m=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,dY(s,a,t,i,r,o,VNe),r.depthTexture){const p=n.packDepth(r,o);r.uniformState.globeDepthTexture=p}TV(c,u,t,i,r,o),r.uniformState.globeDepthTexture=m,o.framebuffer=g};const I_=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
|
||
}
|
||
`,kNe={NEVER:ae.NEVER,LESS:ae.LESS,EQUAL:ae.EQUAL,LESS_OR_EQUAL:ae.LEQUAL,GREATER:ae.GREATER,NOT_EQUAL:ae.NOTEQUAL,GREATER_OR_EQUAL:ae.GEQUAL,ALWAYS:ae.ALWAYS},gi=Object.freeze(kNe),GNe={ZERO:ae.ZERO,KEEP:ae.KEEP,REPLACE:ae.REPLACE,INCREMENT:ae.INCR,DECREMENT:ae.DECR,INVERT:ae.INVERT,INCREMENT_WRAP:ae.INCR_WRAP,DECREMENT_WRAP:ae.DECR_WRAP},_t=Object.freeze(GNe),Xw={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};Xw.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:gi.ALWAYS,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.REPLACE},backFunction:gi.ALWAYS,backOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.REPLACE},reference:Xw.CESIUM_3D_TILE_MASK,mask:Xw.CESIUM_3D_TILE_MASK}};const Rt=Object.freeze(Xw);function wu(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new Ln({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new Ln({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 co({color:new H(0,0,0,0),owner:this}),this._clearCommand=new co({color:new H(0,0,0,0),depth:1,stencil:0});const e=this;this._uniformMap={colorTexture:function(){return e._fbo.getColorTexture()},depthTexture:function(){return e._depthStencilTexture},classifiedTexture:function(){return e._fboClassified.getColorTexture()}}}Object.defineProperties(wu.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});wu.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const WNe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:gi.EQUAL,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},backFunction:gi.NEVER,reference:0,mask:Rt.CLASSIFICATION_MASK},blending:Gi.ALPHA_BLEND},jNe={depthMask:!1,stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},backFunction:gi.NEVER,reference:0,mask:Rt.CLASSIFICATION_MASK},blending:Gi.ALPHA_BLEND},qNe={depthMask:!0,depthTest:{enabled:!0},stencilTest:Rt.setCesium3DTileBit(),stencilMask:Rt.CESIUM_3D_TILE_MASK,blending:Gi.ALPHA_BLEND},$Ne=`#extension GL_EXT_frag_depth : enable
|
||
uniform sampler2D colorTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform sampler2D classifiedTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
if (color.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
bool isClassified = all(equal(texture2D(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
|
||
gl_FragColor = color * highlightColor;
|
||
gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;
|
||
}
|
||
`,YNe=`uniform sampler2D colorTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
if (color.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
#ifdef UNCLASSIFIED
|
||
gl_FragColor = color * czm_invertClassificationColor;
|
||
#else
|
||
gl_FragColor = color;
|
||
#endif
|
||
}
|
||
`;wu.prototype.update=function(e,t,n){const i=this._fbo.getColorTexture(),o=this.previousFramebuffer!==this._previousFramebuffer;this._previousFramebuffer=this.previousFramebuffer;const r=this._numSamples!==t,s=e.drawingBufferWidth,a=e.drawingBufferHeight,c=!l(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(),l(this._previousFramebuffer)||(this._depthStencilTexture=new Wt({context:e,width:s,height:a,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Qe.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Xl({context:e,width:s,height:a,format:af.DEPTH24_STENCIL8,numSamples:t})))),!l(this._fbo.framebuffer)||c||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,d;l(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),d=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,d=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),l(d)&&this._fbo.setDepthStencilRenderbuffer(d),this._fbo.update(e,s,a,t),l(this._previousFramebuffer)||(this._fboClassified.setDepthStencilTexture(u),this._fboClassified.update(e,s,a))}if(l(this._rsUnclassified)||(this._rsUnclassified=et.fromCache(WNe),this._rsClassified=et.fromCache(jNe),this._rsDefault=et.fromCache(qNe)),!l(this._unclassifiedCommand)||o||r){l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy());const u=l(this._previousFramebuffer)?YNe:$Ne,d=new We({defines:["UNCLASSIFIED"],sources:[u]}),h=new We({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(d,{renderState:l(this._previousFramebuffer)?this._rsUnclassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),this._classifiedCommand=e.createViewportQuadCommand(h,{renderState:l(this._previousFramebuffer)?this._rsClassified:this._rsDefault,uniformMap:this._uniformMap,owner:this}),l(this._translucentCommand)&&(this._translucentCommand.shaderProgram=this._translucentCommand.shaderProgram&&this._translucentCommand.shaderProgram.destroy()),l(this._previousFramebuffer)||(this._translucentCommand=e.createViewportQuadCommand(I_,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};wu.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};wu.prototype.clear=function(e,t){l(this._previousFramebuffer)?this._fbo.clear(e,this._clearColorCommand,t):(this._fbo.clear(e,this._clearCommand,t),this._fboClassified.clear(e,this._clearCommand,t))};wu.prototype.executeClassified=function(e,t){if(!l(this._previousFramebuffer)){const 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)};wu.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};wu.prototype.isDestroyed=function(){return!1};wu.prototype.destroy=function(){return this._fbo.destroy(),this._fboClassified.destroy(),this._depthStencilTexture=this._depthStencilTexture&&this._depthStencilTexture.destroy(),this._depthStencilRenderbuffer=this._depthStencilRenderbuffer&&this._depthStencilRenderbuffer.destroy(),l(this._unclassifiedCommand)&&(this._unclassifiedCommand.shaderProgram=this._unclassifiedCommand.shaderProgram&&this._unclassifiedCommand.shaderProgram.destroy(),this._classifiedCommand.shaderProgram=this._classifiedCommand.shaderProgram&&this._classifiedCommand.shaderProgram.destroy()),He(this)};const XNe={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},Gl=Object.freeze(XNe);function Kw(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(Kw.prototype,{total:{get:function(){return this._total}}});function hp(e){if(l(e)&&e.length!==Gl.NUMBER_OF_JOB_TYPES)throw new x("A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES.");const t=new Array(Gl.NUMBER_OF_JOB_TYPES);t[Gl.TEXTURE]=new Kw(l(e)?e[Gl.TEXTURE]:10),t[Gl.PROGRAM]=new Kw(l(e)?e[Gl.PROGRAM]:10),t[Gl.BUFFER]=new Kw(l(e)?e[Gl.BUFFER]:30);const n=t.length;let i,o=0;for(i=0;i<n;++i)o+=t[i].total;const 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}hp.getTimestamp=fr;Object.defineProperties(hp.prototype,{totalBudget:{get:function(){return this._totalBudget}}});hp.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};hp.prototype.resetBudgets=function(){const e=this._budgets,t=e.length;for(let n=0;n<t;++n){const i=e[n];i.starvedLastFrame=i.starvedThisFrame,i.starvedThisFrame=!1,i.usedThisFrame=0,i.stolenFromMeThisFrame=0}this._totalUsedThisFrame=0};hp.prototype.execute=function(e,t){const 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){const c=n.length;let u;for(u=0;u<c&&(r=n[u],!(r.usedThisFrame+r.stolenFromMeThisFrame<r.total&&!r.starvedLastFrame));++u);if(u===c&&o)return!1;o&&(i.starvedThisFrame=!0)}const s=hp.getTimestamp();e.execute();const a=hp.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};function hu(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;const t=this;this._readyPromise=new Promise((n,i)=>{t._completeLoadFromCache=o=>{i2(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(hu.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}}});hu.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const KNe=new f(1,0,0),JNe=new f(0,0,1),QNe=new f(-1,0,0),ZNe=new f(0,0,-1),Sx=new f(0,1,0),eMe=new f(0,-1,0),fY=[Sx,QNe,JNe,eMe,KNe,Sx,ZNe,Sx,Sx],hY=fY.length,pY=new Float32Array(hY*3);let EV=0;for(let e=0;e<hY;++e,EV+=3)f.pack(fY[e],pY,EV);const tMe=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),nMe=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 iMe(e){const t=Tt.createVertexBuffer({context:e,typedArray:tMe,usage:nt.STATIC_DRAW}),n=Tt.createVertexBuffer({context:e,typedArray:pY,usage:nt.STATIC_DRAW}),i=Tt.createIndexBuffer({context:e,typedArray:nMe,usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ee.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:ee.FLOAT}];return new ho({context:e,attributes:o,indexBuffer:i})}function xV(e){return function(){return e}}function i2(e){e._va=e._va&&e._va.destroy(),e._sp=e._sp&&e._sp.destroy();let t,n;const i=e._cubeMaps;if(l(i))for(n=i.length,t=0;t<n;++t)i[t].destroy();const o=e._mipTextures;if(l(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}hu.prototype.update=function(e){const t=e.context;if(!hu.isSupported(t)||(l(this._texture)&&l(this._va)&&i2(this),l(this._texture)))return;if(!l(this._texture)&&!this._loading){const g=e.context.textureCache.getTexture(this._url);l(g)&&this._completeLoadFromCache(g)}const n=this._cubeMapBuffers;if(!l(n)&&!this._loading){const g=this;K_(this._url).then(function(p){g._cubeMapBuffers=p,g._loading=!1}).catch(function(p){g._failLoad(p)}),this._loading=!0}if(!l(this._cubeMapBuffers))return;const i=[];let o=n[0].positiveX.pixelDatatype;l(o)?i.push("RGBA_NORMALIZED"):o=t.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.FLOAT;const r=rt.RGBA,s=new We({defines:i,sources:[bEe]});this._va=iMe(t),this._sp=Cn.fromCache({context:t,vertexShaderSource:CEe,fragmentShaderSource:s,attributeLocations:{position:0,cubeMapCoordinates:1}});const a=Math.min(n.length,6);this._maximumMipmapLevel=a-1;const c=this._cubeMaps=new Array(a),u=this._mipTextures=new Array(a),d=n[0].positiveX.width*2,h={originalSize:function(){return d}};for(let g=0;g<a;++g){const p=n[g].positiveY;n[g].positiveY=n[g].negativeY,n[g].negativeY=p;const y=c[g]=new bu({context:t,source:n[g],pixelDatatype:o}),b=c[g].width*2,C=u[g]=new Wt({context:t,width:b,height:b,pixelDatatype:o,pixelFormat:r}),E=new yC({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:xV(y)},outputTexture:C,persists:!0,owner:this});e.commandList.push(E),h[`texture${g}`]=xV(C)}this._texture=new Wt({context:t,width:d*1.5+2,height:d,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const m=new yC({fragmentShaderSource:AEe,uniformMap:h,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(m),this._completeLoad()};hu.prototype.isDestroyed=function(){return!1};hu.prototype.destroy=function(){return i2(this),this._texture=this._texture&&this._texture.destroy(),He(this)};function wD(e){e=A(e,A.EMPTY_OBJECT);const t=Ar(e.container);if(!l(t))throw new x("container is required");this._container=t;const n=document.createElement("div");n.className="cesium-performanceDisplay";const i=document.createElement("div");i.className="cesium-performanceDisplay-fps",this._fpsText=document.createTextNode(""),i.appendChild(this._fpsText);const 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=fr(),this._lastMsSampleTime=fr(),this._fpsFrameCount=0,this._msFrameCount=0,this._throttled=!1;const r=document.createElement("div");r.className="cesium-performanceDisplay-throttled",this._throttledText=document.createTextNode(""),r.appendChild(this._throttledText),n.appendChild(r)}Object.defineProperties(wD.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});wD.prototype.update=function(e){const t=fr(),n=A(e,!0);this._fpsFrameCount++;const 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++;const 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}};wD.prototype.destroy=function(){return He(this)};const wV=new f,SV=new f,vV=new Ce,pP=new f,oMe=new f,DV=new fe,rMe=new aa,EA=[new Ce,new Ce,new Ce,new Ce],xA=new j,zo={};zo.initialize=function(){let e=zo._initPromise;return l(e)||(e=Me.fetchJson(An("Assets/approximateTerrainHeights.json")).then(function(t){zo._terrainHeights=t}),zo._initPromise=e),e};zo.getMinimumMaximumHeights=function(e,t){if(T.defined("rectangle",e),!l(zo._terrainHeights))throw new x("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,me.WGS84);const n=mY(e);let i=zo._defaultMinTerrainHeight,o=zo._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=zo._terrainHeights[r];l(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(ge.northeast(e,vV),wV),t.cartographicToCartesian(ge.southwest(e,vV),SV),f.midpoint(SV,wV,pP);const a=t.scaleToGeodeticSurface(pP,oMe);if(l(a)){const c=f.distance(pP,a);i=Math.min(i,-c)}else i=zo._defaultMinTerrainHeight}return i=Math.max(zo._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};zo.getBoundingSphere=function(e,t){if(T.defined("rectangle",e),!l(zo._terrainHeights))throw new x("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,me.WGS84);const n=mY(e);let i=zo._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=zo._terrainHeights[r];l(s)&&(i=s[1])}const o=fe.fromRectangle3D(e,t,0);return fe.fromRectangle3D(e,t,i,DV),fe.union(o,DV,o)};function mY(e){Ce.fromRadians(e.east,e.north,0,EA[0]),Ce.fromRadians(e.west,e.north,0,EA[1]),Ce.fromRadians(e.east,e.south,0,EA[2]),Ce.fromRadians(e.west,e.south,0,EA[3]);let t=0,n=0,i=0,o=0;const r=zo._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let a=!1;for(let c=0;c<4;++c){const u=EA[c];if(rMe.positionToTileXY(u,s,xA),c===0)i=xA.x,o=xA.y;else if(i!==xA.x||o!==xA.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}}zo._terrainHeightsMaxLevel=6;zo._defaultMaxTerrainHeight=9e3;zo._defaultMinTerrainHeight=-1e5;zo._terrainHeights=void 0;zo._initPromise=void 0;Object.defineProperties(zo,{initialized:{get:function(){return l(zo._terrainHeights)}}});const lo=zo;function Xn(e){e=A(e,!0),this.value=Xn.toValue(e)}Object.defineProperties(Xn.prototype,{componentDatatype:{get:function(){return ee.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});Xn.toValue=function(e,t){if(!l(e))throw new x("show is required.");return l(t)?(t[0]=e,t):new Uint8Array([e])};function As(e,t){this._content=e,this._batchId=t,this._color=void 0}Object.defineProperties(As.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 l(this._color)||(this._color=new H),this._content.batchTable.getColor(this._batchId,this._color)},set:function(e){this._content.batchTable.setColor(this._batchId,e)}},polylinePositions:{get:function(){if(l(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)}}});As.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};As.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};As.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};As.getPropertyInherited=function(e,t,n){const i=e.batchTable;if(l(i)){if(i.hasPropertyBySemantic(t,n))return i.getPropertyBySemantic(t,n);if(i.hasProperty(t,n))return i.getProperty(t,n)}const o=e.metadata;if(l(o)){if(o.hasPropertyBySemantic(n))return o.getPropertyBySemantic(n);if(o.hasProperty(n))return o.getProperty(n)}const r=e.tile,s=r.metadata;if(l(s)){if(s.hasPropertyBySemantic(n))return s.getPropertyBySemantic(n);if(s.hasProperty(n))return s.getProperty(n)}let a;if(l(r.implicitSubtree)&&(a=r.implicitSubtree.metadata),l(a)){if(a.hasPropertyBySemantic(n))return a.getPropertyBySemantic(n);if(a.hasProperty(n))return a.getProperty(n)}const c=l(e.group)?e.group.metadata:void 0;if(l(c)){if(c.hasPropertyBySemantic(n))return c.getPropertyBySemantic(n);if(c.hasProperty(n))return c.getProperty(n)}const u=e.tileset.metadata;if(l(u)){if(u.hasPropertyBySemantic(n))return u.getPropertyBySemantic(n);if(u.hasProperty(n))return u.getProperty(n)}};As.prototype.getPropertyInherited=function(e){return As.getPropertyInherited(this._content,this._batchId,e)};As.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};As.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};As.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};As.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function rg(){this._framebuffer=new Ln,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(rg.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function sMe(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function aMe(e,t,n){if(!l(e._copyDepthCommand)){const i=`uniform highp sampler2D u_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);
|
||
}
|
||
`;e._copyDepthCommand=t.createViewportQuadCommand(i,{renderState:et.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}rg.prototype.update=function(e,t){sMe(this,e,t),aMe(this,e,t)};const cMe=new oe,lMe=new oe(1,1/255,1/65025,1/16581375);rg.prototype.getDepth=function(e,t,n){if(!l(this.framebuffer))return;const i=e.readPixels({x:t,y:n,width:1,height:1,framebuffer:this.framebuffer}),o=oe.unpack(i,0,cMe);return oe.divideByScalar(o,255,o),oe.dot(o,lMe)};rg.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};rg.prototype.isDestroyed=function(){return!1};rg.prototype.destroy=function(){return this._framebuffer.destroy(),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=l(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),He(this)};function qo(e){e=A(e,A.EMPTY_OBJECT),this._primitives=[],this._guid=Ms(),this._zIndex=void 0,this.show=A(e.show,!0),this.destroyPrimitives=A(e.destroyPrimitives,!0)}Object.defineProperties(qo.prototype,{length:{get:function(){return this._primitives.length}}});qo.prototype.add=function(e,t){const n=l(t);if(!l(e))throw new x("primitive is required.");if(n){if(t<0)throw new x("index must be greater than or equal to zero.");if(t>this._primitives.length)throw new x("index must be less than or equal to the number of primitives.")}const 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};qo.prototype.remove=function(e){if(this.contains(e)){const 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};qo.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};qo.prototype.removeAll=function(){const 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=[]};qo.prototype.contains=function(e){return!!(l(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function SD(e,t){if(!e.contains(t))throw new x("primitive is not in this collection.");return e._primitives.indexOf(t)}qo.prototype.raise=function(e){if(l(e)){const t=SD(this,e),n=this._primitives;if(t!==n.length-1){const i=n[t];n[t]=n[t+1],n[t+1]=i}}};qo.prototype.raiseToTop=function(e){if(l(e)){const t=SD(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};qo.prototype.lower=function(e){if(l(e)){const t=SD(this,e),n=this._primitives;if(t!==0){const i=n[t];n[t]=n[t-1],n[t-1]=i}}};qo.prototype.lowerToBottom=function(e){if(l(e)){const t=SD(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};qo.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._primitives[e]};qo.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};qo.prototype.prePassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];l(i.prePassesUpdate)&&i.prePassesUpdate(e)}};qo.prototype.updateForPass=function(e,t){const n=this._primitives;for(let i=0;i<n.length;++i){const o=n[i];l(o.updateForPass)&&o.updateForPass(e,t)}};qo.prototype.postPassesUpdate=function(e){const t=this._primitives;for(let n=0;n<t.length;++n){const i=t[n];l(i.postPassesUpdate)&&i.postPassesUpdate(e)}};qo.prototype.isDestroyed=function(){return!1};qo.prototype.destroy=function(){return this.removeAll(),He(this)};const vs={},uMe=new oe(0,0,0,1);let ks=new oe;const dMe=new Ye,mP=new j,_P=new j;vs.wgs84ToWindowCoordinates=function(e,t,n){return vs.wgs84WithEyeOffsetToWindowCoordinates(e,t,f.ZERO,n)};const IV=new oe,PV=new f;function wA(e,t,n,i){const o=n.viewMatrix,r=B.multiplyByVector(o,oe.fromElements(e.x,e.y,e.z,1,IV),IV),s=f.multiplyComponents(t,f.normalize(r,PV),PV);return r.x+=t.x+s.x,r.y+=t.y+s.y,r.z+=s.z,B.multiplyByVector(n.frustum.projectionMatrix,r,i)}const fMe=new Ce(Math.PI,M.PI_OVER_TWO),hMe=new f,pMe=new f;vs.wgs84WithEyeOffsetToWindowCoordinates=function(e,t,n,i){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("position is required.");const o=e.frameState,r=vs.computeActualWgs84Position(o,t,uMe);if(!l(r))return;const s=e.canvas,a=dMe;a.x=0,a.y=0,a.width=s.clientWidth,a.height=s.clientHeight;const c=e.camera;let u=!1;if(o.mode===le.SCENE2D){const d=e.mapProjection,h=fMe,m=d.project(h,hMe),g=f.clone(c.position,pMe),p=c.frustum.clone(),y=B.computeViewportTransformation(a,0,1,new B),b=c.frustum.projectionMatrix,C=c.positionWC.y,E=f.fromElements(M.sign(C)*m.x-C,0,-c.positionWC.x),w=cn.pointToGLWindowCoordinates(b,y,E);if(C===0||w.x<=0||w.x>=s.clientWidth)u=!0;else{if(w.x>s.clientWidth*.5){a.width=w.x,c.frustum.right=m.x-C,ks=wA(r,n,c,ks),vs.clipToGLWindowCoordinates(a,ks,mP),a.x+=w.x,c.position.x=-c.position.x;const S=c.frustum.right;c.frustum.right=-c.frustum.left,c.frustum.left=-S,ks=wA(r,n,c,ks),vs.clipToGLWindowCoordinates(a,ks,_P)}else{a.x+=w.x,a.width-=w.x,c.frustum.left=-m.x-C,ks=wA(r,n,c,ks),vs.clipToGLWindowCoordinates(a,ks,mP),a.x=a.x-a.width,c.position.x=-c.position.x;const S=c.frustum.left;c.frustum.left=-c.frustum.right,c.frustum.right=-S,ks=wA(r,n,c,ks),vs.clipToGLWindowCoordinates(a,ks,_P)}f.clone(g,c.position),c.frustum=p.clone(),i=j.clone(mP,i),(i.x<0||i.x>s.clientWidth)&&(i.x=_P.x)}}if(o.mode!==le.SCENE2D||u){if(ks=wA(r,n,c,ks),ks.z<0&&!(c.frustum instanceof Gt)&&!(c.frustum instanceof Wo))return;i=vs.clipToGLWindowCoordinates(a,ks,i)}return i.y=s.clientHeight-i.y,i};vs.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=vs.wgs84ToWindowCoordinates(e,t,n),!!l(n))return vs.transformWindowToDrawingBuffer(e,n,n)};const jd=new f,mMe=new Ce;vs.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===le.SCENE3D)return f.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,mMe);if(!l(r))return;if(o.project(r,jd),i===le.COLUMBUS_VIEW)return f.fromElements(jd.z,jd.x,jd.y,n);if(i===le.SCENE2D)return f.fromElements(0,jd.x,jd.y,n);const s=e.morphTime;return f.fromElements(M.lerp(jd.z,t.x,s),M.lerp(jd.x,t.y,s),M.lerp(jd.y,t.z,s),n)};const OV=new f,LV=new f,BV=new B;vs.clipToGLWindowCoordinates=function(e,t,n){return f.divideByScalar(t,t.w,OV),B.computeViewportTransformation(e,0,1,BV),B.multiplyByPoint(BV,OV,LV),j.fromCartesian3(LV,n)};vs.transformWindowToDrawingBuffer=function(e,t,n){const i=e.canvas,o=e.drawingBufferWidth/i.clientWidth,r=e.drawingBufferHeight/i.clientHeight;return j.fromElements(t.x*o,t.y*r,n)};const _Me=new oe,RV=new oe;vs.drawingBufferToWgs84Coordinates=function(e,t,n,i){const r=e.context.uniformState,s=r.currentFrustum,a=s.x,c=s.y;if(e.frameState.useLogDepth){const g=n*r.log2FarDepthFromNearPlusOne,p=Math.pow(2,g)-1;n=c*(1-a/(p+a))/(c-a)}const u=e.view.passState.viewport,d=oe.clone(oe.UNIT_W,_Me);d.x=(t.x-u.x)/u.width*2-1,d.y=(t.y-u.y)/u.height*2-1,d.z=n*2-1,d.w=1;let h,m=e.camera.frustum;if(!l(m.fovy))l(m._offCenterFrustum)&&(m=m._offCenterFrustum),h=RV,h.x=(d.x*(m.right-m.left)+m.left+m.right)*.5,h.y=(d.y*(m.top-m.bottom)+m.bottom+m.top)*.5,h.z=(d.z*(a-c)-a-c)*.5,h.w=1,h=B.multiplyByVector(r.inverseView,h,h);else{h=B.multiplyByVector(r.inverseViewProjection,d,RV);const g=1/h.w;f.multiplyByScalar(h,g,h)}return f.fromCartesian4(h,i)};const br=vs;function gMe(e,t){this.near=A(e,0),this.far=A(t,0);const n=Ne.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}const qB=`uniform highp sampler2D u_depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);
|
||
}
|
||
`;function Ed(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new Ln({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new Ln({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new Ln,this._tempCopyDepthFramebuffer=new Ln,this._updateDepthFramebuffer=new Ln({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(Ed.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 yMe(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function _Y(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Ye.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Ye.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ye.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._rs)||!Ye.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Gi.ALPHA_BLEND}),e._rsUpdate=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:gi.EQUAL,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},backFunction:gi.NEVER,reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK}})),l(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(qB,{uniformMap:{u_depthTexture:function(){return e.colorFramebufferManager.getDepthStencilTexture()}},owner:e})),e._copyDepthCommand.framebuffer=e._copyDepthFramebuffer.framebuffer,e._copyDepthCommand.renderState=e._rs,l(e._copyColorCommand)||(e._copyColorCommand=t.createViewportQuadCommand(I_,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,l(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(qB,{uniformMap:{u_depthTexture:function(){return e._tempCopyDepthTexture}},owner:e})),e._tempCopyDepthCommand.framebuffer=e._tempCopyDepthFramebuffer.framebuffer,e._tempCopyDepthCommand.renderState=e._rs,l(e._updateDepthCommand)||(e._updateDepthCommand=t.createViewportQuadCommand(I_,{uniformMap:{colorTexture:function(){return e._tempCopyDepthFramebuffer.getColorTexture()}},owner:e})),e._updateDepthCommand.framebuffer=e._updateDepthFramebuffer.framebuffer,e._updateDepthCommand.renderState=e._rsUpdate,l(e._clearGlobeColorCommand)||(e._clearGlobeColorCommand=new co({color:new H(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}Ed.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.FLOAT:Qe.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),_Y(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};Ed.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};Ed.prototype.executeCopyDepth=function(e,t){l(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};Ed.prototype.executeUpdateDepth=function(e,t,n,i){const o=l(i)?i:t.framebuffer.depthStencilTexture;if(n||o!==this.colorFramebufferManager.getDepthStencilTexture()){if(l(this._updateDepthCommand)){if(!l(this._updateDepthFramebuffer.framebuffer)||this._updateDepthFramebuffer.getDepthStencilTexture()!==o||this._updateDepthFramebuffer.getColorTexture()!==this._copyDepthFramebuffer.getColorTexture()){const r=this._copyDepthFramebuffer.getColorTexture().width,s=this._copyDepthFramebuffer.getColorTexture().height;this._tempCopyDepthFramebuffer.destroy(),this._tempCopyDepthFramebuffer.update(e,r,s);const a=this._copyDepthFramebuffer.getColorTexture();this._updateDepthFramebuffer.setColorTexture(a,0),this._updateDepthFramebuffer.setDepthStencilTexture(o),this._updateDepthFramebuffer.update(e,r,s),_Y(this,e,r,s,t)}this._tempCopyDepthTexture=o,this._tempCopyDepthCommand.execute(e,t),this._updateDepthCommand.execute(e,t)}return}l(this._copyDepthCommand)&&this._copyDepthCommand.execute(e,t)};Ed.prototype.executeCopyColor=function(e,t){l(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};Ed.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;l(i)&&(H.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};Ed.prototype.isDestroyed=function(){return!1};Ed.prototype.destroy=function(){return yMe(this),l(this._copyColorCommand)&&(this._copyColorCommand.shaderProgram=this._copyColorCommand.shaderProgram.destroy()),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=this._copyDepthCommand.shaderProgram.destroy()),l(this._tempCopyDepthCommand)&&(this._tempCopyDepthCommand.shaderProgram=this._tempCopyDepthCommand.shaderProgram.destroy()),l(this._updateDepthCommand)&&(this._updateDepthCommand.shaderProgram=this._updateDepthCommand.shaderProgram.destroy()),He(this)};function sg(){this._framebuffer=new Ln({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new Ln,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(sg.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 AMe(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function bMe(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.FLOAT:Qe.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function CMe(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!Ye.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,Ye.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=Ye.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._renderState)||!Ye.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(qB,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),l(e._clearCommand)||(e._clearCommand=new co({color:new H(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}sg.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;bMe(this,n,o,r,e),CMe(this,n,o,r,i),this._useHdr=e};sg.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};sg.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};sg.prototype.isDestroyed=function(){return!1};sg.prototype.destroy=function(){return AMe(this),He(this)};function Yf(e){this._numSamples=1,this._translucentMultipassSupport=!1,this._translucentMRTSupport=!1;const 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 Ln({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new Ln({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new Ln({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new Ln({createColorAttachments:!1}),this._opaqueClearCommand=new co({color:new H(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new co({color:new H(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new co({color:new H(0,0,0,0),owner:this}),this._alphaClearCommand=new co({color:new H(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 gY(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function $B(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function yY(e){gY(e),$B(e)}function TMe(e,t,n,i){gY(e),e._accumulationTexture=new Wt({context:t,width:n,height:i,pixelFormat:rt.RGBA,pixelDatatype:Qe.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:Qe.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function EMe(e,t){$B(e);const n=ae.FRAMEBUFFER_COMPLETE;let i=!0;const o=e._accumulationTexture.width,r=e._accumulationTexture.height;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)&&($B(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);const s=e._translucentFBO.status===n,a=e._alphaFBO.status===n,c=e._adjustTranslucentFBO.status===n,u=e._adjustAlphaFBO.status===n;(!s||!a||!c||!u)&&(yY(e),e._translucentMultipassSupport=!1,i=!1)}return i}Yf.prototype.update=function(e,t,n,i,o){if(!this.isSupported())return;this._opaqueFBO=n,this._opaqueTexture=n.getColorTexture(0),this._depthStencilTexture=n.getDepthStencilTexture();const r=this._opaqueTexture.width,s=this._opaqueTexture.height,a=this._accumulationTexture,c=!l(a)||a.width!==r||a.height!==s||i!==this._useHDR,u=this._numSamples!==o;if((c||u)&&(this._numSamples=o,TMe(this,e,r,s)),(!l(this._translucentFBO.framebuffer)||c||u)&&!EMe(this,e))return;this._useHDR=i;const d=this;let h,m;l(this._compositeCommand)||(h=new We({sources:[hEe]}),this._translucentMRTSupport&&h.defines.push("MRT"),m={u_opaque:function(){return d._opaqueTexture},u_accumulation:function(){return d._accumulationTexture},u_revealage:function(){return d._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(h,{uniformMap:m,owner:this})),l(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(h=new We({defines:["MRT"],sources:[YU]}),m={u_bgColor:function(){return d._translucentMRTClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:m,owner:this})):this._translucentMultipassSupport&&(h=new We({sources:[YU]}),m={u_bgColor:function(){return d._translucentMultipassClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:m,owner:this}),m={u_bgColor:function(){return d._alphaClearCommand.color},u_depthTexture:function(){return d._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(h,{uniformMap:m,owner:this}))),this._viewport.width=r,this._viewport.height=s;const g=!Ye.equals(this._viewport,t.viewport);let p=g!==this._useScissorTest;this._useScissorTest=g,Ye.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=Ye.clone(t.viewport,this._scissorRectangle),p=!0),(!l(this._rs)||!Ye.equals(this._viewport,this._rs.viewport)||p)&&(this._rs=et.fromCache({viewport:this._viewport,scissorTest:{enabled:this._useScissorTest,rectangle:this._scissorRectangle}})),l(this._compositeCommand)&&(this._compositeCommand.renderState=this._rs),this._adjustTranslucentCommand&&(this._adjustTranslucentCommand.renderState=this._rs),l(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.renderState=this._rs)};const xMe={enabled:!0,color:new H(0,0,0,0),equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.ONE,functionDestinationRgb:Mo.ONE,functionSourceAlpha:Mo.ZERO,functionDestinationAlpha:Mo.ONE_MINUS_SOURCE_ALPHA},wMe={enabled:!0,color:new H(0,0,0,0),equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.ONE,functionDestinationRgb:Mo.ONE,functionSourceAlpha:Mo.ONE,functionDestinationAlpha:Mo.ONE},SMe={enabled:!0,color:new H(0,0,0,0),equationRgb:Jc.ADD,equationAlpha:Jc.ADD,functionSourceRgb:Mo.ZERO,functionDestinationRgb:Mo.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:Mo.ZERO,functionDestinationAlpha:Mo.ONE_MINUS_SOURCE_ALPHA};function o2(e,t,n,i){let o=n[i.id];if(!l(o)){const r=et.getState(i);r.depthMask=!1,r.blending=t,o=et.fromCache(r),n[i.id]=o}return o}function vMe(e,t,n){return o2(t,xMe,e._translucentRenderStateCache,n)}function DMe(e,t,n){return o2(t,wMe,e._translucentRenderStateCache,n)}function IMe(e,t,n){return o2(t,SMe,e._alphaRenderStateCache,n)}const PMe=` vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;
|
||
float ai = czm_gl_FragColor.a;
|
||
float wzi = czm_alphaWeight(ai);
|
||
gl_FragData[0] = vec4(Ci * wzi, ai);
|
||
gl_FragData[1] = vec4(ai * wzi);
|
||
`,OMe=` vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;
|
||
float ai = czm_gl_FragColor.a;
|
||
float wzi = czm_alphaWeight(ai);
|
||
gl_FragColor = vec4(Ci, ai) * wzi;
|
||
`,LMe=` float ai = czm_gl_FragColor.a;
|
||
gl_FragColor = vec4(ai);
|
||
`;function r2(e,t,n,i){let o=e.shaderCache.getDerivedShaderProgram(t,n);if(!l(o)){const r=t._attributeLocations,s=t.fragmentShaderSource.clone();s.sources=s.sources.map(function(a){return a=We.replaceMain(a,"czm_translucent_main"),a=a.replace(/gl_FragColor/g,"czm_gl_FragColor"),a=a.replace(/\bdiscard\b/g,"czm_discard = true"),a=a.replace(/czm_phong/g,"czm_translucentPhong"),a}),s.sources.splice(0,0,`${i.indexOf("gl_FragData")!==-1?`#extension GL_EXT_draw_buffers : enable
|
||
`:""}vec4 czm_gl_FragColor;
|
||
bool czm_discard = false;
|
||
`),s.sources.push(`void main()
|
||
{
|
||
czm_translucent_main();
|
||
if (czm_discard)
|
||
{
|
||
discard;
|
||
}
|
||
${i}}
|
||
`),o=e.shaderCache.createDerivedShaderProgram(t,n,{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:s,attributeLocations:r})}return o}function BMe(e,t){return r2(e,t,"translucentMRT",PMe)}function RMe(e,t){return r2(e,t,"translucentMultipass",OMe)}function NMe(e,t){return r2(e,t,"alphaMultipass",LMe)}Yf.prototype.createDerivedCommands=function(e,t,n){if(l(n)||(n={}),this._translucentMRTSupport){let i,o;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState),n.translucentCommand=mt.shallowClone(e,n.translucentCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=BMe(t,e.shaderProgram),n.translucentCommand.renderState=vMe(this,t,e.renderState),n.shaderProgramId=e.shaderProgram.id):(n.translucentCommand.shaderProgram=i,n.translucentCommand.renderState=o)}else{let i,o,r,s;l(n.translucentCommand)&&(i=n.translucentCommand.shaderProgram,o=n.translucentCommand.renderState,r=n.alphaCommand.shaderProgram,s=n.alphaCommand.renderState),n.translucentCommand=mt.shallowClone(e,n.translucentCommand),n.alphaCommand=mt.shallowClone(e,n.alphaCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=RMe(t,e.shaderProgram),n.translucentCommand.renderState=DMe(this,t,e.renderState),n.alphaCommand.shaderProgram=NMe(t,e.shaderProgram),n.alphaCommand.renderState=IMe(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)}return n};function MMe(e,t,n,i,o,r){let s,a,c;const u=t.context,d=t.frameState.useLogDepth,h=t._hdr,m=i.framebuffer,g=o.length,p=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(u,i),i.framebuffer=e._adjustAlphaFBO.framebuffer,e._adjustAlphaCommand.execute(u,i);const y=e._opaqueFBO.framebuffer;for(i.framebuffer=e._translucentFBO.framebuffer,c=0;c<g;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=h?s.derivedCommands.hdr.command:s,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,y);for(l(r)&&(s=r.unclassifiedCommand,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.translucentCommand:s.derivedCommands.oit.translucentCommand,n(a,t,u,i,y)),i.framebuffer=e._alphaFBO.framebuffer,c=0;c<g;++c)s=o[c],s=d?s.derivedCommands.logDepth.command:s,s=h?s.derivedCommands.hdr.command:s,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,y);l(r)&&(s=r.unclassifiedCommand,a=p&&s.receiveShadows?s.derivedCommands.oit.shadows.alphaCommand:s.derivedCommands.oit.alphaCommand,n(a,t,u,i,y)),i.framebuffer=m}function FMe(e,t,n,i,o,r){const s=t.context,a=t.frameState.useLogDepth,c=t._hdr,u=i.framebuffer,d=o.length,h=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const m=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let g,p;for(let y=0;y<d;++y)g=o[y],g=a?g.derivedCommands.logDepth.command:g,g=c?g.derivedCommands.hdr.command:g,p=h&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand,n(p,t,s,i,m);l(r)&&(g=r.unclassifiedCommand,p=h&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand,n(p,t,s,i,m)),i.framebuffer=u}Yf.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){FMe(this,e,t,n,i,o);return}MMe(this,e,t,n,i,o)};Yf.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};Yf.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,H.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};Yf.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};Yf.prototype.isDestroyed=function(){return!1};Yf.prototype.destroy=function(){return yY(this),l(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),l(this._adjustTranslucentCommand)&&(this._adjustTranslucentCommand.shaderProgram=this._adjustTranslucentCommand.shaderProgram&&this._adjustTranslucentCommand.shaderProgram.destroy()),l(this._adjustAlphaCommand)&&(this._adjustAlphaCommand.shaderProgram=this._adjustAlphaCommand.shaderProgram&&this._adjustAlphaCommand.shaderProgram.destroy()),He(this)};function TT(){this._framebuffer=new Ln({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(TT.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function zMe(e){e._framebuffer.destroy()}function UMe(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new J_(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new Ye},o.viewport=new Ye,e._passState=o}TT.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&UMe(this,e);const 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};TT.prototype.isDestroyed=function(){return!1};TT.prototype.destroy=function(){return zMe(this),He(this)};function ET(e){const t=new J_(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new Ye},t.viewport=new Ye,this._context=e,this._fb=new Ln({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}ET.prototype.begin=function(e,t){const 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};const SA=new H;ET.prototype.end=function(e){const t=A(e.width,1),n=A(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);let u=0,d=0,h=0,m=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-c<=d&&d<=c){const p=4*((c-d)*t+u+a);SA.red=H.byteToFloat(o[p]),SA.green=H.byteToFloat(o[p+1]),SA.blue=H.byteToFloat(o[p+2]),SA.alpha=H.byteToFloat(o[p+3]);const y=i.getObjectByPickColor(SA);if(l(y))return y}if(u===d||u<0&&-u===d||u>0&&u===1-d){const p=h;h=-m,m=p}u+=h,d+=m}};ET.prototype.isDestroyed=function(){return!1};ET.prototype.destroy=function(){return this._fb.destroy(),He(this)};function xd(){this._numSamples=1,this._colorFramebuffer=new Ln({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new Ln({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new H(0,0,0,0),this._clearCommand=new co({color:new H(0,0,0,0),depth:1,owner:this})}function HMe(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(xd.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});xd.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.FLOAT:Qe.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};xd.prototype.clear=function(e,t,n){H.clone(n,this._clearCommand.color),H.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};xd.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};xd.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};xd.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};xd.prototype.isDestroyed=function(){return!1};xd.prototype.destroy=function(){return HMe(this),He(this)};function ul(){}ul.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};ul.createShadowCastVertexShader=function(e,t,n){const i=e.defines.slice(0),o=e.sources.slice(0);i.push("SHADOW_MAP"),n&&i.push("GENERATE_POSITION");const r=We.findPositionVarying(e),s=l(r);if(t&&!s){const a=o.length;for(let u=0;u<a;++u)o[u]=We.replaceMain(o[u],"czm_shadow_cast_main");const c=`varying vec3 v_positionEC;
|
||
void main()
|
||
{
|
||
czm_shadow_cast_main();
|
||
v_positionEC = (czm_inverseProjection * gl_Position).xyz;
|
||
}`;o.push(c)}return new We({defines:i,sources:o})};ul.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=We.findPositionVarying(e);const a=l(s);a||(s="v_positionEC");const c=r.length;for(let d=0;d<c;++d)r[d]=We.replaceMain(r[d],"czm_shadow_cast_main");let u="";return t&&(a||(u+=`varying vec3 v_positionEC;
|
||
`),u+=`uniform vec4 shadowMap_lightPositionEC;
|
||
`),i?u+=`void main()
|
||
{
|
||
`:u+=`void main()
|
||
{
|
||
czm_shadow_cast_main();
|
||
if (gl_FragColor.a == 0.0)
|
||
{
|
||
discard;
|
||
}
|
||
`,t?u+=` float distance = length(${s});
|
||
if (distance >= shadowMap_lightPositionEC.w)
|
||
{
|
||
discard;
|
||
}
|
||
distance /= shadowMap_lightPositionEC.w; // radius
|
||
gl_FragColor = czm_packDepth(distance);
|
||
`:n?u+=` gl_FragColor = vec4(1.0);
|
||
`:u+=` gl_FragColor = czm_packDepth(gl_FragCoord.z);
|
||
`,u+=`}
|
||
`,r.push(u),new We({defines:o,sources:r})};ul.getShadowReceiveShaderKeyword=function(e,t,n,i){const o=e._usesDepthTexture,r=e._polygonOffsetSupported,s=e._isPointLight,a=e._isSpotLight,c=e._numberOfCascades>1,u=e.debugCascadeColors,d=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${c}${u}${d}${t}${n}${i}`};ul.createShadowReceiveVertexShader=function(e,t,n){const 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 We({defines:i,sources:o})};ul.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=We.findNormalVarying(e),s=!i&&l(r)||i&&o,a=We.findPositionVarying(e),c=l(a),u=t._usesDepthTexture,d=t._polygonOffsetSupported,h=t._isPointLight,m=t._isSpotLight,g=t._numberOfCascades>1,p=t.debugCascadeColors,y=t.softShadows,b=h?t._pointBias:i?t._terrainBias:t._primitiveBias,C=e.defines.slice(0),E=e.sources.slice(0),w=E.length;for(let L=0;L<w;++L)E[L]=We.replaceMain(E[L],"czm_shadow_receive_main");h?C.push("USE_CUBE_MAP_SHADOW"):u&&C.push("USE_SHADOW_DEPTH_TEXTURE"),y&&!h&&C.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?C.push("ENABLE_VERTEX_LIGHTING"):C.push("ENABLE_DAYNIGHT_SHADING")),n&&b.normalShading&&s&&(C.push("USE_NORMAL_SHADING"),b.normalShadingSmooth>0&&C.push("USE_NORMAL_SHADING_SMOOTH"));let S="";h?S+=`uniform samplerCube shadowMap_textureCube;
|
||
`:S+=`uniform sampler2D shadowMap_texture;
|
||
`;let P;return c?P=` return vec4(${a}, 1.0);
|
||
`:P=`#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
|
||
varying vec3 v_logPositionEC;
|
||
#endif
|
||
vec4 getPositionEC()
|
||
{
|
||
${P}}
|
||
vec3 getNormalEC()
|
||
{
|
||
${s?` return normalize(${r});
|
||
`:` return vec3(1.0);
|
||
`}}
|
||
void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
|
||
{
|
||
${b.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
|
||
float normalOffsetScale = 1.0 - nDotL;
|
||
vec3 offset = normalOffset * normalOffsetScale * normalEC;
|
||
positionEC.xyz += offset;
|
||
`:""}}
|
||
`,S+=`void main()
|
||
{
|
||
czm_shadow_receive_main();
|
||
vec4 positionEC = getPositionEC();
|
||
vec3 normalEC = getNormalEC();
|
||
float depth = -positionEC.z;
|
||
`,S+=` czm_shadowParameters shadowParameters;
|
||
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
|
||
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
|
||
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
|
||
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
|
||
`,i?S+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
|
||
`:d||(S+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
|
||
`),h?S+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz;
|
||
float distance = length(directionEC);
|
||
directionEC = normalize(directionEC);
|
||
float radius = shadowMap_lightPositionEC.w;
|
||
// Stop early if the fragment is beyond the point light radius
|
||
if (distance > radius)
|
||
{
|
||
return;
|
||
}
|
||
vec3 directionWC = czm_inverseViewRotation * directionEC;
|
||
shadowParameters.depth = distance / radius;
|
||
shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
|
||
shadowParameters.texCoords = directionWC;
|
||
float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters);
|
||
`:m?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);
|
||
${p?` // Draw cascade colors for debugging
|
||
gl_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+=` gl_FragColor.rgb *= visibility;
|
||
}
|
||
`,E.push(S),new We({defines:C,sources:E})};function Bc(e){e=A(e,A.EMPTY_OBJECT);const t=e.context;if(!l(t))throw new x("context is required.");if(!l(e.lightCamera))throw new x("lightCamera is required.");if(l(e.numberOfCascades)&&e.numberOfCascades!==1&&e.numberOfCascades!==4)throw new x("Only one or four cascades are supported.");this._enabled=A(e.enabled,!0),this._softShadows=A(e.softShadows,!1),this._normalOffset=A(e.normalOffset,!0),this.dirty=!0,this.fromLightSource=A(e.fromLightSource,!0),this.darkness=A(e.darkness,.3),this._darkness=this.darkness,this.fadingEnabled=A(e.fadingEnabled,!0),this.maximumDistance=A(e.maximumDistance,5e3),this._outOfView=!1,this._outOfViewPrevious=!1,this._needsUpdate=!0;let n=!0;(gn.isInternetExplorer()||gn.isEdge()||(gn.isChrome()||gn.isFirefox())&&gn.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new B,this._shadowMapTexture=void 0,this._lightDirectionEC=new f,this._lightPositionEC=new oe,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new vD,this._shadowMapCullingVolume=void 0,this._sceneCamera=void 0,this._boundingSphere=new fe,this._isPointLight=A(e.isPointLight,!1),this._pointLightRadius=A(e.pointLightRadius,100),this._cascadesEnabled=this._isPointLight?!1:A(e.cascadesEnabled,!0),this._numberOfCascades=this._cascadesEnabled?A(e.numberOfCascades,4):0,this._fitNearFar=!0,this._maximumCascadeDistances=[25,150,700,Number.MAX_VALUE],this._textureSize=new j,this._isSpotLight=!1,this._cascadesEnabled?this._shadowMapCamera.frustum=new Wo:l(this._lightCamera.frustum.fov)&&(this._isSpotLight=!0),this._cascadeSplits=[new oe,new oe],this._cascadeMatrices=[new B,new B,new B,new B],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 VMe(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,s2(this),this._clearCommand=new co({depth:1,color:new H}),this._clearPassState=new J_(t),this._size=A(e.size,2048),this.size=this._size}Bc.MAXIMUM_DISTANCE=2e4;function VMe(e){this.camera=new vD,this.passState=new J_(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function gP(e,t){return et.fromCache({cull:{enabled:!0,face:Ho.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 s2(e){const t=!e._usesDepthTexture;e._primitiveRenderState=gP(t,e._primitiveBias),e._terrainRenderState=gP(t,e._terrainBias),e._pointRenderState=gP(t,e._pointBias)}Bc.prototype.debugCreateRenderStates=function(){s2(this)};Object.defineProperties(Bc.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){$Me(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 a2(e){const t=e._passes.length;for(let n=0;n<t;++n){const i=e._passes[n],o=i.framebuffer;l(o)&&!o.isDestroyed()&&o.destroy(),i.framebuffer=void 0}e._depthAttachment=e._depthAttachment&&e._depthAttachment.destroy(),e._colorAttachment=e._colorAttachment&&e._colorAttachment.destroy()}function kMe(e,t){const n=new Xl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:af.DEPTH_COMPONENT16}),i=new Wt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,sampler:ii.NEAREST}),o=new Yr({context:t,depthRenderbuffer:n,colorTextures:[i],destroyAttachments:!1}),r=e._passes.length;for(let s=0;s<r;++s){const a=e._passes[s];a.framebuffer=o,a.passState.framebuffer=o}e._shadowMapTexture=i,e._depthAttachment=n,e._colorAttachment=i}function GMe(e,t){const n=new Wt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Qe.UNSIGNED_INT_24_8,sampler:ii.NEAREST}),i=new Yr({context:t,depthStencilTexture:n,destroyAttachments:!1}),o=e._passes.length;for(let r=0;r<o;++r){const s=e._passes[r];s.framebuffer=i,s.passState.framebuffer=i}e._shadowMapTexture=n,e._depthAttachment=n}function WMe(e,t){const n=new Xl({context:t,width:e._textureSize.x,height:e._textureSize.y,format:af.DEPTH_COMPONENT16}),i=new bu({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,sampler:ii.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const s=new Yr({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 AY(e,t){e._isPointLight?WMe(e,t):e._usesDepthTexture?GMe(e,t):kMe(e,t)}function jMe(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==ae.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,s2(e),a2(e),AY(e,t))}function qMe(e,t){(!l(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(a2(e),AY(e,t),jMe(e,t),bY(e,t))}function bY(e,t,n){n=A(n,0),(e._isPointLight||n===0)&&(e._clearCommand.framebuffer=e._passes[n].framebuffer,e._clearCommand.execute(t,e._clearPassState))}function $Me(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=It.maximumCubeMapSize>=t?t:It.maximumCubeMapSize,o.x=t,o.y=t;const 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=It.maximumTextureSize>=t?t:It.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new Ye(0,0,t,t)):i===4&&(t=It.maximumTextureSize>=t*2?t:It.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){const s=n[r],a=s.passState.viewport,c=a.x/o.x,u=a.y/o.y,d=a.width/o.x,h=a.height/o.y;s.textureOffsets=new B(d,0,0,c,0,h,0,u,0,0,1,0,0,0,0,1)}}const YMe=new Ye;function XMe(e,t){let n;e._isPointLight?n=`uniform samplerCube shadowMap_textureCube;
|
||
varying 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(textureCube(shadowMap_textureCube, dir));
|
||
gl_FragColor = vec4(vec3(shadow), 1.0);
|
||
}
|
||
`:n=`uniform sampler2D shadowMap_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
${e._usesDepthTexture?` float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r;
|
||
`:` float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates));
|
||
`} gl_FragColor = vec4(vec3(shadow), 1.0);
|
||
}
|
||
`;const i=t.createViewportQuadCommand(n,{uniformMap:{shadowMap_texture:function(){return e._shadowMapTexture},shadowMap_textureCube:function(){return e._shadowMapTexture}}});return i.pass=Ne.OVERLAY,i}function KMe(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=YMe;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;l(a)||(a=XMe(e,n),e._debugShadowViewCommand=a),(!l(a.renderState)||!Ye.equals(a.renderState.viewport,s))&&(a.renderState=et.fromCache({viewport:Ye.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const wd=new Array(8);wd[0]=new oe(-1,-1,-1,1);wd[1]=new oe(1,-1,-1,1);wd[2]=new oe(1,1,-1,1);wd[3]=new oe(-1,1,-1,1);wd[4]=new oe(-1,-1,1,1);wd[5]=new oe(1,-1,1,1);wd[6]=new oe(1,1,1,1);wd[7]=new oe(-1,1,1,1);const ep=new B,c2=new Array(8);for(let e=0;e<8;++e)c2[e]=new oe;function JMe(e,t){const n=new ln({geometry:new Tc({minimum:new f(-.5,-.5,-.5),maximum:new f(.5,.5,.5)}),attributes:{color:pn.fromColor(t)}}),i=new ln({geometry:new vp({radius:.5}),attributes:{color:pn.fromColor(t)}});return new Jt({geometryInstances:[n,i],appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const QMe=[H.RED,H.GREEN,H.BLUE,H.MAGENTA],ZMe=new f;function e2e(e,t){KMe(e,t);const n=e.debugFreezeFrame&&!e._debugFreezeFrame;if(e._debugFreezeFrame=e.debugFreezeFrame,e.debugFreezeFrame&&(n&&(e._debugCameraFrustum=e._debugCameraFrustum&&e._debugCameraFrustum.destroy(),e._debugCameraFrustum=new Zh({camera:e._sceneCamera,color:H.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new Zh({camera:e._shadowMapCamera,color:H.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 Zh({camera:e._passes[i].camera,color:QMe[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!l(e._debugLightFrustum)||e._needsUpdate){const i=e._shadowMapCamera.positionWC,o=Te.IDENTITY,r=e._pointLightRadius*2,s=f.fromElements(r,r,r,ZMe),a=B.fromTranslationQuaternionRotationScale(i,o,s,ep);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=JMe(a,H.YELLOW)}e._debugLightFrustum.update(t)}else(!l(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new Zh({camera:e._shadowMapCamera,color:H.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function vD(){this.viewMatrix=new B,this.inverseViewMatrix=new B,this.frustum=void 0,this.positionCartographic=new Ce,this.positionWC=new f,this.directionWC=f.clone(f.UNIT_Z),this.upWC=f.clone(f.UNIT_Y),this.rightWC=f.clone(f.UNIT_X),this.viewProjectionMatrix=new B}vD.prototype.clone=function(e){B.clone(e.viewMatrix,this.viewMatrix),B.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Ce.clone(e.positionCartographic,this.positionCartographic),f.clone(e.positionWC,this.positionWC),f.clone(e.directionWC,this.directionWC),f.clone(e.upWC,this.upWC),f.clone(e.rightWC,this.rightWC)};const t2e=new B(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);vD.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return B.multiply(t,e,this.viewProjectionMatrix),B.multiply(t2e,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const n2e=new Array(5),i2e=new Yn,o2e=new Array(4),CY=new f,TY=new f;function r2e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=i.frustum.near,r=i.frustum.far,s=e._numberOfCascades;let a;const c=r-o,u=r/o;let d=.9,h=!1;t.shadowState.closestObjectSize<200&&(h=!0,d=.9);const m=o2e,g=n2e;for(g[0]=o,g[s]=r,a=0;a<s;++a){const U=(a+1)/s,D=o*Math.pow(u,U),I=o+c*U,_=M.lerp(I,D,d);g[a+1]=_,m[a]=_-g[a]}if(h){for(a=0;a<s;++a)m[a]=Math.min(m[a],e._maximumCascadeDistances[a]);let U=g[0];for(a=0;a<s-1;++a)U+=m[a],g[a+1]=U}oe.unpack(g,0,e._cascadeSplits[0]),oe.unpack(g,1,e._cascadeSplits[1]),oe.unpack(m,0,e._cascadeDistances);const p=n.frustum,y=p.left,b=p.right,C=p.bottom,E=p.top,w=p.near,S=p.far,P=n.positionWC,L=n.directionWC,z=n.upWC,R=i.frustum.clone(i2e),F=n.getViewProjection();for(a=0;a<s;++a){R.near=g[a],R.far=g[a+1];const U=B.multiply(R.projectionMatrix,i.viewMatrix,ep),D=B.inverse(U,ep),I=B.multiply(F,D,ep),_=f.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,CY),v=f.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,TY);for(let G=0;G<8;++G){const W=oe.clone(wd[G],c2[G]);B.multiplyByVector(I,W,W),f.divideByScalar(W,W.w,W),f.minimumByComponent(W,_,_),f.maximumByComponent(W,v,v)}_.x=Math.max(_.x,0),_.y=Math.max(_.y,0),_.z=0,v.x=Math.min(v.x,1),v.y=Math.min(v.y,1),v.z=Math.min(v.z,1);const O=e._passes[a],N=O.camera;N.clone(n);const V=N.frustum;V.left=y+_.x*(b-y),V.right=y+v.x*(b-y),V.bottom=C+_.y*(E-C),V.top=C+v.y*(E-C),V.near=w+_.z*(S-w),V.far=w+v.z*(S-w),O.cullingVolume=N.frustum.computeCullingVolume(P,L,z);const k=e._cascadeMatrices[a];B.multiply(N.getViewProjection(),i.inverseViewMatrix,k),B.multiply(O.textureOffsets,k,k)}}const s2e=new B,a2e=new f,c2e=new f,NV=new f;function l2e(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=B.multiply(i.frustum.projectionMatrix,i.viewMatrix,ep),r=B.inverse(o,ep),s=n.directionWC;let a=i.directionWC;f.equalsEpsilon(s,a,M.EPSILON10)&&(a=i.upWC);const c=f.cross(s,a,a2e);a=f.cross(c,s,c2e),f.normalize(a,a),f.normalize(c,c);const u=f.fromElements(0,0,0,NV);let d=B.computeView(u,s,a,c,s2e);const h=B.multiply(d,r,ep),m=f.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,CY),g=f.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,TY);for(let S=0;S<8;++S){const P=oe.clone(wd[S],c2[S]);B.multiplyByVector(h,P,P),f.divideByScalar(P,P.w,P),f.minimumByComponent(P,m,m),f.maximumByComponent(P,g,g)}g.z+=1e3,m.z-=10;const p=NV;p.x=-(.5*(m.x+g.x)),p.y=-(.5*(m.y+g.y)),p.z=-g.z;const y=B.fromTranslation(p,ep);d=B.multiply(y,d,d);const b=.5*(g.x-m.x),C=.5*(g.y-m.y),E=g.z-m.z,w=n.frustum;w.left=-b,w.right=b,w.bottom=-C,w.top=C,w.near=.01,w.far=E,B.clone(d,n.viewMatrix),B.inverse(d,n.inverseViewMatrix),B.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),f.clone(s,n.directionWC),f.clone(a,n.upWC),f.clone(c,n.rightWC)}const u2e=[new f(-1,0,0),new f(0,-1,0),new f(0,0,-1),new f(1,0,0),new f(0,1,0),new f(0,0,1)],d2e=[new f(0,-1,0),new f(0,0,-1),new f(0,-1,0),new f(0,-1,0),new f(0,0,1),new f(0,-1,0)],f2e=[new f(0,0,1),new f(1,0,0),new f(-1,0,0),new f(0,0,-1),new f(1,0,0),new f(1,0,0)];function h2e(e,t){const n=new Yn;n.fov=M.PI_OVER_TWO,n.near=1,n.far=e._pointLightRadius,n.aspectRatio=1;for(let i=0;i<6;++i){const o=e._passes[i].camera;o.positionWC=e._shadowMapCamera.positionWC,o.positionCartographic=t.mapProjection.ellipsoid.cartesianToCartographic(o.positionWC,o.positionCartographic),o.directionWC=u2e[i],o.upWC=d2e[i],o.rightWC=f2e[i],B.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),B.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}const p2e=new f,m2e=new f,EY=new fe,MV=EY.center;function _2e(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=EY;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,p2e),s=f.negate(i.directionWC,m2e),a=f.dot(r,s);if(e.fadingEnabled){const c=M.clamp(a/.1,0,1);e._darkness=M.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)===xn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),fe.clone(o,e._boundingSphere);else{const r=i.frustum.far/2,s=f.add(i.positionWC,f.multiplyByScalar(i.directionWC,r,MV),MV);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===xn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),fe.clone(o,e._boundingSphere)}}function g2e(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?f.clone(i.directionWC,r.directionWC):e._isPointLight?f.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;B.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),f.normalize(s,s),f.negate(s,s),B.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=ct.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=c,e._distance=c-a,_2e(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}Bc.prototype.update=function(e){if(g2e(this,e),this._needsUpdate)if(qMe(this,e.context),this._isPointLight&&h2e(this,e),this._cascadesEnabled&&(l2e(this,e),this._numberOfCascades>1&&r2e(this,e)),this._isPointLight)this._shadowMapCullingVolume=ar.fromBoundingSphere(this._boundingSphere);else{const 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){const t=this._sceneCamera.inverseViewMatrix;B.multiply(this._shadowMapCamera.getViewProjection(),t,this._shadowMapMatrix)}this.debugShow&&e2e(this,e)};Bc.prototype.updatePass=function(e,t){bY(this,e,t)};const y2e=new j;function xY(e,t,n){const 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(){const r=y2e;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 hn(t,o,!1)}function A2e(e,t,n,i,o,r){let s,a,c;if(l(r)&&(s=r.shaderProgram,a=r.renderState,c=r.uniformMap),r=mt.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!l(s)||o!==n.shaderProgram.id||t){const u=n.shaderProgram,d=n.pass===Ne.GLOBE,h=n.pass!==Ne.TRANSLUCENT,m=e._isPointLight,g=e._usesDepthTexture,p=ul.getShadowCastShaderKeyword(m,d,g,h);if(s=i.shaderCache.getDerivedShaderProgram(u,p),!l(s)){const b=u.vertexShaderSource,C=u.fragmentShaderSource,E=ul.createShadowCastVertexShader(b,m,d),w=ul.createShadowCastFragmentShader(C,m,g,h);s=i.shaderCache.createDerivedShaderProgram(u,p,{vertexShaderSource:E,fragmentShaderSource:w,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,m?a=e._pointRenderState:d&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=ht(a,!1),a.cull=ht(a.cull,!1),a.cull.enabled=!1,a=et.fromCache(a)),c=xY(e,n.uniformMap,d)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=c,r}Bc.createReceiveDerivedCommand=function(e,t,n,i,o){l(o)||(o={});const r=e.length>0,s=t.shaderProgram,a=s.vertexShaderSource,c=s.fragmentShaderSource,u=t.pass===Ne.GLOBE;let d=!1;if(u&&(d=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let h,m;l(o.receiveCommand)&&(h=o.receiveCommand.shaderProgram,m=o.receiveCommand.uniformMap),o.receiveCommand=mt.shallowClone(t,o.receiveCommand),o.castShadows=!1,o.receiveShadows=!0;const g=o.receiveShaderCastShadows!==t.castShadows,p=o.receiveShaderProgramId!==t.shaderProgram.id;if(!l(h)||p||n||g){const y=ul.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,d);if(h=i.shaderCache.getDerivedShaderProgram(s,y),!l(h)){const b=ul.createShadowReceiveVertexShader(a,u,d),C=ul.createShadowReceiveFragmentShader(c,e[0],t.castShadows,u,d);h=i.shaderCache.createDerivedShaderProgram(s,y,{vertexShaderSource:b,fragmentShaderSource:C,attributeLocations:s._attributeLocations})}m=xY(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=h,o.receiveCommand.uniformMap=m,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};Bc.createCastDerivedCommand=function(e,t,n,i,o){if(l(o)||(o={}),t.castShadows){let r=o.castCommands;l(r)||(r=o.castCommands=[]);const s=o.castShaderProgramId,a=e.length;r.length=a;for(let c=0;c<a;++c)r[c]=A2e(e[c],n,t,i,s,r[c]);o.castShaderProgramId=t.shaderProgram.id}return o};Bc.prototype.isDestroyed=function(){return!1};Bc.prototype.destroy=function(){a2(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 He(this)};const yP=`uniform sampler2D colorTexture;
|
||
|
||
#ifdef DEBUG_SHOW_DEPTH
|
||
uniform sampler2D u_packedTranslucentDepth;
|
||
#endif
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
#ifdef DEBUG_SHOW_DEPTH
|
||
if (v_textureCoordinates.x < 0.5)
|
||
{
|
||
gl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));
|
||
gl_FragColor.a = 1.0;
|
||
}
|
||
#else
|
||
vec4 color = texture2D(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
|
||
gl_FragColor = color;
|
||
#endif
|
||
}
|
||
`;function Qp(e){this._drawClassificationFBO=new Ln({createDepthAttachments:!1}),this._accumulationFBO=new Ln({createDepthAttachments:!1}),this._packFBO=new Ln,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 co({color:new H(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new co({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(Qp.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function wY(e){e._textureToComposite=void 0,e._translucentDepthStencilTexture=e._translucentDepthStencilTexture&&!e._translucentDepthStencilTexture.isDestroyed()&&e._translucentDepthStencilTexture.destroy()}function SY(e){e._drawClassificationFBO.destroy(),e._accumulationFBO.destroy(),e._packFBO.destroy()}function b2e(e,t,n,i){wY(e),e._translucentDepthStencilTexture=new Wt({context:t,width:n,height:i,pixelFormat:rt.DEPTH_STENCIL,pixelDatatype:Qe.UNSIGNED_INT_24_8,sampler:ii.NEAREST})}function C2e(e,t,n,i){SY(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 T2e(e,t,n,i){if(!e.isSupported())return;e._opaqueDepthStencilTexture=i;const o=e._opaqueDepthStencilTexture.width,r=e._opaqueDepthStencilTexture.height;e._drawClassificationFBO.isDirty(o,r)&&(b2e(e,t,o,r),C2e(e,t,o,r));let s,a;if(l(e._packDepthCommand)||(s=new We({sources:[fEe]}),a={u_opaqueDepthTexture:function(){return e._opaqueDepthStencilTexture},u_translucentDepthTexture:function(){return e._translucentDepthStencilTexture}},e._packDepthCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),!l(e._compositeCommand)){s=new We({sources:[yP]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const d=e._compositeCommand,h=d.shaderProgram,m=t.shaderCache.createDerivedShaderProgram(h,"pick",{vertexShaderSource:h.vertexShaderSource,fragmentShaderSource:new We({sources:s.sources,defines:["PICK"]}),attributeLocations:h._attributeLocations}),g=mt.shallowClone(d);g.shaderProgram=m,d.derivedCommands.pick=g}l(e._copyCommand)||(s=new We({sources:[yP]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),l(e._accumulateCommand)||(s=new We({sources:[yP]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._accumulateCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),e._viewport.width=o,e._viewport.height=r;const c=!Ye.equals(e._viewport,n.viewport);let u=c!==e._useScissorTest;e._useScissorTest=c,Ye.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=Ye.clone(n.viewport,e._scissorRectangle),u=!0),(!l(e._rsDepth)||!Ye.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!l(e._rsAccumulate)||!Ye.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:gi.EQUAL,reference:Rt.CESIUM_3D_TILE_MASK}})),l(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!l(e._rsComp)||!Ye.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=et.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Gi.ALPHA_BLEND})),l(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}Qp.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const c=e.frameState.useLogDepth,u=e.context,d=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(T2e(this,u,n,o),n.framebuffer=this._drawClassificationFBO.framebuffer,this._clearDepthStencilCommand.execute(u,n),a=0;a<r;++a){if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,!s.depthForTranslucentClassification)continue;const h=s.derivedCommands.depth.depthOnlyCommand;t(h,e,u,n)}this._frustumsDrawn+=this._hasTranslucentDepth?1:0,this._hasTranslucentDepth&&(n.framebuffer=this._packFBO.framebuffer,this._packDepthCommand.execute(u,n)),n.framebuffer=d}};Qp.prototype.executeClassificationCommands=function(e,t,n,i){if(!this._hasTranslucentDepth)return;const 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(Ne.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const c=i.commands[Ne.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[Ne.CESIUM_3D_TILE_CLASSIFICATION];for(let d=0;d<u;++d)t(c[d],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)};Qp.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),E2e(this,e,t)};function E2e(e,t,n){if(!e._hasTranslucentDepth)return;const 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}Qp.prototype.isSupported=function(){return this._supported};Qp.prototype.isDestroyed=function(){return!1};Qp.prototype.destroy=function(){return wY(this),SY(this),l(this._compositeCommand)&&(this._compositeCommand.shaderProgram=this._compositeCommand.shaderProgram&&this._compositeCommand.shaderProgram.destroy()),l(this._packDepthCommand)&&(this._packDepthCommand.shaderProgram=this._packDepthCommand.shaderProgram&&this._packDepthCommand.shaderProgram.destroy()),He(this)};function x2e(){this.command=void 0,this.near=void 0,this.far=void 0}function xT(e,t,n){const i=e.context;let o;i.depthTexture&&(o=new Ed);let r;e._useOIT&&i.depthTexture&&(r=new Yf(i));const s=new J_(i);s.viewport=Ye.clone(n),this.camera=t,this._cameraClone=ct.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new ET(i),this.pickDepthFramebuffer=new TT,this.sceneFramebuffer=new xd,this.globeDepth=o,this.globeTranslucencyFramebuffer=new sg,this.oit=r,this.translucentTileClassification=new Qp(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}const FV=new f,zV=new f;function w2e(e,t){const 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 S2e(e,t,n){const i=1/Math.max(1,w2e(e.position,t.position));return f.multiplyByScalar(e.position,i,FV),f.multiplyByScalar(t.position,i,zV),f.equalsEpsilon(FV,zV,n)&&f.equalsEpsilon(e.direction,t.direction,n)&&f.equalsEpsilon(e.up,t.up,n)&&f.equalsEpsilon(e.right,t.right,n)&&B.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}xT.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return S2e(t,n,M.EPSILON15)?(this._cameraStartFired&&fr()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=fr(),ct.clone(t,n),!0)};function v2e(e,t,n,i){const o=t.frameState,r=o.camera,s=o.useLogDepth?t.logarithmicDepthFarToNearRatio:t.farToNearRatio,a=t.mode===le.SCENE2D,c=t.nearToFarDistance2D;i*=1+M.EPSILON2,n=Math.min(Math.max(n,r.frustum.near),r.frustum.far),i=Math.max(Math.min(i,r.frustum.far),n);let u;a?(i=Math.min(i,r.position.z+t.nearToFarDistance2D),n=Math.min(n,i),u=Math.ceil(Math.max(1,i-n)/t.nearToFarDistance2D)):u=Math.ceil(Math.log(i/n)/Math.log(s));const d=e.frustumCommandsList;d.length=u;for(let h=0;h<u;++h){let m,g;a?(m=Math.min(i-c,n+h*c),g=Math.min(i,m+c)):(m=Math.max(n,Math.pow(s,h)*n),g=Math.min(i,s*m));let p=d[h];l(p)?(p.near=m,p.far=g):p=d[h]=new gMe(m,g)}}function D2e(e,t,n,i,o){t.debugShowFrustums&&(n.debugOverlappingFrustums=0);const r=e.frustumCommandsList,s=r.length;for(let a=0;a<s;++a){const c=r[a],u=c.near,d=c.far;if(i>d)continue;if(o<u)break;const h=n.pass,m=c.indices[h]++;if(c.commands[h][m]=n,t.debugShowFrustums&&(n.debugOverlappingFrustums|=1<<a),n.executeInClosestFrustum)break}if(t.debugShowFrustums){const a=e.debugFrustumStatistics.commandsInFrustums;a[n.debugOverlappingFrustums]=l(a[n.debugOverlappingFrustums])?a[n.debugOverlappingFrustums]+1:1,++e.debugFrustumStatistics.totalCommands}t.updateDerivedCommands(n)}const UV=new ar,I2e=new Jh;xT.prototype.createPotentiallyVisibleSet=function(e){const 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:{}});const c=this.frustumCommandsList,u=c.length,d=Ne.NUMBER_OF_PASSES;for(let I=0;I<u;++I)for(let _=0;_<d;++_)c[I].indices[_]=0;r.length=0,s.length=0;const h=this._commandExtents,m=h.length;let g=0,p=+Number.MAX_VALUE,y=-Number.MAX_VALUE;const b=t.shadowState.shadowsEnabled;let C=+Number.MAX_VALUE,E=-Number.MAX_VALUE,w=Number.MAX_VALUE;const S=t.mode===le.SCENE3D?t.occluder:void 0;let P=t.cullingVolume;const L=UV.planes;for(let I=0;I<5;++I)L[I]=P.planes[I];P=UV;const z=a.length;for(let I=0;I<z;++I){const _=a[I],v=_.pass;if(v===Ne.COMPUTE)r.push(_);else if(v===Ne.OVERLAY)s.push(_);else{let O,N;const V=_.boundingVolume;if(l(V)){if(!e.isVisible(_,P,S))continue;const G=V.computePlaneDistances(o,i,I2e);if(O=G.start,N=G.stop,p=Math.min(p,O),y=Math.max(y,N),b&&_.receiveShadows&&O<Bc.MAXIMUM_DISTANCE&&!(v===Ne.GLOBE&&O<-100&&N>100)){const W=N-O;v!==Ne.GLOBE&&O<100&&(w=Math.min(w,W)),C=Math.min(C,O),E=Math.max(E,N)}}else _ instanceof co?(O=n.frustum.near,N=n.frustum.far):(O=n.frustum.near,N=n.frustum.far,p=Math.min(p,O),y=Math.max(y,N));let k=h[g];l(k)||(k=h[g]=new x2e),k.command=_,k.near=O,k.far=N,g++}}b&&(C=Math.min(Math.max(C,n.frustum.near),n.frustum.far),E=Math.max(Math.min(E,n.frustum.far),C)),b&&(t.shadowState.nearPlane=C,t.shadowState.farPlane=E,t.shadowState.closestObjectSize=w),v2e(this,e,p,y);let R,F;for(R=0;R<g;R++)F=h[R],D2e(this,e,F.command,F.near,F.far);if(g<m)for(R=g;R<m&&(F=h[R],!!l(F.command));R++)F.command=void 0;const U=c.length,D=t.frustumSplits;D.length=U+1;for(let I=0;I<U;++I)D[I]=c[I].near,I===U-1&&(D[I+1]=c[I].far)};xT.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;const t=this.pickDepths,n=t.length;for(e=0;e<n;++e)t[e].destroy()};const vY=.1,P2e=new ig({pass:ra.MOST_DETAILED_PRELOAD}),O2e=new ig({pass:ra.MOST_DETAILED_PICK}),l2=new ig({pass:ra.PICK});function zs(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new Ye(0,0,1,1),n=new ct(e);n.frustum=new Gt({width:vY,aspectRatio:1,near:.1}),this._pickOffscreenView=new xT(e,n,t)}zs.prototype.update=function(){this._pickPositionCacheDirty=!0};zs.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return l(i)||(i=new rg,n[t]=i),i};const L2e=new Wo,B2e=new f,vx=new f,R2e=new j,N2e=new B;function M2e(e,t,n,i,o){const r=e.camera;let s=r.frustum;l(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;const u=B.clone(r.transform,N2e);r._setTransform(B.IDENTITY);const d=f.clone(r.position,B2e);f.multiplyByScalar(r.right,a,vx),f.add(vx,d,d),f.multiplyByScalar(r.up,c,vx),f.add(vx,d,d),r._setTransform(u),e.mode===le.SCENE2D&&f.fromElements(d.z,d.x,d.y,d);const h=s.getPixelDimensions(o.width,o.height,1,1,R2e),m=L2e;return m.right=h.x*.5,m.left=-m.right,m.top=h.y*.5,m.bottom=-m.top,m.near=s.near,m.far=s.far,m.computeCullingVolume(d,r.directionWC,r.upWC)}const F2e=new ca,z2e=new j;function U2e(e,t,n,i,o){const r=e.camera,s=r.frustum,a=s.near,c=Math.tan(s.fovy*.5),u=s.aspectRatio*c,d=2*(t.x-o.x)/o.width-1,h=2*(o.height-t.y-o.y)/o.height-1,m=d*a*u,g=h*a*c,p=s.getPixelDimensions(o.width,o.height,1,1,z2e),y=p.x*n*.5,b=p.y*i*.5,C=F2e;return C.top=g+b,C.bottom=g-b,C.right=m+y,C.left=m-y,C.near=a,C.far=s.far,C.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function DY(e,t,n,i,o){const r=e.camera.frustum;return r instanceof Gt||r instanceof Wo?M2e(e,t,n,i,o):U2e(e,t,n,i,o)}let ay=3,lb=3,Yu=new Ye(0,0,ay,lb);const IY=new j,u2=new H(0,0,0,0);zs.prototype.pick=function(e,t,n,i){if(!l(t))throw new x("windowPosition is undefined.");ay=A(n,3),lb=A(i,ay);const o=e.context,r=o.uniformState,s=e.frameState,a=e.defaultView;e.view=a;const c=a.viewport;c.x=0,c.y=0,c.width=o.drawingBufferWidth,c.height=o.drawingBufferHeight;let u=a.passState;u.viewport=Ye.clone(c,u.viewport);const d=br.transformWindowToDrawingBuffer(e,t,IY);e.jobScheduler.disableThisFrame(),e.updateFrameState(),s.cullingVolume=DY(e,d,ay,lb,c),s.invertClassification=!1,s.passes.pick=!0,s.tilesetPassState=l2,r.update(s),e.updateEnvironment(),Yu.x=d.x-(ay-1)*.5,Yu.y=e.drawingBufferHeight-d.y-(lb-1)*.5,Yu.width=ay,Yu.height=lb,u=a.pickFramebuffer.begin(Yu,a.viewport),e.updateAndExecuteCommands(u,u2),e.resolveFramebuffers(u);const h=a.pickFramebuffer.end(Yu);return o.endFrame(),h};function H2e(e,t){const n=e.context,i=e.frameState,o=e.environmentState,r=e.defaultView;e.view=r;const 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=DY(e,t,1,1,s),i.tilesetPassState=l2,e.updateEnvironment(),o.renderTranslucentDepthForPick=!0,a=r.pickDepthFramebuffer.update(n,t,s),e.updateAndExecuteCommands(a,u2),e.resolveFramebuffers(a),n.endFrame()}const V2e=new Yn,k2e=new ca,G2e=new Gt,W2e=new Wo;zs.prototype.pickPositionWorldCoordinates=function(e,t,n){if(!e.useDepthPicking)return;if(!l(t))throw new x("windowPosition is undefined.");if(!e.context.depthTexture)throw new x("Picking from the depth buffer is not supported. Check pickPositionSupported.");const i=t.toString();if(this._pickPositionCacheDirty)this._pickPositionCache={},this._pickPositionCacheDirty=!1;else if(this._pickPositionCache.hasOwnProperty(i))return f.clone(this._pickPositionCache[i],n);const o=e.frameState,r=e.context,s=r.uniformState,a=e.defaultView;e.view=a;const c=br.transformWindowToDrawingBuffer(e,t,IY);e.pickTranslucentDepth?H2e(e,c):(e.updateFrameState(),s.update(o),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;const u=e.camera;let d;l(u.frustum.fov)?d=u.frustum.clone(V2e):l(u.frustum.infiniteProjectionMatrix)?d=u.frustum.clone(k2e):l(u.frustum.width)?d=u.frustum.clone(G2e):d=u.frustum.clone(W2e);const h=a.frustumCommandsList,m=h.length;for(let g=0;g<m;++g){const y=this.getPickDepth(e,g).getDepth(r,c.x,c.y);if(l(y)&&y>0&&y<1){const b=h[g];let C;return e.mode===le.SCENE2D?(C=u.position.z,u.position.z=C-b.near+1,d.far=Math.max(1,b.far-b.near),d.near=1,s.update(o),s.updateFrustum(d)):(d.near=b.near*(g!==0?e.opaqueFrustumNearOffset:1),d.far=b.far,s.updateFrustum(d)),n=br.drawingBufferToWgs84Coordinates(e,c,y,n),e.mode===le.SCENE2D&&(u.position.z=C,s.update(o)),this._pickPositionCache[i]=f.clone(n),n}}this._pickPositionCache[i]=void 0};const j2e=new Ce;zs.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),l(n)&&e.mode!==le.SCENE3D){f.fromElements(n.y,n.z,n.x,n);const i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,j2e);o.cartographicToCartesian(r,n)}return n};function PY(e,t){let n,i;const o=[],r=[],s=[],a=[];l(e)||(e=Number.MAX_VALUE);let c=t();for(;l(c);){const u=c.object,d=c.position,h=c.exclude;if(l(d)&&!l(u)){o.push(c);break}if(!l(u)||!l(u.primitive)||!h&&(o.push(c),0>=--e))break;const m=u.primitive;let g=!1;typeof m.getGeometryInstanceAttributes=="function"&&l(u.id)&&(i=m.getGeometryInstanceAttributes(u.id),l(i)&&l(i.show)&&(g=!0,i.show=Xn.toValue(!1,i.show),s.push(i))),u instanceof As&&(g=!0,u.show=!1,a.push(u)),g||(m.show=!1,r.push(m)),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=Xn.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}zs.prototype.drillPick=function(e,t,n,i,o){const r=this;return PY(n,function(){const c=r.pick(e,t,i,o);if(l(c))return{object:c,position:void 0,exclude:!1}}).map(function(c){return c.object})};const HV=new f,q2e=new f;function $2e(e,t,n){this.ray=e,this.width=t,this.tilesets=n,this.ready=!1;const i=this;this.promise=new Promise(o=>{i._completePick=()=>{o()}})}function OY(e,t,n,i){const o=t.direction,r=f.mostOrthogonalAxis(o,HV),s=f.cross(o,r,HV),a=f.cross(o,s,q2e);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=A(n,vY),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function Y2e(e,t,n){const i=t.frameState,o=n.ray,r=n.width,s=n.tilesets,a=e._pickOffscreenView.camera,c=OY(e,o,r,a),u=P2e;u.camera=a,u.cullingVolume=c;let d=!0;const h=s.length;for(let m=0;m<h;++m){const g=s[m];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),d=d&&u.ready)}return d&&n._completePick(),d}zs.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)Y2e(this,e,t[n])&&t.splice(n--,1)};function LY(e,t,n){const i=e.length;for(let o=0;o<i;++o){const r=e.get(o);r.show&&(l(r.isCesium3DTileset)?(!l(t)||t.indexOf(r)===-1)&&n.push(r):r instanceof qo&&LY(r,t,n))}}function DD(e,t,n,i,o,r){const s=[];if(LY(t.primitives,i,s),s.length===0)return Promise.resolve(r());const a=new $2e(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function X2e(e,t){return!l(e)||!l(t)||t.length===0?!1:t.indexOf(e)>-1||t.indexOf(e.primitive)>-1||t.indexOf(e.id)>-1}function K2e(e,t,n,i,o,r,s){const a=t.context,c=a.uniformState,u=t.frameState,d=e._pickOffscreenView;t.view=d,OY(e,n,o,d.camera),Yu=Ye.clone(d.viewport,Yu);const h=d.pickFramebuffer.begin(Yu,d.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),u.invertClassification=!1,u.passes.pick=!0,u.passes.offscreen=!0,s?u.tilesetPassState=O2e:u.tilesetPassState=l2,c.update(u),t.updateEnvironment(),t.updateAndExecuteCommands(h,u2),t.resolveFramebuffers(h);let m;const g=d.pickFramebuffer.end(Yu);if(t.context.depthTexture){const p=d.frustumCommandsList.length;for(let y=0;y<p;++y){const C=e.getPickDepth(t,y).getDepth(a,0,0);if(l(C)&&C>0&&C<1){const E=d.frustumCommandsList[y],w=E.near*(y!==0?t.opaqueFrustumNearOffset:1),S=E.far,P=w+C*(S-w);m=Un.getPoint(n,P);break}}}if(t.view=t.defaultView,a.endFrame(),l(g)||l(m))return{object:g,position:m,exclude:!l(m)&&r||X2e(g,i)}}function BY(e,t,n,i,o,r,s,a){return PY(i,function(){return K2e(e,t,n,o,r,s,a)})}function M0(e,t,n,i,o,r,s){const a=BY(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function RY(e,t,n,i,o,r,s,a){return BY(e,t,n,i,o,r,s,a)}function ID(e,t){return new Promise((n,i)=>{t.then(function(o){const r=e.postRender.addEventListener(function(){r(),n(o)});e.requestRender()}).catch(function(o){i(o)})})}zs.prototype.pickFromRay=function(e,t,n,i){if(T.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");return M0(this,e,t,n,i,!1,!1)};zs.prototype.drillPickFromRay=function(e,t,n,i,o){if(T.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");return RY(this,e,t,n,i,o,!1,!1)};zs.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(T.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");const o=this;return t=Un.clone(t),n=l(n)?n.slice():n,ID(e,DD(o,e,t,n,i,function(){return M0(o,e,t,n,i,!1,!0)}))};zs.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(T.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");const r=this;return t=Un.clone(t),i=l(i)?i.slice():i,ID(e,DD(r,e,t,i,o,function(){return RY(r,e,t,n,i,o,!1,!0)}))};const J2e=new f,Q2e=new f,Z2e=new Un,NY=new Ce;function d2(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=lo._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,Q2e),s=Ce.toCartesian(t,i,J2e),a=Z2e;a.origin=s,a.direction=r;const c=new Un;return Un.getPoint(a,o,c.origin),f.negate(r,c.direction),c}function MY(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Ce.fromCartesian(t,i,NY);return d2(e,o)}function FY(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid;return Ce.fromCartesian(t,i,NY).height}function eFe(e,t,n,i,o){const r=d2(t,n);return DD(e,t,r,i,o,function(){const s=M0(e,t,r,i,o,!0,!0);if(l(s))return FY(t,s.position)})}function tFe(e,t,n,i,o,r){const s=MY(t,n);return DD(e,t,s,i,o,function(){const a=M0(e,t,s,i,o,!0,!0);if(l(a))return f.clone(a.position,r)})}zs.prototype.sampleHeight=function(e,t,n,i){if(T.defined("position",t),e.mode!==le.SCENE3D)throw new x("sampleHeight is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new x("sampleHeight requires depth texture support. Check sampleHeightSupported.");const o=d2(e,t),r=M0(this,e,o,n,i,!0,!1);if(l(r))return FY(e,r.position)};zs.prototype.clampToHeight=function(e,t,n,i,o){if(T.defined("cartesian",t),e.mode!==le.SCENE3D)throw new x("clampToHeight is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new x("clampToHeight requires depth texture support. Check clampToHeightSupported.");const r=MY(e,t),s=M0(this,e,r,n,i,!0,!1);if(l(s))return f.clone(s.position,o)};zs.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(T.defined("positions",t),e.mode!==le.SCENE3D)throw new x("sampleHeightMostDetailed is only supported in 3D mode.");if(!e.sampleHeightSupported)throw new x("sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported.");n=l(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=eFe(this,e,t[s],n,i);return ID(e,Promise.all(r).then(function(s){const a=s.length;for(let c=0;c<a;++c)t[c].height=s[c];return t}))};zs.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(T.defined("cartesians",t),e.mode!==le.SCENE3D)throw new x("clampToHeightMostDetailed is only supported in 3D mode.");if(!e.clampToHeightSupported)throw new x("clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported.");n=l(n)?n.slice():n;const o=t.length,r=new Array(o);for(let s=0;s<o;++s)r[s]=tFe(this,e,t[s],n,i,t[s]);return ID(e,Promise.all(r).then(function(s){const a=s.length;for(let c=0;c<a;++c)t[c]=s[c];return t}))};zs.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const nFe=`uniform sampler2D colorTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
uniform sampler2D autoExposure;
|
||
#endif
|
||
|
||
void main()
|
||
{
|
||
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
color /= texture2D(autoExposure, vec2(0.5)).r;
|
||
#endif
|
||
color = czm_acesTonemapping(color);
|
||
color = czm_inverseGamma(color);
|
||
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,iFe=`uniform sampler2D randomTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform float intensity;
|
||
uniform float bias;
|
||
uniform float lengthCap;
|
||
uniform float stepSize;
|
||
uniform float frustumLength;
|
||
|
||
varying 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)
|
||
{
|
||
gl_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 = texture2D(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);
|
||
gl_FragColor = vec4(vec3(ao), 1.0);
|
||
}
|
||
`,oFe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D ambientOcclusionTexture;
|
||
uniform bool ambientOcclusionOnly;
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;
|
||
gl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;
|
||
}
|
||
`,rFe=`uniform sampler2D colorTexture;
|
||
uniform float gradations;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
#ifdef CZM_SELECTED_FEATURE
|
||
if (czm_selected()) {
|
||
gl_FragColor = vec4(rgb, 1.0);
|
||
return;
|
||
}
|
||
#endif
|
||
float luminance = czm_luminance(rgb);
|
||
float darkness = luminance * gradations;
|
||
darkness = (darkness - fract(darkness)) / gradations;
|
||
gl_FragColor = vec4(vec3(darkness), 1.0);
|
||
}
|
||
`,sFe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D bloomTexture;
|
||
uniform bool glowOnly;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
|
||
#ifdef CZM_SELECTED_FEATURE
|
||
if (czm_selected()) {
|
||
gl_FragColor = color;
|
||
return;
|
||
}
|
||
#endif
|
||
|
||
vec4 bloom = texture2D(bloomTexture, v_textureCoordinates);
|
||
gl_FragColor = glowOnly ? bloom : bloom + color;
|
||
}
|
||
`,aFe=`uniform sampler2D colorTexture;
|
||
uniform float brightness;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 target = vec3(0.0);
|
||
gl_FragColor = vec4(mix(target, rgb, brightness), 1.0);
|
||
}
|
||
`,cFe=`uniform sampler2D colorTexture;
|
||
uniform float contrast;
|
||
uniform float brightness;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec3 sceneColor = texture2D(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);
|
||
gl_FragColor = vec4(sceneColor, 1.0);
|
||
}
|
||
`,lFe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D blurTexture;
|
||
uniform sampler2D depthTexture;
|
||
uniform float focalDistance;
|
||
|
||
varying 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);
|
||
gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);
|
||
}
|
||
`,uFe=`uniform sampler2D depthTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
|
||
gl_FragColor = vec4(vec3(depth), 1.0);
|
||
}
|
||
`,dFe=`uniform sampler2D depthTexture;
|
||
uniform float length;
|
||
uniform vec4 color;
|
||
|
||
varying 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)
|
||
{
|
||
gl_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 -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;
|
||
horizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;
|
||
|
||
vertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;
|
||
vertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;
|
||
}
|
||
|
||
float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);
|
||
gl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);
|
||
}
|
||
`,fFe=`uniform sampler2D colorTexture;
|
||
|
||
varying 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 = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(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);
|
||
gl_FragColor = vec4(c, fragmentColor.a);
|
||
}
|
||
`,hFe=`varying 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 = texture2D(colorTexture, v_textureCoordinates).a;
|
||
gl_FragColor = vec4(color.rgb, alpha);
|
||
}
|
||
`,YB=`#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
|
||
|
||
varying 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 = texture2D(colorTexture, st) * g.x;
|
||
for (int i = 1; i < SAMPLES; ++i)
|
||
{
|
||
g.xy *= g.yz;
|
||
|
||
vec2 offset = float(i) * dir * step;
|
||
result += texture2D(colorTexture, st - offset) * g.x;
|
||
result += texture2D(colorTexture, st + offset) * g.x;
|
||
}
|
||
|
||
gl_FragColor = result;
|
||
}
|
||
`,pFe=`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;
|
||
|
||
varying 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) * texture2D(tex, texcoord + direction * distortion.r).r;
|
||
color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;
|
||
color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;
|
||
}
|
||
else
|
||
{
|
||
color.r = texture2D(tex, texcoord + direction * distortion.r).r;
|
||
color.g = texture2D(tex, texcoord + direction * distortion.g).g;
|
||
color.b = texture2D(tex, texcoord + direction * distortion.b).b;
|
||
}
|
||
return vec4(clamp(color, 0.0, 1.0), 0.0);
|
||
}
|
||
|
||
void main(void)
|
||
{
|
||
vec4 originalColor = texture2D(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
|
||
gl_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 * texture2D(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 *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;
|
||
}
|
||
|
||
result += texture2D(colorTexture, v_textureCoordinates);
|
||
|
||
gl_FragColor = result;
|
||
}
|
||
`,mFe=`uniform sampler2D colorTexture;
|
||
uniform vec3 white;
|
||
|
||
varying 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 = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(autoExposure, vec2(0.5)).r;
|
||
color /= exposure;
|
||
#endif
|
||
color = (color * (1.0 + color / white)) / (1.0 + color);
|
||
color = czm_inverseGamma(color);
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,_Fe=`uniform sampler2D colorTexture;
|
||
|
||
varying 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 = texture2D(colorTexture, v_textureCoordinates).rgb;
|
||
vec3 green = vec3(0.0, 1.0, 0.0);
|
||
gl_FragColor = vec4((noiseValue + rgb) * green, 1.0);
|
||
}
|
||
`,gFe=`uniform sampler2D colorTexture;
|
||
|
||
varying 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 = texture2D(colorTexture, v_textureCoordinates);
|
||
vec3 color = fragmentColor.rgb;
|
||
#ifdef AUTO_EXPOSURE
|
||
float exposure = texture2D(autoExposure, vec2(0.5)).r;
|
||
color /= exposure;
|
||
#endif
|
||
color = color / (1.0 + color);
|
||
color = czm_inverseGamma(color);
|
||
gl_FragColor = vec4(color, fragmentColor.a);
|
||
}
|
||
`,yFe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D silhouetteTexture;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main(void)
|
||
{
|
||
vec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);
|
||
vec4 color = texture2D(colorTexture, v_textureCoordinates);
|
||
gl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);
|
||
}
|
||
`;function ag(){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 Ln,this._commands=void 0,this._clearCommand=void 0,this._minMaxLuminance=new j,this.enabled=!0,this._enabled=!0,this.minimumLuminance=.1,this.maximumLuminance=10}Object.defineProperties(ag.prototype,{ready:{get:function(){return this._ready}},name:{get:function(){return this._name}},outputTexture:{get:function(){const e=this._framebuffers;if(l(e))return e[e.length-1].getColorTexture(0)}}});function zY(e){const t=e._framebuffers;if(!l(t))return;const 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 AFe(e,t){zY(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.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 Ln,s[c].update(t,n,i,1,o);const a=s[r-1].getColorTexture(0);e._previousLuminance.update(t,a.width,a.height,1,o),e._framebuffers=s}function UY(e){const t=e._commands;if(!l(t))return;const n=t.length;for(let i=0;i<n;++i)t[i].shaderProgram.destroy();e._commands=void 0}function bFe(e,t){let n;if(t===0)n={colorTexture:function(){return e._colorTexture},colorTextureDimensions:function(){return e._colorTexture.dimensions}};else{const 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 CFe(e,t){let n=`uniform sampler2D colorTexture;
|
||
varying vec2 v_textureCoordinates;
|
||
float sampleTexture(vec2 offset) {
|
||
`;return e===0?n+=` vec4 color = texture2D(colorTexture, v_textureCoordinates + offset);
|
||
return czm_luminance(color.rgb);
|
||
`:n+=` return texture2D(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 = texture2D(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+=` gl_FragColor = vec4(color);
|
||
}
|
||
`,n}function TFe(e,t){UY(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(CFe(r,i),{framebuffer:n[r].framebuffer,uniformMap:bFe(e,r)});e._commands=o}ag.prototype.clear=function(e){const t=this._framebuffers;if(!l(t))return;let n=this._clearCommand;l(n)||(n=this._clearCommand=new co({color:new H(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};ag.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,AFe(this,e),TFe(this,e),this._ready||(this._ready=!0)),this._minMaxLuminance.x=this.minimumLuminance,this._minMaxLuminance.y=this.maximumLuminance;const 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};ag.prototype.execute=function(e,t){this._colorTexture=t;const n=this._commands;if(!l(n))return;const i=n.length;for(let o=0;o<i;++o)n[o].execute(e)};ag.prototype.isDestroyed=function(){return!1};ag.prototype.destroy=function(){return zY(this),UY(this),He(this)};const EFe={NEAREST:0,LINEAR:1},P_=EFe;function Ri(e){e=A(e,A.EMPTY_OBJECT);const t=e.fragmentShader,n=A(e.textureScale,1),i=A(e.pixelFormat,rt.RGBA);if(T.typeOf.string("options.fragmentShader",t),T.typeOf.number.greaterThan("options.textureScale",n,0),T.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!rt.isColorFormat(i))throw new x("options.pixelFormat must be a color format.");this._fragmentShader=t,this._uniforms=e.uniforms,this._textureScale=n,this._forcePowerOfTwo=A(e.forcePowerOfTwo,!1),this._sampleMode=A(e.sampleMode,P_.NEAREST),this._pixelFormat=i,this._pixelDatatype=A(e.pixelDatatype,Qe.UNSIGNED_BYTE),this._clearColor=A(e.clearColor,H.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;const o=new J_;o.scissorTest={enabled:!0,rectangle:l(e.scissorRectangle)?Ye.clone(e.scissorRectangle):new Ye},this._passState=o,this._ready=!1;let r=e.name;l(r)||(r=Ms()),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(Ri.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(l(this._textureCache)){const e=this._textureCache.getFramebuffer(this._name);if(l(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}}});const xFe=/uniform\s+sampler2D\s+depthTexture/g;Ri.prototype._isSupported=function(e){return!xFe.test(this._fragmentShader)||e.depthTexture};function wFe(e,t,n){const 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){const r=t[n];t[n]=o;const s=e._actualUniforms,a=s[n];l(a)&&a!==r&&a instanceof Wt&&!l(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof Wt&&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 SFe(e,t){return function(){const n=e._actualUniforms[t];return typeof n=="function"?n():n}}function vFe(e,t){return function(){const n=e[t]();if(l(n))return n.dimensions}}function DFe(e){if(l(e._uniformMap))return;const t={},n={},i=e._uniforms,o=e._actualUniforms;for(const r in i)if(i.hasOwnProperty(r)){typeof i[r]!="function"?(t[r]=SFe(e,r),n[r]=wFe(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();(typeof s=="string"||s instanceof Wt||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=vFe(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=hn(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 IFe(e,t){if(l(e._command)&&!e._logDepthChanged&&!e._selectedDirty)return;let n=e._fragmentShader;if(l(e._selectedIdTexture)){const o=e._selectedIdTexture.width;n=n.replace(/varying\s+vec2\s+v_textureCoordinates;/g,""),n=`#define CZM_SELECTED_FEATURE
|
||
uniform sampler2D czm_idTexture;
|
||
uniform sampler2D czm_selectedIdTexture;
|
||
uniform float czm_selectedIdTextureStep;
|
||
varying vec2 v_textureCoordinates;
|
||
bool czm_selected(vec2 offset)
|
||
{
|
||
bool selected = false;
|
||
vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset);
|
||
for (int i = 0; i < ${o}; ++i)
|
||
{
|
||
vec4 selectedId = texture2D(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}`}const i=new We({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function PFe(e){const t=e._sampleMode;let n,i;t===P_.LINEAR?(n=In.LINEAR,i=Kr.LINEAR):(n=In.NEAREST,i=Kr.NEAREST);const o=e._sampler;(!l(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function OFe(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function LFe(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function BFe(e,t){let n,i,o;const r=e._texturesToRelease;let s=r.length;for(n=0;n<s;++n)i=r[n],i=i&&i.destroy();r.length=0;const a=e._texturesToCreate;for(s=a.length,n=0;n<s;++n){const h=a[n];o=h.name;const m=h.source;e._actualUniforms[o]=new Wt({context:t,source:m})}a.length=0;const c=e._dirtyUniforms;if(c.length===0&&!l(e._texturePromise)){e._ready=!0;return}if(c.length===0||l(e._texturePromise))return;s=c.length;const u=e._uniforms,d=[];for(n=0;n<s;++n){o=c[n];const h=u[o],m=e._textureCache.getStageByName(h);if(l(m))e._actualUniforms[o]=LFe(e,h);else if(typeof h=="string"){const g=new Me({url:h});d.push(g.fetchImage().then(OFe(e,o)))}else e._texturesToCreate.push({name:o,source:h})}c.length=0,d.length>0?(e._ready=!1,e._texturePromise=Promise.all(d).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function HY(e){l(e._command)&&(e._command.shaderProgram=e._command.shaderProgram&&e._command.shaderProgram.destroy(),e._command=void 0),e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy();const t=e._textureCache;if(!l(t))return;const n=e._uniforms,i=e._actualUniforms;for(const o in i)i.hasOwnProperty(o)&&i[o]instanceof Wt&&(l(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function RFe(e){let t=l(e._selected)?e._selected.length:0;const n=l(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(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 NFe(e,t){if(!e._selectedDirty)return;e._selectedIdTexture=e._selectedIdTexture&&e._selectedIdTexture.destroy(),e._selectedIdTexture=void 0;const n=e._combinedSelected;if(!l(n))return;let i,o,r=0;const s=n.length;for(i=0;i<s;++i)o=n[i],l(o.pickIds)?r+=o.pickIds.length:l(o.pickId)&&++r;if(s===0||r===0){const d=new Uint8Array(4);d[0]=255,d[1]=255,d[2]=255,d[3]=255,e._selectedIdTexture=new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,source:{arrayBufferView:d,width:1,height:1},sampler:ii.NEAREST});return}let a,c=0;const u=new Uint8Array(r*4);for(i=0;i<s;++i)if(o=n[i],l(o.pickIds)){const d=o.pickIds,h=d.length;for(let m=0;m<h;++m)a=d[m].color,u[c]=H.floatToByte(a.red),u[c+1]=H.floatToByte(a.green),u[c+2]=H.floatToByte(a.blue),u[c+3]=H.floatToByte(a.alpha),c+=4}else l(o.pickId)&&(a=o.pickId.color,u[c]=H.floatToByte(a.red),u[c+1]=H.floatToByte(a.green),u[c+2]=H.floatToByte(a.blue),u[c+3]=H.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:ii.NEAREST})}Ri.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&HY(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=RFe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0,NFe(this,e),DFe(this),BFe(this,e),IFe(this,e),PFe(this),this._selectedDirty=!1,!this._ready))return;const n=this._textureCache.getFramebuffer(this._name);if(this._command.framebuffer=n,!l(n))return;const i=n.getColorTexture(0);let o;(i.width!==e.drawingBufferWidth||i.height!==e.drawingBufferHeight)&&(o=this._renderState,(!l(o)||i.width!==o.viewport.width||i.height!==o.viewport.height)&&(this._renderState=et.fromCache({viewport:new Ye(0,0,i.width,i.height)}))),this._command.renderState=o};Ri.prototype.execute=function(e,t,n,i){if(!l(this._command)||!l(this._command.framebuffer)||!this._ready||!this._enabled)return;this._colorTexture=t,this._depthTexture=n,this._idTexture=i,ii.equals(this._colorTexture.sampler,this._sampler)||(this._colorTexture.sampler=this._sampler);const o=this.scissorRectangle.width>0&&this.scissorRectangle.height>0?this._passState:void 0;l(o)&&(o.context=e),this._command.execute(e,o)};Ri.prototype.isDestroyed=function(){return!1};Ri.prototype.destroy=function(){return HY(this),He(this)};function ua(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.stages",e.stages),T.typeOf.number.greaterThan("options.stages.length",e.stages.length,0),this._stages=e.stages,this._inputPreviousStageTexture=A(e.inputPreviousStageTexture,!0);let t=e.name;l(t)||(t=Ms()),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(ua.prototype,{ready:{get:function(){const 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){const 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}}});ua.prototype._isSupported=function(e){const t=this._stages,n=t.length;for(let i=0;i<n;++i)if(!t[i]._isSupported(e))return!1;return!0};ua.prototype.get=function(e){return T.typeOf.number.greaterThanOrEquals("index",e,0),T.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function MFe(e){let t=l(e._selected)?e._selected.length:0;const n=l(e._parentSelected)?e._parentSelected:0;let i=e._selected!==e._selectedShadow||t!==e._selectedLength;if(i=i||e._parentSelected!==e._parentSelectedShadow||n!==e._parentSelectedLength,l(e._selected)&&l(e._parentSelected)?e._combinedSelected=e._selected.concat(e._parentSelected):l(e._parentSelected)?e._combinedSelected=e._parentSelected:e._combinedSelected=e._selected,!i&&l(e._combinedSelected)){if(!l(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}ua.prototype.update=function(e,t){this._selectedDirty=MFe(this),this._selectedShadow=this._selected,this._parentSelectedShadow=this._parentSelected,this._combinedSelectedShadow=this._combinedSelected,this._selectedLength=l(this._selected)?this._selected.length:0,this._parentSelectedLength=l(this._parentSelected)?this._parentSelected.length:0;const n=this._stages,i=n.length;for(let o=0;o<i;++o){const r=n[o];this._selectedDirty&&(r.parentSelected=this._combinedSelected),r.update(e,t)}};ua.prototype.isDestroyed=function(){return!1};ua.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const ir={};function PD(e){const o=`#define USE_STEP_SIZE
|
||
${YB}`,r=new Ri({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:P_.LINEAR}),s=new Ri({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:P_.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(c){const u=r.uniforms,d=s.uniforms;u.delta=d.delta=c}},sigma:{get:function(){return r.uniforms.sigma},set:function(c){const u=r.uniforms,d=s.uniforms;u.sigma=d.sigma=c}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(c){const u=r.uniforms,d=s.uniforms;u.stepSize=d.stepSize=c}}}),new ua({name:e,stages:[r,s],uniforms:a})}ir.createBlurStage=function(){return PD("czm_blur")};ir.createDepthOfFieldStage=function(){const e=PD("czm_depth_of_field_blur"),t=new Ri({name:"czm_depth_of_field_composite",fragmentShader:lFe,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 ua({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};ir.isDepthOfFieldSupported=function(e){return e.context.depthTexture};ir.createEdgeDetectionStage=function(){const e=Ms();return new Ri({name:`czm_edge_detection_${e}`,fragmentShader:dFe,uniforms:{length:.25,color:H.clone(H.BLACK)}})};ir.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function FFe(e){if(!l(e))return ir.createEdgeDetectionStage();const t=new ua({name:"czm_edge_detection_multiple",stages:e,inputPreviousStageTexture:!1}),n={};let i="",o="";for(let a=0;a<e.length;++a)i+=`uniform sampler2D edgeTexture${a};
|
||
`,o+=` vec4 edge${a} = texture2D(edgeTexture${a}, v_textureCoordinates);
|
||
if (edge${a}.a > 0.0)
|
||
{
|
||
color = edge${a};
|
||
break;
|
||
}
|
||
`,n[`edgeTexture${a}`]=e[a].name;const r=`${i}varying vec2 v_textureCoordinates;
|
||
void main() {
|
||
vec4 color = vec4(0.0);
|
||
for (int i = 0; i < ${e.length}; i++)
|
||
{
|
||
${o} }
|
||
gl_FragColor = color;
|
||
}
|
||
`,s=new Ri({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new ua({name:"czm_edge_detection_composite",stages:[t,s]})}ir.createSilhouetteStage=function(e){const t=FFe(e),n=new Ri({name:"czm_silhouette_color_edges",fragmentShader:yFe,uniforms:{silhouetteTexture:t.name}});return new ua({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};ir.isSilhouetteSupported=function(e){return e.context.depthTexture};ir.createBloomStage=function(){const e=new Ri({name:"czm_bloom_contrast_bias",fragmentShader:cFe,uniforms:{contrast:128,brightness:-.3}}),t=PD("czm_bloom_blur"),n=new ua({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new Ri({name:"czm_bloom_generate_composite",fragmentShader:sFe,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 ua({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};ir.createAmbientOcclusionStage=function(){const e=new Ri({name:"czm_ambient_occlusion_generate",fragmentShader:iFe,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=PD("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new ua({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new Ri({name:"czm_ambient_occlusion_composite",fragmentShader:oFe,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 ua({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};ir.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const zFe=`#define FXAA_QUALITY_PRESET 39
|
||
${_Ee}
|
||
${hFe}`;ir.createFXAAStage=function(){return new Ri({name:"czm_FXAA",fragmentShader:zFe,sampleMode:P_.LINEAR})};ir.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=nFe,new Ri({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};ir.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=fFe,new Ri({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};ir.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=gFe,new Ri({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};ir.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
|
||
`:"";return t+=mFe,new Ri({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:H.WHITE,autoExposure:void 0}})};ir.createAutoExposureStage=function(){return new ag};ir.createBlackAndWhiteStage=function(){return new Ri({name:"czm_black_and_white",fragmentShader:rFe,uniforms:{gradations:5}})};ir.createBrightnessStage=function(){return new Ri({name:"czm_brightness",fragmentShader:aFe,uniforms:{brightness:.5}})};ir.createNightVisionStage=function(){return new Ri({name:"czm_night_vision",fragmentShader:_Fe})};ir.createDepthViewStage=function(){return new Ri({name:"czm_depth_view",fragmentShader:uFe})};ir.createLensFlareStage=function(){return new Ri({name:"czm_lens_flare",fragmentShader:pFe,uniforms:{dirtTexture:An("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:An("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:me.WGS84.maximumRadius}})};const tp=ir;function Sd(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function Vb(e){for(;l(e.length);)e=e.get(e.length-1);return e.name}function XB(e,t,n,i,o){if(!i.enabled||!i._isSupported(t))return o;const r=n[i.name]={};if(l(o)){const a=e.getStageByName(o);r[Vb(a)]=!0}const s=i.uniforms;if(l(s)){const a=Object.getOwnPropertyNames(s),c=a.length;for(let u=0;u<c;++u){const d=s[a[u]];if(typeof d=="string"){const h=e.getStageByName(d);l(h)&&(r[Vb(h)]=!0)}}}return i.name}function ub(e,t,n,i,o){if(l(i.enabled)&&!i.enabled||l(i._isSupported)&&!i._isSupported(t))return o;const r=o,s=!l(i.inputPreviousStageTexture)||i.inputPreviousStageTexture;let a=o;const c=i.length;for(let h=0;h<c;++h){const m=i.get(h);l(m.length)?a=ub(e,t,n,m,o):a=XB(e,t,n,m,o),s&&(o=a)}let u,d;if(s)for(u=1;u<c;++u)d=Vb(i.get(u)),l(n[d])||(n[d]={}),n[d][r]=!0;else for(u=1;u<c;++u){d=Vb(i.get(u));const h=n[d];for(let m=0;m<u;++m)h[Vb(i.get(m))]=!0}return a}function UFe(e,t){const n={};if(l(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=ub(e,t,n,i,void 0);a=ub(e,t,n,o,a),a=XB(e,t,n,r,a),a=ub(e,t,n,e,a),XB(e,t,n,s,a)}else ub(e,t,n,e,void 0);return n}function HFe(e,t,n){const o=e._collection.getStageByName(t),r=o._textureScale,s=o._forcePowerOfTwo,a=o._pixelFormat,c=o._pixelDatatype,u=o._clearColor;let d,h;const m=e._framebuffers,g=m.length;for(d=0;d<g;++d){if(h=m[d],r!==h.textureScale||s!==h.forcePowerOfTwo||a!==h.pixelFormat||c!==h.pixelDatatype||!H.equals(u,h.clearColor))continue;const p=h.stages,y=p.length;let b=!1;for(let C=0;C<y;++C)if(n[p[C]]){b=!0;break}if(!b)break}return l(h)&&d<g?(h.stages.push(t),h):(h={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:c,clearColor:u,stages:[t],buffer:new Ln({pixelFormat:a,pixelDatatype:c}),clear:void 0},m.push(h),h)}function VFe(e,t){const n=UFe(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=HFe(e,i,n[i]))}function KB(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function kFe(e,t){const n=e._width,i=e._height,o=e._framebuffers,r=o.length;for(let s=0;s<r;++s){const a=o[s],c=a.textureScale;let u=Math.ceil(n*c),d=Math.ceil(i*c),h=Math.min(u,d);a.forcePowerOfTwo&&(M.isPowerOfTwo(h)||(h=M.nextPowerOfTwo(h)),u=h,d=h),a.buffer.update(t,u,d),a.clear=new co({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}Sd.prototype.updateDependencies=function(){this._updateDependencies=!0};Sd.prototype.update=function(e){const t=this._collection,n=this._updateDependencies,i=l(t.ambientOcclusion)&&t.ambientOcclusion.enabled&&t.ambientOcclusion._isSupported(e),o=l(t.bloom)&&t.bloom.enabled&&t.bloom._isSupported(e),r=l(t._tonemapping)&&t._tonemapping.enabled&&t._tonemapping._isSupported(e),s=l(t.fxaa)&&t.fxaa.enabled&&t.fxaa._isSupported(e),a=!l(t._activeStages)||t._activeStages.length>0||i||o||r||s;if((n||!a&&this._framebuffers.length>0)&&(KB(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&VFe(this,e);const c=e.drawingBufferWidth,u=e.drawingBufferHeight,d=this._width!==c||this._height!==u;!n&&!d||(this._width=c,this._height=u,this._updateDependencies=!1,KB(this),kFe(this,e))};Sd.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};Sd.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};Sd.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};Sd.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(l(t))return t.buffer.framebuffer};Sd.prototype.isDestroyed=function(){return!1};Sd.prototype.destroy=function(){return KB(this),He(this)};const db={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===db.REINHARD||e===db.MODIFIED_REINHARD||e===db.FILMIC||e===db.ACES}},fb=Object.freeze(db),f2=[];function Na(){const e=tp.createFXAAStage(),t=tp.createAmbientOcclusionStage(),n=tp.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=tp.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=fb.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new Sd(this),r={},s=f2;for(s.push(e,t,n,i);s.length>0;){const c=s.pop();r[c.name]=c,c._textureCache=o;const u=c.length;if(l(u))for(let d=0;d<u;++d)s.push(c.get(d))}this._stages=[],this._activeStages=[],this._previousActiveStages=[],this._randomTexture=void 0;const 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(Na.prototype,{ready:{get:function(){let e=!1;const t=this._stages,n=t.length;for(let a=n-1;a>=0;--a){const c=t[a];e=e||c.ready&&c.enabled}const 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 h2(this),this._stages.length}},outputTexture:{get:function(){const e=this._fxaa;if(e.enabled&&e.ready)return this.getOutputTexture(e.name);const t=this._stages,n=t.length;for(let s=n-1;s>=0;--s){const a=t[s];if(l(a)&&a.ready&&a.enabled)return this.getOutputTexture(a.name)}const i=this._tonemapping;if(i.enabled&&i.ready)return this.getOutputTexture(i.name);const o=this._bloom;if(o.enabled&&o.ready)return this.getOutputTexture(o.name);const r=this._ao;if(r.enabled&&r.ready)return this.getOutputTexture(r.name)}},hasSelected:{get:function(){const e=this._stages.slice();for(;e.length>0;){const t=e.pop();if(!l(t))continue;if(l(t.selected))return!0;const n=t.length;if(l(n))for(let i=0;i<n;++i)e.push(t.get(i))}return!1}},tonemapper:{get:function(){return this._tonemapper},set:function(e){if(this._tonemapper===e)return;if(!fb.validate(e))throw new x("tonemapper was set to an invalid value.");l(this._tonemapping)&&(delete this._stageNames[this._tonemapping.name],this._tonemapping.destroy());const t=this._autoExposureEnabled;let n;switch(e){case fb.REINHARD:n=tp.createReinhardTonemappingStage(t);break;case fb.MODIFIED_REINHARD:n=tp.createModifiedReinhardTonemappingStage(t);break;case fb.FILMIC:n=tp.createFilmicTonemappingStage(t);break;default:n=tp.createAcesTonemappingStage(t);break}if(t){const i=this._autoExposure;n.uniforms.autoExposure=function(){return i.outputTexture}}this._tonemapper=e,this._tonemapping=n,l(this._stageNames)&&(this._stageNames[n.name]=n,n._textureCache=this._textureCache),this._textureCacheDirty=!0}}});function h2(e){if(!e._stagesRemoved)return;e._stagesRemoved=!1;const t=[],n=e._stages,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._stages=t}Na.prototype.add=function(e){T.typeOf.object("stage",e);const t=this._stageNames,n=f2;for(n.push(e);n.length>0;){const o=n.pop();if(l(t[o.name]))throw new x(`${o.name} has already been added to the collection or does not have a unique name.`);t[o.name]=o,o._textureCache=this._textureCache;const r=o.length;if(l(r))for(let s=0;s<r;++s)n.push(o.get(s))}const i=this._stages;return e._index=i.length,i.push(e),this._textureCacheDirty=!0,e};Na.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=f2;for(n.push(e);n.length>0;){const i=n.pop();delete t[i.name];const o=i.length;if(l(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};Na.prototype.contains=function(e){return l(e)&&l(e._index)&&e._textureCache===this._textureCache};Na.prototype.get=function(e){h2(this);const t=this._stages,n=t.length;return T.typeOf.number.greaterThanOrEquals("stages length",n,0),T.typeOf.number.greaterThanOrEquals("index",e,0),T.typeOf.number.lessThan("index",e,n),t[e]};Na.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};Na.prototype.getStageByName=function(e){return this._stageNames[e]};Na.prototype.update=function(e,t,n){h2(this);const i=this._activeStages,o=this._activeStages=this._previousActiveStages;this._previousActiveStages=i;const r=this._stages;let s=o.length=r.length,a,c,u=0;for(a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&(o[u++]=c);o.length=u;let d=u!==i.length;if(!d){for(a=0;a<u;++a)if(o[a]!==i[a]){d=!0;break}}const h=this._ao,m=this._bloom,g=this._autoExposure,p=this._tonemapping,y=this._fxaa;p.enabled=n;const b=h.enabled&&h._isSupported(e),C=m.enabled&&m._isSupported(e),E=p.enabled&&p._isSupported(e),w=y.enabled&&y._isSupported(e);if((d||this._textureCacheDirty||b!==this._aoEnabled||C!==this._bloomEnabled||E!==this._tonemappingEnabled||w!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=b,this._bloomEnabled=C,this._tonemappingEnabled=E,this._fxaaEnabled=w,this._textureCacheDirty=!1),l(this._randomTexture)&&!b&&(this._randomTexture.destroy(),this._randomTexture=void 0),!l(this._randomTexture)&&b){s=256*256*3;const S=new Uint8Array(s);for(a=0;a<s;a+=3)S[a]=Math.floor(Math.random()*255);this._randomTexture=new Wt({context:e,pixelFormat:rt.RGB,pixelDatatype:Qe.UNSIGNED_BYTE,source:{arrayBufferView:S,width:256,height:256},sampler:new ii({wrapS:Fi.REPEAT,wrapT:Fi.REPEAT,minificationFilter:In.NEAREST,magnificationFilter:Kr.NEAREST})})}for(this._textureCache.update(e),y.update(e,t),h.update(e,t),m.update(e,t),p.update(e,t),this._autoExposureEnabled&&g.update(e,t),s=r.length,a=0;a<s;++a)r[a].update(e,t);for(u=0,a=0;a<s;++a)c=r[a],c.ready&&c.enabled&&c._isSupported(e)&&u++;d=u!==o.length,d&&this.update(e,t,n)};Na.prototype.clear=function(e){this._textureCache.clear(e),this._autoExposureEnabled&&this._autoExposure.clear(e)};function Xm(e){for(;l(e.length);)e=e.get(e.length-1);return e.outputTexture}Na.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(l(t))return Xm(t)};function Gu(e,t,n,i,o){if(l(e.execute)){e.execute(t,n,i,o);return}const r=e.length;let s;if(e.inputPreviousStageTexture)for(Gu(e.get(0),t,n,i,o),s=1;s<r;++s)Gu(e.get(s),t,Xm(e.get(s-1)),i,o);else for(s=0;s<r;++s)Gu(e.get(s),t,n,i,o)}Na.prototype.execute=function(e,t,n,i){const o=this._activeStages,r=o.length,s=this._fxaa,a=this._ao,c=this._bloom,u=this._autoExposure,d=this._tonemapping,h=a.enabled&&a._isSupported(e),m=c.enabled&&c._isSupported(e),g=this._autoExposureEnabled,p=d.enabled&&d._isSupported(e),y=s.enabled&&s._isSupported(e);if(!y&&!h&&!m&&!p&&r===0)return;let b=t;h&&a.ready&&(Gu(a,e,b,n,i),b=Xm(a)),m&&c.ready&&(Gu(c,e,b,n,i),b=Xm(c)),g&&u.ready&&Gu(u,e,b,n,i),p&&d.ready&&(Gu(d,e,b,n,i),b=Xm(d));let C=b;if(r>0){Gu(o[0],e,b,n,i);for(let E=1;E<r;++E)Gu(o[E],e,Xm(o[E-1]),n,i);C=Xm(o[r-1])}y&&s.ready&&Gu(s,e,C,n,i)};Na.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(I_,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Na.prototype.isDestroyed=function(){return!1};Na.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(),He(this)};const GFe={SHIFT:0,CTRL:1,ALT:2},dl=Object.freeze(GFe),WFe={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},kn=Object.freeze(WFe);function Zp(e,t,n){const i=e._element;if(i===document)return n.x=t.clientX,n.y=t.clientY,n;const o=i.getBoundingClientRect();return n.x=t.clientX-o.left,n.y=t.clientY-o.top,n}function p2(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function cg(e){if(e.shiftKey)return dl.SHIFT;if(e.ctrlKey)return dl.CTRL;if(e.altKey)return dl.ALT}const Ir={LEFT:0,MIDDLE:1,RIGHT:2};function Za(e,t,n,i){function o(r){i(e,r)}gn.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function jFe(e){const t=e._element,n=l(t.disableRootEvents)?t:document;gn.supportsPointerEvents()?(Za(e,"pointerdown",t,JFe),Za(e,"pointerup",t,KV),Za(e,"pointermove",t,QFe),Za(e,"pointercancel",t,KV)):(Za(e,"mousedown",t,VY),Za(e,"mouseup",n,kY),Za(e,"mousemove",n,GY),Za(e,"touchstart",t,XFe),Za(e,"touchend",n,jV),Za(e,"touchmove",n,KFe),Za(e,"touchcancel",n,jV)),Za(e,"dblclick",t,$Fe);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",Za(e,i,t,YFe)}function qFe(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}const VV={position:new j};function m2(e){e._lastSeenTouchEvent=fr()}function _2(e){return fr()-e._lastSeenTouchEvent>Rc.mouseEmulationIgnoreMilliseconds}function JB(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function VY(e,t){if(!_2(e))return;const n=t.button;e._buttonDown[n]=!0;let i;if(n===Ir.LEFT)i=kn.LEFT_DOWN;else if(n===Ir.MIDDLE)i=kn.MIDDLE_DOWN;else if(n===Ir.RIGHT)i=kn.RIGHT_DOWN;else return;const o=Zp(e,t,e._primaryPosition);j.clone(o,e._primaryStartPosition),j.clone(o,e._primaryPreviousPosition);const r=cg(t),s=e.getInputAction(i,r);l(s)&&(j.clone(o,VV.position),s(VV),t.preventDefault())}const kV={position:new j},GV={position:new j};function AP(e,t,n,i){const o=cg(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(l(r)||l(s)){const a=Zp(e,i,e._primaryPosition);if(l(r)&&(j.clone(a,kV.position),r(kV)),l(s)){const c=e._primaryStartPosition;JB(c,a,e._clickPixelTolerance)&&(j.clone(a,GV.position),s(GV))}}}function kY(e,t){if(!_2(e))return;const n=t.button;n!==Ir.LEFT&&n!==Ir.MIDDLE&&n!==Ir.RIGHT||(e._buttonDown[Ir.LEFT]&&(AP(e,kn.LEFT_UP,kn.LEFT_CLICK,t),e._buttonDown[Ir.LEFT]=!1),e._buttonDown[Ir.MIDDLE]&&(AP(e,kn.MIDDLE_UP,kn.MIDDLE_CLICK,t),e._buttonDown[Ir.MIDDLE]=!1),e._buttonDown[Ir.RIGHT]&&(AP(e,kn.RIGHT_UP,kn.RIGHT_CLICK,t),e._buttonDown[Ir.RIGHT]=!1))}const bP={startPosition:new j,endPosition:new j};function GY(e,t){if(!_2(e))return;const n=cg(t),i=Zp(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(kn.MOUSE_MOVE,n);l(r)&&(j.clone(o,bP.startPosition),j.clone(i,bP.endPosition),r(bP)),j.clone(i,o),(e._buttonDown[Ir.LEFT]||e._buttonDown[Ir.MIDDLE]||e._buttonDown[Ir.RIGHT])&&t.preventDefault()}const WV={position:new j};function $Fe(e,t){const n=t.button;let i;if(n===Ir.LEFT)i=kn.LEFT_DOUBLE_CLICK;else return;const o=cg(t),r=e.getInputAction(i,o);l(r)&&(Zp(e,t,WV.position),r(WV))}function YFe(e,t){let n;if(l(t.deltaY)){const 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(!l(n))return;const i=cg(t),o=e.getInputAction(kn.WHEEL,i);l(o)&&(o(n),t.preventDefault())}function XFe(e,t){m2(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.set(s,Zp(e,r,new j));OD(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.set(s,j.clone(a.get(s)))}function jV(e,t){m2(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i)r=n[i],s=r.identifier,a.remove(s);OD(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.remove(s)}const qV={position:new j},CP={position1:new j,position2:new j},$V={position:new j},YV={position:new j},XV={position:new j};function OD(e,t){const n=cg(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(o!==1&&e._buttonDown[Ir.LEFT]){if(e._buttonDown[Ir.LEFT]=!1,l(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(kn.LEFT_UP,n),l(r)&&(j.clone(e._primaryPosition,$V.position),r($V)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(kn.LEFT_CLICK,n),l(s))){const c=e._primaryStartPosition,u=e._previousPositions.values[0];JB(c,u,e._clickPixelTolerance)&&(j.clone(e._primaryPosition,YV.position),s(YV))}e._isTouchHolding=!1}if(o===0&&a&&(e._isPinching=!1,r=e.getInputAction(kn.PINCH_END,n),l(r)&&r()),o===1&&!a){const c=i.values[0];j.clone(c,e._primaryPosition),j.clone(c,e._primaryStartPosition),j.clone(c,e._primaryPreviousPosition),e._buttonDown[Ir.LEFT]=!0,r=e.getInputAction(kn.LEFT_DOWN,n),l(r)&&(j.clone(c,qV.position),r(qV)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(kn.RIGHT_CLICK,n),l(s))){const u=e._primaryStartPosition,d=e._previousPositions.values[0];JB(u,d,e._holdPixelTolerance)&&(j.clone(e._primaryPosition,XV.position),s(XV))}},Rc.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(kn.PINCH_START,n),l(r)&&(j.clone(i.values[0],CP.position1),j.clone(i.values[1],CP.position2),r(CP),t.preventDefault()))}function KFe(e,t){m2(e);const n=t.changedTouches;let i;const o=n.length;let r,s;const a=e._positions;for(i=0;i<o;++i){r=n[i],s=r.identifier;const u=a.get(s);l(u)&&Zp(e,r,u)}WY(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,j.clone(a.get(s),c.get(s))}const TP={startPosition:new j,endPosition:new j},vA={distance:{startPosition:new j,endPosition:new j},angleAndHeight:{startPosition:new j,endPosition:new j}};function WY(e,t){const n=cg(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(r===1&&e._buttonDown[Ir.LEFT]){const a=i.values[0];j.clone(a,e._primaryPosition);const c=e._primaryPreviousPosition;s=e.getInputAction(kn.MOUSE_MOVE,n),l(s)&&(j.clone(c,TP.startPosition),j.clone(a,TP.endPosition),s(TP)),j.clone(a,c),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(kn.PINCH_MOVE,n),l(s))){const a=i.values[0],c=i.values[1],u=o.values[0],d=o.values[1],h=c.x-a.x,m=c.y-a.y,g=Math.sqrt(h*h+m*m)*.25,p=d.x-u.x,y=d.y-u.y,b=Math.sqrt(p*p+y*y)*.25,C=(c.y+a.y)*.125,E=(d.y+u.y)*.125,w=Math.atan2(m,h),S=Math.atan2(y,p);j.fromElements(0,b,vA.distance.startPosition),j.fromElements(0,g,vA.distance.endPosition),j.fromElements(S,E,vA.angleAndHeight.startPosition),j.fromElements(w,C,vA.angleAndHeight.endPosition),s(vA)}}function JFe(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.set(i,Zp(e,t,new j)),OD(e,t),e._previousPositions.set(i,j.clone(n.get(i)))}else VY(e,t)}function KV(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.remove(i),OD(e,t),e._previousPositions.remove(i)}else kY(e,t)}function QFe(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId,o=n.get(i);if(!l(o))return;Zp(e,t,o),WY(e,t);const r=e._previousPositions;j.clone(n.get(i),r.get(i))}else GY(e,t)}function Rc(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-Rc.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new j,this._primaryPosition=new j,this._primaryPreviousPosition=new j,this._positions=new vt,this._previousPositions=new vt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=A(e,document),jFe(this)}Rc.prototype.setInputAction=function(e,t,n){if(!l(e))throw new x("action is required.");if(!l(t))throw new x("type is required.");const i=p2(t,n);this._inputEvents[i]=e};Rc.prototype.getInputAction=function(e,t){if(!l(e))throw new x("type is required.");const n=p2(e,t);return this._inputEvents[n]};Rc.prototype.removeInputAction=function(e,t){if(!l(e))throw new x("type is required.");const n=p2(e,t);delete this._inputEvents[n]};Rc.prototype.isDestroyed=function(){return!1};Rc.prototype.destroy=function(){return qFe(this),He(this)};Rc.mouseEmulationIgnoreMilliseconds=800;Rc.touchHoldDelayMilliseconds=1500;function lg(e){T.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}lg.prototype.completeMorph=function(){l(this._completeMorph)&&this._completeMorph()};lg.prototype.morphTo2D=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof Gt,!(this._previousMode===le.SCENE2D||this._previousMode===le.MORPHING)&&(this._scene.morphStart.raiseEvent(this,this._previousMode,le.SCENE2D,!0),n._mode=le.MORPHING,n.camera._setTransform(B.IDENTITY),this._previousMode===le.COLUMBUS_VIEW?O3e(this,e):z3e(this,e,t),e===0&&l(this._completeMorph)&&this._completeMorph())};const ZFe=new f,e3e=new f,t3e=new f,n3e=new f,i3e=new f,o3e=new f,r3e=new f,s3e=new Ce,a3e=new B,c3e=new Yn,l3e=new Gt,u3e={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};lg.prototype.morphToColumbusView=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,this._previousMode===le.COLUMBUS_VIEW||this._previousMode===le.MORPHING)return;this._scene.morphStart.raiseEvent(this,this._previousMode,le.COLUMBUS_VIEW,!0),n.camera._setTransform(B.IDENTITY);let i=ZFe;const o=e3e,r=t3e;if(e>0)i.x=0,i.y=-1,i.z=1,i=f.multiplyByScalar(f.normalize(i,i),5*t.maximumRadius,i),f.negate(f.normalize(i,o),o),f.cross(f.UNIT_X,o,r);else{const u=n.camera;if(this._previousMode===le.SCENE2D)f.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,f.negate(f.UNIT_Z,o),f.clone(f.UNIT_Y,r);else{f.clone(u.positionWC,i),f.clone(u.directionWC,o),f.clone(u.upWC,r);const d=t.scaleToGeodeticSurface(i,r3e),h=cn.eastNorthUpToFixedFrame(d,t,a3e);B.inverseTransformation(h,h),n.mapProjection.project(t.cartesianToCartographic(i,s3e),i),B.multiplyByPointAsVector(h,o,o),B.multiplyByPointAsVector(h,r,r)}}let s;this._morphToOrthographic?(s=l3e,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=c3e,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=M.toRadians(60));const a=u3e;a.position=i,a.direction=o,a.up=r,a.frustum=s;const c=H3e(a);wT(this,c),this._previousMode===le.SCENE2D?U3e(this,e,a,c):(a.position2D=B.multiplyByPoint(ct.TRANSFORM_2D,i,n3e),a.direction2D=B.multiplyByPointAsVector(ct.TRANSFORM_2D,o,i3e),a.up2D=B.multiplyByPointAsVector(ct.TRANSFORM_2D,r,o3e),n._mode=le.MORPHING,eX(this,e,a,c)),e===0&&l(this._completeMorph)&&this._completeMorph()};const g2={position:new f,direction:new f,up:new f,frustum:void 0},jY=new Yn;lg.prototype.morphTo3D=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;if(this._previousMode=n.mode,!(this._previousMode===le.SCENE3D||this._previousMode===le.MORPHING)){if(this._scene.morphStart.raiseEvent(this,this._previousMode,le.SCENE3D,!0),n._mode=le.MORPHING,n.camera._setTransform(B.IDENTITY),this._previousMode===le.SCENE2D)C3e(this,e,t);else{let i;e>0?(i=g2,f.fromDegrees(0,0,5*t.maximumRadius,t,i.position),f.negate(i.position,i.direction),f.normalize(i.direction,i.direction),f.clone(f.UNIT_Z,i.up)):i=qY(this,t);let o;const r=n.camera;r.frustum instanceof Gt?o=r.frustum.clone():(o=jY,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=M.toRadians(60)),i.frustum=o;const s=nX(i);wT(this,s),QB(this,e,i,s)}e===0&&l(this._completeMorph)&&this._completeMorph()}};lg.prototype.isDestroyed=function(){return!1};lg.prototype.destroy=function(){return LD(this),He(this)};function wT(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new Rc(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,kn.LEFT_DOWN),e._morphHandler.setInputAction(n,kn.MIDDLE_DOWN),e._morphHandler.setInputAction(n,kn.RIGHT_DOWN),e._morphHandler.setInputAction(n,kn.WHEEL)}}function LD(e){const 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()}const d3e=new Ce,f3e=new f,h3e=new B;function qY(e,t){const n=e._scene,i=n.camera,o=g2,r=o.position,s=o.direction,a=o.up,c=n.mapProjection.unproject(i.position,d3e);t.cartographicToCartesian(c,r);const u=t.scaleToGeodeticSurface(r,f3e),d=cn.eastNorthUpToFixedFrame(u,t,h3e);return B.multiplyByPointAsVector(d,i.direction,s),B.multiplyByPointAsVector(d,i.up,a),o}const p3e=new f,m3e=new f,_3e=new f,g3e=new f,y3e=new f,A3e=new f;function QB(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=f.clone(r.position,p3e),a=f.clone(r.direction,m3e),c=f.clone(r.up,_3e),u=B.multiplyByPoint(ct.TRANSFORM_2D_INVERSE,n.position,g3e),d=B.multiplyByPointAsVector(ct.TRANSFORM_2D_INVERSE,n.direction,y3e),h=B.multiplyByPointAsVector(ct.TRANSFORM_2D_INVERSE,n.up,A3e);function m(p){fl(s,u,p.time,r.position),fl(a,d,p.time,r.direction),fl(c,h,p.time,r.up),f.cross(r.direction,r.up,r.right),f.normalize(r.right,r.right)}const g=o.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:m,complete:function(){tX(e,o,0,1,t,i)}});e._currentTweens.push(g)}const b3e=new Gt,$Y=new f,YY=new f,XY=new f,y2=new f,KY=new f,JY=new f;function C3e(e,t,n){t/=3;const i=e._scene,o=i.camera;let r;t>0?(r=g2,f.fromDegrees(0,0,5*n.maximumRadius,n,r.position),f.negate(r.position,r.direction),f.normalize(r.direction,r.direction),f.clone(f.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=qY(e,n));let s;e._morphToOrthographic?(s=b3e,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=jY,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=M.toRadians(60)),r.frustum=s;const a=nX(r);wT(e,a);let c;e._morphToOrthographic?c=function(){QB(e,t,r,a)}:c=function(){ZY(e,t,r,function(){QB(e,t,r,a)})},t>0?(i._mode=le.SCENE2D,o.flyTo({duration:t,destination:f.fromDegrees(0,0,5*n.maximumRadius,n,y2),complete:function(){i._mode=le.MORPHING,c()}})):c()}function fl(e,t,n,i){return f.lerp(e,t,n,i)}function QY(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof Gt)return;const a=s.frustum.fov,c=M.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(c*.5)+1e7;function d(m){s.frustum.fov=M.lerp(a,c,m.time);const g=u/Math.tan(s.frustum.fov*.5);i(s,g)}const h=r.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:d,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(h)}const T3e=new f,E3e=new f,x3e=new f,EP=new f,w3e=new f,S3e=new f,v3e=new Wo,D3e=new Un,I3e=new f,P3e={position:void 0,direction:void 0,up:void 0,frustum:void 0};function O3e(e,t){t*=.5;const n=e._scene,i=n.camera,o=f.clone(i.position,T3e),r=f.clone(i.direction,E3e),s=f.clone(i.up,x3e),a=f.negate(f.UNIT_Z,w3e),c=f.clone(f.UNIT_Y,S3e),u=EP;if(t>0)f.clone(f.ZERO,EP),u.z=5*n.mapProjection.ellipsoid.maximumRadius;else{f.clone(o,EP);const b=D3e;B.multiplyByPoint(ct.TRANSFORM_2D,o,b.origin),B.multiplyByPointAsVector(ct.TRANSFORM_2D,r,b.direction);const C=n.globe;if(l(C)){const E=C.pickWorldCoordinates(b,n,!0,I3e);l(E)&&(B.multiplyByPoint(ct.TRANSFORM_2D_INVERSE,E,u),u.z+=f.distance(o,u))}}const d=v3e;d.right=u.z*.5,d.left=-d.right,d.top=d.right*(n.drawingBufferHeight/n.drawingBufferWidth),d.bottom=-d.top;const h=P3e;h.position=u,h.direction=a,h.up=c,h.frustum=d;const m=iX(h);wT(e,m);function g(b){fl(o,u,b.time,i.position),fl(r,a,b.time,i.direction),fl(s,c,b.time,i.up),f.cross(i.direction,i.up,i.right),f.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function p(b,C){b.position.z=C}const y=n.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){QY(e,t,h,p,m)}});e._currentTweens.push(y)}const JV=new Ce,L3e={position:new f,direction:new f,up:new f,position2D:new f,direction2D:new f,up2D:new f,frustum:new Wo},B3e={position:new f,direction:new f,up:new f,frustum:void 0},R3e=new f,N3e=new Un,M3e=new B,F3e=new f;function z3e(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=L3e;if(t>0)f.clone(f.ZERO,r.position),r.position.z=5*n.maximumRadius,f.negate(f.UNIT_Z,r.direction),f.clone(f.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,JV),i.mapProjection.project(JV,r.position),f.negate(f.UNIT_Z,r.direction),f.clone(f.UNIT_Y,r.up);const h=N3e;f.clone(r.position2D,h.origin);const m=f.clone(o.directionWC,h.direction),g=n.scaleToGeodeticSurface(o.positionWC,F3e),p=cn.eastNorthUpToFixedFrame(g,n,M3e);B.inverseTransformation(p,p),B.multiplyByPointAsVector(p,m,m),B.multiplyByPointAsVector(ct.TRANSFORM_2D,m,m);const y=i.globe;if(l(y)){const b=y.pickWorldCoordinates(h,i,!0,R3e);if(l(b)){const C=f.distance(r.position2D,b);b.x+=C,f.clone(b,r.position2D)}}}function s(h,m){h.position.x=m}B.multiplyByPoint(ct.TRANSFORM_2D,r.position,r.position2D),B.multiplyByPointAsVector(ct.TRANSFORM_2D,r.direction,r.direction2D),B.multiplyByPointAsVector(ct.TRANSFORM_2D,r.up,r.up2D);const 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;const c=B3e;B.multiplyByPoint(ct.TRANSFORM_2D_INVERSE,r.position2D,c.position),f.clone(r.direction,c.direction),f.clone(r.up,c.up),c.frustum=a;const u=iX(c);wT(e,u);function d(){QY(e,t,r,s,u)}eX(e,t,r,d)}function ZY(e,t,n,i){const o=e._scene,r=o.camera,s=r.frustum.right-r.frustum.left;r.frustum=n.frustum.clone();const a=r.frustum.fov,c=M.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(c*.5)+1e7,r.frustum.fov=c;function d(m){r.frustum.fov=M.lerp(c,a,m.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}const h=o.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:d,complete:function(){i(e)}});e._currentTweens.push(h)}function U3e(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=f.clone(n.position,y2),a=f.clone(n.direction,KY),c=f.clone(n.up,JY);o._mode=le.MORPHING;function u(){r.frustum=n.frustum.clone();const d=f.clone(r.position,$Y),h=f.clone(r.direction,YY),m=f.clone(r.up,XY);d.z=s.z;function g(y){fl(d,s,y.time,r.position),fl(h,a,y.time,r.direction),fl(m,c,y.time,r.up),f.cross(r.direction,r.up,r.right),f.normalize(r.right,r.right)}const p=o.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(p)}e._morphToOrthographic?u():ZY(e,0,n,u)}function eX(e,t,n,i){const o=e._scene,r=o.camera,s=f.clone(r.position,$Y),a=f.clone(r.direction,YY),c=f.clone(r.up,XY),u=f.clone(n.position2D,y2),d=f.clone(n.direction2D,KY),h=f.clone(n.up2D,JY);function m(p){fl(s,u,p.time,r.position),fl(a,d,p.time,r.direction),fl(c,h,p.time,r.up),f.cross(r.direction,r.up,r.right),f.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}const g=o.tweens.add({duration:t,easingFunction:xc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:m,complete:function(){tX(e,o,1,0,t,i)}});e._currentTweens.push(g)}function tX(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:xc.QUARTIC_OUT};l(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function nX(e){return function(t){const n=t._scene;n._mode=le.SCENE3D,n.morphTime=le.getMorphTime(le.SCENE3D),LD(t);const i=n.camera;(t._previousMode!==le.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,f.clone(e.position,i.position),f.clone(e.direction,i.direction),f.clone(e.up,i.up),f.cross(i.direction,i.up,i.right),f.normalize(i.right,i.right),i.frustum=e.frustum.clone());const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,le.SCENE3D,r)}}function iX(e){return function(t){const n=t._scene;n._mode=le.SCENE2D,n.morphTime=le.getMorphTime(le.SCENE2D),LD(t);const i=n.camera;f.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,f.clone(e.direction,i.direction),f.clone(e.up,i.up),f.cross(i.direction,i.up,i.right),f.normalize(i.right,i.right),i.frustum=e.frustum.clone();const o=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,le.SCENE2D,o)}}function H3e(e){return function(t){const n=t._scene;n._mode=le.COLUMBUS_VIEW,n.morphTime=le.getMorphTime(le.COLUMBUS_VIEW),LD(t);const i=n.camera;(t._previousModeMode!==le.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,f.clone(e.position,i.position),f.clone(e.direction,i.direction),f.clone(e.up,i.up),f.cross(i.direction,i.up,i.right),f.normalize(i.right,i.right));const o=i.frustum;n.frameState.useLogDepth&&(o.near=.1,o.far=1e10);const r=l(t._completeMorph);t._completeMorph=void 0,n.camera.update(n.mode),t._scene.morphComplete.raiseEvent(t,t._previousMode,le.COLUMBUS_VIEW,r)}}const V3e={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},Oi=Object.freeze(V3e);function sa(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function k3e(e,t){j.clone(e.distance.startPosition,t.distance.startPosition),j.clone(e.distance.endPosition,t.distance.endPosition),j.clone(e.angleAndHeight.startPosition,t.angleAndHeight.startPosition),j.clone(e.angleAndHeight.endPosition,t.angleAndHeight.endPosition)}function QV(e,t,n){const i=sa(Oi.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 j;let u=e._movement[i];l(u)||(u=e._movement[i]={}),u.distance={startPosition:new j,endPosition:new j},u.angleAndHeight={startPosition:new j,endPosition:new j},u.prevAngle=0,e._eventHandler.setInputAction(function(d){e._buttonsDown++,r[i]=!0,a[i]=new Date,j.lerp(d.position1,d.position2,.5,s[i])},kn.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,c[i]=new Date},kn.PINCH_END,t),e._eventHandler.setInputAction(function(d){if(r[i]){o[i]?(k3e(d,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):(j.clone(d.distance.endPosition,u.distance.endPosition),j.clone(d.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let h=u.angleAndHeight.endPosition.x;const m=u.prevAngle,g=Math.PI*2;for(;h>=m+Math.PI;)h-=g;for(;h<m-Math.PI;)h+=g;u.angleAndHeight.endPosition.x=-h*n.clientWidth/12,u.angleAndHeight.startPosition.x=-m*n.clientWidth/12}},kn.PINCH_MOVE,t)}function ZV(e,t){const n=sa(Oi.WHEEL,t),i=e._update;i[n]=!0;let o=e._movement[n];l(o)||(o=e._movement[n]={}),o.startPosition=new j,o.endPosition=new j,e._eventHandler.setInputAction(function(r){const s=15*M.toRadians(r);i[n]?(j.clone(j.ZERO,o.startPosition),o.endPosition.x=0,o.endPosition.y=s,i[n]=!1):o.endPosition.y=o.endPosition.y+s},kn.WHEEL,t)}function zg(e,t,n){const i=sa(n,t),o=e._isDown,r=e._eventStartPosition,s=e._pressTime,a=e._releaseTime;o[i]=!1,r[i]=new j;let c=e._lastMovement[i];l(c)||(c=e._lastMovement[i]={startPosition:new j,endPosition:new j,valid:!1});let u,d;n===Oi.LEFT_DRAG?(u=kn.LEFT_DOWN,d=kn.LEFT_UP):n===Oi.RIGHT_DRAG?(u=kn.RIGHT_DOWN,d=kn.RIGHT_UP):n===Oi.MIDDLE_DRAG&&(u=kn.MIDDLE_DOWN,d=kn.MIDDLE_UP),e._eventHandler.setInputAction(function(h){e._buttonsDown++,c.valid=!1,o[i]=!0,s[i]=new Date,j.clone(h.position,r[i])},u,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),o[i]=!1,a[i]=new Date},d,t)}function ek(e,t){j.clone(e.startPosition,t.startPosition),j.clone(e.endPosition,t.endPosition)}function tk(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in Oi)if(Oi.hasOwnProperty(s)){const a=Oi[s];if(l(a)){const c=sa(a,t);n[c]=!0,l(e._lastMovement[c])||(e._lastMovement[c]={startPosition:new j,endPosition:new j,valid:!1}),l(e._movement[c])||(e._movement[c]={startPosition:new j,endPosition:new j})}}e._eventHandler.setInputAction(function(s){for(const a in Oi)if(Oi.hasOwnProperty(a)){const c=Oi[a];if(l(c)){const u=sa(c,t);r[u]&&(n[u]?(ek(i[u],o[u]),o[u].valid=!0,ek(s,i[u]),n[u]=!1):j.clone(s.endPosition,i[u].endPosition))}}j.clone(s.endPosition,e._currentMousePosition)},kn.MOUSE_MOVE,t)}function wl(e){if(!l(e))throw new x("canvas is required.");this._eventHandler=new Rc(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new j,ZV(this,void 0),QV(this,void 0,e),zg(this,void 0,Oi.LEFT_DRAG),zg(this,void 0,Oi.RIGHT_DRAG),zg(this,void 0,Oi.MIDDLE_DRAG),tk(this,void 0);for(const t in dl)if(dl.hasOwnProperty(t)){const n=dl[t];l(n)&&(ZV(this,n),QV(this,n,e),zg(this,n,Oi.LEFT_DRAG),zg(this,n,Oi.RIGHT_DRAG),zg(this,n,Oi.MIDDLE_DRAG),tk(this,n))}}Object.defineProperties(wl.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!this._update[sa(Oi.WHEEL)]||!this._update[sa(Oi.WHEEL,dl.SHIFT)]||!this._update[sa(Oi.WHEEL,dl.CTRL)]||!this._update[sa(Oi.WHEEL,dl.ALT)];return this._buttonsDown>0||e}}});wl.prototype.isMoving=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t);return!this._update[n]};wl.prototype.getMovement=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t);return this._movement[n]};wl.prototype.getLastMovement=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t),i=this._lastMovement[n];if(i.valid)return i};wl.prototype.isButtonDown=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t);return this._isDown[n]};wl.prototype.getStartMousePosition=function(e,t){if(!l(e))throw new x("type is required.");if(e===Oi.WHEEL)return this._currentMousePosition;const n=sa(e,t);return this._eventStartPosition[n]};wl.prototype.getButtonPressTime=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t);return this._pressTime[n]};wl.prototype.getButtonReleaseTime=function(e,t){if(!l(e))throw new x("type is required.");const n=sa(e,t);return this._releaseTime[n]};wl.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};wl.prototype.isDestroyed=function(){return!1};wl.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),He(this)};function nv(e,t,n,i,o,r,s,a,c,u){this._tweens=e,this._tweenjs=t,this._startObject=ht(n),this._stopObject=ht(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=c,this.cancel=u,this.needsStart=!0}Object.defineProperties(nv.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}}});nv.prototype.cancelTween=function(){this._tweens.remove(this)};function Sl(){this._tweens=[]}Object.defineProperties(Sl.prototype,{length:{get:function(){return this._tweens.length}}});Sl.prototype.add=function(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.startObject)||!l(e.stopObject))throw new x("options.startObject and options.stopObject are required.");if(!l(e.duration)||e.duration<0)throw new x("options.duration is required and must be positive.");if(e.duration===0)return l(e.complete)&&e.complete(),new nv(this);const t=e.duration/Ni.SECONDS_PER_MILLISECOND,n=A(e.delay,0),i=n/Ni.SECONDS_PER_MILLISECOND,o=A(e.easingFunction,xc.LINEAR_NONE),r=e.startObject,s=new tLe(r);s.to(ht(e.stopObject),t),s.delay(i),s.easing(o),l(e.update)&&s.onUpdate(function(){e.update(r)}),s.onComplete(A(e.complete,null)),s.repeat(A(e._repeat,0));const a=new nv(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};Sl.prototype.addProperty=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.object,n=e.property,i=e.startValue,o=e.stopValue;if(!l(t)||!l(e.property))throw new x("options.object and options.property are required.");if(!l(t[n]))throw new x("options.object must have the specified property.");if(!l(i)||!l(o))throw new x("options.startValue and options.stopValue are required.");function r(s){t[n]=s.value}return this.add({startObject:{value:i},stopObject:{value:o},duration:A(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:r,complete:e.complete,cancel:e.cancel,_repeat:e._repeat})};Sl.prototype.addAlpha=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.material;if(!l(t))throw new x("options.material is required.");const n=[];for(const o in t.uniforms)t.uniforms.hasOwnProperty(o)&&l(t.uniforms[o])&&l(t.uniforms[o].alpha)&&n.push(o);if(n.length===0)throw new x("material has no properties with alpha components.");function i(o){const r=n.length;for(let s=0;s<r;++s)t.uniforms[n[s]].alpha=o.alpha}return this.add({startObject:{alpha:A(e.startValue,0)},stopObject:{alpha:A(e.stopValue,1)},duration:A(e.duration,3),delay:e.delay,easingFunction:e.easingFunction,update:i,complete:e.complete,cancel:e.cancel})};Sl.prototype.addOffsetIncrement=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.material;if(!l(t))throw new x("material is required.");if(!l(t.uniforms.offset))throw new x("material.uniforms must have an offset property.");const n=t.uniforms;return this.addProperty({object:n,property:"offset",startValue:n.offset,stopValue:n.offset+1,duration:e.duration,delay:e.delay,easingFunction:e.easingFunction,update:e.update,cancel:e.cancel,_repeat:1/0})};Sl.prototype.remove=function(e){if(!l(e))return!1;const t=this._tweens.indexOf(e);return t!==-1?(e.tweenjs.stop(),l(e.cancel)&&e.cancel(),this._tweens.splice(t,1),!0):!1};Sl.prototype.removeAll=function(){const e=this._tweens;for(let t=0;t<e.length;++t){const n=e[t];n.tweenjs.stop(),l(n.cancel)&&n.cancel()}e.length=0};Sl.prototype.contains=function(e){return l(e)&&this._tweens.indexOf(e)!==-1};Sl.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._tweens[e]};Sl.prototype.update=function(e){const t=this._tweens;let n=0;for(e=l(e)?e/Ni.SECONDS_PER_MILLISECOND:fr();n<t.length;){const i=t[n],o=i.tweenjs;i.needsStart?(i.needsStart=!1,o.start(e)):o.update(e)?n++:(o.stop(),t.splice(n,1))}};function ST(e){if(!l(e))throw new x("scene is required.");this.enableInputs=!0,this.enableTranslate=!0,this.enableZoom=!0,this.enableRotate=!0,this.enableTilt=!0,this.enableLook=!0,this.inertiaSpin=.9,this.inertiaTranslate=.9,this.inertiaZoom=.8,this.maximumMovementRatio=.1,this.bounceAnimationTime=3,this.minimumZoomDistance=1,this.maximumZoomDistance=Number.POSITIVE_INFINITY,this.translateEventTypes=Oi.LEFT_DRAG,this.zoomEventTypes=[Oi.RIGHT_DRAG,Oi.WHEEL,Oi.PINCH],this.rotateEventTypes=Oi.LEFT_DRAG,this.tiltEventTypes=[Oi.MIDDLE_DRAG,Oi.PINCH,{eventType:Oi.LEFT_DRAG,modifier:dl.CTRL},{eventType:Oi.RIGHT_DRAG,modifier:dl.CTRL}],this.lookEventTypes={eventType:Oi.LEFT_DRAG,modifier:dl.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 wl(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 Sl,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new j(-1,-1),this._tiltCenter=new f,this._rotateMousePosition=new j(-1,-1),this._rotateStartPosition=new f,this._strafeStartPosition=new f,this._strafeMousePosition=new j,this._strafeEndMousePosition=new j,this._zoomMouseStart=new j(-1,-1),this._zoomWorldPosition=new f,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;const t=e.mapProjection;this._maxCoord=t.project(new Ce(Math.PI,M.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 G3e(e,t){if(e<0)return 0;const n=(1-t)*25;return Math.exp(-n*e)}function W3e(e){return j.equalsEpsilon(e.startPosition,e.endPosition,M.EPSILON14)}const j3e=.4;function q3e(e,t,n,i,o,r,s){let a=r[s];l(a)||(a=r[s]={startPosition:new j,endPosition:new j,motion:new j,inertiaEnabled:!0});const c=e.getButtonPressTime(t,n),u=e.getButtonReleaseTime(t,n),d=c&&u&&(u.getTime()-c.getTime())/1e3,h=new Date,m=u&&(h.getTime()-u.getTime())/1e3;if(c&&u&&d<j3e){const g=G3e(m,i),p=e.getLastMovement(t,n);if(!l(p)||W3e(p)||!a.inertiaEnabled||(a.motion.x=(p.endPosition.x-p.startPosition.x)*.5,a.motion.y=(p.endPosition.y-p.startPosition.y)*.5,a.startPosition=j.clone(p.startPosition,a.startPosition),a.endPosition=j.multiplyByScalar(a.motion,g,a.endPosition),a.endPosition=j.add(a.startPosition,a.endPosition,a.endPosition),isNaN(a.endPosition.x)||isNaN(a.endPosition.y)||j.distance(a.startPosition,a.endPosition)<.5))return;if(!e.isButtonDown(t,n)){const y=e.getStartMousePosition(t,n);o(r,y,a)}}}function $3e(e,t){if(l(t)){let n=e[t];l(n)&&(n.inertiaEnabled=!0);const i=e._inertiaDisablers[t];if(l(i)){const o=i.length;for(let r=0;r<o;++r)n=e[i[r]],l(n)&&(n.inertiaEnabled=!1)}}}const nk=[];function wa(e,t,n,i,o,r){if(!l(n))return;const s=e._aggregator;Array.isArray(n)||(nk[0]=n,n=nk);const a=n.length;for(let c=0;c<a;++c){const u=n[c],d=l(u.eventType)?u.eventType:u,h=u.modifier,m=s.isMoving(d,h)&&s.getMovement(d,h),g=s.getStartMousePosition(d,h);e.enableInputs&&t&&(m?(i(e,g,m),$3e(e,r)):o<1&&q3e(s,d,h,o,i,e,r))}}const Dx=new Un,Y3e=new f,X3e=new j,K3e=new f,J3e=new j,Q3e=new f,Z3e=new f,eze=new f,tze=new f,nze=new f,ize=new f,oze=new f,rze=new f,sze=new f,aze=new f,cze=new f,lze=new f,uze=new f,dze=new f,fze=new f,Cm=new f,ik=new f,ok=new f,xP={orientation:new Xr};function A2(e,t,n,i,o,r){let s=1;l(r)&&(s=M.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,d=e.maximumZoomDistance,h=o-u;let m=i*h;m=M.clamp(m,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let p=m*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!l(e._globe)){if(p>0&&Math.abs(o-u)<1||p<0&&Math.abs(o-d)<1)return;o-p<u?p=o-u-1:o-p>d&&(p=o-d)}const y=e._scene,b=y.camera,C=y.mode,E=xP.orientation;if(E.heading=b.heading,E.pitch=b.pitch,E.roll=b.roll,b.frustum instanceof Gt){Math.abs(p)>0&&(b.zoomIn(p),b._adjustOrthographicFrustum());return}const w=j.equals(t,e._zoomMouseStart);let S=e._zoomingOnVector,P=e._rotatingZoom,L;if(w||(e._zoomMouseStart=j.clone(t,e._zoomMouseStart),l(e._globe)&&(C===le.SCENE2D?(L=b.getPickRay(t,Dx).origin,L=f.fromElements(L.y,L.z,L.x)):L=Op(e,t,Y3e)),l(L)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=f.clone(L,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,S=e._zoomingOnVector=!1,P=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){b.zoomIn(p);return}let z=C===le.COLUMBUS_VIEW;if(b.positionCartographic.height<2e6&&(P=!0),!w||P){if(C===le.SCENE2D){const R=e._zoomWorldPosition,F=b.position;if(!f.equals(R,F)&&b.positionCartographic.height<e._maxCoord.x*2){const U=b.position.x,D=f.subtract(R,F,K3e);f.normalize(D,D);const I=f.distance(R,F)*p/(b.getMagnitude()*.5);b.move(D,I*.5),(b.position.x<0&&U>0||b.position.x>0&&U<0)&&(L=b.getPickRay(t,Dx).origin,L=f.fromElements(L.y,L.z,L.x),e._zoomWorldPosition=f.clone(L,e._zoomWorldPosition))}}else if(C===le.SCENE3D){const R=f.normalize(b.position,nze);if(e._cameraUnderground||e._zoomingUnderground||b.positionCartographic.height<3e3&&Math.abs(f.dot(b.direction,R))<.6)z=!0;else{const F=y.canvas,U=J3e;U.x=F.clientWidth/2,U.y=F.clientHeight/2;const D=Op(e,U,Q3e);if(!l(D))z=!0;else if(b.positionCartographic.height<1e6)if(f.dot(b.direction,R)>=-.5)z=!0;else{const I=oze;f.clone(b.position,I);const _=e._zoomWorldPosition;let v=ize;if(v=f.normalize(_,v),f.dot(v,R)<0)return;const O=fze,N=aze;f.clone(b.direction,N),f.add(I,f.multiplyByScalar(N,1e3,Cm),O);const V=cze,k=lze;f.subtract(_,I,V),f.normalize(V,k);const G=f.dot(R,k);if(G>=0){e._zoomMouseStart.x=-1;return}const W=Math.acos(-G),K=f.magnitude(I),q=f.magnitude(_),te=K-p,Y=f.magnitude(V),X=Math.asin(M.clamp(Y/q*Math.sin(W),-1,1)),$=Math.asin(M.clamp(te/q*Math.sin(W),-1,1)),se=X-$+W,ue=rze;f.normalize(I,ue);let re=sze;re=f.cross(k,ue,re),re=f.normalize(re,re),f.normalize(f.cross(ue,re,Cm),N),f.multiplyByScalar(f.normalize(O,Cm),f.magnitude(O)-p,O),f.normalize(I,I),f.multiplyByScalar(I,te,I);const he=uze;f.multiplyByScalar(f.add(f.multiplyByScalar(ue,Math.cos(se)-1,ik),f.multiplyByScalar(N,Math.sin(se),ok),Cm),te,he),f.add(I,he,I),f.normalize(O,ue),f.normalize(f.cross(ue,re,Cm),N);const ce=dze;f.multiplyByScalar(f.add(f.multiplyByScalar(ue,Math.cos(se)-1,ik),f.multiplyByScalar(N,Math.sin(se),ok),Cm),f.magnitude(O),ce),f.add(O,ce,O),f.clone(I,b.position),f.normalize(f.subtract(O,I,Cm),b.direction),f.clone(b.direction,b.direction),f.cross(b.direction,b.up,b.right),f.cross(b.right,b.direction,b.up),b.setView(xP);return}else{const I=f.normalize(D,Z3e),_=f.normalize(e._zoomWorldPosition,eze),v=f.dot(_,I);if(v>0&&v<1){const O=M.acosClamped(v),N=f.cross(_,I,tze),V=Math.abs(O)>M.toRadians(20)?b.positionCartographic.height*.75:b.positionCartographic.height-p,k=p/V;b.rotate(N,O*k)}}}}e._rotatingZoom=!z}if(!w&&z||S){let R;const F=br.wgs84ToWindowCoordinates(y,e._zoomWorldPosition,X3e);C!==le.COLUMBUS_VIEW&&j.equals(t,e._zoomMouseStart)&&l(F)?R=b.getPickRay(F,Dx):R=b.getPickRay(t,Dx);const U=R.direction;(C===le.COLUMBUS_VIEW||C===le.SCENE2D)&&f.fromElements(U.y,U.z,U.x,U),b.move(U,p),e._zoomingOnVector=!0}else b.zoomIn(p);e._cameraUnderground||b.setView(xP)}const hze=new Un,pze=new Un,mze=new f;function _ze(e,t,n){const o=e._scene.camera;let r=o.getPickRay(n.startPosition,hze).origin,s=o.getPickRay(n.endPosition,pze).origin;r=f.fromElements(r.y,r.z,r.x,r),s=f.fromElements(s.y,s.z,s.x,s);const a=f.subtract(r,s,mze),c=f.magnitude(a);c>0&&(f.normalize(a,a),o.move(a,c))}function rk(e,t,n){l(n.distance)&&(n=n.distance);const o=e._scene.camera;A2(e,t,n,e._zoomFactor,o.getMagnitude())}const gze=new j,yze=new j;function sk(e,t,n){if(l(n.angleAndHeight)){Aze(e,t,n.angleAndHeight);return}const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let c=gze;c.x=2/s*n.startPosition.x-1,c.y=2/a*(a-n.startPosition.y)-1,c=j.normalize(c,c);let u=yze;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=j.normalize(u,u);let d=M.acosClamped(c.x);c.y<0&&(d=M.TWO_PI-d);let h=M.acosClamped(u.x);u.y<0&&(h=M.TWO_PI-h);const m=h-d;o.twistRight(m)}function Aze(e,t,n){let i=e._rotateFactor*e._rotateRateRangeAdjustment;i>e._maximumRotateRate&&(i=e._maximumRotateRate),i<e._minimumRotateRate&&(i=e._minimumRotateRate);const o=e._scene,r=o.camera,s=o.canvas;let a=(n.endPosition.x-n.startPosition.x)/s.clientWidth;a=Math.min(a,e.maximumMovementRatio);const c=i*a*Math.PI*4;r.twistRight(c)}function bze(e){const t=e._scene.mapMode2D===Ip.ROTATE;B.equals(B.IDENTITY,e._scene.camera.transform)?(wa(e,e.enableTranslate,e.translateEventTypes,_ze,e.inertiaTranslate,"_lastInertiaTranslateMovement"),wa(e,e.enableZoom,e.zoomEventTypes,rk,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&wa(e,e.enableRotate,e.tiltEventTypes,sk,e.inertiaSpin,"_lastInertiaTiltMovement")):(wa(e,e.enableZoom,e.zoomEventTypes,rk,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&wa(e,e.enableRotate,e.translateEventTypes,sk,e.inertiaSpin,"_lastInertiaSpinMovement"))}const oX=new Un,Cze=new f,Tze=new f;function Op(e,t,n){const i=e._scene,o=e._globe,r=i.camera;if(!l(o))return;const s=!e._cameraUnderground;let a;i.pickPositionSupported&&(a=i.pickPositionWorldCoordinates(t,Cze));const c=r.getPickRay(t,oX),u=o.pickWorldCoordinates(c,i,s,Tze),d=l(a)?f.distance(a,r.positionWC):Number.POSITIVE_INFINITY,h=l(u)?f.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return d<h?f.clone(a,n):f.clone(u,n)}const Eze=new Ce;function iv(e){const t=e._ellipsoid,n=e._scene,i=n.camera,o=n.mode;let r=0;if(o===le.SCENE3D){const c=t.cartesianToCartographic(i.position,Eze);l(c)&&(r=c.height)}else r=i.position.z;const s=A(e._scene.globeHeight,0);return Math.abs(s-r)}const xze=new f;function rX(e,t){const n=t.origin,i=t.direction,o=iv(e),r=f.normalize(n,xze);let s=Math.abs(f.dot(r,i));return s=Math.max(s,.5)*2,o*s}function sX(e,t,n,i){let o=f.distance(t.origin,n);const r=iv(e),s=M.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),Un.getPoint(t,o,i)}function aX(e,t,n,i){let o;return l(n)?(o=f.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=iv(e))):o=iv(e),Un.getPoint(t,o,i)}const wze=new j;function cX(e,t){const n=t.endPosition,i=j.subtract(t.endPosition,t.startPosition,wze),o=e._strafeEndMousePosition;j.add(o,i,o),t.endPosition=o,b2(e,t,e._strafeStartPosition),t.endPosition=n}const ak=new Un,Sze=new Un,wP=new f,vze=new f,Dze=new f,Ize=new f,Pze=new Pt(f.UNIT_X,0),Oze=new j,Lze=new j;function Bze(e,t,n){if(f.equals(t,e._translateMousePosition)||(e._looking=!1),f.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){mc(e,t,n);return}if(e._strafing){cX(e,n);return}const o=e._scene.camera,r=e._cameraUnderground,s=j.clone(n.startPosition,Oze),a=j.clone(n.endPosition,Lze);let c=o.getPickRay(s,ak);const u=f.clone(f.ZERO,Ize),d=f.UNIT_X;let h;if(o.position.z<e._minimumPickingTerrainHeight&&(h=Op(e,s,wP),l(h)&&(u.x=h.x)),r||u.x>o.position.z&&l(h)){let w=h;r&&(w=aX(e,c,h,wP)),j.clone(t,e._strafeMousePosition),j.clone(t,e._strafeEndMousePosition),f.clone(w,e._strafeStartPosition),e._strafing=!0,b2(e,n,e._strafeStartPosition);return}const m=Pt.fromPointNormal(u,d,Pze);c=o.getPickRay(s,ak);const g=pr.rayPlane(c,m,wP),p=o.getPickRay(a,Sze),y=pr.rayPlane(p,m,vze);if(!l(g)||!l(y)){e._looking=!0,mc(e,t,n),j.clone(t,e._translateMousePosition);return}const b=f.subtract(g,y,Dze),C=b.x;b.x=b.y,b.y=b.z,b.z=C;const E=f.magnitude(b);E>M.EPSILON6&&(f.normalize(b,b),o.move(b,E))}const lX=new j,Jw=new Un,Qw=new f,Rze=new f,uX=new B,Nze=new B,Mze=new f,Fze=new Pt(f.UNIT_X,0),SP=new f,ZB=new Ce,dX=new B,zze=new Te,Uze=new J,Zw=new f;function Hze(e,t,n){if(l(n.angleAndHeight)&&(n=n.angleAndHeight),j.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){mc(e,t,n);return}const o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,Vze(e,t,n)):kze(e,t,n)}function Vze(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=lX;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,Jw),c=f.UNIT_X,u=a.origin,d=a.direction;let h;const m=f.dot(c,d);if(Math.abs(m)>M.EPSILON6&&(h=-f.dot(c,u)/m),!l(h)||h<=0){e._looking=!0,mc(e,t,n),j.clone(t,e._tiltCenterMousePosition);return}const g=f.multiplyByScalar(d,h,Qw);f.add(u,g,g);const p=i.mapProjection,y=p.ellipsoid;f.fromElements(g.y,g.z,g.x,g);const b=p.unproject(g,ZB);y.cartographicToCartesian(b,g);const C=cn.eastNorthUpToFixedFrame(g,y,uX),E=e._globe,w=e._ellipsoid;e._globe=void 0,e._ellipsoid=me.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const S=B.clone(o.transform,dX);o._setTransform(C),pc(e,t,n,f.UNIT_Z),o._setTransform(S),e._globe=E,e._ellipsoid=w;const P=w.maximumRadius;e._rotateFactor=1/P,e._rotateRateRangeAdjustment=P}function kze(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const c=f.UNIT_X;if(j.equals(t,e._tiltCenterMousePosition))s=f.clone(e._tiltCenter,Qw);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=Op(e,t,Qw)),!l(s)){a=o.getPickRay(t,Jw);const D=a.origin,I=a.direction;let _;const v=f.dot(c,I);if(Math.abs(v)>M.EPSILON6&&(_=-f.dot(c,D)/v),!l(_)||_<=0){e._looking=!0,mc(e,t,n),j.clone(t,e._tiltCenterMousePosition);return}s=f.multiplyByScalar(I,_,Qw),f.add(D,s,s)}r&&(l(a)||(a=o.getPickRay(t,Jw)),sX(e,a,s,s)),j.clone(t,e._tiltCenterMousePosition),f.clone(s,e._tiltCenter)}const u=i.canvas,d=lX;d.x=u.clientWidth/2,d.y=e._tiltCenterMousePosition.y,a=o.getPickRay(d,Jw);const h=f.clone(f.ZERO,Mze);h.x=s.x;const m=Pt.fromPointNormal(h,c,Fze),g=pr.rayPlane(a,m,Rze),p=o._projection,y=p.ellipsoid;f.fromElements(s.y,s.z,s.x,s);let b=p.unproject(s,ZB);y.cartographicToCartesian(b,s);const C=cn.eastNorthUpToFixedFrame(s,y,uX);let E;l(g)?(f.fromElements(g.y,g.z,g.x,g),b=p.unproject(g,ZB),y.cartographicToCartesian(b,g),E=cn.eastNorthUpToFixedFrame(g,y,Nze)):E=C;const w=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=me.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=f.UNIT_Z;const L=B.clone(o.transform,dX);o._setTransform(C);const z=f.cross(f.UNIT_Z,f.normalize(o.position,SP),SP),R=f.dot(o.right,z);if(pc(e,t,n,P,!1,!0),o._setTransform(E),R<0){const D=n.startPosition.y-n.endPosition.y;(r&&D<0||!r&&D>0)&&(P=void 0);const I=o.constrainedAxis;o.constrainedAxis=void 0,pc(e,t,n,P,!0,!1),o.constrainedAxis=I}else pc(e,t,n,P,!0,!1);if(l(o.constrainedAxis)){const D=f.cross(o.direction,o.constrainedAxis,Zw);f.equalsEpsilon(D,f.ZERO,M.EPSILON6)||(f.dot(D,o.right)<0&&f.negate(D,D),f.cross(D,o.direction,o.up),f.cross(o.direction,o.up,o.right),f.normalize(o.up,o.up),f.normalize(o.right,o.right))}o._setTransform(L),e._globe=w,e._ellipsoid=S;const F=S.maximumRadius;e._rotateFactor=1/F,e._rotateRateRangeAdjustment=F;const U=f.clone(o.positionWC,SP);if(e.enableCollisionDetection&&E2(e),!f.equals(o.positionWC,U)){o._setTransform(E),o.worldToCameraCoordinatesPoint(U,U);const D=f.magnitudeSquared(U);f.magnitudeSquared(o.position)>D&&(f.normalize(o.position,o.position),f.multiplyByScalar(o.position,Math.sqrt(D),o.position));const I=f.angleBetween(U,o.position),_=f.cross(U,o.position,U);f.normalize(_,_);const v=Te.fromAxisAngle(_,I,zze),O=J.fromQuaternion(v,Uze);J.multiplyByVector(O,o.direction,o.direction),J.multiplyByVector(O,o.up,o.up),f.cross(o.direction,o.up,o.right),f.cross(o.right,o.direction,o.up),o._setTransform(L)}}const fX=new j,hX=new Un,pX=new f;function Gze(e,t,n){l(n.distance)&&(n=n.distance);const i=e._scene,o=i.camera,r=i.canvas,s=e._cameraUnderground;let a;s?a=t:(a=fX,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const c=o.getPickRay(a,hX),u=c.origin,d=c.direction,h=o.position.z;let m;h<e._minimumPickingTerrainHeight&&(m=Op(e,a,pX));let g;if(l(m)&&(g=f.distance(u,m)),s){const p=rX(e,c);l(g)?g=Math.min(g,p):g=p}if(!l(g)){const p=f.UNIT_X;g=-f.dot(p,u)/f.dot(p,d)}A2(e,t,n,e._zoomFactor,g)}function Wze(e){const n=e._scene.camera;if(!B.equals(B.IDENTITY,n.transform))wa(e,e.enableRotate,e.rotateEventTypes,pc,e.inertiaSpin,"_lastInertiaSpinMovement"),wa(e,e.enableZoom,e.zoomEventTypes,mX,e.inertiaZoom,"_lastInertiaZoomMovement");else{const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),wa(e,e.enableTilt,e.tiltEventTypes,Hze,e.inertiaSpin,"_lastInertiaTiltMovement"),wa(e,e.enableTranslate,e.translateEventTypes,Bze,e.inertiaTranslate,"_lastInertiaTranslateMovement"),wa(e,e.enableZoom,e.zoomEventTypes,Gze,e.inertiaZoom,"_lastInertiaZoomMovement"),wa(e,e.enableLook,e.lookEventTypes,mc),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const o=n.createCorrectPositionTween(e.bounceAnimationTime);l(o)&&(e._tween=i.add(o))}i.update()}}const jze=new Un,qze=new Pt(f.UNIT_X,0),$ze=new f,Yze=new f,Xze=new f;function b2(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,jze);let s=f.clone(o.direction,Yze);i.mode===le.COLUMBUS_VIEW&&f.fromElements(s.z,s.x,s.y,s);const a=Pt.fromPointNormal(n,s,qze),c=pr.rayPlane(r,a,$ze);l(c)&&(s=f.subtract(n,c,s),i.mode===le.COLUMBUS_VIEW&&f.fromElements(s.y,s.z,s.x,s),f.add(o.position,s,o.position))}const ck=new f,Kze=new Ce,eR=new f,tR=new me,Jze=new f,Qze=new f;function Zze(e,t,n){const o=e._scene.camera,r=e._cameraUnderground;let s=e._ellipsoid;if(!B.equals(o.transform,B.IDENTITY)){pc(e,t,n);return}let a,c;const u=s.geodeticSurfaceNormal(o.position,Jze);if(j.equals(t,e._rotateMousePosition)){if(e._looking)mc(e,t,n,u);else if(e._rotating)pc(e,t,n);else if(e._strafing)cX(e,n);else{if(f.magnitude(o.position)<f.magnitude(e._rotateStartPosition))return;a=f.magnitude(e._rotateStartPosition),c=eR,c.x=c.y=c.z=a,s=me.fromCartesian3(c,tR),DP(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const d=s.cartesianToCartographic(o.positionWC,Kze).height,h=e._globe;if(l(h)&&d<e._minimumPickingTerrainHeight){const m=Op(e,n.startPosition,Xze);if(l(m)){let g=!1;const p=o.getPickRay(n.startPosition,oX);if(r)g=!0,aX(e,p,m,m);else{const y=s.geodeticSurfaceNormal(m,Qze);Math.abs(f.dot(p.direction,y))<.05?g=!0:g=f.magnitude(o.position)<f.magnitude(m)}g?(j.clone(t,e._strafeEndMousePosition),f.clone(m,e._strafeStartPosition),e._strafing=!0,b2(e,n,e._strafeStartPosition)):(a=f.magnitude(m),c=eR,c.x=c.y=c.z=a,s=me.fromCartesian3(c,tR),DP(e,t,n,s),f.clone(m,e._rotateStartPosition))}else e._looking=!0,mc(e,t,n,u)}else l(o.pickEllipsoid(n.startPosition,e._ellipsoid,ck))?(DP(e,t,n,e._ellipsoid),f.clone(ck,e._rotateStartPosition)):d>e._minimumTrackBallHeight?(e._rotating=!0,pc(e,t,n)):(e._looking=!0,mc(e,t,n,u));j.clone(t,e._rotateMousePosition)}function pc(e,t,n,i,o,r){o=A(o,!1),r=A(r,!1);const s=e._scene,a=s.camera,c=s.canvas,u=a.constrainedAxis;l(i)&&(a.constrainedAxis=i);const d=f.magnitude(a.position);let h=e._rotateFactor*(d-e._rotateRateRangeAdjustment);h>e._maximumRotateRate&&(h=e._maximumRotateRate),h<e._minimumRotateRate&&(h=e._minimumRotateRate);let m=(n.startPosition.x-n.endPosition.x)/c.clientWidth,g=(n.startPosition.y-n.endPosition.y)/c.clientHeight;m=Math.min(m,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);const p=h*m*Math.PI*2,y=h*g*Math.PI;o||a.rotateRight(p),r||a.rotateUp(y),a.constrainedAxis=u}const eUe=oe.clone(oe.UNIT_W),tUe=oe.clone(oe.UNIT_W),Ix=new f,vP=new f,nUe=new f,iUe=new f,oUe=new j,rUe=new j;function DP(e,t,n,i){const r=e._scene.camera,s=j.clone(n.startPosition,oUe),a=j.clone(n.endPosition,rUe);let c=r.pickEllipsoid(s,i,eUe),u=r.pickEllipsoid(a,i,tUe);if(!l(c)||!l(u)){e._rotating=!0,pc(e,t,n);return}if(c=r.worldToCameraCoordinates(c,c),u=r.worldToCameraCoordinates(u,u),l(r.constrainedAxis)){const d=r.constrainedAxis,h=f.mostOrthogonalAxis(d,Ix);f.cross(h,d,h),f.normalize(h,h);const m=f.cross(d,h,vP),g=f.magnitude(c),p=f.dot(d,c),y=Math.acos(p/g),b=f.multiplyByScalar(d,p,nUe);f.subtract(c,b,b),f.normalize(b,b);const C=f.magnitude(u),E=f.dot(d,u),w=Math.acos(E/C),S=f.multiplyByScalar(d,E,iUe);f.subtract(u,S,S),f.normalize(S,S);let P=Math.acos(f.dot(b,h));f.dot(b,m)<0&&(P=M.TWO_PI-P);let L=Math.acos(f.dot(S,h));f.dot(S,m)<0&&(L=M.TWO_PI-L);const z=P-L;let R;f.equalsEpsilon(d,r.position,M.EPSILON2)?R=r.right:R=f.cross(d,r.position,Ix);const F=f.cross(d,R,Ix),U=f.dot(F,f.subtract(c,d,vP)),D=f.dot(F,f.subtract(u,d,vP));let I;U>0&&D>0?I=w-y:U>0&&D<=0?f.dot(r.position,d)>0?I=-y-w:I=y+w:I=y-w,r.rotateRight(z),r.rotateUp(I)}else{f.normalize(c,c),f.normalize(u,u);const d=f.dot(c,u),h=f.cross(c,u,Ix);if(d<1&&!f.equalsEpsilon(h,f.ZERO,M.EPSILON14)){const m=Math.acos(d);r.rotate(h,m)}}}const sUe=new f,aUe=new Ce;function mX(e,t,n){l(n.distance)&&(n=n.distance);const i=e._ellipsoid,o=e._scene,r=o.camera,s=o.canvas,a=e._cameraUnderground;let c;a?c=t:(c=fX,c.x=s.clientWidth/2,c.y=s.clientHeight/2);const u=r.getPickRay(c,hX);let d;const h=i.cartesianToCartographic(r.position,aUe).height;h<e._minimumPickingTerrainHeight&&(d=Op(e,c,pX));let m;if(l(d)&&(m=f.distance(u.origin,d)),a){const p=rX(e,u);l(m)?m=Math.min(m,p):m=p}l(m)||(m=h);const g=f.normalize(r.position,sUe);A2(e,t,n,e._zoomFactor,m,f.dot(g,r.direction))}const _X=new j,eS=new Un,kb=new f,cUe=new f,gX=new B,lUe=new B,yX=new B,uUe=new Te,dUe=new J,C2=new Ce,T2=new f;function fUe(e,t,n){const o=e._scene.camera;if(!B.equals(o.transform,B.IDENTITY))return;if(l(n.angleAndHeight)&&(n=n.angleAndHeight),j.equals(t,e._tiltCenterMousePosition)||(e._tiltOnEllipsoid=!1,e._looking=!1),e._looking){const a=e._ellipsoid.geodeticSurfaceNormal(o.position,T2);mc(e,t,n,a);return}const s=e._ellipsoid.cartesianToCartographic(o.position,C2);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,pUe(e,t,n)):mUe(e,t,n)}const hUe=new Ce;function pUe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,hUe).height;if(a-s-1<M.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const c=o.canvas,u=_X;u.x=c.clientWidth/2,u.y=c.clientHeight/2;const d=r.getPickRay(u,eS);let h;const m=pr.rayEllipsoid(d,i);if(l(m))h=Un.getPoint(d,m.start,kb);else if(a>e._minimumTrackBallHeight){const E=pr.grazingAltitudeLocation(d,i);if(!l(E))return;const w=i.cartesianToCartographic(E,C2);w.height=0,h=i.cartographicToCartesian(w,kb)}else{e._looking=!0;const E=e._ellipsoid.geodeticSurfaceNormal(r.position,T2);mc(e,t,n,E),j.clone(t,e._tiltCenterMousePosition);return}const g=cn.eastNorthUpToFixedFrame(h,i,gX),p=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=me.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const b=B.clone(r.transform,yX);r._setTransform(g),pc(e,t,n,f.UNIT_Z),r._setTransform(b),e._globe=p,e._ellipsoid=y;const C=y.maximumRadius;e._rotateFactor=1/C,e._rotateRateRangeAdjustment=C}function mUe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e._cameraUnderground;let a,c,u;if(j.equals(t,e._tiltCenterMousePosition))a=f.clone(e._tiltCenter,kb);else{if(a=Op(e,t,kb),!l(a)){if(c=r.getPickRay(t,eS),u=pr.rayEllipsoid(c,i),!l(u)){if(i.cartesianToCartographic(r.position,C2).height<=e._minimumTrackBallHeight){e._looking=!0;const I=e._ellipsoid.geodeticSurfaceNormal(r.position,T2);mc(e,t,n,I),j.clone(t,e._tiltCenterMousePosition)}return}a=Un.getPoint(c,u.start,kb)}s&&(l(c)||(c=r.getPickRay(t,eS)),sX(e,c,a,a)),j.clone(t,e._tiltCenterMousePosition),f.clone(a,e._tiltCenter)}const d=o.canvas,h=_X;h.x=d.clientWidth/2,h.y=e._tiltCenterMousePosition.y,c=r.getPickRay(h,eS);const m=f.magnitude(a),g=f.fromElements(m,m,m,eR),p=me.fromCartesian3(g,tR);if(u=pr.rayEllipsoid(c,p),!l(u))return;const y=f.magnitude(c.origin)>m?u.start:u.stop,b=Un.getPoint(c,y,cUe),C=cn.eastNorthUpToFixedFrame(a,i,gX),E=cn.eastNorthUpToFixedFrame(b,p,lUe),w=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=me.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=f.UNIT_Z;const L=B.clone(r.transform,yX);r._setTransform(E);const z=f.cross(b,r.positionWC,Zw);if(f.dot(r.rightWC,z)<0){const D=n.startPosition.y-n.endPosition.y;(s&&D<0||!s&&D>0)&&(P=void 0);const I=r.constrainedAxis;r.constrainedAxis=void 0,pc(e,t,n,P,!0,!1),r.constrainedAxis=I}else pc(e,t,n,P,!0,!1);if(r._setTransform(C),pc(e,t,n,P,!1,!0),l(r.constrainedAxis)){const D=f.cross(r.direction,r.constrainedAxis,Zw);f.equalsEpsilon(D,f.ZERO,M.EPSILON6)||(f.dot(D,r.right)<0&&f.negate(D,D),f.cross(D,r.direction,r.up),f.cross(r.direction,r.up,r.right),f.normalize(r.up,r.up),f.normalize(r.right,r.right))}r._setTransform(L),e._globe=w,e._ellipsoid=S;const F=S.maximumRadius;e._rotateFactor=1/F,e._rotateRateRangeAdjustment=F;const U=f.clone(r.positionWC,Zw);if(e.enableCollisionDetection&&E2(e),!f.equals(r.positionWC,U)){r._setTransform(E),r.worldToCameraCoordinatesPoint(U,U);const D=f.magnitudeSquared(U);f.magnitudeSquared(r.position)>D&&(f.normalize(r.position,r.position),f.multiplyByScalar(r.position,Math.sqrt(D),r.position));const I=f.angleBetween(U,r.position),_=f.cross(U,r.position,U);f.normalize(_,_);const v=Te.fromAxisAngle(_,I,uUe),O=J.fromQuaternion(v,dUe);J.multiplyByVector(O,r.direction,r.direction),J.multiplyByVector(O,r.up,r.up),f.cross(r.direction,r.up,r.right),f.cross(r.right,r.direction,r.up),r._setTransform(L)}}const _Ue=new j,gUe=new j,lk=new Un,uk=new Un,yUe=new f,AUe=new f;function mc(e,t,n,i){const r=e._scene.camera,s=_Ue;s.x=n.startPosition.x,s.y=0;const a=gUe;a.x=n.endPosition.x,a.y=0;let c=r.getPickRay(s,lk),u=r.getPickRay(a,uk),d=0,h,m;r.frustum instanceof Gt?(h=c.origin,m=u.origin,f.add(r.direction,h,h),f.add(r.direction,m,m),f.subtract(h,r.position,h),f.subtract(m,r.position,m),f.normalize(h,h),f.normalize(m,m)):(h=c.direction,m=u.direction);let g=f.dot(h,m);g<1&&(d=Math.acos(g)),d=n.startPosition.x>n.endPosition.x?-d:d;const p=e._horizontalRotationAxis;if(l(i)?r.look(i,-d):l(p)?r.look(p,-d):r.lookLeft(d),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,c=r.getPickRay(s,lk),u=r.getPickRay(a,uk),d=0,r.frustum instanceof Gt?(h=c.origin,m=u.origin,f.add(r.direction,h,h),f.add(r.direction,m,m),f.subtract(h,r.position,h),f.subtract(m,r.position,m),f.normalize(h,h),f.normalize(m,m)):(h=c.direction,m=u.direction),g=f.dot(h,m),g<1&&(d=Math.acos(g)),d=n.startPosition.y>n.endPosition.y?-d:d,i=A(i,p),l(i)){const y=r.direction,b=f.negate(i,yUe),C=f.equalsEpsilon(y,i,M.EPSILON2),E=f.equalsEpsilon(y,b,M.EPSILON2);if(!C&&!E){g=f.dot(y,i);let w=M.acosClamped(g);d>0&&d>w&&(d=w-M.EPSILON4),g=f.dot(y,b),w=M.acosClamped(g),d<0&&-d>w&&(d=-w+M.EPSILON4);const S=f.cross(i,y,AUe);r.look(S,d)}else(C&&d<0||E&&d>0)&&r.look(r.right,-d)}else r.lookUp(d)}function bUe(e){wa(e,e.enableRotate,e.rotateEventTypes,Zze,e.inertiaSpin,"_lastInertiaSpinMovement"),wa(e,e.enableZoom,e.zoomEventTypes,mX,e.inertiaZoom,"_lastInertiaZoomMovement"),wa(e,e.enableTilt,e.tiltEventTypes,fUe,e.inertiaSpin,"_lastInertiaTiltMovement"),wa(e,e.enableLook,e.lookEventTypes,mc)}const CUe=new B,TUe=new Ce;function E2(e){e._adjustedHeightForTerrain=!0;const t=e._scene,n=t.mode,i=t.globe;if(!l(i)||n===le.SCENE2D||n===le.MORPHING)return;const o=t.camera,r=i.ellipsoid,s=t.mapProjection;let a,c;B.equals(o.transform,B.IDENTITY)||(a=B.clone(o.transform,CUe),c=f.magnitude(o.position),o._setTransform(B.IDENTITY));const u=TUe;n===le.SCENE3D?r.cartesianToCartographic(o.position,u):s.unproject(o.position,u);let d=!1;if(u.height<e._minimumCollisionTerrainHeight){const h=e._scene.globeHeight;if(l(h)){const m=h+e.minimumZoomDistance;u.height<m&&(u.height=m,n===le.SCENE3D?r.cartographicToCartesian(u,o.position):s.project(u,o.position),d=!0)}}l(a)&&(o._setTransform(a),d&&(f.normalize(o.position,o.position),f.negate(o.position,o.direction),f.multiplyByScalar(o.position,Math.max(c,e.minimumZoomDistance),o.position),f.normalize(o.direction,o.direction),f.cross(o.direction,o.up,o.right),f.cross(o.right,o.direction,o.up)))}ST.prototype.onMap=function(){const e=this._scene,t=e.mode,n=e.camera;return t===le.COLUMBUS_VIEW?Math.abs(n.position.x)-this._maxCoord.x<0&&Math.abs(n.position.y)-this._maxCoord.y<0:!0};const EUe=new f,xUe=new f;ST.prototype.update=function(){const e=this._scene,t=e.camera,n=e.globe,i=e.mode;B.equals(t.transform,B.IDENTITY)?(this._globe=n,this._ellipsoid=l(this._globe)?this._globe.ellipsoid:e.mapProjection.ellipsoid):(this._globe=void 0,this._ellipsoid=me.UNIT_SPHERE);const o=l(this._globe)?this._globe.terrainExaggeration:1,r=l(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=fp.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=fp.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=fp.getHeight(this.minimumTrackBallHeight,o,r),this._cameraUnderground=e.cameraUnderground&&l(this._globe);const s=this._ellipsoid.maximumRadius;this._rotateFactor=1/s,this._rotateRateRangeAdjustment=s,this._adjustedHeightForTerrain=!1;const a=f.clone(t.positionWC,EUe),c=f.clone(t.directionWC,xUe);i===le.SCENE2D?bze(this):i===le.COLUMBUS_VIEW?(this._horizontalRotationAxis=f.UNIT_Z,Wze(this)):i===le.SCENE3D&&(this._horizontalRotationAxis=void 0,bUe(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain&&(!f.equals(a,t.positionWC)||!f.equals(c,t.directionWC))&&E2(this),this._aggregator.reset()};ST.prototype.isDestroyed=function(){return!1};ST.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),He(this)};const wUe=`uniform sampler2D colorTexture;
|
||
uniform sampler2D colorTexture2;
|
||
|
||
uniform vec2 center;
|
||
uniform float radius;
|
||
|
||
varying vec2 v_textureCoordinates;
|
||
|
||
void main()
|
||
{
|
||
vec4 color0 = texture2D(colorTexture, v_textureCoordinates);
|
||
vec4 color1 = texture2D(colorTexture2, v_textureCoordinates);
|
||
|
||
float x = length(gl_FragCoord.xy - center) / radius;
|
||
float t = smoothstep(0.5, 0.8, x);
|
||
gl_FragColor = mix(color0 + color1, color1, t);
|
||
}
|
||
`,SUe=`uniform sampler2D colorTexture;
|
||
|
||
uniform float avgLuminance;
|
||
uniform float threshold;
|
||
uniform float offset;
|
||
|
||
varying 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 = texture2D(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;
|
||
gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);
|
||
}
|
||
`;function Xf(){this._sceneFramebuffer=new xd;const e=.125,t=new Array(6);t[0]=new Ri({fragmentShader:I_,textureScale:e,forcePowerOfTwo:!0,sampleMode:P_.LINEAR});const n=t[1]=new Ri({fragmentShader:SUe,uniforms:{avgLuminance:.5,threshold:.25,offset:.1},textureScale:e,forcePowerOfTwo:!0}),i=this;this._delta=1,this._sigma=2,this._blurStep=new j,t[2]=new Ri({fragmentShader:YB,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 Ri({fragmentShader:YB,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 Ri({fragmentShader:I_,sampleMode:P_.LINEAR}),this._uCenter=new j,this._uRadius=void 0,t[5]=new Ri({fragmentShader:wUe,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new ua({stages:t});const o=new Sd(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Xf.prototype.get=function(e){return this._stages.get(e)};Xf.prototype.getStageByName=function(e){const t=this._stages.length;for(let n=0;n<t;++n){const i=this._stages.get(n);if(i.name===e)return i}};const vUe=new oe,dk=new j,DUe=new j,fk=new B;function IUe(e,t,n){const i=t.uniformState,o=i.sunPositionWC,r=i.view,s=i.viewProjection,a=i.projection;let c=B.computeViewportTransformation(n,0,1,fk);const u=B.multiplyByPoint(r,o,vUe);let d=cn.pointToGLWindowCoordinates(s,c,o,dk);u.x+=M.SOLAR_RADIUS;const h=cn.pointToGLWindowCoordinates(a,c,u,u),m=j.magnitude(j.subtract(h,d,h))*30*2,g=DUe;g.x=m,g.y=m,e._uCenter=j.clone(d,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;const p=t.drawingBufferWidth,y=t.drawingBufferHeight,b=e._stages,C=b.get(0),E=C.outputTexture.width,w=C.outputTexture.height,S=new Ye;S.width=E,S.height=w,c=B.computeViewportTransformation(S,0,1,fk),d=cn.pointToGLWindowCoordinates(s,c,o,dk),g.x*=E/p,g.y*=w/y;const P=C.scissorRectangle;P.x=Math.max(d.x-g.x*.5,0),P.y=Math.max(d.y-g.y*.5,0),P.width=Math.min(g.x,p),P.height=Math.min(g.y,y);for(let L=1;L<4;++L)Ye.clone(P,b.get(L).scissorRectangle)}Xf.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};Xf.prototype.update=function(e){const t=e.context,n=e.viewport,i=this._sceneFramebuffer;i.update(t,n);const o=i.framebuffer;return this._textureCache.update(t),this._stages.update(t,!1),IUe(this,t,n),o};Xf.prototype.execute=function(e){const 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)};Xf.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(I_,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Xf.prototype.isDestroyed=function(){return!1};Xf.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),He(this)};function AX(){this._cachedShowFrustumsShaders={}}function PUe(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function OUe(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(d){d=We.replaceMain(d,"czm_Debug_main");const h=/gl_FragData\[(\d+)\]/g;let m;for(;(m=h.exec(d))!==null;)r.indexOf(m[1])===-1&&r.push(m[1]);return d});const s=r.length;let 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+=` gl_FragData[${r[c]}].rgb *= debugShowCommandsColor;
|
||
`,a+=` gl_FragData[${r[c]}].rgb *= debugShowFrustumsColor;
|
||
`;else a+=` gl_FragColor.rgb *= debugShowCommandsColor;
|
||
`,a+=` gl_FragColor.rgb *= debugShowFrustumsColor;
|
||
`;a+="}",o.sources.push(a);const u=PUe(i);return Cn.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}const DA=new H;function LUe(e,t){let n;return l(t.uniformMap)?n=t.uniformMap:n={},l(n.debugShowCommandsColor)||l(n.debugShowFrustumsColor)||(n.debugShowCommandsColor=function(){return e.debugShowCommands?(l(t._debugColor)||(t._debugColor=H.fromRandom()),t._debugColor):H.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(DA.red=t.debugOverlappingFrustums&1<<0?1:0,DA.green=t.debugOverlappingFrustums&1<<1?1:0,DA.blue=t.debugOverlappingFrustums&1<<2?1:0,DA.alpha=1,DA):H.WHITE}),n}const BUe=new mt;AX.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];l(o)||(o=OUe(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=mt.shallowClone(t,BUe);r.shaderProgram=o,r.uniformMap=LUe(e,t),r.execute(e.context,n)};const ov=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function xi(e){e=A(e,A.EMPTY_OBJECT);const t=e.canvas;let n=e.creditContainer,i=e.creditViewport;const o=ht(e.contextOptions);if(!l(t))throw new x("options and options.canvas are required.");const r=l(n),s=new Ja(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)),l(i)||(i=t.parentNode),this._id=Ms(),this._jobScheduler=new hp,this._frameState=new gNe(s,new Vo(n," • ",i),this._jobScheduler),this._frameState.scene3DOnly=A(e.scene3DOnly,!1),this._removeCreditContainer=!r,this._creditContainer=n,this._canvas=t,this._context=s,this._computeEngine=new oD(s),this._globe=void 0,this._globeTranslucencyState=new og,this._primitives=new qo,this._groundPrimitives=new qo,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new Sl,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=A(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new CT(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new co({color:new H,stencil:0,owner:this}),this._depthClearCommand=new co({depth:1,owner:this}),this._stencilClearCommand=new co({stencil:0}),this._classificationStencilClearCommand=new co({stencil:0,renderState:et.fromCache({stencilMask:Rt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new lg(this),this._preUpdate=new Ke,this._postUpdate=new Ke,this._renderError=new Ke,this._preRender=new Ke,this._postRender=new Ke,this._minimumDisableDepthTestDistance=0,this._debugInspector=new AX,this._msaaSamples=A(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new Ke,this.morphComplete=new Ke,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=H.clone(H.BLACK),this._mode=le.SCENE3D,this._mapProjection=l(e.mapProjection)?e.mapProjection:new nr,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 aY,this._shadowMapCamera=new ct(this),this.shadowMap=new Bc({context:s,lightCamera:this._shadowMapCamera,enabled:A(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=H.clone(H.WHITE),this._actualInvertClassificationColor=H.clone(this._invertClassificationColor),this._invertClassification=new wu,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new Na,this._brdfLutGenerator=new AT,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new ST(this),this._cameraUnderground=!1,this._mapMode2D=A(e.mapMode2D,Ip.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=A(e.requestRenderMode,!1),this._renderRequested=!0,this.maximumRenderTimeChange=A(e.maximumRenderTimeChange,0),this._lastRenderTime=void 0,this._frameRateMonitor=void 0,this._removeRequestListenerCallback=bi.requestCompletedEvent.addEventListener(ov(this)),this._removeTaskProcessorListenerCallback=Vi.taskCompletedEvent.addEventListener(ov(this)),this._removeGlobeCallbacks=[];const a=new Ye(0,0,s.drawingBufferWidth,s.drawingBufferHeight),c=new ct(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new ct(this),this.preloadFlightCullingVolume=void 0,this._picking=new zs(this),this._defaultView=new xT(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 aD,bX(this,0,ie.now()),this.updateFrameState(),this.initializeFrame()}function RUe(e,t){for(let i=0;i<e._removeGlobeCallbacks.length;++i)e._removeGlobeCallbacks[i]();e._removeGlobeCallbacks.length=0;const n=[];l(t)&&(n.push(t.imageryLayersUpdatedEvent.addEventListener(ov(e))),n.push(t.terrainProviderChanged.addEventListener(ov(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 It.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return It.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 hu.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,RUe(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(l(this.globe))return this.globe.imageryLayers}},terrainProvider:{get:function(){if(l(this.globe))return this.globe.terrainProvider},set:function(e){l(this.globe)&&(this.globe.terrainProvider=e)}},terrainProviderChanged:{get:function(){if(l(this.globe))return this.globe.terrainProviderChanged}},preUpdate:{get:function(){return this._preUpdate}},postUpdate:{get:function(){return this._postUpdate}},renderError:{get:function(){return this._renderError}},preRender:{get:function(){return this._preRender}},postRender:{get:function(){return this._postRender}},lastRenderTime:{get:function(){return this._lastRenderTime}},context:{get:function(){return this._context}},debugFrustumStatistics:{get:function(){return this._view.debugFrustumStatistics}},scene3DOnly:{get:function(){return this._frameState.scene3DOnly}},orderIndependentTranslucency:{get:function(){return this._useOIT}},id:{get:function(){return this._id}},mode:{get:function(){return this._mode},set:function(e){if(this.scene3DOnly&&e!==le.SCENE3D)throw new x("Only SceneMode.SCENE3D is valid when scene3DOnly is true.");if(e===le.SCENE2D)this.morphTo2D(0);else if(e===le.SCENE3D)this.morphTo3D(0);else if(e===le.COLUMBUS_VIEW)this.morphToColumbusView(0);else throw new x("value must be a valid SceneMode enumeration.");this._mode=e}},frustumCommandsList:{get:function(){return this._view.frustumCommandsList}},numberOfFrustums:{get:function(){return this._view.frustumCommandsList.length}},useWebVR:{get:function(){return this._useWebVR},set:function(e){if(this.camera.frustum instanceof Gt)throw new x("VR is unsupported with an orthographic projection.");this._useWebVR=e,this._useWebVR?(this._frameState.creditDisplay.container.style.visibility="hidden",this._cameraVR=new ct(this),l(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new xD(this)),this._aspectRatioVR=this.camera.frustum.aspectRatio):(this._frameState.creditDisplay.container.style.visibility="visible",this._cameraVR=void 0,this._deviceOrientationCameraController=this._deviceOrientationCameraController&&!this._deviceOrientationCameraController.isDestroyed()&&this._deviceOrientationCameraController.destroy(),this.camera.frustum.aspectRatio=this._aspectRatioVR,this.camera.frustum.xOffset=0)}},mapMode2D:{get:function(){return this._mapMode2D}},splitPosition:{get:function(){return this._frameState.splitPosition},set:function(e){this._frameState.splitPosition=e}},minimumDisableDepthTestDistance:{get:function(){return this._minimumDisableDepthTestDistance},set:function(e){if(!l(e)||e<0)throw new x("minimumDisableDepthTestDistance must be greater than or equal to 0.0.");this._minimumDisableDepthTestDistance=e}},logarithmicDepthBuffer:{get:function(){return this._logDepthBuffer},set:function(e){e=this._context.fragmentDepth&&e,this._logDepthBuffer!==e&&(this._logDepthBuffer=e,this._logDepthBufferDirty=!0)}},gamma:{get:function(){return this._context.uniformState.gamma},set:function(e){this._context.uniformState.gamma=e}},highDynamicRange:{get:function(){return this._hdr},set:function(e){const t=this._context,n=e&&t.depthTexture&&(t.colorBufferFloat||t.colorBufferHalfFloat);this._hdrDirty=n!==this._hdr,this._hdr=n}},highDynamicRangeSupported:{get:function(){const 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,It.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){const 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 hk(e,t,n){const i=e._frameState,o=e._context,r=e._view.oit,s=i.shadowState.lightShadowMaps,a=i.shadowState.lightShadowsEnabled;let c=t.derivedCommands;l(t.pickId)&&(c.picking=gf.createPickDerivedCommand(e,t,o,c.picking)),t.pickOnly||(c.depth=gf.createDepthOnlyDerivedCommand(e,t,o,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=gf.createHdrCommand(t,o,c.hdr),t=c.hdr.command,c=t.derivedCommands),a&&t.receiveShadows&&(c.shadows=Bc.createReceiveDerivedCommand(s,t,n,o,c.shadows)),t.pass===Ne.TRANSLUCENT&&l(r)&&r.isSupported()&&(a&&t.receiveShadows?(c.oit=l(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(!l(e.derivedCommands))return;const t=this._frameState,n=this._context;let i=!1;const o=t.shadowState.lastDirtyTime;e.lastDirtyTime!==o&&(e.lastDirtyTime=o,e.dirty=!0,i=!0);const r=t.useLogDepth,s=this._hdr,a=e.derivedCommands,c=l(a.logDepth),u=l(a.hdr),d=l(a.originalCommand),h=r&&!c,m=s&&!u,g=(!r||!s)&&!d;if(e.dirty=e.dirty||h||m||g,e.dirty){e.dirty=!1;const p=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=Bc.createCastDerivedCommand(p,e,i,n,a.shadows)),(c||h)&&(a.logDepth=gf.createLogDepthCommand(e,n,a.logDepth),hk(this,a.logDepth.command,i)),(d||g)&&hk(this,e,i)}};const NUe=new ig({pass:ra.RENDER}),IP=new ig({pass:ra.PRELOAD}),PP=new ig({pass:ra.PRELOAD_FLIGHT}),MUe=new ig({pass:ra.REQUEST_RENDER_MODE_DEFER_CHECK}),pk=new fe;let OP;function FUe(e){const t=e.globe;if(e._mode===le.SCENE3D&&l(t)&&t.show&&!e._cameraUnderground&&!e._globeTranslucencyState.translucent){const n=t.ellipsoid,i=e.frameState.minimumTerrainHeight;return pk.radius=n.minimumRadius+i,OP=oa.fromBoundingSphere(pk,e.camera.positionWC,OP),OP}}xi.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function bX(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=ie.clone(n,i.time)}xi.prototype.updateFrameState=function(){const 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=FUe(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof Gt||this.camera.frustum instanceof Wo),t.light=this.light,t.cameraUnderground=this._cameraUnderground,t.globeTranslucencyState=this._globeTranslucencyState,l(this.globe)&&(t.terrainExaggeration=this.globe.terrainExaggeration,t.terrainExaggerationRelativeHeight=this.globe.terrainExaggerationRelativeHeight),l(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=H.clone(this.invertClassificationColor,this._actualInvertClassificationColor),wu.isTranslucencySupported(this._context)||(this._actualInvertClassificationColor.alpha=1),t.invertClassificationColor=this._actualInvertClassificationColor,l(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 l(e)&&(!l(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==xn.OUTSIDE&&(!l(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let tS=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);tS=B.inverseTransformation(tS,tS);function zUe(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;l(t._debugVolume)&&t._debugVolume.destroy();let a,c=f.clone(s.center);if(o.mode!==le.SCENE3D){c=B.multiplyByPoint(tS,c,c);const m=o.mapProjection,g=m.unproject(c);c=m.ellipsoid.cartographicToCartesian(g)}if(l(s.radius)){const m=s.radius;a=Yi.toWireframe(hc.createGeometry(new hc({radii:new f(m,m,m),vertexFormat:wn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Jt({geometryInstances:new ln({geometry:a,modelMatrix:B.fromTranslation(c),attributes:{color:new pn(1,0,0,1)}}),appearance:new wn({flat:!0,translucent:!1}),asynchronous:!1})}else{const m=s.halfAxes;a=Yi.toWireframe(qr.createGeometry(qr.fromDimensions({dimensions:new f(2,2,2),vertexFormat:wn.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Jt({geometryInstances:new ln({geometry:a,modelMatrix:B.fromRotationTranslation(m,c,new B),attributes:{color:new pn(1,0,0,1)}}),appearance:new wn({flat:!0,translucent:!1}),asynchronous:!1})}const u=o.commandList,d=o.commandList=[];t._debugVolume.update(o),e=d[0],o.useLogDepth&&(e=gf.createLogDepthCommand(e,r).command);let h;l(i)&&(h=n.framebuffer,n.framebuffer=i),e.execute(r,n),l(h)&&(n.framebuffer=h),o.commandList=u}function xs(e,t,n,i,o){const r=t._frameState;if(l(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof co){e.execute(n,i);return}e.debugShowBoundingVolume&&l(e.boundingVolume)&&zUe(e,t,i,o),r.useLogDepth&&l(e.derivedCommands.logDepth)&&(e=e.derivedCommands.logDepth.command);const s=r.passes;if(!s.pick&&!s.depth&&t._hdr&&l(e.derivedCommands)&&l(e.derivedCommands.hdr)&&(e=e.derivedCommands.hdr.command),s.pick||s.depth){if(s.pick&&!s.depth&&l(e.derivedCommands.picking)){e=e.derivedCommands.picking.pickCommand,e.execute(n,i);return}else if(l(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&&l(e.derivedCommands.shadows)?e.derivedCommands.shadows.receiveCommand.execute(n,i):e.execute(n,i)}function IA(e,t,n,i){const o=t._frameState;let r=e.derivedCommands;l(r)&&(o.useLogDepth&&l(r.logDepth)&&(e=r.logDepth.command),r=e.derivedCommands,l(r.picking)?(e=r.picking.pickCommand,e.execute(n,i)):l(r.depth)&&(e=r.depth.depthOnlyCommand,e.execute(n,i)))}function CX(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function UUe(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+M.EPSILON12}function HUe(e,t,n,i,o){const r=e.context;$M(i,CX,e.camera.positionWC),l(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function VUe(e,t,n,i,o){const r=e.context;$M(i,UUe,e.camera.positionWC),l(o)&&t(o.unclassifiedCommand,e,r,n);const s=i.length;for(let a=0;a<s;++a)t(i[a],e,r,n)}function kUe(e,t,n,i){const o=e.context;$M(i,CX,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}const GUe=new Yn,WUe=new ca,jUe=new Gt,qUe=new Wo;function nR(e,t){const n=e.camera,i=e.context,o=e.frameState,r=i.uniformState;r.updateCamera(n);let s;l(n.frustum.fov)?s=n.frustum.clone(GUe):l(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(WUe):l(n.frustum.width)?s=n.frustum.clone(jUe):s=n.frustum.clone(qUe),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(Ne.ENVIRONMENT);const a=o.passes,c=a.pick,u=e._environmentState,d=e._view,h=u.renderTranslucentDepthForPick,m=u.useWebVR;if(!c){const I=u.skyBoxCommand;if(l(I)&&xs(I,e,i,t),u.isSkyAtmosphereVisible&&xs(u.skyAtmosphereCommand,e,i,t),u.isSunVisible&&(u.sunDrawCommand.execute(i,t),e.sunBloom&&!m)){let _;u.useGlobeDepthFramebuffer?_=d.globeDepth.framebuffer:u.usePostProcess?_=d.sceneFramebuffer.framebuffer:_=u.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,_),t.framebuffer=_}u.isMoonVisible&&u.moonCommand.execute(i,t)}let g;u.useOIT?(l(e._executeOITFunction)||(e._executeOITFunction=function(I,_,v,O,N){d.globeDepth.prepareColorTextures(i),d.oit.executeCommands(I,_,v,O,N)}),g=e._executeOITFunction):a.render?g=HUe:g=VUe;const p=d.frustumCommandsList,y=p.length,b=u.clearGlobeDepth,C=u.useDepthPlane,E=e._globeTranslucencyState,w=E.translucent,S=e._view.globeTranslucencyFramebuffer,P=e._depthClearCommand,L=e._stencilClearCommand,z=e._classificationStencilClearCommand,R=e._depthPlane,F=u.usePostProcessSelected,U=n.position.z;let D;for(let I=0;I<y;++I){const _=y-I-1,v=p[_];e.mode===le.SCENE2D?(n.position.z=U-v.near+1,s.far=Math.max(1,v.far-v.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=_!==0?v.near*e.opaqueFrustumNearOffset:v.near,s.far=v.far,r.updateFrustum(s)),P.execute(i,t),i.stencilBuffer&&L.execute(i,t),r.updatePass(Ne.GLOBE);let O=v.commands[Ne.GLOBE],N=v.indices[Ne.GLOBE];if(w)E.executeGlobeCommands(v,xs,S,e,t);else for(D=0;D<N;++D)xs(O[D],e,i,t);const V=d.globeDepth;if(l(V)&&u.useGlobeDepthFramebuffer&&V.executeCopyDepth(i,t),!u.renderTranslucentDepthForPick)if(r.updatePass(Ne.TERRAIN_CLASSIFICATION),O=v.commands[Ne.TERRAIN_CLASSIFICATION],N=v.indices[Ne.TERRAIN_CLASSIFICATION],w)E.executeGlobeClassificationCommands(v,xs,S,e,t);else for(D=0;D<N;++D)xs(O[D],e,i,t);if(b&&(P.execute(i,t),C&&R.execute(i,t)),!u.useInvertClassification||c||u.renderTranslucentDepthForPick){for(r.updatePass(Ne.CESIUM_3D_TILE),O=v.commands[Ne.CESIUM_3D_TILE],N=v.indices[Ne.CESIUM_3D_TILE],D=0;D<N;++D)xs(O[D],e,i,t);if(N>0&&(l(V)&&u.useGlobeDepthFramebuffer&&(V.prepareColorTextures(i,b),V.executeUpdateDepth(i,t,b,V.depthStencilTexture)),!u.renderTranslucentDepthForPick))for(r.updatePass(Ne.CESIUM_3D_TILE_CLASSIFICATION),O=v.commands[Ne.CESIUM_3D_TILE_CLASSIFICATION],N=v.indices[Ne.CESIUM_3D_TILE_CLASSIFICATION],D=0;D<N;++D)xs(O[D],e,i,t)}else{e._invertClassification.clear(i,t);const K=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(Ne.CESIUM_3D_TILE),O=v.commands[Ne.CESIUM_3D_TILE],N=v.indices[Ne.CESIUM_3D_TILE],D=0;D<N;++D)xs(O[D],e,i,t);for(l(V)&&u.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),V.executeUpdateDepth(i,t,b,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),O=v.commands[Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],N=v.indices[Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],D=0;D<N;++D)xs(O[D],e,i,t);for(t.framebuffer=K,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),N>0&&i.stencilBuffer&&z.execute(i,t),r.updatePass(Ne.CESIUM_3D_TILE_CLASSIFICATION),O=v.commands[Ne.CESIUM_3D_TILE_CLASSIFICATION],N=v.indices[Ne.CESIUM_3D_TILE_CLASSIFICATION],D=0;D<N;++D)xs(O[D],e,i,t)}for(N>0&&i.stencilBuffer&&L.execute(i,t),r.updatePass(Ne.OPAQUE),O=v.commands[Ne.OPAQUE],N=v.indices[Ne.OPAQUE],D=0;D<N;++D)xs(O[D],e,i,t);_!==0&&e.mode!==le.SCENE2D&&(s.near=v.near,r.updateFrustum(s));let k;if(!c&&u.useInvertClassification&&o.invertClassificationColor.alpha<1&&(k=e._invertClassification),r.updatePass(Ne.TRANSLUCENT),O=v.commands[Ne.TRANSLUCENT],O.length=v.indices[Ne.TRANSLUCENT],g(e,xs,t,O,k),v.indices[Ne.CESIUM_3D_TILE_CLASSIFICATION]>0&&d.translucentTileClassification.isSupported()&&(d.translucentTileClassification.executeTranslucentCommands(e,xs,t,O,V.depthStencilTexture),d.translucentTileClassification.executeClassificationCommands(e,xs,t,v)),i.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||h)){const K=V.depthStencilTexture,q=e._picking.getPickDepth(e,_);q.update(i,K),q.executeCopyDepth(i,t)}if(r.updatePass(Ne.VOXELS),O=v.commands[Ne.VOXELS],N=v.indices[Ne.VOXELS],O.length=N,kUe(e,xs,t,O),c||!F)continue;const W=t.framebuffer;if(t.framebuffer=d.sceneFramebuffer.getIdFramebuffer(),s.near=_!==0?v.near*e.opaqueFrustumNearOffset:v.near,s.far=v.far,r.updateFrustum(s),r.updatePass(Ne.GLOBE),O=v.commands[Ne.GLOBE],N=v.indices[Ne.GLOBE],w)E.executeGlobeCommands(v,IA,S,e,t);else for(D=0;D<N;++D)IA(O[D],e,i,t);for(b&&(P.framebuffer=t.framebuffer,P.execute(i,t),P.framebuffer=void 0),b&&C&&R.execute(i,t),r.updatePass(Ne.CESIUM_3D_TILE),O=v.commands[Ne.CESIUM_3D_TILE],N=v.indices[Ne.CESIUM_3D_TILE],D=0;D<N;++D)IA(O[D],e,i,t);for(r.updatePass(Ne.OPAQUE),O=v.commands[Ne.OPAQUE],N=v.indices[Ne.OPAQUE],D=0;D<N;++D)IA(O[D],e,i,t);for(r.updatePass(Ne.TRANSLUCENT),O=v.commands[Ne.TRANSLUCENT],N=v.indices[Ne.TRANSLUCENT],D=0;D<N;++D)IA(O[D],e,i,t);t.framebuffer=W}}function TX(e){e.context.uniformState.updatePass(Ne.COMPUTE);const n=e._environmentState.sunComputeCommand;l(n)&&n.execute(e._computeEngine);const i=e._computeCommandList,o=i.length;for(let r=0;r<o;++r)i[r].execute(e._computeEngine)}function $Ue(e,t){e.context.uniformState.updatePass(Ne.OVERLAY);const i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function YUe(e,t,n){const i=n.shadowMapCullingVolume,o=n.isPointLight,r=n.passes,s=r.length,a=t.length;for(let c=0;c<a;++c){const u=t[c];if(e.updateDerivedCommands(u),u.castShadows&&(u.pass===Ne.GLOBE||u.pass===Ne.CESIUM_3D_TILE||u.pass===Ne.OPAQUE||u.pass===Ne.TRANSLUCENT)&&e.isVisible(u,i))if(o)for(let d=0;d<s;++d)r[d].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let d=!1;for(let h=s-1;h>=0;--h){const m=r[h].cullingVolume;if(e.isVisible(u,m))r[h].commandList.push(u),d=!0;else if(d)break}}}}function EX(e){const t=e.frameState,n=t.shadowState.shadowMaps,i=n.length;if(!t.shadowState.shadowsEnabled)return;const o=e.context,r=o.uniformState;for(let s=0;s<i;++s){const a=n[s];if(a.outOfView)continue;const c=a.passes,u=c.length;for(let h=0;h<u;++h)c[h].commandList.length=0;const d=e.frameState.commandList;YUe(e,d,a);for(let h=0;h<u;++h){const m=a.passes[h];r.updateCamera(m.camera),a.updatePass(o,h);const g=m.commandList.length;for(let p=0;p<g;++p){const y=m.commandList[p];r.updatePass(y.pass),xs(y.derivedCommands.shadows.castCommands[s],e,o,m.passState)}}}}const XUe=new f;xi.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?KUe(this,e,t):i!==le.SCENE2D||this._mapMode2D===Ip.ROTATE?Hh(!0,this,e,t):(x2(this,e,t),r4e(this,e))};function KUe(e,t,n){const i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;x2(e,t,n),xX(e),i.createPotentiallyVisibleSet(e),TX(e),s||EX(e);const a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;const c=ct.clone(o,e._cameraVR);c.frustum=o.frustum;const u=o.frustum.near,d=u*A(e.focalLength,5),h=A(e.eyeSeparation,d/30),m=f.multiplyByScalar(c.right,h*.5,XUe);o.frustum.aspectRatio=a.width/a.height;const g=.5*h*u/d;f.add(c.position,m,o.position),o.frustum.xOffset=g,nR(e,t),a.x=a.width,f.subtract(c.position,m,o.position),o.frustum.xOffset=-g,nR(e,t),ct.clone(c,o)}const JUe=new Ce(Math.PI,M.PI_OVER_TWO),QUe=new f,ZUe=new f,e4e=new B,t4e=new B,n4e=new f,i4e=new f,o4e=new Ye;function r4e(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=Ye.clone(r,o4e);t.viewport=s;const a=JUe,c=QUe;e.mapProjection.project(a,c);const d=f.clone(o.position,ZUe),h=B.clone(o.transform,t4e),m=o.frustum.clone();o._setTransform(B.IDENTITY);const g=B.computeViewportTransformation(s,0,1,e4e),p=o.frustum.projectionMatrix,y=o.positionWC.y,b=f.fromElements(M.sign(y)*c.x-y,0,-o.positionWC.x,n4e),C=cn.pointToGLWindowCoordinates(p,g,b,i4e);C.x=Math.floor(C.x);const E=s.x,w=s.width;if(y===0||C.x<=E||C.x>=E+w)Hh(!0,e,t);else if(Math.abs(E+w*.5-C.x)<1)s.width=C.x-s.x,o.position.x*=M.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Hh(!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),Hh(!1,e,t);else if(C.x>E+w*.5){s.width=C.x-E;const S=o.frustum.right;o.frustum.right=c.x-y,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Hh(!0,e,t),s.x=C.x,s.width=E+w-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),Hh(!1,e,t)}else{s.x=C.x,s.width=E+w-C.x;const S=o.frustum.left;o.frustum.left=-c.x-y,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Hh(!0,e,t),s.x=E,s.width=C.x-E,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),Hh(!1,e,t)}o._setTransform(h),f.clone(d,o.position),o.frustum=m.clone(),t.viewport=r}function Hh(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),xX(t),r.createPotentiallyVisibleSet(t),e&&(l(i)&&x2(t,n,i),TX(t),s||EX(t)),nR(t,n)}const mk=new ar;xi.prototype.updateEnvironment=function(){const 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!==le.SCENE2D&&t.camera.frustum instanceof Gt||!a.environmentVisible)n.skyAtmosphereCommand=void 0,n.skyBoxCommand=void 0,n.sunDrawCommand=void 0,n.sunComputeCommand=void 0,n.moonCommand=void 0;else{l(r)?(l(s)&&(r.setDynamicAtmosphereColor(s.enableLighting&&s.dynamicAtmosphereLighting,s.dynamicAtmosphereLightingFromSun),n.isReadyForAtmosphere=n.isReadyForAtmosphere||s._surface._tilesToRender.length>0),n.skyAtmosphereCommand=r.update(e,s),l(n.skyAtmosphereCommand)&&this.updateDerivedCommands(n.skyAtmosphereCommand)):n.skyAtmosphereCommand=void 0,n.skyBoxCommand=l(this.skyBox)?this.skyBox.update(e,this._hdr):void 0;const y=l(this.sun)?this.sun.update(e,t.passState,this._hdr):void 0;n.sunDrawCommand=l(y)?y.drawCommand:void 0,n.sunComputeCommand=l(y)?y.computeCommand:void 0,n.moonCommand=l(this.moon)?this.moon.update(e):void 0}const c=n.clearGlobeDepth=l(s)&&s.show&&(!s.depthTestAgainstTerrain||this.mode===le.SCENE2D);(n.useDepthPlane=c&&this.mode===le.SCENE3D&&a.useDepthPlane)&&this._depthPlane.update(e),n.renderTranslucentDepthForPick=!1,n.useWebVR=this._useWebVR&&this.mode!==le.SCENE2D&&!o;const d=e.mode===le.SCENE3D&&!a.sunVisibleThroughGlobe?e.occluder:void 0;let h=e.cullingVolume;const m=mk.planes;for(let y=0;y<5;++y)m[y]=h.planes[y];h=mk,n.isSkyAtmosphereVisible=l(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,h,d),n.isMoonVisible=this.isVisible(n.moonCommand,h,d);const g=this.specularEnvironmentMaps;let p=this._specularEnvironmentMapAtlas;l(g)&&(!l(p)||p.url!==g)?(p=p&&p.destroy(),this._specularEnvironmentMapAtlas=new hu(g)):!l(g)&&l(p)&&(p.destroy(),this._specularEnvironmentMapAtlas=void 0),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function s4e(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new Zh({camera:e.camera,updateOnChange:!1,frustumSplits:t.frustumSplits}):e._debugFrustumPlanes=e._debugFrustumPlanes&&e._debugFrustumPlanes.destroy(),e._debugShowFrustumPlanes=e.debugShowFrustumPlanes),l(e._debugFrustumPlanes)&&e._debugFrustumPlanes.update(t)}function a4e(e){const t=e._frameState,n=t.shadowMaps,i=n.length,o=i>0&&!t.passes.pick&&e.mode===le.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){const 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 xX(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),s4e(e),a4e(e),e._globe&&e._globe.render(t)}function x2(e,t,n){const i=e._context,o=e._frameState,r=e._environmentState,s=e._view,c=e._frameState.passes.pick;l(s.globeDepth)&&(s.globeDepth.picking=c);const u=r.useWebVR;r.originalFramebuffer=t.framebuffer,l(e.sun)&&e.sunBloom!==e._sunBloom?(e.sunBloom&&!u?e._sunPostProcess=new Xf:l(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy()),e._sunBloom=e.sunBloom):!l(e.sun)&&l(e._sunPostProcess)&&(e._sunPostProcess=e._sunPostProcess.destroy(),e._sunBloom=!1);const d=e._clearColorCommand;H.clone(n,d.color),d.execute(i,t);const h=r.useGlobeDepthFramebuffer=l(s.globeDepth);h&&(s.globeDepth.update(i,t,s.viewport,e.msaaSamples,e._hdr,r.clearGlobeDepth),s.globeDepth.clear(i,t,n));const m=s.oit,g=r.useOIT=!c&&l(m)&&m.isSupported();g&&(m.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),m.clear(i,t,n),r.useOIT=m.isSupported());const p=e.postProcessStages;let y=r.usePostProcess=!c&&(e._hdr||p.length>0||p.ambientOcclusion.enabled||p.fxaa.enabled||p.bloom.enabled);if(r.usePostProcessSelected=!1,y&&(s.sceneFramebuffer.update(i,s.viewport,e._hdr,e.msaaSamples),s.sceneFramebuffer.clear(i,t,n),p.update(i,o.useLogDepth,e._hdr),p.clear(i),y=r.usePostProcess=p.ready,r.usePostProcessSelected=y&&p.hasSelected),r.isSunVisible&&e.sunBloom&&!u?(t.framebuffer=e._sunPostProcess.update(t),e._sunPostProcess.clear(i,t,n)):h?t.framebuffer=s.globeDepth.framebuffer:y&&(t.framebuffer=s.sceneFramebuffer.framebuffer),l(t.framebuffer)&&d.execute(i,t),r.useInvertClassification=!c&&l(t.framebuffer)&&e.invertClassification){let C;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(C=s.globeDepth.framebuffer),l(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){const E=e._invertClassification.unclassifiedCommand,w=E.derivedCommands;w.oit=m.createDerivedCommands(E,i,w.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}xi.prototype.resolveFramebuffers=function(e){const t=this._context,n=this._environmentState,i=this._view,o=i.globeDepth;l(o)&&o.prepareColorTextures(t);const r=n.useOIT,s=n.useGlobeDepthFramebuffer,a=n.usePostProcess,c=n.originalFramebuffer,u=s?o.colorFramebufferManager:void 0,d=i.sceneFramebuffer._colorFramebuffer,h=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?d.framebuffer:c,i.oit.execute(t,e));const m=i.translucentTileClassification;if(m.hasTranslucentDepth&&m.isSupported()&&m.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=d;s&&!r&&(g=u);const p=this.postProcessStages,y=g.getColorTexture(0),b=h.getColorTexture(0),C=A(u,d).getDepthStencilTexture();p.execute(t,y,C,b),p.copy(t,c)}!r&&!a&&s&&(e.framebuffer=c,o.executeCopyColor(t,e))};function c4e(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function l4e(e){const t=e._globe,i=e.camera.positionCartographic;if(l(t)&&t.show&&l(i))return t.getHeight(i)}function u4e(e){const t=e.camera,n=e._mode,i=e.globe,o=e._screenSpaceCameraController,r=t.positionCartographic;if(!l(r))return!1;if(!o.onMap()&&r.height<0)return!0;if(!l(i)||!i.show||n===le.SCENE2D||n===le.MORPHING)return!1;const s=e._globeHeight;return l(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=l4e(this),this._cameraUnderground=u4e(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),l(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function d4e(e,t){if(e.debugShowFramesPerSecond){if(!l(e._performanceDisplay)){const n=document.createElement("div");n.className="cesium-performanceDisplay-defaultContainer",e._canvas.parentNode.appendChild(n);const o=new wD({container:n});e._performanceDisplay=o,e._performanceContainer=n}e._performanceDisplay.throttled=e.requestRenderMode,e._performanceDisplay.update(t)}else l(e._performanceDisplay)&&(e._performanceDisplay=e._performanceDisplay&&e._performanceDisplay.destroy(),e._performanceContainer.parentNode.removeChild(e._performanceContainer))}function f4e(e){e._jobScheduler.resetBudgets();const t=e._frameState;e.primitives.prePassesUpdate(t),l(e.globe)&&e.globe.update(t),e._picking.update(),t.creditDisplay.update()}function h4e(e){const t=e._frameState;e.primitives.postPassesUpdate(t),bi.update()}const p4e=new H;function m4e(e){const 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=NUe;let r=A(e.backgroundColor,H.BLACK);e._hdr&&(r=H.clone(r,p4e),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);const s=e.shadowMap;l(s)&&s.enabled&&(!l(e.light)||e.light instanceof aD?f.negate(i.sunDirectionWC,e._shadowMapCamera.direction):f.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;const a=o.viewport;a.x=0,a.y=0,a.width=n.drawingBufferWidth,a.height=n.drawingBufferHeight;const c=o.passState;c.framebuffer=void 0,c.blendingEnabled=void 0,c.scissorTest=void 0,c.viewport=Ye.clone(a,c.viewport),l(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,r),e.resolveFramebuffers(c),c.framebuffer=void 0,$Ue(e,c),l(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function Tm(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function _4e(e){return e._picking.updateMostDetailedRayPicks(e)}xi.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,l(e)||(e=ie.now());const n=this._view.checkForCameraUpdates(this);let i=!this.requestRenderMode||this._renderRequested||n||this._logDepthBufferDirty||this._hdrDirty||this.mode===le.MORPHING;if(!i&&l(this.maximumRenderTimeChange)&&l(this._lastRenderTime)){const o=Math.abs(ie.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=ie.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;const o=M.incrementWrap(t.frameNumber,15e6,1);bX(this,o,e),t.newFrame=!0}Tm(this,f4e),this.primitives.show&&(Tm(this,_4e),Tm(this,g4e),Tm(this,y4e),i||Tm(this,A4e)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),Tm(this,m4e)),d4e(this,i),Tm(this,h4e),c4e(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(It.minimumAliasedLineWidth,Math.min(e,It.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 g4e(e){const t=e._frameState;IP.camera=t.camera,IP.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,IP)}function y4e(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;PP.camera=e.preloadFlightCamera,PP.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,PP)}function A4e(e){e.primitives.updateForPass(e._frameState,MUe)}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 br.wgs84ToWindowCoordinates(this,e,t)};xi.prototype.completeMorph=function(){this._transitioner.completeMorph()};xi.prototype.morphTo2D=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(e,2),this._transitioner.morphTo2D(e,t)};xi.prototype.morphToColumbusView=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(e,2),this._transitioner.morphToColumbusView(e,t)};xi.prototype.morphTo3D=function(e){let t;const n=this.globe;l(n)?t=n.ellipsoid:t=this.mapProjection.ellipsoid,e=A(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(),l(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,He(this)};const Lf={X:0,Y:1,Z:2};Lf.Y_UP_TO_Z_UP=B.fromRotationTranslation(J.fromRotationX(M.PI_OVER_TWO));Lf.Z_UP_TO_Y_UP=B.fromRotationTranslation(J.fromRotationX(-M.PI_OVER_TWO));Lf.X_UP_TO_Z_UP=B.fromRotationTranslation(J.fromRotationY(-M.PI_OVER_TWO));Lf.Z_UP_TO_X_UP=B.fromRotationTranslation(J.fromRotationY(M.PI_OVER_TWO));Lf.X_UP_TO_Y_UP=B.fromRotationTranslation(J.fromRotationZ(M.PI_OVER_TWO));Lf.Y_UP_TO_X_UP=B.fromRotationTranslation(J.fromRotationZ(-M.PI_OVER_TWO));Lf.fromName=function(e){return T.typeOf.string("name",e),Lf[e]};const cs=Object.freeze(Lf);function F0(e){e=A(e,me.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=1.025,n=f.multiplyByScalar(e.radii,t,new f);this._scaleMatrix=B.fromScale(n),this._modelMatrix=new B,this._command=new mt({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new f(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new f(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 f;const i=new f;i.x=e.maximumRadius*t,i.y=e.maximumRadius,i.z=0,this._radiiAndDynamicAtmosphereColor=i;const 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(F0.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});F0.prototype.setDynamicAtmosphereColor=function(e,t){const n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};const LP=new B;F0.prototype.update=function(e,t){if(!this.show)return;const n=e.mode;if(n!==le.SCENE3D&&n!==le.MORPHING||!e.passes.render)return;const i=B.fromRotationTranslation(e.context.uniformState.inverseViewRotation,f.ZERO,LP),o=B.multiplyTransformation(i,cs.Y_UP_TO_Z_UP,LP),r=B.multiply(this._scaleMatrix,o,LP);B.clone(r,this._modelMatrix);const s=e.context,a=b4e(this),c=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||c||!l(t)||!t.show,d=this._command;if(!l(d.vertexArray)){const m=hc.createGeometry(new hc({radii:new f(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Fe.POSITION_ONLY}));d.vertexArray=ho.fromGeometry({context:s,geometry:m,attributeLocations:Yi.createAttributeLocations(m),bufferUsage:nt.STATIC_DRAW}),d.renderState=et.fromCache({cull:{enabled:!0,face:Ho.FRONT},blending:Gi.ALPHA_BLEND,depthMask:!1})}const h=a|u<<2|c<<3;if(h!==this._flags){this._flags=h;const m=[];a&&m.push("COLOR_CORRECT"),u&&m.push("PER_FRAGMENT_ATMOSPHERE"),c&&m.push("GLOBE_TRANSLUCENT");const g=new We({defines:m,sources:[WS,QU,LEe]}),p=new We({defines:m,sources:[WS,QU,OEe]});this._spSkyAtmosphere=Cn.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:p}),d.shaderProgram=this._spSkyAtmosphere}return d};function b4e(e){return!(M.equalsEpsilon(e.hueShift,0,M.EPSILON7)&&M.equalsEpsilon(e.saturationShift,0,M.EPSILON7)&&M.equalsEpsilon(e.brightnessShift,0,M.EPSILON7))}F0.prototype.isDestroyed=function(){return!1};F0.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),He(this)};function BD(e){this.sources=e.sources,this._sources=void 0,this.show=A(e.show,!0),this._command=new mt({modelMatrix:B.clone(B.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}BD.prototype.update=function(e,t){const n=this;if(!this.show||e.mode!==le.SCENE3D&&e.mode!==le.MORPHING||!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const r=this.sources;if(!l(r.positiveX)||!l(r.negativeX)||!l(r.positiveY)||!l(r.negativeY)||!l(r.positiveZ)||!l(r.negativeZ))throw new x("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof r.positiveX!=typeof r.negativeX||typeof r.positiveX!=typeof r.positiveY||typeof r.positiveX!=typeof r.negativeY||typeof r.positiveX!=typeof r.positiveZ||typeof r.positiveX!=typeof r.negativeZ)throw new x("this.sources properties must all be the same type.");typeof r.positiveX=="string"?cEe(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 bu({context:i,source:r}))}const o=this._command;if(!l(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const r=qr.createGeometry(qr.fromDimensions({dimensions:new f(2,2,2),vertexFormat:Fe.POSITION_ONLY})),s=this._attributeLocations=Yi.createAttributeLocations(r);o.vertexArray=ho.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:nt.STATIC_DRAW}),o.renderState=et.fromCache({blending:Gi.ALPHA_BLEND})}if(!l(o.shaderProgram)||this._useHdr!==t){const r=new We({defines:[t?"HDR":""],sources:[BEe]});o.shaderProgram=Cn.fromCache({context:i,vertexShaderSource:REe,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(l(this._cubeMap))return o};BD.prototype.isDestroyed=function(){return!1};BD.prototype.destroy=function(){const 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(),He(this)};function vT(){this.show=!0,this._drawCommand=new mt({primitiveType:Ze.TRIANGLES,boundingVolume:new fe,owner:this}),this._commands={drawCommand:this._drawCommand,computeCommand:void 0},this._boundingVolume=new fe,this._boundingVolume2D=new fe,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;const e=this;this._uniformMap={u_texture:function(){return e._texture},u_size:function(){return e._size}}}Object.defineProperties(vT.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const C4e=new j,T4e=new j,E4e=new oe,PA=new oe;vT.prototype.update=function(e,t,n){if(!this.show)return;const i=e.mode;if(i===le.SCENE2D||i===le.MORPHING||!e.passes.render)return;const o=e.context,r=t.viewport.width,s=t.viewport.height;if(!l(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);const P=n?o.halfFloatingPointTexture?Qe.HALF_FLOAT:Qe.FLOAT:Qe.UNSIGNED_BYTE;this._texture=new Wt({context:o,width:S,height:S,pixelFormat:rt.RGBA,pixelDatatype:P}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const L=this,z={u_radiusTS:function(){return L._radiusTS}};this._commands.computeCommand=new yC({fragmentShaderSource:MEe,outputTexture:this._texture,uniformMap:z,persists:!1,owner:this,postExecute:function(){L._commands.computeCommand=void 0}})}const a=this._drawCommand;if(!l(a.vertexArray)){const S={direction:0},P=new Uint8Array(4*2);P[0]=0,P[1]=0,P[2]=255,P[3]=0,P[4]=255,P[5]=255,P[6]=0,P[7]=255;const L=Tt.createVertexBuffer({context:o,typedArray:P,usage:nt.STATIC_DRAW}),z=[{index:S.direction,vertexBuffer:L,componentsPerAttribute:2,normalize:!0,componentDatatype:ee.UNSIGNED_BYTE}],R=Tt.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT});a.vertexArray=new ho({context:o,attributes:z,indexBuffer:R}),a.shaderProgram=Cn.fromCache({context:o,vertexShaderSource:FEe,fragmentShaderSource:NEe,attributeLocations:S}),a.renderState=et.fromCache({blending:Gi.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const c=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,d=this._boundingVolume,h=this._boundingVolume2D;f.clone(c,d.center),h.center.x=u.z,h.center.y=u.x,h.center.z=u.y,d.radius=M.SOLAR_RADIUS+M.SOLAR_RADIUS*this._glowLengthTS,h.radius=d.radius,i===le.SCENE3D?fe.clone(d,a.boundingVolume):i===le.COLUMBUS_VIEW&&fe.clone(h,a.boundingVolume);const m=br.computeActualWgs84Position(e,c,PA),g=f.magnitude(f.subtract(m,e.camera.position,PA)),p=o.uniformState.projection,y=E4e;y.x=0,y.y=0,y.z=-g,y.w=1;const b=B.multiplyByVector(p,y,PA),C=br.clipToGLWindowCoordinates(t.viewport,b,C4e);y.x=M.SOLAR_RADIUS;const E=B.multiplyByVector(p,y,PA),w=br.clipToGLWindowCoordinates(t.viewport,E,T4e);return this._size=j.magnitude(j.subtract(w,C,PA)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};vT.prototype.isDestroyed=function(){return!1};vT.prototype.destroy=function(){const 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(),He(this)};function Ug(e){return An(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function x4e(e){e._renderLoopRunning=!0;let t=0;function n(i){if(!e.isDestroyed())if(e._useDefaultRenderLoop)try{const o=e._targetFrameRate;if(!l(o))e.resize(),e.render(),requestAnimationFrame(n);else{const 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){const r="An error occurred while rendering. Rendering has stopped.";e.showErrorPanel(r,void 0,o)}}else e._renderLoopRunning=!1}requestAnimationFrame(n)}function wX(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,l(e._scene)&&(e._scene.pixelRatio=t),t}function SX(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=wX(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 vX(e){const t=e._canvas,n=t.width,i=t.height;if(n!==0&&i!==0){const o=e._scene.camera.frustum;l(o.aspectRatio)?o.aspectRatio=n/i:(o.top=o.right*(i/n),o.bottom=-o.top)}}function ug(e,t){if(!l(e))throw new x("container is required.");e=Ar(e),t=A(t,A.EMPTY_OBJECT);const n=document.createElement("div");n.className="cesium-widget",e.appendChild(n);const i=document.createElement("canvas"),o=gn.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=gn.imageRenderingValue()),i.oncontextmenu=function(){return!1},i.onselectstart=function(){return!1};function r(){i!==i.ownerDocument.activeElement&&i.ownerDocument.activeElement.blur()}A(t.blurActiveElementOnCanvasFocus,!0)&&(i.addEventListener("mousedown",r),i.addEventListener("pointerdown",r)),n.appendChild(i);const a=document.createElement("div");a.className="cesium-widget-credits";const c=l(t.creditContainer)?Ar(t.creditContainer):n;c.appendChild(a);const u=l(t.creditViewport)?Ar(t.creditViewport):n,d=A(t.showRenderLoopErrors,!0),h=A(t.useBrowserRecommendedResolution,!0);this._element=n,this._container=e,this._canvas=i,this._canvasClientWidth=0,this._canvasClientHeight=0,this._lastDevicePixelRatio=0,this._creditViewport=u,this._creditContainer=c,this._innerCreditContainer=a,this._canRender=!1,this._renderLoopRunning=!1,this._showRenderLoopErrors=d,this._resolutionScale=1,this._useBrowserRecommendedResolution=h,this._forceResize=!1,this._clock=l(t.clock)?t.clock:new gT,SX(this);try{const m=new xi({canvas:i,contextOptions:t.contextOptions,creditContainer:a,creditViewport:u,mapProjection:t.mapProjection,orderIndependentTranslucency:t.orderIndependentTranslucency,scene3DOnly:A(t.scene3DOnly,!1),shadows:t.shadows,mapMode2D:t.mapMode2D,requestRenderMode:t.requestRenderMode,maximumRenderTimeChange:t.maximumRenderTimeChange,depthPlaneEllipsoidOffset:t.depthPlaneEllipsoidOffset,msaaSamples:t.msaaSamples});this._scene=m,m.camera.constrainedAxis=f.UNIT_Z,wX(this),vX(this);const g=A(m.mapProjection.ellipsoid,me.WGS84);let p=t.globe;l(p)||(p=new Eu(g)),p!==!1&&(m.globe=p,m.globe.shadows=A(t.terrainShadows,Po.RECEIVE_ONLY));let y=t.skyBox;l(y)||(y=new BD({sources:{positiveX:Ug("px"),negativeX:Ug("mx"),positiveY:Ug("py"),negativeY:Ug("my"),positiveZ:Ug("pz"),negativeZ:Ug("mz")}})),y!==!1&&(m.skyBox=y,m.sun=new vT,m.moon=new yT);let b=t.skyAtmosphere;l(b)||(b=new F0(g)),b!==!1&&(m.skyAtmosphere=b);let C=t.globe===!1?!1:t.imageryProvider;l(C)||(C=Hw()),C!==!1&&m.imageryLayers.addImageryProvider(C),l(t.terrainProvider)&&t.globe!==!1&&(m.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new Rc(i),l(t.sceneMode)&&(t.sceneMode===le.SCENE2D&&this._scene.morphTo2D(0),t.sceneMode===le.COLUMBUS_VIEW&&this._scene.morphToColumbusView(0)),this._useDefaultRenderLoop=void 0,this.useDefaultRenderLoop=A(t.useDefaultRenderLoop,!0),this._targetFrameRate=void 0,this.targetFrameRate=t.targetFrameRate;const E=this;this._onRenderError=function(w,S){if(E._useDefaultRenderLoop=!1,E._renderLoopRunning=!1,E._showRenderLoopErrors){const P="An error occurred while rendering. Rendering has stopped.";E.showErrorPanel(P,void 0,S)}},m.renderError.addEventListener(this._onRenderError)}catch(m){if(d){const g="Error constructing CesiumWidget.",p='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,p,m)}throw m}}Object.defineProperties(ug.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){if(e<=0)throw new x("targetFrameRate must be greater than 0, or undefined.");this._targetFrameRate=e}},useDefaultRenderLoop:{get:function(){return this._useDefaultRenderLoop},set:function(e){this._useDefaultRenderLoop!==e&&(this._useDefaultRenderLoop=e,e&&!this._renderLoopRunning&&x4e(this))}},resolutionScale:{get:function(){return this._resolutionScale},set:function(e){if(e<=0)throw new x("resolutionScale must be greater than 0.");this._resolutionScale!==e&&(this._resolutionScale=e,this._forceResize=!0)}},useBrowserRecommendedResolution:{get:function(){return this._useBrowserRecommendedResolution},set:function(e){this._useBrowserRecommendedResolution!==e&&(this._useBrowserRecommendedResolution=e,this._forceResize=!0)}}});ug.prototype.showErrorPanel=function(e,t,n){const i=this._element,o=document.createElement("div");o.className="cesium-widget-errorPanel";const r=document.createElement("div");r.className="cesium-widget-errorPanel-content",o.appendChild(r);const s=document.createElement("div");s.className="cesium-widget-errorPanel-header",s.appendChild(document.createTextNode(e)),r.appendChild(s);const 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(),l(window.addEventListener)&&window.addEventListener("resize",c,!1);const u=l(t),d=l(n);if(u||d){const g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),d){let p=yB(n);u||(typeof n=="string"&&(n=new Error(n)),t=yB({name:n.name,message:n.message}),p=n.stack),typeof console<"u"&&console.error(`${e}
|
||
${t}
|
||
${p}`);const y=document.createElement("div");y.className="cesium-widget-errorPanel-message-details collapsed";const b=document.createElement("span");b.className="cesium-widget-errorPanel-more-details",b.appendChild(document.createTextNode("See more...")),y.appendChild(b),y.onclick=function(C){y.removeChild(b),y.appendChild(document.createTextNode(p)),y.className="cesium-widget-errorPanel-message-details",r.className="cesium-widget-errorPanel-content expanded",y.onclick=void 0},a.appendChild(y)}g.innerHTML=`<p>${t}</p>`}const h=document.createElement("div");h.className="cesium-widget-errorPanel-buttonPanel",r.appendChild(h);const m=document.createElement("button");m.setAttribute("type","button"),m.className="cesium-button",m.appendChild(document.createTextNode("OK")),m.onclick=function(){l(c)&&l(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},h.appendChild(m),i.appendChild(o)};ug.prototype.isDestroyed=function(){return!1};ug.prototype.destroy=function(){l(this._scene)&&(this._scene.renderError.removeEventListener(this._onRenderError),this._scene=this._scene.destroy()),this._container.removeChild(this._element),this._creditContainer.removeChild(this._innerCreditContainer),He(this)};ug.prototype.resize=function(){const e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,SX(this),vX(this),this._scene.requestRender())};ug.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};function $o(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new Ke,this.setValue(e)}Object.defineProperties($o.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});$o.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};$o.prototype.setValue=function(e){const t=this._value;if(t!==e){const n=l(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))}};$o.prototype.equals=function(e){return this===e||e instanceof $o&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};$o.prototype.valueOf=function(){return this._value};$o.prototype.toString=function(){return String(this._value)};function w4e(e,t,n,i,o){return{configurable:i,get:function(){return this[t]},set:function(r){const s=this[t],a=this[n];l(a)&&(a(),this[n]=void 0),r!==void 0&&(!l(r)||!l(r.getValue))&&l(o)&&(r=o(r)),s!==r&&(this[t]=r,this._definitionChanged.raiseEvent(this,e,r,s)),l(r)&&l(r.definitionChanged)&&(this[n]=r.definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this,e,r,r)},this))}}}function S4e(e){return new $o(e)}function ye(e,t,n){return w4e(e,`_${e.toString()}`,`_${e.toString()}Subscription`,A(t,!1),A(n,S4e))}function PC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(PC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),image:ye("image"),scale:ye("scale"),pixelOffset:ye("pixelOffset"),eyeOffset:ye("eyeOffset"),horizontalOrigin:ye("horizontalOrigin"),verticalOrigin:ye("verticalOrigin"),heightReference:ye("heightReference"),color:ye("color"),rotation:ye("rotation"),alignedAxis:ye("alignedAxis"),sizeInMeters:ye("sizeInMeters"),width:ye("width"),height:ye("height"),scaleByDistance:ye("scaleByDistance"),translucencyByDistance:ye("translucencyByDistance"),pixelOffsetScaleByDistance:ye("pixelOffsetScaleByDistance"),imageSubRegion:ye("imageSubRegion"),distanceDisplayCondition:ye("distanceDisplayCondition"),disableDepthTestDistance:ye("disableDepthTestDistance")});PC.prototype.clone=function(e){return l(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 PC(this)};PC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this._show,e.show),this.image=A(this._image,e.image),this.scale=A(this._scale,e.scale),this.pixelOffset=A(this._pixelOffset,e.pixelOffset),this.eyeOffset=A(this._eyeOffset,e.eyeOffset),this.horizontalOrigin=A(this._horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=A(this._verticalOrigin,e.verticalOrigin),this.heightReference=A(this._heightReference,e.heightReference),this.color=A(this._color,e.color),this.rotation=A(this._rotation,e.rotation),this.alignedAxis=A(this._alignedAxis,e.alignedAxis),this.sizeInMeters=A(this._sizeInMeters,e.sizeInMeters),this.width=A(this._width,e.width),this.height=A(this._height,e.height),this.scaleByDistance=A(this._scaleByDistance,e.scaleByDistance),this.translucencyByDistance=A(this._translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=A(this._pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.imageSubRegion=A(this._imageSubRegion,e.imageSubRegion),this.distanceDisplayCondition=A(this._distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this._disableDepthTestDistance,e.disableDepthTestDistance)};function jt(e,t){e=A(e,0),this._near=e,t=A(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(jt.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}}});jt.packedLength=2;jt.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),t[n++]=e.near,t[n]=e.far,t};jt.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new jt),n.near=e[t++],n.far=e[t],n};jt.equals=function(e,t){return e===t||l(e)&&l(t)&&e.near===t.near&&e.far===t.far};jt.clone=function(e,t){if(l(e))return l(t)||(t=new jt),t.near=e.near,t.far=e.far,t};jt.prototype.clone=function(e){return jt.clone(this,e)};jt.prototype.equals=function(e){return jt.equals(this,e)};const v4e={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},St=Object.freeze(v4e),D4e={CENTER:0,LEFT:1,RIGHT:-1},La=Object.freeze(D4e),I4e={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},Hi=Object.freeze(I4e),P4e={DONE:0,PENDING:1,FAILED:2},gt=Object.freeze(P4e);function Z(){x.throwInstantiationError()}Object.defineProperties(Z.prototype,{isConstant:{get:x.throwInstantiationError},definitionChanged:{get:x.throwInstantiationError}});Z.prototype.getValue=x.throwInstantiationError;Z.prototype.equals=x.throwInstantiationError;Z.equals=function(e,t){return e===t||l(e)&&e.equals(t)};Z.arrayEquals=function(e,t){if(e===t)return!0;if(!l(e)||!l(t)||e.length!==t.length)return!1;const n=e.length;for(let i=0;i<n;i++)if(!Z.equals(e[i],t[i]))return!1;return!0};Z.isConstant=function(e){return!l(e)||e.isConstant};Z.getValueOrUndefined=function(e,t,n){return l(e)?e.getValue(t,n):void 0};Z.getValueOrDefault=function(e,t,n,i){return l(e)?A(e.getValue(t,i),n):n};Z.getValueOrClonedDefault=function(e,t,n,i){let o;return l(e)&&(o=e.getValue(t,i)),l(o)||(o=n.clone(o)),o};const O4e=H.WHITE,L4e=f.ZERO,B4e=St.NONE,R4e=j.ZERO,N4e=1,M4e=0,F4e=f.ZERO,z4e=La.CENTER,U4e=Hi.CENTER,H4e=!1,V4e=new f,k4e=new H,G4e=new f,W4e=new j,j4e=new kt,q4e=new kt,$4e=new kt,Y4e=new Ye,X4e=new jt;function _k(e){this.entity=e,this.billboard=void 0,this.textureValue=void 0}function Lp(e,t){if(!l(e))throw new x("entityCluster is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(Lp.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new vt,this._onCollectionChanged(t,t.values,[],[])}Lp.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._billboard;let c,u=r.billboard,d=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(d&&(h=Z.getValueOrUndefined(s._position,e,V4e),c=Z.getValueOrUndefined(a._image,e),d=l(h)&&l(c)),!d){iR(r,s,n);continue}Z.isConstant(s._position)||(n._clusterDirty=!0),l(u)||(u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u),u.show=d,(!l(u.image)||r.textureValue!==c)&&(u.image=c,r.textureValue=c),u.position=h,u.color=Z.getValueOrDefault(a._color,e,O4e,k4e),u.eyeOffset=Z.getValueOrDefault(a._eyeOffset,e,L4e,G4e),u.heightReference=Z.getValueOrDefault(a._heightReference,e,B4e),u.pixelOffset=Z.getValueOrDefault(a._pixelOffset,e,R4e,W4e),u.scale=Z.getValueOrDefault(a._scale,e,N4e),u.rotation=Z.getValueOrDefault(a._rotation,e,M4e),u.alignedAxis=Z.getValueOrDefault(a._alignedAxis,e,F4e),u.horizontalOrigin=Z.getValueOrDefault(a._horizontalOrigin,e,z4e),u.verticalOrigin=Z.getValueOrDefault(a._verticalOrigin,e,U4e),u.width=Z.getValueOrUndefined(a._width,e),u.height=Z.getValueOrUndefined(a._height,e),u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,j4e),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,q4e),u.pixelOffsetScaleByDistance=Z.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,$4e),u.sizeInMeters=Z.getValueOrDefault(a._sizeInMeters,e,H4e),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,X4e),u.disableDepthTestDistance=Z.getValueOrUndefined(a._disableDepthTestDistance,e);const m=Z.getValueOrUndefined(a._imageSubRegion,e,Y4e);l(m)&&u.setImageSubRegion(u._imageId,m)}return!0};Lp.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new x("entity is required.");if(!l(t))throw new x("result is required.");const n=this._items.get(e.id);if(!l(n)||!l(n.billboard))return gt.FAILED;const i=n.billboard;if(i.heightReference===St.NONE)t.center=f.clone(i.position,t.center);else{if(!l(i._clampedPosition))return gt.PENDING;t.center=f.clone(i._clampedPosition,t.center)}return t.radius=0,gt.DONE};Lp.prototype.isDestroyed=function(){return!1};Lp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Lp.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeBillboard(e[t]);return He(this)};Lp.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._billboard)&&l(r._position)&&s.set(r.id,new _k(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._billboard)&&l(r._position)?s.contains(r.id)||s.set(r.id,new _k(r)):(iR(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],iR(s.get(r.id),r,a),s.remove(r.id)};function iR(e,t,n){l(e)&&(e.billboard=void 0,n.removeBillboard(t))}function Ii(e,t){if(e=A(e,0),t=A(t,Number.MAX_VALUE),t<=e)throw new x("far distance must be greater than near distance.");this.value=new Float32Array([e,t])}Object.defineProperties(Ii.prototype,{componentDatatype:{get:function(){return ee.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});Ii.fromDistanceDisplayCondition=function(e){if(!l(e))throw new x("distanceDisplayCondition is required.");if(e.far<=e.near)throw new x("distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance.");return new Ii(e.near,e.far)};Ii.toValue=function(e,t){if(!l(e))throw new x("distanceDisplayCondition is required.");return l(t)?(t[0]=e.near,t[1]=e.far,t):new Float32Array([e.near,e.far])};function rn(e){e=A(e,A.EMPTY_OBJECT),this.start=l(e.start)?ie.clone(e.start):new ie,this.stop=l(e.stop)?ie.clone(e.stop):new ie,this.data=e.data,this.isStartIncluded=A(e.isStartIncluded,!0),this.isStopIncluded=A(e.isStopIncluded,!0)}Object.defineProperties(rn.prototype,{isEmpty:{get:function(){const e=ie.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});const Hg={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};rn.fromIso8601=function(e,t){T.typeOf.object("options",e),T.typeOf.string("options.iso8601",e.iso8601);const n=e.iso8601.split("/");if(n.length!==2)throw new x("options.iso8601 is an invalid ISO 8601 interval.");const i=ie.fromIso8601(n[0]),o=ie.fromIso8601(n[1]),r=A(e.isStartIncluded,!0),s=A(e.isStopIncluded,!0),a=e.data;return l(t)?(t.start=i,t.stop=o,t.isStartIncluded=r,t.isStopIncluded=s,t.data=a,t):(Hg.start=i,Hg.stop=o,Hg.isStartIncluded=r,Hg.isStopIncluded=s,Hg.data=a,new rn(Hg))};rn.toIso8601=function(e,t){return T.typeOf.object("timeInterval",e),`${ie.toIso8601(e.start,t)}/${ie.toIso8601(e.stop,t)}`};rn.clone=function(e,t){if(l(e))return l(t)?(t.start=e.start,t.stop=e.stop,t.isStartIncluded=e.isStartIncluded,t.isStopIncluded=e.isStopIncluded,t.data=e.data,t):new rn(e)};rn.equals=function(e,t,n){return e===t||l(e)&&l(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ie.equals(e.start,t.start)&&ie.equals(e.stop,t.stop)&&(e.data===t.data||l(n)&&n(e.data,t.data)))};rn.equalsEpsilon=function(e,t,n,i){return n=A(n,0),e===t||l(e)&&l(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ie.equalsEpsilon(e.start,t.start,n)&&ie.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||l(i)&&i(e.data,t.data)))};rn.intersect=function(e,t,n,i){if(T.typeOf.object("left",e),!l(t))return rn.clone(rn.EMPTY,n);const o=e.start,r=e.stop,s=t.start,a=t.stop,c=ie.greaterThanOrEquals(s,o)&&ie.greaterThanOrEquals(r,s),u=!c&&ie.lessThanOrEquals(s,o)&&ie.lessThanOrEquals(o,a);if(!c&&!u)return rn.clone(rn.EMPTY,n);const d=e.isStartIncluded,h=e.isStopIncluded,m=t.isStartIncluded,g=t.isStopIncluded,p=ie.lessThan(r,a);return l(n)||(n=new rn),n.start=c?s:o,n.isStartIncluded=d&&m||!ie.equals(s,o)&&(c&&m||u&&d),n.stop=p?r:a,n.isStopIncluded=p?h:h&&g||!ie.equals(a,r)&&g,n.data=l(i)?i(e.data,t.data):e.data,n};rn.contains=function(e,t){if(T.typeOf.object("timeInterval",e),T.typeOf.object("julianDate",t),e.isEmpty)return!1;const n=ie.compare(e.start,t);if(n===0)return e.isStartIncluded;const i=ie.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};rn.prototype.clone=function(e){return rn.clone(this,e)};rn.prototype.equals=function(e,t){return rn.equals(this,e,t)};rn.prototype.equalsEpsilon=function(e,t,n){return rn.equalsEpsilon(this,e,t,n)};rn.prototype.toString=function(){return rn.toIso8601(this)};rn.EMPTY=Object.freeze(new rn({start:new ie,stop:new ie,isStartIncluded:!1,isStopIncluded:!1}));const DX=Object.freeze(ie.fromIso8601("0000-01-01T00:00:00Z")),IX=Object.freeze(ie.fromIso8601("9999-12-31T24:00:00Z")),K4e=Object.freeze(new rn({start:DX,stop:IX})),J4e={MINIMUM_VALUE:DX,MAXIMUM_VALUE:IX,MAXIMUM_INTERVAL:K4e},ft=J4e,Q4e=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec3 v_tangentEC;
|
||
varying vec3 v_bitangentEC;
|
||
varying 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
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,Z4e=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec3 tangent;
|
||
attribute vec3 bitangent;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying vec3 v_tangentEC;
|
||
varying vec3 v_bitangentEC;
|
||
varying 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;
|
||
}
|
||
`,eHe=`varying vec3 v_positionEC;
|
||
varying 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
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,tHe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying 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;
|
||
}
|
||
`,nHe=`varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying 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
|
||
gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||
#else
|
||
gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||
#endif
|
||
}
|
||
`,iHe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 normal;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying vec3 v_positionEC;
|
||
varying vec3 v_normalEC;
|
||
varying 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;
|
||
}
|
||
`;function Zo(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=A(e.closed,!1),i=A(e.materialSupport,Zo.MaterialSupport.TEXTURED);this.material=l(e.material)?e.material:ze.fromType(ze.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=A(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=Tr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._materialSupport=i,this._vertexFormat=i.vertexFormat,this._flat=A(e.flat,!1),this._faceForward=A(e.faceForward,!n)}Object.defineProperties(Zo.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}}});Zo.prototype.getFragmentShaderSource=Tr.prototype.getFragmentShaderSource;Zo.prototype.isTranslucent=Tr.prototype.isTranslucent;Zo.prototype.getRenderState=Tr.prototype.getRenderState;Zo.MaterialSupport={BASIC:Object.freeze({vertexFormat:Fe.POSITION_AND_NORMAL,vertexShaderSource:tHe,fragmentShaderSource:eHe}),TEXTURED:Object.freeze({vertexFormat:Fe.POSITION_NORMAL_AND_ST,vertexShaderSource:iHe,fragmentShaderSource:nHe}),ALL:Object.freeze({vertexFormat:Fe.ALL,vertexShaderSource:Z4e,fragmentShaderSource:Q4e})};function nn(e){this._definitionChanged=new Ke,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(nn.prototype,{isConstant:{get:function(){return Z.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ye("color")});nn.prototype.getType=function(e){return"Color"};nn.prototype.getValue=function(e,t){return l(t)||(t={}),t.color=Z.getValueOrClonedDefault(this._color,e,H.WHITE,t.color),t};nn.prototype.equals=function(e){return this===e||e instanceof nn&&Z.equals(this._color,e._color)};const PX={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};PX.NUMBER_OF_CLASSIFICATION_TYPES=3;const vo=Object.freeze(PX);function Kl(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.componentDatatype))throw new x("options.componentDatatype is required.");if(!l(e.componentsPerAttribute))throw new x("options.componentsPerAttribute is required.");if(e.componentsPerAttribute<1||e.componentsPerAttribute>4)throw new x("options.componentsPerAttribute must be between 1 and 4.");if(!l(e.value))throw new x("options.value is required.");this.componentDatatype=e.componentDatatype,this.componentsPerAttribute=e.componentsPerAttribute,this.normalize=A(e.normalize,!1),this.value=e.value}function ms(e,t,n){T.typeOf.bool("extentsCulling",e),T.typeOf.bool("planarExtents",t),T.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new oR;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new oR;if(o.requiresTextureCoordinates=e,n instanceof wn)i.requiresNormalEC=!n.flat;else{const 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}ms.prototype.createFragmentShader=function(e){T.typeOf.bool("columbusView2D",e);const 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 wn&&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 wn||(o=t.material.shaderSource),new We({defines:i,sources:[o,Lq]})};ms.prototype.createPickFragmentShader=function(e){T.typeOf.bool("columbusView2D",e);const 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 We({defines:n,sources:[Lq],pickColorQualifier:"varying"})};ms.prototype.createVertexShader=function(e,t,n,i){return T.defined("defines",e),T.typeOf.string("vertexShaderSource",t),T.typeOf.bool("columbusView2D",n),T.defined("mapProjection",i),OX(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};ms.prototype.createPickVertexShader=function(e,t,n,i){return T.defined("defines",e),T.typeOf.string("vertexShaderSource",t),T.typeOf.bool("columbusView2D",n),T.defined("mapProjection",i),OX(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const gk=new f,yk=new Ce,Ak={high:0,low:0};function OX(e,t,n,i,o,r,s,a){const c=i.slice();if(a.eastMostYhighDefine===""){const u=yk;u.longitude=M.PI,u.latitude=0,u.height=0;const d=s.project(u,gk);let h=Rn.encode(d.x,Ak);a.eastMostYhighDefine=`EAST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.eastMostYlowDefine=`EAST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`;const m=yk;m.longitude=-M.PI,m.latitude=0,m.height=0;const g=s.project(m,gk);h=Rn.encode(g.x,Ak),a.westMostYhighDefine=`WEST_MOST_X_HIGH ${h.high.toFixed(`${h.high}`.length+1)}`,a.westMostYlowDefine=`WEST_MOST_X_LOW ${h.low.toFixed(`${h.low}`.length+1)}`}return n&&(c.push(a.eastMostYhighDefine),c.push(a.eastMostYlowDefine),c.push(a.westMostYhighDefine),c.push(a.westMostYlowDefine)),l(r)&&r instanceof wn&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new We({defines:c,sources:[o]})}function oR(){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(oR.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 bk(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)/j.distance(t,e)}const oHe=[new j,new j,new j,new j];function LX(e,t){const n=oHe,i=j.unpack(t,0,n[0]),o=j.unpack(t,2,n[1]),r=j.unpack(t,4,n[2]);e.uMaxVmax=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/bk(i,o,r),a=1/bk(i,r,o);e.uvMinAndExtents=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const BX=new Ce,RX=new f,rHe=new f,sHe=new f,Px={high:0,low:0};function NX(e,t,n){const i=BX;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,RX);i.latitude=e.north;const r=t.project(i,rHe);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,sHe),a=[0,0,0,0],c=[0,0,0,0];let u=Rn.encode(o.x,Px);a[0]=u.high,c[0]=u.low,u=Rn.encode(o.y,Px),a[1]=u.high,c[1]=u.low,u=Rn.encode(r.y,Px),a[2]=u.high,c[2]=u.low,u=Rn.encode(s.x,Px),a[3]=u.high,c[3]=u.low,n.planes2D_HIGH=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const aHe=new B,cHe=new B,Ck=new f,lHe=new Ce,uHe=[new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce,new Ce];function dHe(e,t,n,i,o,r){const s=ge.center(e,lHe);s.height=n;const a=Ce.toCartesian(s,t,Ck),c=cn.eastNorthUpToFixedFrame(a,t,aHe),u=B.inverse(c,cHe),d=e.west,h=e.east,m=e.north,g=e.south,p=uHe;p[0].latitude=g,p[0].longitude=d,p[1].latitude=m,p[1].longitude=d,p[2].latitude=m,p[2].longitude=h,p[3].latitude=g,p[3].longitude=h;const y=(d+h)*.5,b=(m+g)*.5;p[4].latitude=g,p[4].longitude=y,p[5].latitude=m,p[5].longitude=y,p[6].latitude=b,p[6].longitude=d,p[7].latitude=b,p[7].longitude=h;let C=Number.POSITIVE_INFINITY,E=Number.NEGATIVE_INFINITY,w=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY;for(let R=0;R<8;R++){p[R].height=n;const F=Ce.toCartesian(p[R],t,Ck);B.multiplyByPoint(u,F,F),F.z=0,C=Math.min(C,F.x),E=Math.max(E,F.x),w=Math.min(w,F.y),S=Math.max(S,F.y)}const P=i;P.x=C,P.y=w,P.z=0,B.multiplyByPoint(c,P,P);const L=o;L.x=E,L.y=w,L.z=0,B.multiplyByPoint(c,L,L),f.subtract(L,P,o);const z=r;z.x=C,z.y=S,z.z=0,B.multiplyByPoint(c,z,z),f.subtract(z,P,r)}const fHe=new f,hHe=new f,pHe=new Rn;ms.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){T.typeOf.object("boundingRectangle",e),T.defined("textureCoordinateRotationPoints",t),T.typeOf.object("ellipsoid",n),T.typeOf.object("projection",i);const r=RX,s=fHe,a=hHe;dHe(e,n,A(o,0),r,s,a);const c={};LX(c,t);const u=Rn.fromCartesian(r,pHe);return c.southWest_HIGH=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:f.pack(u.high,[0,0,0])}),c.southWest_LOW=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:f.pack(u.low,[0,0,0])}),c.eastward=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:f.pack(s,[0,0,0])}),c.northward=new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:f.pack(a,[0,0,0])}),NX(e,i,c),c};const mHe=new f;function Tk(e,t,n,i){const o=BX;o.latitude=e,o.longitude=t,o.height=0;const r=Ce.toCartesian(o,n,mHe),s=Math.sqrt(r.x*r.x+r.y*r.y),a=M.fastApproximateAtan2(s,r.z),c=M.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=c,i}const Ek=new j;ms.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){T.typeOf.object("boundingRectangle",e),T.defined("textureCoordinateRotationPoints",t),T.typeOf.object("ellipsoid",n),T.typeOf.object("projection",i);const o=Tk(e.south,e.west,n,Ek);let r=o.x,s=o.y;const a=Tk(e.north,e.east,n,Ek);let c=a.x,u=a.y,d=0;s>u&&(d=M.PI-s,s=-M.PI,u+=d),r-=M.EPSILON5,s-=M.EPSILON5,c+=M.EPSILON5,u+=M.EPSILON5;const h=1/(u-s),m=1/(c-r),g={sphericalExtents:new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,m,h]}),longitudeRotation:new Kl({componentDatatype:ee.FLOAT,componentsPerAttribute:1,normalize:!1,value:[d]})};return LX(g,t),NX(e,i,g),g};ms.hasAttributesForTextureCoordinatePlanes=function(e){return l(e.southWest_HIGH)&&l(e.southWest_LOW)&&l(e.northward)&&l(e.eastward)&&l(e.planes2D_HIGH)&&l(e.planes2D_LOW)&&l(e.uMaxVmax)&&l(e.uvMinAndExtents)};ms.hasAttributesForSphericalExtents=function(e){return l(e.sphericalExtents)&&l(e.longitudeRotation)&&l(e.planes2D_HIGH)&&l(e.planes2D_LOW)&&l(e.uMaxVmax)&&l(e.uvMinAndExtents)};function _He(e){return Math.max(e.width,e.height)>ms.MAX_WIDTH_FOR_PLANAR_EXTENTS}ms.shouldUseSphericalCoordinates=function(e){return T.typeOf.object("rectangle",e),_He(e)};ms.MAX_WIDTH_FOR_PLANAR_EXTENTS=M.toRadians(1);function em(e){e=A(e,A.EMPTY_OBJECT);const t=e.geometryInstances;this.geometryInstances=t,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,vo.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._debugShowShadowVolume=!1,this._extruded=A(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;const n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const r=this._error;l(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:A(e.vertexCacheOptimize,!1),interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:A(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_createRenderStatesFunction:void 0,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0,_createPickOffsets:!0}}Object.defineProperties(em.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}}});em.isSupported=function(e){return e.context.stencilBuffer};function wy(e,t){const n=t?gi.EQUAL:gi.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:_t.KEEP,zFail:_t.DECREMENT_WRAP,zPass:_t.KEEP},backFunction:n,backOperation:{fail:_t.KEEP,zFail:_t.INCREMENT_WRAP,zPass:_t.KEEP},reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:x_.LESS_OR_EQUAL},depthMask:!1}}function rR(e){return{stencilTest:{enabled:e,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND}}const gHe={stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function yHe(e,t,n,i){if(l(e._rsStencilDepthPass))return;const o=!e.debugShowShadowVolume;e._rsStencilDepthPass=et.fromCache(wy(o,!1)),e._rsStencilDepthPass3DTiles=et.fromCache(wy(o,!0)),e._rsColorPass=et.fromCache(rR(o)),e._rsPickPass=et.fromCache(gHe)}function AHe(e,t){if(!e.compressVertices)return t;if(t.search(/attribute\s+vec3\s+extrudeDirection;/g)!==-1){const n="compressedAttributes",i=`attribute vec2 ${n};`,o=`vec3 extrudeDirection;
|
||
`,r=` extrudeDirection = czm_octDecode(${n}, 65535.0);
|
||
`;let s=t;s=s.replace(/attribute\s+vec3\s+extrudeDirection;/g,""),s=We.replaceMain(s,"czm_non_compressed_main");const a=`void main()
|
||
{
|
||
${r} czm_non_compressed_main();
|
||
}`;return[i,o,s,a].join(`
|
||
`)}}function bHe(e,t){const n=t.context,i=e._primitive;let o=PEe;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Jt._appendDistanceDisplayConditionToShader(i,o),o=Jt._modifyShaderPosition(e,o,t.scene3DOnly),o=Jt._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=AHe(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new We({defines:[a],sources:[o]});const u=new We({sources:[pB]}),d=e._primitive._attributeLocations,h=new ms(s,r,e.appearance);if(e._spStencil=Cn.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d}),e._primitive.allowPicking){let p=We.createPickVertexShaderSource(o);p=Jt._appendShowToShader(i,p),p=Jt._updatePickColorAttribute(p);const y=h.createPickFragmentShader(!1),b=h.createPickVertexShader([a],p,!1,t.mapProjection);if(e._spPick=Cn.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:b,fragmentShaderSource:y,attributeLocations:d}),s){let C=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!l(C)){const E=h.createPickFragmentShader(!0),w=h.createPickVertexShader([a],p,!0,t.mapProjection);C=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:w,fragmentShaderSource:E,attributeLocations:d})}e._spPick2D=C}}else e._spPick=Cn.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d});o=Jt._appendShowToShader(i,o),c=new We({defines:[a],sources:[o]}),e._sp=Cn.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:d});const m=h.createFragmentShader(!1),g=h.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=Cn.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:m,attributeLocations:d}),s){let p=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!l(p)){const y=h.createFragmentShader(!0),b=h.createVertexShader([a],o,!0,t.mapProjection);p=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:b,fragmentShaderSource:y,attributeLocations:d})}e._spColor2D=p}}function CHe(e,t){const n=e._primitive;let i=n._va.length*2;t.length=i;let o,r,s,a=0,c=n._batchTable.getUniformMapCallback()(e._uniformMap);const u=e._needs2DShader;for(o=0;o<i;o+=2){const g=n._va[a++];r=t[o],l(r)||(r=t[o]=new mt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Ne.TERRAIN_CLASSIFICATION,s=mt.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],l(r)||(r=t[o+1]=new mt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Ne.TERRAIN_CLASSIFICATION;const y=e.appearance.material;if(l(y)&&(c=hn(c,y._uniforms)),r.uniformMap=c,s=mt.shallowClone(r,r.derivedCommands.tileset),s.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let b=mt.shallowClone(r,r.derivedCommands.appearance2D);b.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=b,b=mt.shallowClone(s,s.derivedCommands.appearance2D),b.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=b}}const d=e._commandsIgnoreShow,h=e._spStencil;let m=0;i=d.length=i/2;for(let g=0;g<i;++g){const p=d[g]=mt.shallowClone(t[m],d[g]);p.shaderProgram=h,p.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,m+=2}}function THe(e,t){const n=e._usePickOffsets,i=e._primitive;let o=i._va.length*2,r,s=0,a;n&&(r=i._pickOffsets,o=r.length*2),t.length=o;let c,u,d,h=0;const m=i._batchTable.getUniformMapCallback()(e._uniformMap),g=e._needs2DShader;for(c=0;c<o;c+=2){let p=i._va[h++];if(n&&(a=r[s++],p=i._va[a.index]),u=t[c],l(u)||(u=t[c]=new mt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=m,u.pass=Ne.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),d=mt.shallowClone(u,u.derivedCommands.tileset),d.renderState=e._rsStencilDepthPass3DTiles,d.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=d,u=t[c+1],l(u)||(u=t[c+1]=new mt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsPickPass,u.shaderProgram=e._spPick,u.uniformMap=m,u.pass=Ne.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),d=mt.shallowClone(u,u.derivedCommands.tileset),d.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=d,g){let y=mt.shallowClone(u,u.derivedCommands.pick2D);y.shaderProgram=e._spPick2D,u.derivedCommands.pick2D=y,y=mt.shallowClone(d,d.derivedCommands.pick2D),y.shaderProgram=e._spPick2D,d.derivedCommands.pick2D=y}}}function EHe(e,t,n,i,o,r,s){CHe(e,r),THe(e,s)}function xk(e,t){return Math.floor(e%t/2)}function BP(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function wk(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function xHe(e,t,n,i,o,r,s,a){const c=e._primitive;Jt._updateBoundingVolumes(c,t,o);let u;t.mode===le.SCENE3D?u=c._boundingSphereWC:t.mode===le.COLUMBUS_VIEW?u=c._boundingSphereCV:t.mode===le.SCENE2D&&l(c._boundingSphere2D)?u=c._boundingSphere2D:l(c._boundingSphereMorph)&&(u=c._boundingSphereMorph);const d=e.classificationType,h=d!==vo.CESIUM_3D_TILE,m=d!==vo.TERRAIN,g=t.passes;let p,y,b;if(g.render){const C=n.length;for(p=0;p<C;++p)y=u[xk(p,C)],h&&(b=n[p],BP(b,t,o,r,y,s)),m&&(b=n[p].derivedCommands.tileset,BP(b,t,o,r,y,s));if(t.invertClassification){const E=e._commandsIgnoreShow,w=E.length;for(p=0;p<w;++p)y=u[p],b=E[p],BP(b,t,o,r,y,s)}}if(g.pick){const C=i.length,E=c._pickOffsets;for(p=0;p<C;++p){const w=E[xk(p,C)];y=u[w.index],h&&(b=i[p],wk(b,t,o,r,y)),m&&(b=i[p].derivedCommands.tileset,wk(b,t,o,r,y))}}}em.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;let t=this.appearance;l(t)&&l(t.material)&&t.material.update(e.context);const n=this,i=this._primitiveOptions;if(!l(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length;let s,a,c,u=!1,d=!0,h,m=!1,g=!1;for(r>0&&(c=o[0].attributes,m=ms.hasAttributesForSphericalExtents(c),g=ms.hasAttributesForTextureCoordinatePlanes(c),h=c.color),s=0;s<r;s++){a=o[s];const y=a.attributes.color;if(l(y))u=!0;else if(u)throw new x("All GeometryInstances must have color attributes to use per-instance color.");d=d&&l(y)&&pn.equals(h,y)}if(!d&&!m&&!g)throw new x("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(u&&!l(t)&&(t=new wn({flat:!0}),this.appearance=t),!u&&t instanceof wn)throw new x("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(l(t.material)&&!m&&!g)throw new x("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!m&&!g,this._hasSphericalExtentsAttribute=m,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=u;const p=new Array(r);for(s=0;s<r;++s)a=o[s],p[s]=new ln({geometry:a.geometry,attributes:a.attributes,modelMatrix:a.modelMatrix,id:a.id,pickPrimitive:A(this._pickPrimitive,n)});i.appearance=t,i.geometryInstances=p,l(this._createBoundingVolumeFunction)&&(i._createBoundingVolumeFunction=function(y,b){n._createBoundingVolumeFunction(y,b)}),i._createRenderStatesFunction=function(y,b,C,E){yHe(n)},i._createShaderProgramFunction=function(y,b,C){bHe(n,b)},i._createCommandsFunction=function(y,b,C,E,w,S,P){EHe(n,void 0,void 0,!0,!1,S,P)},l(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(y,b,C,E,w,S,P,L){n._updateAndQueueCommandsFunction(y,b,C,E,w,S,P,L)}:i._updateAndQueueCommandsFunction=function(y,b,C,E,w,S,P,L){xHe(n,b,C,E,w,S,P)},this._primitive=new Jt(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=et.fromCache(wy(!1,!1)),this._rsStencilDepthPass3DTiles=et.fromCache(wy(!1,!0)),this._rsColorPass=et.fromCache(rR(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=et.fromCache(wy(!0,!1)),this._rsStencilDepthPass3DTiles=et.fromCache(wy(!0,!0)),this._rsColorPass=et.fromCache(rR(!0))),this._primitive.appearance!==t){if(!this._hasSphericalExtentsAttribute&&!this._hasPlanarExtentsAttributes&&l(t.material))throw new x("Materials on ClassificationPrimitives are not supported except via GroundPrimitive");if(!this._hasPerColorAttribute&&t instanceof wn)throw new x("PerInstanceColorAppearance requires color GeometryInstanceAttribute");this._primitive.appearance=t}this._primitive.show=this.show,this._primitive.debugShowBoundingVolume=this.debugShowBoundingVolume,this._primitive.update(e),e.afterRender.push(()=>{l(this._primitive)&&this._primitive.ready&&this._completeLoad()})};em.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};em.prototype.isDestroyed=function(){return!1};em.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,He(this)};const wHe={u_globeMinimumAltitude:function(){return 55e3}};function $r(e){e=A(e,A.EMPTY_OBJECT);let t=e.appearance;const n=e.geometryInstances;if(!l(t)&&l(n)){const r=Array.isArray(n)?n:[n],s=r.length;for(let a=0;a<s;a++){const c=r[a].attributes;if(l(c)&&l(c.color)){t=new wn({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,vo.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._boundingVolumes=[],this._boundingVolumes2D=[],this._ready=!1;const i=this;this._readyPromise=new Promise((r,s)=>{i._completeLoad=()=>{if(this._ready)return;this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const a=this._error;l(a)?s(a):r(this)}}),this._primitive=void 0,this._maxHeight=void 0,this._minHeight=void 0,this._maxTerrainHeight=lo._defaultMaxTerrainHeight,this._minTerrainHeight=lo._defaultMinTerrainHeight,this._boundingSpheresKeys=[],this._boundingSpheres=[],this._useFragmentCulling=!1,this._zIndex=void 0;const o=this;this._classificationPrimitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:A(e.vertexCacheOptimize,!1),interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:A(e.compressVertices,!0),_createBoundingVolumeFunction:void 0,_updateAndQueueCommandsFunction:void 0,_pickPrimitive:o,_extruded:!0,_uniformMap:wHe}}Object.defineProperties($r.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}}});$r.isSupported=em.isSupported;function Sk(e){return function(t,n){const i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function vk(e){return function(t,n){return e._minHeight}}const SHe=new f,vHe=new f,DHe=new f,IHe=new Ce,PHe=new ge;function nS(e,t){const n=e.mapProjection.ellipsoid;if(!l(t.attributes)||!l(t.attributes.position3DHigh))return l(t.rectangle)?t.rectangle:void 0;const i=t.attributes.position3DHigh.values,o=t.attributes.position3DLow.values,r=i.length;let s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(let h=0;h<r;h+=3){const m=f.unpack(i,h,SHe),g=f.unpack(o,h,vHe),p=f.add(m,g,DHe),y=n.cartesianToCartographic(p,IHe),b=y.latitude,C=y.longitude;s=Math.min(s,b),a=Math.min(a,C),c=Math.max(c,b),u=Math.max(u,C)}const d=PHe;return d.north=c,d.south=s,d.east=u,d.west=a,d}function OHe(e,t,n){const i=lo.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function LHe(e,t,n){const i=t.mapProjection.ellipsoid,o=nS(t,n),r=zt.fromRectangle(o,e._minHeight,e._maxHeight,i);if(e._boundingVolumes.push(r),!t.scene3DOnly){const s=t.mapProjection,a=fe.fromRectangleWithHeights2D(o,s,e._maxHeight,e._minHeight);f.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function RP(e,t){return Math.floor(e%t/2)}function NP(e,t,n,i,o,r,s){const a=e._primitive;n.mode!==le.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 Dk(e,t,n,i,o,r){const s=e._primitive;n.mode!==le.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 BHe(e,t,n,i,o,r,s,a){let c;t.mode===le.SCENE3D?c=e._boundingVolumes:c=e._boundingVolumes2D;const u=e.classificationType,d=u!==vo.CESIUM_3D_TILE,h=u!==vo.TERRAIN,m=t.passes,g=e._primitive;let p,y,b;if(m.render){const C=n.length;for(p=0;p<C;++p)y=c[RP(p,C)],d&&(b=n[p],NP(e,b,t,o,r,y,s)),h&&(b=n[p].derivedCommands.tileset,NP(e,b,t,o,r,y,s));if(t.invertClassification){const E=g._commandsIgnoreShow,w=E.length;for(p=0;p<w;++p)y=c[p],b=E[p],NP(e,b,t,o,r,y,s)}}if(m.pick){const C=i.length;let E;for(e._useFragmentCulling||(E=g._primitive._pickOffsets),p=0;p<C;++p){if(y=c[RP(p,C)],!e._useFragmentCulling){const w=E[RP(p,C)];y=c[w.index]}d&&(b=i[p],Dk(e,b,t,o,r,y)),h&&(b=i[p].derivedCommands.tileset,Dk(e,b,t,o,r,y))}}}$r.initializeTerrainHeights=function(){return lo.initialize()};$r.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!lo.initialized){if(!this.asynchronous)throw new x("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");$r.initializeTerrainHeights();return}const t=this,n=this._classificationPrimitiveOptions;if(!l(this._primitive)){const i=e.mapProjection.ellipsoid;let o,r,s;const a=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],c=a.length,u=new Array(c);let d,h;for(d=0;d<c;++d){o=a[d],r=o.geometry;const y=nS(e,r);l(h)?l(y)&&ge.union(h,y,h):h=ge.clone(y);const b=o.id;if(l(b)&&l(y)){const C=lo.getBoundingSphere(y,i);this._boundingSpheresKeys.push(b),this._boundingSpheres.push(C)}if(s=r.constructor,!l(s)||!l(s.createShadowVolume))throw new x("Not all of the geometry instances have GroundPrimitive support.")}OHe(this,h,i);const m=e.terrainExaggeration,g=e.terrainExaggerationRelativeHeight;this._minHeight=fp.getHeight(this._minTerrainHeight,m,g),this._maxHeight=fp.getHeight(this._maxTerrainHeight,m,g);const p=$r._supportsMaterials(e.context);if(this._useFragmentCulling=p,p){let y,b=!0;for(d=0;d<c;++d)if(o=a[d],r=o.geometry,h=nS(e,r),ms.shouldUseSphericalCoordinates(h)){b=!1;break}for(d=0;d<c;++d){o=a[d],r=o.geometry,s=r.constructor;const C=nS(e,r),E=r.textureCoordinateRotationPoints;b?y=ms.getPlanarTextureCoordinateAttributes(C,E,i,e.mapProjection,this._maxHeight):y=ms.getSphericalExtentGeometryInstanceAttributes(C,E,i,e.mapProjection);const w=o.attributes;for(const S in w)w.hasOwnProperty(S)&&(y[S]=w[S]);u[d]=new ln({geometry:s.createShadowVolume(r,vk(this),Sk(this)),attributes:y,id:o.id})}}else for(d=0;d<c;++d)o=a[d],r=o.geometry,s=r.constructor,u[d]=new ln({geometry:s.createShadowVolume(r,vk(this),Sk(this)),attributes:o.attributes,id:o.id});n.geometryInstances=u,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(y,b){LHe(t,y,b)},n._updateAndQueueCommandsFunction=function(y,b,C,E,w,S,P,L){BHe(t,b,C,E,w,S,P)},this._primitive=new em(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(()=>{l(this._primitive)&&this._primitive.ready&&this._completeLoad()})};$r.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};$r.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};$r.prototype.isDestroyed=function(){return!1};$r.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)};$r._supportsMaterials=function(e){return e.depthTexture};$r.supportsMaterials=function(e){return T.typeOf.object("scene",e),$r._supportsMaterials(e.frameState.context)};function Or(){x.throwInstantiationError()}Object.defineProperties(Or.prototype,{isConstant:{get:x.throwInstantiationError},definitionChanged:{get:x.throwInstantiationError}});Or.prototype.getType=x.throwInstantiationError;Or.prototype.getValue=x.throwInstantiationError;Or.prototype.equals=x.throwInstantiationError;Or.getValue=function(e,t,n){let i;return l(t)&&(i=t.getType(e),l(i))?((!l(n)||n.type!==i)&&(n=ze.fromType(i)),t.getValue(e,n.uniforms),n):((!l(n)||n.type!==ze.ColorType)&&(n=ze.fromType(ze.ColorType)),H.clone(H.WHITE,n.uniforms.color),n)};function yi(e,t,n){T.defined("geometryUpdater",e),T.defined("primitives",t),T.defined("orderedGroundPrimitives",n),this._primitives=t,this._orderedGroundPrimitives=n,this._primitive=void 0,this._outlinePrimitive=void 0,this._geometryUpdater=e,this._options=e._options,this._entity=e._entity,this._material=void 0}yi.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!Z.getValueOrDefault(t.show,n,!0)};yi.prototype._setOptions=x.throwInstantiationError;yi.prototype.update=function(e){T.defined("time",e);const 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;const r=this._entity,s=r[this._geometryUpdater._geometryPropertyName];if(this._setOptions(r,s,e),this._isHidden(r,s,e))return;const a=this._geometryUpdater.shadowsProperty.getValue(e),c=this._options;if(!l(s.fill)||s.fill.getValue(e)){const u=t.fillMaterialProperty,d=u instanceof nn;let h;const m=t._getIsClosed(c);if(d)h=new wn({closed:m,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const g=Or.getValue(e,u,this._material);this._material=g,h=new Zo({material:g,translucent:g.isTranslucent(),closed:m})}if(n)c.vertexFormat=wn.VERTEX_FORMAT,this._primitive=o.add(new $r({geometryInstances:this._geometryUpdater.createFillGeometryInstance(e),appearance:h,asynchronous:!1,shadows:a,classificationType:this._geometryUpdater.classificationTypeProperty.getValue(e)}),Z.getValueOrUndefined(this._geometryUpdater.zIndex,e));else{c.vertexFormat=h.vertexFormat;const g=this._geometryUpdater.createFillGeometryInstance(e);d&&(h.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Jt({geometryInstances:g,appearance:h,asynchronous:!1,shadows:a}))}}if(!n&&l(s.outline)&&s.outline.getValue(e)){const u=this._geometryUpdater.createOutlineGeometryInstance(e),d=Z.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Jt({geometryInstances:u,appearance:new wn({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(d)}}),asynchronous:!1,shadows:a}))}};yi.prototype.getBoundingSphere=function(e){if(!l(e))throw new x("result is required.");const t=this._entity,n=this._primitive,i=this._outlinePrimitive;let o;return l(n)&&n.show&&n.ready&&(o=n.getGeometryInstanceAttributes(t),l(o)&&l(o.boundingSphere))||l(i)&&i.show&&i.ready&&(o=i.getGeometryInstanceAttributes(t),l(o)&&l(o.boundingSphere))?(fe.clone(o.boundingSphere,e),gt.DONE):l(n)&&!n.ready||l(i)&&!i.ready?gt.PENDING:gt.FAILED};yi.prototype.isDestroyed=function(){return!1};yi.prototype.destroy=function(){const e=this._primitives,t=this._orderedGroundPrimitives;this._geometryUpdater._onTerrain?t.remove(this._primitive):e.removeAndDestroy(this._primitive),e.removeAndDestroy(this._outlinePrimitive),He(this)};const RHe={NONE:0,GEODESIC:1,RHUMB:2},Bn=Object.freeze(RHe),Ik=M.EPSILON10;function da(e,t,n,i){if(T.defined("equalsEpsilon",t),!l(e))return;n=A(n,!1);const o=l(i),r=e.length;if(r<2)return e;let s,a=e[0],c,u,d=0,h=-1;for(s=1;s<r;++s)c=e[s],t(a,c,Ik)?(l(u)||(u=e.slice(0,s),d=s-1,h=0),o&&i.push(s)):(l(u)&&(u.push(c),d=s,o&&(h=i.length)),a=c);return n&&t(e[0],e[r-1],Ik)&&(o&&(l(u)?i.splice(h,0,d):i.push(r-1)),l(u)?u.length-=1:u=e.slice(0,-1)),l(u)?u:e}const w2=[nr,di],NHe=w2.length,MX=Math.cos(M.toRadians(30)),Pk=Math.cos(M.toRadians(150)),FX=0,zX=1e3;function Bf(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t)||t.length<2)throw new x("At least two positions are required.");if(l(e.arcType)&&e.arcType!==Bn.GEODESIC&&e.arcType!==Bn.RHUMB)throw new x("Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB.");this.width=A(e.width,1),this._positions=t,this.granularity=A(e.granularity,9999),this.loop=A(e.loop,!1),this.arcType=A(e.arcType,Bn.GEODESIC),this._ellipsoid=me.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(Bf.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+me.packedLength+1+1}}});Bf.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<NHe;i++)if(t instanceof w2[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const MHe=new f,Ok=new f,Lk=new f;function sR(e,t,n,i,o){const r=xa(i,e,0,MHe),s=xa(i,e,n,Ok),a=xa(i,t,0,Lk),c=Rf(s,r,Ok),u=Rf(a,r,Lk);return f.cross(u,c,o),f.normalize(o,o)}const FHe=new Ce,zHe=new f,UHe=new f,HHe=new f;function MP(e,t,n,i,o,r,s,a,c,u,d){if(o===0)return;let h;r===Bn.GEODESIC?h=new qf(e,t,s):r===Bn.RHUMB&&(h=new ps(e,t,s));const m=h.surfaceDistance;if(m<o)return;const g=sR(e,t,i,s,HHe),p=Math.ceil(m/o),y=m/p;let b=y;const C=p-1;let E=a.length;for(let w=0;w<C;w++){const S=h.interpolateUsingSurfaceDistance(b,FHe),P=xa(s,S,n,zHe),L=xa(s,S,i,UHe);f.pack(g,a,E),f.pack(P,c,E),f.pack(L,u,E),d.push(S.latitude),d.push(S.longitude),E+=3,b+=y}}const FP=new Ce;function xa(e,t,n,i){return Ce.clone(t,FP),FP.height=n,Ce.toCartesian(FP,e,i)}Bf.pack=function(e,t,n){T.typeOf.object("value",e),T.defined("array",t);let i=A(n,0);const o=e._positions,r=o.length;t[i++]=r;for(let s=0;s<r;++s){const a=o[s];f.pack(a,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,me.pack(e._ellipsoid,t,i),i+=me.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t};Bf.unpack=function(e,t,n){T.defined("array",e);let i=A(t,0);const o=e[i++],r=new Array(o);for(let m=0;m<o;m++)r[m]=f.unpack(e,i),i+=3;const s=e[i++],a=e[i++]===1,c=e[i++],u=me.unpack(e,i);i+=me.packedLength;const d=e[i++],h=e[i++]===1;return l(n)||(n=new Bf({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=c,n._ellipsoid=u,n._projectionIndex=d,n._scene3DOnly=h,n};function Rf(e,t,n){return f.subtract(e,t,n),f.normalize(n,n),n}function Bk(e,t,n,i){return i=Rf(e,t,i),i=f.cross(i,n,i),i=f.normalize(i,i),i=f.cross(n,i,i),i}const VHe=new f,kHe=new f,GHe=new f,UX=new f,WHe=0,jHe=-1;function zP(e,t,n,i,o){const r=Rf(n,t,UX),s=Bk(e,t,r,VHe),a=Bk(i,t,r,kHe);if(M.equalsEpsilon(f.dot(s,a),jHe,M.EPSILON5))return o=f.cross(r,s,o),o=f.normalize(o,o),o;o=f.add(a,s,o),o=f.normalize(o,o);const c=f.cross(r,o,GHe);return f.dot(a,c)<WHe&&(o=f.negate(o,o)),o}const rv=Pt.fromPointNormal(f.ZERO,f.UNIT_Y),qHe=new f,$He=new f,YHe=new f,XHe=new f,KHe=new f,Ox=new f,Lx=new Ce,Rk=new Ce,Nk=new Ce;Bf.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new w2[e._projectionIndex](i),a=FX,c=zX;let u,d;const h=e._positions,m=h.length;m===2&&(n=!1);let g,p,y,b;const C=new ps(void 0,void 0,i);let E,w,S;const P=[h[0]];for(d=0;d<m-1;d++)g=h[d],p=h[d+1],E=pr.lineSegmentPlane(g,p,rv,Ox),l(E)&&!f.equalsEpsilon(E,g,M.EPSILON7)&&!f.equalsEpsilon(E,p,M.EPSILON7)&&(e.arcType===Bn.GEODESIC?P.push(f.clone(E)):e.arcType===Bn.RHUMB&&(S=i.cartesianToCartographic(E,Lx).longitude,y=i.cartesianToCartographic(g,Lx),b=i.cartesianToCartographic(p,Rk),C.setEndPoints(y,b),w=C.findIntersectionWithLongitude(S,Nk),E=i.cartographicToCartesian(w,Ox),l(E)&&!f.equalsEpsilon(E,g,M.EPSILON7)&&!f.equalsEpsilon(E,p,M.EPSILON7)&&P.push(f.clone(E)))),P.push(p);n&&(g=h[m-1],p=h[0],E=pr.lineSegmentPlane(g,p,rv,Ox),l(E)&&!f.equalsEpsilon(E,g,M.EPSILON7)&&!f.equalsEpsilon(E,p,M.EPSILON7)&&(e.arcType===Bn.GEODESIC?P.push(f.clone(E)):e.arcType===Bn.RHUMB&&(S=i.cartesianToCartographic(E,Lx).longitude,y=i.cartesianToCartographic(g,Lx),b=i.cartesianToCartographic(p,Rk),C.setEndPoints(y,b),w=C.findIntersectionWithLongitude(S,Nk),E=i.cartographicToCartesian(w,Ox),l(E)&&!f.equalsEpsilon(E,g,M.EPSILON7)&&!f.equalsEpsilon(E,p,M.EPSILON7)&&P.push(f.clone(E)))));let L=P.length,z=new Array(L);for(d=0;d<L;d++){const q=Ce.fromCartesian(P[d],i);q.height=0,z[d]=q}if(z=da(z,Ce.equalsEpsilon),L=z.length,L<2)return;const R=[],F=[],U=[],D=[];let I=qHe,_=$He,v=YHe,O=XHe,N=KHe;const V=z[0],k=z[1],G=z[L-1];for(I=xa(i,G,a,I),O=xa(i,k,a,O),_=xa(i,V,a,_),v=xa(i,V,c,v),n?N=zP(I,_,v,O,N):N=sR(V,k,c,i,N),f.pack(N,F,0),f.pack(_,U,0),f.pack(v,D,0),R.push(V.latitude),R.push(V.longitude),MP(V,k,a,c,o,r,i,F,U,D,R),d=1;d<L-1;++d){I=f.clone(_,I),_=f.clone(O,_);const q=z[d];xa(i,q,c,v),xa(i,z[d+1],a,O),zP(I,_,v,O,N),u=F.length,f.pack(N,F,u),f.pack(_,U,u),f.pack(v,D,u),R.push(q.latitude),R.push(q.longitude),MP(z[d],z[d+1],a,c,o,r,i,F,U,D,R)}const W=z[L-1],K=z[L-2];if(_=xa(i,W,a,_),v=xa(i,W,c,v),n){const q=z[0];I=xa(i,K,a,I),O=xa(i,q,a,O),N=zP(I,_,v,O,N)}else N=sR(K,W,c,i,N);if(u=F.length,f.pack(N,F,u),f.pack(_,U,u),f.pack(v,D,u),R.push(W.latitude),R.push(W.longitude),n){for(MP(W,V,a,c,o,r,i,F,U,D,R),u=F.length,d=0;d<3;++d)F[u+d]=F[d],U[u+d]=U[d],D[u+d]=D[d];R.push(V.latitude),R.push(V.longitude)}return TVe(n,s,U,D,F,R,t)};const JHe=new f,QHe=new J,ZHe=new Te;function Mk(e,t,n,i){const o=Rf(n,t,JHe),r=f.dot(o,e);if(r>MX||r<Pk){const s=Rf(i,n,UX),a=r<Pk?M.PI_OVER_TWO:-M.PI_OVER_TWO,c=Te.fromAxisAngle(s,a,ZHe),u=J.fromQuaternion(c,QHe);return J.multiplyByVector(u,e,e),!0}return!1}const Fk=new Ce,eVe=new f,zk=new f;function hb(e,t,n,i,o){const r=Ce.toCartesian(t,e._ellipsoid,eVe);let s=f.add(r,n,zk),a=!1;const c=e._ellipsoid;let u=c.cartesianToCartographic(s,Fk);Math.abs(t.longitude-u.longitude)>M.PI_OVER_TWO&&(a=!0,s=f.subtract(r,n,zk),u=c.cartesianToCartographic(s,Fk)),u.height=0;const d=e.project(u,o);return o=f.subtract(d,i,o),o.z=0,o=f.normalize(o,o),a&&f.negate(o,o),o}const tVe=new f,Uk=new f;function Hk(e,t,n,i,o,r){const s=f.subtract(t,e,tVe);f.normalize(s,s);const a=n-FX;let c=f.multiplyByScalar(s,a,Uk);f.add(e,c,o);const u=i-zX;c=f.multiplyByScalar(s,u,Uk),f.add(t,c,r)}const nVe=new f;function Bx(e,t){const n=Pt.getPointDistance(rv,e),i=Pt.getPointDistance(rv,t);let o=nVe;M.equalsEpsilon(n,0,M.EPSILON2)?(o=Rf(t,e,o),f.multiplyByScalar(o,M.EPSILON2,o),f.add(e,o,e)):M.equalsEpsilon(i,0,M.EPSILON2)&&(o=Rf(e,t,o),f.multiplyByScalar(o,M.EPSILON2,o),f.add(t,o,t))}function iVe(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(M.equalsEpsilon(n,M.PI,M.EPSILON11)){const o=M.sign(t.longitude);return e.longitude=o*(n-M.EPSILON11),1}else if(M.equalsEpsilon(i,M.PI,M.EPSILON11)){const o=M.sign(e.longitude);return t.longitude=o*(i-M.EPSILON11),2}return 0}const HX=new Ce,VX=new Ce,Vk=new f,UP=new f,kk=new f,Gk=new f,oVe=new f,Wk=new f,rVe=[HX,VX],sVe=new ge,aVe=new f,cVe=new f,lVe=new f,uVe=new f,dVe=new f,fVe=new f,HP=new f,VP=new f,hVe=new f,pVe=new f,mVe=new f,jk=new f,_Ve=new f,gVe=new f,yVe=new Rn,AVe=new Rn,qk=new f,bVe=new f,$k=new f,CVe=[new fe,new fe],kX=[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],Yk=kX.length;function TVe(e,t,n,i,o,r,s){let a,c;const u=t._ellipsoid,d=n.length/3-1,h=d*8,m=h*4,g=d*36,p=h>65535?new Uint32Array(g):new Uint16Array(g),y=new Float64Array(h*3),b=new Float32Array(m),C=new Float32Array(m),E=new Float32Array(m),w=new Float32Array(m),S=new Float32Array(m);let P,L,z,R;s&&(P=new Float32Array(m),L=new Float32Array(m),z=new Float32Array(m),R=new Float32Array(h*2));const F=r.length/2;let U=0;const D=HX;D.height=0;const I=VX;I.height=0;let _=Vk,v=UP;if(s)for(c=0,a=1;a<F;a++)D.latitude=r[c],D.longitude=r[c+1],I.latitude=r[c+2],I.longitude=r[c+3],_=t.project(D,_),v=t.project(I,v),U+=f.distance(_,v),c+=2;const O=i.length/3;v=f.unpack(i,0,v);let N=0;for(c=3,a=1;a<O;a++)_=f.clone(v,_),v=f.unpack(i,c,v),N+=f.distance(_,v),c+=3;let V;c=3;let k=0,G=0,W=0,K=0,q=!1,te=f.unpack(n,0,Gk),Y=f.unpack(i,0,UP),X=f.unpack(o,0,Wk);if(e){const ne=f.unpack(n,n.length-6,kk);Mk(X,ne,te,Y)&&(X=f.negate(X,X))}let $=0,se=0,ue=0;for(a=0;a<d;a++){const ne=f.clone(te,kk),de=f.clone(Y,Vk);let _e=f.clone(X,oVe);q&&(_e=f.negate(_e,_e)),te=f.unpack(n,c,Gk),Y=f.unpack(i,c,UP),X=f.unpack(o,c,Wk),q=Mk(X,ne,te,Y),D.latitude=r[k],D.longitude=r[k+1],I.latitude=r[k+2],I.longitude=r[k+3];let Se,ve,Le,Ee;if(s){const mn=iVe(D,I);Se=t.project(D,dVe),ve=t.project(I,fVe);const Kn=Rf(ve,Se,qk);Kn.y=Math.abs(Kn.y),Le=HP,Ee=VP,mn===0||f.dot(Kn,f.UNIT_Y)>MX?(Le=hb(t,D,_e,Se,HP),Ee=hb(t,I,X,ve,VP)):mn===1?(Ee=hb(t,I,X,ve,VP),Le.x=0,Le.y=M.sign(D.longitude-Math.abs(I.longitude)),Le.z=0):(Le=hb(t,D,_e,Se,HP),Ee.x=0,Ee.y=M.sign(D.longitude-I.longitude),Ee.z=0)}const Be=f.distance(de,Y),Pe=Rn.fromCartesian(ne,yVe),Ae=f.subtract(te,ne,hVe),xe=f.normalize(Ae,jk);let Oe=f.subtract(de,ne,pVe);Oe=f.normalize(Oe,Oe);let Ve=f.cross(xe,Oe,jk);Ve=f.normalize(Ve,Ve);let Re=f.cross(Oe,_e,_Ve);Re=f.normalize(Re,Re);let At=f.subtract(Y,te,mVe);At=f.normalize(At,At);let xt=f.cross(X,At,gVe);xt=f.normalize(xt,xt);const Nt=Be/N,On=$/N;let Nn=0,Sn,un,Ht,vn=0,Pn=0;if(s){Nn=f.distance(Se,ve),Sn=Rn.fromCartesian(Se,AVe),un=f.subtract(ve,Se,qk),Ht=f.normalize(un,bVe);const mn=Ht.x;Ht.x=Ht.y,Ht.y=-mn,vn=Nn/U,Pn=se/U}for(V=0;V<8;V++){const mn=K+V*4,Kn=G+V*2,Hn=mn+3,dn=V<4?1:-1,bt=V===2||V===3||V===6||V===7?1:-1;f.pack(Pe.high,b,mn),b[Hn]=Ae.x,f.pack(Pe.low,C,mn),C[Hn]=Ae.y,f.pack(Re,E,mn),E[Hn]=Ae.z,f.pack(xt,w,mn),w[Hn]=Nt*dn,f.pack(Ve,S,mn);let Ge=On*bt;Ge===0&&bt<0&&(Ge=9),S[Hn]=Ge,s&&(P[mn]=Sn.high.x,P[mn+1]=Sn.high.y,P[mn+2]=Sn.low.x,P[mn+3]=Sn.low.y,z[mn]=-Le.y,z[mn+1]=Le.x,z[mn+2]=Ee.y,z[mn+3]=-Ee.x,L[mn]=un.x,L[mn+1]=un.y,L[mn+2]=Ht.x,L[mn+3]=Ht.y,R[Kn]=vn*dn,Ge=Pn*bt,Ge===0&&bt<0&&(Ge=9),R[Kn+1]=Ge)}const qt=lVe,tn=uVe,jn=aVe,hi=cVe,sn=ge.fromCartographicArray(rVe,sVe),zi=lo.getMinimumMaximumHeights(sn,u),oo=zi.minimumTerrainHeight,Wi=zi.maximumTerrainHeight;ue+=oo,ue+=Wi,Hk(ne,de,oo,Wi,qt,jn),Hk(te,Y,oo,Wi,tn,hi);let li=f.multiplyByScalar(Ve,M.EPSILON5,$k);f.add(qt,li,qt),f.add(tn,li,tn),f.add(jn,li,jn),f.add(hi,li,hi),Bx(qt,tn),Bx(jn,hi),f.pack(qt,y,W),f.pack(tn,y,W+3),f.pack(hi,y,W+6),f.pack(jn,y,W+9),li=f.multiplyByScalar(Ve,-2*M.EPSILON5,$k),f.add(qt,li,qt),f.add(tn,li,tn),f.add(jn,li,jn),f.add(hi,li,hi),Bx(qt,tn),Bx(jn,hi),f.pack(qt,y,W+12),f.pack(tn,y,W+15),f.pack(hi,y,W+18),f.pack(jn,y,W+21),k+=2,c+=3,G+=16,W+=24,K+=32,$+=Be,se+=Nn}c=0;let re=0;for(a=0;a<d;a++){for(V=0;V<Yk;V++)p[c+V]=kX[V]+re;re+=8,c+=Yk}const he=CVe;fe.fromVertices(n,f.ZERO,3,he[0]),fe.fromVertices(i,f.ZERO,3,he[1]);const ce=fe.fromBoundingSpheres(he);ce.radius+=ue/(d*2);const Q={position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,normalize:!1,values:y}),startHiAndForwardOffsetX:xh(b),startLoAndForwardOffsetY:xh(C),startNormalAndForwardOffsetZ:xh(E),endNormalAndTextureCoordinateNormalizationX:xh(w),rightNormalAndTextureCoordinateNormalizationY:xh(S)};return s&&(Q.startHiLo2D=xh(P),Q.offsetAndRight2D=xh(L),Q.startEndNormals2D=xh(z),Q.texcoordNormalization2D=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,normalize:!1,values:R})),new Lt({attributes:Q,indices:p,boundingSphere:ce})}function xh(e){return new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}Bf._projectNormal=hb;const EVe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec2 expandAndWidth;
|
||
attribute vec4 color;
|
||
attribute float batchId;
|
||
|
||
varying 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;
|
||
}
|
||
`;let aR=`${hT}
|
||
${EVe}`;const xVe=B7;gn.isInternetExplorer()||(aR=`#define CLIP_POLYLINE
|
||
${aR}`);function ea(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=ea.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,aR),this._fragmentShaderSource=A(e.fragmentShaderSource,xVe),this._renderState=Tr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(ea.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}}});ea.VERTEX_FORMAT=Fe.POSITION_ONLY;ea.prototype.getFragmentShaderSource=Tr.prototype.getFragmentShaderSource;ea.prototype.isTranslucent=Tr.prototype.isTranslucent;ea.prototype.getRenderState=Tr.prototype.getRenderState;const wVe=`attribute vec3 position3DHigh;
|
||
attribute vec3 position3DLow;
|
||
attribute vec3 prevPosition3DHigh;
|
||
attribute vec3 prevPosition3DLow;
|
||
attribute vec3 nextPosition3DHigh;
|
||
attribute vec3 nextPosition3DLow;
|
||
attribute vec2 expandAndWidth;
|
||
attribute vec2 st;
|
||
attribute float batchId;
|
||
|
||
varying float v_width;
|
||
varying vec2 v_st;
|
||
varying 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;
|
||
}
|
||
`;let cR=`${hT}
|
||
${wVe}`;const SVe=Oq;gn.isInternetExplorer()||(cR=`#define CLIP_POLYLINE
|
||
${cR}`);function Is(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=Is.VERTEX_FORMAT;this.material=l(e.material)?e.material:ze.fromType(ze.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,cR),this._fragmentShaderSource=A(e.fragmentShaderSource,SVe),this._renderState=Tr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Is.prototype,{vertexShaderSource:{get:function(){let e=this._vertexShaderSource;return this.material.shaderSource.search(/varying\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}}});Is.VERTEX_FORMAT=Fe.POSITION_AND_ST;Is.prototype.getFragmentShaderSource=Tr.prototype.getFragmentShaderSource;Is.prototype.isTranslucent=Tr.prototype.isTranslucent;Is.prototype.getRenderState=Tr.prototype.getRenderState;function yl(e){e=A(e,A.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;l(t)||(t=new Is),this.appearance=t,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,vo.BOTH),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this._debugShowShadowVolume=A(e.debugShowShadowVolume,!1),this._primitiveOptions={geometryInstances:void 0,appearance:void 0,vertexCacheOptimize:!1,interleave:A(e.interleave,!1),releaseGeometryInstances:A(e.releaseGeometryInstances,!0),allowPicking:A(e.allowPicking,!0),asynchronous:A(e.asynchronous,!0),compressVertices:!1,_createShaderProgramFunction:void 0,_createCommandsFunction:void 0,_updateAndQueueCommandsFunction:void 0},this._zIndex=void 0,this._ready=!1;const n=this;this._readyPromise=new Promise((i,o)=>{n._completeLoad=()=>{this._ready=!0,this.releaseGeometryInstances&&(this.geometryInstances=void 0);const r=this._error;l(r)?o(r):i(this)}}),this._primitive=void 0,this._sp=void 0,this._sp2D=void 0,this._spMorph=void 0,this._renderState=Xk(!1),this._renderState3DTiles=Xk(!0),this._renderStateMorph=et.fromCache({cull:{enabled:!0,face:Ho.FRONT},depthTest:{enabled:!0},blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(yl.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}}});yl.initializeTerrainHeights=function(){return lo.initialize()};function vVe(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()(SEe);s=Jt._appendShowToShader(o,s),s=Jt._appendDistanceDisplayConditionToShader(o,s),s=Jt._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(wEe);a=Jt._appendShowToShader(o,a),a=Jt._appendDistanceDisplayConditionToShader(o,a),a=Jt._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(EEe);const u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let d="",h="";l(n.material)?(h=l(n.material)?n.material.shaderSource:"",h.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&u.push("ANGLE_VARYING"),h.search(/varying\s+float\s+v_width;/g)!==-1&&u.push("WIDTH_VARYING")):d="PER_INSTANCE_COLOR",u.push(d);const m=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",d]:[d],g=new We({defines:u,sources:[s]}),p=new We({defines:m,sources:[h,c]});e._sp=Cn.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:p,attributeLocations:r});let y=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!l(y)){const C=new We({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});y=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:C,fragmentShaderSource:p,attributeLocations:r})}e._sp2D=y;let b=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!l(b)){const C=new We({defines:u.concat([`MAX_TERRAIN_HEIGHT ${lo._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()(xEe);const E=new We({defines:m,sources:[h,c]});b=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:C,fragmentShaderSource:E,attributeLocations:r})}e._spMorph=b}function Xk(e){return et.fromCache({cull:{enabled:!0},blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:gi.EQUAL,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},backFunction:gi.EQUAL,backOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK}})}function DVe(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const u=t instanceof ea?{}:n._uniforms,d=s._batchTable.getUniformMapCallback()(u);for(let h=0;h<a;h++){const m=s._va[h];let g=o[h];l(g)||(g=o[h]=new mt({owner:e,primitiveType:s._primitiveType})),g.vertexArray=m,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=d,g.pass=Ne.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const p=mt.shallowClone(g,g.derivedCommands.tileset);p.renderState=e._renderState3DTiles,p.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=p;const y=mt.shallowClone(g,g.derivedCommands.color2D);y.shaderProgram=e._sp2D,g.derivedCommands.color2D=y;const b=mt.shallowClone(p,p.derivedCommands.color2D);b.shaderProgram=e._sp2D,p.derivedCommands.color2D=b;const C=mt.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 Kk(e,t,n,i,o,r,s){n.mode===le.MORPHING?t=t.derivedCommands.colorMorph:n.mode!==le.SCENE3D&&(t=t.derivedCommands.color2D),t.modelMatrix=i,t.boundingVolume=r,t.cull=o,t.debugShowBoundingVolume=s,n.commandList.push(t)}function IVe(e,t,n,i,o,r,s){const a=e._primitive;Jt._updateBoundingVolumes(a,t,o);let c;t.mode===le.SCENE3D?c=a._boundingSphereWC:t.mode===le.COLUMBUS_VIEW?c=a._boundingSphereCV:t.mode===le.SCENE2D&&l(a._boundingSphere2D)?c=a._boundingSphere2D:l(a._boundingSphereMorph)&&(c=a._boundingSphereMorph);const u=t.mode===le.MORPHING,d=e.classificationType,h=d!==vo.CESIUM_3D_TILE,m=d!==vo.TERRAIN&&!u;let g;const p=t.passes;if(p.render||p.pick&&a.allowPicking){const y=n.length;for(let b=0;b<y;++b){const C=c[b];h&&(g=n[b],Kk(e,g,t,o,r,C,s)),m&&(g=n[b].derivedCommands.tileset,Kk(e,g,t,o,r,C,s))}}}yl.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!lo.initialized){if(!this.asynchronous)throw new x("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");yl.initializeTerrainHeights();return}let t;const n=this,i=this._primitiveOptions;if(!l(this._primitive)){const o=Array.isArray(this.geometryInstances)?this.geometryInstances:[this.geometryInstances],r=o.length,s=new Array(r);let a;for(t=0;t<r;++t)if(a=o[t].attributes,!l(a)||!l(a.color)){this._hasPerInstanceColors=!1;break}for(t=0;t<r;++t){const c=o[t];a={};const u=c.attributes;for(const d in u)u.hasOwnProperty(d)&&(a[d]=u[d]);l(a.width)||(a.width=new Kl({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,value:[c.geometry.width]})),c.geometry._scene3DOnly=e.scene3DOnly,Bf.setProjectionAndEllipsoid(c.geometry,e.mapProjection),s[t]=new ln({geometry:c.geometry,attributes:a,id:c.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(c,u,d){vVe(n,u,d)},i._createCommandsFunction=function(c,u,d,h,m,g,p){DVe(n,u,d,h,g,p)},i._updateAndQueueCommandsFunction=function(c,u,d,h,m,g,p,y){IVe(n,u,d,h,m,g,p)},this._primitive=new Jt(i),this._primitive.readyPromise.then(this._completeLoad)}if(this.appearance instanceof ea&&!this._hasPerInstanceColors)throw new x("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)};yl.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};yl.isSupported=function(e){return e.frameState.context.depthTexture};yl.prototype.isDestroyed=function(){return!1};yl.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,He(this)};const PVe=new j(1,1),OVe=!1,LVe=H.WHITE;function _0(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new Ke,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(_0.prototype,{isConstant:{get:function(){return Z.isConstant(this._image)&&Z.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:ye("image"),repeat:ye("repeat"),color:ye("color"),transparent:ye("transparent")});_0.prototype.getType=function(e){return"Image"};_0.prototype.getValue=function(e,t){return l(t)||(t={}),t.image=Z.getValueOrUndefined(this._image,e),t.repeat=Z.getValueOrClonedDefault(this._repeat,e,PVe,t.repeat),t.color=Z.getValueOrClonedDefault(this._color,e,LVe,t.color),Z.getValueOrDefault(this._transparent,e,OVe)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};_0.prototype.equals=function(e){return this===e||e instanceof _0&&Z.equals(this._image,e._image)&&Z.equals(this._repeat,e._repeat)&&Z.equals(this._color,e._color)&&Z.equals(this._transparent,e._transparent)};function BVe(e){if(e instanceof H)return new nn(e);if(typeof e=="string"||e instanceof Me||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new _0;return t.image=e,t}throw new x(`Unable to infer material type: ${e}`)}function wc(e,t){return ye(e,t,BVe)}function OC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(OC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),dimensions:ye("dimensions"),heightReference:ye("heightReference"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});OC.prototype.clone=function(e){return l(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 OC(this)};OC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.dimensions=A(this.dimensions,e.dimensions),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};const RVe={FIXED:0,INERTIAL:1},fa=Object.freeze(RVe);function tm(){x.throwInstantiationError()}Object.defineProperties(tm.prototype,{isConstant:{get:x.throwInstantiationError},definitionChanged:{get:x.throwInstantiationError},referenceFrame:{get:x.throwInstantiationError}});tm.prototype.getValue=x.throwInstantiationError;tm.prototype.getValueInReferenceFrame=x.throwInstantiationError;tm.prototype.equals=x.throwInstantiationError;const kP=new J;tm.convertToReferenceFrame=function(e,t,n,i,o){if(!l(t))return t;if(l(o)||(o=new f),n===i)return f.clone(t,o);let r=cn.computeIcrfToFixedMatrix(e,kP);if(l(r)||(r=cn.computeTemeToPseudoFixedMatrix(e,kP)),n===fa.INERTIAL)return J.multiplyByVector(r,t,o);if(n===fa.FIXED)return J.multiplyByVector(J.transpose(r,kP),t,o)};function Nf(e,t){this._definitionChanged=new Ke,this._value=f.clone(e),this._referenceFrame=A(t,fa.FIXED)}Object.defineProperties(Nf.prototype,{isConstant:{get:function(){return!l(this._value)||this._referenceFrame===fa.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});Nf.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,fa.FIXED,t)};Nf.prototype.setValue=function(e,t){let n=!1;f.equals(this._value,e)||(n=!0,this._value=f.clone(e)),l(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};Nf.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new x("time is required.");if(!l(t))throw new x("referenceFrame is required.");return tm.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};Nf.prototype.equals=function(e){return this===e||e instanceof Nf&&f.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};function LC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(LC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),positions:ye("positions"),width:ye("width"),height:ye("height"),heightReference:ye("heightReference"),extrudedHeight:ye("extrudedHeight"),extrudedHeightReference:ye("extrudedHeightReference"),cornerType:ye("cornerType"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition"),classificationType:ye("classificationType"),zIndex:ye("zIndex")});LC.prototype.clone=function(e){return l(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 LC(this)};LC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.width=A(this.width,e.width),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.cornerType=A(this.cornerType,e.cornerType),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function NVe(e){return e}function lR(e,t){return ye(e,t,NVe)}function BC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(BC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),length:ye("length"),topRadius:ye("topRadius"),bottomRadius:ye("bottomRadius"),heightReference:ye("heightReference"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),numberOfVerticalLines:ye("numberOfVerticalLines"),slices:ye("slices"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});BC.prototype.clone=function(e){return l(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 BC(this)};BC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.length=A(this.length,e.length),this.topRadius=A(this.topRadius,e.topRadius),this.bottomRadius=A(this.bottomRadius,e.bottomRadius),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=A(this.numberOfVerticalLines,e.numberOfVerticalLines),this.slices=A(this.slices,e.slices),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function RC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(RC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),semiMajorAxis:ye("semiMajorAxis"),semiMinorAxis:ye("semiMinorAxis"),height:ye("height"),heightReference:ye("heightReference"),extrudedHeight:ye("extrudedHeight"),extrudedHeightReference:ye("extrudedHeightReference"),rotation:ye("rotation"),stRotation:ye("stRotation"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),numberOfVerticalLines:ye("numberOfVerticalLines"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition"),classificationType:ye("classificationType"),zIndex:ye("zIndex")});RC.prototype.clone=function(e){return l(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 RC(this)};RC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.semiMajorAxis=A(this.semiMajorAxis,e.semiMajorAxis),this.semiMinorAxis=A(this.semiMinorAxis,e.semiMinorAxis),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=A(this.rotation,e.rotation),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.numberOfVerticalLines=A(this.numberOfVerticalLines,e.numberOfVerticalLines),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function NC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(NC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),radii:ye("radii"),innerRadii:ye("innerRadii"),minimumClock:ye("minimumClock"),maximumClock:ye("maximumClock"),minimumCone:ye("minimumCone"),maximumCone:ye("maximumCone"),heightReference:ye("heightReference"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),stackPartitions:ye("stackPartitions"),slicePartitions:ye("slicePartitions"),subdivisions:ye("subdivisions"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});NC.prototype.clone=function(e){return l(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 NC(this)};NC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.radii=A(this.radii,e.radii),this.innerRadii=A(this.innerRadii,e.innerRadii),this.minimumClock=A(this.minimumClock,e.minimumClock),this.maximumClock=A(this.maximumClock,e.maximumClock),this.minimumCone=A(this.minimumCone,e.minimumCone),this.maximumCone=A(this.maximumCone,e.maximumCone),this.heightReference=A(this.heightReference,e.heightReference),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.stackPartitions=A(this.stackPartitions,e.stackPartitions),this.slicePartitions=A(this.slicePartitions,e.slicePartitions),this.subdivisions=A(this.subdivisions,e.subdivisions),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function MC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(MC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),text:ye("text"),font:ye("font"),style:ye("style"),scale:ye("scale"),showBackground:ye("showBackground"),backgroundColor:ye("backgroundColor"),backgroundPadding:ye("backgroundPadding"),pixelOffset:ye("pixelOffset"),eyeOffset:ye("eyeOffset"),horizontalOrigin:ye("horizontalOrigin"),verticalOrigin:ye("verticalOrigin"),heightReference:ye("heightReference"),fillColor:ye("fillColor"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),translucencyByDistance:ye("translucencyByDistance"),pixelOffsetScaleByDistance:ye("pixelOffsetScaleByDistance"),scaleByDistance:ye("scaleByDistance"),distanceDisplayCondition:ye("distanceDisplayCondition"),disableDepthTestDistance:ye("disableDepthTestDistance")});MC.prototype.clone=function(e){return l(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 MC(this)};MC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.text=A(this.text,e.text),this.font=A(this.font,e.font),this.style=A(this.style,e.style),this.scale=A(this.scale,e.scale),this.showBackground=A(this.showBackground,e.showBackground),this.backgroundColor=A(this.backgroundColor,e.backgroundColor),this.backgroundPadding=A(this.backgroundPadding,e.backgroundPadding),this.pixelOffset=A(this.pixelOffset,e.pixelOffset),this.eyeOffset=A(this.eyeOffset,e.eyeOffset),this.horizontalOrigin=A(this.horizontalOrigin,e.horizontalOrigin),this.verticalOrigin=A(this.verticalOrigin,e.verticalOrigin),this.heightReference=A(this.heightReference,e.heightReference),this.fillColor=A(this.fillColor,e.fillColor),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.translucencyByDistance=A(this.translucencyByDistance,e.translucencyByDistance),this.pixelOffsetScaleByDistance=A(this.pixelOffsetScaleByDistance,e.pixelOffsetScaleByDistance),this.scaleByDistance=A(this.scaleByDistance,e.scaleByDistance),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this.disableDepthTestDistance,e.disableDepthTestDistance)};const MVe=new f(1,1,1),FVe=f.ZERO,zVe=Te.IDENTITY;function RD(e,t,n){this.translation=f.clone(A(e,FVe)),this.rotation=Te.clone(A(t,zVe)),this.scale=f.clone(A(n,MVe))}RD.prototype.equals=function(e){return this===e||l(e)&&f.equals(this.translation,e.translation)&&Te.equals(this.rotation,e.rotation)&&f.equals(this.scale,e.scale)};const GP=new RD;function FC(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new Ke,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(FC.prototype,{isConstant:{get:function(){return Z.isConstant(this._translation)&&Z.isConstant(this._rotation)&&Z.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:ye("translation"),rotation:ye("rotation"),scale:ye("scale")});FC.prototype.getValue=function(e,t){return l(t)||(t=new RD),t.translation=Z.getValueOrClonedDefault(this._translation,e,GP.translation,t.translation),t.rotation=Z.getValueOrClonedDefault(this._rotation,e,GP.rotation,t.rotation),t.scale=Z.getValueOrClonedDefault(this._scale,e,GP.scale,t.scale),t};FC.prototype.equals=function(e){return this===e||e instanceof FC&&Z.equals(this._translation,e._translation)&&Z.equals(this._rotation,e._rotation)&&Z.equals(this._scale,e._scale)};function Sc(e,t){this._propertyNames=[],this._definitionChanged=new Ke,l(e)&&this.merge(e,t)}Object.defineProperties(Sc.prototype,{propertyNames:{get:function(){return this._propertyNames}},isConstant:{get:function(){const e=this._propertyNames;for(let t=0,n=e.length;t<n;t++)if(!Z.isConstant(this[e[t]]))return!1;return!0}},definitionChanged:{get:function(){return this._definitionChanged}}});Sc.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function UVe(e){return new $o(e)}Sc.prototype.addProperty=function(e,t,n){const i=this._propertyNames;if(!l(e))throw new x("propertyName is required.");if(i.indexOf(e)!==-1)throw new x(`${e} is already a registered property.`);i.push(e),Object.defineProperty(this,e,ye(e,!0,A(n,UVe))),l(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};Sc.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!l(e))throw new x("propertyName is required.");if(n===-1)throw new x(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e],this._definitionChanged.raiseEvent(this)};Sc.prototype.getValue=function(e,t){if(!l(e))throw new x("time is required.");l(t)||(t={});const n=this._propertyNames;for(let i=0,o=n.length;i<o;i++){const r=n[i];t[r]=Z.getValueOrUndefined(this[r],e,t[r])}return t};Sc.prototype.merge=function(e,t){if(!l(e))throw new x("source is required.");const n=this._propertyNames,i=l(e._propertyNames)?e._propertyNames:Object.keys(e);for(let o=0,r=i.length;o<r;o++){const 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?l(a)&&l(a.merge)&&a.merge(c):l(c)&&l(c.merge)&&l(c.clone)?this[s]=c.clone():this[s]=c)}};function HVe(e,t){const n=e._propertyNames,i=t._propertyNames,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;++r){const s=n[r];if(i.indexOf(s)===-1||!Z.equals(e[s],t[s]))return!1}return!0}Sc.prototype.equals=function(e){return this===e||e instanceof Sc&&HVe(this,e)};function GX(e){return new FC(e)}function VVe(e){return new Sc(e,GX)}function kVe(e){return new Sc(e)}function zC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(zC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),uri:ye("uri"),scale:ye("scale"),minimumPixelSize:ye("minimumPixelSize"),maximumScale:ye("maximumScale"),incrementallyLoadTextures:ye("incrementallyLoadTextures"),runAnimations:ye("runAnimations"),clampAnimations:ye("clampAnimations"),shadows:ye("shadows"),heightReference:ye("heightReference"),silhouetteColor:ye("silhouetteColor"),silhouetteSize:ye("silhouetteSize"),color:ye("color"),colorBlendMode:ye("colorBlendMode"),colorBlendAmount:ye("colorBlendAmount"),imageBasedLightingFactor:ye("imageBasedLightingFactor"),lightColor:ye("lightColor"),distanceDisplayCondition:ye("distanceDisplayCondition"),nodeTransformations:ye("nodeTransformations",void 0,VVe),articulations:ye("articulations",void 0,kVe),clippingPlanes:ye("clippingPlanes"),customShader:ye("customShader")});zC.prototype.clone=function(e){return l(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 zC(this)};zC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.uri=A(this.uri,e.uri),this.scale=A(this.scale,e.scale),this.minimumPixelSize=A(this.minimumPixelSize,e.minimumPixelSize),this.maximumScale=A(this.maximumScale,e.maximumScale),this.incrementallyLoadTextures=A(this.incrementallyLoadTextures,e.incrementallyLoadTextures),this.runAnimations=A(this.runAnimations,e.runAnimations),this.clampAnimations=A(this.clampAnimations,e.clampAnimations),this.shadows=A(this.shadows,e.shadows),this.heightReference=A(this.heightReference,e.heightReference),this.silhouetteColor=A(this.silhouetteColor,e.silhouetteColor),this.silhouetteSize=A(this.silhouetteSize,e.silhouetteSize),this.color=A(this.color,e.color),this.colorBlendMode=A(this.colorBlendMode,e.colorBlendMode),this.colorBlendAmount=A(this.colorBlendAmount,e.colorBlendAmount),this.imageBasedLightingFactor=A(this.imageBasedLightingFactor,e.imageBasedLightingFactor),this.lightColor=A(this.lightColor,e.lightColor),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.clippingPlanes=A(this.clippingPlanes,e.clippingPlanes),this.customShader=A(this.customShader,e.customShader);const t=e.nodeTransformations;if(l(t)){const i=this.nodeTransformations;l(i)?i.merge(t):this.nodeTransformations=new Sc(t,GX)}const n=e.articulations;if(l(n)){const i=this.articulations;l(i)?i.merge(n):this.articulations=new Sc(n)}};function UC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(UC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),uri:ye("uri"),maximumScreenSpaceError:ye("maximumScreenSpaceError")});UC.prototype.clone=function(e){return l(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new UC(this)};UC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.uri=A(this.uri,e.uri),this.maximumScreenSpaceError=A(this.maximumScreenSpaceError,e.maximumScreenSpaceError)};function g0(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(g0.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),leadTime:ye("leadTime"),trailTime:ye("trailTime"),width:ye("width"),resolution:ye("resolution"),material:wc("material"),distanceDisplayCondition:ye("distanceDisplayCondition")});g0.prototype.clone=function(e){return l(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 g0(this)};g0.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.leadTime=A(this.leadTime,e.leadTime),this.trailTime=A(this.trailTime,e.trailTime),this.width=A(this.width,e.width),this.resolution=A(this.resolution,e.resolution),this.material=A(this.material,e.material),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function HC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(HC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),plane:ye("plane"),dimensions:ye("dimensions"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});HC.prototype.clone=function(e){return l(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 HC(this)};HC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.plane=A(this.plane,e.plane),this.dimensions=A(this.dimensions,e.dimensions),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function VC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(VC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),pixelSize:ye("pixelSize"),heightReference:ye("heightReference"),color:ye("color"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),scaleByDistance:ye("scaleByDistance"),translucencyByDistance:ye("translucencyByDistance"),distanceDisplayCondition:ye("distanceDisplayCondition"),disableDepthTestDistance:ye("disableDepthTestDistance")});VC.prototype.clone=function(e){return l(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 VC(this)};VC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.pixelSize=A(this.pixelSize,e.pixelSize),this.heightReference=A(this.heightReference,e.heightReference),this.color=A(this.color,e.color),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.scaleByDistance=A(this.scaleByDistance,e.scaleByDistance),this.translucencyByDistance=A(this._translucencyByDistance,e.translucencyByDistance),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.disableDepthTestDistance=A(this.disableDepthTestDistance,e.disableDepthTestDistance)};function GVe(e,t){this.positions=l(e)?e:[],this.holes=l(t)?t:[]}function WVe(e){return Array.isArray(e)&&(e=new GVe(e)),new $o(e)}function kC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(kC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),hierarchy:ye("hierarchy",void 0,WVe),height:ye("height"),heightReference:ye("heightReference"),extrudedHeight:ye("extrudedHeight"),extrudedHeightReference:ye("extrudedHeightReference"),stRotation:ye("stRotation"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),perPositionHeight:ye("perPositionHeight"),closeTop:ye("closeTop"),closeBottom:ye("closeBottom"),arcType:ye("arcType"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition"),classificationType:ye("classificationType"),zIndex:ye("zIndex"),textureCoordinates:ye("textureCoordinates")});kC.prototype.clone=function(e){return l(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 kC(this)};kC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.hierarchy=A(this.hierarchy,e.hierarchy),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.perPositionHeight=A(this.perPositionHeight,e.perPositionHeight),this.closeTop=A(this.closeTop,e.closeTop),this.closeBottom=A(this.closeBottom,e.closeBottom),this.arcType=A(this.arcType,e.arcType),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex),this.textureCoordinates=A(this.textureCoordinates,e.textureCoordinates)};function GC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(GC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),positions:ye("positions"),width:ye("width"),granularity:ye("granularity"),material:wc("material"),depthFailMaterial:wc("depthFailMaterial"),arcType:ye("arcType"),clampToGround:ye("clampToGround"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition"),classificationType:ye("classificationType"),zIndex:ye("zIndex")});GC.prototype.clone=function(e){return l(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 GC(this)};GC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.width=A(this.width,e.width),this.granularity=A(this.granularity,e.granularity),this.material=A(this.material,e.material),this.depthFailMaterial=A(this.depthFailMaterial,e.depthFailMaterial),this.arcType=A(this.arcType,e.arcType),this.clampToGround=A(this.clampToGround,e.clampToGround),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function WC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(WC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),positions:ye("positions"),shape:ye("shape"),cornerType:ye("cornerType"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});WC.prototype.clone=function(e){return l(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 WC(this)};WC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.shape=A(this.shape,e.shape),this.cornerType=A(this.cornerType,e.cornerType),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};function jC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(jC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),coordinates:ye("coordinates"),height:ye("height"),heightReference:ye("heightReference"),extrudedHeight:ye("extrudedHeight"),extrudedHeightReference:ye("extrudedHeightReference"),rotation:ye("rotation"),stRotation:ye("stRotation"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition"),classificationType:ye("classificationType"),zIndex:ye("zIndex")});jC.prototype.clone=function(e){return l(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 jC(this)};jC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.coordinates=A(this.coordinates,e.coordinates),this.height=A(this.height,e.height),this.heightReference=A(this.heightReference,e.heightReference),this.extrudedHeight=A(this.extrudedHeight,e.extrudedHeight),this.extrudedHeightReference=A(this.extrudedHeightReference,e.extrudedHeightReference),this.rotation=A(this.rotation,e.rotation),this.stRotation=A(this.stRotation,e.stRotation),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition),this.classificationType=A(this.classificationType,e.classificationType),this.zIndex=A(this.zIndex,e.zIndex)};function qC(e){this._definitionChanged=new Ke,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(A(e,A.EMPTY_OBJECT))}Object.defineProperties(qC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ye("show"),positions:ye("positions"),minimumHeights:ye("minimumHeights"),maximumHeights:ye("maximumHeights"),granularity:ye("granularity"),fill:ye("fill"),material:wc("material"),outline:ye("outline"),outlineColor:ye("outlineColor"),outlineWidth:ye("outlineWidth"),shadows:ye("shadows"),distanceDisplayCondition:ye("distanceDisplayCondition")});qC.prototype.clone=function(e){return l(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 qC(this)};qC.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.show=A(this.show,e.show),this.positions=A(this.positions,e.positions),this.minimumHeights=A(this.minimumHeights,e.minimumHeights),this.maximumHeights=A(this.maximumHeights,e.maximumHeights),this.granularity=A(this.granularity,e.granularity),this.fill=A(this.fill,e.fill),this.material=A(this.material,e.material),this.outline=A(this.outline,e.outline),this.outlineColor=A(this.outlineColor,e.outlineColor),this.outlineWidth=A(this.outlineWidth,e.outlineWidth),this.shadows=A(this.shadows,e.shadows),this.distanceDisplayCondition=A(this.distanceDisplayCondition,e.distanceDisplayCondition)};const jVe=new Ce;function qVe(e){return new Nf(e)}function $Ve(e){return ye(e,void 0,qVe)}function ts(e,t){return ye(e,void 0,function(n){return n instanceof t?n:new t(n)})}function Nr(e){e=A(e,A.EMPTY_OBJECT);let t=e.id;l(t)||(t=Ms()),this._availability=void 0,this._id=t,this._definitionChanged=new Ke,this._name=e.name,this._show=A(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 uR(e,t,n){const i=t.length;for(let o=0;o<i;o++){const r=t[o],s=r._show;(!n&&s)!==(n&&s)&&uR(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(Nr.prototype,{availability:lR("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:lR("name"),show:{get:function(){return this._show},set:function(e){if(!l(e))throw new x("value is required.");if(e===this._show)return;const t=this.isShowing;this._show=e;const n=this.isShowing;t!==n&&uR(this,this._children,n),this._definitionChanged.raiseEvent(this,"show",e,!e)}},isShowing:{get:function(){return this._show&&(!l(this.entityCollection)||this.entityCollection.show)&&(!l(this._parent)||this._parent.isShowing)}},parent:{get:function(){return this._parent},set:function(e){const t=this._parent;if(t===e)return;const n=this.isShowing;if(l(t)){const o=t._children.indexOf(this);t._children.splice(o,1)}this._parent=e,l(e)&&e._children.push(this);const i=this.isShowing;n!==i&&uR(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:ts("billboard",PC),box:ts("box",OC),corridor:ts("corridor",LC),cylinder:ts("cylinder",BC),description:ye("description"),ellipse:ts("ellipse",RC),ellipsoid:ts("ellipsoid",NC),label:ts("label",MC),model:ts("model",zC),tileset:ts("tileset",UC),orientation:ye("orientation"),path:ts("path",g0),plane:ts("plane",HC),point:ts("point",VC),polygon:ts("polygon",kC),polyline:ts("polyline",GC),polylineVolume:ts("polylineVolume",WC),properties:ts("properties",Sc),position:$Ve("position"),rectangle:ts("rectangle",jC),viewFrom:ye("viewFrom"),wall:ts("wall",qC)});Nr.prototype.isAvailable=function(e){if(!l(e))throw new x("time is required.");const t=this._availability;return!l(t)||t.contains(e)};Nr.prototype.addProperty=function(e){const t=this._propertyNames;if(!l(e))throw new x("propertyName is required.");if(t.indexOf(e)!==-1)throw new x(`${e} is already a registered property.`);if(e in this)throw new x(`${e} is a reserved property name.`);t.push(e),Object.defineProperty(this,e,lR(e,!0))};Nr.prototype.removeProperty=function(e){const n=this._propertyNames.indexOf(e);if(!l(e))throw new x("propertyName is required.");if(n===-1)throw new x(`${e} is not a registered property.`);this._propertyNames.splice(n,1),delete this[e]};Nr.prototype.merge=function(e){if(!l(e))throw new x("source is required.");this.name=A(this.name,e.name),this.availability=A(this.availability,e.availability);const t=this._propertyNames,n=l(e._propertyNames)?e._propertyNames:Object.keys(e),i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r==="parent"||r==="name"||r==="availability")continue;const s=this[r],a=e[r];!l(s)&&t.indexOf(r)===-1&&this.addProperty(r),l(a)&&(l(s)?l(s.merge)&&s.merge(a):l(a.merge)&&l(a.clone)?this[r]=a.clone():this[r]=a)}};const WX=new J,jX=new f,qX=new Te;Nr.prototype.computeModelMatrix=function(e,t){T.typeOf.object("time",e);const n=Z.getValueOrUndefined(this._position,e,jX);if(!l(n))return;const i=Z.getValueOrUndefined(this._orientation,e,qX);return l(i)?t=B.fromRotationTranslation(J.fromQuaternion(i,WX),n,t):t=cn.eastNorthUpToFixedFrame(n,void 0,t),t};Nr.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){T.typeOf.object("time",e);const r=Z.getValueOrDefault(t,e,St.NONE);let s=Z.getValueOrUndefined(this._position,e,jX);if(r===St.NONE||!l(s)||f.equalsEpsilon(s,f.ZERO,M.EPSILON8))return this.computeModelMatrix(e,o);const a=i.cartesianToCartographic(s,jVe);r===St.CLAMP_TO_GROUND?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);const c=Z.getValueOrUndefined(this._orientation,e,qX);return l(c)?o=B.fromRotationTranslation(J.fromQuaternion(c,WX),s,o):o=cn.eastNorthUpToFixedFrame(s,void 0,o),o};Nr.supportsMaterialsforEntitiesOnTerrain=function(e){return $r.supportsMaterials(e)};Nr.supportsPolylinesOnTerrain=function(e){return yl.isSupported(e)};const YVe=new nn(H.WHITE),XVe=new $o(!0),KVe=new $o(!0),JVe=new $o(!1),QVe=new $o(H.BLACK),ZVe=new $o(Po.DISABLED),eke=new $o(new jt),tke=new $o(vo.BOTH);function Wn(e){T.defined("options.entity",e.entity),T.defined("options.scene",e.scene),T.defined("options.geometryOptions",e.geometryOptions),T.defined("options.geometryPropertyName",e.geometryPropertyName),T.defined("options.observedPropertyNames",e.observedPropertyNames);const 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 Ke,this._showProperty=void 0,this._materialProperty=void 0,this._showOutlineProperty=void 0,this._outlineColorProperty=void 0,this._outlineWidth=1,this._shadowsProperty=void 0,this._distanceDisplayConditionProperty=void 0,this._classificationTypeProperty=void 0,this._options=e.geometryOptions,this._geometryPropertyName=n,this._id=`${n}-${t.id}`,this._observedPropertyNames=e.observedPropertyNames,this._supportsMaterialsforEntitiesOnTerrain=Nr.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(Wn.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||!l(this._entity.availability)&&Z.isConstant(this._showProperty)&&Z.isConstant(this._fillProperty)}},fillMaterialProperty:{get:function(){return this._materialProperty}},outlineEnabled:{get:function(){return this._outlineEnabled}},hasConstantOutline:{get:function(){return!this._outlineEnabled||!l(this._entity.availability)&&Z.isConstant(this._showProperty)&&Z.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}}});Wn.prototype.isOutlineVisible=function(e){const t=this._entity,n=this._outlineEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e);return A(n,!1)};Wn.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e);return A(n,!1)};Wn.prototype.createFillGeometryInstance=x.throwInstantiationError;Wn.prototype.createOutlineGeometryInstance=x.throwInstantiationError;Wn.prototype.isDestroyed=function(){return!1};Wn.prototype.destroy=function(){He(this)};Wn.prototype._isHidden=function(e,t){const n=t.show;return l(n)&&n.isConstant&&!n.getValue(ft.MINIMUM_VALUE)};Wn.prototype._isOnTerrain=function(e,t){return!1};Wn.prototype._getIsClosed=function(e){return!0};Wn.prototype._isDynamic=x.throwInstantiationError;Wn.prototype._setStaticOptions=x.throwInstantiationError;Wn.prototype._onEntityPropertyChanged=function(e,t,n,i){if(this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.fill,s=l(r)&&r.isConstant?r.getValue(ft.MINIMUM_VALUE):!0,a=o.outline;let c=l(a);if(c&&a.isConstant&&(c=a.getValue(ft.MINIMUM_VALUE)),!s&&!c){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}const u=o.show;if(this._isHidden(e,o)){(this._fillEnabled||this._outlineEnabled)&&(this._fillEnabled=!1,this._outlineEnabled=!1,this._geometryChanged.raiseEvent(this));return}this._materialProperty=A(o.material,YVe),this._fillProperty=A(r,KVe),this._showProperty=A(u,XVe),this._showOutlineProperty=A(o.outline,JVe),this._outlineColorProperty=c?A(o.outlineColor,QVe):void 0,this._shadowsProperty=A(o.shadows,ZVe),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,eke),this._classificationTypeProperty=A(o.classificationType,tke),this._fillEnabled=s;const d=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof nn);if(c&&d&&(ki(ki.geometryOutlines),c=!1),this._onTerrain=d,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);const h=o.outlineWidth;this._outlineWidth=l(h)?h.getValue(ft.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Wn.prototype.createDynamicUpdater=function(e,t){if(T.defined("primitives",e),T.defined("groundPrimitives",t),!this._dynamic)throw new x("This instance does not represent dynamic geometry.");return new this.constructor.DynamicGeometryUpdater(this,e,t)};function O_(e,t){this._callback=void 0,this._isConstant=void 0,this._definitionChanged=new Ke,this.setCallback(e,t)}Object.defineProperties(O_.prototype,{isConstant:{get:function(){return this._isConstant}},definitionChanged:{get:function(){return this._definitionChanged}}});O_.prototype.getValue=function(e,t){return this._callback(e,t)};O_.prototype.setCallback=function(e,t){if(!l(e))throw new x("callback is required.");if(!l(t))throw new x("isConstant is required.");const n=this._callback!==e||this._isConstant!==t;this._callback=e,this._isConstant=t,n&&this._definitionChanged.raiseEvent(this)};O_.prototype.equals=function(e){return this===e||e instanceof O_&&this._callback===e._callback&&this._isConstant===e._isConstant};const $X=new f,nke=new Ce;function dg(e,t,n,i){T.defined("scene",e),T.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new f,this._cartographicPosition=new Ce,this._normal=new f,this._definitionChanged=new Ke,this._terrainHeight=0,this._removeCallbackFunc=void 0,this._removeEventListener=void 0,this._removeModeListener=void 0;const o=this;if(l(e.globe)&&(this._removeEventListener=e.terrainProviderChanged.addEventListener(function(){o._updateClamping()}),this._removeModeListener=e.morphComplete.addEventListener(function(){o._updateClamping()})),t.isConstant){const r=t.getValue(ft.MINIMUM_VALUE,$X);if(!l(r)||f.equals(r,f.ZERO)||!l(e.globe))return;this._position=f.clone(r,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(dg.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});dg.prototype._updateClamping=function(){l(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(!l(t)||f.equals(n,f.ZERO)){this._terrainHeight=0;return}const i=t.ellipsoid,o=t._surface,r=this,s=i.cartesianToCartographic(n,this._cartographicPosition),a=t.getHeight(s);l(a)?this._terrainHeight=a:this._terrainHeight=0;function c(u){if(e.mode===le.SCENE3D){const d=i.cartesianToCartographic(u,nke);r._terrainHeight=d.height}else r._terrainHeight=u.x;r.definitionChanged.raiseEvent()}this._removeCallbackFunc=o.updateHeight(s,c)};dg.prototype.getValue=function(e,t){const n=Z.getValueOrDefault(this._heightReference,e,St.NONE),i=Z.getValueOrDefault(this._extrudedHeightReference,e,St.NONE);if(n===St.NONE&&i!==St.RELATIVE_TO_GROUND)return this._position=f.clone(f.ZERO,this._position),f.clone(f.ZERO,t);if(this._positionProperty.isConstant)return f.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,$X);if(!l(r)||f.equals(r,f.ZERO)||!l(o.globe))return f.clone(f.ZERO,t);if(f.equalsEpsilon(this._position,r,M.EPSILON10))return f.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=f.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return f.multiplyByScalar(s,this._terrainHeight,t)};dg.prototype.isDestroyed=function(){return!1};dg.prototype.destroy=function(){return l(this._removeEventListener)&&this._removeEventListener(),l(this._removeModeListener)&&this._removeModeListener(),l(this._removeCallbackFunc)&&this._removeCallbackFunc(),He(this)};function S2(e,t,n,i){if(Wn.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o))return;l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference;if(l(r)){const s=new O_(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new dg(this._scene,s,r)}}const YX=f.ZERO,XX=new f,ike=new f,KX=new H;function oke(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function _c(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new oke(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}l(Object.create)&&(_c.prototype=Object.create(Wn.prototype),_c.prototype.constructor=_c);Object.defineProperties(_c.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});_c.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Ii.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof nn){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,KX)),l(a)||(a=H.WHITE),s.color=pn.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,YX,XX))),new ln({id:t,geometry:qr.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};_c.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,KX),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,YX,XX))),new ln({id:t,geometry:Tc.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};_c.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};_c.prototype._isHidden=function(e,t){return!l(t.dimensions)||!l(e.position)||Wn.prototype._isHidden.call(this,e,t)};_c.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.dimensions.isConstant||!Z.isConstant(t.outlineWidth)};_c.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof nn?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(ft.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==St.NONE?yn.ALL:void 0};_c.prototype._onEntityPropertyChanged=S2;_c.DynamicGeometryUpdater=Uy;function Uy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Uy.prototype=Object.create(yi.prototype),Uy.prototype.constructor=Uy);Uy.prototype._isHidden=function(e,t,n){const i=Z.getValueOrUndefined(e.position,n,ike),o=this._options.dimensions;return!l(i)||!l(o)||yi.prototype._isHidden.call(this,e,t,n)};Uy.prototype._setOptions=function(e,t,n){const i=Z.getValueOrDefault(t.heightReference,n,St.NONE),o=this._options;o.dimensions=Z.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==St.NONE?yn.ALL:void 0};function z0(e){e=A(e,A.EMPTY_OBJECT);const t=l(e.imageBasedLightingFactor)?j.clone(e.imageBasedLightingFactor):new j(1,1);T.typeOf.object("options.imageBasedLightingFactor",t),T.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),T.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),T.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),T.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;const n=A(e.luminanceAtZenith,.2);T.typeOf.number("options.luminanceAtZenith",n),this._luminanceAtZenith=n;const i=e.sphericalHarmonicCoefficients;if(l(i)&&(!Array.isArray(i)||i.length!==9))throw new x("options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");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=j.clone(t),this._previousLuminanceAtZenith=n,this._previousSphericalHarmonicCoefficients=i}Object.defineProperties(z0.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){T.typeOf.object("imageBasedLightingFactor",e),T.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),T.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),T.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),T.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.y",e.y,1),this._previousImageBasedLightingFactor=j.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor),this._imageBasedLightingFactor=j.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){if(l(e)&&(!Array.isArray(e)||e.length!==9))throw new x("sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values.");this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients,this._sphericalHarmonicCoefficients=e}},specularEnvironmentMaps:{get:function(){return this._specularEnvironmentMaps},set:function(e){e!==this._specularEnvironmentMaps&&(this._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 l(this._sphericalHarmonicCoefficients)||this._useDefaultSphericalHarmonics}},specularEnvironmentMapAtlas:{get:function(){return this._specularEnvironmentMapAtlas}},useDefaultSpecularMaps:{get:function(){return this._useDefaultSpecularMaps}},useSpecularEnvironmentMaps:{get:function(){return l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.ready||this._useDefaultSpecularMaps}}});function rke(e,t){if(hu.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),l(e._specularEnvironmentMaps)){const n=new hu(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,n.readyPromise.then(function(){e._specularEnvironmentMapLoaded=!0}).catch(function(i){console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}z0.prototype.update=function(e){if(e.frameNumber===this._previousFrameNumber)return;this._previousFrameNumber=e.frameNumber;const t=e.context;e.brdfLutGenerator.update(e),this._shouldRegenerateShaders=!1;const n=this._imageBasedLightingFactor,i=this._previousImageBasedLightingFactor;j.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=j.clone(this._imageBasedLightingFactor,this._previousImageBasedLightingFactor)),this._luminanceAtZenith!==this._previousLuminanceAtZenith&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||l(this._luminanceAtZenith)!==l(this._previousLuminanceAtZenith),this._previousLuminanceAtZenith=this._luminanceAtZenith),this._previousSphericalHarmonicCoefficients!==this._sphericalHarmonicCoefficients&&(this._shouldRegenerateShaders=this._shouldRegenerateShaders||l(this._previousSphericalHarmonicCoefficients)!==l(this._sphericalHarmonicCoefficients),this._previousSphericalHarmonicCoefficients=this._sphericalHarmonicCoefficients),this._shouldRegenerateShaders=this._shouldRegenerateShaders||this._previousSpecularEnvironmentMapLoaded!==this._specularEnvironmentMapLoaded,this._previousSpecularEnvironmentMapLoaded=this._specularEnvironmentMapLoaded,this._specularEnvironmentMapAtlasDirty&&(rke(this,t),this._specularEnvironmentMapAtlasDirty=!1),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e);const o=!l(this._specularEnvironmentMapAtlas)&&l(e.specularEnvironmentMaps)&&!this._useDefaultSpecularMaps,r=!l(e.specularEnvironmentMaps)&&this._useDefaultSpecularMaps,s=!l(this._sphericalHarmonicCoefficients)&&l(e.sphericalHarmonicCoefficients)&&!this._useDefaultSphericalHarmonics,a=!l(e.sphericalHarmonicCoefficients)&&this._useDefaultSphericalHarmonics;this._shouldRegenerateShaders=this._shouldRegenerateShaders||o||r||s||a,this._useDefaultSpecularMaps=!l(this._specularEnvironmentMapAtlas)&&l(e.specularEnvironmentMaps),this._useDefaultSphericalHarmonics=!l(this._sphericalHarmonicCoefficients)&&l(e.sphericalHarmonicCoefficients)};z0.prototype.isDestroyed=function(){return!1};z0.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),He(this)};function v2(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(v2.prototype,{metadata:{get:function(){return this._metadata}}});function lc(e,t,n){if(!l(e))throw new x("uint8Array is required.");if(t<0)throw new x("byteOffset cannot be negative.");if(n<0)throw new x("byteLength cannot be negative.");if(t+n>e.byteLength)throw new x("sub-region exceeds array bounds.");return t=A(t,0),n=A(n,e.byteLength-t),e=e.subarray(t,t+n),lc.decode(e)}lc.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};lc.decodeWithFromCharCode=function(e){let t="";const n=ske(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 OA(e,t,n){return t<=e&&e<=n}function ske(e){let t=0,n=0,i=0,o=128,r=191;const s=[],a=e.length;for(let c=0;c<a;++c){const u=e[c];if(i===0){if(OA(u,0,127)){s.push(u);continue}if(OA(u,194,223)){i=1,t=u&31;continue}if(OA(u,224,239)){u===224&&(o=160),u===237&&(r=159),i=2,t=u&15;continue}if(OA(u,240,244)){u===240&&(o=144),u===244&&(r=143),i=3,t=u&7;continue}throw new Ie("String decoding failed.")}if(!OA(u,o,r)){t=i=n=0,o=128,r=191,--c;continue}o=128,r=191,t=t<<6|u&63,++n,n===i&&(s.push(t),t=i=n=0)}return s}typeof TextDecoder<"u"?lc.decode=lc.decodeWithTextDecoder:lc.decode=lc.decodeWithFromCharCode;function ND(e,t){return t=A(t,0),lc(e,t,Math.min(4,e.length))}function Kf(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=ake(this,i,o,r)}Object.defineProperties(Kf.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const 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;const 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;const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].group=e}}});const LA=Uint32Array.BYTES_PER_ELEMENT;function ake(e,t,n,i){n=A(n,0);const o=new Uint8Array(t),r=new DataView(t);n+=LA;const s=r.getUint32(n,!0);if(s!==1)throw new Ie(`Only Composite Tile version 1 is supported. Version ${s} is not.`);n+=LA,n+=LA;const a=r.getUint32(n,!0);n+=LA;const c=[],u=e._resource;let d=u.queryParameters.compositeIndex;l(d)?d=`${d}_`:d="";for(let h=0;h<a;++h){const m=ND(o,n),g=r.getUint32(n+LA*2,!0),p=i[m],y=`${d}${h}`,b=u.getDerivedResource({queryParameters:{compositeIndex:y}});if(l(p)){const C=p(e._tileset,e._tile,b,t,n);e._contents.push(C),c.push(C.readyPromise)}else throw new Ie(`Unknown tile content type, ${m}, inside Composite tile`);n+=g}return Promise.all(c).then(function(){return e})}Kf.prototype.hasProperty=function(e,t){return!1};Kf.prototype.getFeature=function(e){};Kf.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Kf.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Kf.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};Kf.prototype.isDestroyed=function(){return!1};Kf.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};function Ya(e,t,n){return JSON.parse(lc(e,t,n))}function wo(e){T.typeOf.number("options.featuresLength",e.featuresLength),T.typeOf.object("options.owner",e.owner),this._id=Ms();const 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){const o=Math.min(t,It.maximumTextureSize),r=Math.ceil(t/It.maximumTextureSize),s=1/o,a=s*.5,c=1/r,u=c*.5;n=new j(o,r),i=new oe(s,a,c,u)}this._translucentFeaturesLength=0,this._featuresLength=t,this._textureDimensions=n,this._textureStep=i,this._owner=e.owner,this._statistics=e.statistics,this._colorChangedCallback=e.colorChangedCallback}Object.defineProperties(wo.prototype,{translucentFeaturesLength:{get:function(){return this._translucentFeaturesLength}},byteLength:{get:function(){let e=0;return l(this._pickTexture)&&(e+=this._pickTexture.sizeInBytes),l(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}}});wo.DEFAULT_COLOR_VALUE=H.WHITE;wo.DEFAULT_SHOW_VALUE=!0;function JX(e){const t=e._textureDimensions;return t.x*t.y*4}function QX(e){if(!l(e._batchValues)){const t=JX(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function ZX(e){if(!l(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function DT(e,t){if(!l(e)||e<0||e>=t)throw new x(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}wo.prototype.setShow=function(e,t){if(DT(e,this._featuresLength),T.typeOf.bool("show",t),t&&!l(this._showAlphaProperties))return;const n=ZX(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;const r=QX(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};wo.prototype.setAllShow=function(e){T.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};wo.prototype.getShow=function(e){if(DT(e,this._featuresLength),!l(this._showAlphaProperties))return!0;const t=e*2;return this._showAlphaProperties[t]===255};const cke=new Array(4);wo.prototype.setColor=function(e,t){if(DT(e,this._featuresLength),T.typeOf.object("color",t),H.equals(t,wo.DEFAULT_COLOR_VALUE)&&!l(this._batchValues))return;const n=t.toBytes(cke),i=n[3],o=QX(this),r=e*4,s=ZX(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];const c=s[a+1]!==255,u=s[a]!==0;o[r+3]=u?i:0,s[a+1]=i;const d=i!==255;d&&!c?++this._translucentFeaturesLength:!d&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,l(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};wo.prototype.setAllColor=function(e){T.typeOf.object("color",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};wo.prototype.getColor=function(e,t){if(DT(e,this._featuresLength),T.typeOf.object("result",t),!l(this._batchValues))return H.clone(wo.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return H.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};wo.prototype.getPickColor=function(e){return DT(e,this._featuresLength),this._pickIds[e]};function eK(e,t,n){const i=e._textureDimensions;return new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:ii.NEAREST})}function lke(e,t){const n=e._featuresLength;if(!l(e._pickTexture)&&n>0){const i=e._pickIds,o=JX(e),r=new Uint8Array(o),s=e._owner,a=e._statistics;for(let c=0;c<n;++c){const u=t.createPickId(s.getFeature(c));i.push(u);const d=u.color,h=c*4;r[h]=H.floatToByte(d.red),r[h+1]=H.floatToByte(d.green),r[h+2]=H.floatToByte(d.blue),r[h+3]=H.floatToByte(d.alpha)}e._pickTexture=eK(e,t,r),l(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function uke(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}wo.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&lke(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,l(this._batchTexture)||(this._batchTexture=eK(this,n,this._batchValues),l(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),uke(this))};wo.prototype.isDestroyed=function(){return!1};wo.prototype.destroy=function(){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),this._pickTexture=this._pickTexture&&this._pickTexture.destroy();const e=this._pickIds,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const dke={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fke={SCALAR:void 0,VEC2:j,VEC3:f,VEC4:oe,MAT2:dt,MAT3:J,MAT4:B};function p_(e){const t=e.componentType;let n;typeof t=="string"?n=ee.fromName(t):n=t;const i=dke[e.type],o=fke[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return ee.createArrayBufferView(n,r,s,i*a)}}}function vd(e){this._classes=void 0,this._classIds=void 0,this._classIndexes=void 0,this._parentCounts=void 0,this._parentIndexes=void 0,this._parentIds=void 0,this._byteLength=0,T.typeOf.object("options.extension",e.extension),hke(this,e.extension,e.binaryBody),gke(this)}Object.defineProperties(vd.prototype,{byteLength:{get:function(){return this._byteLength}}});function hke(e,t,n){let i,o,r;const s=t.instancesLength,a=t.classes;let c=t.classIds,u=t.parentCounts,d=t.parentIds,h=s,m=0;l(c.byteOffset)&&(c.componentType=A(c.componentType,ee.UNSIGNED_SHORT),c.type=_n.SCALAR,r=p_(c),c=r.createArrayBufferView(n.buffer,n.byteOffset+c.byteOffset,s),m+=c.byteLength);let g;if(l(u)){for(l(u.byteOffset)&&(u.componentType=A(u.componentType,ee.UNSIGNED_SHORT),u.type=_n.SCALAR,r=p_(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),m+=u.byteLength),g=new Uint16Array(s),h=0,i=0;i<s;++i)g[i]=h,h+=u[i];m+=g.byteLength}l(d)&&l(d.byteOffset)&&(d.componentType=A(d.componentType,ee.UNSIGNED_SHORT),d.type=_n.SCALAR,r=p_(d),d=r.createArrayBufferView(n.buffer,n.byteOffset+d.byteOffset,h),m+=d.byteLength);const p=a.length;for(i=0;i<p;++i){const C=a[i].length,E=a[i].instances,w=pke(C,E,n);m+=mke(w),a[i].instances=hn(w,E)}const y=new Array(p).fill(0),b=new Uint16Array(s);for(i=0;i<s;++i)o=c[i],b[i]=y[o],++y[o];m+=b.byteLength,e._classes=a,e._classIds=c,e._classIndexes=b,e._parentCounts=u,e._parentIndexes=g,e._parentIds=d,e._byteLength=m}function pke(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(l(s)){const a=r.componentType,c=r.type;if(!l(a))throw new Ie("componentType is required.");if(!l(c))throw new Ie("type is required.");if(!l(n))throw new Ie(`Property ${o} requires a batch table binary.`);const u=p_(r),d=u.componentsPerAttribute,h=u.classType,m=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:m,componentCount:d,type:h}}}return i}function mke(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}const _ke=[];function gke(e){const t=_ke;t.length=0;const i=e._classIds.length;for(let o=0;o<i;++o)tK(e,o,t)}function tK(e,t,n){const i=e._parentCounts,o=e._parentIds,r=e._parentIndexes,a=e._classIds.length;if(!l(o))return;if(t>=a)throw new x(`Parent index ${t} exceeds the total number of instances: ${a}`);if(n.indexOf(t)>-1)throw new x("Circular dependency detected in the batch table hierarchy.");n.push(t);const c=l(i)?i[t]:1,u=l(i)?r[t]:t;for(let d=0;d<c;++d){const h=o[u+d];h!==t&&tK(e,h,n)}n.pop(t)}const yke=[],Ake=[];let bke=0;function Cke(e,t,n){const i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,c=yke;c.length=Math.max(c.length,a);const u=++bke,d=Ake;for(d.length=0,d.push(t);d.length>0;){if(t=d.pop(),c[t]===u)continue;c[t]=u;const h=n(e,t);if(l(h))return h;const m=o[t],g=s[t];for(let p=0;p<m;++p){const y=r[g+p];y!==t&&d.push(y)}}}function Tke(e,t,n){let i=!0;for(;i;){const o=n(e,t);if(l(o))return o;const r=e._parentIds[t];i=r!==t,t=r}}function IT(e,t,n){const i=e._parentCounts,o=e._parentIds;if(l(o)){if(l(i))return Cke(e,t,n)}else return n(e,t);return Tke(e,t,n)}vd.prototype.hasProperty=function(e,t){const n=IT(this,e,function(i,o){const r=i._classIds[o],s=i._classes[r].instances;if(l(s[t]))return!0});return l(n)};vd.prototype.propertyExists=function(e){const t=this._classes,n=t.length;for(let i=0;i<n;++i){const o=t[i].instances;if(l(o[e]))return!0}return!1};vd.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,IT(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o].instances;for(const s in r)r.hasOwnProperty(s)&&t.indexOf(s)===-1&&t.push(s)}),t};vd.prototype.getProperty=function(e,t){return IT(this,e,function(n,i){const o=n._classIds[i],r=n._classes[o],s=n._classIndexes[i],a=r.instances[t];if(l(a))return l(a.typedArray)?Eke(a,s):ht(a[s],!0)})};function Eke(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}vd.prototype.setProperty=function(e,t,n){const i=IT(this,e,function(o,r){const s=o._classIds[r],a=o._classes[s],c=o._classIndexes[r],u=a.instances[t];if(l(u)){if(r!==e)throw new x(`Inherited property "${t}" is read-only.`);return l(u.typedArray)?xke(u,c,n):u[c]=ht(n,!0),!0}});return l(i)};function xke(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}vd.prototype.isClass=function(e,t){const n=IT(this,e,function(i,o){const r=i._classIds[o];if(i._classes[r].name===t)return!0});return l(n)};vd.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const wke={HIGHLIGHT:0,REPLACE:1,MIX:2},iS=Object.freeze(wke),WP=wo.DEFAULT_COLOR_VALUE,jP=wo.DEFAULT_SHOW_VALUE;function Pi(e,t,n,i,o){this.featuresLength=t;let r;l(n)&&(r=n.extensions),this._extensions=A(r,{});const s=Ske(n);this._properties=s,this._batchTableHierarchy=vke(this,n,i);const a=nK(t,s,i);this._binaryPropertiesByteLength=Dke(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new wo({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}Pi._deprecationWarning=$p;Object.defineProperties(Pi.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return l(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function Ske(e){const t={};if(!l(e))return t;for(const n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=ht(e[n],!0));return t}function vke(e,t,n){if(!l(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const o=t.HIERARCHY;if(l(o)&&(Pi._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),!!l(i))return new vd({extension:i,binaryBody:n})}function nK(e,t,n){let i;for(const o in t)if(t.hasOwnProperty(o)){const r=t[o],s=r.byteOffset;if(l(s)){const a=r.componentType,c=r.type;if(!l(a))throw new Ie("componentType is required.");if(!l(c))throw new Ie("type is required.");if(!l(n))throw new Ie(`Property ${o} requires a batch table binary.`);const u=p_(r),d=u.componentsPerAttribute,h=u.classType,m=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:m,componentCount:d,type:h}}}return i}function Dke(e){if(!l(e))return 0;let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}Pi.getBinaryProperties=function(e,t,n){return nK(e,t,n)};Pi.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};Pi.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};Pi.prototype.getShow=function(e){return this._batchTexture.getShow(e)};Pi.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};Pi.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};Pi.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};Pi.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const Ike=new H;Pi.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(WP),this.setAllShow(jP);return}const t=this._content,n=this.featuresLength;for(let i=0;i<n;++i){const o=t.getFeature(i),r=l(e.color)?A(e.color.evaluateColor(o,Ike),WP):WP,s=l(e.show)?A(e.show.evaluate(o),jP):jP;this.setColor(i,r),this.setShow(i,s)}};function Pke(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function Oke(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}function U0(e,t){if(!l(e)||e<0||e>=t)throw new x(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Pi.prototype.isClass=function(e,t){U0(e,this.featuresLength),T.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};Pi.prototype.isExactClass=function(e,t){return T.typeOf.string("className",t),this.getExactClassName(e)===t};Pi.prototype.getExactClassName=function(e){U0(e,this.featuresLength);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};Pi.prototype.hasProperty=function(e,t){return U0(e,this.featuresLength),T.typeOf.string("name",t),l(this._properties[t])||l(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};Pi.prototype.hasPropertyBySemantic=function(){return!1};Pi.prototype.getPropertyIds=function(e,t){U0(e,this.featuresLength),t=l(t)?t:[],t.length=0;const n=Object.keys(this._properties);return t.push.apply(t,n),l(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,n)),t};Pi.prototype.getPropertyBySemantic=function(e,t){};Pi.prototype.getProperty=function(e,t){if(U0(e,this.featuresLength),T.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(l(i))return Pke(i,e)}const n=this._properties[t];if(l(n))return ht(n[e],!0);if(l(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(l(i))return i}};Pi.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(U0(e,i),T.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const r=this._batchTableBinaryProperties[t];if(l(r)){Oke(r,e,n);return}}if(l(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n))return;let o=this._properties[t];l(o)||(this._properties[t]=new Array(i),o=this._properties[t]),o[e]=ht(n,!0)};function Lke(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));
|
||
}
|
||
`}Pi.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;const i=this;return function(o){const r=iK(o,n,!1);let s;return It.maximumVertexTextureImageUnits>0?(s="",e&&(s+=`uniform bool tile_translucentCommand;
|
||
`),s+=`uniform sampler2D tile_batchTexture;
|
||
varying vec4 tile_featureColor;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
vec2 st = computeSt(${t});
|
||
vec4 featureProperties = texture2D(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=`varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
tile_color(vec4(1.0));
|
||
tile_featureSt = computeSt(${t});
|
||
}`,`${r}
|
||
${Lke(i)}${s}`}};function Jk(e,t){return e=We.replaceMain(e,"tile_main"),t?`${e}uniform float tile_colorBlend;
|
||
void tile_color(vec4 tile_featureColor)
|
||
{
|
||
tile_main();
|
||
tile_featureColor = czm_gammaCorrect(tile_featureColor);
|
||
gl_FragColor.a *= tile_featureColor.a;
|
||
float highlight = ceil(tile_colorBlend);
|
||
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
||
}
|
||
`:`${e}void tile_color(vec4 tile_featureColor)
|
||
{
|
||
tile_main();
|
||
}
|
||
`}function Bke(e,t){const n=`texture2D(${t}`;let i=0,o=e.indexOf(n,i),r;for(;o>-1;){let s=0;for(let u=o;u<e.length;++u){const d=e.charAt(u);if(d==="(")++s;else if(d===")"&&(--s,s===0)){r=u+1;break}}const 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 iK(e,t,n){if(!l(t))return Jk(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const o=e.match(i);if(!l(o))return Jk(e,n);const r=o[0],s=o[2];e=We.replaceMain(e,"tile_main"),e=e.replace(r,"");const 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);
|
||
gl_FragColor.a *= tile_featureColor.a;
|
||
float highlight = ceil(tile_colorBlend);
|
||
gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
|
||
`;let u;if(s==="vec3"||s==="vec4"){const d=s==="vec3"?`vec4(${t}, 1.0)`:t,h=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,h),u=` vec4 source = ${d};
|
||
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
|
||
tile_main();
|
||
`}else s==="sampler2D"&&(e=Bke(e,t),u=` tile_diffuse = tile_featureColor;
|
||
tile_main();
|
||
`);return e=`uniform float tile_colorBlend;
|
||
vec4 tile_diffuse = vec4(1.0);
|
||
${a}${r}
|
||
${e}
|
||
void tile_color(vec4 tile_featureColor)
|
||
{
|
||
${u}`,n&&(e+=c),e+=`}
|
||
`,e}Pi.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=iK(i,t,!0),It.maximumVertexTextureImageUnits>0?(i+=`uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
varying vec4 tile_featureColor;
|
||
void main()
|
||
{
|
||
tile_color(tile_featureColor);
|
||
`,n&&(i+=` gl_FragColor.rgb *= gl_FragColor.a;
|
||
`),i+="}"):(e&&(i+=`uniform bool tile_translucentCommand;
|
||
`),i+=`uniform sampler2D tile_pickTexture;
|
||
uniform sampler2D tile_batchTexture;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
vec4 featureProperties = texture2D(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+=` gl_FragColor.rgb *= gl_FragColor.a;
|
||
`),i+=`}
|
||
`),i}};Pi.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=We.replaceMain(e,"tile_main"),It.maximumVertexTextureImageUnits>0?e+=`uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
varying vec4 tile_featureColor;
|
||
void main()
|
||
{
|
||
tile_main();
|
||
gl_FragColor = tile_featureColor;
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
}`:e+=`uniform sampler2D tile_batchTexture;
|
||
uniform sampler2D tile_pickTexture;
|
||
varying vec2 tile_featureSt;
|
||
void main()
|
||
{
|
||
tile_main();
|
||
vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt);
|
||
if (featureProperties.a == 0.0) {
|
||
discard;
|
||
}
|
||
gl_FragColor = featureProperties;
|
||
gl_FragColor.rgb *= gl_FragColor.a;
|
||
}
|
||
`,e}};function Rke(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===iS.HIGHLIGHT)return 0;if(n===iS.REPLACE)return 1;if(n===iS.MIX)return M.clamp(i,M.EPSILON4,1);throw new x(`Invalid color blend mode "${n}".`)}Pi.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;const e=this;return function(t){return hn(t,{tile_batchTexture:function(){return A(e._batchTexture.batchTexture,e._batchTexture.defaultTexture)},tile_textureDimensions:function(){return e._batchTexture.textureDimensions},tile_textureStep:function(){return e._batchTexture.textureStep},tile_colorBlend:function(){return Rke(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};Pi.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};const Xh={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};Pi.prototype.addDerivedCommands=function(e,t){const 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=Nke(this);for(let u=t;u<i;++u){const d=n[u];if(d.pass===Ne.COMPUTE)continue;let h=d.derivedCommands.tileset;(!l(h)||d.dirty)&&(h={},d.derivedCommands.tileset=h,h.originalCommand=Mke(d),d.dirty=!1);const m=h.originalCommand;c!==Xh.ALL_OPAQUE&&d.pass!==Ne.TRANSLUCENT&&(l(h.translucent)||(h.translucent=Fke(m))),c!==Xh.ALL_TRANSLUCENT&&d.pass!==Ne.TRANSLUCENT&&(l(h.opaque)||(h.opaque=zke(m)),a&&(r||(l(h.zback)||(h.zback=Hke(e.context,m)),s._backfaceCommands.push(h.zback)),(!l(h.stencil)||o._selectionDepth!==kke(h.stencil))&&(d.renderState.depthMask?h.stencil=Vke(m,o._selectionDepth):h.stencil=h.opaque)));const g=a?h.stencil:h.opaque,p=h.translucent;d.pass!==Ne.TRANSLUCENT?(c===Xh.ALL_OPAQUE&&(n[u]=g),c===Xh.ALL_TRANSLUCENT&&(n[u]=p),c===Xh.OPAQUE_AND_TRANSLUCENT&&(n[u]=g,n.push(p))):n[u]=m}};function Nke(e){const t=e._batchTexture.translucentFeaturesLength;return t===0?Xh.ALL_OPAQUE:t===e.featuresLength?Xh.ALL_TRANSLUCENT:Xh.OPAQUE_AND_TRANSLUCENT}function Mke(e){const t=mt.shallowClone(e),n=t.pass===Ne.TRANSLUCENT;return t.uniformMap=l(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function Fke(e){const t=mt.shallowClone(e);return t.pass=Ne.TRANSLUCENT,t.renderState=Gke(e.renderState),t}function zke(e){const t=mt.shallowClone(e);return t.renderState=Wke(e.renderState),t}function Uke(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"zBackfaceLogDepth");if(!l(n)){const i=t.fragmentShaderSource.clone();i.defines=l(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 Hke(e,t){const n=mt.shallowClone(t),i=ht(n.renderState,!0);i.cull.enabled=!0,i.cull.face=Ho.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=Rt.setCesium3DTileBit(),i.stencilMask=Rt.CESIUM_3D_TILE_MASK,n.renderState=et.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=ht(t.uniformMap);const o=new j(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=Uke(e,t.shaderProgram),n}function Vke(e,t){const n=mt.shallowClone(e),i=ht(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=Rt.SKIP_LOD_MASK,i.stencilTest.reference=Rt.CESIUM_3D_TILE_MASK|t<<Rt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=gi.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=_t.REPLACE,i.stencilTest.backFunction=gi.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=_t.REPLACE,i.stencilMask=Rt.CESIUM_3D_TILE_MASK|Rt.SKIP_LOD_MASK,n.renderState=et.fromCache(i),n}function kke(e){return(e.renderState.stencilTest.reference&Rt.SKIP_LOD_MASK)>>>Rt.SKIP_LOD_BIT_SHIFT}function Gke(e){const t=ht(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=Gi.ALPHA_BLEND,t.stencilTest=Rt.setCesium3DTileBit(),t.stencilMask=Rt.CESIUM_3D_TILE_MASK,et.fromCache(t)}function Wke(e){const t=ht(e,!0);return t.stencilTest=Rt.setCesium3DTileBit(),t.stencilMask=Rt.CESIUM_3D_TILE_MASK,et.fromCache(t)}Pi.prototype.update=function(e,t){this._batchTexture.update(e,t)};Pi.prototype.isDestroyed=function(){return!1};Pi.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),He(this)};function sv(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}class jke{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)})}}class qke{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)})}}class ke{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+ke.version}static addUnaryOp(t){return ke.max_unop_len=Math.max(t.length,ke.max_unop_len),ke.unary_ops[t]=1,ke}static addBinaryOp(t,n,i){return ke.max_binop_len=Math.max(t.length,ke.max_binop_len),ke.binary_ops[t]=n,i?ke.right_associative.add(t):ke.right_associative.delete(t),ke}static addIdentifierChar(t){return ke.additional_identifier_chars.add(t),ke}static addLiteral(t,n){return ke.literals[t]=n,ke}static removeUnaryOp(t){return delete ke.unary_ops[t],t.length===ke.max_unop_len&&(ke.max_unop_len=ke.getMaxKeyLen(ke.unary_ops)),ke}static removeAllUnaryOps(){return ke.unary_ops={},ke.max_unop_len=0,ke}static removeIdentifierChar(t){return ke.additional_identifier_chars.delete(t),ke}static removeBinaryOp(t){return delete ke.binary_ops[t],t.length===ke.max_binop_len&&(ke.max_binop_len=ke.getMaxKeyLen(ke.binary_ops)),ke.right_associative.delete(t),ke}static removeAllBinaryOps(){return ke.binary_ops={},ke.max_binop_len=0,ke}static removeLiteral(t){return delete ke.literals[t],ke}static removeAllLiterals(){return ke.literals={},ke}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 ke(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 ke.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!ke.binary_ops[String.fromCharCode(t)]||ke.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return ke.isIdentifierStart(t)||ke.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(ke.hooks[t]){const i={context:this,node:n};return ke.hooks.run(t,i),i.node}return n}searchHook(t){if(ke.hooks[t]){const n={context:this};return ke.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===ke.SPACE_CODE||t===ke.TAB_CODE||t===ke.LF_CODE||t===ke.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:ke.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===ke.SEMCOL_CODE||i===ke.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(){const 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,ke.max_binop_len),n=t.length;for(;n>0;){if(ke.binary_ops.hasOwnProperty(t)&&(!ke.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!ke.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,u;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:ke.binaryPrecedence(n),right_a:ke.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=ke.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:ke.right_associative.has(n)},u=n;const d=h=>r.right_a&&h.right_a?i>h.prec:i<=h.prec;for(;o.length>2&&d(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:ke.BINARY_EXP,operator:n,left:s,right:a},o.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+u),o.push(r,t)}for(c=o.length-1,t=o[c];c>1;)t={type:ke.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,ke.isDecimalDigit(t)||t===ke.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===ke.SQUOTE_CODE||t===ke.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===ke.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,ke.max_unop_len),i=n.length;i>0;){if(ke.unary_ops.hasOwnProperty(n)&&(!ke.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!ke.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=i;const r=this.gobbleToken();return r||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:ke.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}ke.isIdentifierStart(t)?(o=this.gobbleIdentifier(),ke.literals.hasOwnProperty(o.name)?o={type:ke.LITERAL,value:ke.literals[o.name],raw:o.name}:o.name===ke.this_str&&(o={type:ke.THIS_EXP})):t===ke.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===ke.PERIOD_CODE||n===ke.OBRACK_CODE||n===ke.OPAREN_CODE||n===ke.QUMARK_CODE;){let i;if(n===ke.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==ke.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===ke.OBRACK_CODE?(t={type:ke.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),n=this.code,n!==ke.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===ke.OPAREN_CODE?t={type:ke.CALL_EXP,arguments:this.gobbleArguments(ke.CPAREN_CODE),callee:t}:(n===ke.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:ke.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(;ke.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===ke.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);ke.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++));ke.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);ke.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,ke.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===ke.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===ke.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:ke.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";const n=this.index,i=this.expr.charAt(this.index++);let 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:ke.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(ke.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,ke.isIdentifierPart(t));)this.index++;return{type:ke.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){const n=[];let i=!1,o=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let r=this.code;if(r===t){i=!0,this.index++,t===ke.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===ke.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===ke.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===ke.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{const s=this.gobbleExpression();(!s||s.type===ke.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(ke.CPAREN_CODE);if(this.code===ke.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:ke.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:ke.ARRAY_EXP,elements:this.gobbleArguments(ke.CBRACK_CODE)}}}const $ke=new jke;Object.assign(ke,{hooks:$ke,plugins:new qke(ke),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"});ke.max_unop_len=ke.getMaxKeyLen(ke.unary_ops);ke.max_binop_len=ke.getMaxKeyLen(ke.binary_ops);const m_=e=>new ke(e).parse(),Yke=Object.getOwnPropertyNames(ke);Yke.forEach(e=>{m_[e]===void 0&&e!=="prototype"&&(m_[e]=ke[e])});m_.Jsep=ke;const Xke="ConditionalExpression";var Kke={name:"ternary",init(e){e.hooks.add("after-expression",function(n){if(n.node&&this.code===e.QUMARK_CODE){this.index++;const i=n.node,o=this.gobbleExpression();if(o||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;const r=this.gobbleExpression();if(r||this.throwError("Expected expression"),n.node={type:Xke,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 :")}})}};m_.plugins.register(Kke);const Jke={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},ut=Object.freeze(Jke);function pu(e,t){T.typeOf.string("expression",e),this._expression=e,e=u5e(e,t),e=f5e(d5e(e)),m_.addBinaryOp("=~",0),m_.addBinaryOp("!~",0);let n;try{n=m_(e)}catch(i){throw new Ie(i)}this._runtimeAst=ei(this,n)}Object.defineProperties(pu.prototype,{expression:{get:function(){return this._expression}}});const on={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new j],cartesian3Array:[new f],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([]);const e=this.arrayArray[this.arrayIndex++];return e.length=0,e},getCartesian2:function(){return this.cartesian2Index>=this.cartesian2Array.length&&this.cartesian2Array.push(new j),this.cartesian2Array[this.cartesian2Index++]},getCartesian3:function(){return this.cartesian3Index>=this.cartesian3Array.length&&this.cartesian3Array.push(new f),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new oe),this.cartesian4Array[this.cartesian4Index++]}};pu.prototype.evaluate=function(e,t){on.reset();const n=this._runtimeAst.evaluate(e);return t instanceof H&&n instanceof oe?H.fromCartesian4(n,t):n instanceof j||n instanceof f||n instanceof oe?n.clone(t):n};pu.prototype.evaluateColor=function(e,t){on.reset();const n=this._runtimeAst.evaluate(e);return H.fromCartesian4(n,t)};pu.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
|
||
{
|
||
return ${o};
|
||
}
|
||
`,o};pu.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};pu.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};const Qke=["!","-","+"],Qk=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],av=/\${(.*?)}/g,Zke=/\\/g,e5e="@#%",t5e=/@#%/g,MD=new H,FD={abs:Vr(Math.abs),sqrt:Vr(Math.sqrt),cos:Vr(Math.cos),sin:Vr(Math.sin),tan:Vr(Math.tan),acos:Vr(Math.acos),asin:Vr(Math.asin),atan:Vr(Math.atan),radians:Vr(M.toRadians),degrees:Vr(M.toDegrees),sign:Vr(M.sign),floor:Vr(Math.floor),ceil:Vr(Math.ceil),round:Vr(Math.round),exp:Vr(Math.exp),exp2:Vr(i5e),log:Vr(Math.log),log2:Vr(o5e),fract:Vr(n5e),length:r5e,normalize:s5e},zD={atan2:Rx(Math.atan2,!1),pow:Rx(Math.pow,!1),min:Rx(Math.min,!0),max:Rx(Math.max,!0),distance:a5e,dot:c5e,cross:l5e},D2={clamp:Zk(M.clamp,!0),mix:Zk(M.lerp,!0)};function n5e(e){return e-Math.floor(e)}function i5e(e){return Math.pow(2,e)}function o5e(e){return M.log2(e)}function Vr(e){return function(t,n){if(typeof n=="number")return e(n);if(n instanceof j)return j.fromElements(e(n.x),e(n.y),on.getCartesian2());if(n instanceof f)return f.fromElements(e(n.x),e(n.y),e(n.z),on.getCartesian3());if(n instanceof oe)return oe.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),on.getCartesian4());throw new Ie(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function Rx(e,t){return function(n,i,o){if(t&&typeof o=="number"){if(typeof i=="number")return e(i,o);if(i instanceof j)return j.fromElements(e(i.x,o),e(i.y,o),on.getCartesian2());if(i instanceof f)return f.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),on.getCartesian3());if(i instanceof oe)return oe.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),on.getCartesian4())}if(typeof i=="number"&&typeof o=="number")return e(i,o);if(i instanceof j&&o instanceof j)return j.fromElements(e(i.x,o.x),e(i.y,o.y),on.getCartesian2());if(i instanceof f&&o instanceof f)return f.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),on.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),on.getCartesian4());throw new Ie(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function Zk(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 j&&o instanceof j)return j.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),on.getCartesian2());if(i instanceof f&&o instanceof f)return f.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),on.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),on.getCartesian4())}if(typeof i=="number"&&typeof o=="number"&&typeof r=="number")return e(i,o,r);if(i instanceof j&&o instanceof j&&r instanceof j)return j.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),on.getCartesian2());if(i instanceof f&&o instanceof f&&r instanceof f)return f.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),on.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),on.getCartesian4());throw new Ie(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function r5e(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof j)return j.magnitude(t);if(t instanceof f)return f.magnitude(t);if(t instanceof oe)return oe.magnitude(t);throw new Ie(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function s5e(e,t){if(typeof t=="number")return 1;if(t instanceof j)return j.normalize(t,on.getCartesian2());if(t instanceof f)return f.normalize(t,on.getCartesian3());if(t instanceof oe)return oe.normalize(t,on.getCartesian4());throw new Ie(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function a5e(e,t,n){if(typeof t=="number"&&typeof n=="number")return Math.abs(t-n);if(t instanceof j&&n instanceof j)return j.distance(t,n);if(t instanceof f&&n instanceof f)return f.distance(t,n);if(t instanceof oe&&n instanceof oe)return oe.distance(t,n);throw new Ie(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function c5e(e,t,n){if(typeof t=="number"&&typeof n=="number")return t*n;if(t instanceof j&&n instanceof j)return j.dot(t,n);if(t instanceof f&&n instanceof f)return f.dot(t,n);if(t instanceof oe&&n instanceof oe)return oe.dot(t,n);throw new Ie(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function l5e(e,t,n){if(t instanceof f&&n instanceof f)return f.cross(t,n,on.getCartesian3());throw new Ie(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function lt(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,T5e(this)}function u5e(e,t){if(!l(t))return e;for(const n in t)if(t.hasOwnProperty(n)){const i=new RegExp(`\\$\\{${n}\\}`,"g"),o=`(${t[n]})`;l(o)&&(e=e.replace(i,o))}return e}function d5e(e){return e.replace(Zke,e5e)}function dR(e){return e.replace(t5e,"\\")}function f5e(e){let t=e,n="",i=t.indexOf("${");for(;i>=0;){const o=t.indexOf("'"),r=t.indexOf('"');let 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);const a=t.indexOf("}");if(a<0)throw new Ie("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function h5e(e){const t=typeof e.value;if(e.value===null)return new lt(ut.LITERAL_NULL,null);if(t==="boolean")return new lt(ut.LITERAL_BOOLEAN,e.value);if(t==="number")return new lt(ut.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new lt(ut.VARIABLE_IN_STRING,e.value):new lt(ut.LITERAL_STRING,dR(e.value))}function p5e(e,t){const n=t.arguments,i=n.length;let o,r,s,a;if(t.callee.type==="MemberExpression"){o=t.callee.property.name;const c=t.callee.object;if(o==="test"||o==="exec"){if(!l(c.callee)||c.callee.name!=="regExp")throw new Ie(`${o} is not a function.`);return i===0?o==="test"?new lt(ut.LITERAL_BOOLEAN,!1):new lt(ut.LITERAL_NULL,null):(s=ei(e,c),a=ei(e,n[0]),new lt(ut.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=ei(e,c),new lt(ut.FUNCTION_CALL,o,r);throw new Ie(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new lt(ut.LITERAL_COLOR,o);if(r=ei(e,n[0]),l(n[1])){const c=ei(e,n[1]);return new lt(ut.LITERAL_COLOR,o,[r,c])}return new lt(ut.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new Ie(`${o} requires three arguments.`);return r=[ei(e,n[0]),ei(e,n[1]),ei(e,n[2])],new lt(ut.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new Ie(`${o} requires four arguments.`);return r=[ei(e,n[0]),ei(e,n[1]),ei(e,n[2]),ei(e,n[3])],new lt(ut.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]=ei(e,n[c]);return new lt(ut.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new lt(ut.LITERAL_BOOLEAN,!0):new lt(ut.LITERAL_BOOLEAN,!1):(r=ei(e,n[0]),new lt(ut.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new Ie(`${o} requires exactly one argument.`);return r=ei(e,n[0]),new lt(ut.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new Ie(`${o} does not take any argument.`);return new lt(ut.UNARY,o)}else if(l(FD[o])){if(i!==1)throw new Ie(`${o} requires exactly one argument.`);return r=ei(e,n[0]),new lt(ut.UNARY,o,r)}else if(l(zD[o])){if(i!==2)throw new Ie(`${o} requires exactly two arguments.`);return s=ei(e,n[0]),a=ei(e,n[1]),new lt(ut.BINARY,o,s,a)}else if(l(D2[o])){if(i!==3)throw new Ie(`${o} requires exactly three arguments.`);s=ei(e,n[0]),a=ei(e,n[1]);const c=ei(e,n[2]);return new lt(ut.TERNARY,o,s,a,c)}else{if(o==="Boolean")return i===0?new lt(ut.LITERAL_BOOLEAN,!1):(r=ei(e,n[0]),new lt(ut.UNARY,o,r));if(o==="Number")return i===0?new lt(ut.LITERAL_NUMBER,0):(r=ei(e,n[0]),new lt(ut.UNARY,o,r));if(o==="String")return i===0?new lt(ut.LITERAL_STRING,""):(r=ei(e,n[0]),new lt(ut.UNARY,o,r));if(o==="regExp")return m5e(e,t)}}throw new Ie(`Unexpected function call "${o}".`)}function m5e(e,t){const n=t.arguments;if(n.length===0)return new lt(ut.LITERAL_REGEX,new RegExp);const i=ei(e,n[0]);let o;if(n.length>1){const r=ei(e,n[1]);if(qP(i)&&qP(r)){try{o=new RegExp(dR(String(i._value)),r._value)}catch(s){throw new Ie(s)}return new lt(ut.LITERAL_REGEX,o)}return new lt(ut.REGEX,i,r)}if(qP(i)){try{o=new RegExp(dR(String(i._value)))}catch(r){throw new Ie(r)}return new lt(ut.LITERAL_REGEX,o)}return new lt(ut.REGEX,i)}function _5e(e){if(b5e(e.name)){const t=C5e(e.name);return t.substr(0,8)==="tiles3d_"?new lt(ut.BUILTIN_VARIABLE,t):new lt(ut.VARIABLE,t)}else{if(e.name==="NaN")return new lt(ut.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new lt(ut.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new lt(ut.LITERAL_UNDEFINED,void 0)}throw new Ie(`${e.name} is not defined.`)}function g5e(e){const t=e.property.name;if(t==="PI")return new lt(ut.LITERAL_NUMBER,Math.PI);if(t==="E")return new lt(ut.LITERAL_NUMBER,Math.E)}function y5e(e){if(e.property.name==="POSITIVE_INFINITY")return new lt(ut.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function A5e(e,t){if(t.object.name==="Math")return g5e(t);if(t.object.name==="Number")return y5e(t);let n;const i=ei(e,t.object);return t.computed?(n=ei(e,t.property),new lt(ut.MEMBER,"brackets",i,n)):(n=new lt(ut.LITERAL_STRING,t.property.name),new lt(ut.MEMBER,"dot",i,n))}function qP(e){return e._type>=ut.LITERAL_NULL}function b5e(e){return e.substr(0,4)==="czm_"}function C5e(e){return e.substr(4)}function ei(e,t){let n,i,o,r;if(t.type==="Literal")n=h5e(t);else if(t.type==="CallExpression")n=p5e(e,t);else if(t.type==="Identifier")n=_5e(t);else if(t.type==="UnaryExpression"){i=t.operator;const s=ei(e,t.argument);if(Qke.indexOf(i)>-1)n=new lt(ut.UNARY,i,s);else throw new Ie(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=ei(e,t.left),r=ei(e,t.right),Qk.indexOf(i)>-1)n=new lt(ut.BINARY,i,o,r);else throw new Ie(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=ei(e,t.left),r=ei(e,t.right),Qk.indexOf(i)>-1&&(n=new lt(ut.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){const s=ei(e,t.test);o=ei(e,t.consequent),r=ei(e,t.alternate),n=new lt(ut.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=A5e(e,t);else if(t.type==="ArrayExpression"){const s=[];for(let a=0;a<t.elements.length;a++)s[a]=ei(e,t.elements[a]);n=new lt(ut.ARRAY,s)}else throw t.type==="Compound"?new Ie("Provide exactly one expression."):new Ie("Cannot parse expression.");return n}function T5e(e){e._type===ut.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===ut.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===ut.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:l(FD[e._value])&&(e.evaluate=x5e(e._value)):e._type===ut.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:l(zD[e._value])&&(e.evaluate=w5e(e._value)):e._type===ut.TERNARY?e.evaluate=S5e(e._value):e._type===ut.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===ut.ARRAY?e.evaluate=e._evaluateArray:e._type===ut.VARIABLE?e.evaluate=e._evaluateVariable:e._type===ut.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===ut.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===ut.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===ut.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===ut.REGEX?e.evaluate=e._evaluateRegExp:e._type===ut.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=E5e):e.evaluate=e._evaluateLiteral}function E5e(e){return l(e)?e.content.tileset.timeSinceLoad:0}function x5e(e){const t=FD[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function w5e(e){const t=zD[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function S5e(e){const t=D2[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n),r=this._test.evaluate(n);return t(e,i,o,r)}}function UD(e,t){if(l(e))return e.getPropertyInherited(t)}lt.prototype._evaluateLiteral=function(){return this._value};lt.prototype._evaluateLiteralColor=function(e){const t=MD,n=this._left;if(this._value==="color")l(n)?n.length>1?(H.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):H.fromCssColorString(n[0].evaluate(e),t):H.fromBytes(255,255,255,255,t);else if(this._value==="rgb")H.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),255,t);else if(this._value==="rgba"){const i=n[3].evaluate(e)*255;H.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?H.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&H.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return oe.fromColor(t,on.getCartesian4())};lt.prototype._evaluateLiteralVector=function(e){const t=on.getArray(),n=this._value,i=this._left,o=i.length;for(let a=0;a<o;++a){const c=i[a].evaluate(e);if(typeof c=="number")t.push(c);else if(c instanceof j)t.push(c.x,c.y);else if(c instanceof f)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 Ie(`${n} argument must be a vector or number. Argument is ${c}.`)}const r=t.length,s=parseInt(n.charAt(3));if(r===0)throw new Ie(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new Ie(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new Ie(`Invalid ${n} constructor. Too many arguments.`);if(r===1){const a=t[0];t.push(a,a,a)}if(n==="vec2")return j.fromArray(t,0,on.getCartesian2());if(n==="vec3")return f.fromArray(t,0,on.getCartesian3());if(n==="vec4")return oe.fromArray(t,0,on.getCartesian4())};lt.prototype._evaluateLiteralString=function(){return this._value};lt.prototype._evaluateVariableString=function(e){let t=this._value,n=av.exec(t);for(;n!==null;){const i=n[0],o=n[1];let r=UD(e,o);l(r)||(r=""),t=t.replace(i,r),n=av.exec(t)}return t};lt.prototype._evaluateVariable=function(e){return UD(e,this._value)};function __(e){return e._value==="feature"}lt.prototype._evaluateMemberDot=function(e){if(__(this._left))return UD(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!l(t))return;const n=this._right.evaluate(e);if(t instanceof j||t instanceof f||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]};lt.prototype._evaluateMemberBrackets=function(e){if(__(this._left))return UD(e,this._right.evaluate(e));const t=this._left.evaluate(e);if(!l(t))return;const n=this._right.evaluate(e);if(t instanceof j||t instanceof f||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]};lt.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};lt.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Ie(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};lt.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof j)return j.negate(t,on.getCartesian2());if(t instanceof f)return f.negate(t,on.getCartesian3());if(t instanceof oe)return oe.negate(t,on.getCartesian4());if(typeof t=="number")return-t;throw new Ie(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};lt.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof j||t instanceof f||t instanceof oe||typeof t=="number"))throw new Ie(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};lt.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Ie(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};lt.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Ie(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};lt.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Ie(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};lt.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Ie(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};lt.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Ie(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Ie(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};lt.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Ie(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Ie(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};lt.prototype._evaluatePlus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof j&&t instanceof j)return j.add(t,n,on.getCartesian2());if(n instanceof f&&t instanceof f)return f.add(t,n,on.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.add(t,n,on.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new Ie(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateMinus=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof j&&t instanceof j)return j.subtract(t,n,on.getCartesian2());if(n instanceof f&&t instanceof f)return f.subtract(t,n,on.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.subtract(t,n,on.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new Ie(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateTimes=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof j&&t instanceof j)return j.multiplyComponents(t,n,on.getCartesian2());if(n instanceof j&&typeof t=="number")return j.multiplyByScalar(n,t,on.getCartesian2());if(t instanceof j&&typeof n=="number")return j.multiplyByScalar(t,n,on.getCartesian2());if(n instanceof f&&t instanceof f)return f.multiplyComponents(t,n,on.getCartesian3());if(n instanceof f&&typeof t=="number")return f.multiplyByScalar(n,t,on.getCartesian3());if(t instanceof f&&typeof n=="number")return f.multiplyByScalar(t,n,on.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.multiplyComponents(t,n,on.getCartesian4());if(n instanceof oe&&typeof t=="number")return oe.multiplyByScalar(n,t,on.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.multiplyByScalar(t,n,on.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new Ie(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateDivide=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof j&&t instanceof j)return j.divideComponents(t,n,on.getCartesian2());if(t instanceof j&&typeof n=="number")return j.divideByScalar(t,n,on.getCartesian2());if(n instanceof f&&t instanceof f)return f.divideComponents(t,n,on.getCartesian3());if(t instanceof f&&typeof n=="number")return f.divideByScalar(t,n,on.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.divideComponents(t,n,on.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.divideByScalar(t,n,on.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new Ie(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateMod=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(n instanceof j&&t instanceof j)return j.fromElements(t.x%n.x,t.y%n.y,on.getCartesian2());if(n instanceof f&&t instanceof f)return f.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,on.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,on.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new Ie(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof j&&t instanceof j||n instanceof f&&t instanceof f||n instanceof oe&&t instanceof oe?t.equals(n):t===n};lt.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof j&&t instanceof j||n instanceof f&&t instanceof f||n instanceof oe&&t instanceof oe?!t.equals(n):t!==n};lt.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if(typeof t!="boolean")throw new Ie(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};lt.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};lt.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};lt.prototype._evaluateIsExactClass=function(e){return l(e)?e.isExactClass(this._left.evaluate(e)):!1};lt.prototype._evaluateIsClass=function(e){return l(e)?e.isClass(this._left.evaluate(e)):!1};lt.prototype._evaluateGetExactClassName=function(e){if(l(e))return e.getExactClassName()};lt.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};lt.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};lt.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};lt.prototype._evaluateRegExp=function(e){const t=this._value.evaluate(e);let n="";l(this._left)&&(n=this._left.evaluate(e));let i;try{i=new RegExp(t,n)}catch(o){throw new Ie(o)}return i};lt.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Ie(`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)};lt.prototype._evaluateRegExpMatch=function(e){const 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 Ie(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateRegExpNotMatch=function(e){const 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 Ie(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};lt.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Ie(`RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${t} and ${n}.`);const i=t.exec(n);return l(i)?i[1]:null};lt.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof j||t instanceof f||t instanceof oe)return String(t);throw new Ie(`Unexpected function call "${this._value}".`)};function e5(e){const t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==ut.LITERAL_NUMBER)return;const i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return H.fromHsl(i,o,r,s,MD)}function t5(e){const t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==ut.LITERAL_NUMBER)return;const i=MD;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 np(e){return e%1===0?e.toFixed(1):e.toString()}function v5e(e){const t=np(e.red),n=np(e.green),i=np(e.blue);return`vec3(${t}, ${n}, ${i})`}function Nx(e){const t=np(e.red),n=np(e.green),i=np(e.blue),o=np(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function n5(e,t,n,i){const 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 i5(e,t){return l(t[e])?t[e]:pu.NULL_SENTINEL}pu.NULL_SENTINEL="czm_infinity";lt.prototype.getShaderExpression=function(e,t,n){let i,o,r,s;const a=this._type;let c=this._value;l(this._left)&&(Array.isArray(this._left)?o=n5(this._left,e,t,this):o=this._left.getShaderExpression(e,t,this)),l(this._right)&&(r=this._right.getShaderExpression(e,t,this)),l(this._test)&&(s=this._test.getShaderExpression(e,t,this)),Array.isArray(this._value)&&(c=n5(this._value,e,t,this));let u,d,h;switch(a){case ut.VARIABLE:return __(this)?void 0:i5(c,e);case ut.UNARY:if(c==="Boolean")return`bool(${o})`;if(c==="Number")return`float(${o})`;if(c==="round")return`floor(${o} + 0.5)`;if(l(FD[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 Ie(`Error generating style shader: "${c}" is not supported.`);return c+o;case ut.BINARY:return c==="%"?`mod(${o}, ${r})`:c==="==="?`(${o} == ${r})`:c==="!=="?`(${o} != ${r})`:c==="atan2"?`atan(${o}, ${r})`:l(zD[c])?`${c}(${o}, ${r})`:`(${o} ${c} ${r})`;case ut.TERNARY:if(l(D2[c]))return`${c}(${o}, ${r}, ${s})`;break;case ut.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case ut.MEMBER:return __(this._left)?i5(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 ut.FUNCTION_CALL:throw new Ie(`Error generating style shader: "${c}" is not supported.`);case ut.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 Ie("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case ut.REGEX:throw new Ie("Error generating style shader: Regular expressions are not supported.");case ut.VARIABLE_IN_STRING:throw new Ie("Error generating style shader: Converting a variable to a string is not supported.");case ut.LITERAL_NULL:return pu.NULL_SENTINEL;case ut.LITERAL_BOOLEAN:return c?"true":"false";case ut.LITERAL_NUMBER:return np(c);case ut.LITERAL_STRING:if(l(n)&&n._type===ut.MEMBER&&(c==="r"||c==="g"||c==="b"||c==="a"||c==="x"||c==="y"||c==="z"||c==="w"||__(n._left)))return c;if(i=H.fromCssColorString(c,MD),l(i))return v5e(i);throw new Ie("Error generating style shader: String literals are not supported.");case ut.LITERAL_COLOR:if(u=o,c==="color"){if(l(u)){if(u.length>1){const m=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${m}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(c==="rgb")return i=t5(this),l(i)?Nx(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, 1.0)`;if(c==="rgba")return u[3]!=="1.0"&&(t.translucent=!0),i=t5(this),l(i)?Nx(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(c==="hsl")return i=e5(this),l(i)?Nx(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(c==="hsla")return i=e5(this),l(i)?(i.alpha!==1&&(t.translucent=!0),Nx(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case ut.LITERAL_VECTOR:if(!l(o))throw new x("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");d=o.length,h=`${c}(`;for(let m=0;m<d;++m)h+=o[m],m<d-1&&(h+=", ");return h+=")",h;case ut.LITERAL_REGEX:throw new Ie("Error generating style shader: Regular expressions are not supported.");case ut.LITERAL_UNDEFINED:return pu.NULL_SENTINEL;case ut.BUILTIN_VARIABLE:if(c==="tiles3d_tileset_time")return c}};lt.prototype.getVariables=function(e,t){let n,i,o;const r=this._type,s=this._value;if(l(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(l(this._right)&&this._right.getVariables(e,this),l(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 ut.VARIABLE:__(this)||e.push(s);break;case ut.VARIABLE_IN_STRING:for(a=av.exec(s);a!==null;)e.push(a[1]),a=av.exec(s);break;case ut.LITERAL_STRING:l(t)&&t._type===ut.MEMBER&&__(t._left)&&e.push(s);break}};function Dd(e){e=A(e,A.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=A(e.center,f.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=H.clone(H.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=A(e.classificationType,vo.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={};const t=this._batchIds.length;for(let n=0;n<t;++n){const i=this._batchIds[n];this._batchIdLookUp[i]=n}}Object.defineProperties(Dd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const D5e={position:0,a_batchId:1};function I5e(e,t){if(l(e._va))return;const n=Tt.createVertexBuffer({context:t,typedArray:e._positions,usage:nt.STATIC_DRAW}),i=Tt.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:nt.STATIC_DRAW}),o=Tt.createIndexBuffer({context:t,typedArray:e._indices,usage:nt.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?at.UNSIGNED_SHORT:at.UNSIGNED_INT}),r=[{index:0,vertexBuffer:n,componentDatatype:ee.fromTypedArray(e._positions),componentsPerAttribute:3},{index:1,vertexBuffer:i,componentDatatype:ee.fromTypedArray(e._vertexBatchIds),componentsPerAttribute:1}];e._va=new ho({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new ho({context:t,attributes:r,indexBuffer:Tt.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:nt.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function P5e(e,t){if(l(e._sp))return;const n=e._batchTable,i=A(e._attributeLocations,D5e);let o=e._pickId;const r=e._vertexShaderSource;let s=e._fragmentShaderSource;if(l(r)){e._sp=Cn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=We.replaceMain(s,"czm_non_pick_main"),s=`${s}void main()
|
||
{
|
||
czm_non_pick_main();
|
||
gl_FragColor = ${o};
|
||
}
|
||
`,e._spPick=Cn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}const a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(ZU);let c=n.getFragmentShaderCallback(!1,void 0,!0)(pB);o=n.getPickId();let u=new We({sources:[a]}),d=new We({defines:["VECTOR_TILE"],sources:[c]});e._sp=Cn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:d,attributeLocations:i}),u=new We({sources:[ZU]}),d=new We({defines:["VECTOR_TILE"],sources:[pB]}),e._spStencil=Cn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:d,attributeLocations:i}),c=We.replaceMain(c,"czm_non_pick_main"),c=`${c}
|
||
void main()
|
||
{
|
||
czm_non_pick_main();
|
||
gl_FragColor = ${o};
|
||
}
|
||
`;const h=new We({sources:[a]}),m=new We({defines:["VECTOR_TILE"],sources:[c]});e._spPick=Cn.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:m,attributeLocations:i})}function o5(e){const t=e?gi.EQUAL:gi.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:_t.KEEP,zFail:_t.DECREMENT_WRAP,zPass:_t.KEEP},backFunction:t,backOperation:{fail:_t.KEEP,zFail:_t.INCREMENT_WRAP,zPass:_t.KEEP},reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:x_.LESS_OR_EQUAL},depthMask:!1}}const O5e={stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND},L5e={stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function B5e(e){l(e._rsStencilDepthPass)||(e._rsStencilDepthPass=et.fromCache(o5(!1)),e._rsStencilDepthPass3DTiles=et.fromCache(o5(!0)),e._rsColorPass=et.fromCache(O5e),e._rsPickPass=et.fromCache(L5e))}const Em=new B,r5=new f;function R5e(e,t){if(l(e._uniformMap))return;const n={u_modifiedModelViewProjection:function(){const i=t.uniformState.view,o=t.uniformState.projection;return B.clone(i,Em),B.multiplyByPoint(Em,e._center,r5),B.setTranslation(Em,r5,Em),B.multiply(o,Em,Em),Em},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function $P(e,t,n,i,o,r,s){const a=e.constructor.BYTES_PER_ELEMENT,c=r.length;for(let u=0;u<c;++u){const d=r[u],h=s[d],m=i[h],g=o[h],p=new e.constructor(e.buffer,a*m,g);t.set(p,n),i[h]=n,n+=g}return n}function N5e(e,t){const n=e._indices,i=e._indexOffsets,o=e._indexCounts,r=e._batchIdLookUp,s=new n.constructor(n.length);let a=t.pop();const c=[a];let u=$P(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){const d=t.pop();if(H.equals(d.color,a.color))u=$P(n,s,u,i,o,d.batchIds,r),a.batchIds=a.batchIds.concat(d.batchIds),a.count=u-a.offset;else{const h=u;u=$P(n,s,u,i,o,d.batchIds,r),d.offset=h,d.count=u-h,c.push(d),a=d}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}function YP(e,t,n,i,o,r,s){const a=e.bytesPerIndex,c=r.length;for(let u=0;u<c;++u){const d=r[u],h=s[d],m=i[h],g=o[h];t.copyFromBuffer(e,m*a,n*a,g*a),i[h]=n,n+=g}return n}function M5e(e,t){const n=e._indexOffsets,i=e._indexCounts,o=e._batchIdLookUp;let r=t.pop();const s=[r],a=e._va.indexBuffer,c=e._vaSwap.indexBuffer;let u=YP(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){const h=t.pop();if(H.equals(h.color,r.color))u=YP(a,c,u,n,i,h.batchIds,o),r.batchIds=r.batchIds.concat(h.batchIds),r.count=u-r.offset;else{const m=u;u=YP(a,c,u,n,i,h.batchIds,o),h.offset=m,h.count=u-m,s.push(h),r=h}}const d=e._va;e._va=e._vaSwap,e._vaSwap=d,e._batchedIndices=s}function F5e(e,t){return t.color.toRgba()-e.color.toRgba()}function z5e(e,t){if(!e._batchDirty)return!1;const n=e._batchedIndices,i=n.length;let o=!1;const r={};for(let s=0;s<i;++s){const c=n[s].color.toRgba();if(l(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(F5e),t.webgl2?M5e(e,n):N5e(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function U5e(e,t){const n=z5e(e,t),i=e._commands,o=e._batchedIndices,r=o.length,s=r*2;if(l(i)&&!n&&i.length===s)return;i.length=s;const a=e._va,c=e._sp,u=A(e._modelMatrix,B.IDENTITY),d=e._uniformMap,h=e._boundingVolume;for(let m=0;m<r;++m){const g=o[m].offset,p=o[m].count;let y=i[m*2];l(y)||(y=i[m*2]=new mt({owner:e})),y.vertexArray=a,y.modelMatrix=u,y.offset=g,y.count=p,y.renderState=e._rsStencilDepthPass,y.shaderProgram=c,y.uniformMap=d,y.boundingVolume=h,y.cull=!1,y.pass=Ne.TERRAIN_CLASSIFICATION;const b=mt.shallowClone(y,y.derivedCommands.tileset);b.renderState=e._rsStencilDepthPass3DTiles,b.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,y.derivedCommands.tileset=b;let C=i[m*2+1];l(C)||(C=i[m*2+1]=new mt({owner:e})),C.vertexArray=a,C.modelMatrix=u,C.offset=g,C.count=p,C.renderState=e._rsColorPass,C.shaderProgram=c,C.uniformMap=d,C.boundingVolume=h,C.cull=!1,C.pass=Ne.TERRAIN_CLASSIFICATION;const E=mt.shallowClone(C,C.derivedCommands.tileset);E.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,C.derivedCommands.tileset=E}e._commandsDirty=!0}function H5e(e,t){if(e.classificationType===vo.TERRAIN||!t.invertClassification||l(e._commandsIgnoreShow)&&!e._commandsDirty)return;const n=e._commands,i=e._commandsIgnoreShow,o=e._spStencil,r=n.length,s=i.length=r/2;let a=0;for(let c=0;c<s;++c){const u=i[c]=mt.shallowClone(n[a],i[c]);u.shaderProgram=o,u.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function V5e(e){if(!e._pickCommandsDirty)return;const t=e._indexOffsets.length,n=e._pickCommands;n.length=t*2;const i=e._va,o=e._spStencil,r=e._spPick,s=A(e._modelMatrix,B.IDENTITY),a=e._uniformMap;for(let c=0;c<t;++c){const u=e._indexOffsets[c],d=e._indexCounts[c],h=l(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let m=n[c*2];l(m)||(m=n[c*2]=new mt({owner:e,pickOnly:!0})),m.vertexArray=i,m.modelMatrix=s,m.offset=u,m.count=d,m.renderState=e._rsStencilDepthPass,m.shaderProgram=o,m.uniformMap=a,m.boundingVolume=h,m.pass=Ne.TERRAIN_CLASSIFICATION;const g=mt.shallowClone(m,m.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,m.derivedCommands.tileset=g;let p=n[c*2+1];l(p)||(p=n[c*2+1]=new mt({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=u,p.count=d,p.renderState=e._rsPickPass,p.shaderProgram=r,p.uniformMap=a,p.boundingVolume=h,p.pass=Ne.TERRAIN_CLASSIFICATION;const y=mt.shallowClone(p,p.derivedCommands.tileset);y.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=y}e._pickCommandsDirty=!1}Dd.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new As(e,r)}};Dd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function k5e(e,t){e._updatingAllCommands=!0;const n=e._batchIds;let i=n.length,o;for(o=0;o<i;++o){const s=n[o],a=t[s];a.show=!0,a.color=H.WHITE}const r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=H.clone(H.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}const G5e=new H,W5e=H.WHITE,j5e=!0,q5e=/\$/;Dd.prototype.applyStyle=function(e,t){if(!l(e)){k5e(this,t);return}const n=e.color,i=n instanceof pu&&!q5e.test(n.expression);this._updatingAllCommands=i;const o=this._batchIds;let r=o.length,s;for(s=0;s<r;++s){const a=o[s],c=t[a];c.color=l(e.color)?e.color.evaluateColor(c,G5e):W5e,c.show=l(e.show)?e.show.evaluate(c):j5e}if(i){const a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=H.clone(H.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};Dd.prototype.updateCommands=function(e,t){if(this._updatingAllCommands)return;const n=this._batchIdLookUp,i=n[e];if(!l(i))return;const o=this._indexOffsets,r=this._indexCounts,s=o[i],a=r[i],c=this._batchedIndices,u=c.length;let d;for(d=0;d<u;++d){const y=c[d].offset,b=c[d].count;if(s>=y&&s<y+b)break}c.push(new sv({color:H.clone(t),offset:s,count:a,batchIds:[e]}));const h=[],m=[],g=c[d].batchIds,p=g.length;for(let y=0;y<p;++y){const b=g[y];if(b===e)continue;const C=n[b];o[C]<s?h.push(b):m.push(b)}m.length!==0&&c.push(new sv({color:H.clone(c[d].color),offset:s+a,count:c[d].offset+c[d].count-(s+a),batchIds:m})),h.length!==0?(c[d].count=s-c[d].offset,c[d].batchIds=h):c.splice(d,1),this._batchDirty=!0};function s5(e,t,n,i){const o=e.classificationType,r=o!==vo.CESIUM_3D_TILE,s=o!==vo.TERRAIN,a=t.commandList;let c=n.length,u,d;for(d=0;d<c;++d)r&&(u=n[d],u.pass=Ne.TERRAIN_CLASSIFICATION,a.push(u)),s&&(u=n[d].derivedCommands.tileset,u.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,a.push(u));if(!(!t.invertClassification||!l(i)))for(c=i.length,d=0;d<c;++d)a.push(i[d])}function $5e(e,t){const n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){const r=t[o+1];r.pass=Ne.OPAQUE,n.push(r)}}function Y5e(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;l(e._rsWireframe)||(e._rsWireframe=et.fromCache({}));let n,i;e.debugWireframe?(n=e._rsWireframe,i=Ze.LINES):(n=e._rsColorPass,i=Ze.TRIANGLES);const o=e._commands,r=o.length;for(let s=0;s<r;s+=2){const a=o[s+1];a.renderState=n,a.primitiveType=i}e._debugWireframe=e.debugWireframe,e._wireframeDirty=!1}Dd.prototype.update=function(e){const t=e.context;I5e(this,t),P5e(this,t),B5e(this),R5e(this,t);const n=e.passes;n.render&&(U5e(this,t),H5e(this,e),Y5e(this),this._debugWireframe?$5e(e,this._commands):s5(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(V5e(this),s5(this,e,this._pickCommands))};Dd.prototype.isDestroyed=function(){return!1};Dd.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(),He(this)};function Ps(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,l(this._center)||(l(this._boundingVolume)?this._center=f.clone(this._boundingVolume.center):this._center=f.clone(f.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=tGe(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=vo.BOTH}Object.defineProperties(Ps.prototype,{trianglesLength:{get:function(){return l(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});Ps.packedBoxLength=B.packedLength+f.packedLength;Ps.packedCylinderLength=B.packedLength+2;Ps.packedEllipsoidLength=B.packedLength+f.packedLength;Ps.packedSphereLength=f.packedLength+1;function X5e(e){const t=new Float64Array(B.packedLength+f.packedLength);let n=0;return f.pack(e._center,t,n),n+=f.packedLength,B.pack(e._modelMatrix,t,n),t}function K5e(e,t){let n=0;const i=t[n++],o=t[n++],r=e._boundingVolumes=new Array(o);for(let c=0;c<o;++c)r[c]=fe.unpack(t,n),n+=fe.packedLength;const s=t[n++],a=e._batchedIndices=new Array(s);for(let c=0;c<s;++c){const u=H.unpack(t,n);n+=H.packedLength;const d=t[n++],h=t[n++],m=t[n++],g=new Array(m);for(let p=0;p<m;++p)g[p]=t[n++];a[c]=new sv({color:u,offset:d,count:h,batchIds:g})}return i}const J5e=new Vi("createVectorTileGeometries",5),Q5e=new H;function Z5e(e){if(!l(e._primitive)&&!l(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,u=e._batchTableColors,d=e._packedBuffer;if(!l(u)){let p=0;l(e._boxes)&&(t=e._boxes=t.slice(),n=e._boxBatchIds=n.slice(),p+=n.length),l(e._cylinders)&&(i=e._cylinders=i.slice(),o=e._cylinderBatchIds=o.slice(),p+=o.length),l(e._ellipsoids)&&(r=e._ellipsoids=r.slice(),s=e._ellipsoidBatchIds=s.slice(),p+=s.length),l(e._spheres)&&(a=e._sphere=a.slice(),c=e._sphereBatchIds=c.slice(),p+=c.length),u=e._batchTableColors=new Uint32Array(p);const y=e._batchTable;for(let b=0;b<p;++b){const C=y.getColor(b,Q5e);u[b]=C.toRgba()}d=e._packedBuffer=X5e(e)}const h=[];l(t)&&h.push(t.buffer,n.buffer),l(i)&&h.push(i.buffer,o.buffer),l(r)&&h.push(r.buffer,s.buffer),l(a)&&h.push(a.buffer,c.buffer),h.push(u.buffer,d.buffer);const m={boxes:l(t)?t.buffer:void 0,boxBatchIds:l(t)?n.buffer:void 0,cylinders:l(i)?i.buffer:void 0,cylinderBatchIds:l(i)?o.buffer:void 0,ellipsoids:l(r)?r.buffer:void 0,ellipsoidBatchIds:l(r)?s.buffer:void 0,spheres:l(a)?a.buffer:void 0,sphereBatchIds:l(a)?c.buffer:void 0,batchTableColors:u.buffer,packedBuffer:d.buffer},g=e._verticesPromise=J5e.scheduleTask(m,h);return l(g)?g.then(function(p){const y=new Float64Array(p.packedBuffer);K5e(e,y)===2?e._indices=new Uint16Array(p.indices):e._indices=new Uint32Array(p.indices),e._indexOffsets=new Uint32Array(p.indexOffsets),e._indexCounts=new Uint32Array(p.indexCounts),e._positions=new Float32Array(p.positions),e._vertexBatchIds=new Uint16Array(p.vertexBatchIds),e._batchIds=new Uint16Array(p.batchIds),e._ready=!0}):void 0}}function eGe(e){e._ready&&!l(e._primitive)&&(e._primitive=new Dd({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:A(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)}Ps.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Ps.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Ps.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Ps.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function tGe(e){return new Promise(function(t,n){e._update=function(i,o){const r=Z5e(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),l(r)&&r.then(function(){eGe(i),t(i)}).catch(function(s){n(s)})}})}Ps.prototype.update=function(e){this._update(this,e)};Ps.prototype.isDestroyed=function(){return!1};Ps.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)};function Jf(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=oGe(this,i,o)}Object.defineProperties(Jf.prototype,{featuresLength:{get:function(){return l(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return 0}},trianglesLength:{get:function(){return l(this._geometries)?this._geometries.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._geometries)?this._geometries.geometryByteLength:0}},texturesByteLength:{get:function(){return 0}},batchTableByteLength:{get:function(){return l(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 nGe(e){return function(t,n){l(e._geometries)&&e._geometries.updateCommands(t,n)}}function iGe(e,t){let n,i,o,r,s;const a=A(e.BOXES_LENGTH,0),c=A(e.CYLINDERS_LENGTH,0),u=A(e.ELLIPSOIDS_LENGTH,0),d=A(e.SPHERES_LENGTH,0);if(a>0&&l(e.BOX_BATCH_IDS)){const p=t.byteOffset+e.BOX_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,p,a)}if(c>0&&l(e.CYLINDER_BATCH_IDS)){const p=t.byteOffset+e.CYLINDER_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,p,c)}if(u>0&&l(e.ELLIPSOID_BATCH_IDS)){const p=t.byteOffset+e.ELLIPSOID_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,p,u)}if(d>0&&l(e.SPHERE_BATCH_IDS)){const p=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,p,d)}const h=l(n)||l(i)||l(o)||l(r),m=a>0&&!l(n)||c>0&&!l(i)||u>0&&!l(o)||d>0&&!l(r);if(h&&m)throw new Ie("If one group of batch ids is defined, then all batch ids must be defined.");if(!l(n)&&!l(i)&&!l(o)&&!l(r)){let p=0;if(!l(n)&&a>0)for(n=new Uint16Array(a),s=0;s<a;++s)n[s]=p++;if(!l(i)&&c>0)for(i=new Uint16Array(c),s=0;s<c;++s)i[s]=p++;if(!l(o)&&u>0)for(o=new Uint16Array(u),s=0;s<u;++s)o[s]=p++;if(!l(r)&&d>0)for(r=new Uint16Array(d),s=0;s<d;++s)r[s]=p++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}const xm=Uint32Array.BYTES_PER_ELEMENT;function oGe(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=xm;const r=o.getUint32(n,!0);if(r!==1)throw new Ie(`Only Geometry tile version 1 is supported. Version ${r} is not.`);n+=xm;const s=o.getUint32(n,!0);if(n+=xm,s===0){e._readyPromise.resolve(e);return}const a=o.getUint32(n,!0);if(n+=xm,a===0)throw new Ie("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=xm;const u=o.getUint32(n,!0);n+=xm;const d=o.getUint32(n,!0);n+=xm;const h=Ya(i,n,a);n+=a;const m=new Uint8Array(t,n,c);n+=c;let g,p;u>0&&(g=Ya(i,n,u),n+=u,d>0&&(p=new Uint8Array(t,n,d),p=new Uint8Array(p)));const y=A(h.BOXES_LENGTH,0),b=A(h.CYLINDERS_LENGTH,0),C=A(h.ELLIPSOIDS_LENGTH,0),E=A(h.SPHERES_LENGTH,0),w=y+b+C+E,S=new Pi(e,w,g,p,nGe(e));if(e._batchTable=S,w===0)return;const P=e.tile.computedTransform;let L;l(h.RTC_CENTER)&&(L=f.unpack(h.RTC_CENTER),B.multiplyByPoint(P,L,L));const z=iGe(h,m);if(y>0||b>0||C>0||E>0){let R,F,U,D;if(y>0){const I=m.byteOffset+h.BOXES.byteOffset;R=new Float32Array(m.buffer,I,Ps.packedBoxLength*y)}if(b>0){const I=m.byteOffset+h.CYLINDERS.byteOffset;F=new Float32Array(m.buffer,I,Ps.packedCylinderLength*b)}if(C>0){const I=m.byteOffset+h.ELLIPSOIDS.byteOffset;U=new Float32Array(m.buffer,I,Ps.packedEllipsoidLength*C)}if(E>0){const I=m.byteOffset+h.SPHERES.byteOffset;D=new Float32Array(m.buffer,I,Ps.packedSphereLength*E)}return e._geometries=new Ps({boxes:R,boxBatchIds:z.boxes,cylinders:F,cylinderBatchIds:z.cylinders,ellipsoids:U,ellipsoidBatchIds:z.ellipsoids,spheres:D,sphereBatchIds:z.spheres,center:L,modelMatrix:P,batchTable:S,boundingVolume:e.tile.boundingVolume.boundingVolume}),e._geometries.readyPromise.then(function(){return e})}return Promise.resolve(e)}function oK(e){const t=e.featuresLength;if(!l(e._features)&&t>0){const n=new Array(t);l(e._geometries)&&e._geometries.createFeatures(e,n),e._features=n}}Jf.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Jf.prototype.getFeature=function(e){const t=this.featuresLength;if(!l(e)||e<0||e>=t)throw new x(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return oK(this),this._features[e]};Jf.prototype.applyDebugSettings=function(e,t){l(this._geometries)&&this._geometries.applyDebugSettings(e,t)};Jf.prototype.applyStyle=function(e){oK(this),l(this._geometries)&&this._geometries.applyStyle(e,this._features)};Jf.prototype.update=function(e,t){l(this._geometries)&&(this._geometries.classificationType=this._tileset.classificationType,this._geometries.debugWireframe=this._tileset.debugWireframe,this._geometries.update(t)),l(this._batchTable)&&this._geometries._ready&&this._batchTable.update(e,t)};Jf.prototype.isDestroyed=function(){return!1};Jf.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),He(this)};const I2={};I2.encode2D=function(e,t,n){const i=Math.pow(2,e);if(T.typeOf.number("level",e),T.typeOf.number("x",t),T.typeOf.number("y",n),e<1)throw new x("Hilbert level cannot be less than 1.");if(t<0||t>=i||n<0||n>=i)throw new x("Invalid coordinates for given level.");const o={x:t,y:n};let 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),rK(i,o,r,s);return c};I2.decode2D=function(e,t){if(T.typeOf.number("level",e),T.typeOf.bigint("index",t),e<1)throw new x("Hilbert level cannot be less than 1.");if(t<BigInt(0)||t>=BigInt(Math.pow(4,e)))throw new x("Hilbert index exceeds valid maximum for given level.");const n=Math.pow(2,e),i={x:0,y:0};let 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)),rK(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function rK(e,t,n,i){if(i!==0)return;n===1&&(t.x=e-1-t.x,t.y=e-1-t.y);const o=t.x;t.x=t.y,t.y=o}const a5=I2,nm=30,rGe=1<<nm,sGe=1<<nm+1>>>0,P2=2*nm+1,qh=4,sK=[],aK=[],aGe=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],ip=1,Sy=2,Mx=[ip,0,0,ip|Sy];function io(e){if(!gn.supportsBigInt())throw new Ie("S2 required BigInt support");if(!l(e))throw new x("cell ID is required.");if(!io.isValidId(e))throw new x("cell ID is invalid.");this._cellId=e,this._level=io.getLevel(e)}io.fromToken=function(e){if(T.typeOf.string("token",e),!io.isValidToken(e))throw new x("token is invalid.");return new io(io.getIdFromToken(e))};io.isValidId=function(e){return T.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(P2)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};io.isValidToken=function(e){return T.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?io.isValidId(io.getIdFromToken(e)):!1};io.getIdFromToken=function(e){return T.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};io.getTokenFromId=function(e){T.typeOf.bigint("cellId",e);const t=Math.floor(gGe(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};io.getLevel=function(e){if(T.typeOf.bigint("cellId",e),!io.isValidId(e))throw new x;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return nm-(t>>1)};io.prototype.getChild=function(e){if(T.typeOf.number("index",e),e<0||e>3)throw new x("child index must be in the range [0-3].");if(this._level===30)throw new x("cannot get child of leaf cell.");const t=uK(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new io(n)};io.prototype.getParent=function(){if(this._level===0)throw new x("cannot get parent of root cell.");const e=uK(this._cellId)<<BigInt(2);return new io(this._cellId&~e+BigInt(1)|e)};io.prototype.getParentAtLevel=function(e){if(this._level===0||e<0||this._level<e)throw new x("cannot get parent at invalid level.");const t=mGe(e);return new io(this._cellId&-t|t)};io.prototype.getCenter=function(e){e=A(e,me.WGS84);let t=cGe(this._cellId,this._level);t=f.normalize(t,t);const n=new Ce.fromCartesian(t,me.UNIT_SPHERE);return Ce.toCartesian(n,e,new f)};io.prototype.getVertex=function(e,t){if(T.typeOf.number("index",e),e<0||e>3)throw new x("vertex index must be in the range [0-3].");t=A(t,me.WGS84);let n=lGe(this._cellId,this._level,e);n=f.normalize(n,n);const i=new Ce.fromCartesian(n,me.UNIT_SPHERE);return Ce.toCartesian(i,t,new f)};io.fromFacePositionLevel=function(e,t,n){if(T.typeOf.bigint("position",t),e<0||e>5)throw new x("Invalid S2 Face (must be within 0-5)");if(n<0||n>nm)throw new x("Invalid level (must be within 0-30)");if(t<0||t>=Math.pow(4,n))throw new x("Invalid Hilbert position for level");const 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(P2-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new io(a)};function cGe(e,t){const n=uGe(e,t);return dGe(n[0],n[1],n[2])}function lGe(e,t,n){const i=cK(e),o=fGe([i[1],i[2]],t),r=n>>1&1;return lK(i[0],o[0][r^n&1],o[1][r])}function uGe(e,t){const n=cK(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,u=(o<<1)+c,d=(r<<1)+c;return[i,u,d]}function cK(e){sK.length===0&&pGe();const t=Number(e>>BigInt(P2));let n=t&ip;const i=(1<<qh)-1;let o=0,r=0;for(let s=7;s>=0;s--){const c=(1<<2*(s===7?nm-7*qh:qh))-1;n+=Number(e>>BigInt(s*2*qh+1)&BigInt(c))<<2,n=aK[n];const u=s*qh;o+=n>>qh+2<<u,r+=(n>>2&i)<<u,n&=ip|Sy}return[t,o,r]}function dGe(e,t,n){const i=c5(t),o=c5(n),r=cv(i),s=cv(o);return lK(e,r,s)}function lK(e,t,n){switch(e){case 0:return new f(1,t,n);case 1:return new f(-t,1,n);case 2:return new f(-t,-n,1);case 3:return new f(-1,-n,-t);case 4:return new f(n,-1,-t);default:return new f(n,t,-1)}}function cv(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function c5(e){return 1/sGe*e}function fGe(e,t){const n=[[],[]],i=hGe(t);for(let o=0;o<2;++o){const r=e[o]&-i,s=r+i;n[o][0]=cv(l5(r)),n[o][1]=cv(l5(s))}return n}function hGe(e){return 1<<nm-e>>>0}function l5(e){return 1/rGe*e}function op(e,t,n,i,o,r){if(e===qh){const s=(t<<qh)+n;sK[(s<<2)+i]=(o<<2)+r,aK[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;const s=aGe[r];op(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^Mx[0]),op(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^Mx[1]),op(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^Mx[2]),op(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^Mx[3])}}function pGe(){op(0,0,0,0,0,0),op(0,0,0,ip,0,ip),op(0,0,0,Sy,0,Sy),op(0,0,0,ip|Sy,0,ip|Sy)}function uK(e){return e&~e+BigInt(1)}function mGe(e){return BigInt(1)<<BigInt(2*(nm-e))}const _Ge=[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 gGe(e){return _Ge[(-e&e)%BigInt(67)]}function hr(e,t){return l(e)&&l(e.extensions)&&l(e.extensions[t])}function lv(e){const t=e.lengthBits;let n=e.availableCount;T.typeOf.number("options.lengthBits",t);const i=e.constant,o=e.bitstream;if(l(i))n=t;else{const r=Math.ceil(t/8);if(o.length!==r)throw new Ie(`Availability bitstream must be exactly ${r} bytes long to store ${t} bits. Actual bitstream was ${o.length} bytes long.`);const s=A(e.computeAvailableCountEnabled,!1);!l(n)&&s&&(n=yGe(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function yGe(e,t){let n=0;for(let i=0;i<t;i++){const o=i>>3,r=i%8;n+=e[o]>>r&1}return n}Object.defineProperties(lv.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});lv.prototype.getBit=function(e){if(e<0||e>=this._lengthBits)throw new x("Bit index out of bounds.");if(l(this._constant))return this._constant;const t=e>>3,n=e%8;return(this._bitstream[t]>>n&1)===1};function Id(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;T.typeOf.object("options.metadataTable",t),T.typeOf.object("options.class",n),T.typeOf.number("options.entityId",i),T.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(Id.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Id.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};Id.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};Id.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};Id.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};Id.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};Id.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};Id.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const oS={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};oS.getBranchingFactor=function(e){switch(e){case oS.OCTREE:return 8;case oS.QUADTREE:return 4;default:throw new x("subdivisionScheme is not a valid value.")}};const Lr=Object.freeze(oS);function Xt(){}Object.defineProperties(Xt.prototype,{class:{get:function(){x.throwInstantiationError()}}});Xt.prototype.hasProperty=function(e){x.throwInstantiationError()};Xt.prototype.hasPropertyBySemantic=function(e){x.throwInstantiationError()};Xt.prototype.getPropertyIds=function(e){x.throwInstantiationError()};Xt.prototype.getProperty=function(e){x.throwInstantiationError()};Xt.prototype.setProperty=function(e,t){x.throwInstantiationError()};Xt.prototype.getPropertyBySemantic=function(e){x.throwInstantiationError()};Xt.prototype.setPropertyBySemantic=function(e,t){x.throwInstantiationError()};Xt.hasProperty=function(e,t,n){if(T.typeOf.string("propertyId",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n),l(t[e]))return!0;const i=n.properties;if(!l(i))return!1;const o=i[e];return!!(l(o)&&l(o.default))};Xt.hasPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return!1;const o=i[e];return l(o)};Xt.getPropertyIds=function(e,t,n){T.typeOf.object("properties",e),T.typeOf.object("classDefinition",t),n=l(n)?n:[],n.length=0;for(const o in e)e.hasOwnProperty(o)&&l(e[o])&&n.push(o);const i=t.properties;if(l(i))for(const o in i)i.hasOwnProperty(o)&&!l(e[o])&&l(i[o].default)&&n.push(o);return n};Xt.getProperty=function(e,t,n){if(T.typeOf.string("propertyId",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n),!l(n.properties[e]))throw new x(`Class definition missing property ${e}`);const i=n.properties[e];let o=t[e];Array.isArray(o)&&(o=o.slice());const r=!0;if(o=i.handleNoData(o),!l(o)&&l(i.default))return o=ht(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(l(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};Xt.setProperty=function(e,t,n,i){if(T.typeOf.string("propertyId",e),T.defined("value",t),T.typeOf.object("properties",n),T.typeOf.object("classDefinition",i),!l(n[e]))return!1;Array.isArray(t)&&(t=t.slice());let o;const r=i.properties;l(r)&&(o=r[e]);const s=!0;return l(o)&&(t=o.packVectorAndMatrixTypes(t,s),t=o.unapplyValueTransform(t),t=o.unnormalize(t)),n[e]=t,!0};Xt.getPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",e),T.typeOf.object("properties",t),T.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return;const o=i[e];if(l(o))return Xt.getProperty(o.id,t,n)};Xt.setPropertyBySemantic=function(e,t,n,i){T.typeOf.string("semantic",e),T.defined("value",t),T.typeOf.object("properties",n),T.typeOf.object("classDefinition",i);const o=i.propertiesBySemantic;if(!l(o))return!1;const r=i.propertiesBySemantic[e];return l(r)?Xt.setProperty(r.id,t,n,i):!1};function Qf(e){e=A(e,A.EMPTY_OBJECT);const t=e.subtreeMetadata,n=e.class;T.typeOf.object("options.subtreeMetadata",t),T.typeOf.object("options.class",n);const i=l(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(Qf.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Qf.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};Qf.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};Qf.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};Qf.prototype.getProperty=function(e){return Xt.getProperty(e,this._properties,this._class)};Qf.prototype.setProperty=function(e,t){return Xt.setProperty(e,t,this._properties,this._class)};Qf.prototype.getPropertyBySemantic=function(e){return Xt.getPropertyBySemantic(e,this._properties,this._class)};Qf.prototype.setPropertyBySemantic=function(e,t){return Xt.setPropertyBySemantic(e,t,this._properties,this._class)};const pt={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};pt.getMinimum=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:return-128;case pt.UINT8:return 0;case pt.INT16:return-32768;case pt.UINT16:return 0;case pt.INT32:return-2147483648;case pt.UINT32:return 0;case pt.INT64:return gn.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case pt.UINT64:return gn.supportsBigInt()?BigInt(0):0;case pt.FLOAT32:return-34028234663852886e22;case pt.FLOAT64:return-Number.MAX_VALUE}};pt.getMaximum=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:return 127;case pt.UINT8:return 255;case pt.INT16:return 32767;case pt.UINT16:return 65535;case pt.INT32:return 2147483647;case pt.UINT32:return 4294967295;case pt.INT64:return gn.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case pt.UINT64:return gn.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case pt.FLOAT32:return 34028234663852886e22;case pt.FLOAT64:return Number.MAX_VALUE}};pt.isIntegerType=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:case pt.UINT8:case pt.INT16:case pt.UINT16:case pt.INT32:case pt.UINT32:case pt.INT64:case pt.UINT64:return!0;default:return!1}};pt.isUnsignedIntegerType=function(e){switch(T.typeOf.string("type",e),e){case pt.UINT8:case pt.UINT16:case pt.UINT32:case pt.UINT64:return!0;default:return!1}};pt.isVectorCompatible=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:case pt.UINT8:case pt.INT16:case pt.UINT16:case pt.INT32:case pt.UINT32:case pt.FLOAT32:case pt.FLOAT64:return!0;default:return!1}};pt.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new x("value must be a number or a BigInt");if(!pt.isIntegerType(t))throw new x("type must be an integer type");return Math.max(Number(e)/Number(pt.getMaximum(t)),-1)};pt.unnormalize=function(e,t){if(T.typeOf.number("value",e),!pt.isIntegerType(t))throw new x("type must be an integer type");const n=pt.getMaximum(t),i=pt.isUnsignedIntegerType(t)?0:-n;return e=M.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===pt.INT64||t===pt.UINT64)&&gn.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};pt.applyValueTransform=function(e,t,n){return n*e+t};pt.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};pt.getSizeInBytes=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:case pt.UINT8:return 1;case pt.INT16:case pt.UINT16:return 2;case pt.INT32:case pt.UINT32:return 4;case pt.INT64:case pt.UINT64:return 8;case pt.FLOAT32:return 4;case pt.FLOAT64:return 8}};pt.fromComponentDatatype=function(e){switch(T.typeOf.number("componentDatatype",e),e){case ee.BYTE:return pt.INT8;case ee.UNSIGNED_BYTE:return pt.UINT8;case ee.SHORT:return pt.INT16;case ee.UNSIGNED_SHORT:return pt.UINT16;case ee.INT:return pt.INT32;case ee.UNSIGNED_INT:return pt.UINT32;case ee.FLOAT:return pt.FLOAT32;case ee.DOUBLE:return pt.FLOAT64}};pt.toComponentDatatype=function(e){switch(T.typeOf.string("type",e),e){case pt.INT8:return ee.BYTE;case pt.UINT8:return ee.UNSIGNED_BYTE;case pt.INT16:return ee.SHORT;case pt.UINT16:return ee.UNSIGNED_SHORT;case pt.INT32:return ee.INT;case pt.UINT32:return ee.UNSIGNED_INT;case pt.FLOAT32:return ee.FLOAT;case pt.FLOAT64:return ee.DOUBLE}};const $t=Object.freeze(pt),so={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};so.isVectorType=function(e){switch(T.typeOf.string("type",e),e){case so.VEC2:case so.VEC3:case so.VEC4:return!0;default:return!1}};so.isMatrixType=function(e){switch(T.typeOf.string("type",e),e){case so.MAT2:case so.MAT3:case so.MAT4:return!0;default:return!1}};so.getComponentCount=function(e){switch(T.typeOf.string("type",e),e){case so.SCALAR:case so.STRING:case so.ENUM:case so.BOOLEAN:return 1;case so.VEC2:return 2;case so.VEC3:return 3;case so.VEC4:return 4;case so.MAT2:return 4;case so.MAT3:return 9;case so.MAT4:return 16;default:throw new x(`Invalid metadata type ${e}`)}};so.getMathType=function(e){switch(e){case so.VEC2:return j;case so.VEC3:return f;case so.VEC4:return oe;case so.MAT2:return dt;case so.MAT3:return J;case so.MAT4:return B;default:return}};const Bt=Object.freeze(so);function Jr(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.type;T.typeOf.string("options.id",t),T.typeOf.string("options.type",n);const i=e.componentType,o=e.enumType,r=l(i)&&$t.isIntegerType(i)&&A(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=l(o)?o.valueType:i,this._isArray=A(e.isArray,!1),this._isVariableLengthArray=A(e.isVariableLengthArray,!1),this._arrayLength=e.arrayLength,this._min=ht(e.min,!0),this._max=ht(e.max,!0),this._normalized=r;let s=ht(e.offset,!0),a=ht(e.scale,!0);const c=l(s)||l(a),u=!0;l(s)||(s=this.expandConstant(0,u)),l(a)||(a=this.expandConstant(1,u)),this._offset=s,this._scale=a,this._hasValueTransform=c,this._noData=ht(e.noData,!0),this._default=ht(e.default,!0),this._required=A(e.required,!0),this._extras=ht(e.extras,!0),this._extensions=ht(e.extensions,!0)}Jr.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.property;T.typeOf.string("options.id",t),T.typeOf.object("options.property",n),T.typeOf.string("options.property.type",n.type);const i=AGe(n),o=bGe(n,e.enums);let r;return l(i)?i?r=l(n.optional)?!n.optional:!0:r=A(n.required,!1):r=!1,new Jr({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(Jr.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 AGe(e){if(e.type==="ARRAY")return!0;const t=e.type;if(t===Bt.SCALAR||Bt.isMatrixType(t)||Bt.isVectorType(t))return!1;if(l($t[t]))return!0;if(l(e.noData)||l(e.scale)||l(e.offset)||l(e.required)||l(e.count)||l(e.array)||l(e.optional))return!1}function bGe(e,t){const n=e.type,i=e.componentType,o=n==="ARRAY";let r,s,a;o?(r=!0,s=e.componentCount,a=!l(s)):e.array?(r=!0,s=e.count,a=!l(e.count)):(r=!1,s=void 0,a=!1);let c;if(l(e.enumType)&&(c=t[e.enumType]),n===Bt.ENUM)return{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===Bt.ENUM)return{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Bt.SCALAR||Bt.isMatrixType(n)||Bt.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===Bt.BOOLEAN||n===Bt.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===Bt.BOOLEAN||i===Bt.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l(i)&&l($t[i]))return{type:Bt.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l($t[n]))return{type:Bt.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new x(`unknown metadata type {type: ${n}, componentType: ${i})`)}Jr.prototype.normalize=function(e){return this._normalized?O2(e,this._valueType,$t.normalize):e};Jr.prototype.unnormalize=function(e){return this._normalized?O2(e,this._valueType,$t.unnormalize):e};Jr.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Jr.valueTransformInPlace(e,this._offset,this._scale,$t.applyValueTransform)};Jr.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Jr.valueTransformInPlace(e,this._offset,this._scale,$t.unapplyValueTransform)};Jr.prototype.expandConstant=function(e,t){t=A(t,!1);const n=this._isArray,i=this._arrayLength,o=Bt.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);const s=new Array(o).fill(e);return new Array(this._arrayLength).fill(s)};Jr.prototype.handleNoData=function(e){const t=this._noData;if(!l(t))return e;if(!dK(e,t))return e};function dK(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(!dK(e[n],t[n]))return!1;return!0}Jr.prototype.unpackVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=Bt.getMathType(this._type),i=this._isArray,o=Bt.getComponentCount(this._type),r=i&&o>1;return l(n)?t&&r?e.map(function(s){return n.unpack(s)}):i?n.unpackArray(e):n.unpack(e):e};Jr.prototype.packVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=Bt.getMathType(this._type),i=this._isArray,o=Bt.getComponentCount(this._type),r=i&&o>1;return l(n)?t&&r?e.map(function(s){return n.pack(s,[])}):i?n.packArray(e,[]):n.pack(e,[]):e};Jr.prototype.validate=function(e){if(!(!l(e)&&l(this._default)))return this._required&&!l(e)?"required property must have a value":this._isArray?CGe(this,e):fK(this,e)};function CGe(e,t){if(!Array.isArray(t))return`value ${t} must be an array`;const n=t.length;if(!e._isVariableLengthArray&&n!==e._arrayLength)return"Array length does not match property.arrayLength";for(let i=0;i<n;i++){const o=fK(e,t[i]);if(l(o))return o}}function fK(e,t){const n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return Bt.isVectorType(n)?TGe(t,n,i):Bt.isMatrixType(n)?EGe(t,n,i):n===Bt.STRING?xGe(t):n===Bt.BOOLEAN?wGe(t):n===Bt.ENUM?SGe(t,o):vGe(t,i,r)}function TGe(e,t,n){if(!$t.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===Bt.VEC2&&!(e instanceof j))return`vector value ${e} must be a Cartesian2`;if(t===Bt.VEC3&&!(e instanceof f))return`vector value ${e} must be a Cartesian3`;if(t===Bt.VEC4&&!(e instanceof oe))return`vector value ${e} must be a Cartesian4`}function EGe(e,t,n){if(!$t.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===Bt.MAT2&&!(e instanceof dt))return`matrix value ${e} must be a Matrix2`;if(t===Bt.MAT3&&!(e instanceof J))return`matrix value ${e} must be a Matrix3`;if(t===Bt.MAT4&&!(e instanceof B))return`matrix value ${e} must be a Matrix4`}function xGe(e){if(typeof e!="string")return uv(e,Bt.STRING)}function wGe(e){if(typeof e!="boolean")return uv(e,Bt.BOOLEAN)}function SGe(e,t){const n=typeof e;if(l(t))return n!=="string"||!l(t.valuesByName[e])?`value ${e} is not a valid enum name for ${t.id}`:void 0}function vGe(e,t,n){const i=typeof e;switch(t){case $t.INT8:case $t.UINT8:case $t.INT16:case $t.UINT16:case $t.INT32:case $t.UINT32:case $t.FLOAT32:case $t.FLOAT64:return i!=="number"?uv(e,t):isFinite(e)?d5(e,t,n):f5(e,t);case $t.INT64:case $t.UINT64:return i!=="number"&&i!=="bigint"?uv(e,t):i==="number"&&!isFinite(e)?f5(e,t):d5(e,t,n)}}function uv(e,t){return`value ${e} does not match type ${t}`}function u5(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function d5(e,t,n){if(n){const i=$t.isUnsignedIntegerType(t)?0:-1,o=1;return e<i||e>o?u5(e,t,n):void 0}if(e<$t.getMinimum(t)||e>$t.getMaximum(t))return u5(e,t,n)}function f5(e,t){return`value ${e} of type ${t} must be finite`}function O2(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=O2(e[i],t,n);return e}Jr.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]=Jr.valueTransformInPlace(e[o],t[o],n[o],i);return e};function PT(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews;T.typeOf.number.greaterThan("options.count",t,0),T.typeOf.object("options.property",n),T.typeOf.object("options.classProperty",i),T.typeOf.object("options.bufferViews",o);const r=i.type,s=i.isArray,a=i.isVariableLengthArray;let c=i.valueType;const u=i.enumType,d=r===Bt.STRING,h=r===Bt.BOOLEAN;let m=0,g;if(a){let D=A(n.arrayOffsetType,n.offsetType);D=A($t[D],$t.UINT32);const I=A(n.arrayOffsets,n.arrayOffsetBufferView);g=new XP(o[I],D,t+1),m+=g.typedArray.byteLength}const p=Bt.getComponentCount(r);let y;a?y=g.get(t)-g.get(0):s?y=t*i.arrayLength:y=t;const b=p*y;let C;if(d){let D=A(n.stringOffsetType,n.offsetType);D=A($t[D],$t.UINT32);const I=A(n.stringOffsets,n.stringOffsetBufferView);C=new XP(o[I],D,b+1),m+=C.typedArray.byteLength}(d||h)&&(c=$t.UINT8);let E;d?E=C.get(b)-C.get(0):h?E=Math.ceil(b/8):E=b;const w=A(n.values,n.bufferView),S=new XP(o[w],c,E);m+=S.typedArray.byteLength;let P=n.offset,L=n.scale;const z=i.hasValueTransform||l(P)||l(L);P=A(P,i.offset),L=A(L,i.scale),P=h5(P),L=h5(L);let R,F;const U=this;d?R=function(D){return PGe(D,U._values,U._stringOffsets)}:h?(R=function(D){return OGe(D,U._values)},F=function(D,I){LGe(D,U._values,I)}):l(u)?(R=function(D){const I=U._values.get(D);return u.namesByValue[I]},F=function(D,I){const _=u.valuesByName[I];U._values.set(D,_)}):(R=function(D){return U._values.get(D)},F=function(D,I){U._values.set(D,I)}),this._arrayOffsets=g,this._stringOffsets=C,this._values=S,this._classProperty=i,this._count=t,this._vectorComponentCount=p,this._min=n.min,this._max=n.max,this._offset=P,this._scale=L,this._hasValueTransform=z,this._getValue=R,this._setValue=F,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=m}Object.defineProperties(PT.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}}});PT.prototype.get=function(e){hK(this,e);let t=DGe(this,e);return t=this._classProperty.handleNoData(t),l(t)?(t=this._classProperty.normalize(t),t=HGe(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};PT.prototype.set=function(e,t){const n=this._classProperty;T.defined("value",t),hK(this,e);const i=n.validate(t);if(l(i))throw new x(i);t=n.packVectorAndMatrixTypes(t),t=VGe(this,t),t=n.unnormalize(t),IGe(this,e,t)};PT.prototype.getTypedArray=function(){if(l(this._values))return this._values.typedArray};function h5(e){if(!Array.isArray(e))return e;const t=[];for(let n=0;n<e.length;n++){const i=e[n];Array.isArray(i)?t.push.apply(t,i):t.push(i)}return t}function hK(e,t){const n=e._count;if(!l(t)||t<0||t>=n){const i=n-1;throw new x(`index is required and between zero and count - 1. Actual value: ${i}`)}}function DGe(e,t){mK(e)&&_K(e);const n=e._classProperty,i=n.isArray,o=n.type,r=Bt.getComponentCount(o);if(l(e._unpackedValues)){const s=e._unpackedValues[t];return i?ht(s,!0):s}return!i&&r===1?e._getValue(t):pK(e,n,t)}function pK(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const s=Bt.getComponentCount(t.type);i*=s,o*=s}else{const a=A(t.arrayLength,1)*e._vectorComponentCount;i=n*a,o=a}const r=new Array(o);for(let s=0;s<o;s++)r[s]=e._getValue(i+s);return r}function IGe(e,t,n){zGe(e,t,n)&&_K(e);const i=e._classProperty,o=i.isArray,r=i.type,s=Bt.getComponentCount(r);if(l(e._unpackedValues)){i.isArray&&(n=ht(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{const d=A(i.arrayLength,1)*e._vectorComponentCount;a=t*d,c=d}for(let u=0;u<c;++u)e._setValue(a+u,n[u])}function PGe(e,t,n){const i=n.get(e),o=n.get(e+1)-i;return lc(t.typedArray,i,o)}function OGe(e,t){const n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function LGe(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function BGe(e,t){const n=t.dataView,i=e*8;let o=0;const r=(n.getUint8(i+7)&128)>0;let 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 RGe(e,t){const n=t.dataView,i=e*8;let o=BigInt(0);const r=(n.getUint8(i+7)&128)>0;let 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 NGe(e,t){const n=t.dataView,i=e*8,o=n.getUint32(i,!0),r=n.getUint32(i+4,!0);return o+4294967296*r}function MGe(e,t){const 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 FGe(e){switch(e){case $t.INT8:return ee.BYTE;case $t.UINT8:return ee.UNSIGNED_BYTE;case $t.INT16:return ee.SHORT;case $t.UINT16:return ee.UNSIGNED_SHORT;case $t.INT32:return ee.INT;case $t.UINT32:return ee.UNSIGNED_INT;case $t.FLOAT32:return ee.FLOAT;case $t.FLOAT64:return ee.DOUBLE}}function mK(e){if(l(e._unpackedValues))return!1;const t=e._classProperty,n=t.type,i=t.valueType;return n===Bt.STRING||i===$t.INT64&&!gn.supportsBigInt64Array()||i===$t.UINT64&&!gn.supportsBigUint64Array()}function zGe(e,t,n){if(mK(e))return!0;const i=e._arrayOffsets;if(l(i)){const o=i.get(t+1)-i.get(t),r=n.length;if(o!==r)return!0}return!1}function _K(e){e._unpackedValues=UGe(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function UGe(e){const t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=Bt.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]=pK(e,i,a);return n}function HGe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Jr.valueTransformInPlace(t,e._offset,e._scale,$t.applyValueTransform)}function VGe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Jr.valueTransformInPlace(t,e._offset,e._scale,$t.unapplyValueTransform)}function XP(e,t,n){const i=this;let o,r,s;if(t===$t.INT64)gn.supportsBigInt()?gn.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 RGe(a,i)}):(ki("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 BGe(a,i)});else if(t===$t.UINT64)gn.supportsBigInt()?gn.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 MGe(a,i)}):(ki("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 NGe(a,i)});else{const a=FGe(t);o=ee.createArrayBufferView(a,e.buffer,e.byteOffset,n),s=function(c,u){i.typedArray[c]=u}}l(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}function Ma(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.class;T.typeOf.number.greaterThan("options.count",t,0),T.typeOf.object("options.class",n);let i=0;const o={};if(l(e.properties)){for(const r in e.properties)if(e.properties.hasOwnProperty(r)){const s=new PT({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(Ma.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});Ma.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};Ma.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};Ma.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};Ma.prototype.getProperty=function(e,t){T.typeOf.string("propertyId",t);const n=this._properties[t];let i;return l(n)?i=n.get(e):i=kGe(this._class,t),i};Ma.prototype.setProperty=function(e,t,n){T.typeOf.string("propertyId",t);const i=this._properties[t];return l(i)?(i.set(e,n),!0):!1};Ma.prototype.getPropertyBySemantic=function(e,t){T.typeOf.string("semantic",t);let n;const i=this._class.propertiesBySemantic;if(l(i)&&(n=i[t]),l(n))return this.getProperty(e,n.id)};Ma.prototype.setPropertyBySemantic=function(e,t,n){T.typeOf.string("semantic",t);let i;const o=this._class.propertiesBySemantic;return l(o)&&(i=o[t]),l(i)?this.setProperty(e,i.id,n):!1};Ma.prototype.getPropertyTypedArray=function(e){T.typeOf.string("propertyId",e);const t=this._properties[e];if(l(t))return t.getTypedArray()};Ma.prototype.getPropertyTypedArrayBySemantic=function(e){T.typeOf.string("semantic",e);let t;const n=this._class.propertiesBySemantic;if(l(n)&&(t=n[e]),l(t))return this.getPropertyTypedArray(t.id)};function kGe(e,t){const n=e.properties;if(!l(n))return;const i=n[t];if(l(i)&&l(i.default)){let o=i.default;return i.isArray&&(o=ht(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}function mr(){}Object.defineProperties(mr.prototype,{promise:{get:function(){x.throwInstantiationError()}},cacheKey:{get:function(){x.throwInstantiationError()}}});mr.prototype.load=function(){x.throwInstantiationError()};mr.prototype.unload=function(){};mr.prototype.process=function(e){};mr.prototype.getError=function(e,t){T.typeOf.string("errorMessage",e),l(t)&&(e+=`
|
||
${t.message}`);const n=new Ie(e);return l(t)&&(n.stack=`Original stack:
|
||
${t.stack}
|
||
Handler stack:
|
||
${n.stack}`),n};mr.prototype.isDestroyed=function(){return!1};mr.prototype.destroy=function(){return this.unload(),He(this)};const GGe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Ft=Object.freeze(GGe);function iu(e){e=A(e,A.EMPTY_OBJECT);const t=e.typedArray,n=e.resource,i=e.cacheKey;if(l(t)===l(n))throw new x("One of options.typedArray and options.resource must be defined.");this._typedArray=t,this._resource=n,this._cacheKey=i,this._state=Ft.UNLOADED,this._promise=void 0}l(Object.create)&&(iu.prototype=Object.create(mr.prototype),iu.prototype.constructor=iu);Object.defineProperties(iu.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});iu.prototype.load=function(){return l(this._typedArray)?this._promise=Promise.resolve(this):this._promise=WGe(this),this._promise};function WGe(e){const t=e._resource;return e._state=Ft.LOADING,iu._fetchArrayBuffer(t).then(function(n){if(!e.isDestroyed())return e._typedArray=new Uint8Array(n),e._state=Ft.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Ft.FAILED;const i=`Failed to load external buffer: ${t.url}`;return Promise.reject(e.getError(i,n))})}iu._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};iu.prototype.unload=function(){this._typedArray=void 0};(function(){var e="B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gVUUUUUB9gLUUUUB9gIUUUEU9gD99UE99I8ayDILEVLEVLOOOOORRVBWWBEdddLVE9wEIIVIEBEOWEUEC+g/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBV8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBOe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBRA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBWl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBdk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBQl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBKe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBpA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBZL79iv9rBhdWEBCEKDxcQ+1tyDBK/hKEyU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrB+Q+KJJBC+gEv86BBAVCJDFCBCJDZ+TJJJB8aDNAItMBAVCJDFADALZmJJJB8aKABAEFHRABCEFHWAVALFCBCBCJDAL9rALCfE0eZ+TJJJB8aAVAVCJDFALZmJJJBHdCJ/ABAL9uHEDNDNALtMBAEC/wfBgGECJDAECJD6eHQCBHKINAKAI9PMEAdCJLFCBCJDZ+TJJJB8aAQAIAK9rAKAQFAI6eGXCSFGECL4CIFCD4HMADAKAL2FHpDNDNDNDNDNAEC9wgGStMBCBHZCEHhApHoAWHaXEKDNAXtMBCBHaCEHhApHcINAdAaFrBBHxAcHECBHOINAdCJLFAOFAErBBGqAx9rGxCETAxCkTCk91CR4786BBAEALFHEAqHxAOCEFGOAX9HMBKARAW9rAM6MIAWCBAMZ+TJJJBGEtMIAEAMFHWAcCEFHcAaCEFGaAL6HhAaAL9HMBXVKKARAW9rAM6MOAWCBAMZ+TJJJB8aCEHEINAWGxAMFHWALAEGOsMLDNARAW9rAM6MBAOCEFHEAWCBAMZ+TJJJB8aAxMEKKCBHWAOAL6MOXIKINDNAXtMBAdAZFrBBHxCBHEAoHOINAdCJLFAEFAOrBBGqAx9rGxCETAxCkTCk91CR4786BBAOALFHOAqHxAECEFGEAX9HMBKKARAa9rAM6MEARAaCBAMZ+TJJJBGlAMFGW9rCk6MDCBHkAdCJLFHcINAdCJLFAkFHyCWH8aCZHaCEHqINDNDNAqCE9HMBCUHOAyrBBMECBHODNINAOGECSsMEAECEFHOAcAEFCEFrBBtMBKKCUCBAECS6eHOXEKAqCETC/+fffEgHOCUAqTCU7CfEgHxCBHEINAOAxAcAEFrBB9NFHOAECEFGECZ9HMBKKAOAaAOAa6GEeHaAqA8aAEeH8aAqCETGqCW6MBKDNDNDNDNA8aCUFpDIEBKAlAkCO4FGEAErBBCDCIA8aCLseAkCI4COgTv86BBA8aCW9HMEAWAy8pBB83BBAWCWFAyCWF8pBB83BBAWCZFHWXDKAlAkCO4FGEAErBBCEAkCI4COgTv86BBKDNCWA8a9tGeMBINAWCB86BBAWCEFHWXBKKCUA8aTCU7HqCBH3AcH5INA5HEAeHxCBHOINAErBBGaAqAaAqCfEgGy6eAOCfEgA8aTvHOAECEFHEAxCUFGxMBKAWAO86BBA5AeFH5AWCEFHWA3AeFG3CZ6MBKCBHEINDNAcAEFrBBGOAy6MBAWAO86BBAWCEFHWKAECEFGECZ9HMBKKDNAkCZFGkAS9PMBAcCZFHcARAW9rCl0MEKKAkAS6MEAWtMEAoCEFHoAZCEFGZAL6HhAWHaAZALsMIXBKKCBHWAhCEgtMEXLKCBHWAhCEgMIKAdApAXCUFAL2FALZmJJJB8aAXAKFHKAWMBKCBHOXDKCBHOARAW9rCAALALCA6e6MEDNALC8f0MBAWCBCAAL9rGEZ+TJJJBAEFHWKAWAdCJDFALZmJJJBALFAB9rHOXEKCBHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbD+Q+KJJBK/YSE3U8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYDn+KJJBGVC/gEv86BBALC/ABFCfECJEZ+TJJJB8aALCuFGR9CU83IBALC8wFGW9CU83IBALCYFGd9CU83IBALCAFGQ9CU83IBALCkFGK9CU83IBALCZFGX9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFHMABCEFGpAOFHEDNAItMBCMCSAVCB9KGSeHZAVCE9IHhCBHoCBHaCBHcCBHxCBHqINDNAEAM9NMBCBHVXIKAqCUFHVADAcCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aDNDNINALC/ABFAVCSgCITFGOYDLHeDNDNDNAOYDBGOAl9HMBAeAysMEKDNAOAy9HMBAeAk9HMBA8aCEFH8aXEKAOAk9HMEAeAl9HMEA8aCDFH8aKA8aC870MDAxCUFHVADA8aCIgCX2GOC+Y1JJBFYDBAcFCDTFYDBHeADAOCn1JJBFYDBAcFCDTFYDBHkADAOC+Q1JJBFYDBAcFCDTFYDBHlCBHODNINDNALAVCSgCDTFYDBAe9HMBAOHyXDKCUHyAVCUFHVAOCEFGOCZ9HMBKKAyCB9KAyAZ9IgGVCU7AeAosGOgH3DNDNDNDNDNAyCBCSAOeAVeGVCS9HMBAhMBAeAeAaAeCEFAasGVeGaCEFsMECMCSAVeHVKApAVA8aCDTC/wEgv86BBAVCS9HMEAeAa9rGVCETAVC8f917HVINAEAVCfB0CRTAVCfBgv86BBAECEFHEAVCJE6HOAVCR4HVAOtMBKAeHaXDKCpHVApA8aCDTCpv86BBAeHaKAVtMBAVAZ9IMEKALAxCDTFAebDBAxCEFCSgHxKAoA3FHoALC/ABFAqCITFGVAkbDLAVAebDBALC/ABFAqCEFCSgGVCITFGOAebDLAOAlbDBAVCEFHOXIKAVCUFHVA8aCLFG8aC/AB9HMBKKDNADCEAkAosCETAyAoseCX2GVC+Q1JJBFYDBAcFCDTFYDBGltADAVCn1JJBFYDBAcFCDTFYDBG8aCEsgADAVC+Y1JJBFYDBAcFCDTFYDBGyCDsgAoCB9HgASgG5CE9HMBAR9CU83IBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAL9CU83IWAL9CU83IBCBHoKCBHeAxCUFGVHODNINDNALAOCSgCDTFYDBA8a9HMBAeHkXDKCUHkAOCUFHOAeCEFGeCZ9HMBKKCBHODNINDNALAVCSgCDTFYDBAy9HMBAOHeXDKCUHeAVCUFHVAOCEFGOCZ9HMBKKAoAlAosG8eFH3DNDNAkCM0MBAkCEFHkXEKCBCSA8aA3sGVeHkA3AVFH3KDNDNAeCM0MBAeCEFHeXEKCBCSAyA3sGVeHeA3AVFH3KC9+CUA8eeH8fAeAkCLTvHOCBHVDNDNDNINAVCJ1JJBFrBBAOCfEgsMEAVCEFGVCZ9HMBXDKKAlAo9HAVCM0vA5vMBApAVC/wEv86BBXEKApA8f86BBAEAO86BBAECEFHEKDNA8eMBAlAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKAlHaKDNAkCS9HMBA8aAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKA8aHaKDNAeCS9HMBAyAa9rGVCETAVC8f917HVINAEAVCfB0GOCRTAVCfBgv86BBAVCR4HVAECEFHEAOMBKAyHaKALAxCDTFAlbDBAxCEFCSgHVDNDNAkpZBEEEEEEEEEEEEEEBEKALAVCDTFA8abDBAxCDFCSgHVKDNDNAepZBEEEEEEEEEEEEEEBEKALAVCDTFAybDBAVCEFCSgHVKALC/ABFAqCITFGOAlbDLAOA8abDBALC/ABFAqCEFCSgCITFGOA8abDLAOAybDBALC/ABFAqCDFCSgCITFGOAybDLAOAlbDBAqCIFHOAVHxA3HoKApCEFHpAOCSgHqAcCIFGcAI6MBKKCBHVAEAM0MBCBHVINAEAVFAVCJ1JJBFrBB86BBAVCEFGVCZ9HMBKAEAB9rAVFHVKALC/AEF8kJJJJBAVKzEEUCBHDDNINADCEFGDC8f0MECEADTAE6MBKKADCRFCfEgCR9uCI2CDFABCI9u2ChFKMBCBABbDn+KJJBK+cDEWU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHOABCBrBn+KJJBC/QEv86BBAL9CB83IWABCEFHRABAEFC98FHWDNAItMBCBHdINDNARAW6MBCBSKADAdCDTFYDBGQALCWFAOAQALCWFAOCDTFYDB9rGEAEC8f91GEFAE7C507GOCDTFGKYDB9rGEC8e91C9+gAECDT7AOvHEINARAECfB0GVCRTAECfBgv86BBAECR4HEARCEFHRAVMBKAKAQbDBAdCEFGdAI9HMBKKCBHVARAW0MBARCBbBBARAB9rCLFHVKAVKbEEUCBHDDNINADCEFGDC8f0MECEADTAE6MBKKADCWFCfEgCR9uAB2CVFK+DVLI99DUI99LUDNAEtMBCUADCETCUFTCU7+yHVDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHWXEKCJJJJ94HWKCBHICBHdINALCLFiDBGRjBBBBjBBJzALiDBGQ+LAR+LmALCWFiDBGK+LmGR+VARjBBBB9beGRnHXAQARnHRALCXFiDBHQDNDNAKjBBBB9gtMBAXHKXEKjBBJzAR+L+TGKAK+MAXjBBBB9geHKjBBJzAX+L+TGXAX+MARjBBBB9geHRKDNDNAQjBBJ+/AQjBBJ+/9geGXjBBJzAXjBBJz9feAVnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHMXEKCJJJJ94HMKDNDNAKjBBJ+/AKjBBJ+/9geGQjBBJzAQjBBJz9feAOnjBBBzjBBB+/AKjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHpXEKCJJJJ94HpKDNDNARjBBJ+/ARjBBJ+/9geGQjBBJzAQjBBJz9feAOnjBBBzjBBB+/ARjBBBB9gemGR+LjBBB9P9dtMBAR+oHSXEKCJJJJ94HSKDNDNADCL9HMBABAdFGZAS86BBAZCIFAM86BBAZCDFAW86BBAZCEFAp86BBXEKABAIFGZAS87EBAZCOFAM87EBAZCLFAW87EBAZCDFAp87EBKALCZFHLAICWFHIAdCLFHdAECUFGEMBKKK/KLLD99EUD99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBJ+/AWjBBJ+/9geGdjBBJzAdjBBJz9feAVnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHQXEKCJJJJ94HQKABAQ87EBDNDNAOALAICDFCIgCDTFiDBj/zL+1znnGWjBBJ+/AWjBBJ+/9geGdjBBJzAdjBBJz9feAVnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHQXEKCJJJJ94HQKABCDFAQ87EBDNDNAOALAICUFCIgCDTFiDBj/zL+1znnGOjBBJ+/AOjBBJ+/9geGWjBBJzAWjBBJz9feAVnjBBBzjBBB+/AOjBBBB9gemGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+7DDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCL6MBCEAI9rHOADCD4GDCEADCE0eHRADCDTHWCBHdINC+cUHDALHIARHQINAIiDBAVCXFZ+XJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKAOADFGICkTHKCBHDCBAI9rHXARHIINDNDNALADFiDBGMAXZ+WJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK/tKDcUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZ+TJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGOADCffffI0eCBYD1+KJJBhJJJJBBGEbD+oEAVCEbD1DAEABAOZmJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+NJJJBCUAICDTGRAICffffI0eGWCBYD1+KJJBhJJJJBBHOAVC+oEFAVYD1DGdCDTFAObDBAVAdCEFGQbD1DAOAVYD+YEGKARZmJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD1+KJJBhJJJJBBGObDBAVAdCDFGRbD1DAOCBAMZ+TJJJBHpAVC+oEFARCDTFAWCBYD1+KJJBhJJJJBBGSbDBAVAdCIFGQbD1DAXHOASHRINARALiDBALAOYDBGWCWAWCW6eCDTFC/EBFiDBmuDBAOCLFHOARCLFHRAICUFGIMBKAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD1+KJJBhJJJJBBGQbDBAVAdCLFbD1DDNADCI6MBAMCEAMCE0eHIAEHOAQHRINARASAOYDBCDTFiDBASAOCLFYDBCDTFiDBmASAOCWFYDBCDTFiDBmuDBAOCXFHOARCLFHRAICUFGIMBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHOCBHWCBHRCBHaCEHcINAOHxCIHqAEARCI2GlCDTFGOCWFYDBHkAOYDBHDABAaCX2FGICLFAOCLFYDBGdbDBAIADbDBAICWFAkbDBApARFCE86BBAZAkbDWAZAdbDLAZADbDBAQARCDTFCBbDBDNAWtMBCIHqAxHIINDNAIYDBGOADsMBAOAdsMBAOAksMBAZAqCDTFAObDBAqCEFHqKAICLFHIAWCUFGWMBKKAaCEFHaAXADCDTFGOAOYDBCUFbDBAXAdCDTFGOAOYDBCUFbDBAXAkCDTFGOAOYDBCUFbDBCBHWINAoAhAEAWAlFCDTFYDBCDTGIFYDBCDTFGkHOAKAIFGdYDBGDHIDNADtMBDNINAOYDBARsMEAOCLFHOAICUFGItMDXBKKAOADCDTAkFC98FYDBbDBAdAdYDBCUFbDBKAWCEFGWCI9HMBKDNDNDNAqtMBCUHRjBBBBHyCBHOINASAZAOCDTFYDBCDTGIFGWiDBH8aAWALCBAOCEFGdAOCS0eCDTFiDBALAXAIFYDBGOCWAOCW6eCDTFC/EBFiDBmGeuDBDNAKAIFYDBGWtMBAeA8a+THeAoAhAIFYDBCDTFHOAWCDTHIINAQAOYDBGWCDTFGDAeADiDBmG8auDBA8aAyAyA8a9dGDeHyAWARADeHRAOCLFHOAIC98FGIMBKKAdHOAdAq9HMBKARCU9HMEKAcAM9PMEINDNApAcFrBBMBAcHRXDKAMAcCEFGc9HMBXDKKAqCZAqCZ6eHWAZHOAxHZARCU9HMEKKAVYD1DHOKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD+E+KJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/uLEVUCUAICDTGVAICffffI0eGOCBYD1+KJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD1+KJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZ+TJJJB8aADCI9uHWDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBAWCEAWCE0eHdABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEAdALCEFGL9HMBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+01JJBZ+MJJJBKqBABAEADAIC+c+JJJBZ+MJJJBK9dEEUABCfEAICDTZ+TJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD+M+KJJBGEABCIFC98gFGBbD+M+KJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD+M+KJJBGEABCIFC98gFGBbD+M+KJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD+M+KJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD+M+KJJBFGDbD+M+KJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+YJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+XJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9PMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD6eC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9NMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2990eC/MEFHEKABAEClTCJJJ/8IF++nKK+eDDBCJWK+EDB4+H9W9n94+p+Gw+J9o+YE9pBBBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC+EQKXEBBBDBBBAwBB",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(m){for(var g=new Uint8Array(m.length),p=0;p<m.length;++p){var y=m.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var b=0,p=0;p<m.length;++p)g[b++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,b)}function r(m){if(!m)throw new Error("Assertion failed")}function s(m){return new Uint8Array(m.buffer,m.byteOffset,m.byteLength)}function a(m,g,p){var y=n.exports.sbrk,b=y(m.length*4),C=y(g*4),E=new Uint8Array(n.exports.memory.buffer),w=s(m);E.set(w,b),p&&p(b,b,m.length,g);var S=n.exports.meshopt_optimizeVertexFetchRemap(C,b,m.length,g);E=new Uint8Array(n.exports.memory.buffer);var P=new Uint32Array(g);new Uint8Array(P.buffer).set(E.subarray(C,C+g*4)),w.set(E.subarray(b,b+m.length*4)),y(b-y(0));for(var L=0;L<m.length;++L)m[L]=P[m[L]];return[P,S]}function c(m,g,p,y,b){var C=n.exports.sbrk,E=C(g),w=C(y*b),S=new Uint8Array(n.exports.memory.buffer);S.set(s(p),w);var P=m(E,g,w,y,b),L=new Uint8Array(P);return L.set(S.subarray(E,E+P)),C(E-C(0)),L}function u(m){for(var g=0,p=0;p<m.length;++p){var y=m[p];g=g<y?y:g}return g}function d(m,g){if(r(g==2||g==4),g==4)return new Uint32Array(m.buffer,m.byteOffset,m.byteLength/4);var p=new Uint16Array(m.buffer,m.byteOffset,m.byteLength/2);return new Uint32Array(p)}function h(m,g,p,y,b,C){var E=n.exports.sbrk,w=E(p*y),S=E(p*C),P=new Uint8Array(n.exports.memory.buffer);P.set(s(g),S),m(w,p,y,b,S);var L=new Uint8Array(p*y);return L.set(P.subarray(w,w+p*y)),E(w-E(0)),L}return{ready:i,supported:!0,reorderMesh:function(m,g,p){var y=g?p?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(m,u(m)+1,y)},encodeVertexBuffer:function(m,g,p){r(p>0&&p<=256),r(p%4==0);var y=n.exports.meshopt_encodeVertexBufferBound(g,p);return c(n.exports.meshopt_encodeVertexBuffer,y,m,g,p)},encodeIndexBuffer:function(m,g,p){r(p==2||p==4),r(g%3==0);var y=d(m,p),b=n.exports.meshopt_encodeIndexBufferBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexBuffer,b,y,g,4)},encodeIndexSequence:function(m,g,p){r(p==2||p==4);var y=d(m,p),b=n.exports.meshopt_encodeIndexSequenceBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexSequence,b,y,g,4)},encodeGltfBuffer:function(m,g,p,y){var b={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(b[y]),b[y](m,g,p)},encodeFilterOct:function(m,g,p,y){return r(p==4||p==8),r(y>=1&&y<=16),h(n.exports.meshopt_encodeFilterOct,m,g,p,y,16)},encodeFilterQuat:function(m,g,p,y){return r(p==8),r(y>=4&&y<=16),h(n.exports.meshopt_encodeFilterQuat,m,g,p,y,16)},encodeFilterExp:function(m,g,p,y){return r(p>0&&p%4==0),r(y>=1&&y<=24),h(n.exports.meshopt_encodeFilterExp,m,g,p,y,p)}}})();var jGe=function(){var e="B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+p8yQDBK/3SEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uHOAICEFHLDNADtMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAQAE9PMEAdAEAQ9rAQAdFAE6eGKCSFGOCL4CIFCD4HXDNDNDNDNAOC9wgGMtMBCBHpCEHSAWCJDFHZALHhINARAh9rAX6MIDNARAhAXFGL9rCk6MBCZHOINAWCJ/CBFAOGIFGOC9wFHoDNDNDNDNDNAhAIC9wFGaCO4FrBBAaCI4COg4CIgpLBEDIBKAo9CB83IBAoCWF9CB83IBXIKAoALrBLALrBBGaCO4GcAcCIsGce86BBAOCgFALCLFAcFGorBBAaCL4CIgGcAcCIsGce86BBAOCvFAoAcFGorBBAaCD4CIgGcAcCIsGce86BBAOC7FAoAcFGorBBAaCIgGaAaCIsGae86BBAOCTFAoAaFGarBBALrBEGoCO4GcAcCIsGce86BBAOC91FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC4FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC93FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC94FAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOC95FAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOC96FAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOC97FAaAcFGarBBAoCIgGoAoCIsGoe86BBAOC98FAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOC99FAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOC9+FAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCUFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAoALrBWALrBBGaCL4GcAcCSsGce86BBAOCgFALCWFAcFGorBBAaCSgGaAaCSsGae86BBAOCvFAoAaFGorBBALrBEGaCL4GcAcCSsGce86BBAOC7FAoAcFGorBBAaCSgGaAaCSsGae86BBAOCTFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOC91FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC4FAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOC93FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC94FAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOC95FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC96FAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOC97FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC98FAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOC99FAoAcFGorBBAaCSgGaAaCSsGae86BBAOC9+FAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCUFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAoAL8pBB83BBAoCWFALCWF8pBB83BBALCZFHLKDNAIAM9PMBAICZFHOARAL9rCl0MEKKAIAM6MIALtMIDNAKtMBAWApFrBBHoCBHOAZHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86BBAIADFHIAOCEFGOAK9HMBKKAZCEFHZApCEFGpAD6HSALHhApAD9HMEXVKKCBHLASCEgMDXIKALAXAD2FHcDNAKtMBCBHhCEHSAWCJDFHMINARAL9rAX6MIALtMDALAXFHLAWAhFrBBHoCBHOAMHIINAIAWCJ/CBFAOFrBBGaCE4CBAaCEg9r7AoFGo86BBAIADFHIAOCEFGOAK9HMBKAMCEFHMAhCEFGhAD6HSAhAD9HMBKAcHLXIKCBHOCEHSINARAL9rAX6MDALtMEALAXFHLAOCEFGOAD6HSADAO9HMBKAcHLXDKCBHLASCEgtMEKC9+HOXIKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aAKAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK/YZEhU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHODNAEtMBCMCSAdCEseHKCBHXCBHMCBHdCBHICBHLINDNAOAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFALARCL4CU7FCSgCITFGpYDLHSApYDBHZDNARCSgGpAK9PMBAVAIARCU7FCSgCDTFYDBAXApeHRAptHpDNDNADCD9HMBABAdCETFGhAZ87EBAhCDFAS87EBAhCLFAR87EBXEKABAdCDTFGhAZbDBAhCLFASbDBAhCWFARbDBKAXApFHXAVC/ABFALCITFGhARbDBAhASbDLAVAICDTFARbDBAVC/ABFALCEFCSgGLCITFGhAZbDBAhARbDLAIApFHIALCEFHLXDKDNDNApCSsMBAMApFApC987FCEFHMXEKAOCEFHRAO8sBBGpCfEgHhDNDNApCU9MMBARHOXEKAOCVFHOAhCfBgHhCRHpDNINAR8sBBGoCfBgApTAhvHhAoCU9KMEARCEFHRApCRFGpC8j9HMBXDKKARCEFHOKAhCE4CBAhCEg9r7AMFHMKDNDNADCD9HMBABAdCETFGRAZ87EBARCDFAS87EBARCLFAM87EBXEKABAdCDTFGRAZbDBARCLFASbDBARCWFAMbDBKAVC/ABFALCITFGRAMbDBARASbDLAVAICDTFAMbDBAVC/ABFALCEFCSgGLCITFGRAZbDBARAMbDLAICEFHIALCEFHLXEKDNARCPE0MBAXCEFGoAVAIAQARCSgFrBBGpCL49rCSgCDTFYDBApCZ6GheHRAVAIAp9rCSgCDTFYDBAoAhFGSApCSgGoeHpAotHoDNDNADCD9HMBABAdCETFGZAX87EBAZCDFAR87EBAZCLFAp87EBXEKABAdCDTFGZAXbDBAZCLFARbDBAZCWFApbDBKAVAICDTFAXbDBAVC/ABFALCITFGZARbDBAZAXbDLAVAICEFGICSgCDTFARbDBAVC/ABFALCEFCSgCITFGZApbDBAZARbDLAVAIAhFCSgGICDTFApbDBAVC/ABFALCDFCSgGLCITFGRAXbDBARApbDLALCEFHLAIAoFHIASAoFHXXEKAXCBAOrBBGZeGaARC/+EsGRFHSAZCSgHcAZCL4HxDNDNAZCS0MBASCEFHoXEKASHoAVAIAx9rCSgCDTFYDBHSKDNDNAcMBAoCEFHXXEKAoHXAVAIAZ9rCSgCDTFYDBHoKDNDNARtMBAOCEFHRXEKAOCDFHRAO8sBEGhCfEgHpDNAhCU9KMBAOCOFHaApCfBgHpCRHODNINAR8sBBGhCfBgAOTApvHpAhCU9KMEARCEFHRAOCRFGOC8j9HMBKAaHRXEKARCEFHRKApCE4CBApCEg9r7AMFGMHaKDNDNAxCSsMBARHpXEKARCEFHpAR8sBBGOCfEgHhDNAOCU9KMBARCVFHSAhCfBgHhCRHODNINAp8sBBGRCfBgAOTAhvHhARCU9KMEApCEFHpAOCRFGOC8j9HMBKASHpXEKApCEFHpKAhCE4CBAhCEg9r7AMFGMHSKDNDNAcCSsMBApHOXEKApCEFHOAp8sBBGRCfEgHhDNARCU9KMBApCVFHoAhCfBgHhCRHRDNINAO8sBBGpCfBgARTAhvHhApCU9KMEAOCEFHOARCRFGRC8j9HMBKAoHOXEKAOCEFHOKAhCE4CBAhCEg9r7AMFGMHoKDNDNADCD9HMBABAdCETFGRAa87EBARCDFAS87EBARCLFAo87EBXEKABAdCDTFGRAabDBARCLFASbDBARCWFAobDBKAVC/ABFALCITFGRASbDBARAabDLAVAICDTFAabDBAVC/ABFALCEFCSgCITFGRAobDBARASbDLAVAICEFGICSgCDTFASbDBAVC/ABFALCDFCSgCITFGRAabDBARAobDLAVAIAZCZ6AxCSsvFGICSgCDTFAobDBAIActAcCSsvFHIALCIFHLKAWCEFHWALCSgHLAICSgHIAdCIFGdAE6MBKKCBC99AOAQseHOKAVC/AEF8kJJJJBAOK+LLEVU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHRAIALFC98FHWDNAEtMBDNADCDsMBCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCDTFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGLbDBAOALbDBAdCEFGdAE9HMBXDKKCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCETFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGL87EBAOALbDBAdCEFGdAE9HMBKKCBC99ARAWseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBB/+9CAWAWnjBBBBAWAWjBBBB9gGdeGQ+MGKAQAICB9IeALmGWAWnAKAQAOCB9IeARmGQAQnmm+R+VGLnjBBBzjBBB+/AdemGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKADAI86BBDNDNAQALnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHDXEKCJJJJ94HDKAVAD86BBDNDNAWALnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjB/+fsAWAWnjBBBBAWAWjBBBB9gGdeGQ+MGKAQAICB9IeALmGWAWnAKAQAOCB9IeARmGQAQnmm+R+VGLnjBBBzjBBB+/AdemGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKADAI87EBDNDNAQALnjBBBzjBBB+/AQjBBBB9gemGQ+LjBBB9P9dtMBAQ+oHDXEKCJJJJ94HDKAVAD87EBDNDNAWALnjBBBzjBBB+/AWjBBBB9gemGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK9MBDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCE91CJJJ/8IFCJJJ98g++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB",t="B9h79tEBBBEkL9gBB9gVUUUUUEU9gIUUUB9gEUEUIKQBBEBEEDDDILVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBRl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBWL79iv9rBdQ/T9TQLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK/H8jLhUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uHOAICEFHLDNADtMBAOC/wfBgGOCJDAOCJD6eHWCBHdINAdAE9PMEAWAEAd9rAdAWFAE6eGQCSFGOC9wgGKCI2HXAKCETHMAOCL4CIFCD4HpABAdAD2FHSCBHZDNINCEHhALHoCBHaDNINARAo9rAp6MIAVCJ/CBFAaAK2FHcAoApFHLCBHIDNAKC/AB6MBARAL9rC/gB6MBCBHOINAcAOFHIDNDNDNDNDNAoAOCO4FrBBGxCIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLBXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLBALCZFHLKDNDNDNDNDNAxCD4CIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLZXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLZALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLZALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLZALCZFHLKDNDNDNDNDNAxCL4CIgpLBEDIBKAIPXBBBBBBBBBBBBBBBBPKLAXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLAALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLAALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAIALPBBBPKLAALCZFHLKDNDNDNDNDNAxCO4pLBEDIBKAIPXBBBBBBBBBBBBBBBBPKL8wXIKAIALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBAxC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKL8wALCLFAyPqBFAxC+Q+YJJBFrBBFHLXDKAIALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBAxC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGxCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKL8wALCWFAyPqBFAxC+Q+YJJBFrBBFHLXEKAIALPBBBPKL8wALCZFHLKAOC/ABFHIAOCJEFAK0MEAIHOARAL9rC/fB0MBKKDNDNAIAK9PMBAICI4HOINARAL9rCk6MDAcAIFHxDNDNDNDNDNAoAICO4FrBBAOCOg4CIgpLBEDIBKAxPXBBBBBBBBBBBBBBBBPKLBXIKAxALPBBLALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlGqCDP+MEAqPMBZEhDoIaLcVxOqRlPXIIIIIIIIIIIIIIIIP9OGlPXIIIIIIIIIIIIIIIIP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCLFAyPqBFAkC+Q+YJJBFrBBFHLXDKAxALPBBWALPBBBGqCLP+MEAqPMBZEhDoIaLcVxOqRlPXSSSSSSSSSSSSSSSSP9OGlPXSSSSSSSSSSSSSSSSP8jGqP5B9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBAkC+Q+YJJBFPBBBGyAyPMBBBBBBBBBBBBBBBBAqP5E9CJf/8/4/w/g/AB9+9Cu1+nGkCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAlAqP9SPKLBALCWFAyPqBFAkC+Q+YJJBFrBBFHLXEKAxALPBBBPKLBALCZFHLKAOCDFHOAICZFGIAK6MBKKALtMBAaCI6HhALHoAaCEFGOHaAOCLsMDXEKKCBHLAhCEgMDKDNAKtMBAVCJDFAZFHIAVAZFPBDBHyCBHxINAIAVCJ/CBFAxFGOPBLBGlCEP9tAlPXEEEEEEEEEEEEEEEEGqP9OP9hP9RGlAOAKFPBLBG8aCEP9tA8aAqP9OP9hP9RG8aPMBZEhDoIaLcVxOqRlGeAOAMFPBLBG3CEP9tA3AqP9OP9hP9RG3AOAXFPBLBG5CEP9tA5AqP9OP9hP9RG5PMBZEhDoIaLcVxOqRlG8ePMBEZhDIoaLVcxORqlGqAqPMBEDIBEDIBEDIBEDIAyP9uGyP9aDBBAIADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAeA8ePMWdkyQK8aeXM35pS8e8fGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAlA8aPMWkdyQ8aKeX3M5p8eS8fGlA3A5PMWkdyQ8aKeX3M5p8eS8fG8aPMBEZhDIoaLVcxORqlGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFGOAyAlA8aPMWdkyQK8aeXM35pS8e8fGqAqPMBEDIBEDIBEDIBEDIP9uGyP9aDBBAOADFGOAyAqAqPMLVORLVORLVORLVORP9uGyP9aDBBAOADFGOAyAqAqPMWdQKWdQKWdQKWdQKP9uGyP9aDBBAOADFGOAyAqAqPMXMpSXMpSXMpSXMpSP9uGyP9aDBBAOADFHIAxCZFGxAK6MBKKAZCLFGZAD6MBKASAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBAQAdFHdC9+HOALMEXIKKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK/UZEhU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHODNAEtMBCMCSAdCEseHKCBHXCBHMCBHdCBHICBHLINDNAOAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFALARCL4CU7FCSgCITFGpYDLHSApYDBHZDNARCSgGpAK9PMBAVAIARCU7FCSgCDTFYDBAXApeHRAptHpDNDNADCD9HMBABAdCETFGhAZ87EBAhCDFAS87EBAhCLFAR87EBXEKABAdCDTFGhAZbDBAhCLFASbDBAhCWFARbDBKAXApFHXAVC/ABFALCITFGhARbDBAhASbDLAVAICDTFARbDBAVC/ABFALCEFCSgGLCITFGhAZbDBAhARbDLAIApFHIALCEFHLXDKDNDNApCSsMBAMApFApC987FCEFHMXEKAOCEFHRAO8sBBGpCfEgHhDNDNApCU9MMBARHOXEKAOCVFHOAhCfBgHhCRHpDNINAR8sBBGoCfBgApTAhvHhAoCU9KMEARCEFHRApCRFGpC8j9HMBXDKKARCEFHOKAhCE4CBAhCEg9r7AMFHMKDNDNADCD9HMBABAdCETFGRAZ87EBARCDFAS87EBARCLFAM87EBXEKABAdCDTFGRAZbDBARCLFASbDBARCWFAMbDBKAVC/ABFALCITFGRAMbDBARASbDLAVAICDTFAMbDBAVC/ABFALCEFCSgGLCITFGRAZbDBARAMbDLAICEFHIALCEFHLXEKDNARCPE0MBAXCEFGoAVAIAQARCSgFrBBGpCL49rCSgCDTFYDBApCZ6GheHRAVAIAp9rCSgCDTFYDBAoAhFGSApCSgGoeHpAotHoDNDNADCD9HMBABAdCETFGZAX87EBAZCDFAR87EBAZCLFAp87EBXEKABAdCDTFGZAXbDBAZCLFARbDBAZCWFApbDBKAVAICDTFAXbDBAVC/ABFALCITFGZARbDBAZAXbDLAVAICEFGICSgCDTFARbDBAVC/ABFALCEFCSgCITFGZApbDBAZARbDLAVAIAhFCSgGICDTFApbDBAVC/ABFALCDFCSgGLCITFGRAXbDBARApbDLALCEFHLAIAoFHIASAoFHXXEKAXCBAOrBBGZeGaARC/+EsGRFHSAZCSgHcAZCL4HxDNDNAZCS0MBASCEFHoXEKASHoAVAIAx9rCSgCDTFYDBHSKDNDNAcMBAoCEFHXXEKAoHXAVAIAZ9rCSgCDTFYDBHoKDNDNARtMBAOCEFHRXEKAOCDFHRAO8sBEGhCfEgHpDNAhCU9KMBAOCOFHaApCfBgHpCRHODNINAR8sBBGhCfBgAOTApvHpAhCU9KMEARCEFHRAOCRFGOC8j9HMBKAaHRXEKARCEFHRKApCE4CBApCEg9r7AMFGMHaKDNDNAxCSsMBARHpXEKARCEFHpAR8sBBGOCfEgHhDNAOCU9KMBARCVFHSAhCfBgHhCRHODNINAp8sBBGRCfBgAOTAhvHhARCU9KMEApCEFHpAOCRFGOC8j9HMBKASHpXEKApCEFHpKAhCE4CBAhCEg9r7AMFGMHSKDNDNAcCSsMBApHOXEKApCEFHOAp8sBBGRCfEgHhDNARCU9KMBApCVFHoAhCfBgHhCRHRDNINAO8sBBGpCfBgARTAhvHhApCU9KMEAOCEFHOARCRFGRC8j9HMBKAoHOXEKAOCEFHOKAhCE4CBAhCEg9r7AMFGMHoKDNDNADCD9HMBABAdCETFGRAa87EBARCDFAS87EBARCLFAo87EBXEKABAdCDTFGRAabDBARCLFASbDBARCWFAobDBKAVC/ABFALCITFGRASbDBARAabDLAVAICDTFAabDBAVC/ABFALCEFCSgCITFGRAobDBARASbDLAVAICEFGICSgCDTFASbDBAVC/ABFALCDFCSgCITFGRAabDBARAobDLAVAIAZCZ6AxCSsvFGICSgCDTFAobDBAIActAcCSsvFHIALCIFHLKAWCEFHWALCSgHLAICSgHIAdCIFGdAE6MBKKCBC99AOAQseHOKAVC/AEF8kJJJJBAOK+LLEVU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHRAIALFC98FHWDNAEtMBDNADCDsMBCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCDTFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGLbDBAOALbDBAdCEFGdAE9HMBXDKKCBHdINDNARAW6MBC9+SKARCEFHOAR8sBBGLCfEgHIDNDNALCU9MMBAOHRXEKARCVFHRAICfBgHICRHLDNINAO8sBBGDCfBgALTAIvHIADCU9KMEAOCEFHOALCRFGLC8j9HMBXDKKAOCEFHRKABAdCETFAICD4CBAICE4CEg9r7AVCWFAICEgCDTvGOYDBFGL87EBAOALbDBAdCEFGdAE9HMBKKCBC99ARAWseHOKAOK+epLIUO97EUE978jJJJJBCA9rHIDNDNADCL9HMBDNAEC98gGLtMBCBHVABHDINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdPXBBBBBBBBBBBBBBBBP+2EGQARPXBBBJBBBJBBBJBBBJGKP9OP9RP/kEGRPXBB/+9CBB/+9CBB/+9CBB/+9CARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEPXBBN0BBN0BBN0BBN0GQP/kEPXfBBBfBBBfBBBfBBBP9OAOPXBBBfBBBfBBBfBBBfP9OP9QARAWP/mEAQP/kECWP+rEPXBfBBBfBBBfBBBfBBP9OP9QAdAWP/mEAQP/kECZP+rEPXBBfBBBfBBBfBBBfBP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdPXBBBBBBBBBBBBBBBBP+2EGQARPXBBBJBBBJBBBJBBBJGKP9OP9RP/kEGRPXBB/+9CBB/+9CBB/+9CBB/+9CARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEPXBBN0BBN0BBN0BBN0GQP/kEPXfBBBfBBBfBBBfBBBP9OAOPXBBBfBBBfBBBfBBBfP9OP9QARAWP/mEAQP/kECWP+rEPXBfBBBfBBBfBBBfBBP9OP9QAdAWP/mEAQP/kECZP+rEPXBBfBBBfBBBfBBBfBP9OP9QPKLBKALAIAD/8QBBSKDNAEC98gGXtMBCBHVABHDINADCZFGLALPBBBGOPXBBBBBBffBBBBBBffGKP9OADPBBBGdAOPMLVORXMpScxql358e8fPXfUBBfUBBfUBBfUBBP9OP/6EAdAOPMBEDIWdQKZhoaky8aeGOCZP+sEP/6EGRP/gEAOCZP+rECZP+sEP/6EGWP/gEP/kEP/lEGOPXB/+fsB/+fsB/+fsB/+fsAWAOPXBBBBBBBBBBBBBBBBP+2EGQAWPXBBBJBBBJBBBJBBBJGMP9OP9RP/kEGWAWP/mEAOAOP/mEARAQARAMP9OP9RP/kEGOAOP/mEP/kEP/kEP/jEP/nEGRP/mEPXBBN0BBN0BBN0BBN0GQP/kECZP+rEAWARP/mEAQP/kEPXffBBffBBffBBffBBP9OP9QGWAOARP/mEAQP/kEPXffBBffBBffBBffBBP9OGOPMWdkyQK8aeXM35pS8e8fP9QPKBBADAdAKP9OAWAOPMBEZhDIoaLVcxORqlP9QPKBBADCAFHDAVCLFGVAX6MBKKAXAE9PMBAIAECIgGVCITGDFCBCAAD9r/8KBAIABAXCITFGLAD/8QBBDNAVtMBAIAIPBLZGOPXBBBBBBffBBBBBBffGKP9OAIPBLBGdAOPMLVORXMpScxql358e8fPXfUBBfUBBfUBBfUBBP9OP/6EAdAOPMBEDIWdQKZhoaky8aeGOCZP+sEP/6EGRP/gEAOCZP+rECZP+sEP/6EGWP/gEP/kEP/lEGOPXB/+fsB/+fsB/+fsB/+fsAWAOPXBBBBBBBBBBBBBBBBP+2EGQAWPXBBBJBBBJBBBJBBBJGMP9OP9RP/kEGWAWP/mEAOAOP/mEARAQARAMP9OP9RP/kEGOAOP/mEP/kEP/kEP/jEP/nEGRP/mEPXBBN0BBN0BBN0BBN0GQP/kECZP+rEAWARP/mEAQP/kEPXffBBffBBffBBffBBP9OP9QGWAOARP/mEAQP/kEPXffBBffBBffBBffBBP9OGOPMWdkyQK8aeXM35pS8e8fP9QPKLZAIAdAKP9OAWAOPMBEZhDIoaLVcxORqlP9QPKLBKALAIAD/8QBBKK/4WLLUE97EUV978jJJJJBC8w9rHIDNAEC98gGLtMBCBHVABHOINAIAOPBBBGRAOCZFGWPBBBGdPMLVORXMpScxql358e8fGQCZP+sEGKCLP+rEPKLBAOPXBBJzBBJzBBJzBBJzPX/zL81z/zL81z/zL81z/zL81zAKPXIBBBIBBBIBBBIBBBP9QP/6EP/nEGKARAdPMBEDIWdQKZhoaky8aeGRCZP+rECZP+sEP/6EP/mEGdAdP/mEAKARCZP+sEP/6EP/mEGXAXP/mEAKAQCZP+rECZP+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLBPeB+t+J83IBAOCWFARP5EAIPBLBPeE+t+J83IBAWAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLBPeD+t+J83IBAOCkFAKP5EAIPBLBPeI+t+J83IBAOCAFHOAVCLFGVAL6MBKKDNALAE9PMBAIAECIgGVCITGOFCBCAAO9r/8KBAIABALCITFGWAO/8QBBDNAVtMBAIAIPBLBGRAIPBLZGdPMLVORXMpScxql358e8fGQCZP+sEGKCLP+rEPKLAAIPXBBJzBBJzBBJzBBJzPX/zL81z/zL81z/zL81z/zL81zAKPXIBBBIBBBIBBBIBBBP9QP/6EP/nEGKARAdPMBEDIWdQKZhoaky8aeGRCZP+rECZP+sEP/6EP/mEGdAdP/mEAKARCZP+sEP/6EP/mEGXAXP/mEAKAQCZP+rECZP+sEP/6EP/mEGQAQP/mEP/kEP/kEP/lEPXBBBBBBBBBBBBBBBBP+4EP/jEPXB/+fsB/+fsB/+fsB/+fsGKP/mEPXBBN0BBN0BBN0BBN0GRP/kEPXffBBffBBffBBffBBGMP9OAXAKP/mEARP/kECZP+rEP9QGXAQAKP/mEARP/kECZP+rEAdAKP/mEARP/kEAMP9OP9QGKPMBEZhDIoaLVcxORqlGRP5BAIPBLAPeB+t+J83IBAIARP5EAIPBLAPeE+t+J83IWAIAXAKPMWdkyQK8aeXM35pS8e8fGKP5BAIPBLAPeD+t+J83IZAIAKP5EAIPBLAPeI+t+J83IkKAWAIAO/8QBBKK+pDDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCEP+sEPXBBJzBBJzBBJzBBJzP+uEPXBBJfBBJfBBJfBBJfP9OP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB",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(h){r=h.instance,r.exports.__wasm_call_ctors()});function a(h){for(var m=new Uint8Array(h.length),g=0;g<h.length;++g){var p=h.charCodeAt(g);m[g]=p>96?p-71:p>64?p-65:p>47?p+4:p>46?63:62}for(var y=0,g=0;g<h.length;++g)m[y++]=m[g]<60?i[m[g]]:(m[g]-60)*64+m[++g];return m.buffer.slice(0,y)}function c(h,m,g,p,y,b){var C=r.exports.sbrk,E=g+3&-4,w=C(E*p),S=C(y.length),P=new Uint8Array(r.exports.memory.buffer);P.set(y,S);var L=h(w,g,p,S,y.length);if(L==0&&b&&b(w,E,p),m.set(P.subarray(w,w+g*p)),C(w-C(0)),L!=0)throw new Error("Malformed buffer data: "+L)}var u={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},d={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(h,m,g,p,y){c(r.exports.meshopt_decodeVertexBuffer,h,m,g,p,r.exports[u[y]])},decodeIndexBuffer:function(h,m,g,p){c(r.exports.meshopt_decodeIndexBuffer,h,m,g,p)},decodeIndexSequence:function(h,m,g,p){c(r.exports.meshopt_decodeIndexSequence,h,m,g,p)},decodeGltfBuffer:function(h,m,g,p,y,b){c(r.exports[d[y]],h,m,g,p,r.exports[u[b]])}}}();(function(){var e="B9h79tEBBBECd9gEUEU9gEUB9gBB9gQUUUUUUU99UUEU9gVUUUUUB9gLUUUUE999gIUUUE999gLUUUUEU9gIUUUEUIMXDILVORBWWBEWLVE9wEIIVIEBEOWEUECJ/JEKR7OO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BBZ9tw79o9v9wT9f79p9t9w29p9m95BEx9tw79o9v9wT9f79p9t9w29p9m959T9j9h2wBLA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBVL79iv9rBOdWEBCEKDdQQ+stXDBK/48yIkUp99hU8jJJJJBCJ/BB9rGQ8kJJJJBAQCkFCBC/kBZ1JJJB8aCUALCDTGKALCffffI0eGXCBYD/s1JJBhJJJJBBHMAQCkFAQYD94GpCDTFAMbDBAQAMbDWAQApCEFbD94AXCBYD/s1JJBhJJJJBBHSAQCkFAQYD94GpCDTFASbDBAQASbDXAQApCEFbD94CUADCITADCffffE0eCBYD/s1JJBhJJJJBBHZAQCkFAQYD94GpCDTFAZbDBAQAZbDZAQApCEFbD94AQCWFAEADALCBZ+CJJJBAXCBYD/s1JJBhJJJJBBHhAQCkFAQYD94GpCDTFAhbDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHoAQCkFAQYD94GpCDTFAobDBAQApCEFbD94ALCD4ALFHaCEHcINAcGpCETHcApAa6MBKCBHxCUApCDTGaApCffffI0eCBYD/s1JJBhJJJJBBHcAQCkFAQYD94GqCDTFAcbDBAQAqCEFbD94AcCfEAaZ1JJJBHlDNALtMBAVCD4HkApCUFHqINAIAxAk2CDTFGyYDLGpCh4Ap7C+f+B+dd2AyYDBGpCh4Ap7C/d/o+b8j27AyYDWGpCh4Ap7C+3f/n8n27HaCBHpDNDNINAlAaAqgGaCDTFG8aYDBGcCUsMEAIAcAk2CDTFAyCXZ+LJJJBtMDApCEFGpAaFHaApAq9NMBXDKKA8aAxbDBAxHcKAhAxCDTFAcbDBAxCEFGxAL9HMBKCBHpAoHcINAcApbDBAcCLFHcALApCEFGp9HMBKCBHpAhHcAoHaINDNApAcYDBGqsMBAaAoAqCDTFGqYDBbDBAqApbDBKAcCLFHcAaCLFHaALApCEFGp9HMBKKCBHaALCBYD/s1JJBhJJJJBBHyAQCkFAQYD94GpCDTFAybDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHpAQCkFAQYD94GcCDTFApbDBAQAcCEFbD94AXCBYD/s1JJBhJJJJBBHcAQCkFAQYD94GqCDTFAcbDBAQAqCEFbD94ApCfEAKZ1JJJBHeAcCfEAKZ1JJJBH3DNALtMBAZCWFH5INDNAMAaCDTGpFYDBG8etMBAZASApFYDBCITFH8fA3ApFHAAeApFHxCBHkINDNDNA8fAkCITFYDBGlAa9HMBAxAabDBAAAabDBXEKDNAMAlCDTGKFYDBGHtMBAZASAKFYDBCITGpFYDBAasMEAHCUFH8aA5ApFHcCBHpINA8aApsMEApCEFHpAcYDBHqAcCWFHcAqAa9HMBKApAH6MEKA3AKFGpAaAlApYDBCUsebDBAxAlAaAxYDBCUsebDBKAkCEFGkA8e9HMBKKAaCEFGaAL9HMBKAhHcAoHaA3HqAeHkCBHpINDNDNApAcYDBG8a9HMBDNApAaYDBG8a9HMBAkYDBH8aDNAqYDBGlCU9HMBA8aCU9HMBAyApFCB86BBXIKAyApFHxDNApAlsMBApA8asMBAxCE86BBXIKAxCL86BBXDKDNApAoA8aCDTGlFYDB9HMBDNAqYDBGxCUsMBApAxsMBAkYDBGKCUsMBApAKsMBA3AlFYDBG8eCUsMBA8eA8asMBAeAlFYDBGlCUsMBAlA8asMBDNAhAxCDTFYDBAhAlCDTFYDB9HMBAhAKCDTFYDBAhA8eCDTFYDB9HMBAyApFCD86BBXLKAyApFCL86BBXIKAyApFCL86BBXDKAyApFCL86BBXEKAyApFAyA8aFrBB86BBKAcCLFHcAaCLFHaAqCLFHqAkCLFHkALApCEFGp9HMBKAWCEgtMBAyHpALHcINDNAprBBCE9HMBApCL86BBKApCEFHpAcCUFGcMBKKCBHkCUALCX2ALC/V+q/V+qE0eCBYD/s1JJBhJJJJBBHMAQCkFAQYD94GpCDTFAMbDBAQApCEFbD94AMAIALAVZ+DJJJB8aCUALC8s2GcALC/d/o/F8u0eCBYD/s1JJBhJJJJBBHpAQCkFAQYD94GaCDTFApbDBAQAaCEFbD94ApCBAcZ1JJJBHZDNADtMBAEHcINDNAMAcCLFYDBG8aCX2FGpiDBAMAcYDBGlCX2FGaiDBGG+TG8jAMAcCWFYDBGxCX2FGqCLFiDBAaCLFiDBG8k+TG8lnAqiDBAG+TG8mApCLFiDBA8k+TG8nn+TGYAYnA8nAqCWFiDBAaCWFiDBG8p+TGinA8lApCWFiDBA8p+TG8nn+TG8lA8lnA8nA8mnAiA8jn+TG8jA8jnmm+RG8mjBBBB9etMBAYA8m+VHYA8jA8m+VH8jA8lA8m+VH8lKAZAhAlCDTFYDBC8s2FGpA8lA8m+RG8mA8lnnG8nApiDBmuDBApA8jA8mA8jnG8rnGiApiDLmuDLApAYA8mAYnG8snGrApiDWmuDWApA8rA8lnG8rApiDXmuDXApA8sA8lnG8uApiDZmuDZApA8sA8jnG8sApiDcmuDcApA8lA8mAYA8pnA8lAGnA8kA8jnmm+MG8knGGnG8lApiDkmuDkApA8jAGnG8jApiD3muD3ApAYAGnGYApiDAmuDAApAGA8knGGApiD8kmuD8kApA8mApiDYmuDYAZAhA8aCDTFYDBC8s2FGpA8nApiDBmuDBApAiApiDLmuDLApArApiDWmuDWApA8rApiDXmuDXApA8uApiDZmuDZApA8sApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApAYApiDAmuDAApAGApiD8kmuD8kApA8mApiDYmuDYAZAhAxCDTFYDBC8s2FGpA8nApiDBmuDBApAiApiDLmuDLApArApiDWmuDWApA8rApiDXmuDXApA8uApiDZmuDZApA8sApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApAYApiDAmuDAApAGApiD8kmuD8kApA8mApiDYmuDYAcCXFHcAkCIFGkAD6MBKCBH8aAEHxINCBHcINAyAEAcC+81JJBFYDBGlA8aFCDTFYDBGaFrBBHpDNDNAyAxAcFYDBGqFrBBGkC99FCfEgCPE0MBApCEsMBApCD9HMEKDNAkCUFCfEgCE0MBAeAqCDTFYDBAa9HMEKDNApCUFCfEgCE0MBA3AaCDTFYDBAq9HMEKDNAkCV2ApFC+g1JJBFrBBtMBAhAaCDTFYDBAhAqCDTFYDB0MEKjBBACjBBJzApCEseH8mAkCEsHKAEAlCDTC+81JJBFYDBA8aFCDTFYDBHlDNAMAaCX2FGpCWFiDBAMAqCX2FGkCWFiDBG8k+TG8lA8lnApiDBAkiDBG8p+TG8jA8jnApCLFiDBAkCLFiDBG8n+TGYAYnmm+RGGjBBBB9etMBA8lAG+VH8lAYAG+VHYA8jAG+VH8jKjBBACA8mAKeH8sDNAMAlCX2FGpiDWA8k+TG8mA8lA8mA8lnApiDBA8p+TGrA8jnAYApiDLA8n+TG8rnmmGin+TG8mA8mnArA8jAin+TG8lA8lnA8rAYAin+TG8jA8jnmm+RGYjBBBB9etMBA8mAY+VH8mA8jAY+VH8jA8lAY+VH8lKAZAhAqCDTFYDBC8s2FGpA8lA8sAGnGYA8lnnGiApiDBmuDBApA8jAYA8jnG8snGrApiDLmuDLApA8mAYA8mnGGnG8rApiDWmuDWApA8sA8lnG8sApiDXmuDXApAGA8lnG8uApiDZmuDZApAGA8jnG8vApiDcmuDcApA8lAYA8mA8knA8lA8pnA8nA8jnmm+MG8knGGnG8lApiDkmuDkApA8jAGnG8jApiD3muD3ApA8mAGnG8mApiDAmuDAApAGA8knGGApiD8kmuD8kApAYApiDYmuDYAZAhAaCDTFYDBC8s2FGpAiApiDBmuDBApArApiDLmuDLApA8rApiDWmuDWApA8sApiDXmuDXApA8uApiDZmuDZApA8vApiDcmuDcApA8lApiDkmuDkApA8jApiD3muD3ApA8mApiDAmuDAApAGApiD8kmuD8kApAYApiDYmuDYKAcCLFGcCX9HMBKAxCXFHxA8aCIFG8aAD6MBKKDNABAEsMBABAEADCDTZ+HJJJB8aKCUADCX2ADC/V+q/V+qE0eCBYD/s1JJBhJJJJBBHAAQCkFAQYD94GpCDTFAAbDBAQApCEFbD94CUADCDTADCffffI0eCBYD/s1JJBhJJJJBBH5AQCkFAQYD94GpCDTFA5bDBAQApCEFbD94AXCBYD/s1JJBhJJJJBBHIAQCkFAQYD94GpCDTFAIbDBAQApCEFbD94ALCBYD/s1JJBhJJJJBBH8wAQCkFAQYD94GpCDTFA8wbDBAQApCEFbD94jBBBBHrDNADAO9NMBARARnH8sAACWFH8xAQYDZH8yAQYDXH8zAQYDWH80jBBBBHrINAQCWFABADGSALAhZ+CJJJBCBHHABHxCBHKINCBHpINDNAhAxApFYDBGaCDTGEFYDBGkAhABApC+81JJBFYDBAKFCDTFYDBGcCDTFYDBG8asMBAyAcFrBBGlCV2AyAaFrBBGqFC/Q1JJBFrBBGDAqCV2AlFG8eC/Q1JJBFrBBG8fvCfEgtMBDNA8eC+g1JJBFrBBtMBA8aAk0MEKDNAqAl9HMBAqCUFCfEgCE0MBAeAEFYDBAc9HMEKAAAHCX2FGqAcAaA8fCfEgGkebDLAqAaAcAkebDBAqADA8fgCfEgCB9HbDWAHCEFHHKApCLFGpCX9HMBKAxCXFHxAKCIFGKAS6MBKDNDNAHtMBAAHcAHH8aINAcCWFGljBBBBjBBJzAZAhAcYDBGaCDTFYDBC8s2FGpiDYG8l+VA8ljBBBB9beApiDWAMAcCLFGEYDBGqCX2FGkCWFiDBG8lnApiDZAkiDBG8jnApiDAmG8mA8mmmA8lnApiDLAkCLFiDBG8mnApiDcA8lnApiD3mG8lA8lmmA8mnApiDBA8jnApiDXA8mnApiDkmG8lA8lmmA8jnApiD8kmmm+LnGYjBBBBjBBJzAZAhAqAaAlYDBGkeGlCDTFYDBC8s2FGpiDYG8l+VA8ljBBBB9beApiDWAMAaAqAkeGxCX2FGkCWFiDBG8lnApiDZAkiDBG8jnApiDAmG8mA8mmmA8lnApiDLAkCLFiDBG8mnApiDcA8lnApiD3mG8lA8lmmA8mnApiDBA8jnApiDXA8mnApiDkmG8lA8lmmA8jnApiD8kmmm+LnG8lAYA8l9fGpeuDBAEAqAxApebDBAcAaAlApebDBAcCXFHcA8aCUFG8aMBKAQCJEFCBCJ/ABZ1JJJB8aA8xHpAHHcINAQCJEFApYDBCo4C/8zgFGaAaYDBCEFbDBApCXFHpAcCUFGcMBKCBHpCBHcINAQCJEFApFGaYDBHqAaAcbDBAqAcFHcApCLFGpCJ/AB9HMBKCBHpA8xHcINAQCJEFAcYDBCo4C/8zgFGaAaYDBGaCEFbDBA5AaCDTFApbDBAcCXFHcAHApCEFGp9HMBKASAO9rGaCI9uH81DNALtMBCBHpAIHcINAcApbDBAcCLFHcALApCEFGp9HMBKKCBHbA8wCBALZ1JJJBH83AaCo9uHuA81CE4H85CBH86CBHKDNINAAA5AKCDTFYDBCX2FGxiDWG8jA8s9eMEA86A819PMEjffUUH8lDNA85AH9PMBAAA5A85CDTFYDBCX2FiDWjBB/AznH8lKDNA8jA8l9etMBA86Au0MDKDNA83AhAxYDLG87CDTG88FYDBGaFG89rBBA83AhAxYDBGECDTG8+FYDBGzFGNrBBvMBDNA80AzCDTGpFYDBGqtMBA8yA8zApFYDBCITFHpAMAaCX2FG8eCWFHDA8eCLFHXAMAzCX2FG8fCWFHVA8fCLFHWCBHcCEHlDNINDNAIApYDBCDTFYDBGkAasMBAIApCLFYDBCDTFYDBG8aAasMBAMA8aCX2FG8aiDBAMAkCX2FGkiDBG8m+TG8lAWiDBAkCLFiDBGY+TGGnA8fiDBA8m+TG8kA8aCLFiDBAY+TG8jn+TA8lAXiDBAY+TG8pnA8eiDBA8m+TG8nA8jn+TnA8jAViDBAkCWFiDBGY+TGinAGA8aCWFiDBAY+TG8mn+TA8jADiDBAY+TGYnA8pA8mn+TnA8mA8knAiA8ln+TA8mA8nnAYA8ln+TnmmjBBBB9dMDKApCWFHpAcCEFGcAq6HlAqAc9HMBKKAlCEgtMBA85CEFH85XEKAxCWFHqAZAaC8s2FGpAZAzC8s2FGciDBApiDBmuDBApAciDLApiDLmuDLApAciDWApiDWmuDWApAciDXApiDXmuDXApAciDZApiDZmuDZApAciDcApiDcmuDcApAciDkApiDkmuDkApAciD3ApiD3muD3ApAciDAApiDAmuDAApAciD8kApiD8kmuD8kApAciDYApiDYmuDYDNDNDNDNAyAEFGcrBBC9+FpDEBDKAEHpINAIApCDTGpFAabDBAoApFYDBGpAE9HMBXIKKAoA88FYDBHpAoA8+FYDBHEAIA8+FA87bDBApH87KAIAECDTFA87bDBKANCE86BBA89CE86BBAqiDBG8lArArA8l9deHrAbCEFHbCECDAcrBBCEseA86FH86KAKCEFGKAH9HMBKKAbtMBDNALtMBCBHcAeHpINDNApYDBGaCUsMBDNAcAIAaCDTGqFYDBGa9HMBAeAqFYDBHaKApAabDBKApCLFHpALAcCEFGc9HMBKCBHcA3HpINDNApYDBGaCUsMBDNAcAIAaCDTGqFYDBGa9HMBA3AqFYDBHaKApAabDBKApCLFHpALAcCEFGc9HMBKKCBHDABHpCBHkINDNAIApYDBCDTFYDBGcAIApCLFYDBCDTFYDBGasMBAcAIApCWFYDBCDTFYDBGqsMBAaAqsMBABADCDTFG8aAcbDBA8aCLFAabDBA8aCWFAqbDBADCIFHDKApCXFHpAkCIFGkAS9PMDXBKKASHDXDKADAO0MBKKDNAdtMBAdAr+RuDBKAQYD94GpCDTAQCkFFC98FHhDNINAptMEAhYDBCBYD/w1JJBh+BJJJBBAhC98FHhApCUFHpXBKKAQCJ/BBF8kJJJJBADK/PLEOUABYDBCBAICDTZ1JJJB8aADCI9uHVDNADtMBABYDBHODNALtMBAEHRADHWINAOALARYDBCDTFYDBCDTFGdAdYDBCEFbDBARCLFHRAWCUFGWMBXDKKAEHRADHWINAOARYDBCDTFGdAdYDBCEFbDBARCLFHRAWCUFGWMBKKDNAItMBABYDBHRABYDLHWCBHdAIHOINAWAdbDBAWCLFHWARYDBAdFHdARCLFHRAOCUFGOMBKKDNADCI6MBAVCEAVCE0eHQABYDLHVABYDWHRINAECWFYDBHWAECLFYDBHdAEYDBHODNALtMBALAWCDTFYDBHWALAdCDTFYDBHdALAOCDTFYDBHOKARAVAOCDTFGDYDBCITFAdbDBARADYDBCITFAWbDLADADYDBCEFbDBARAVAdCDTFGDYDBCITFAWbDBARADYDBCITFAObDLADADYDBCEFbDBARAVAWCDTFGWYDBCITFAObDBARAWYDBCITFAdbDLAWAWYDBCEFbDBAECXFHEAQCUFGQMBKKDNAItMBABYDLHRABYDBHWINARARYDBAWYDB9rbDBAWCLFHWARCLFHRAICUFGIMBKKK+3LDOUV998jJJJJBCA9rGLCZFCWFCBYD11JJBbDBALCB8pDJ1JJB83IZALCWFCBYDn1JJBbDBALCB8pD+M1JJB83IBDNADtMBAICD4HVDNABtMBAVCDTHOCBHRAEHWINABARCX2FGIAEARAV2CDTFGdiDBuDBAIAdiDLuDLAIAdiDWuDWCBHIINALCZFAIFGdAWAIFiDBGQAdiDBGKAKAQ9eeuDBALAIFGdAQAdiDBGKAKAQ9deuDBAICLFGICX9HMBKAWAOFHWARCEFGRAD9HMBXDKKAVCDTHRCBHWINCBHIINALCZFAIFGdAEAIFiDBGQAdiDBGKAKAQ9eeuDBALAIFGdAQAdiDBGKAKAQ9deuDBAICLFGICX9HMBKAEARFHEAWCEFGWAD9HMBKKALiDBALiDZGK+TjBBBB+XGQALiDLALiDcGX+TGMAMAQ9deGQALiDWALiDkGM+TGpApAQ9deHpDNABtMBADtMBjBBBBjBBJzAp+VApjBBBB9beHQINABAQABiDBAK+TnuDBABCLFGIAQAIiDBAX+TnuDBABCWFGIAQAIiDBAM+TnuDBABCXFHBADCUFGDMBKKApK+qDIDUI99DUCBHI8jJJJJBCA9rGLCZFCWFCBYD11JJBbDBALCB8pDJ1JJB83IZALCWFCBYDn1JJBbDBALCB8pD+M1JJB83IBDNDNAEMBjBBJfHVjBBJfHOjBBJfHRXEKADCD4CDTHWINCBHDINALCZFADFGdABADFiDBGOAdiDBGRARAO9eeuDBALADFGdAOAdiDBGRARAO9deuDBADCLFGDCX9HMBKABAWFHBAICEFGIAE9HMBKALiDWALiDk+THRALiDLALiDc+THOALiDBALiDZ+THVKAVjBBBB+XGVAOAOAV9deGOARARAO9deK9dEEUABCfEAICDTZ1JJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/01JJBGEABCIFC98gFGBbD/01JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/01JJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/01JJBFGDbD/01JJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKK6EIUCBHIDNADtMBDNINABrBBGLAErBBGV9HMEAECEFHEABCEFHBADCUFGDMBXDKKALAV9rHIKAIKK+CEDBCJWK9pffUUffUUffUUffUfffUfffUfBBBBBBBBEEEBEEBEBBEEEBEBBBBBEBEBBBBBEBBBDBBBBBBBBBBBBBBBEEEEEBEBBBBBEBBBBBEEBBBBBBC/sWKXEBBBDBBBJ9kBB",t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var n,i=WebAssembly.instantiate(o(e),{}).then(function(m){n=m.instance,n.exports.__wasm_call_ctors()});function o(m){for(var g=new Uint8Array(m.length),p=0;p<m.length;++p){var y=m.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var b=0,p=0;p<m.length;++p)g[b++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,b)}function r(m){if(!m)throw new Error("Assertion failed")}function s(m){return new Uint8Array(m.buffer,m.byteOffset,m.byteLength)}function a(m,g){var p=n.exports.sbrk,y=p(m.length*4),b=p(g*4),C=new Uint8Array(n.exports.memory.buffer),E=s(m);C.set(E,y);var w=n.exports.meshopt_optimizeVertexFetchRemap(b,y,m.length,g);C=new Uint8Array(n.exports.memory.buffer);var S=new Uint32Array(g);new Uint8Array(S.buffer).set(C.subarray(b,b+g*4)),E.set(C.subarray(y,y+m.length*4)),p(y-p(0));for(var P=0;P<m.length;++P)m[P]=S[m[P]];return[S,w]}function c(m){for(var g=0,p=0;p<m.length;++p){var y=m[p];g=g<y?y:g}return g}function u(m,g,p,y,b,C,E,w,S){var P=n.exports.sbrk,L=P(4),z=P(p*4),R=P(b*C),F=P(p*4),U=new Uint8Array(n.exports.memory.buffer);U.set(s(y),R),U.set(s(g),F);var D=m(z,F,p,R,b,C,E,w,S,L);U=new Uint8Array(n.exports.memory.buffer);var I=new Uint32Array(D);s(I).set(U.subarray(z,z+D*4));var _=new Float32Array(1);return s(_).set(U.subarray(L,L+4)),P(L-P(0)),[I,_[0]]}function d(m,g,p,y){var b=n.exports.sbrk,C=b(p*y),E=new Uint8Array(n.exports.memory.buffer);E.set(s(g),C);var w=m(C,p,y);return b(C-b(0)),w}var h={LockBorder:1};return{ready:i,supported:!0,compactMesh:function(m){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0);var g=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m);return a(g,c(m)+1)},simplify:function(m,g,p,y,b,C){r(m instanceof Uint32Array||m instanceof Int32Array||m instanceof Uint16Array||m instanceof Int16Array),r(m.length%3==0),r(g instanceof Float32Array),r(g.length%p==0),r(p>=3),r(y%3==0);for(var E=0,w=0;w<(C?C.length:0);++w)E|=h[C[w]];var S=m.BYTES_PER_ELEMENT==4?m:new Uint32Array(m),P=u(n.exports.meshopt_simplify,S,m.length,g,g.length,p*4,y,b,E);return P[0]=m instanceof Uint32Array?P[0]:new m.constructor(P[0]),P},getScale:function(m,g){return r(m instanceof Float32Array),r(m.length%g==0),d(n.exports.meshopt_simplifyScale,m,m.length,g*4)}}})();function yf(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.bufferViewId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.bufferViewId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let c=a.buffer,u=a.byteOffset,d=a.byteLength,h=!1,m,g,p,y;if(hr(a,"EXT_meshopt_compression")){const C=a.extensions.EXT_meshopt_compression;c=C.buffer,u=A(C.byteOffset,0),d=C.byteLength,h=!0,m=C.byteStride,g=C.count,p=C.mode,y=A(C.filter,"NONE")}const b=n.buffers[c];this._hasMeshopt=h,this._meshoptByteStride=m,this._meshoptCount=g,this._meshoptMode=p,this._meshoptFilter=y,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=b,this._bufferId=c,this._byteOffset=u,this._byteLength=d,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=Ft.UNLOADED,this._promise=void 0,this._process=function(C,E){}}l(Object.create)&&(yf.prototype=Object.create(mr.prototype),yf.prototype.constructor=yf);Object.defineProperties(yf.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});yf.prototype.load=function(){const e=qGe(this);this._bufferLoader=e,this._state=Ft.LOADING;const t=this,n=new Promise(function(i){t._process=function(o,r){if(!o._hasMeshopt||!l(o._typedArray)||o._state!==Ft.PROCESSING)return;const s=o._meshoptCount,a=o._meshoptByteStride,c=new Uint8Array(s*a);jGe.decodeGltfBuffer(c,s,a,o._typedArray,o._meshoptMode,o._meshoptFilter),o._typedArray=c,o._state=Ft.READY,i(o)}});return this._promise=e.promise.then(function(){if(t.isDestroyed())return;const i=e.typedArray,o=new Uint8Array(i.buffer,i.byteOffset+t._byteOffset,t._byteLength);return t.unload(),t._typedArray=o,t._hasMeshopt?(t._state=Ft.PROCESSING,n):(t._state=Ft.READY,t)}).catch(function(i){if(t.isDestroyed())return;t.unload(),t._state=Ft.FAILED;const o="Failed to load buffer view";return Promise.reject(t.getError(o,i))}),this._promise};function qGe(e){const t=e._resourceCache,n=e._buffer;if(l(n.uri)){const o=e._baseResource.getDerivedResource({url:n.uri});return t.loadExternalBuffer({resource:o})}return t.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:e._bufferId})}yf.prototype.process=function(e){return T.typeOf.object("frameState",e),this._process(this,e)};yf.prototype.unload=function(){l(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};function ls(){}ls._maxDecodingConcurrency=Math.max(gn.hardwareConcurrency-1,1);ls._decoderTaskProcessor=void 0;ls._taskProcessorReady=!1;ls._getDecoderTaskProcessor=function(){if(!l(ls._decoderTaskProcessor)){const e=new Vi("decodeDraco",ls._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(){ls._taskProcessorReady=!0}),ls._decoderTaskProcessor=e}return ls._decoderTaskProcessor};ls.decodePointCloud=function(e){const t=ls._getDecoderTaskProcessor();if(ls._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};ls.decodeBufferView=function(e){const t=ls._getDecoderTaskProcessor();if(ls._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};function Af(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.draco,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.draco",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),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=Ft.UNLOADED,this._promise=void 0,this._process=function(a,c){}}l(Object.create)&&(Af.prototype=Object.create(mr.prototype),Af.prototype.constructor=Af);Object.defineProperties(Af.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});Af.prototype.load=function(){const t=this._resourceCache.loadBufferView({gltf:this._gltf,bufferViewId:this._draco.bufferView,gltfResource:this._gltfResource,baseResource:this._baseResource});this._bufferViewLoader=t,this._state=Ft.LOADING;const n=this,i=new Promise(function(o,r){n._process=function(s,a){if(!l(s._bufferViewTypedArray)||l(s._decodePromise))return;const c=s._draco,d=s._gltf.bufferViews,h=c.bufferView,m=d[h],g=c.attributes,p={array:new Uint8Array(s._bufferViewTypedArray),bufferView:m,compressedAttributes:g,dequantizeInShader:!0},y=ls.decodeBufferView(p);l(y)&&(s._decodePromise=y.then(function(b){if(s.isDestroyed()){o();return}s.unload(),s._decodedData={indices:b.indexArray,vertexAttributes:b.attributeData},s._state=Ft.READY,o(s)}).catch(function(b){if(s.isDestroyed()){o();return}r(b)}))}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._bufferViewTypedArray=t.typedArray,n._state=Ft.PROCESSING,i}).catch(function(o){if(!n.isDestroyed())return $Ge(n,o)}),this._promise};function $Ge(e,t){e.unload(),e._state=Ft.FAILED;const n="Failed to load Draco";return Promise.reject(e.getError(n,t))}Af.prototype.process=function(e){return T.typeOf.object("frameState",e),this._process(this,e)};Af.prototype.unload=function(){l(this._bufferViewLoader)&&this._resourceCache.unload(this._bufferViewLoader),this._bufferViewLoader=void 0,this._bufferViewTypedArray=void 0,this._decodedData=void 0,this._gltf=void 0};function YGe(e){const t=e.uint8Array,n=e.format,i=e.request,o=A(e.flipY,!1),r=A(e.skipColorSpaceConversion,!1);T.typeOf.object("uint8Array",t),T.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return Me.supportsImageBitmapOptions().then(function(c){return c?Promise.resolve(Me.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new Me({url:a,request:i}).fetchImage({flipY:o,skipColorSpaceConversion:r}))}).then(function(c){return l(a)&&window.URL.revokeObjectURL(a),c}).catch(function(c){return l(a)&&window.URL.revokeObjectURL(a),Promise.reject(c)})}function rd(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.imageId,o=e.gltfResource,r=e.baseResource,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.imageId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r);const a=n.images[i],c=a.bufferView,u=a.uri;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._bufferViewId=c,this._uri=u,this._cacheKey=s,this._bufferViewLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._state=Ft.UNLOADED,this._promise=void 0}l(Object.create)&&(rd.prototype=Object.create(mr.prototype),rd.prototype.constructor=rd);Object.defineProperties(rd.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}}});rd.prototype.load=function(){return l(this._bufferViewId)?(this._promise=XGe(this),this._promise):(this._promise=KGe(this),this._promise)};function gK(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 XGe(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,e._state=Ft.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.typedArray;return QGe(i).then(function(o){if(e.isDestroyed())return;const r=gK(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Ft.READY,e})}).catch(function(i){if(!e.isDestroyed())return yK(e,i,"Failed to load embedded image")})}function KGe(e){const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});return e._state=Ft.LOADING,e8e(i).then(function(o){if(e.isDestroyed())return;const r=gK(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Ft.READY,e}).catch(function(o){if(!e.isDestroyed())return yK(e,o,`Failed to load image: ${n}`)})}function yK(e,t,n){return e.unload(),e._state=Ft.FAILED,Promise.reject(e.getError(n,t))}function JGe(e){const 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 Ie("Image format is not recognized")}function QGe(e){const t=JGe(e);if(t==="image/ktx2"){const n=new Uint8Array(e);return K_(n)}return rd._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}const ZGe=/(^data:image\/ktx2)|(\.ktx2$)/i;function e8e(e){const t=e.getUrlComponent(!1,!0);return ZGe.test(t)?K_(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}rd.prototype.unload=function(){l(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};rd._loadImageFromTypedArray=YGe;function bf(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.accessorId,o=e.gltfResource,r=e.baseResource,s=e.draco,a=e.cacheKey,c=A(e.asynchronous,!0),u=A(e.loadBuffer,!1),d=A(e.loadTypedArray,!1);if(T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.number("options.accessorId",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),!u&&!d)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const h=n.accessors[i].componentType;this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._gltf=n,this._accessorId=i,this._indexDatatype=h,this._draco=s,this._cacheKey=a,this._asynchronous=c,this._loadBuffer=u,this._loadTypedArray=d,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Ft.UNLOADED,this._promise=void 0,this._process=function(m,g){}}l(Object.create)&&(bf.prototype=Object.create(mr.prototype),bf.prototype.constructor=bf);Object.defineProperties(bf.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}}});const t8e=new L2;bf.prototype.load=function(){let e;l(this._draco)?e=n8e(this):e=i8e(this);const t=this,n=new Promise(function(i){t._process=function(o,r){if(o._state===Ft.READY)return;const s=o._typedArray,a=o._indexDatatype;if(l(o._dracoLoader)&&o._dracoLoader.process(r),l(o._bufferViewLoader)&&o._bufferViewLoader.process(r),!l(s))return;let c;if(o._loadBuffer&&o._asynchronous){const u=t8e;if(u.set(s,a,r.context),!r.jobScheduler.execute(u,Gl.BUFFER))return;c=u.buffer}else o._loadBuffer&&(c=AK(s,a,r.context));o.unload(),o._buffer=c,o._typedArray=o._loadTypedArray?s:void 0,o._state=Ft.READY,i(o)}});return this._promise=e.then(function(){if(!t.isDestroyed())return n}).catch(function(i){if(!t.isDestroyed())return r8e(t,i)}),this._promise};function n8e(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Ft.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.decodedData.indices.typedArray;return e._typedArray=i,e._indexDatatype=ee.fromTypedArray(i),e._state=Ft.PROCESSING,e})}function i8e(e){const 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=Ft.LOADING,e._bufferViewLoader=s,s.promise.then(function(){if(e.isDestroyed())return;const a=s.typedArray;return e._typedArray=o8e(e,a),e._state=Ft.PROCESSING,e})}function o8e(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=at.getSizeInBytes(s);let c=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){const h=r*a,m=new Uint8Array(c,u,h);c=new Uint8Array(m).buffer,u=0,$p("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let d;return s===at.UNSIGNED_BYTE?d=new Uint8Array(c,u,r):s===at.UNSIGNED_SHORT?d=new Uint16Array(c,u,r):s===at.UNSIGNED_INT&&(d=new Uint32Array(c,u,r)),d}function r8e(e,t){e.unload(),e._state=Ft.FAILED;const n="Failed to load index buffer";return t=e.getError(n,t),Promise.reject(t)}function L2(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}L2.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};L2.prototype.execute=function(){this.buffer=AK(this.typedArray,this.indexDatatype,this.context)};function AK(e,t,n){const i=Tt.createIndexBuffer({typedArray:e,context:n,usage:nt.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}bf.prototype.process=function(e){return T.typeOf.object("frameState",e),this._process(this,e)};bf.prototype.unload=function(){l(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;l(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),l(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};function Jl(e,t,n){if(n=A(n,!1),n){const i=e.indexOf(t);if(i>-1)return i}return e.push(t),e.length-1}function _s(e,t){return l(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function be(){}be.objectLegacy=function(e,t){if(l(e)){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(l(o))return o}}};be.object=function(e,t){if(l(e)){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=t(o,i);if(l(r))return r}}};be.topLevel=function(e,t,n){const i=e[t];return l(i)&&!Array.isArray(i)?be.objectLegacy(i,n):be.object(i,n)};be.accessor=function(e,t){return be.topLevel(e,"accessors",t)};be.accessorWithSemantic=function(e,t,n){const i={};return be.mesh(e,function(o){return be.meshPrimitive(o,function(r){const s=be.meshPrimitiveAttribute(r,function(a,c){if(c.indexOf(t)===0&&!l(i[a])){i[a]=!0;const u=n(a);if(l(u))return u}});return l(s)?s:be.meshPrimitiveTarget(r,function(a){return be.meshPrimitiveTargetAttribute(a,function(c,u){if(u.indexOf(t)===0&&!l(i[c])){i[c]=!0;const d=n(c);if(l(d))return d}})})})})};be.accessorContainingVertexAttributeData=function(e,t){const n={};return be.mesh(e,function(i){return be.meshPrimitive(i,function(o){const r=be.meshPrimitiveAttribute(o,function(s){if(!l(n[s])){n[s]=!0;const a=t(s);if(l(a))return a}});return l(r)?r:be.meshPrimitiveTarget(o,function(s){return be.meshPrimitiveTargetAttribute(s,function(a){if(!l(n[a])){n[a]=!0;const c=t(a);if(l(c))return c}})})})})};be.accessorContainingIndexData=function(e,t){const n={};return be.mesh(e,function(i){return be.meshPrimitive(i,function(o){const r=o.indices;if(l(r)&&!l(n[r])){n[r]=!0;const s=t(r);if(l(s))return s}})})};be.animation=function(e,t){return be.topLevel(e,"animations",t)};be.animationChannel=function(e,t){const n=e.channels;return be.object(n,t)};be.animationSampler=function(e,t){const n=e.samplers;return be.object(n,t)};be.buffer=function(e,t){return be.topLevel(e,"buffers",t)};be.bufferView=function(e,t){return be.topLevel(e,"bufferViews",t)};be.camera=function(e,t){return be.topLevel(e,"cameras",t)};be.image=function(e,t){return be.topLevel(e,"images",t)};be.material=function(e,t){return be.topLevel(e,"materials",t)};be.materialValue=function(e,t){let n=e.values;l(e.extensions)&&l(e.extensions.KHR_techniques_webgl)&&(n=e.extensions.KHR_techniques_webgl.values);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};be.mesh=function(e,t){return be.topLevel(e,"meshes",t)};be.meshPrimitive=function(e,t){const n=e.primitives;if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r,o);if(l(s))return s}}};be.meshPrimitiveAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};be.meshPrimitiveTarget=function(e,t){const n=e.targets;if(l(n)){const i=n.length;for(let o=0;o<i;++o){const r=t(n[o],o);if(l(r))return r}}};be.meshPrimitiveTargetAttribute=function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t(i,n);if(l(o))return o}};be.node=function(e,t){return be.topLevel(e,"nodes",t)};be.nodeInTree=function(e,t,n){const i=e.nodes;if(l(i)){const o=t.length;for(let r=0;r<o;r++){const s=t[r],a=i[s];if(l(a)){let c=n(a,s);if(l(c))return c;const u=a.children;if(l(u)&&(c=be.nodeInTree(e,u,n),l(c)))return c}}}};be.nodeInScene=function(e,t,n){const i=t.nodes;if(l(i))return be.nodeInTree(e,i,n)};be.program=function(e,t){return _s(e,"KHR_techniques_webgl")?be.object(e.extensions.KHR_techniques_webgl.programs,t):be.topLevel(e,"programs",t)};be.sampler=function(e,t){return be.topLevel(e,"samplers",t)};be.scene=function(e,t){return be.topLevel(e,"scenes",t)};be.shader=function(e,t){return _s(e,"KHR_techniques_webgl")?be.object(e.extensions.KHR_techniques_webgl.shaders,t):be.topLevel(e,"shaders",t)};be.skin=function(e,t){return be.topLevel(e,"skins",t)};be.skinJoint=function(e,t){const n=e.joints;if(l(n)){const i=n.length;for(let o=0;o<i;o++){const r=n[o],s=t(r);if(l(s))return s}}};be.techniqueAttribute=function(e,t){const n=e.attributes;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};be.techniqueUniform=function(e,t){const n=e.uniforms;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};be.techniqueParameter=function(e,t){const n=e.parameters;for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)){const o=t(n[i],i);if(l(o))return o}};be.technique=function(e,t){return _s(e,"KHR_techniques_webgl")?be.object(e.extensions.KHR_techniques_webgl.techniques,t):be.topLevel(e,"techniques",t)};be.texture=function(e,t){return be.topLevel(e,"textures",t)};function OT(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}}function H0(e,t){const n=t.bufferView;if(l(n)){const i=e.bufferViews[n];if(l(i.byteStride)&&i.byteStride>0)return i.byteStride}return ee.getSizeInBytes(t.componentType)*OT(t.type)}function s8e(e){be.accessor(e,function(n){l(n.bufferView)&&(n.byteOffset=A(n.byteOffset,0))}),be.bufferView(e,function(n){l(n.buffer)&&(n.byteOffset=A(n.byteOffset,0))}),be.mesh(e,function(n){be.meshPrimitive(n,function(i){if(i.mode=A(i.mode,ae.TRIANGLES),!l(i.material)){l(e.materials)||(e.materials=[]);const o={name:"default"};i.material=Jl(e.materials,o)}})}),be.accessorContainingVertexAttributeData(e,function(n){const i=e.accessors[n],o=i.bufferView;if(i.normalized=A(i.normalized,!1),l(o)){const r=e.bufferViews[o];r.byteStride=H0(e,i),r.target=ae.ARRAY_BUFFER}}),be.accessorContainingIndexData(e,function(n){const o=e.accessors[n].bufferView;if(l(o)){const r=e.bufferViews[o];r.target=ae.ELEMENT_ARRAY_BUFFER}}),be.material(e,function(n){const i=A(n.extensions,A.EMPTY_OBJECT),o=i.KHR_materials_common;if(l(o)){const c=o.technique,u=l(o.values)?o.values:{};o.values=u,u.ambient=l(u.ambient)?u.ambient:[0,0,0,1],u.emission=l(u.emission)?u.emission:[0,0,0,1],u.transparency=A(u.transparency,1),c!=="CONSTANT"&&(u.diffuse=l(u.diffuse)?u.diffuse:[0,0,0,1],c!=="LAMBERT"&&(u.specular=l(u.specular)?u.specular:[0,0,0,1],u.shininess=A(u.shininess,0))),o.transparent=A(o.transparent,!1),o.doubleSided=A(o.doubleSided,!1);return}n.emissiveFactor=A(n.emissiveFactor,[0,0,0]),n.alphaMode=A(n.alphaMode,"OPAQUE"),n.doubleSided=A(n.doubleSided,!1),n.alphaMode==="MASK"&&(n.alphaCutoff=A(n.alphaCutoff,.5));const r=i.KHR_techniques_webgl;l(r)&&be.materialValue(n,function(c){l(c.index)&&wm(c)}),wm(n.emissiveTexture),wm(n.normalTexture),wm(n.occlusionTexture);const s=n.pbrMetallicRoughness;l(s)&&(s.baseColorFactor=A(s.baseColorFactor,[1,1,1,1]),s.metallicFactor=A(s.metallicFactor,1),s.roughnessFactor=A(s.roughnessFactor,1),wm(s.baseColorTexture),wm(s.metallicRoughnessTexture));const a=i.KHR_materials_pbrSpecularGlossiness;l(a)&&(a.diffuseFactor=A(a.diffuseFactor,[1,1,1,1]),a.specularFactor=A(a.specularFactor,[1,1,1]),a.glossinessFactor=A(a.glossinessFactor,1),wm(a.specularGlossinessTexture))}),be.animation(e,function(n){be.animationSampler(n,function(i){i.interpolation=A(i.interpolation,"LINEAR")})});const t=a8e(e);return be.node(e,function(n,i){l(t[i])||l(n.translation)||l(n.rotation)||l(n.scale)?(n.translation=A(n.translation,[0,0,0]),n.rotation=A(n.rotation,[0,0,0,1]),n.scale=A(n.scale,[1,1,1])):n.matrix=A(n.matrix,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}),be.sampler(e,function(n){n.wrapS=A(n.wrapS,ae.REPEAT),n.wrapT=A(n.wrapT,ae.REPEAT)}),l(e.scenes)&&!l(e.scene)&&(e.scene=0),e}function a8e(e){const t={};return be.animation(e,function(n){be.animationChannel(n,function(i){const o=i.target,r=o.node,s=o.path;(s==="translation"||s==="rotation"||s==="scale")&&(t[r]=!0)})}),t}function wm(e){l(e)&&(e.texCoord=A(e.texCoord,0))}function B2(e){return be.shader(e,function(t){Fx(t)}),be.buffer(e,function(t){Fx(t)}),be.image(e,function(t){Fx(t)}),Fx(e),e}function Fx(e){e.extras=l(e.extras)?e.extras:{},e.extras._pipeline=l(e.extras._pipeline)?e.extras._pipeline:{}}function c8e(e,t){const n=e.extensionsRequired;if(l(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),n.length===0&&delete e.extensionsRequired}}function bK(e,t){const n=e.extensionsUsed;if(l(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),c8e(e,t),n.length===0&&delete e.extensionsUsed}}const l8e=4;function u8e(e){if(ND(e)!=="glTF")throw new Ie("File is not valid binary glTF");const n=CK(e,0,5),i=n[1];if(i!==1&&i!==2)throw new Ie("Binary glTF version is not 1 or 2");return i===1?d8e(e,n):f8e(e,n)}function CK(e,t,n){const i=new DataView(e.buffer),o=new Array(n);for(let r=0;r<n;++r)o[r]=i.getUint32(e.byteOffset+t+r*l8e,!0);return o}function d8e(e,t){const n=t[2],i=t[3];if(t[4]!==0)throw new Ie("Binary glTF scene format is not JSON");const r=20,s=r+i,a=lc(e,r,i),c=JSON.parse(a);B2(c);const u=e.subarray(s,n),d=c.buffers;if(l(d)&&Object.keys(d).length>0){const h=A(d.binary_glTF,d.KHR_binary_glTF);l(h)&&(h.extras._pipeline.source=u,delete h.uri)}return bK(c,"KHR_binary_glTF"),c}function f8e(e,t){const n=t[2];let i=12,o,r;for(;i<n;){const s=CK(e,i,2),a=s[0],c=s[1];i+=8;const u=e.subarray(i,i+a);if(i+=a,c===1313821514){const d=lc(u);o=JSON.parse(d),B2(o)}else c===5130562&&(r=u)}if(l(o)&&l(r)){const s=o.buffers;if(l(s)&&s.length>0){const a=s[0];a.extras._pipeline.source=r}}return o}function h8e(e){return be.shader(e,function(t){zx(t)}),be.buffer(e,function(t){zx(t)}),be.image(e,function(t){zx(t)}),zx(e),e}function zx(e){l(e.extras)&&(l(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}function LT(e,t){let n=e.extensionsUsed;l(n)||(n=[],e.extensionsUsed=n),Jl(n,t,!0)}function R2(e){switch(e){case ee.BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt8(n+s*o)};case ee.UNSIGNED_BYTE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getUint8(n+s*o)};case ee.SHORT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt16(n+s*o,!0)};case ee.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 ee.INT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getInt32(n+s*o,!0)};case ee.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 ee.FLOAT:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat32(n+s*o,!0)};case ee.DOUBLE:return function(t,n,i,o,r){for(let s=0;s<i;++s)r[s]=t.getFloat64(n+s*o,!0)}}}function N2(e,t){const n=e.bufferViews,i=e.buffers,o=t.bufferView,r=OT(t.type);if(!l(t.bufferView))return{min:new Array(r).fill(0),max:new Array(r).fill(0)};const s=new Array(r).fill(Number.POSITIVE_INFINITY),a=new Array(r).fill(Number.NEGATIVE_INFINITY),c=n[o],u=c.buffer,h=i[u].extras._pipeline.source,m=t.count,g=H0(e,t);let p=t.byteOffset+c.byteOffset+h.byteOffset;const y=t.componentType,b=ee.getSizeInBytes(y),C=new DataView(h.buffer),E=new Array(r),w=R2(y);for(let S=0;S<m;S++){w(C,p,r,b,E);for(let P=0;P<r;P++){const L=E[P];s[P]=Math.min(s[P],L),a[P]=Math.max(a[P],L)}p+=g}return{min:s,max:a}}const p8e=[ae.FUNC_ADD,ae.FUNC_ADD],m8e=[ae.ONE,ae.ZERO,ae.ONE,ae.ZERO];function p5(e,t){const n=e.enable;return l(n)?n.indexOf(t)>-1:!1}const _8e=[ae.ZERO,ae.ONE,ae.SRC_COLOR,ae.ONE_MINUS_SRC_COLOR,ae.SRC_ALPHA,ae.ONE_MINUS_SRC_ALPHA,ae.DST_ALPHA,ae.ONE_MINUS_DST_ALPHA,ae.DST_COLOR,ae.ONE_MINUS_DST_COLOR];function g8e(e,t){if(!l(e))return t;for(let n=0;n<4;n++)if(_8e.indexOf(e[n])===-1)return t;return e}function y8e(e){const t={},n={},i=e.techniques;return l(i)&&(be.technique(e,function(o,r){const s=o.states;if(l(s)){const a=n[r]={};if(p5(s,ae.BLEND)){a.alphaMode="BLEND";const c=s.functions;l(c)&&(l(c.blendEquationSeparate)||l(c.blendFuncSeparate))&&(t[r]={blendEquation:A(c.blendEquationSeparate,p8e),blendFactors:g8e(c.blendFuncSeparate,m8e)})}p5(s,ae.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(l(e.extensions)||(e.extensions={}),LT(e,"KHR_blend")),be.material(e,function(o){if(l(o.technique)){const r=n[o.technique];be.objectLegacy(r,function(a,c){o[c]=a});const s=t[o.technique];l(s)&&(l(o.extensions)||(o.extensions={}),o.extensions.KHR_blend=s)}})),e}function A8e(e,t){let n=e.extensionsRequired;l(n)||(n=[],e.extensionsRequired=n),Jl(n,t,!0),LT(e,t)}function b8e(e){const t=e.techniques,n={},i={},o={};if(l(t)){const r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,be.technique(e,function(a,c){const u={name:a.name,program:void 0,attributes:{},uniforms:{}};let d;if(be.techniqueAttribute(a,function(h,m){d=a.parameters[h],u.attributes[m]={semantic:d.semantic}}),be.techniqueUniform(a,function(h,m){d=a.parameters[h],u.uniforms[m]={count:d.count,node:d.node,type:d.type,semantic:d.semantic,value:d.value},l(n[c])||(n[c]={}),n[c][h]=m}),l(o[a.program]))u.program=o[a.program];else{const h=e.programs[a.program],m={name:h.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[h.fragmentShader];m.fragmentShader=Jl(r.shaders,g,!0);const p=e.shaders[h.vertexShader];m.vertexShader=Jl(r.shaders,p,!0),u.program=Jl(r.programs,m),o[a.program]=u.program}i[c]=Jl(r.techniques,u)}),r.techniques.length>0&&(l(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,LT(e,"KHR_techniques_webgl"),A8e(e,"KHR_techniques_webgl"))}return be.material(e,function(r){if(l(r.technique)){const s={technique:i[r.technique]};be.objectLegacy(r.values,function(a,c){l(s.values)||(s.values={});const u=n[r.technique][c];l(u)&&(s.values[u]=a)}),l(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}function TK(e,t){T.typeOf.object("material",e),T.defined("handler",t);const n=e.pbrMetallicRoughness;if(l(n)){if(l(n.baseColorTexture)){const o=n.baseColorTexture,r=t(o.index,o);if(l(r))return r}if(l(n.metallicRoughnessTexture)){const o=n.metallicRoughnessTexture,r=t(o.index,o);if(l(r))return r}}if(l(e.extensions)){const o=e.extensions.KHR_materials_pbrSpecularGlossiness;if(l(o)){if(l(o.diffuseTexture)){const s=o.diffuseTexture,a=t(s.index,s);if(l(a))return a}if(l(o.specularGlossinessTexture)){const s=o.specularGlossinessTexture,a=t(s.index,s);if(l(a))return a}}const r=e.extensions.KHR_materials_common;if(l(r)&&l(r.values)){const s=r.values.diffuse,a=r.values.ambient,c=r.values.emission,u=r.values.specular;if(l(s)&&l(s.index)){const d=t(s.index,s);if(l(d))return d}if(l(a)&&l(a.index)){const d=t(a.index,a);if(l(d))return d}if(l(c)&&l(c.index)){const d=t(c.index,c);if(l(d))return d}if(l(u)&&l(u.index)){const d=t(u.index,u);if(l(d))return d}}}const i=be.materialValue(e,function(o){if(l(o.index)){const r=t(o.index,o);if(l(r))return r}});if(l(i))return i;if(l(e.emissiveTexture)){const o=e.emissiveTexture,r=t(o.index,o);if(l(r))return r}if(l(e.normalTexture)){const o=e.normalTexture,r=t(o.index,o);if(l(r))return r}if(l(e.occlusionTexture)){const o=e.occlusionTexture,r=t(o.index,o);if(l(r))return r}}const m5=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function C8e(e,t){return t=A(t,m5),m5.forEach(function(n){t.indexOf(n)>-1&&E8e(e,n)}),e}const T8e={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function E8e(e,t){const n=T8e[t],i=e[n];if(l(i)){let o=0;const r=Od[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(Pd[t](e,a-o),o++)}}function Pd(){}Pd.accessor=function(e,t){e.accessors.splice(t,1),be.mesh(e,function(i){be.meshPrimitive(i,function(o){be.meshPrimitiveAttribute(o,function(s,a){s>t&&o.attributes[a]--}),be.meshPrimitiveTarget(o,function(s){be.meshPrimitiveTargetAttribute(s,function(a,c){a>t&&s[c]--})});const r=o.indices;l(r)&&r>t&&o.indices--})}),be.skin(e,function(i){l(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),be.animation(e,function(i){be.animationSampler(i,function(o){l(o.input)&&o.input>t&&o.input--,l(o.output)&&o.output>t&&o.output--})})};Pd.buffer=function(e,t){e.buffers.splice(t,1),be.bufferView(e,function(i){l(i.buffer)&&i.buffer>t&&i.buffer--,l(i.extensions)&&l(i.extensions.EXT_meshopt_compression)&&i.extensions.EXT_meshopt_compression.buffer--})};Pd.bufferView=function(e,t){if(e.bufferViews.splice(t,1),be.accessor(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),be.shader(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),be.image(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),_s(e,"KHR_draco_mesh_compression")&&be.mesh(e,function(i){be.meshPrimitive(i,function(o){l(o.extensions)&&l(o.extensions.KHR_draco_mesh_compression)&&o.extensions.KHR_draco_mesh_compression.bufferView>t&&o.extensions.KHR_draco_mesh_compression.bufferView--})}),_s(e,"EXT_feature_metadata")){const o=e.extensions.EXT_feature_metadata.featureTables;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(l(a)){for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];l(u.bufferView)&&u.bufferView>t&&u.bufferView--,l(u.arrayOffsetBufferView)&&u.arrayOffsetBufferView>t&&u.arrayOffsetBufferView--,l(u.stringOffsetBufferView)&&u.stringOffsetBufferView>t&&u.stringOffsetBufferView--}}}}if(_s(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTables;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const c=o[s].properties;for(const u in c)if(c.hasOwnProperty(u)){const d=c[u];l(d.values)&&d.values>t&&d.values--,l(d.arrayOffsets)&&d.arrayOffsets>t&&d.arrayOffsets--,l(d.stringOffsets)&&d.stringOffsets>t&&d.stringOffsets--}}}}};Pd.image=function(e,t){e.images.splice(t,1),be.texture(e,function(i){l(i.source)&&i.source>t&&--i.source;const o=i.extensions;l(o)&&l(o.EXT_texture_webp)&&o.EXT_texture_webp.source>t?--i.extensions.EXT_texture_webp.source:l(o)&&l(o.KHR_texture_basisu)&&o.KHR_texture_basisu.source>t&&--i.extensions.KHR_texture_basisu.source})};Pd.mesh=function(e,t){e.meshes.splice(t,1),be.node(e,function(i){l(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};Pd.node=function(e,t){e.nodes.splice(t,1),be.skin(e,function(i){l(i.skeleton)&&i.skeleton>t&&i.skeleton--,i.joints=i.joints.map(function(o){return o>t?o-1:o})}),be.animation(e,function(i){be.animationChannel(i,function(o){l(o.target)&&l(o.target.node)&&o.target.node>t&&o.target.node--})}),be.technique(e,function(i){be.techniqueUniform(i,function(o){l(o.node)&&o.node>t&&o.node--})}),be.node(e,function(i){l(i.children)&&(i.children=i.children.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o}))}),be.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};Pd.material=function(e,t){e.materials.splice(t,1),be.mesh(e,function(i){be.meshPrimitive(i,function(o){l(o.material)&&o.material>t&&o.material--})})};Pd.sampler=function(e,t){e.samplers.splice(t,1),be.texture(e,function(i){l(i.sampler)&&i.sampler>t&&--i.sampler})};Pd.texture=function(e,t){if(e.textures.splice(t,1),be.material(e,function(i){TK(i,function(o,r){r.index>t&&--r.index})}),_s(e,"EXT_feature_metadata")){be.mesh(e,function(r){be.meshPrimitive(r,function(s){const a=s.extensions;if(l(a)&&l(a.EXT_feature_metadata)){const u=a.EXT_feature_metadata.featureIdTextures;if(l(u)){const d=u.length;for(let h=0;h<d;++h){const g=u[h].featureIds.texture;g.index>t&&--g.index}}}})});const o=e.extensions.EXT_feature_metadata.featureTextures;for(const r in o)if(o.hasOwnProperty(r)){const a=o[r].properties;if(l(a)){for(const c in a)if(a.hasOwnProperty(c)){const d=a[c].texture;d.index>t&&--d.index}}}}if(_s(e,"EXT_mesh_features")&&be.mesh(e,function(i){be.meshPrimitive(i,function(o){const r=o.extensions;if(l(r)&&l(r.EXT_mesh_features)){const a=r.EXT_mesh_features.featureIds;if(l(a)){const c=a.length;for(let u=0;u<c;++u){const d=a[u];l(d.texture)&&d.texture.index>t&&--d.texture.index}}}})}),_s(e,"EXT_structural_metadata")){const o=e.extensions.EXT_structural_metadata.propertyTextures;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const c=o[s].properties;for(const u in c)if(c.hasOwnProperty(u)){const d=c[u];d.index>t&&--d.index}}}}};function Od(){}Od.accessor=function(e){const t={};return be.mesh(e,function(n){be.meshPrimitive(n,function(i){be.meshPrimitiveAttribute(i,function(r){t[r]=!0}),be.meshPrimitiveTarget(i,function(r){be.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});const o=i.indices;l(o)&&(t[o]=!0)})}),be.skin(e,function(n){l(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),be.animation(e,function(n){be.animationSampler(n,function(i){l(i.input)&&(t[i.input]=!0),l(i.output)&&(t[i.output]=!0)})}),_s(e,"EXT_mesh_gpu_instancing")&&be.node(e,function(n){l(n.extensions)&&l(n.extensions.EXT_mesh_gpu_instancing)&&Object.keys(n.extensions.EXT_mesh_gpu_instancing.attributes).forEach(function(i){const o=n.extensions.EXT_mesh_gpu_instancing.attributes[i];t[o]=!0})}),t};Od.buffer=function(e){const t={};return be.bufferView(e,function(n){l(n.buffer)&&(t[n.buffer]=!0),l(n.extensions)&&l(n.extensions.EXT_meshopt_compression)&&(t[n.extensions.EXT_meshopt_compression.buffer]=!0)}),t};Od.bufferView=function(e){const t={};if(be.accessor(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),be.shader(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),be.image(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),_s(e,"KHR_draco_mesh_compression")&&be.mesh(e,function(n){be.meshPrimitive(n,function(i){l(i.extensions)&&l(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),_s(e,"EXT_feature_metadata")){const i=e.extensions.EXT_feature_metadata.featureTables;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(l(s)){for(const a in s)if(s.hasOwnProperty(a)){const c=s[a];l(c.bufferView)&&(t[c.bufferView]=!0),l(c.arrayOffsetBufferView)&&(t[c.arrayOffsetBufferView]=!0),l(c.stringOffsetBufferView)&&(t[c.stringOffsetBufferView]=!0)}}}}if(_s(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTables;if(l(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];l(u.values)&&(t[u.values]=!0),l(u.arrayOffsets)&&(t[u.arrayOffsets]=!0),l(u.stringOffsets)&&(t[u.stringOffsets]=!0)}}}}return t};Od.image=function(e){const t={};return be.texture(e,function(n){l(n.source)&&(t[n.source]=!0),l(n.extensions)&&l(n.extensions.EXT_texture_webp)?t[n.extensions.EXT_texture_webp.source]=!0:l(n.extensions)&&l(n.extensions.KHR_texture_basisu)&&(t[n.extensions.KHR_texture_basisu.source]=!0)}),t};Od.mesh=function(e){const t={};return be.node(e,function(n){if(l(n.mesh&&l(e.meshes))){const i=e.meshes[n.mesh];l(i)&&l(i.primitives)&&i.primitives.length>0&&(t[n.mesh]=!0)}}),t};function EK(e,t,n){const i=e.nodes[t];return l(i.mesh)||l(i.camera)||l(i.skin)||l(i.weights)||l(i.extras)||l(i.extensions)&&Object.keys(i.extensions).length!==0||l(n[t])?!1:!l(i.children)||i.children.filter(function(o){return!EK(e,o,n)}).length===0}Od.node=function(e){const t={};return be.skin(e,function(n){l(n.skeleton)&&(t[n.skeleton]=!0),be.skinJoint(n,function(i){t[i]=!0})}),be.animation(e,function(n){be.animationChannel(n,function(i){l(i.target)&&l(i.target.node)&&(t[i.target.node]=!0)})}),be.technique(e,function(n){be.techniqueUniform(n,function(i){l(i.node)&&(t[i.node]=!0)})}),be.node(e,function(n,i){EK(e,i,t)||(t[i]=!0)}),t};Od.material=function(e){const t={};return be.mesh(e,function(n){be.meshPrimitive(n,function(i){l(i.material)&&(t[i.material]=!0)})}),t};Od.texture=function(e){const t={};if(be.material(e,function(n){TK(n,function(i){t[i]=!0})}),_s(e,"EXT_feature_metadata")){be.mesh(e,function(o){be.meshPrimitive(o,function(r){const s=r.extensions;if(l(s)&&l(s.EXT_feature_metadata)){const c=s.EXT_feature_metadata.featureIdTextures;if(l(c)){const u=c.length;for(let d=0;d<u;++d){const m=c[d].featureIds.texture;t[m.index]=!0}}}})});const i=e.extensions.EXT_feature_metadata.featureTextures;for(const o in i)if(i.hasOwnProperty(o)){const s=i[o].properties;if(l(s)){for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].texture;t[u.index]=!0}}}}if(_s(e,"EXT_mesh_features")&&be.mesh(e,function(n){be.meshPrimitive(n,function(i){const o=i.extensions;if(l(o)&&l(o.EXT_mesh_features)){const s=o.EXT_mesh_features.featureIds;if(l(s)){const a=s.length;for(let c=0;c<a;++c){const u=s[c];l(u.texture)&&(t[u.texture.index]=!0)}}}})}),_s(e,"EXT_structural_metadata")){const i=e.extensions.EXT_structural_metadata.propertyTextures;if(l(i)){const o=i.length;for(let r=0;r<o;++r){const a=i[r].properties;for(const c in a)if(a.hasOwnProperty(c)){const u=a[c];t[u.index]=!0}}}}return t};Od.sampler=function(e){const t={};return be.texture(e,function(n){l(n.sampler)&&(t[n.sampler]=!0)}),t};function x8e(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:Jl(e.buffers,n),byteOffset:0,byteLength:t.length};return Jl(e.bufferViews,o)}function w8e(e,t){const n=H0(e,t),i=ee.getSizeInBytes(t.componentType),o=OT(t.type),r=t.count,s=new Array(o*r);if(!l(t.bufferView))return s.fill(0);const a=e.bufferViews[t.bufferView],c=e.buffers[a.buffer].extras._pipeline.source;let u=t.byteOffset+a.byteOffset+c.byteOffset;const d=new DataView(c.buffer),h=new Array(o),m=R2(t.componentType);for(let g=0;g<r;++g){m(d,u,o,i,h);for(let p=0;p<o;++p)s[g*o+p]=h[p];u+=n}return s}function S8e(e){let t;return be.accessorWithSemantic(e,"JOINTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===ae.BYTE?Ux(e,i,ee.UNSIGNED_BYTE):t!==ae.UNSIGNED_BYTE&&t!==ae.UNSIGNED_SHORT&&Ux(e,i,ee.UNSIGNED_SHORT)}),be.accessorWithSemantic(e,"WEIGHTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===ae.BYTE?Ux(e,i,ee.UNSIGNED_BYTE):t===ae.SHORT&&Ux(e,i,ee.UNSIGNED_SHORT)}),e}function Ux(e,t,n){const i=ee.createTypedArray(n,w8e(e,t)),o=new Uint8Array(i.buffer);t.bufferView=x8e(e,o),t.componentType=n,t.byteOffset=0}function fR(e,t){return bK(e,t),t==="CESIUM_RTC"&&v8e(e),hR(e,t)}function v8e(e){be.technique(e,function(t){be.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function hR(e,t){if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;++i)hR(e[i],t)}else if(e!==null&&typeof e=="object"&&e.constructor===Object){const n=e.extensions;let i;l(n)&&(i=n[t],l(i)&&(delete n[t],Object.keys(n).length===0&&delete e.extensions));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&hR(e[o],t);return i}}const Hx={.8:B8e,"1.0":e6e,"2.0":void 0};function D8e(e,t){t=A(t,A.EMPTY_OBJECT);const n=t.targetVersion;let i=e.version;e.asset=A(e.asset,{version:"1.0"}),e.asset.version=A(e.asset.version,"1.0"),i=A(i,e.asset.version).toString(),Object.prototype.hasOwnProperty.call(Hx,i)||(l(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(Hx,i)||(i="1.0"));let o=Hx[i];for(;l(o)&&i!==n;)o(e,t),i=e.asset.version,o=Hx[i];return t.keepLegacyExtensions||(i6e(e),o6e(e)),e}function xK(e){const t=e.materials;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.instanceTechnique;l(o)&&(i.technique=o.technique,i.values=o.values,delete i.instanceTechnique)}}function I8e(e){const t=e.meshes;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n].primitives;if(l(o)){const r=o.length;for(let s=0;s<r;++s){const a=o[s],c=A(a.primitive,ae.TRIANGLES);a.mode=A(a.mode,c),delete a.primitive}}}}function P8e(e){const t=e.nodes,n=new f,i=new Te;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o];if(l(r.rotation)){const a=r.rotation;f.fromArray(a,0,n),Te.fromAxisAngle(n,a[3],i),r.rotation=[i.x,i.y,i.z,i.w]}const s=r.instanceSkin;l(s)&&(r.skeletons=s.skeletons,r.skin=s.skin,r.meshes=s.meshes,delete r.instanceSkin)}}function O8e(e){const t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new f,a=new Te;for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const u=t[c],d=u.channels,h=u.parameters,m=u.samplers;if(l(d)){const g=d.length;for(let p=0;p<g;++p){const y=d[p];if(y.target.path==="rotation"){const b=h[m[y.sampler].output];if(l(r[b]))continue;r[b]=!0;const C=n[b],E=i[C.bufferView],S=o[E.buffer].extras._pipeline.source,P=S.byteOffset+E.byteOffset+C.byteOffset,L=C.componentType,z=C.count,R=OT(C.type),F=C.count*R,U=ee.createArrayBufferView(L,S.buffer,P,F);for(let D=0;D<z;D++){const I=D*R;f.unpack(U,I,s);const _=U[I+3];Te.fromAxisAngle(s,_,a),Te.pack(a,U,I)}}}}}}function L8e(e){const t=e.techniques;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.passes;if(l(o)){const r=A(i.pass,"defaultPass");if(Object.prototype.hasOwnProperty.call(o,r)){const s=o[r],a=s.instanceProgram;i.attributes=A(i.attributes,a.attributes),i.program=A(i.program,a.program),i.uniforms=A(i.uniforms,a.uniforms),i.states=A(i.states,s.states)}delete i.passes,delete i.pass}}}function B8e(e){l(e.asset)||(e.asset={});const t=e.asset;if(t.version="1.0",typeof t.profile=="string"){const n=t.profile.split(" ");t.profile={api:n[0],version:n[1]}}else t.profile={};if(l(e.version)&&delete e.version,xK(e),I8e(e),P8e(e),O8e(e),L8e(e),l(e.allExtensions)&&(e.extensionsUsed=e.allExtensions,delete e.allExtensions),l(e.lights)){const n=A(e.extensions,{});e.extensions=n;const i=A(n.KHR_materials_common,{});n.KHR_materials_common=i,i.lights=e.lights,delete e.lights,LT(e,"KHR_materials_common")}}function R8e(e){const t=e.animations;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n],o=i.parameters;if(l(o)){const r=i.samplers;for(const s in r)if(Object.prototype.hasOwnProperty.call(r,s)){const a=r[s];a.input=o[a.input],a.output=o[a.output]}delete i.parameters}}}function _5(e,t){const n=[];for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const o=e[i];t[i]=n.length,n.push(o),l(o.name)||(o.name=i)}return n}function N8e(e){let t;const n={accessors:{},animations:{},buffers:{},bufferViews:{},cameras:{},images:{},materials:{},meshes:{},nodes:{},programs:{},samplers:{},scenes:{},shaders:{},skins:{},textures:{},techniques:{}};let i;const o={},r=e.nodes;for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&(i=r[s].jointName,l(i)&&(o[i]=s));for(const s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&l(n[s])){const a={},c=e[s];e[s]=_5(c,a),n[s]=a}for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(o[i]=n.nodes[o[i]]);l(e.scene)&&(e.scene=n.scenes[e.scene]),be.bufferView(e,function(s){l(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),be.accessor(e,function(s){l(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),be.shader(e,function(s){const a=s.extensions;if(l(a)){const c=a.KHR_binary_glTF;l(c)&&(s.bufferView=n.bufferViews[c.bufferView],delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),be.program(e,function(s){l(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),l(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),be.technique(e,function(s){l(s.program)&&(s.program=n.programs[s.program]),be.techniqueParameter(s,function(a){l(a.node)&&(a.node=n.nodes[a.node]);const c=a.value;typeof c=="string"&&(a.value={index:n.textures[c]})})}),be.mesh(e,function(s){be.meshPrimitive(s,function(a){l(a.indices)&&(a.indices=n.accessors[a.indices]),be.meshPrimitiveAttribute(a,function(c,u){a.attributes[u]=n.accessors[c]}),l(a.material)&&(a.material=n.materials[a.material])})}),be.node(e,function(s){let a=s.children;if(l(a)){const c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}if(l(s.meshes)){const c=s.meshes,u=c.length;if(u>0)for(s.mesh=n.meshes[c[0]],t=1;t<u;++t){const d={mesh:n.meshes[c[t]]},h=Jl(e.nodes,d);l(a)||(a=[],s.children=a),a.push(h)}delete s.meshes}if(l(s.camera)&&(s.camera=n.cameras[s.camera]),l(s.skin)&&(s.skin=n.skins[s.skin]),l(s.skeletons)){const c=s.skeletons;if(c.length>0&&l(s.skin)){const d=e.skins[s.skin];d.skeleton=n.nodes[c[0]]}delete s.skeletons}l(s.jointName)&&delete s.jointName}),be.skin(e,function(s){l(s.inverseBindMatrices)&&(s.inverseBindMatrices=n.accessors[s.inverseBindMatrices]);const a=s.jointNames;if(l(a)){const c=[],u=a.length;for(t=0;t<u;++t)c[t]=o[a[t]];s.joints=c,delete s.jointNames}}),be.scene(e,function(s){const a=s.nodes;if(l(a)){const c=a.length;for(t=0;t<c;++t)a[t]=n.nodes[a[t]]}}),be.animation(e,function(s){const a={};s.samplers=_5(s.samplers,a),be.animationSampler(s,function(c){c.input=n.accessors[c.input],c.output=n.accessors[c.output]}),be.animationChannel(s,function(c){c.sampler=a[c.sampler];const u=c.target;l(u)&&(u.node=n.nodes[u.id],delete u.id)})}),be.material(e,function(s){l(s.technique)&&(s.technique=n.techniques[s.technique]),be.materialValue(s,function(c,u){typeof c=="string"&&(s.values[u]={index:n.textures[c]})});const a=s.extensions;if(l(a)){const c=a.KHR_materials_common;l(c)&&l(c.values)&&be.materialValue(c,function(u,d){typeof u=="string"&&(c.values[d]={index:n.textures[u]})})}}),be.image(e,function(s){const a=s.extensions;if(l(a)){const c=a.KHR_binary_glTF;l(c)&&(s.bufferView=n.bufferViews[c.bufferView],s.mimeType=c.mimeType,delete a.KHR_binary_glTF),Object.keys(a).length===0&&delete s.extensions}}),be.texture(e,function(s){l(s.sampler)&&(s.sampler=n.samplers[s.sampler]),l(s.source)&&(s.source=n.images[s.source])})}function M8e(e){be.animation(e,function(t){be.animationSampler(t,function(n){delete n.name})})}function F8e(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const n=e[t];Array.isArray(n)&&n.length===0&&delete e[t]}be.node(e,function(t){l(t.children)&&t.children.length===0&&delete t.children})}function z8e(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const U8e={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function H8e(e){const t=e.extensionsUsed;if(e.extensionsRequired=A(e.extensionsRequired,[]),l(t)){const n=t.length;for(let i=0;i<n;++i){const o=t[i];l(U8e[o])&&e.extensionsRequired.push(o)}}}function V8e(e){be.buffer(e,function(t){delete t.type})}function k8e(e){be.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function G8e(e){be.mesh(e,function(t){be.meshPrimitive(t,function(n){be.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})}),be.technique(e,function(t){be.techniqueParameter(t,function(n){const i=n.semantic;l(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}const W8e={POSITION:!0,NORMAL:!0,TANGENT:!0},j8e={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function q8e(e){const t={};be.mesh(e,function(n){be.meshPrimitive(n,function(i){be.meshPrimitiveAttribute(i,function(o,r){if(r.charAt(0)!=="_"){const s=r.search(/_[0-9]+/g);let a=r,c="_0";s>=0&&(a=r.substring(0,s),c=r.substring(s));let u;const d=j8e[a];l(d)?(u=d+c,t[r]=u):l(W8e[a])||(u=`_${r}`,t[r]=u)}});for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o],s=i.attributes[o];l(s)&&(delete i.attributes[o],i.attributes[r]=s)}})}),be.technique(e,function(n){be.techniqueParameter(n,function(i){const o=t[i.semantic];l(o)&&(i.semantic=o)})})}function $8e(e){be.camera(e,function(t){const n=t.perspective;if(l(n)){const i=n.aspectRatio;l(i)&&i===0&&delete n.aspectRatio;const o=n.yfov;l(o)&&o===0&&(n.yfov=1)}})}function pR(e,t){return l(t.byteStride)&&t.byteStride!==0?t.byteStride:H0(e,t)}function Y8e(e){be.buffer(e,function(t){l(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),be.accessor(e,function(t){const n=t.bufferView;if(l(n)){const i=e.bufferViews[n],o=pR(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(A(i.byteLength,0),r)}})}function X8e(e){let t,n,i;const o=e.bufferViews,r={};be.accessorContainingVertexAttributeData(e,function(a){const c=e.accessors[a];l(c.bufferView)&&(r[c.bufferView]=!0)});const s={};be.accessor(e,function(a){l(a.bufferView)&&(s[a.bufferView]=A(s[a.bufferView],[]),s[a.bufferView].push(a))});for(const a in s)if(Object.prototype.hasOwnProperty.call(s,a)){i=o[a];const c=s[a];c.sort(function(m,g){return m.byteOffset-g.byteOffset});let u=0,d=0;const h=c.length;for(t=0;t<h;++t){let m=c[t];const g=pR(e,m),p=m.byteOffset,y=m.count*g;delete m.byteStride;const b=t<h-1,C=b?pR(e,c[t+1]):void 0;if(g!==C){const E=ht(i,!0);r[a]&&(E.byteStride=g),E.byteOffset+=u,E.byteLength=p+y-u;const w=Jl(o,E);for(n=d;n<=t;++n)m=c[n],m.bufferView=w,m.byteOffset=m.byteOffset-u;u=b?c[t+1].byteOffset:void 0,d=t+1}}}C8e(e,["accessor","bufferView","buffer"])}function K8e(e){be.accessorWithSemantic(e,"POSITION",function(t){const n=e.accessors[t];if(!l(n.min)||!l(n.max)){const i=N2(e,n);n.min=i.min,n.max=i.max}})}function wK(e){return(!l(e.children)||e.children.length===0)&&(!l(e.meshes)||e.meshes.length===0)&&!l(e.camera)&&!l(e.skin)&&!l(e.skeletons)&&!l(e.jointName)&&(!l(e.translation)||f.fromArray(e.translation).equals(f.ZERO))&&(!l(e.scale)||f.fromArray(e.scale).equals(new f(1,1,1)))&&(!l(e.rotation)||oe.fromArray(e.rotation).equals(new oe(0,0,0,1)))&&(!l(e.matrix)||B.fromColumnMajorArray(e.matrix).equals(B.IDENTITY))&&!l(e.extensions)&&!l(e.extras)}function SK(e,t){be.scene(e,function(n){const i=n.nodes;if(l(i)){const o=i.length;for(let r=o;r>=0;--r)if(i[r]===t){i.splice(r,1);return}}}),be.node(e,function(n,i){if(l(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),wK(n)&&SK(e,i))}}),delete e.nodes[t]}function J8e(e){return be.node(e,function(t,n){wK(t)&&SK(e,n)}),e}function Q8e(e){be.animation(e,function(t){be.animationSampler(t,function(n){const i=e.accessors[n.input];if(!l(i.min)||!l(i.max)){const o=N2(e,i);i.min=o.min,i.max=o.max}})})}function Z8e(e){be.accessor(e,function(t){if(l(t.min)||l(t.max)){const n=N2(e,t);l(t.min)&&(t.min=n.min),l(t.max)&&(t.max=n.max)}})}function e6e(e){e.asset=A(e.asset,{}),e.asset.version="2.0",xK(e),R8e(e),J8e(e),N8e(e),M8e(e),z8e(e),H8e(e),Y8e(e),X8e(e),K8e(e),Q8e(e),Z8e(e),V8e(e),k8e(e),G8e(e),q8e(e),S8e(e),$8e(e),y8e(e),b8e(e),F8e(e)}const t6e=["u_tex","u_diffuse","u_emission"],n6e=["u_diffuse"];function mR(e){e.pbrMetallicRoughness=l(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function rS(e){return l(e.index)}function sS(e){return Array.isArray(e)&&e.length===4}function vK(e){const t=new Array(4);t[3]=e[3];for(let n=0;n<3;n++){const i=e[n];i<=.04045?t[n]=e[n]*.07739938080495357:t[n]=Math.pow((i+.055)*.9478672985781991,2.4)}return t}function i6e(e){be.material(e,function(t){be.materialValue(t,function(n,i){t6e.indexOf(i)!==-1&&rS(n)?(mR(t),t.pbrMetallicRoughness.baseColorTexture=n):n6e.indexOf(i)!==-1&&sS(n)&&(mR(t),t.pbrMetallicRoughness.baseColorFactor=vK(n))})}),fR(e,"KHR_techniques_webgl"),fR(e,"KHR_blend")}function o6e(e){be.material(e,function(t){const n=A(t.extensions,A.EMPTY_OBJECT).KHR_materials_common;if(l(n)){n.technique==="CONSTANT"&&(LT(e,"KHR_materials_unlit"),t.extensions=l(t.extensions)?t.extensions:{},t.extensions.KHR_materials_unlit={});const o=l(n.values)?n.values:{},r=o.ambient,s=o.diffuse,a=o.emission,c=o.transparency,u=n.doubleSided,d=n.transparent;mR(t),l(r)&&(sS(r)?t.emissiveFactor=r.slice(0,3):rS(r)&&(t.emissiveTexture=r)),l(s)&&(sS(s)?t.pbrMetallicRoughness.baseColorFactor=vK(s):rS(s)&&(t.pbrMetallicRoughness.baseColorTexture=s)),l(u)&&(t.doubleSided=u),l(a)&&(sS(a)?t.emissiveFactor=a.slice(0,3):rS(a)&&(t.emissiveTexture=a)),l(c)&&(l(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=c:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,c]),l(d)&&(t.alphaMode=d?"BLEND":"OPAQUE")}}),fR(e,"KHR_materials_common")}function Cf(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltfResource,i=e.baseResource,o=e.typedArray,r=e.gltfJson,s=e.cacheKey;T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),this._resourceCache=t,this._gltfResource=n,this._baseResource=i,this._typedArray=o,this._gltfJson=r,this._cacheKey=s,this._gltf=void 0,this._bufferLoaders=[],this._state=Ft.UNLOADED,this._promise=void 0}l(Object.create)&&(Cf.prototype=Object.create(mr.prototype),Cf.prototype.constructor=Cf);Object.defineProperties(Cf.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});Cf.prototype.load=function(){this._state=Ft.LOADING;let e;l(this._gltfJson)?e=DK(this,this._gltfJson):l(this._typedArray)?e=IK(this,this._typedArray):e=r6e(this);const t=this;return this._promise=e.then(function(n){if(!t.isDestroyed())return t._gltf=n,t._state=Ft.READY,t}).catch(function(n){if(!t.isDestroyed())return s6e(t,n)}),this._promise};function r6e(e){return e._fetchGltf().then(function(t){if(e.isDestroyed())return;const n=new Uint8Array(t);return IK(e,n)})}function s6e(e,t){e.unload(),e._state=Ft.FAILED;const n=`Failed to load glTF: ${e._gltfResource.url}`;return Promise.reject(e.getError(n,t))}function a6e(e,t){if(l(t.asset)&&t.asset.version==="2.0"&&!_s(t,"KHR_techniques_webgl")&&!_s(t,"KHR_materials_common"))return Promise.resolve();const n=[];return be.buffer(t,function(i){if(!l(i.extras._pipeline.source)&&l(i.uri)){const 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(){D8e(t)})}function c6e(e){const t=[];return be.buffer(e,function(n){const i=n.uri;!l(n.extras._pipeline.source)&&l(i)&&aM(i)&&(delete n.uri,t.push(Me.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function l6e(e,t){const n=[];return be.buffer(t,function(i,o){const r=i.extras._pipeline.source;if(l(r)&&!l(i.uri)){const a=e._resourceCache.loadEmbeddedBuffer({parentResource:e._gltfResource,bufferId:o,typedArray:r});e._bufferLoaders.push(a),n.push(a.promise)}}),Promise.all(n)}function DK(e,t){return B2(t),c6e(t).then(function(){return a6e(e,t)}).then(function(){return s8e(t),l6e(e,t)}).then(function(){return h8e(t),t})}function IK(e,t){let n;return ND(t)==="glTF"?n=u8e(t):n=Ya(t),DK(e,n)}Cf.prototype.unload=function(){const 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};Cf.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const u6e={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},dv=Object.freeze(u6e),yo={};function d6e(){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 f6e(){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 h6e(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function p6e(){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 m6e(){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 _6e(){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 g6e(){this.attributes=[]}function y6e(){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 A6e(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function b6e(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function C6e(){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 T6e(){this.nodes=[]}const E6e={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function x6e(){this.input=[],this.interpolation=void 0,this.output=[]}function w6e(){this.node=void 0,this.path=void 0}function S6e(){this.sampler=void 0,this.target=void 0}function v6e(){this.name=void 0,this.samplers=[],this.channels=[]}function D6e(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function I6e(){this.name=void 0,this.stages=[]}function PK(){this.credits=[]}function P6e(){this.asset=new PK,this.scene=void 0,this.nodes=[],this.skins=[],this.animations=[],this.articulations=[],this.structuralMetadata=void 0,this.upAxis=void 0,this.forwardAxis=void 0,this.transform=B.clone(B.IDENTITY)}function O6e(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=J.clone(J.IDENTITY),this.channels=void 0}function pp(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=oe.clone(pp.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=pp.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=pp.DEFAULT_ROUGHNESS_FACTOR}pp.DEFAULT_BASE_COLOR_FACTOR=oe.ONE;pp.DEFAULT_METALLIC_FACTOR=1;pp.DEFAULT_ROUGHNESS_FACTOR=1;function g_(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=oe.clone(g_.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=f.clone(g_.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=g_.DEFAULT_GLOSSINESS_FACTOR}g_.DEFAULT_DIFFUSE_FACTOR=oe.ONE;g_.DEFAULT_SPECULAR_FACTOR=f.ONE;g_.DEFAULT_GLOSSINESS_FACTOR=1;function M2(){this.metallicRoughness=new pp,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=f.clone(M2.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=dv.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}M2.DEFAULT_EMISSIVE_FACTOR=f.ZERO;yo.Quantization=d6e;yo.Attribute=f6e;yo.Indices=h6e;yo.FeatureIdAttribute=p6e;yo.FeatureIdTexture=_6e;yo.FeatureIdImplicitRange=m6e;yo.MorphTarget=g6e;yo.Primitive=y6e;yo.Instances=A6e;yo.Skin=b6e;yo.Node=C6e;yo.Scene=T6e;yo.AnimatedPropertyType=Object.freeze(E6e);yo.AnimationSampler=x6e;yo.AnimationTarget=w6e;yo.AnimationChannel=S6e;yo.Animation=v6e;yo.ArticulationStage=D6e;yo.Articulation=I6e;yo.Asset=PK;yo.Components=P6e;yo.TextureReader=O6e;yo.MetallicRoughness=pp;yo.SpecularGlossiness=g_;yo.Material=M2;const Ot=yo,HD={};HD.getImageIdFromTexture=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureId,i=e.supportedImageFormats;T.typeOf.object("options.gltf",t),T.typeOf.number("options.textureId",n),T.typeOf.object("options.supportedImageFormats",i);const o=t.textures[n],r=o.extensions;if(l(r)){if(i.webp&&l(r.EXT_texture_webp))return r.EXT_texture_webp.source;if(i.basis&&l(r.KHR_texture_basisu))return r.KHR_texture_basisu.source}return o.source};HD.createSampler=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=A(e.compressedTextureNoMipmap,!1);T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n);let o=Fi.REPEAT,r=Fi.REPEAT,s=In.LINEAR,a=Kr.LINEAR;const c=n.index,d=t.textures[c].sampler;if(l(d)){const g=t.samplers[d];o=A(g.wrapS,o),r=A(g.wrapT,r),s=A(g.minFilter,s),a=A(g.magFilter,a)}let h=!1;const m=n.extensions;return l(m)&&l(m.KHR_texture_transform)&&(h=!0),(i||h)&&s!==In.LINEAR&&s!==In.NEAREST&&(s===In.NEAREST_MIPMAP_NEAREST||s===In.NEAREST_MIPMAP_LINEAR?s=In.NEAREST:s=In.LINEAR),new ii({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};const L6e=new j(1,1);HD.createModelTextureReader=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.textureInfo,n=e.channels,i=e.texture;T.typeOf.object("options.textureInfo",t);let o=A(t.texCoord,0),r;const s=A(t.extensions,A.EMPTY_OBJECT).KHR_texture_transform;if(l(s)){o=A(s.texCoord,o);const c=l(s.offset)?j.unpack(s.offset):j.ZERO;let u=A(s.rotation,0);const d=l(s.scale)?j.unpack(s.scale):L6e;u=-u,r=new J(Math.cos(u)*d.x,-Math.sin(u)*d.y,c.x,Math.sin(u)*d.x,Math.cos(u)*d.y,c.y,0,0,1)}const a=new Ot.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.transform=r,a.channels=n,a};const L_=HD;function _R(e){const t=document.createElement("canvas");return t.width=M.nextPowerOfTwo(e.width),t.height=M.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function Tf(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.textureInfo,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.cacheKey,c=A(e.asynchronous,!0);T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.textureInfo",i),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),T.typeOf.object("options.supportedImageFormats",s);const u=i.index,d=L_.getImageIdFromTexture({gltf:n,textureId:u,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=d,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=Ft.UNLOADED,this._promise=void 0,this._process=function(h,m){}}l(Object.create)&&(Tf.prototype=Object.create(mr.prototype),Tf.prototype.constructor=Tf);Object.defineProperties(Tf.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});const B6e=new F2;Tf.prototype.load=function(){const t=this._resourceCache.loadImage({gltf:this._gltf,imageId:this._imageId,gltfResource:this._gltfResource,baseResource:this._baseResource});this._imageLoader=t,this._state=Ft.LOADING;const n=this,i=new Promise(function(o){n._process=function(r,s){if(l(r._texture)||!l(r._image))return;let a;if(r._asynchronous){const c=B6e;if(c.set(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context),!s.jobScheduler.execute(c,Gl.TEXTURE))return;a=c.texture}else a=OK(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context);r.unload(),r._texture=a,r._state=Ft.READY,o(r)}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._image=t.image,n._mipLevels=t.mipLevels,n._state=Ft.PROCESSING,i}).catch(function(o){if(n.isDestroyed())return;n.unload(),n._state=Ft.FAILED;const r="Failed to load texture";return Promise.reject(n.getError(r,o))}),this._promise};function F2(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}F2.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o};F2.prototype.execute=function(){this.texture=OK(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};function OK(e,t,n,i,o){const r=n.internalFormat;let s=!1;rt.isCompressedFormat(r)&&!l(i)&&(s=!0);const a=L_.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),c=a.minificationFilter,u=a.wrapS,d=a.wrapT,h=c===In.NEAREST_MIPMAP_NEAREST||c===In.NEAREST_MIPMAP_LINEAR||c===In.LINEAR_MIPMAP_NEAREST||c===In.LINEAR_MIPMAP_LINEAR,m=!l(r)&&h,g=m||u===Fi.REPEAT||u===Fi.MIRRORED_REPEAT||d===Fi.REPEAT||d===Fi.MIRRORED_REPEAT,p=!M.isPowerOfTwo(n.width)||!M.isPowerOfTwo(n.height),y=g&&p;let b;return l(r)?(!o.webgl2&&rt.isCompressedFormat(r)&&p&&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."),b=Wt.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(y&&(n=_R(n)),b=Wt.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),m&&b.generateMipmap(),b}Tf.prototype.process=function(e){return T.typeOf.object("frameState",e),this._process(this,e)};Tf.prototype.unload=function(){l(this._texture)&&this._texture.destroy(),l(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};function Ef(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceCache,n=e.gltf,i=e.gltfResource,o=e.baseResource,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,u=e.cacheKey,d=A(e.asynchronous,!0),h=A(e.loadBuffer,!1),m=A(e.loadTypedArray,!1);if(T.typeOf.func("options.resourceCache",t),T.typeOf.object("options.gltf",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),!h&&!m)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=LK(s,a),y=l(a),b=l(c);if(g===p)throw new x("One of options.bufferViewId and options.draco must be defined.");if(p&&!y)throw new x("When options.draco is defined options.attributeSemantic must also be defined.");if(p&&!b)throw new x("When options.draco is defined options.accessorId must also be defined.");p&&(T.typeOf.object("options.draco",s),T.typeOf.string("options.attributeSemantic",a),T.typeOf.number("options.accessorId",c)),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=u,this._asynchronous=d,this._loadBuffer=h,this._loadTypedArray=m,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Ft.UNLOADED,this._promise=void 0,this._process=function(C,E){}}l(Object.create)&&(Ef.prototype=Object.create(mr.prototype),Ef.prototype.constructor=Ef);Object.defineProperties(Ef.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 LK(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}Ef.prototype.load=function(){let e;LK(this._draco,this._attributeSemantic)?e=N6e(this):e=M6e(this);const t=this,n=new z2,i=new Promise(function(o){t._process=function(r,s){if(r._state===Ft.READY)return;const a=r._typedArray;if(l(r._dracoLoader)&&r._dracoLoader.process(s),l(r._bufferViewLoader)&&r._bufferViewLoader.process(s),!l(a))return;let c;if(r._loadBuffer&&r._asynchronous){const u=n;if(u.set(a,s.context),!s.jobScheduler.execute(u,Gl.BUFFER))return;c=u.buffer}else r._loadBuffer&&(c=BK(a,s.context));r.unload(),r._buffer=c,r._typedArray=r._loadTypedArray?a:void 0,r._state=Ft.READY,o(r)}});return this._promise=e.then(function(){if(!t.isDestroyed())return i}).catch(function(o){if(!t.isDestroyed())return F6e(t,o)}),this._promise};function R6e(e,t,n,i){const r=(1<<e.quantizationBits)-1,s=1/r,a=new Ot.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=_n.VEC2,a.normalizationRange=r;else{const c=_n.getMathType(i);if(c===Number){const u=e.range;a.quantizedVolumeOffset=e.minValues[0],a.quantizedVolumeDimensions=u,a.normalizationRange=r,a.quantizedVolumeStepSize=u*s}else{a.quantizedVolumeOffset=c.unpack(e.minValues),a.normalizationRange=c.unpack(new Array(n).fill(r));const u=new Array(n).fill(e.range);a.quantizedVolumeDimensions=c.unpack(u);const d=u.map(function(h){return h*s});a.quantizedVolumeStepSize=c.unpack(d)}}return a}function N6e(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Ft.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.decodedData.vertexAttributes,o=e._attributeSemantic,r=i[o],s=e._accessorId,c=e._gltf.accessors[s].type,u=r.array,d=r.data.quantization;return l(d)&&(e._quantization=R6e(d,r.data.componentDatatype,r.data.componentsPerAttribute,c)),e._typedArray=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),e._state=Ft.PROCESSING,e})}function M6e(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Ft.LOADING,e._bufferViewLoader=n,n.promise.then(function(){if(!e.isDestroyed())return e._typedArray=n.typedArray,e._state=Ft.PROCESSING,e})}function F6e(e,t){e.unload(),e._state=Ft.FAILED;const n="Failed to load vertex buffer";return t=e.getError(n,t),Promise.reject(t)}function z2(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}z2.prototype.set=function(e,t){this.typedArray=e,this.context=t};z2.prototype.execute=function(){this.buffer=BK(this.typedArray,this.context)};function BK(e,t){const n=Tt.createVertexBuffer({typedArray:e,context:t,usage:nt.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}Ef.prototype.process=function(e){return T.typeOf.object("frameState",e),this._process(this,e)};Ef.prototype.unload=function(){l(this._buffer)&&this._buffer.destroy();const e=this._resourceCache;l(this._bufferViewLoader)&&e.unload(this._bufferViewLoader),l(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};function Bp(e){e=A(e,A.EMPTY_OBJECT);const t=e.id;T.typeOf.string("options.id",t);const n=A(e.properties,{}),i={};for(const o in n)if(n.hasOwnProperty(o)){const r=n[o];l(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=ht(e.extras,!0),this._extensions=ht(e.extensions,!0)}Bp.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.class;T.typeOf.string("options.id",t),T.typeOf.object("options.class",n);const i={};for(const o in n.properties)if(n.properties.hasOwnProperty(o)){const r=Jr.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new Bp({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(Bp.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}}});Bp.BATCH_TABLE_CLASS_NAME="_batchTable";function fv(e){e=A(e,A.EMPTY_OBJECT);const t=e.value,n=e.name;T.typeOf.number("options.value",t),T.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=ht(e.extras,!0),this._extensions=ht(e.extensions,!0)}fv.fromJson=function(e){return T.typeOf.object("value",e),new fv({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(fv.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}}});function hv(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.values;T.typeOf.string("options.id",t),T.defined("options.values",n);const i={},o={},r=n.length;for(let a=0;a<r;++a){const c=n[a];i[c.value]=c.name,o[c.name]=c.value}const s=A(e.valueType,$t.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=ht(e.extras,!0),this._extensions=ht(e.extensions,!0)}hv.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.enum;T.typeOf.string("options.id",t),T.typeOf.object("options.enum",n);const i=n.values.map(function(o){return fv.fromJson(o)});return new hv({id:t,values:i,valueType:$t[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(hv.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}}});function Rp(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.classes,{}),n=A(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=ht(e.extras,!0),this._extensions=ht(e.extensions,!0)}Rp.fromJson=function(e){T.typeOf.object("schema",e);const t={};if(l(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=hv.fromJson({id:i,enum:e.enums[i]}));const n={};if(l(e.classes))for(const i in e.classes)e.classes.hasOwnProperty(i)&&(n[i]=Bp.fromJson({id:i,class:e.classes[i],enums:t}));return new Rp({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(Rp.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}}});function mp(e){e=A(e,A.EMPTY_OBJECT);const t=e.schema,n=e.resource,i=e.cacheKey;if(l(t)===l(n))throw new x("One of options.schema and options.resource must be defined.");this._schema=l(t)?Rp.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=Ft.UNLOADED,this._promise=void 0}l(Object.create)&&(mp.prototype=Object.create(mr.prototype),mp.prototype.constructor=mp);Object.defineProperties(mp.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});mp.prototype.load=function(){return l(this._schema)?this._promise=Promise.resolve(this):this._promise=z6e(this),this._promise};function z6e(e){const t=e._resource;return e._state=Ft.LOADING,t.fetchJson().then(function(n){if(!e.isDestroyed())return e._schema=Rp.fromJson(n),e._state=Ft.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Ft.FAILED;const i=`Failed to load schema: ${t.url}`;return Promise.reject(e.getError(i,n))})}mp.prototype.unload=function(){this._schema=void 0};const Su={};function BT(e){return dT(e.url)}function VD(e){let t=e.byteOffset,n=e.byteLength;if(hr(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=A(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function U6e(e,t){const n=t.byteOffset+e.byteOffset,i=e.componentType,o=e.type,r=e.count;return`${n}-${i}-${o}-${r}`}function RK(e){return BT(e)}function NK(e,t){return`${BT(e)}-buffer-id-${t}`}function RT(e,t,n,i){if(l(e.uri)){const o=i.getDerivedResource({url:e.uri});return RK(o)}return NK(n,t)}function U2(e,t,n,i){const o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],c=RT(a,s,n,i),u=VD(r);return`${c}-range-${u}`}function MK(e,t,n,i){const o=e.images[t],r=o.bufferView,s=o.uri;if(l(s)){const m=i.getDerivedResource({url:s});return BT(m)}const a=e.bufferViews[r],c=a.buffer,u=e.buffers[c],d=RT(u,c,n,i),h=VD(a);return`${d}-range-${h}`}function H6e(e,t){const n=L_.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}Su.getSchemaCacheKey=function(e){const t=e.schema,n=e.resource;if(l(t)===l(n))throw new x("One of options.schema and options.resource must be defined.");return l(t)?`embedded-schema:${JSON.stringify(t)}`:`external-schema:${BT(n)}`};Su.getExternalBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;return T.typeOf.object("options.resource",t),`external-buffer:${RK(t)}`};Su.getEmbeddedBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId;return T.typeOf.object("options.parentResource",t),T.typeOf.number("options.bufferId",n),`embedded-buffer:${NK(t,n)}`};Su.getGltfCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource;return T.typeOf.object("options.gltfResource",t),`gltf:${BT(t)}`};Su.getBufferViewCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;T.typeOf.object("options.gltf",t),T.typeOf.number("options.bufferViewId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);const r=t.bufferViews[n];let s=r.buffer;const a=t.buffers[s];hr(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);const c=RT(a,s,i,o),u=VD(r);return`buffer-view:${c}-range-${u}`};Su.getDracoCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return T.typeOf.object("options.gltf",t),T.typeOf.object("options.draco",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),`draco:${U2(t,n,i,o)}`};Su.getVertexBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=A(e.dequantize,!1),u=A(e.loadBuffer,!1),d=A(e.loadTypedArray,!1);T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),T.typeOf.object("options.frameState",o);const h=l(r),m=V6e(s,a),g=l(a);if(h===m)throw new x("One of options.bufferViewId and options.draco must be defined.");if(m&&!g)throw new x("When options.draco is defined options.attributeSemantic must also be defined.");if(m&&(T.typeOf.object("options.draco",s),T.typeOf.string("options.attributeSemantic",a)),!u&&!d)throw new x("At least one of loadBuffer and loadTypedArray must be true.");let p="";if(c&&(p+="-dequantize"),u&&(p+="-buffer",p+=`-context-${o.context.id}`),d&&(p+="-typed-array"),l(s))return`vertex-buffer:${U2(t,s,n,i)}-draco-${a}${p}`;const y=t.bufferViews[r],b=y.buffer,C=t.buffers[b],E=RT(C,b,n,i),w=VD(y);return`vertex-buffer:${E}-range-${w}${p}`};function V6e(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}Su.getIndexBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=A(e.loadBuffer,!1),c=A(e.loadTypedArray,!1);if(T.typeOf.object("options.gltf",t),T.typeOf.number("options.accessorId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.frameState",r),!a&&!c)throw new x("At least one of loadBuffer and loadTypedArray must be true.");let u="";if(a&&(u+="-buffer",u+=`-context-${r.context.id}`),c&&(u+="-typed-array"),l(s))return`index-buffer:${U2(t,s,i,o)}-draco${u}`;const d=t.accessors[n],h=d.bufferView,m=t.bufferViews[h],g=m.buffer,p=t.buffers[g],y=RT(p,g,i,o),b=U6e(d,m);return`index-buffer:${y}-accessor-${b}${u}`};Su.getImageCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;return T.typeOf.object("options.gltf",t),T.typeOf.number("options.imageId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),`image:${MK(t,n,i,o)}`};Su.getTextureCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState;T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.supportedImageFormats",r),T.typeOf.object("options.frameState",s);const a=n.index,c=L_.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),u=MK(t,c,i,o),d=H6e(t,n);return`texture:${u}-sampler-${d}-context-${s.context.id}`};const Ld=Su;function NT(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}NT.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};NT.prototype.addGeometryLoader=function(e){T.typeOf.object("loader",e);const t=e.cacheKey;if(this._geometrySizes.hasOwnProperty(t))return;this._geometrySizes[t]=0;const n=this;return e.promise.then(function(i){if(!n._geometrySizes.hasOwnProperty(t))return;const o=i.buffer,r=i.typedArray;let s=0;l(o)&&(s+=o.sizeInBytes),l(r)&&(s+=r.byteLength),n.geometryByteLength+=s,n._geometrySizes[t]=s}).catch(function(){delete n._geometrySizes[t]})};NT.prototype.addTextureLoader=function(e){T.typeOf.object("loader",e);const t=e.cacheKey;if(this._textureSizes.hasOwnProperty(t))return;this._textureSizes[t]=0;const n=this;return e.promise.then(function(i){if(!n._textureSizes.hasOwnProperty(t))return;const o=i.texture.sizeInBytes;n.texturesByteLength+=i.texture.sizeInBytes,n._textureSizes[t]=o}).catch(function(){delete n._textureSizes[t]})};NT.prototype.removeLoader=function(e){T.typeOf.object("loader",e);const t=e.cacheKey,n=this._geometrySizes[t];delete this._geometrySizes[t],l(n)&&(this.geometryByteLength-=n);const i=this._textureSizes[t];delete this._textureSizes[t],l(i)&&(this.texturesByteLength-=i)};function yt(){}yt.cacheEntries={};yt.statistics=new NT;function k6e(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}yt.get=function(e){T.typeOf.string("cacheKey",e);const t=yt.cacheEntries[e];if(l(t))return++t.referenceCount,t.resourceLoader};yt.load=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceLoader;T.typeOf.object("options.resourceLoader",t);const n=t.cacheKey;if(T.typeOf.string("options.resourceLoader.cacheKey",n),l(yt.cacheEntries[n]))throw new x(`Resource with this cacheKey is already in the cache: ${n}`);yt.cacheEntries[n]=new k6e(t),t.load()};yt.unload=function(e){T.typeOf.object("resourceLoader",e);const t=e.cacheKey,n=yt.cacheEntries[t];if(!l(n))throw new x(`Resource is not in the cache: ${t}`);--n.referenceCount,n.referenceCount===0&&(yt.statistics.removeLoader(e),e.destroy(),delete yt.cacheEntries[t])};yt.loadSchema=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.schema,n=e.resource;if(l(t)===l(n))throw new x("One of options.schema and options.resource must be defined.");const i=Ld.getSchemaCacheKey({schema:t,resource:n});let o=yt.get(i);return l(o)||(o=new mp({schema:t,resource:n,cacheKey:i}),yt.load({resourceLoader:o})),o};yt.loadEmbeddedBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId,i=e.typedArray;T.typeOf.object("options.parentResource",t),T.typeOf.number("options.bufferId",n);const o=Ld.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let r=yt.get(o);return l(r)||(T.typeOf.object("options.typedArray",i),r=new iu({typedArray:i,cacheKey:o}),yt.load({resourceLoader:r})),r};yt.loadExternalBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;T.typeOf.object("options.resource",t);const n=Ld.getExternalBufferCacheKey({resource:t});let i=yt.get(n);return l(i)||(i=new iu({resource:t,cacheKey:n}),yt.load({resourceLoader:i})),i};yt.loadGltfJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson;T.typeOf.object("options.gltfResource",t),T.typeOf.object("options.baseResource",n);const r=Ld.getGltfCacheKey({gltfResource:t});let s=yt.get(r);return l(s)||(s=new Cf({resourceCache:yt,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),yt.load({resourceLoader:s})),s};yt.loadBufferView=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;T.typeOf.object("options.gltf",t),T.typeOf.number("options.bufferViewId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);const r=Ld.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o});let s=yt.get(r);return l(s)||(s=new yf({resourceCache:yt,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),yt.load({resourceLoader:s})),s};yt.loadDraco=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;T.typeOf.object("options.gltf",t),T.typeOf.object("options.draco",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);const r=Ld.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o});let s=yt.get(r);return l(s)||(s=new Af({resourceCache:yt,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),yt.load({resourceLoader:s})),s};yt.loadVertexBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.gltfResource,i=e.baseResource,o=e.frameState,r=e.bufferViewId,s=e.draco,a=e.attributeSemantic,c=e.accessorId,u=A(e.asynchronous,!0),d=A(e.dequantize,!1),h=A(e.loadBuffer,!1),m=A(e.loadTypedArray,!1);if(T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",n),T.typeOf.object("options.baseResource",i),T.typeOf.object("options.frameState",o),!h&&!m)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=G6e(s,a),y=l(a),b=l(c);if(g===p)throw new x("One of options.bufferViewId and options.draco must be defined.");if(p&&!y)throw new x("When options.draco is defined options.attributeSemantic must also be defined.");if(p&&!b)throw new x("When options.draco is defined options.haAccessorId must also be defined.");p&&(T.typeOf.object("options.draco",s),T.typeOf.string("options.attributeSemantic",a),T.typeOf.number("options.accessorId",c));const C=Ld.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:d,loadBuffer:h,loadTypedArray:m});let E=yt.get(C);if(l(E))return E;E=new Ef({resourceCache:yt,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:c,cacheKey:C,asynchronous:u,dequantize:d,loadBuffer:h,loadTypedArray:m}),yt.load({resourceLoader:E});const w=yt.statistics.addGeometryLoader(E);return yt.cacheEntries[C]._statisticsPromise=w,E};function G6e(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}yt.loadIndexBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.accessorId,i=e.gltfResource,o=e.baseResource,r=e.frameState,s=e.draco,a=A(e.asynchronous,!0),c=A(e.loadBuffer,!1),u=A(e.loadTypedArray,!1);if(T.typeOf.object("options.gltf",t),T.typeOf.number("options.accessorId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.frameState",r),!c&&!u)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const d=Ld.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:c,loadTypedArray:u});let h=yt.get(d);if(l(h))return h;h=new bf({resourceCache:yt,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:d,asynchronous:a,loadBuffer:c,loadTypedArray:u}),yt.load({resourceLoader:h});const m=yt.statistics.addGeometryLoader(h);return yt.cacheEntries[d]._statisticsPromise=m,h};yt.loadImage=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;T.typeOf.object("options.gltf",t),T.typeOf.number("options.imageId",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o);const r=Ld.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o});let s=yt.get(r);return l(s)||(s=new rd({resourceCache:yt,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),yt.load({resourceLoader:s})),s};yt.loadTexture=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=e.gltfResource,o=e.baseResource,r=e.supportedImageFormats,s=e.frameState,a=A(e.asynchronous,!0);T.typeOf.object("options.gltf",t),T.typeOf.object("options.textureInfo",n),T.typeOf.object("options.gltfResource",i),T.typeOf.object("options.baseResource",o),T.typeOf.object("options.supportedImageFormats",r),T.typeOf.object("options.frameState",s);const c=Ld.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s});let u=yt.get(c);if(l(u))return u;u=new Tf({resourceCache:yt,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:c,asynchronous:a}),yt.load({resourceLoader:u});const d=yt.statistics.addTextureLoader(u);return yt.cacheEntries[c]._statisticsPromise=d,u};yt.clearForSpecs=function(){const e=[Ef,bf,Af,Tf,rd,yf,iu,mp,Cf];let t;const n=yt.cacheEntries,i=[];for(t in n)n.hasOwnProperty(t)&&i.push(n[t]);i.sort(function(r,s){const a=e.indexOf(r.resourceLoader.constructor),c=e.indexOf(s.resourceLoader.constructor);return a-c});const o=i.length;for(let r=0;r<o;++r){const s=i[r];t=s.resourceLoader.cacheKey,l(n[t])&&(s.resourceLoader.destroy(),delete n[t])}yt.statistics.clear()};function ya(e,t,n,i,o){if(T.typeOf.object("resource",e),l(t)===l(n))throw new x("One of json and subtreeView must be defined.");T.typeOf.object("implicitTileset",i),T.typeOf.object("implicitCoordinates",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=W6e(this,t,n,i)}Object.defineProperties(ya.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}}});ya.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};ya.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};ya.prototype.contentIsAvailableAtIndex=function(e,t){if(t=A(t,0),t<0||t>=this._contentAvailabilityBitstreams.length)throw new x("contentIndex out of bounds.");return this._contentAvailabilityBitstreams[t].getBit(e)};ya.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};ya.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};ya.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};ya.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};ya.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===Lr.OCTREE&&(t=3),e>>t};function W6e(e,t,n,i){let o;l(t)?o={json:t,binary:void 0}:o=j6e(n);const r=o.json;e._subtreeJson=r;let s;if(hr(r,"3DTILES_metadata"))s=r.extensions["3DTILES_metadata"];else if(l(r.tileMetadata)){const p=r.tileMetadata;s=r.propertyTables[p]}const a=[];if(l(r.contentMetadata)){const p=r.contentMetadata.length;for(let y=0;y<p;y++){const b=r.contentMetadata[y];a.push(r.propertyTables[b])}}let c;const u=i.metadataSchema,d=r.subtreeMetadata;if(l(d)){const p=d.class,y=u.classes[p];c=new Qf({subtreeMetadata:d,class:y})}e._metadata=c,e._tilePropertyTableJson=s,e._contentPropertyTableJsons=a;const h={constant:0};r.contentAvailabilityHeaders=[],hr(r,"3DTILES_multiple_contents")?r.contentAvailabilityHeaders=r.extensions["3DTILES_multiple_contents"].contentAvailability:Array.isArray(r.contentAvailability)?r.contentAvailabilityHeaders=r.contentAvailability:r.contentAvailabilityHeaders.push(A(r.contentAvailability,h));const m=q6e(r.buffers),g=$6e(r.bufferViews,m);Y6e(r,g),l(s)&&g5(s,g);for(let p=0;p<a.length;p++){const y=a[p];g5(y,g)}return X6e(e,m,o.binary).then(function(p){const y=J6e(g,p);return Q6e(e,r,i,y),l(s)&&(Z6e(e,i,y),t9e(e)),e9e(e,i,y),n9e(e),e})}function j6e(e){const n=new DataView(e.buffer,e.byteOffset);let i=8;const o=n.getUint32(i,!0);i+=8;const r=n.getUint32(i,!0);i+=8;const s=Ya(e,i,o);i+=o;const a=e.subarray(i,i+r);return{json:s,binary:a}}function q6e(e){e=l(e)?e:[];for(let t=0;t<e.length;t++){const n=e[t];n.isExternal=l(n.uri),n.isActive=!1}return e}function $6e(e,t){e=l(e)?e:[];for(let n=0;n<e.length;n++){const i=e[n],o=t[i.buffer];i.bufferHeader=o,i.isActive=!1}return e}function Y6e(e,t){let n;const i=e.tileAvailability;l(i.bitstream)?n=t[i.bitstream]:l(i.bufferView)&&(n=t[i.bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);const o=e.contentAvailabilityHeaders;for(let s=0;s<o.length;s++)n=void 0,l(o[s].bitstream)?n=t[o[s].bitstream]:l(o[s].bufferView)&&(n=t[o[s].bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0);n=void 0;const r=e.childSubtreeAvailability;l(r.bitstream)?n=t[r.bitstream]:l(r.bufferView)&&(n=t[r.bufferView]),l(n)&&(n.isActive=!0,n.bufferHeader.isActive=!0)}function g5(e,t){const n=e.properties;let i;for(const o in n)if(n.hasOwnProperty(o)){const r=n[o],s=A(r.values,r.bufferView);i=t[s],i.isActive=!0,i.bufferHeader.isActive=!0;const a=A(r.stringOffsets,r.stringOffsetBufferView);l(a)&&(i=t[a],i.isActive=!0,i.bufferHeader.isActive=!0);const c=A(r.arrayOffsets,r.arrayOffsetBufferView);l(c)&&(i=t[c],i.isActive=!0,i.bufferHeader.isActive=!0)}}function X6e(e,t,n){const i=[];for(let o=0;o<t.length;o++){const r=t[o];if(!r.isActive)i.push(Promise.resolve(void 0));else if(r.isExternal){const s=K6e(e,r);i.push(s)}else i.push(Promise.resolve(n))}return Promise.all(i).then(function(o){const r={};for(let s=0;s<o.length;s++){const a=o[s];l(a)&&(r[s]=a)}return r})}function K6e(e,t){const i=e._resource.getDerivedResource({url:t.uri}),o=yt.loadExternalBuffer({resource:i});return e._bufferLoader=o,o.promise.then(function(r){return r.typedArray})}function J6e(e,t){const n={};for(let i=0;i<e.length;i++){const o=e[i];if(!o.isActive)continue;const r=o.byteOffset,s=r+o.byteLength,c=t[o.buffer].subarray(r,s);n[i]=c}return n}function Q6e(e,t,n,i){const o=n.branchingFactor,r=n.subtreeLevels,s=(Math.pow(o,r)-1)/(o-1),a=Math.pow(o,r),c=hr(t,"3DTILES_metadata"),u=l(e._tilePropertyTableJson);let d=c||u;e._tileAvailability=KP(t.tileAvailability,i,s,d);const h=e._contentPropertyTableJsons.length>0;d=d||h;for(let m=0;m<t.contentAvailabilityHeaders.length;m++){const g=KP(t.contentAvailabilityHeaders[m],i,s,d);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=KP(t.childSubtreeAvailability,i,a)}function KP(e,t,n,i){if(l(e.constant))return new lv({constant:Boolean(e.constant),lengthBits:n,availableCount:e.availableCount});let o;return l(e.bitstream)?o=t[e.bitstream]:l(e.bufferView)&&(o=t[e.bufferView]),new lv({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function Z6e(e,t,n){const i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new Ma({class:a,count:o,properties:i.properties,bufferViews:n})}function e9e(e,t,n){const i=e._contentPropertyTableJsons,o=e._contentAvailabilityBitstreams,r=t.metadataSchema,s=e._contentMetadataTables;for(let a=0;a<i.length;a++){const c=i[a],d=o[a].availableCount,h=c.class,m=r.classes[h],g=new Ma({class:m,count:d,properties:c.properties,bufferViews:n});s.push(g)}}function FK(e){let t=0;const n=e.lengthBits,i=e.availableCount;let 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 t9e(e){const t=FK(e._tileAvailability);e._tileJumpBuffer=t}function n9e(e){const t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){const o=n[i],r=FK(o);t.push(r)}}ya.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new Ie("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};ya.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new Ie("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function i9e(e,t){if(!l(e._tileMetadataTable))return;const n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function o9e(e,t,n){const i=e._contentMetadataTables;if(!l(i))return;const o=i[n];if(!l(o))return;const r=e._contentAvailabilityBitstreams[n],s=e.getTileIndex(t);if(r.getBit(s))return e._contentJumpBuffers[n][s]}ya.prototype.getTileMetadataView=function(e){const t=i9e(this,e);if(!l(t))return;const n=this._tileMetadataTable;return new Id({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};ya.prototype.getContentMetadataView=function(e,t){const n=o9e(this,e,t);if(!l(n))return;const i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new Id({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};ya.prototype.isDestroyed=function(){return!1};ya.prototype.destroy=function(){return l(this._bufferLoader)&&yt.unload(this._bufferLoader),He(this)};const r9e={ID:"ID",NAME:"NAME",DESCRIPTION:"DESCRIPTION",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"},s9e=Object.freeze(r9e);function a9e(e){return T.typeOf.object("tileMetadata",e),{tile:{boundingVolume:y5("TILE",e),minimumHeight:A5("TILE",e),maximumHeight:b5("TILE",e)},content:{boundingVolume:y5("CONTENT",e),minimumHeight:A5("CONTENT",e),maximumHeight:b5("CONTENT",e)}}}function y5(e,t){const n=`${e}_BOUNDING_BOX`,i=t.getPropertyBySemantic(n);if(l(i))return{box:i};const o=`${e}_BOUNDING_REGION`,r=t.getPropertyBySemantic(o);if(l(r))return{region:r};const s=`${e}_BOUNDING_SPHERE`,a=t.getPropertyBySemantic(s);if(l(a))return{sphere:a}}function A5(e,t){const n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function b5(e,t){const n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function vc(e,t,n,i,o,r){if(T.defined("tile.implicitTileset",t.implicitTileset),T.defined("tile.implicitCoordinates",t.implicitCoordinates),l(i)===l(o))throw new x("One of json and arrayBuffer must be defined.");const 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;const c=a.getTemplateValues(),u=s.subtreeUriTemplate.getDerivedResource({templateValues:c});this._url=u.getUrlComponent(!0),this._readyPromise=c9e(this,i,o,r)}Object.defineProperties(vc.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(){throw new x("Implicit3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){return this._group},set:function(e){this._group=e}}});function c9e(e,t,n,i){i=A(i,0);let o;l(n)&&(o=new Uint8Array(n,i));const r=new ya(e._resource,t,o,e._implicitTileset,e._implicitCoordinates);return e._implicitSubtree=r,r.readyPromise.then(function(){return l9e(e,r),e})}function l9e(e,t){const n=e._tile,i=e._implicitCoordinates.childIndex,o=d9e(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;const s=u9e(e,t,o.bottomRow);for(let a=0;a<s.length;a++){const c=s[a],u=c.tile,d=b9e(e,u,c.childIndex);u.children.push(d),r.numberOfTilesTotal++}}function u9e(e,t,n){const i=[],o=e._implicitTileset.branchingFactor;for(let r=0;r<n.length;r++){const s=n[r];if(l(s))for(let a=0;a<o;a++){const c=r*o+a;t.childSubtreeIsAvailableAtIndex(c)&&i.push({tile:s,childIndex:a})}}return i}function d9e(e,t,n,i){const s=C5(e,t,n,i,0,!0),a=e._tileset.statistics;let c=[s],u=[];const d=e._implicitTileset;for(let h=1;h<d.subtreeLevels;h++){const m=t.getLevelOffset(h),g=d.branchingFactor*c.length;for(let p=0;p<g;p++){const y=m+p;if(!t.tileIsAvailableAtIndex(y)){u.push(void 0);continue}const b=t.getParentMortonIndex(p),C=c[b],E=p%d.branchingFactor,w=C5(e,t,C,E,y);C.children.push(w),a.numberOfTilesTotal++,u.push(w)}c=u,u=[]}return{rootTile:s,bottomRow:c}}function zK(e,t,n){const i=s9e.TILE_GEOMETRIC_ERROR;return l(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function C5(e,t,n,i,o,r){const s=e._implicitTileset;let a;A(r,!1)?a=n.implicitCoordinates:a=n.implicitCoordinates.getChildCoordinates(i);let c,u,d;if(l(t.tilePropertyTableJson)){c=t.getTileMetadataView(a);const L=a9e(c);u=L.tile,d=L.content}const m=t.contentPropertyTableJsons.length;let g=!1;for(let L=0;L<m;L++)if(t.contentIsAvailableAtCoordinates(a,L)){g=!0;break}const p=p9e(s,a,i,r,n,u),y=[];for(let L=0;L<s.contentCount;L++){if(!t.contentIsAvailableAtIndex(o,L))continue;const F={uri:s.contentUriTemplates[L].getDerivedResource({templateValues:a.getTemplateValues()}).url},U=m9e(p,d);l(U)&&(F.boundingVolume=U),y.push(hn(F,s.contentHeaders[L]))}const b=zK(c,s,a),C={boundingVolume:p,geometricError:b,refine:s.refine,contents:y},E=!0,w=ht(s.tileHeader,E);delete w.boundingVolume,delete w.transform;const S=hn(C,w,E),P=GK(e,s.baseResource,S,n);return P.implicitCoordinates=a,P.implicitSubtree=t,P.metadata=c,P.hasImplicitContentMetadata=g,P}function pv(e,t){return l(e)&&l(t)&&(l(t.minimumHeight)||l(t.maximumHeight))&&(hr(e,"3DTILES_bounding_volume_S2")||l(e.region))}function gR(e,t){l(t)&&(hr(e,"3DTILES_bounding_volume_S2")?h9e(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):l(e.region)&&f9e(e.region,t.minimumHeight,t.maximumHeight))}function f9e(e,t,n){l(t)&&(e[4]=t),l(n)&&(e[5]=n)}function h9e(e,t,n){l(t)&&(e.minimumHeight=t),l(n)&&(e.maximumHeight=n)}function p9e(e,t,n,i,o,r){let s;return!l(r)||!l(r.boundingVolume)||!pv(r.boundingVolume,r)&&pv(e.boundingVolume,r)?s=UK(e,t,n,A(i,!1),o):s=r.boundingVolume,gR(s,r),s}function m9e(e,t){let n;return l(t)&&(n=t.boundingVolume),pv(n,t)?gR(n,t):pv(e,t)&&(n=ht(e,!0),gR(n,t)),n}function UK(e,t,n,i,o){const r=e.boundingVolume;return hr(r,"3DTILES_bounding_volume_S2")?HK(i,o,n,t.level,t.x,t.y,t.z):l(r.region)?{region:kK(r.region,t.level,t.x,t.y,t.z)}:{box:VK(r.box,t.level,t.x,t.y,t.z)}}function HK(e,t,n,i,o,r,s){T.typeOf.bool("parentIsPlaceholderTile",e),T.typeOf.object("parentTile",t),T.typeOf.number("childIndex",n),T.typeOf.number("level",i),T.typeOf.number("x",o),T.typeOf.number("y",r),l(s)&&T.typeOf.number("z",s);const a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:io.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};const c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),u=c%2===0?a5.encode2D(i,o,r):a5.encode2D(i,r,o),d=io.fromFacePositionLevel(c,BigInt(u),i);let h,m;if(l(s)){const g=(a.maximumHeight+a.minimumHeight)/2;h=n<4?a.minimumHeight:g,m=n<4?g:a.maximumHeight}else h=a.minimumHeight,m=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:io.getTokenFromId(d._cellId),minimumHeight:h,maximumHeight:m}}}}const _9e=new f,g9e=new f,JP=new f,y9e=new J;function VK(e,t,n,i,o){if(T.typeOf.object("rootBox",e),T.typeOf.number("level",t),T.typeOf.number("x",n),T.typeOf.number("y",i),l(o)&&T.typeOf.number("z",o),t===0)return e;const r=f.unpack(e,0,g9e),s=J.unpack(e,3,y9e),a=Math.pow(2,-t),c=-1+(2*n+1)*a,u=-1+(2*i+1)*a;let d=0;const h=f.fromElements(a,a,1,_9e);l(o)&&(d=-1+(2*o+1)*a,h.z=a);let m=f.fromElements(c,u,d,JP);m=J.multiplyByVector(s,m,JP),m=f.add(m,r,JP);let g=J.clone(s);g=J.multiplyByScale(g,h,g);const p=new Array(12);return f.pack(m,p),J.pack(g,p,3),p}const A9e=new ge;function kK(e,t,n,i,o){if(T.typeOf.object("rootRegion",e),T.typeOf.number("level",t),T.typeOf.number("x",n),T.typeOf.number("y",i),l(o)&&T.typeOf.number("z",o),t===0)return e.slice();const r=ge.unpack(e,0,A9e),s=e[4],a=e[5],c=Math.pow(2,-t),u=c*r.width,d=M.negativePiToPi(r.west+n*u),h=M.negativePiToPi(d+u),m=c*r.height,g=M.negativePiToPi(r.south+i*m),p=M.negativePiToPi(g+m);let y=s,b=a;if(l(o)){const C=c*(a-s);y+=o*C,b=y+C}return[d,g,h,p,y,b]}function b9e(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=UK(i,o,n,!1,t),s=zK(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,c={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=GK(e,i.baseResource,c,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function GK(e,t,n,i){const o=e._tile.constructor;return new o(e._tileset,t,n,i)}vc.prototype.hasProperty=function(e,t){return!1};vc.prototype.getFeature=function(e){};vc.prototype.applyDebugSettings=function(e,t){};vc.prototype.applyStyle=function(e){};vc.prototype.update=function(e,t){};vc.prototype.isDestroyed=function(){return!1};vc.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),He(this)};vc._deriveBoundingBox=VK;vc._deriveBoundingRegion=kK;vc._deriveBoundingVolumeS2=HK;const C9e={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},cf=Object.freeze(C9e),pb={HIGHLIGHT:0,REPLACE:1,MIX:2};pb.getColorBlend=function(e,t){if(e===pb.HIGHLIGHT)return 0;if(e===pb.REPLACE)return 1;if(e===pb.MIX)return M.clamp(t,M.EPSILON4,1)};const kD=Object.freeze(pb),T9e={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},Hl=Object.freeze(T9e),E9e={STEP:0,LINEAR:1,CUBICSPLINE:2},Hy=Object.freeze(E9e),WK={};function fg(e){T.typeOf.number.greaterThan("options.count",e.count,0),T.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=ht(e.properties,!0)}fg.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,WK)};fg.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,WK,e)};fg.prototype.getProperty=function(e,t){if(T.typeOf.number("index",e),T.typeOf.string("propertyId",t),e<0||e>=this._count)throw new x(`index must be in the range [0, ${this._count})`);const n=this._properties[t];if(l(n))return ht(n[e],!0)};fg.prototype.setProperty=function(e,t,n){if(T.typeOf.number("index",e),T.typeOf.string("propertyId",t),e<0||e>=this._count)throw new x(`index must be in the range [0, ${this._count})`);let i=this._properties[t];l(i)||(i=new Array(this._count),this._properties[t]=i),i[e]=ht(n,!0)};function Er(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.number("options.count",e.count),this._name=e.name,this._id=e.id,this._count=e.count,this._extras=e.extras,this._extensions=e.extensions,this._metadataTable=e.metadataTable,this._jsonMetadataTable=e.jsonMetadataTable,this._batchTableHierarchy=e.batchTableHierarchy}Object.defineProperties(Er.prototype,{name:{get:function(){return this._name}},id:{get:function(){return this._id}},count:{get:function(){return this._count}},class:{get:function(){if(l(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 l(this._metadataTable)&&(e+=this._metadataTable.byteLength),l(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e}}});Er.prototype.hasProperty=function(e,t){return T.typeOf.number("index",e),T.typeOf.string("propertyId",t),!!(l(this._metadataTable)&&this._metadataTable.hasProperty(t)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)||l(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(t))};Er.prototype.hasPropertyBySemantic=function(e,t){return T.typeOf.number("index",e),T.typeOf.string("semantic",t),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};Er.prototype.propertyExists=function(e){return T.typeOf.string("propertyId",e),!!(l(this._metadataTable)&&this._metadataTable.hasProperty(e)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.propertyExists(e)||l(this._jsonMetadataTable)&&this._jsonMetadataTable.hasProperty(e))};Er.prototype.propertyExistsBySemantic=function(e){return T.typeOf.string("semantic",e),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};const QP=[];Er.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,l(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(QP)),l(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,QP)),l(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(QP)),t};Er.prototype.getProperty=function(e,t){let n;if(l(this._metadataTable)&&(n=this._metadataTable.getProperty(e,t),l(n))||l(this._batchTableHierarchy)&&(n=this._batchTableHierarchy.getProperty(e,t),l(n))||l(this._jsonMetadataTable)&&(n=this._jsonMetadataTable.getProperty(e,t),l(n)))return n};Er.prototype.setProperty=function(e,t,n){l(this._metadataTable)&&this._metadataTable.setProperty(e,t,n)||l(this._batchTableHierarchy)&&this._batchTableHierarchy.setProperty(e,t,n)||(l(this._jsonMetadataTable)||(this._jsonMetadataTable=new fg({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};Er.prototype.getPropertyBySemantic=function(e,t){if(l(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};Er.prototype.setPropertyBySemantic=function(e,t,n){return l(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};Er.prototype.getPropertyTypedArray=function(e){if(T.typeOf.string("propertyId",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};Er.prototype.getPropertyTypedArrayBySemantic=function(e){if(T.typeOf.string("semantic",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function H2(e,t){if(!l(e)||e<0||e>=t)throw new x(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}Er.prototype.isClass=function(e,t){H2(e,this.count),T.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};Er.prototype.isExactClass=function(e,t){return H2(e,this.count),T.typeOf.string("className",t),this.getExactClassName(e)===t};Er.prototype.getExactClassName=function(e){H2(e,this.count);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};function MT(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty,i=e.textures;T.typeOf.object("options.property",t),T.typeOf.object("options.classProperty",n),T.typeOf.object("options.textures",i);const o=l(t.channels)?t.channels:[0],r=t,s=L_.createModelTextureReader({textureInfo:r,channels:S9e(o),texture:i[r.index]});this._min=t.min,this._max=t.max;let a=t.offset,c=t.scale;const u=n.hasValueTransform||l(a)||l(c);a=A(a,n.offset),c=A(c,n.scale),a=n.unpackVectorAndMatrixTypes(a),c=n.unpackVectorAndMatrixTypes(c),this._offset=a,this._scale=c,this._hasValueTransform=u,this._textureReader=s,this._classProperty=n,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(MT.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}}});MT.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===Bt.SCALAR&&n===$t.UINT8:Bt.isVectorType(t)||t===Bt.SCALAR?n===$t.UINT8:!1};const x9e=[void 0,"float","vec2","vec3","vec4"],w9e=[void 0,"int","ivec2","ivec3","ivec4"];MT.prototype.getGlslType=function(){const e=this._classProperty;let t=Bt.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?x9e[t]:w9e[t]};MT.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function S9e(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}function GD(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyTexture,n=e.class,i=e.textures;T.typeOf.object("options.propertyTexture",t),T.typeOf.object("options.class",n),T.typeOf.object("options.textures",i);const o=t.extensions,r=t.extras,s={};if(l(t.properties))for(const a in t.properties)t.properties.hasOwnProperty(a)&&(s[a]=new MT({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(GD.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}}});GD.prototype.getProperty=function(e){return T.typeOf.string("propertyId",e),this._properties[e]};function jK(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty;T.typeOf.object("options.property",t),T.typeOf.object("options.classProperty",n),this._attribute=t.attribute,this._classProperty=n,this._min=t.min,this._max=t.max;let i=t.offset,o=t.scale;const r=n.hasValueTransform||l(i)||l(o);i=A(i,n.offset),o=A(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(jK.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}}});function WD(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyAttribute,n=e.class;T.typeOf.object("options.propertyAttribute",t),T.typeOf.object("options.class",n);const i={};if(l(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new jK({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(WD.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}}});WD.prototype.getProperty=function(e){return T.typeOf.string("propertyId",e),this._properties[e]};function vu(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.schema",e.schema),this._schema=e.schema;const t=e.propertyTables;this._propertyTableCount=l(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(vu.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(!l(this._propertyTables))return 0;let e=0;const t=this._propertyTables.length;for(let n=0;n<t;n++)e+=this._propertyTables[n].byteLength;return e}}});vu.prototype.getPropertyTable=function(e){return T.typeOf.number("propertyTableId",e),this._propertyTables[e]};vu.prototype.getPropertyTexture=function(e){return T.typeOf.number("propertyTextureId",e),this._propertyTextures[e]};vu.prototype.getPropertyAttribute=function(e){return T.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]};function v9e(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;T.typeOf.object("options.extension",t),T.typeOf.object("options.schema",n);const i=[];if(l(t.propertyTables))for(let s=0;s<t.propertyTables.length;s++){const a=t.propertyTables[s],c=n.classes[a.class],u=new Ma({count:a.count,properties:a.properties,class:c,bufferViews:e.bufferViews});i.push(new Er({id:s,name:a.name,count:a.count,metadataTable:u,extras:a.extras,extensions:a.extensions}))}const o=[];if(l(t.propertyTextures))for(let s=0;s<t.propertyTextures.length;s++){const a=t.propertyTextures[s];o.push(new GD({id:s,name:a.name,propertyTexture:a,class:n.classes[a.class],textures:e.textures}))}const r=[];if(l(t.propertyAttributes))for(let s=0;s<t.propertyAttributes.length;s++){const a=t.propertyAttributes[s];r.push(new WD({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new vu({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function D9e(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;T.typeOf.object("options.extension",t),T.typeOf.object("options.schema",n);let i;const o=[];let r;if(l(t.featureTables))for(r=Object.keys(t.featureTables).sort(),i=0;i<r.length;i++){const a=r[i],c=t.featureTables[a],u=n.classes[c.class],d=new Ma({count:c.count,properties:c.properties,class:u,bufferViews:e.bufferViews});o.push(new Er({id:a,count:c.count,metadataTable:d,extras:c.extras,extensions:c.extensions}))}const s=[];if(l(t.featureTextures))for(r=Object.keys(t.featureTextures).sort(),i=0;i<r.length;i++){const a=r[i],c=t.featureTextures[a];s.push(new GD({id:a,propertyTexture:I9e(c),class:n.classes[c.class],textures:e.textures}))}return new vu({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function I9e(e){const t={class:e.class,properties:{}},n=e.properties;for(const i in n)if(n.hasOwnProperty(i)){const o=n[i],r={channels:P9e(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=hn(o.texture,r,!0)}return t}function P9e(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]="rgba".indexOf(e[i]);return n}function _p(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.extension,i=e.extensionLegacy,o=e.gltfResource,r=e.baseResource,s=e.supportedImageFormats,a=e.frameState,c=e.cacheKey,u=A(e.asynchronous,!0);if(T.typeOf.object("options.gltf",t),T.typeOf.object("options.gltfResource",o),T.typeOf.object("options.baseResource",r),T.typeOf.object("options.supportedImageFormats",s),T.typeOf.object("options.frameState",a),!l(e.extension)&&!l(e.extensionLegacy))throw new x("One of options.extension or options.extensionLegacy must be specified");this._gltfResource=o,this._baseResource=r,this._gltf=t,this._extension=n,this._extensionLegacy=i,this._supportedImageFormats=s,this._frameState=a,this._cacheKey=c,this._asynchronous=u,this._bufferViewLoaders=[],this._textureLoaders=[],this._schemaLoader=void 0,this._structuralMetadata=void 0,this._state=Ft.UNLOADED,this._promise=void 0}l(Object.create)&&(_p.prototype=Object.create(mr.prototype),_p.prototype.constructor=_p);Object.defineProperties(_p.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});_p.prototype.load=function(){const e=N9e(this),t=H9e(this),n=V9e(this);this._gltf=void 0,this._state=Ft.LOADING;const i=this;this._promise=Promise.all([e,t,n]).then(function(o){if(i.isDestroyed())return;const r=o[0],s=o[1],a=o[2];return l(i._extension)?i._structuralMetadata=v9e({extension:i._extension,schema:a,bufferViews:r,textures:s}):i._structuralMetadata=D9e({extension:i._extensionLegacy,schema:a,bufferViews:r,textures:s}),i._state=Ft.READY,i}).catch(function(o){if(i.isDestroyed())return;i.unload(),i._state=Ft.FAILED;const r="Failed to load structural metadata";return Promise.reject(i.getError(r,o))})};function O9e(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.values,r=i.arrayOffsets,s=i.stringOffsets;l(o)&&(t[o]=!0),l(r)&&(t[r]=!0),l(s)&&(t[s]=!0)}}function L9e(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],o=i.bufferView,r=i.arrayOffsetBufferView,s=i.stringOffsetBufferView;l(o)&&(t[o]=!0),l(r)&&(t[r]=!0),l(s)&&(t[s]=!0)}}function B9e(e){const t=e.propertyTables,n={};if(l(t))for(let i=0;i<t.length;i++){const o=t[i];O9e(o.properties,n)}return n}function R9e(e){const t=e.featureTables,n={};if(l(t)){for(const i in t)if(t.hasOwnProperty(i)){const r=t[i].properties;l(r)&&L9e(r,n)}}return n}function N9e(e){let t;l(e._extension)?t=B9e(e._extension):t=R9e(e._extensionLegacy);const n=[],i={};for(const o in t)if(t.hasOwnProperty(o)){const r=yt.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(){const o={};for(const r in i)if(i.hasOwnProperty(r)){const s=i[r],a=new Uint8Array(s.typedArray);o[r]=a}return qK(e),o})}function M9e(e){const t={},n=e.propertyTextures;if(l(n))for(let i=0;i<n.length;i++){const r=n[i].properties;l(r)&&F9e(r,t)}return t}function F9e(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=i}}function z9e(e){const t={},n=e.featureTextures;if(l(n)){for(const i in n)if(n.hasOwnProperty(i)){const r=n[i].properties;l(r)&&U9e(r,t)}}return t}function U9e(e,t){for(const n in e)if(e.hasOwnProperty(n)){const o=e[n].texture;t[o.index]=o}}function H9e(e){let t;l(e._extension)?t=M9e(e._extension):t=z9e(e._extensionLegacy);const n=e._gltf,i=e._gltfResource,o=e._baseResource,r=e._supportedImageFormats,s=e._frameState,a=e._asynchronous,c=[],u={};for(const d in t)if(t.hasOwnProperty(d)){const h=yt.loadTexture({gltf:n,textureInfo:t[d],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});c.push(h.promise),e._textureLoaders.push(h),u[d]=h}return Promise.all(c).then(function(){const d={};for(const h in u)if(u.hasOwnProperty(h)){const m=u[h];d[h]=m.texture}return d})}function V9e(e){const t=A(e._extension,e._extensionLegacy);let n;if(l(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=yt.loadSchema({resource:i})}else n=yt.loadSchema({schema:t.schema});return e._schemaLoader=n,n.promise.then(function(i){return i.schema})}_p.prototype.process=function(e){if(T.typeOf.object("frameState",e),this._state!==Ft.LOADING)return;const t=this._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i].process(e)};function qK(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)yt.unload(t[i]);e._bufferViewLoaders.length=0}function k9e(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)yt.unload(t[i]);e._textureLoaders.length=0}_p.prototype.unload=function(){qK(this),k9e(this),l(this._schemaLoader)&&yt.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const zn={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function G9e(e){switch(e){case zn.POSITION:return"positionMC";case zn.NORMAL:return"normalMC";case zn.TANGENT:return"tangentMC";case zn.TEXCOORD:return"texCoord";case zn.COLOR:return"color";case zn.JOINTS:return"joints";case zn.WEIGHTS:return"weights";case zn.FEATURE_ID:return"featureId";default:throw new x("semantic is not a valid value.")}}zn.hasSetIndex=function(e){switch(T.typeOf.string("semantic",e),e){case zn.POSITION:case zn.NORMAL:case zn.TANGENT:return!1;case zn.TEXCOORD:case zn.COLOR:case zn.JOINTS:case zn.WEIGHTS:case zn.FEATURE_ID:return!0;default:throw new x("semantic is not a valid value.")}};zn.fromGltfSemantic=function(e){T.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return zn.POSITION;case"NORMAL":return zn.NORMAL;case"TANGENT":return zn.TANGENT;case"TEXCOORD":return zn.TEXCOORD;case"COLOR":return zn.COLOR;case"JOINTS":return zn.JOINTS;case"WEIGHTS":return zn.WEIGHTS;case"_FEATURE_ID":return zn.FEATURE_ID}};zn.fromPntsSemantic=function(e){switch(T.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return zn.POSITION;case"RGBA":case"RGB":case"RGB565":return zn.COLOR;case"NORMAL":case"NORMAL_OCT16P":return zn.NORMAL;case"BATCH_ID":return zn.FEATURE_ID;default:throw new x("pntsSemantic is not a valid value.")}};zn.getGlslType=function(e){switch(T.typeOf.string("semantic",e),e){case zn.POSITION:case zn.NORMAL:case zn.TANGENT:return"vec3";case zn.TEXCOORD:return"vec2";case zn.COLOR:return"vec4";case zn.JOINTS:return"ivec4";case zn.WEIGHTS:return"vec4";case zn.FEATURE_ID:return"int";default:throw new x("semantic is not a valid value.")}};zn.getVariableName=function(e,t){T.typeOf.string("semantic",e);let n=G9e(e);return l(t)&&(n+=`_${t}`),n};const wt=Object.freeze(zn);function en(){}en.getFailedLoadFunction=function(e,t,n){return function(i){let o=`Failed to load ${t}: ${n}`;l(i)&&(o+=`
|
||
${i.message}`);const r=new Ie(o);return l(i)&&(r.stack=`Original stack:
|
||
${i.stack}
|
||
Handler stack:
|
||
${r.stack}`),Promise.reject(r)}};en.getNodeTransform=function(e){return l(e.matrix)?e.matrix:B.fromTranslationQuaternionRotationScale(l(e.translation)?e.translation:f.ZERO,l(e.rotation)?e.rotation:Te.IDENTITY,l(e.scale)?e.scale:f.ONE)};en.getAttributeBySemantic=function(e,t,n){const i=e.attributes,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=l(n)?s.setIndex===n:!0;if(s.semantic===t&&a)return s}};en.getAttributeByName=function(e,t){const n=e.attributes,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.name===t)return r}};en.getFeatureIdsByLabel=function(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(i.positionalLabel===t||i.label===t)return i}};en.hasQuantizedAttributes=function(e){if(!l(e))return!1;for(let t=0;t<e.length;t++){const n=e[t];if(l(n.quantization))return!0}return!1};en.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,o=!1;l(t)?(i=wt.getVariableName(t,n),o=!0):(i=e.name,i=i.replace(/^_/,""),i=i.toLowerCase());const r=/^color_\d+$/.test(i),s=e.type;let a=_n.getGlslType(s);r&&(a="vec4");const c=l(e.quantization);let u;return c&&(u=r?"vec4":_n.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};const W9e=new f,j9e=new f;en.getPositionMinMax=function(e,t,n){const i=en.getAttributeBySemantic(e,"POSITION");let o=i.max,r=i.min;return l(n)&&l(t)&&(r=f.add(r,t,j9e),o=f.add(o,n,W9e)),{min:r,max:o}};en.getAxisCorrectionMatrix=function(e,t,n){return n=B.clone(B.IDENTITY,n),e===cs.Y?n=B.clone(cs.Y_UP_TO_Z_UP,n):e===cs.X&&(n=B.clone(cs.X_UP_TO_Z_UP,n)),t===cs.Z&&(n=B.multiplyTransformation(n,cs.Z_UP_TO_X_UP,n)),n};const q9e=new J;en.getCullFace=function(e,t){if(!Ze.isTriangles(t))return Ho.BACK;const n=B.getMatrix3(e,q9e);return J.determinant(n)<0?Ho.FRONT:Ho.BACK};en.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};en.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};en.checkSupportedExtensions=function(e){const t=e.length;for(let n=0;n<t;n++){const i=e[n];if(!en.supportedExtensions[i])throw new Ie(`Unsupported glTF Extension: ${i}`)}};const cy={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};cy.fromGltfSemantic=function(e){T.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return cy.TRANSLATION;case"ROTATION":return cy.ROTATION;case"SCALE":return cy.SCALE;case"_FEATURE_ID":return cy.FEATURE_ID}};const ta=Object.freeze(cy),$9e=65534,Y9e=255;function FT(e){e=A(e,A.EMPTY_OBJECT);const t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;T.typeOf.object("options.triangleIndices",t),T.typeOf.object("options.outlineIndices",n),T.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new $K(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],X9e(this)}Object.defineProperties(FT.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function X9e(e){let t=e._triangleIndices;const n=e._edges,i=[],o=e._extraVertices,r=e._originalVertexCount,s={};for(let a=0;a<t.length;a+=3){let c=t[a],u=t[a+1],d=t[a+2];const h=n.hasEdge(c,u),m=n.hasEdge(u,d),g=n.hasEdge(d,c);let p=T5(i,c,u,d,h,m,g);for(;l(p);){let y=s[p];if(!l(y)){y=r+o.length;let b=p;for(;b>=r;)b=o[b-r];o.push(b),s[p]=y}y>$9e&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):y>Y9e&&t instanceof Uint8Array&&(t=new Uint16Array(t)),p===c?(c=y,t[a]=y):p===u?(u=y,t[a+1]=y):(d=y,t[a+2]=y),p=T5(i,c,u,d,h,m,g)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function T5(e,t,n,i,o,r,s){const a=s?1:0,c=o?1:0,u=0,d=ZP(e,t,a,c,u);if(d===0)return t;const h=0,m=o?1:0,g=r?1:0,p=ZP(e,n,h,m,g);if(p===0)return n;const y=s?1:0,b=0,C=r?1:0,E=ZP(e,i,y,b,C);if(E===0)return i;const w=d&p&E;let S,P,L;if(w&1<<0)S=0,P=1,L=2;else if(w&1<<1)S=0,L=1,P=2;else if(w&1<<2)P=0,S=1,L=2;else if(w&1<<3)P=0,L=1,S=2;else if(w&1<<4)L=0,S=1,P=2;else if(w&1<<5)L=0,P=1,S=2;else{const U=eO(d),D=eO(p),I=eO(E);return U<D&&U<I?t:D<I?n:i}const z=t*3;e[z+S]=a,e[z+P]=c,e[z+L]=u;const R=n*3;e[R+S]=h,e[R+P]=m,e[R+L]=g;const F=i*3;e[F+S]=y,e[F+P]=b,e[F+L]=C}function ZP(e,t,n,i,o){const r=t*3,s=e[r],a=e[r+1],c=e[r+2];return l(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 eO(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}FT.prototype.updateAttribute=function(e){const 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++){const c=t[a]*i,u=n+a*i;for(let d=0;d<i;d++)s[u+d]=s[c+d]}return s};FT.createTexture=function(e){let t=e.cache.modelOutliningCache;if(l(t)||(t=e.cache.modelOutliningCache={}),l(t.outlineTexture))return t.outlineTexture;const n=Math.min(4096,It.maximumTextureSize);let i=n;const o=E5(i),r=[];for(;i>1;)i>>=1,r.push(E5(i));const s=new Wt({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:rt.LUMINANCE,sampler:new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:In.LINEAR_MIPMAP_LINEAR,magnificationFilter:Kr.LINEAR})});return t.outlineTexture=s,s};function E5(e){const 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 $K(e,t){this._originalVertexCount=t,this._edges=new Set;for(let n=0;n<e.length;n+=2){const 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)}}$K.prototype.hasEdge=function(e,t){const n=Math.min(e,t),i=Math.max(e,t),o=n*this._originalVertexCount+i;return this._edges.has(o)};function YK(e){T.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function K9e(e){T.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function V0(e){T.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}V0.prototype.postProcess=function(e){this.needsOutlines&&(J9e(this),Z9e(this,e))};function J9e(e){const t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new FT({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=at.fromTypedArray(n.typedArray);const r=Q9e(o.outlineCoordinates),s=new YK(r);s.loadBuffer=!0,s.loadTypedArray=!1,e.attributePlans.push(s),t.outlineCoordinates=s.attribute;const a=e.attributePlans,c=e.attributePlans.length;for(let u=0;u<c;u++){const d=a[u].attribute;d.typedArray=o.updateAttribute(d.typedArray)}}function Q9e(e){const t=new Ot.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=ee.FLOAT,t.type=_n.VEC3,t.normalized=!1,t.count=e.length/3,t}function Z9e(e,t){eWe(e.attributePlans,t),l(e.indicesPlan)&&tWe(e.indicesPlan,t)}function eWe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i],r=o.attribute,s=r.typedArray;if(o.loadBuffer){const a=Tt.createVertexBuffer({typedArray:s,context:t,usage:nt.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function tWe(e,t){const n=e.indices;if(e.loadBuffer){const i=Tt.createIndexBuffer({typedArray:n.typedArray,context:t,usage:nt.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}V0.AttributeLoadPlan=YK;V0.IndicesLoadPlan=K9e;function nWe(e){e=A(e,A.EMPTY_OBJECT),this.webp=A(e.webp,!1),this.basis=A(e.basis,!1)}const iWe=Ot.Attribute,oWe=Ot.Indices,XK=Ot.FeatureIdAttribute,KK=Ot.FeatureIdTexture,JK=Ot.FeatureIdImplicitRange,rWe=Ot.MorphTarget,sWe=Ot.Primitive,aWe=Ot.Instances,cWe=Ot.Skin,lWe=Ot.Node,uWe=Ot.AnimatedPropertyType,dWe=Ot.AnimationSampler,fWe=Ot.AnimationTarget,hWe=Ot.AnimationChannel,pWe=Ot.Animation,mWe=Ot.ArticulationStage,_We=Ot.Articulation,gWe=Ot.Asset,yWe=Ot.Scene,AWe=Ot.Components,bWe=Ot.MetallicRoughness,CWe=Ot.SpecularGlossiness,TWe=Ot.Material,bo={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function ou(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource;let n=e.baseResource;const i=e.typedArray,o=A(e.releaseGltfJson,!1),r=A(e.asynchronous,!0),s=A(e.incrementallyLoadTextures,!0),a=A(e.upAxis,cs.Y),c=A(e.forwardAxis,cs.Z),u=A(e.loadAttributesAsTypedArray,!1),d=A(e.loadAttributesFor2D,!1),h=A(e.loadIndicesForWireframe,!1),m=A(e.loadPrimitiveOutline,!0),g=A(e.loadForClassification,!1),p=A(e.renameBatchIdSemantic,!1);T.typeOf.object("options.gltfResource",t),n=l(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=u,this._loadAttributesFor2D=d,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=m,this._loadForClassification=g,this._renameBatchIdSemantic=p,this._hasKhrMeshQuantization=!1,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=bo.NOT_LOADED,this._textureState=bo.NOT_LOADED,this._promise=void 0,this._texturesLoadedPromise=void 0,this._process=function(y,b){},this._processTextures=function(y,b){},this._primitiveLoadPlans=[],this._loaderPromises=[],this._textureLoaders=[],this._texturesPromises=[],this._bufferViewLoaders=[],this._geometryLoaders=[],this._structuralMetadataLoader=void 0,this._postProcessBuffers=[],this._components=void 0}l(Object.create)&&(ou.prototype=Object.create(mr.prototype),ou.prototype.constructor=ou);Object.defineProperties(ou.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}}});ou.prototype.load=function(){const e=yt.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=bo.LOADING,this._textureState=bo.LOADING;const t=this;let n;const i=new Promise(function(o,r){n=new Promise(function(s,a){t._process=function(c,u){if(!gn.supportsWebP.initialized){gn.supportsWebP.initialize();return}if(c._state===bo.LOADED){c._state=bo.PROCESSING;const d=new nWe({webp:gn.supportsWebP(),basis:u.context.supportsBasis});let h;l(c._gltfJsonLoader)?h=c._gltfJsonLoader.gltf:h=c._gltfJson,yje(c,h,d,u,r,a),l(c._gltfJsonLoader)&&c._releaseGltfJson&&(yt.unload(c._gltfJsonLoader),c._gltfJsonLoader=void 0)}c._state===bo.PROCESSING&&EWe(c,u),c._state===bo.POST_PROCESSING&&(xWe(c,u.context),c._state=bo.PROCESSED),c._state===bo.PROCESSED&&(sJ(c),c._typedArray=void 0,c._state=bo.READY,o(c))},t._processTextures=function(c,u){if(c._textureState===bo.LOADED&&(c._textureState=bo.PROCESSING),c._textureState===bo.PROCESSING){let d;const h=c._textureLoaders,m=h.length;for(d=0;d<m;++d)h[d].process(u)}c._textureState===bo.PROCESSED&&(c._textureState=bo.READY,s(c))}})});return this._promise=e.promise.then(function(){if(!t.isDestroyed())return t._state=bo.LOADED,t._textureState=bo.LOADED,i}).catch(function(o){if(!t.isDestroyed())return t._state=bo.FAILED,t._textureState=bo.FAILED,x5(t,o)}),this._texturesLoadedPromise=n.catch(function(o){if(!t.isDestroyed())return t._textureState=bo.FAILED,x5(t,o)}),this._promise};function x5(e,t){e.unload();const n="Failed to load glTF";return t=e.getError(n,t),Promise.reject(t)}function EWe(e,t){const n=e._bufferViewLoaders,i=n.length;for(let s=0;s<i;++s)n[s].process(t);const o=e._geometryLoaders,r=o.length;for(let s=0;s<r;++s)o[s].process(t);l(e._structuralMetadataLoader)&&e._structuralMetadataLoader.process(t)}function xWe(e,t){const n=e._primitiveLoadPlans,i=n.length;for(let o=0;o<i;o++){const r=n[o];r.postProcess(t),r.needsOutlines&&wWe(e,r)}}function wWe(e,t){const n=e._postProcessBuffers,i=t.primitive,o=i.outlineCoordinates;l(o)&&n.push(o.buffer);const r=i.attributes,s=r.length;for(let c=0;c<s;c++){const u=r[c];l(u.buffer)&&n.push(u.buffer)}const a=i.indices;l(a)&&l(a.buffer)&&n.push(a.buffer)}ou.prototype.process=function(e){T.typeOf.object("frameState",e),this._process(this,e),this._processTextures(this,e)};function SWe(e,t,n,i,o,r,s,a){const u=t.accessors[n].bufferView,d=yt.loadVertexBuffer({gltf:t,gltfResource:e._gltfResource,baseResource:e._baseResource,frameState:a,bufferViewId:u,draco:o,attributeSemantic:i,accessorId:n,asynchronous:e._asynchronous,loadBuffer:r,loadTypedArray:s});return e._geometryLoaders.push(d),d}function vWe(e,t,n,i,o,r,s){const a=yt.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 DWe(e,t,n){const i=yt.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function QK(e,t,n){let i=t.byteOffset;const o=H0(e,t),r=t.count,s=OT(t.type),a=t.componentType,c=ee.getSizeInBytes(a),u=c*s,d=r*s;if(o===u)return n=new Uint8Array(n),ee.createArrayBufferView(a,n.buffer,n.byteOffset+i,d);const h=ee.createTypedArray(a,d),m=new DataView(n.buffer),g=new Array(s),p=R2(t.componentType);i=n.byteOffset+i;for(let y=0;y<r;++y){p(m,i,s,c,g);for(let b=0;b<s;++b)h[y*s+b]=g[b];i+=o}return h}function IWe(e,t){const n=e.type;if(n===_n.SCALAR)return t.fill(0);const i=_n.getMathType(n);return t.fill(i.clone(i.ZERO))}function PWe(e,t,n,i){const o=e.type,r=e.count;if(o===_n.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===_n.VEC4&&i)for(let s=0;s<r;s++)n[s]=Te.unpack(t,s*4);else{const s=_n.getMathType(o),a=_n.getNumberOfComponents(o);for(let c=0;c<r;c++)n[c]=s.unpack(t,c*a)}return n}function mv(e,t,n,i){const o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(l(a)){const u=DWe(e,t,a).promise.then(function(d){if(e.isDestroyed())return;const h=d.typedArray,m=QK(t,o,h);i=A(i,!1),PWe(o,m,s,i)});return e._loaderPromises.push(u),s}return IWe(o,s)}function ol(e,t){if(l(t))return e===Number?t[0]:e.unpack(t)}function OWe(e){return e===Number?0:new e}function LWe(e){switch(e){case ee.BYTE:return 127;case ee.UNSIGNED_BYTE:return 255;case ee.SHORT:return 32767;case ee.UNSIGNED_SHORT:return 65535;default:return 1}}const BWe={VEC2:new j(-1,-1),VEC3:new f(-1,-1,-1),VEC4:new oe(-1,-1,-1,-1)};function RWe(e,t){const n=LWe(e.componentDatatype),i=BWe[e.type];let o=e.min;l(o)&&(o=t.divideByScalar(o,n,o),o=t.maximumByComponent(o,i,o));let r=e.max;l(r)&&(r=t.divideByScalar(r,n,r),r=t.maximumByComponent(r,i,r)),e.min=o,e.max=r}function NWe(e,t,n){const i=e.decodeMatrix,o=ol(n,e.decodedMin),r=ol(n,e.decodedMax);l(o)&&l(r)&&(t.min=o,t.max=r);const s=new Ot.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 j(i[6],i[7]),s.quantizedVolumeStepSize=new j(i[0],i[4])):i.length===16?(s.quantizedVolumeOffset=new f(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new f(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 MWe(e,t,n,i,o,r){const s=e.accessors[t],a=_n.getMathType(s.type),c=A(s.normalized,!1),u=new iWe;u.name=n,u.semantic=i,u.setIndex=o,u.constant=OWe(a),u.componentDatatype=s.componentType,u.normalized=c,u.count=s.count,u.type=s.type,u.min=ol(a,s.min),u.max=ol(a,s.max),u.byteOffset=s.byteOffset,u.byteStride=H0(e,s),hr(s,"WEB3D_quantized_attributes")&&NWe(s.extensions.WEB3D_quantized_attributes,u,a);const d=u.semantic===wt.POSITION||u.semantic===wt.NORMAL||u.semantic===wt.TANGENT||u.semantic===wt.TEXCOORD;return r&&c&&d&&RWe(u,a),u}function ZK(e){const n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}const FWe={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function V2(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");const o=t.fromGltfSemantic(i),r=FWe;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function zWe(e){const t=e===wt.POSITION,n=e===wt.FEATURE_ID,i=e===wt.TEXCOORD;return t||n||i}function UWe(e,t,n,i){if(e.byteOffset=0,e.byteStride=void 0,e.quantization=t.quantization,n&&(e.buffer=t.buffer),i){const o=l(t.quantization)?t.quantization.componentDatatype:e.componentDatatype;e.typedArray=ee.createArrayBufferView(o,t.typedArray.buffer)}}function HWe(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){const s=i.typedArray;n.typedArray=QK(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function eJ(e,t,n,i,o,r,s,a){const c=t.accessors[n],u=c.bufferView,d=i.gltfSemantic,h=i.renamedSemantic,m=i.modelSemantic,g=l(m)?ZK(h):void 0,y=MWe(t,n,d,m,g,e._hasKhrMeshQuantization);if(!l(o)&&!l(u))return y;const C=SWe(e,t,n,d,o,r,s,a).promise.then(function(E){e.isDestroyed()||(l(o)&&l(o.attributes)&&l(o.attributes[d])?UWe(y,E,r,s):HWe(t,c,y,E,r,s))});return e._loaderPromises.push(C),y}function tJ(e,t,n,i,o,r,s,a){const c=i.modelSemantic,u=c===wt.POSITION,d=c===wt.FEATURE_ID,h=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,m=e._loadForClassification&&d,g=e._loadAttributesAsTypedArray,p=!g,y=g||h||m,E=eJ(e,t,n,i,o,s?!1:p,s?!0:y,a),w=new V0.AttributeLoadPlan(E);return w.loadBuffer=p,w.loadTypedArray=y,w}function VWe(e,t,n,i,o,r){const s=l(i.ROTATION),a=l(i.TRANSLATION)&&l(t.accessors[i.TRANSLATION].min)&&l(t.accessors[i.TRANSLATION].max),c=V2(e,ta,o),u=c.modelSemantic,d=u===ta.TRANSLATION||u===ta.ROTATION||u===ta.SCALE,h=u===ta.TRANSLATION,m=e._loadAttributesAsTypedArray||s&&d||!r.context.instancedArrays,g=!m,p=e._loadAttributesFor2D&&!r.scene3DOnly;return eJ(e,t,n,c,void 0,g,m||h&&(!a||p),r)}function kWe(e,t,n,i,o,r,s){const a=t.accessors[n],c=a.bufferView;if(!l(i)&&!l(c))return;const u=new oWe;u.count=a.count;const d=e._loadAttributesAsTypedArray,h=e._loadIndicesForWireframe&&!s.context.webgl2,m=e._loadForClassification&&o,p=!d,y=d||h||m,w=vWe(e,t,n,i,r?!1:p,r?!0:y,s).promise.then(function(P){e.isDestroyed()||(u.indexDatatype=P.indexDatatype,u.buffer=P.buffer,u.typedArray=P.typedArray)});e._loaderPromises.push(w);const S=new V0.IndicesLoadPlan(u);return S.loadBuffer=p,S.loadTypedArray=y,S}function Jd(e,t,n,i,o,r){const s=L_.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!l(s))return;const a=yt.loadTexture({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous});e._textureLoaders.push(a);const c=L_.createModelTextureReader({textureInfo:n}),u=a.promise.then(function(d){e.isUnloaded()||e.isDestroyed()||(c.texture=d.texture,l(r)&&(c.texture.sampler=r))});return e._texturesPromises.push(u),c}function GWe(e,t,n,i,o){const r=new TWe,s=A(n.extensions,A.EMPTY_OBJECT),a=s.KHR_materials_pbrSpecularGlossiness,c=n.pbrMetallicRoughness;if(r.unlit=l(s.KHR_materials_unlit),l(a)){const u=new CWe;r.specularGlossiness=u,l(a.diffuseTexture)&&(u.diffuseTexture=Jd(e,t,a.diffuseTexture,i,o)),l(a.specularGlossinessTexture)&&l(a.specularGlossinessTexture)&&(u.specularGlossinessTexture=Jd(e,t,a.specularGlossinessTexture,i,o)),u.diffuseFactor=ol(oe,a.diffuseFactor),u.specularFactor=ol(f,a.specularFactor),u.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(l(c)){const u=new bWe;l(c.baseColorTexture)&&(u.baseColorTexture=Jd(e,t,c.baseColorTexture,i,o)),l(c.metallicRoughnessTexture)&&(u.metallicRoughnessTexture=Jd(e,t,c.metallicRoughnessTexture,i,o)),u.baseColorFactor=ol(oe,c.baseColorFactor),u.metallicFactor=c.metallicFactor,u.roughnessFactor=c.roughnessFactor,r.metallicRoughness=u}return l(n.emissiveTexture)&&(r.emissiveTexture=Jd(e,t,n.emissiveTexture,i,o)),l(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=Jd(e,t,n.normalTexture,i,o)),l(n.occlusionTexture)&&(r.occlusionTexture=Jd(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=ol(f,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function nJ(e,t){const n=new XK;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 iJ(e,t,n,i){const o=new XK,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=ZK(r.attribute),o.positionalLabel=i,o}function oJ(e,t){const n=new JK;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 rJ(e,t,n,i){const o=new JK,r=e.featureIds;o.propertyTableId=t,o.featureCount=n,o.offset=A(r.constant,0);const s=A(r.divisor,0);return o.repeat=s===0?void 0:s,o.positionalLabel=i,o}function WWe(e,t,n,i,o,r){const s=new KK;s.featureCount=n.featureCount,s.nullFeatureId=n.nullFeatureId,s.propertyTableId=n.propertyTable,s.label=n.label,s.positionalLabel=r;const a=n.texture;s.textureReader=Jd(e,t,a,i,o,ii.NEAREST);const u=(l(a.channels)?a.channels:[0]).map(function(d){return"rgba".charAt(d)}).join("");return s.textureReader.channels=u,s}function jWe(e,t,n,i,o,r,s,a){const c=new KK,u=n.featureIds,d=u.texture;return c.featureCount=s,c.propertyTableId=i,c.textureReader=Jd(e,t,d,o,r,ii.NEAREST),c.textureReader.channels=u.channels,c.positionalLabel=a,c}function qWe(e,t,n,i,o,r){const s=new rWe,a=void 0,c=!1;for(const u in n)if(n.hasOwnProperty(u)){const d=n[u],h=V2(e,wt,u),m=tJ(e,t,d,h,a,c,i,r);s.attributes.push(m.attribute),o.attributePlans.push(m)}return s}function $We(e,t,n,i,o,r){const s=new sWe,a=new V0(s);e._primitiveLoadPlans.push(a);const c=n.material;l(c)&&(s.material=GWe(e,t,t.materials[c],o,r));const u=A(n.extensions,A.EMPTY_OBJECT);let d=!1;const h=u.CESIUM_primitive_outline;e._loadPrimitiveOutline&&l(h)&&(d=!0,a.needsOutlines=!0,a.outlineIndices=YWe(e,t,h));const m=e._loadForClassification,g=u.KHR_draco_mesh_compression;let p=!1;const y=n.attributes;if(l(y)){for(const z in y)if(y.hasOwnProperty(z)){const R=y[z],F=V2(e,wt,z),U=F.modelSemantic;if(m&&!zWe(U))continue;U===wt.FEATURE_ID&&(p=!0);const D=tJ(e,t,R,F,g,i,d,r);a.attributePlans.push(D),s.attributes.push(D.attribute)}}const b=n.targets;if(l(b)&&!m){const z=b.length;for(let R=0;R<z;++R)s.morphTargets.push(qWe(e,t,b[R],d,a,r))}const C=n.indices;if(l(C)){const z=kWe(e,t,C,g,p,d,r);l(z)&&(a.indicesPlan=z,s.indices=z.indices)}const E=u.EXT_structural_metadata,w=u.EXT_mesh_features,S=u.EXT_feature_metadata,P=l(S);l(w)?XWe(e,t,s,w,o,r):P&&KWe(e,t,s,S,o,r),l(E)?JWe(s,E):P&&QWe(e,s,S);const L=n.mode;if(m&&L!==Ze.TRIANGLES)throw new Ie("Only triangle meshes can be used for classification.");return s.primitiveType=L,s}function YWe(e,t,n){const i=n.indices;return mv(e,t,i,!1)}function XWe(e,t,n,i,o,r){let s;l(i)&&l(i.featureIds)?s=i.featureIds:s=[];for(let a=0;a<s.length;a++){const c=s[a],u=`featureId_${a}`;let d;l(c.texture)?d=WWe(e,t,c,o,r,u):l(c.attribute)?d=nJ(c,u):d=oJ(c,u),n.featureIds.push(d)}}function KWe(e,t,n,i,o,r){const s=t.extensions.EXT_feature_metadata.featureTables;let a=0;const c=i.featureIdAttributes;if(l(c)){const d=c.length;for(let h=0;h<d;++h){const m=c[h],g=m.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,b=`featureId_${a}`;a++;let C;l(m.featureIds.attribute)?C=iJ(m,p,y,b):C=rJ(m,p,y,b),n.featureIds.push(C)}}const u=i.featureIdTextures;if(l(u)){const d=u.length;for(let h=0;h<d;++h){const m=u[h],g=m.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,b=`featureId_${a}`;a++;const C=jWe(e,t,m,p,o,r,y,b);n.featureIds.push(C)}}}function JWe(e,t){l(t)&&(l(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),l(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function QWe(e,t,n){l(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function ZWe(e,t,n,i){const o=n.EXT_mesh_gpu_instancing,r=new aWe,s=o.attributes;if(l(s)){for(const d in s)if(s.hasOwnProperty(d)){const h=s[d];r.attributes.push(VWe(e,t,h,s,d,i))}}const a=A(o.extensions,A.EMPTY_OBJECT),c=n.EXT_instance_features,u=a.EXT_feature_metadata;return l(c)?eje(r,c):l(u)&&tje(t,r,u,e._sortedPropertyTableIds),r}function eje(e,t){const n=t.featureIds;for(let i=0;i<n.length;i++){const o=n[i],r=`instanceFeatureId_${i}`;let s;l(o.attribute)?s=nJ(o,r):s=oJ(o,r),e.featureIds.push(s)}}function tje(e,t,n,i){const o=e.extensions.EXT_feature_metadata.featureTables,r=n.featureIdAttributes;if(l(r)){const s=r.length;for(let a=0;a<s;++a){const c=r[a],u=c.featureTable,d=i.indexOf(u),h=o[u].count,m=`instanceFeatureId_${a}`;let g;l(c.featureIds.attribute)?g=iJ(c,d,h,m):g=rJ(c,d,h,m),t.featureIds.push(g)}}}function nje(e,t,n,i,o){const r=new lWe;r.name=n.name,r.matrix=ol(B,n.matrix),r.translation=ol(f,n.translation),r.rotation=ol(Te,n.rotation),r.scale=ol(f,n.scale);const s=A(n.extensions,A.EMPTY_OBJECT),a=s.EXT_mesh_gpu_instancing,c=s.AGI_articulations;if(l(a)){if(e._loadForClassification)throw new Ie("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=ZWe(e,t,s,o)}l(c)&&(r.articulationName=c.articulationName);const u=n.mesh;if(l(u)){const d=t.meshes[u],h=d.primitives,m=h.length;for(let b=0;b<m;++b)r.primitives.push($We(e,t,h[b],l(r.instances),i,o));const g=A(n.weights,d.weights),y=r.primitives[0].morphTargets.length;r.morphWeights=l(g)?g.slice():new Array(y).fill(0)}return r}function ije(e,t,n,i){if(!l(t.nodes))return[];let o,r;const s=t.nodes.length,a=new Array(s);for(o=0;o<s;++o){const c=nje(e,t,t.nodes[o],n,i);c.index=o,a[o]=c}for(o=0;o<s;++o){const c=t.nodes[o].children;if(l(c)){const u=c.length;for(r=0;r<u;++r)a[o].children.push(a[c[r]])}}return a}function oje(e,t,n,i){const o=new cWe,r=n.joints,s=r.length,a=new Array(s);for(let u=0;u<s;++u)a[u]=i[r[u]];o.joints=a;const c=n.inverseBindMatrices;return l(c)?o.inverseBindMatrices=mv(e,t,c):o.inverseBindMatrices=new Array(s).fill(B.IDENTITY),o}function rje(e,t,n){const i=t.skins;if(e._loadForClassification||!l(i))return[];const o=t.skins.length,r=new Array(o);for(let a=0;a<o;++a){const c=oje(e,t,t.skins[a],n);c.index=a,r[a]=c}const s=n.length;for(let a=0;a<s;++a){const c=t.nodes[a].skin;l(c)&&(n[a].skin=r[c])}return r}function sje(e,t,n,i,o,r){const s=new _p({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 aje(e,t,n){const i=new dWe,o=n.input;i.input=mv(e,t,o);const r=n.interpolation;i.interpolation=A(Hy[r],Hy.LINEAR);const s=n.output;return i.output=mv(e,t,s,!0),i}function cje(e,t){const n=new fWe,i=e.node;if(!l(i))return;n.node=t[i];const o=e.path.toUpperCase();return n.path=uWe[o],n}function lje(e,t,n){const i=new hWe,o=e.sampler;return i.sampler=t[o],i.target=cje(e.target,n),i}function uje(e,t,n,i){let o;const r=new pWe;r.name=n.name;const s=n.samplers,a=s.length,c=new Array(a);for(o=0;o<a;o++){const m=aje(e,t,s[o]);m.index=o,c[o]=m}const u=n.channels,d=u.length,h=new Array(d);for(o=0;o<d;o++)h[o]=lje(u[o],c,i);return r.samplers=c,r.channels=h,r}function dje(e,t,n){const i=t.animations;if(e._loadForClassification||!l(i))return[];const o=t.animations.length,r=new Array(o);for(let s=0;s<o;++s){const a=uje(e,t,t.animations[s],n);a.index=s,r[s]=a}return r}function fje(e){const t=new mWe;t.name=e.name;const n=e.type.toUpperCase();return t.type=Hl[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function hje(e){const t=new _We;t.name=e.name;const n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){const s=fje(n[r]);o[r]=s}return t.stages=o,t}function pje(e){const n=A(e.extensions,A.EMPTY_OBJECT).AGI_articulations;if(!l(n))return[];const i=n.articulations;if(!l(i))return[];const o=i.length,r=new Array(o);for(let s=0;s<o;s++){const a=hje(i[s]);r[s]=a}return r}function mje(e){let t;return l(e.scenes)&&l(e.scene)&&(t=e.scenes[e.scene].nodes),t=A(t,e.nodes),t=l(t)?t:[],t}function _je(e,t){const n=new yWe,i=mje(e);return n.nodes=i.map(function(o){return t[o]}),n}const gje=new f;function yje(e,t,n,i,o,r){const s=t.asset.version;if(s!=="1.0"&&s!=="2.0"){const P=e._gltfResource.url;throw new Ie(`Failed to load ${P}:
|
||
Unsupported glTF version: ${s}`)}const a=t.extensionsRequired;l(a)&&(en.checkSupportedExtensions(a),e._hasKhrMeshQuantization=a.includes("KHR_mesh_quantization"));const c=A(t.extensions,A.EMPTY_OBJECT),u=c.EXT_structural_metadata,d=c.EXT_feature_metadata,h=c.CESIUM_RTC;if(l(d)){const P=d.featureTables,L=d.featureTextures,z=l(P)?P:[],R=l(L)?L:[];e._sortedPropertyTableIds=Object.keys(z).sort(),e._sortedFeatureTextureIds=Object.keys(R).sort()}const m=ije(e,t,n,i),g=rje(e,t,m),p=dje(e,t,m),y=pje(t),b=_je(t,m),C=new AWe,E=new gWe,w=t.asset.copyright;if(l(w)){const P=w.split(";").map(function(L){return new ai(L.trim())});E.credits=P}if(C.asset=E,C.scene=b,C.nodes=m,C.skins=g,C.animations=p,C.articulations=y,C.upAxis=e._upAxis,C.forwardAxis=e._forwardAxis,l(h)){const P=f.fromArray(h.center,0,gje);C.transform=B.fromTranslation(P,C.transform)}if(e._components=C,l(u)||l(d)){const L=sje(e,t,u,d,n,i).promise.then(function(z){e.isDestroyed()||(C.structuralMetadata=z.structuralMetadata)});e._loaderPromises.push(L)}const S=[];S.push.apply(S,e._loaderPromises),e._incrementallyLoadTextures||S.push.apply(S,e._texturesPromises),Promise.all(S).then(function(){e.isDestroyed()||(e._state=bo.POST_PROCESSING)}).catch(o),Promise.all(e._texturesPromises).then(function(){e.isDestroyed()||(e._textureState=bo.PROCESSED)}).catch(r)}function Aje(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)yt.unload(t[i]);e._textureLoaders.length=0}function sJ(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)yt.unload(t[i]);e._bufferViewLoaders.length=0}function bje(e){const t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)yt.unload(t[i]);e._geometryLoaders.length=0}function Cje(e){const t=e._postProcessBuffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}function Tje(e){l(e._structuralMetadataLoader)&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}ou.prototype.isUnloaded=function(){return this._state===bo.UNLOADED};ou.prototype.unload=function(){l(this._gltfJsonLoader)&&yt.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,Aje(this),sJ(this),bje(this),Cje(this),Tje(this),this._components=void 0,this._typedArray=void 0,this._state=bo.UNLOADED};const Eje=`#extension GL_EXT_frag_depth : enable
|
||
|
||
uniform sampler2D u_pointCloud_colorGBuffer;
|
||
uniform sampler2D u_pointCloud_depthGBuffer;
|
||
uniform vec2 u_distanceAndEdlStrength;
|
||
varying 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(texture2D(u_pointCloud_depthGBuffer, texCoord0));
|
||
float depthOrLogDepth1 = czm_unpackDepth(texture2D(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(texture2D(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 = texture2D(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;
|
||
gl_FragColor = vec4(color);
|
||
|
||
// Input and output depth are the same.
|
||
gl_FragDepthEXT = depthOrLogDepth;
|
||
}
|
||
`;function im(){this._framebuffer=new Ln({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(im.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 xje(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}const tO=new j;function wje(e,t){const n=new We({defines:["LOG_DEPTH_WRITE"],sources:[Eje]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return tO.x=e._radius,tO.y=e._strength,tO}},o=et.fromCache({blending:Gi.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:Rt.setCesium3DTileBit(),stencilMask:Rt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:Ne.CESIUM_3D_TILE,owner:e}),e._clearCommand=new co({framebuffer:e.framebuffer,color:new H(0,0,0,0),depth:1,renderState:et.fromCache(),pass:Ne.CESIUM_3D_TILE,owner:e})}function Sje(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),wje(e,t)}function aJ(e){return e.drawBuffers&&e.fragmentDepth}im.isSupported=aJ;function vje(e,t){let n=e.shaderCache.getDerivedShaderProgram(t,"EC");if(!l(n)){const i=t._attributeLocations,o=t.fragmentShaderSource.clone();o.sources=o.sources.map(function(r){return r=We.replaceMain(r,"czm_point_cloud_post_process_main"),r=r.replace(/gl_FragColor/g,"gl_FragData[0]"),r}),o.sources.unshift(`#extension GL_EXT_draw_buffers : enable
|
||
`),o.sources.push(`void main()
|
||
{
|
||
czm_point_cloud_post_process_main();
|
||
#ifdef LOG_DEPTH
|
||
czm_writeLogDepth();
|
||
gl_FragData[1] = czm_packDepth(gl_FragDepthEXT);
|
||
#else
|
||
gl_FragData[1] = czm_packDepth(gl_FragCoord.z);
|
||
#endif
|
||
}`),n=e.shaderCache.createDerivedShaderProgram(t,"EC",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}im.prototype.update=function(e,t,n,i){if(!aJ(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,Sje(this,e.context);let o;const r=e.commandList,s=r.length;for(o=t;o<s;++o){const u=r[o];if(u.primitiveType!==Ze.POINTS||u.pass===Ne.TRANSLUCENT)continue;let d,h,m=u.derivedCommands.pointCloudProcessor;l(m)&&(d=m.command,h=m.originalShaderProgram),(!l(d)||u.dirty||h!==u.shaderProgram||d.framebuffer!==this.framebuffer)&&(d=mt.shallowClone(u,d),d.framebuffer=this.framebuffer,d.shaderProgram=vje(e.context,u.shaderProgram),d.castShadows=!1,d.receiveShadows=!1,l(m)||(m={command:d,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=m),m.originalShaderProgram=u.shaderProgram),r[o]=d}const a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)};im.prototype.isDestroyed=function(){return!1};im.prototype.destroy=function(){return xje(this),He(this)};function zT(e){const t=A(e,{});this.attenuation=A(t.attenuation,!1),this.geometricErrorScale=A(t.geometricErrorScale,1),this.maximumAttenuation=t.maximumAttenuation,this.baseResolution=t.baseResolution,this.eyeDomeLighting=A(t.eyeDomeLighting,!0),this.eyeDomeLightingStrength=A(t.eyeDomeLightingStrength,1),this.eyeDomeLightingRadius=A(t.eyeDomeLightingRadius,1),this.backFaceCulling=A(t.backFaceCulling,!1),this.normalShading=A(t.normalShading,!0)}zT.isSupported=function(e){return im.isSupported(e.context)};const vy={};vy._deprecationWarning=$p;const qd=Uint32Array.BYTES_PER_ELEMENT;vy.parse=function(e,t){const n=A(t,0);T.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=qd;const r=o.getUint32(t,!0);if(r!==1)throw new Ie(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=qd;const s=o.getUint32(t,!0);t+=qd;let a=o.getUint32(t,!0);t+=qd;let c=o.getUint32(t,!0);t+=qd;let u=o.getUint32(t,!0);t+=qd;let d=o.getUint32(t,!0);t+=qd;let h;u>=570425344?(t-=qd*2,h=a,u=c,d=0,a=0,c=0,vy._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.")):d>=570425344&&(t-=qd,h=u,u=a,d=c,a=0,c=0,vy._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 m;a===0?m={BATCH_LENGTH:A(h,0)}:(m=Ya(i,t,a),t+=a);const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=Ya(i,t,u),t+=u,d>0&&(y=new Uint8Array(e,t,d),y=new Uint8Array(y),t+=d));const b=n+s-t;if(b===0)throw new Ie("glTF byte length must be greater than 0.");let C;return t%4===0?C=new Uint8Array(e,t,b):(vy._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),C=new Uint8Array(i.subarray(t,t+b))),{batchLength:h,featureTableJson:m,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:C}};const Dje=vy;function om(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function cJ(e,t,n,i,o,r){const s=e._cachedTypedArrays;let a=s[t];return l(a)||(a=ee.createArrayBufferView(n,e.buffer.buffer,e.buffer.byteOffset+r,o*i),s[t]=a),a}function Ije(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return l(r)||(r=ee.createTypedArray(n,i),o[t]=r),r}om.prototype.getGlobalProperty=function(e,t,n){const i=this.json[e];if(l(i))return l(i.byteOffset)?(t=A(t,ee.UNSIGNED_INT),n=A(n,1),cJ(this,e,t,n,1,i.byteOffset)):i};om.prototype.hasProperty=function(e){return l(this.json[e])};om.prototype.getPropertyArray=function(e,t,n){const i=this.json[e];if(l(i))return l(i.byteOffset)?(l(i.componentType)&&(t=ee.fromName(i.componentType)),cJ(this,e,t,n,this.featuresLength,i.byteOffset)):Ije(this,e,t,i)};om.prototype.getProperty=function(e,t,n,i,o){const r=this.json[e];if(!l(r))return;const 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};function hg(e){T.typeOf.number("options.count",e.count),T.typeOf.object("options.batchTable",e.batchTable);const t=e.count,n=e.batchTable,i=e.binaryBody,o=A(e.parseAsPropertyAttributes,!1),r=e.customAttributeOutput;if(o&&!l(r))throw new x("customAttributeOutput is required when parsing batch table as property attributes");const s=Pje(n);let a;l(s.jsonProperties)&&(a=new fg({count:t,properties:s.jsonProperties}));let c;l(s.hierarchy)&&(c=new vd({extension:s.hierarchy,binaryBody:i}));const u=Bp.BATCH_TABLE_CLASS_NAME,d=s.binaryProperties;let h,m,g;if(o){const b=Lje(t,u,d,i,r);g=b.transcodedSchema,m=[new WD({propertyAttribute:b.propertyAttributeJson,class:b.transcodedClass})]}else{const b=Oje(t,u,d,i);g=b.transcodedSchema;const C=b.featureTableJson;h=new Ma({count:C.count,properties:C.properties,class:b.transcodedClass,bufferViews:b.bufferViewsTypedArrays}),m=[]}const p=[];if(l(h)||l(a)||l(c)){const b=new Er({id:0,name:"Batch Table",count:t,metadataTable:h,jsonMetadataTable:a,batchTableHierarchy:c});p.push(b)}const y={schema:g,propertyTables:p,propertyAttributes:m,extensions:s.extensions,extras:s.extras};return new vu(y)}function Pje(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let o;l(t)?(hg._deprecationWarning("batchTableHierarchyExtension","The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."),o=t):l(i)&&(o=i["3DTILES_batch_table_hierarchy"]);let r;const s={};for(const a in e){if(!e.hasOwnProperty(a)||a==="HIERARCHY"||a==="extensions"||a==="extras")continue;const c=e[a];Array.isArray(c)?(r=l(r)?r:{},r[a]=c):s[a]=c}return{binaryProperties:s,jsonProperties:r,hierarchy:o,extras:n,extensions:i}}function Oje(e,t,n,i){const o={},r={},s={};let a=0;for(const h in n){if(!n.hasOwnProperty(h))continue;if(!l(i))throw new Ie(`Property ${h} requires a batch table binary.`);const m=n[h],g=p_(m);r[h]={bufferView:a},o[h]=lJ(m),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+m.byteOffset,e),a++}const c={classes:{}};c.classes[t]={properties:o};const u=Rp.fromJson(c);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:u,transcodedClass:u.classes[t]}}function Lje(e,t,n,i,o){const r={},s={};let a=0;for(const h in n){if(!n.hasOwnProperty(h))continue;const m=n[h];if(!l(i)&&!l(m.typedArray))throw new Ie(`Property ${h} requires a batch table binary.`);let g=en.sanitizeGlslIdentifier(h);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);const p=lJ(m);p.name=h,r[g]=p;let y=g.toUpperCase();y.startsWith("_")||(y=`_${y}`);let b=m.typedArray;l(b)||(b=p_(m).createArrayBufferView(i.buffer,i.byteOffset+m.byteOffset,e));const C=new Ot.Attribute;C.name=y,C.count=e,C.type=m.type;const E=ee.fromTypedArray(b);(E===ee.INT||E===ee.UNSIGNED_INT||E===ee.DOUBLE)&&(hg._oneTimeWarning("Cast pnts property to floats",`Point cloud property "${y}" will be cast to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`),b=new Float32Array(b)),C.componentDatatype=ee.fromTypedArray(b),C.typedArray=b,o.push(C),s[g]={attribute:y}}const c={classes:{}};c.classes[t]={properties:r};const u=Rp.fromJson(c);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:u,transcodedClass:u.classes[t]}}function lJ(e){const t=Bje(e.componentType);return{type:e.type,componentType:t}}function Bje(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"}}hg._deprecationWarning=$p;hg._oneTimeWarning=ki;const y_={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Rje=Ot.FeatureIdAttribute;function gp(e){e=A(e,A.EMPTY_OBJECT);const t=e.b3dmResource;let n=e.baseResource;const i=e.arrayBuffer,o=A(e.byteOffset,0),r=A(e.releaseGltfJson,!1),s=A(e.asynchronous,!0),a=A(e.incrementallyLoadTextures,!0),c=A(e.upAxis,cs.Y),u=A(e.forwardAxis,cs.X),d=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadAttributesFor2D,!1),m=A(e.loadIndicesForWireframe,!1),g=A(e.loadPrimitiveOutline,!0),p=A(e.loadForClassification,!1);T.typeOf.object("options.b3dmResource",t),T.typeOf.object("options.arrayBuffer",i),n=l(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=u,this._loadAttributesAsTypedArray=d,this._loadAttributesFor2D=h,this._loadIndicesForWireframe=m,this._loadPrimitiveOutline=g,this._loadForClassification=p,this._state=y_.UNLOADED,this._promise=void 0,this._gltfLoader=void 0,this._batchLength=0,this._propertyTable=void 0,this._batchTable=void 0,this._components=void 0,this._transform=B.IDENTITY}l(Object.create)&&(gp.prototype=Object.create(mr.prototype),gp.prototype.constructor=gp);Object.defineProperties(gp.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});gp.prototype.load=function(){const e=Dje.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new om(n,i);t=s.getGlobalProperty("BATCH_LENGTH"),this._batchLength=t;const a=s.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(a)&&(this._transform=B.fromTranslation(f.fromArray(a))),this._batchTable={json:o,binary:r};const c=new ou({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=y_.LOADING;const u=this;return c.load(),this._promise=c.promise.then(function(){if(u.isDestroyed())return;const d=c.components;return d.transform=B.multiplyTransformation(u._transform,d.transform,d.transform),Mje(u,d),u._components=d,u._arrayBuffer=void 0,u._state=y_.READY,u}).catch(function(d){if(!u.isDestroyed())return Nje(u,d)}),this._promise};function Nje(e,t){e.unload(),e._state=y_.FAILED;const n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}gp.prototype.process=function(e){T.typeOf.object("frameState",e),this._state===y_.LOADING&&(this._state=y_.PROCESSING),this._state===y_.PROCESSING&&this._gltfLoader.process(e)};function Mje(e,t){const n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(l(n.json))o=hg({count:i,batchTable:n.json,binaryBody:n.binary});else{const a=new Er({name:Bp.BATCH_TABLE_CLASS_NAME,count:i});o=new vu({schema:{},propertyTables:[a]})}const r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)uJ(r[a]);t.structuralMetadata=o}function uJ(e){const t=e.children.length;for(let i=0;i<t;i++)uJ(e.children[i]);const n=e.primitives.length;for(let i=0;i<n;i++){const o=e.primitives[i],r=en.getAttributeBySemantic(o,wt.FEATURE_ID);if(l(r)){r.setIndex=0;const s=new Rje;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}gp.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};function yp(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.geoJson",e.geoJson),this._geoJson=e.geoJson,this._promise=void 0,this._process=function(t,n){},this._components=void 0}l(Object.create)&&(yp.prototype=Object.create(mr.prototype),yp.prototype.constructor=yp);Object.defineProperties(yp.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});yp.prototype.load=function(){const e=this,t=new Promise(function(n){e._process=function(i,o){l(i._components)||(i._components=Xje(i._geoJson,o),i._geoJson=void 0,n(i))}});return this._promise=t,t};yp.prototype.process=function(e){T.typeOf.object("frameState",e),this._process(this,e)};function Fje(){this.lines=void 0,this.points=void 0,this.properties=void 0}function zje(){this.features=[]}function k2(e){const t=e[0],n=e[1],i=A(e[2],0);return new f(t,n,i)}function G2(e){const t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=k2(e[o]);return[n]}function Uje(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=G2(e[i])[0];return n}function dJ(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=G2(e[i])[0];return n}function Hje(e){const t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,dJ(e[i]));return n}function Vje(e){return[k2(e)]}function kje(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=k2(e[i]);return n}const Gje={LineString:G2,MultiLineString:Uje,MultiPolygon:Hje,Polygon:dJ,MultiPoint:kje,Point:Vje},Wje={LineString:Ze.LINES,MultiLineString:Ze.LINES,MultiPolygon:Ze.LINES,Polygon:Ze.LINES,MultiPoint:Ze.POINTS,Point:Ze.POINTS};function fJ(e,t){if(!l(e.geometry))return;const n=e.geometry.type,i=Gje[n],o=Wje[n],r=e.geometry.coordinates;if(!l(i)||!l(r))return;const s=new Fje;o===Ze.LINES?s.lines=i(r):o===Ze.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function jje(e,t){const n=e.features,i=n.length;for(let o=0;o<i;o++)fJ(n[o],t)}const qje={FeatureCollection:jje,Feature:fJ},_v=new f;function $je(e,t,n){let i=0,o=0;const r=e.length;for(let F=0;F<r;F++){const U=e[F];if(l(U.lines)){const D=U.lines.length;for(let I=0;I<D;I++){const _=U.lines[I];i+=_.length,o+=(_.length-1)*2}}}const s=new Float32Array(i*3),a=new Float32Array(i),c=at.createTypedArray(i,o),u=at.fromTypedArray(c),d=new f(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new f(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let m=0,g=0;for(let F=0;F<r;F++){const U=e[F];if(!l(U.lines))continue;const D=U.lines.length;for(let I=0;I<D;I++){const _=U.lines[I],v=_.length;for(let O=0;O<v;O++){const N=_[O],V=f.fromDegrees(N.x,N.y,N.z,me.WGS84,_v),k=B.multiplyByPoint(t,V,_v);f.minimumByComponent(d,k,d),f.maximumByComponent(h,k,h),f.pack(k,s,m*3),a[m]=F,O<v-1&&(c[g*2]=m,c[g*2+1]=m+1,g++),m++}}}const p=Tt.createVertexBuffer({typedArray:s,context:n.context,usage:nt.STATIC_DRAW});p.vertexArrayDestroyable=!1;const y=Tt.createVertexBuffer({typedArray:a,context:n.context,usage:nt.STATIC_DRAW});y.vertexArrayDestroyable=!1;const b=Tt.createIndexBuffer({typedArray:c,context:n.context,usage:nt.STATIC_DRAW,indexDatatype:u});b.vertexArrayDestroyable=!1;const C=new Ot.Attribute;C.semantic=wt.POSITION,C.componentDatatype=ee.FLOAT,C.type=_n.VEC3,C.count=i,C.min=d,C.max=h,C.buffer=p;const E=new Ot.Attribute;E.semantic=wt.FEATURE_ID,E.setIndex=0,E.componentDatatype=ee.FLOAT,E.type=_n.SCALAR,E.count=i,E.buffer=y;const w=[C,E],S=new Ot.Material;S.unlit=!0;const P=new Ot.Indices;P.indexDatatype=u,P.count=c.length,P.buffer=b;const L=new Ot.FeatureIdAttribute;L.featureCount=r,L.propertyTableId=0,L.setIndex=0,L.positionalLabel="featureId_0";const z=[L],R=new Ot.Primitive;return R.attributes=w,R.indices=P,R.featureIds=z,R.primitiveType=Ze.LINES,R.material=S,R}function Yje(e,t,n){let i=0;const o=e.length;for(let w=0;w<o;w++){const S=e[w];l(S.points)&&(i+=S.points.length)}const r=new Float32Array(i*3),s=new Float32Array(i),a=new f(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),c=new f(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let u=0;for(let w=0;w<o;w++){const S=e[w];if(!l(S.points))continue;const P=S.points.length;for(let L=0;L<P;L++){const z=S.points[L],R=f.fromDegrees(z.x,z.y,z.z,me.WGS84,_v),F=B.multiplyByPoint(t,R,_v);f.minimumByComponent(a,F,a),f.maximumByComponent(c,F,c),f.pack(F,r,u*3),s[u]=w,u++}}const d=Tt.createVertexBuffer({typedArray:r,context:n.context,usage:nt.STATIC_DRAW});d.vertexArrayDestroyable=!1;const h=Tt.createVertexBuffer({typedArray:s,context:n.context,usage:nt.STATIC_DRAW});h.vertexArrayDestroyable=!1;const m=new Ot.Attribute;m.semantic=wt.POSITION,m.componentDatatype=ee.FLOAT,m.type=_n.VEC3,m.count=i,m.min=a,m.max=c,m.buffer=d;const g=new Ot.Attribute;g.semantic=wt.FEATURE_ID,g.setIndex=0,g.componentDatatype=ee.FLOAT,g.type=_n.SCALAR,g.count=i,g.buffer=h;const p=[m,g],y=new Ot.Material;y.unlit=!0;const b=new Ot.FeatureIdAttribute;b.featureCount=o,b.propertyTableId=0,b.setIndex=0,b.positionalLabel="featureId_0";const C=[b],E=new Ot.Primitive;return E.attributes=p,E.featureIds=C,E.primitiveType=Ze.POINTS,E.material=y,E}function Xje(e,t){const n=new zje,i=qje[e.type];l(i)&&i(e,n);const o=n.features,r=o.length;if(r===0)throw new Ie("GeoJSON must have at least one feature");const s={};for(let F=0;F<r;F++){const U=o[F],D=A(U.properties,A.EMPTY_OBJECT);for(const I in D)D.hasOwnProperty(I)&&(l(s[I])||(s[I]=new Array(r)))}for(let F=0;F<r;F++){const U=o[F];for(const D in s)if(s.hasOwnProperty(D)){const I=A(U.properties[D],"");s[D][F]=I}}const a=new fg({count:r,properties:s}),u=[new Er({id:0,count:r,jsonMetadataTable:a})],d=Rp.fromJson({}),h=new vu({schema:d,propertyTables:u}),m=new f(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new f(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let p=!1,y=!1;for(let F=0;F<r;F++){const U=o[F];if(l(U.lines)){p=!0;const D=U.lines.length;for(let I=0;I<D;I++){const _=U.lines[I],v=_.length;for(let O=0;O<v;O++)f.minimumByComponent(m,_[O],m),f.maximumByComponent(g,_[O],g)}}if(l(U.points)){y=!0;const D=U.points.length;for(let I=0;I<D;I++){const _=U.points[I];f.minimumByComponent(m,_,m),f.maximumByComponent(g,_,g)}}}const b=f.midpoint(m,g,new f),C=f.fromDegrees(b.x,b.y,b.z,me.WGS84,new f),E=cn.eastNorthUpToFixedFrame(C,me.WGS84,new B),w=B.inverseTransformation(E,new B),S=[];p&&S.push($je(o,w,t)),y&&S.push(Yje(o,w,t));const P=new Ot.Node;P.index=0,P.primitives=S;const L=[P],z=new Ot.Scene;z.nodes=L;const R=new Ot.Components;return R.scene=z,R.nodes=L,R.transform=E,R.structuralMetadata=h,R}yp.prototype.unload=function(){this._components=void 0};const gv={};gv._deprecationWarning=$p;const wh=Uint32Array.BYTES_PER_ELEMENT;gv.parse=function(e,t){T.defined("arrayBuffer",e);const n=A(t,0);t=n;const i=new Uint8Array(e),o=new DataView(e);t+=wh;const r=o.getUint32(t,!0);if(r!==1)throw new Ie(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=wh;const s=o.getUint32(t,!0);t+=wh;const a=o.getUint32(t,!0);if(a===0)throw new Ie("featureTableJsonByteLength is zero, the feature table must be defined.");t+=wh;const c=o.getUint32(t,!0);t+=wh;const u=o.getUint32(t,!0);t+=wh;const d=o.getUint32(t,!0);t+=wh;const h=o.getUint32(t,!0);if(h!==1&&h!==0)throw new Ie(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${h} is not.`);t+=wh;const m=Ya(i,t,a);t+=a;const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=Ya(i,t,u),t+=u,d>0&&(y=new Uint8Array(e,t,d),y=new Uint8Array(y),t+=d));const b=n+s-t;if(b===0)throw new Ie("glTF byte length must be greater than 0.");let C;return t%4===0?C=new Uint8Array(e,t,b):(gv._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),C=new Uint8Array(i.subarray(t,t+b))),{gltfFormat:h,featureTableJson:m,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:C}};const Kje=gv,Ql={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},Vx=Ot.Attribute,Jje=Ot.FeatureIdAttribute,hJ=Ot.Instances;function xf(e){e=A(e,A.EMPTY_OBJECT);const t=e.i3dmResource,n=e.arrayBuffer;let i=e.baseResource;const o=A(e.byteOffset,0),r=A(e.releaseGltfJson,!1),s=A(e.asynchronous,!0),a=A(e.incrementallyLoadTextures,!0),c=A(e.upAxis,cs.Y),u=A(e.forwardAxis,cs.X),d=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadIndicesForWireframe,!1),m=A(e.loadPrimitiveOutline,!0);T.typeOf.object("options.i3dmResource",t),T.typeOf.object("options.arrayBuffer",n),i=l(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=u,this._loadAttributesAsTypedArray=d,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=m,this._state=Ql.NOT_LOADED,this._promise=void 0,this._gltfLoader=void 0,this._gltfLoaderPromise=void 0,this._process=function(g,p){},this._postProcess=function(g,p){},this._buffers=[],this._components=void 0,this._transform=B.IDENTITY,this._batchTable=void 0,this._featureTable=void 0,this._instancesLength=0}l(Object.create)&&(xf.prototype=Object.create(mr.prototype),xf.prototype.constructor=xf);Object.defineProperties(xf.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});xf.prototype.load=function(){const e=Kje.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new om(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!l(a))throw new Ie("Feature table global property: INSTANCES_LENGTH must be defined");this._instancesLength=a;const c=s.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(c)&&(this._transform=B.fromTranslation(f.fromArray(c))),this._batchTable={json:i,binary:o};const u={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=lc(e.gltf);g=g.replace(/[\s\0]+$/,"");const p=this._baseResource.getDerivedResource({url:g});u.gltfResource=p,u.baseResource=p}else u.gltfResource=this._i3dmResource,u.typedArray=e.gltf;const d=new ou(u);this._gltfLoader=d,this._state=Ql.LOADING,d.load();const h=this,m=new Promise(function(g){h._process=function(p,y){p._gltfLoader.process(y)},h._postProcess=function(p,y){const C=p._gltfLoader.components;C.transform=B.multiplyTransformation(p._transform,C.transform,C.transform),tqe(p,C,y),Zje(p,C),p._components=C,p._arrayBuffer=void 0,p._state=Ql.READY,g(p)}});return this._promise=d.promise.then(function(){if(!h.isDestroyed())return h._state=Ql.POST_PROCESSING,m}).catch(function(g){if(!h.isDestroyed())return Qje(h,g)}),this._promise};function Qje(e,t){e.unload(),e._state=Ql.FAILED;const n="Failed to load i3dm";return t=e.getError(n,t),Promise.reject(t)}xf.prototype.process=function(e){T.typeOf.object("frameState",e),this._state===Ql.LOADING&&(this._state=Ql.PROCESSING),this._state===Ql.PROCESSING&&this._process(this,e),this._state===Ql.POST_PROCESSING&&this._postProcess(this,e)};function Zje(e,t){const n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(l(n.json))o=hg({count:i,batchTable:n.json,binaryBody:n.binary});else{const r=new Er({name:Bp.BATCH_TABLE_CLASS_NAME,count:i});o=new vu({schema:{},propertyTables:[r]})}t.structuralMetadata=o}const kx=new f,yR=new Array(4),eqe=new B;function tqe(e,t,n){let i;const o=e._featureTable,r=e._instancesLength;if(r===0)return;const s=o.getGlobalProperty("RTC_CENTER",ee.FLOAT,3),a=o.getGlobalProperty("EAST_NORTH_UP"),c=o.hasProperty("NORMAL_UP")||o.hasProperty("NORMAL_UP_OCT32P")||a,u=o.hasProperty("SCALE")||o.hasProperty("SCALE_NON_UNIFORM"),d=iqe(o);let h;c&&(h=new Float32Array(4*r));let m;u&&(m=new Float32Array(3*r));const g=new Float32Array(r),p=f.unpackArray(d);let y=new f;const b=new f,C=new f,E=new f,w=new J,S=new Te,P=new Array(4),L=new f,z=new Array(3),R=new B;if(!l(s)){const k=fe.fromPoints(p);for(i=0;i<p.length;i++)f.subtract(p[i],k.center,kx),d[3*i+0]=kx.x,d[3*i+1]=kx.y,d[3*i+2]=kx.z;const G=B.fromTranslation(k.center,eqe);t.transform=B.multiplyTransformation(G,t.transform,t.transform)}for(i=0;i<r;i++){y=f.clone(p[i]),l(s)&&f.add(y,f.unpack(s),y),c&&(oqe(o,a,i,S,y,C,b,E,w,R),Te.pack(S,P,0),h[4*i+0]=P[0],h[4*i+1]=P[1],h[4*i+2]=P[2],h[4*i+3]=P[3]),u&&(rqe(o,i,L),f.pack(L,z,0),m[3*i+0]=z[0],m[3*i+1]=z[1],m[3*i+2]=z[2]);let k=o.getProperty("BATCH_ID",ee.UNSIGNED_SHORT,1,i);l(k)||(k=i),g[i]=k}const F=new hJ;F.transformInWorldSpace=!0;const U=e._buffers,D=new Vx;if(D.name="Instance Translation",D.semantic=ta.TRANSLATION,D.componentDatatype=ee.FLOAT,D.type=_n.VEC3,D.count=r,D.typedArray=d,!c){const k=Tt.createVertexBuffer({context:n.context,typedArray:d,usage:nt.STATIC_DRAW});k.vertexArrayDestroyable=!1,U.push(k),D.buffer=k}if(F.attributes.push(D),c){const k=new Vx;k.name="Instance Rotation",k.semantic=ta.ROTATION,k.componentDatatype=ee.FLOAT,k.type=_n.VEC4,k.count=r,k.typedArray=h,F.attributes.push(k)}if(u){const k=new Vx;if(k.name="Instance Scale",k.semantic=ta.SCALE,k.componentDatatype=ee.FLOAT,k.type=_n.VEC3,k.count=r,c)k.typedArray=m;else{const G=Tt.createVertexBuffer({context:n.context,typedArray:m,usage:nt.STATIC_DRAW});G.vertexArrayDestroyable=!1,U.push(G),k.buffer=G}F.attributes.push(k)}const I=new Vx;I.name="Instance Feature ID",I.setIndex=0,I.semantic=ta.FEATURE_ID,I.componentDatatype=ee.FLOAT,I.type=_n.SCALAR,I.count=r;const _=Tt.createVertexBuffer({context:n.context,typedArray:g,usage:nt.STATIC_DRAW});_.vertexArrayDestroyable=!1,U.push(_),I.buffer=_,F.attributes.push(I);const v=new Jje;v.propertyTableId=0,v.setIndex=0,v.positionalLabel="instanceFeatureId_0",F.featureIds.push(v);const O=t.nodes,N=O.length;let V=!1;for(i=0;i<N;i++){const k=O[i];k.primitives.length>0&&(k.instances=V?nqe(F):F,V=!0)}}function nqe(e){const t=new hJ;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=ht(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function iqe(e,t){if(e.hasProperty("POSITION"))return e.getPropertyArray("POSITION",ee.FLOAT,3);if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",ee.UNSIGNED_SHORT,3),i=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ee.FLOAT,3);if(!l(i))throw new Ie("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const o=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ee.FLOAT,3);if(!l(o))throw new Ie("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const r=new Float32Array(n.length);for(let s=0;s<n.length/3;s++)for(let a=0;a<3;a++){const c=3*s+a;r[c]=n[c]/65535*o[a]+i[a]}return r}else throw new Ie("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const w5=new Array(4);function oqe(e,t,n,i,o,r,s,a,c,u){const d=e.getProperty("NORMAL_UP",ee.FLOAT,3,n,yR),h=e.getProperty("NORMAL_RIGHT",ee.FLOAT,3,n,w5);let m=!1;if(l(d)){if(!l(h))throw new Ie("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");f.unpack(d,0,r),f.unpack(h,0,s),m=!0}else{const g=e.getProperty("NORMAL_UP_OCT32P",ee.UNSIGNED_SHORT,2,n,yR),p=e.getProperty("NORMAL_RIGHT_OCT32P",ee.UNSIGNED_SHORT,2,n,w5);if(l(g)){if(!l(p))throw new Ie("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");mi.octDecodeInRange(g[0],g[1],65535,r),mi.octDecodeInRange(p[0],p[1],65535,s),m=!0}else t?(cn.eastNorthUpToFixedFrame(o,me.WGS84,u),B.getMatrix3(u,c)):J.clone(J.IDENTITY,c)}m&&(f.cross(s,r,a),f.normalize(a,a),J.setColumn(c,0,s,c),J.setColumn(c,1,r,c),J.setColumn(c,2,a,c)),Te.fromRotationMatrix(c,i)}function rqe(e,t,n){n=f.fromElements(1,1,1,n);const i=e.getProperty("SCALE",ee.FLOAT,1,t);l(i)&&f.multiplyByScalar(n,i,n);const o=e.getProperty("SCALE_NON_UNIFORM",ee.FLOAT,3,t,yR);l(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function sqe(e){const t=e._buffers,n=t.length;for(let i=0;i<n;i++){const o=t[i];o.isDestroyed()||o.destroy()}t.length=0}xf.prototype.isUnloaded=function(){return this._state===Ql.UNLOADED};xf.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),sqe(this),this._components=void 0,this._arrayBuffer=void 0,this._state=Ql.UNLOADED};const aqe={STOPPED:0,ANIMATING:1},ly=Object.freeze(aqe);function go(){this.times=void 0,this.points=void 0,x.throwInstantiationError()}go.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof f)return f;if(e instanceof Te)return Te;throw new x("point must be a Cartesian3, Quaternion, or Number.")};go.prototype.evaluate=x.throwInstantiationError;go.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(T.typeOf.number("time",e),e<n[0]||e>n[i-1])throw new x("time is out of range.");if(t=A(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};go.prototype.wrapTime=function(e){T.typeOf.number("time",e);const t=this.times,n=t[t.length-1],i=t[0],o=n-i;let 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};go.prototype.clampTime=function(e){T.typeOf.number("time",e);const t=this.times;return M.clamp(e,t[0],t[t.length-1])};function k0(e){this._value=e,this._valueType=go.getPointType(e)}Object.defineProperties(k0.prototype,{value:{get:function(){return this._value}}});k0.prototype.findTimeInterval=function(e){throw new x("findTimeInterval cannot be called on a ConstantSpline.")};k0.prototype.wrapTime=function(e){return T.typeOf.number("time",e),0};k0.prototype.clampTime=function(e){return T.typeOf.number("time",e),0};k0.prototype.evaluate=function(e,t){T.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};function rm(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new x("points and times are required.");if(t.length<2)throw new x("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new x("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=go.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(rm.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});rm.prototype.findTimeInterval=go.prototype.findTimeInterval;rm.prototype.wrapTime=go.prototype.wrapTime;rm.prototype.clampTime=go.prototype.clampTime;rm.prototype.evaluate=function(e,t){const 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]:(l(t)||(t=new f),f.lerp(n[o],n[o+1],r,t))};const pJ={};pJ.solve=function(e,t,n,i){if(!l(e)||!(e instanceof Array))throw new x("The array lower is required.");if(!l(t)||!(t instanceof Array))throw new x("The array diagonal is required.");if(!l(n)||!(n instanceof Array))throw new x("The array upper is required.");if(!l(i)||!(i instanceof Array))throw new x("The array right is required.");if(t.length!==i.length)throw new x("diagonal and right must have the same lengths.");if(e.length!==n.length)throw new x("lower and upper must have the same lengths.");if(e.length!==t.length-1)throw new x("lower and upper must be one less than the length of diagonal.");const o=new Array(n.length),r=new Array(i.length),s=new Array(i.length);let a;for(a=0;a<r.length;a++)r[a]=new f,s[a]=new f;o[0]=n[0]/t[0],r[0]=f.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]=f.subtract(i[a],f.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=f.multiplyByScalar(r[a],c,r[a]);for(c=1/(t[a]-o[a-1]*e[a-1]),r[a]=f.subtract(i[a],f.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=f.multiplyByScalar(r[a],c,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=f.subtract(r[a],f.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};const mJ=pJ,_J=[],gJ=[],yJ=[],AJ=[];function cqe(e,t,n){const i=_J,o=yJ,r=gJ,s=AJ;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(l(c)||(c=s[0]=new f),f.clone(t,c),a=1;a<i.length-1;++a)i[a]=o[a]=1,r[a]=4,c=s[a],l(c)||(c=s[a]=new f),f.subtract(e[a+1],e[a-1],c),f.multiplyByScalar(c,3,c);return i[a]=0,o[a]=1,r[a]=4,c=s[a],l(c)||(c=s[a]=new f),f.subtract(e[a+1],e[a-1],c),f.multiplyByScalar(c,3,c),r[a+1]=1,c=s[a+1],l(c)||(c=s[a+1]=new f),f.clone(n,c),mJ.solve(i,r,o,s)}function lqe(e){const t=_J,n=yJ,i=gJ,o=AJ;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(l(s)||(s=o[0]=new f),f.subtract(e[1],e[0],s),f.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],l(s)||(s=o[r]=new f),f.subtract(e[r+1],e[r-1],s),f.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],l(s)||(s=o[r]=new f),f.subtract(e[r],e[r-1],s),f.multiplyByScalar(s,3,s),mJ.solve(t,i,n,o)}function Xa(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times,i=e.inTangents,o=e.outTangents;if(!l(t)||!l(n)||!l(i)||!l(o))throw new x("times, points, inTangents, and outTangents are required.");if(t.length<2)throw new x("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new x("times.length must be equal to points.length.");if(i.length!==o.length||i.length!==t.length-1)throw new x("inTangents and outTangents must have a length equal to points.length - 1.");if(this._times=n,this._points=t,this._pointType=go.getPointType(t[0]),this._pointType!==go.getPointType(i[0])||this._pointType!==go.getPointType(o[0]))throw new x("inTangents and outTangents must be of the same type as points.");this._inTangents=i,this._outTangents=o,this._lastTimeIndex=0}Object.defineProperties(Xa.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}}});Xa.createC1=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.tangents;if(!l(n)||!l(t)||!l(i))throw new x("points, times and tangents are required.");if(n.length<2)throw new x("points.length must be greater than or equal to 2.");if(t.length!==n.length||t.length!==i.length)throw new x("times, points and tangents must have the same length.");const o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Xa({times:t,points:n,inTangents:r,outTangents:o})};Xa.createNaturalCubic=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points;if(!l(n)||!l(t))throw new x("points and times are required.");if(n.length<2)throw new x("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new x("times.length must be equal to points.length.");if(n.length<3)return new rm({points:n,times:t});const i=lqe(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new Xa({times:t,points:n,inTangents:r,outTangents:o})};Xa.createClampedCubic=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.times,n=e.points,i=e.firstTangent,o=e.lastTangent;if(!l(n)||!l(t)||!l(i)||!l(o))throw new x("points, times, firstTangent and lastTangent are required.");if(n.length<2)throw new x("points.length must be greater than or equal to 2.");if(t.length!==n.length)throw new x("times.length must be equal to points.length.");const r=go.getPointType(n[0]);if(r!==go.getPointType(i)||r!==go.getPointType(o))throw new x("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new rm({points:n,times:t});const s=cqe(n,i,o),a=s.slice(0,s.length-1),c=s.slice(1,s.length);return new Xa({times:t,points:n,inTangents:c,outTangents:a})};Xa.hermiteCoefficientMatrix=new B(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);Xa.prototype.findTimeInterval=go.prototype.findTimeInterval;const uqe=new oe,Vg=new f;Xa.prototype.wrapTime=go.prototype.wrapTime;Xa.prototype.clampTime=go.prototype.clampTime;Xa.prototype.evaluate=function(e,t){const n=this.points,i=this.times,o=this.inTangents,r=this.outTangents;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const s=this._lastTimeIndex,a=i[s+1]-i[s],c=(e-i[s])/a,u=uqe;u.z=c,u.y=c*c,u.x=u.y*c,u.w=1;const d=B.multiplyByVector(Xa.hermiteCoefficientMatrix,u,u);d.z*=a,d.w*=a;const h=this._pointType;return h===Number?n[s]*d.x+n[s+1]*d.y+r[s]*d.z+o[s]*d.w:(l(t)||(t=new h),t=h.multiplyByScalar(n[s],d.x,t),h.multiplyByScalar(n[s+1],d.y,Vg),h.add(t,Vg,t),h.multiplyByScalar(r[s],d.z,Vg),h.add(t,Vg,t),h.multiplyByScalar(o[s],d.w,Vg),h.add(t,Vg,t))};function G0(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new x("points and times are required.");if(t.length<2)throw new x("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new x("times.length must be equal to points.length.");this._times=n,this._points=t,this._pointType=go.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(G0.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});G0.prototype.findTimeInterval=go.prototype.findTimeInterval;G0.prototype.wrapTime=go.prototype.wrapTime;G0.prototype.clampTime=go.prototype.clampTime;G0.prototype.evaluate=function(e,t){const n=this.points;this._lastTimeIndex=this.findTimeInterval(e,this._lastTimeIndex);const i=this._lastTimeIndex,o=this._pointType;return o===Number?n[i]:(l(t)||(t=new o),o.clone(n[i],t))};function dqe(e){const t=e.points,n=e.times;return function(i,o){l(o)||(o=new Te);const 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 Te.fastSlerp(a,c,s,o)}}function W0(e){e=A(e,A.EMPTY_OBJECT);const t=e.points,n=e.times;if(!l(t)||!l(n))throw new x("points and times are required.");if(t.length<2)throw new x("points.length must be greater than or equal to 2.");if(n.length!==t.length)throw new x("times.length must be equal to points.length.");this._times=n,this._points=t,this._evaluateFunction=dqe(this),this._lastTimeIndex=0}Object.defineProperties(W0.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});W0.prototype.findTimeInterval=go.prototype.findTimeInterval;W0.prototype.wrapTime=go.prototype.wrapTime;W0.prototype.clampTime=go.prototype.clampTime;W0.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};const i_=Ot.AnimatedPropertyType;function W2(e){e=A(e,A.EMPTY_OBJECT);const t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;T.typeOf.object("options.channel",t),T.typeOf.object("options.runtimeAnimation",n),T.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,pqe(this)}Object.defineProperties(W2.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 fqe(e,t){const 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 Xa({times:e,points:n,inTangents:i,outTangents:o})}function S5(e,t,n,i){if(e.length===1&&t.length===1)return new k0(t[0]);switch(n){case Hy.STEP:return new G0({times:e,points:t});case Hy.CUBICSPLINE:return fqe(e,t);case Hy.LINEAR:return i===i_.ROTATION?new W0({times:e,points:t}):new rm({times:e,points:t})}}function hqe(e,t,n,i,o){const r=[];if(i===i_.WEIGHTS){const a=t.length/o;let c,u;for(c=0;c<o;c++){const d=new Array(a);let h=c;if(n===Hy.CUBICSPLINE)for(u=0;u<a;u+=3)d[u]=t[h],d[u+1]=t[h+o],d[u+2]=t[h+2*o],h+=o*3;else for(u=0;u<a;u++)d[u]=t[h],h+=o;r.push(S5(e,d,n,i))}}else r.push(S5(e,t,n,i));return r}let AR;function pqe(e){const t=e._channel,n=t.sampler,i=n.input,o=n.output,r=n.interpolation,a=t.target.path,c=e._runtimeNode,u=l(c.morphWeights)?c.morphWeights.length:1,d=hqe(i,o,r,a,u);switch(e._splines=d,e._path=a,a){case i_.TRANSLATION:case i_.SCALE:AR=new f;break;case i_.ROTATION:AR=new Te;break;case i_.WEIGHTS:break}}W2.prototype.animate=function(e){const t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===i_.WEIGHTS){const r=o.morphWeights,s=r.length;for(let a=0;a<s;a++){const c=t[a],u=i.clampAnimations?c.clampTime(e):c.wrapTime(e);r[a]=c.evaluate(u)}}else{if(o.userAnimated)return;{const r=t[0],s=i.clampAnimations?r.clampTime(e):r.wrapTime(e);o[n]=r.evaluate(s,AR)}}};function j2(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=ie.clone(n.startTime),this._delay=A(n.delay,0),this._stopTime=ie.clone(n.stopTime),this.removeOnStop=A(n.removeOnStop,!1),this._multiplier=A(n.multiplier,1),this._reverse=A(n.reverse,!1),this._loop=A(n.loop,cf.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new Ke,this.update=new Ke,this.stop=new Ke,this._state=ly.STOPPED,this._computedStartTime=void 0,this._duration=void 0;const 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,mqe(this)}Object.defineProperties(j2.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 mqe(e){let t=Number.MAX_VALUE,n=-Number.MAX_VALUE;const i=e._model.sceneGraph,r=e._animation.channels,s=r.length,a=[];for(let c=0;c<s;c++){const u=r[c],d=u.target;if(!l(d))continue;const h=d.node.index,m=i._runtimeNodes[h],g=new W2({channel:u,runtimeAnimation:e,runtimeNode:m}),p=u.sampler.input;t=Math.min(t,p[0]),n=Math.max(n,p[p.length-1]),a.push(g)}e._runtimeChannels=a,e._localStartTime=t,e._localStopTime=n}j2.prototype.animate=function(e){const t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};function Zf(e){this.animationAdded=new Ke,this.animationRemoved=new Ke,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(Zf.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function bR(e,t,n){const i=e._model,o=new j2(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}Zf.prototype.add=function(e){e=A(e,A.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new x("Animations are not loaded. Wait for Model.readyPromise to resolve.");const n=t.sceneGraph.components.animations;if(!l(e.name)&&!l(e.index))throw new x("Either options.name or options.index must be defined.");if(l(e.multiplier)&&e.multiplier<=0)throw new x("options.multiplier must be greater than zero.");if(l(e.index)&&(e.index>=n.length||e.index<0))throw new x("options.index must be a valid animation index.");let i=e.index;if(l(i))return bR(this,n[i],e);const o=n.length;for(let r=0;r<o;++r)if(n[r].name===e.name){i=r;break}if(!l(i))throw new x("options.name must be a valid animation name.");return bR(this,n[i],e)};Zf.prototype.addAll=function(e){e=A(e,A.EMPTY_OBJECT);const t=this._model;if(!t.ready)throw new x("Animations are not loaded. Wait for Model.readyPromise to resolve.");if(l(e.multiplier)&&e.multiplier<=0)throw new x("options.multiplier must be greater than zero.");const n=t.sceneGraph.components.animations,i=[],o=n.length;for(let r=0;r<o;++r){const s=bR(this,n[r],e);i.push(s)}return i};Zf.prototype.remove=function(e){if(!l(e))return!1;const t=this._runtimeAnimations,n=t.indexOf(e);return n!==-1?(t.splice(n,1),this.animationRemoved.raiseEvent(this._model,e),!0):!1};Zf.prototype.removeAll=function(){const 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])};Zf.prototype.contains=function(e){return l(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};Zf.prototype.get=function(e){if(!l(e))throw new x("index is required.");if(e>=this._runtimeAnimations.length||e<0)throw new x("index must be valid within the range of the collection");return this._runtimeAnimations[e]};const Gx=[];function _qe(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}Zf.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&ie.equals(e.time,this._previousTime))return!1;this._previousTime=ie.clone(e.time,this._previousTime);let i=!1;const o=e.time,r=this._model;for(let s=0;s<n;++s){const a=t[s];l(a._computedStartTime)||(a._computedStartTime=ie.addSeconds(A(a.startTime,o),a.delay,new ie)),l(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));const c=a._computedStartTime,u=a._duration,d=a.stopTime,h=ie.lessThanOrEquals(c,o),m=l(d)&&ie.greaterThan(o,d);let g=0;if(u!==0){const b=ie.secondsDifference(m?d:o,c);g=l(a._animationTime)?a._animationTime(u,b):b/u}const p=a.loop===cf.REPEAT||a.loop===cf.MIRRORED_REPEAT,y=(h||p&&!l(a.startTime))&&(g<=1||p)&&!m;if(g===a._prevAnimationDelta){const b=a._state===ly.STOPPED;if(y!==b)continue}if(a._prevAnimationDelta=g,y||a._state===ly.ANIMATING){if(y&&a._state===ly.STOPPED&&(a._state=ly.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===cf.REPEAT)g=g-Math.floor(g);else if(a.loop===cf.MIRRORED_REPEAT){const C=Math.floor(g),E=g-C;g=C%2===1?1-E:E}a.reverse&&(g=1-g);let b=g*u*a.multiplier;b=M.clamp(b,a.localStartTime,a.localStopTime),a.animate(b),a.update.numberOfListeners>0&&(a._updateEventTime=b,e.afterRender.push(a._raiseUpdateEvent)),i=!0,y||(a._state=ly.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&Gx.push(a))}}n=Gx.length;for(let s=0;s<n;++s){const a=Gx[s];t.splice(t.indexOf(a),1),e.afterRender.push(_qe(this,r,a))}return Gx.length=0,i};function pg(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(pg.prototype,{show:{get:function(){return this._featureTable.getShow(this._featureId)},set:function(e){this._featureTable.setShow(this._featureId,e)}},color:{get:function(){return l(this._color)||(this._color=new H),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}}});pg.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};pg.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};pg.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};pg.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};pg.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};const mb={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};mb.getStyleCommandsNeeded=function(e,t){return t===0?mb.ALL_OPAQUE:t===e?mb.ALL_TRANSLUCENT:mb.OPAQUE_AND_TRANSLUCENT};const $C=Object.freeze(mb),Vh={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};Vh.is3DTiles=function(e){switch(T.typeOf.string("modelType",e),e){case Vh.TILE_GLTF:case Vh.TILE_B3DM:case Vh.TILE_I3DM:case Vh.TILE_PNTS:case Vh.TILE_GEOJSON:return!0;case Vh.GLTF:return!1;default:throw new x("modelType is not a valid value.")}};const ha=Object.freeze(Vh);function or(e){const t=e.model,n=e.propertyTable;T.typeOf.object("propertyTable",n),T.typeOf.object("model",t),this._propertyTable=n,this._model=t,this._features=void 0,this._featuresLength=0,this._batchTexture=void 0,this._styleCommandsNeededDirty=!1,this._styleCommandsNeeded=$C.ALL_OPAQUE,gqe(this)}Object.defineProperties(or.prototype,{batchTexture:{get:function(){return this._batchTexture}},featuresLength:{get:function(){return this._featuresLength}},batchTextureByteLength:{get:function(){return l(this._batchTexture)?this._batchTexture.byteLength:0}},styleCommandsNeededDirty:{get:function(){return this._styleCommandsNeededDirty}}});function gqe(e){const t=e._model,n=ha.is3DTiles(t.type),i=e._propertyTable.count;if(i===0)return;let o;const r=new Array(i);if(n){const s=t.content;for(o=0;o<i;o++)r[o]=new As(s,o)}else for(o=0;o<i;o++)r[o]=new pg({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new wo({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}or.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=$C.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};or.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};or.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};or.prototype.getShow=function(e){return this._batchTexture.getShow(e)};or.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};or.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};or.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};or.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};or.prototype.getFeature=function(e){return this._features[e]};or.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};or.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};or.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};or.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};or.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};or.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};or.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};or.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};or.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};const yqe=new H;or.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(wo.DEFAULT_COLOR_VALUE),this.setAllShow(wo.DEFAULT_SHOW_VALUE);return}for(let t=0;t<this._featuresLength;t++){const n=this.getFeature(t),i=l(e.color)?A(e.color.evaluateColor(n,yqe),wo.DEFAULT_COLOR_VALUE):wo.DEFAULT_COLOR_VALUE,o=l(e.show)?A(e.show.evaluate(n),wo.DEFAULT_SHOW_VALUE):wo.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};or.prototype.isDestroyed=function(){return!1};or.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),He(this)};const Aqe=`#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
|
||
|
||
gl_FragColor = color;
|
||
}
|
||
`,bqe=`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 q2(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;T.typeOf.object("options.command",t),T.typeOf.object("options.primitiveRenderResources",n);const 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;const o=i.classificationType;this._classificationType=o,this._classifiesTerrain=o!==vo.CESIUM_3D_TILE,this._classifies3DTiles=o!==vo.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],xqe(this)}function Cqe(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:_t.KEEP,zFail:_t.DECREMENT_WRAP,zPass:_t.KEEP},backFunction:e,backOperation:{fail:_t.KEEP,zFail:_t.INCREMENT_WRAP,zPass:_t.KEEP},reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:x_.LESS_OR_EQUAL},depthMask:!1}}const Tqe={stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND},Eqe={stencilTest:{enabled:!0,frontFunction:gi.NOT_EQUAL,frontOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},backFunction:gi.NOT_EQUAL,backOperation:{fail:_t.ZERO,zFail:_t.ZERO,zPass:_t.ZERO},reference:0,mask:Rt.CLASSIFICATION_MASK},stencilMask:Rt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},bJ=[];function xqe(e){const t=e._command,n=bJ;if(e._useDebugWireframe){t.pass=Ne.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=Gb(e,n,e._commandListDebugWireframe);const r=e._commandListDebugWireframe,s=r.length;for(let a=0;a<s;a++){const c=r[a];c.count*=2,c.offset*=2}return}const o=e.model.allowPicking;if(e._classifiesTerrain){const r=Ne.TERRAIN_CLASSIFICATION,s=CR(t,r),a=v5(t,r);n.length=0,n.push(s,a),e._commandListTerrain=Gb(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=D5(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){const r=Ne.CESIUM_3D_TILE_CLASSIFICATION,s=CR(t,r),a=v5(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=Gb(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=D5(e,n,e._commandList3DTilesPicking))}}function Gb(e,t,n){const i=e._runtimePrimitive,o=i.batchLengths,r=i.batchOffsets,s=o.length,a=t.length;for(let c=0;c<s;c++){const u=o[c],d=r[c];for(let h=0;h<a;h++){const m=t[h],g=mt.shallowClone(m);g.count=u,g.offset=d,n.push(g)}}return n}function CR(e,t){const n=mt.shallowClone(e);n.cull=!1,n.pass=t;const i=t===Ne.TERRAIN_CLASSIFICATION?gi.ALWAYS:gi.EQUAL,o=Cqe(i);return n.renderState=et.fromCache(o),n}function v5(e,t){const n=mt.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=et.fromCache(Tqe),n}const wqe=[];function D5(e,t,n){const i=et.fromCache(Eqe),o=t[0],r=t[1],s=mt.shallowClone(o);s.cull=!0,s.pickOnly=!0;const a=mt.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;const c=wqe;return c.length=0,c.push(s,a),Gb(e,c,n)}Object.defineProperties(q2.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},batchLengths:{get:function(){return this._runtimePrimitive.batchLengths}},batchOffsets:{get:function(){return this._runtimePrimitive.batchOffsets}},model:{get:function(){return this._model}},classificationType:{get:function(){return this._classificationType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix);const t=this._runtimePrimitive.boundingSphere;this._boundingVolume=fe.transform(t,this._modelMatrix,this._boundingVolume)}},boundingVolume:{get:function(){return this._boundingVolume}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace=e}}});q2.prototype.pushCommands=function(e,t){const 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){const o=Ne.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=CR(this._command,o),s=bJ;s.length=0,s.push(r),this._commandListIgnoreShow=Gb(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};function jD(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;T.typeOf.object("options.command",t),T.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._model=i;const o=n.runtimePrimitive;this._runtimePrimitive=o;const r=t.pass===Ne.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,c=n.hasSilhouette,u=!r&&!c,d=n.hasSkipLevelOfDetail&&!r,h=c;this._command=t,this._modelMatrix=B.clone(t.modelMatrix),this._boundingVolume=fe.clone(t.boundingVolume),this._modelMatrix2D=new B,this._boundingVolume2D=new fe,this._modelMatrix2DDirty=!1,this._backFaceCulling=t.renderState.cull.enabled,this._cullFace=t.renderState.cull.face,this._shadows=i.shadows,this._debugShowBoundingVolume=t.debugShowBoundingVolume,this._usesBackFaceCulling=a,this._needsTranslucentCommand=u,this._needsSkipLevelOfDetailCommands=d,this._needsSilhouetteCommands=h,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,Sqe(this)}function nf(e){this.command=e.command,this.updateShadows=e.updateShadows,this.updateBackFaceCulling=e.updateBackFaceCulling,this.updateCullFace=e.updateCullFace,this.updateDebugShowBoundingVolume=e.updateDebugShowBoundingVolume,this.is2D=A(e.is2D,!1),this.derivedCommand2D=void 0}nf.clone=function(e){return new nf({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function Sqe(e){const t=e._command;t.modelMatrix=e._modelMatrix,t.boundingVolume=e._boundingVolume;const n=e._model,i=e._usesBackFaceCulling,o=e._derivedCommands;e._originalCommand=new nf({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new nf({command:Bqe(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new nf({command:Uqe(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new nf({command:Hqe(t),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new nf({command:Rqe(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new nf({command:Nqe(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(jD.prototype,{command:{get:function(){return this._command}},runtimePrimitive:{get:function(){return this._runtimePrimitive}},model:{get:function(){return this._model}},primitiveType:{get:function(){return this._command.primitiveType}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix),this._modelMatrix2DDirty=!0,this._boundingVolume=fe.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,Dqe(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,Iqe(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,Pqe(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,Oqe(this))}}});function vqe(e,t){const n=e._modelMatrix;e._modelMatrix2D=B.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=M.sign(n[13])*2*M.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=fe.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function Dqe(e){const t=e.shadows,n=Po.castShadows(t),i=Po.receiveShadows(t),o=e._derivedCommands,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a.updateShadows){const c=a.command;c.castShadows=n,c.receiveShadows=i}}}function Iqe(e){const t=e.backFaceCulling,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateBackFaceCulling){const s=r.command,a=ht(s.renderState,!0);a.cull.enabled=t,s.renderState=et.fromCache(a)}}}function Pqe(e){const t=e.cullFace,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateCullFace){const s=r.command,a=ht(s.renderState,!0);a.cull.face=t,s.renderState=et.fromCache(a)}}}function Oqe(e){const t=e.debugShowBoundingVolume,n=e._derivedCommands,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.updateDebugShowBoundingVolume){const s=r.command;s.debugShowBoundingVolume=t}}}jD.prototype.pushCommands=function(e,t){const n=CJ(this,e);n&&!this._has2DCommands&&(Lqe(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(vqe(this,e),this._modelMatrix2DDirty=!1);const i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&l(i)&&(i!==$C.ALL_OPAQUE&&uy(t,this._translucentCommand,n),i===$C.ALL_TRANSLUCENT))){if(this._needsSkipLevelOfDetailCommands){const o=this._model.content,r=o.tileset,s=o.tile,a=r._hasMixedContent,c=s._finalResolution;if(a){c||uy(r._backfaceCommands,this._skipLodBackfaceCommand,n),Mqe(this,s,n),uy(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){uy(t,this._silhouetteModelCommand,n);return}return uy(t,this._originalCommand,n),t}};jD.prototype.pushSilhouetteCommands=function(e,t){const n=CJ(this,e);return uy(t,this._silhouetteColorCommand,n),t};function uy(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function CJ(e,t){if(t.mode!==le.SCENE2D||e.model._projectTo2D)return!1;const i=e.model.sceneGraph._boundingSphere2D,o=i.center.y-i.radius,r=i.center.y+i.radius,s=t.mapProjection.ellipsoid.maximumRadius*M.PI;return o<s&&r>s||o<-s&&r>-s}function kg(e,t){if(!l(t))return;const n=nf.clone(t),i=mt.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 Lqe(e){kg(e,e._originalCommand),kg(e,e._translucentCommand),kg(e,e._skipLodBackfaceCommand),kg(e,e._skipLodStencilCommand),kg(e,e._silhouetteModelCommand),kg(e,e._silhouetteColorCommand)}function Bqe(e){const t=mt.shallowClone(e);t.pass=Ne.TRANSLUCENT;const n=ht(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=Gi.ALPHA_BLEND,t.renderState=et.fromCache(n),t}function Rqe(e,t){const n=t._silhouetteId%255,i=mt.shallowClone(e),o=ht(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:ae.ALWAYS,backFunction:ae.ALWAYS,reference:n,mask:-1,frontOperation:{fail:ae.KEEP,zFail:ae.KEEP,zPass:ae.REPLACE},backOperation:{fail:ae.KEEP,zFail:ae.KEEP,zPass:ae.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=et.fromCache(o),i}function Nqe(e,t){const n=t._silhouetteId%255,i=mt.shallowClone(e),o=ht(e.renderState,!0);o.cull.enabled=!1,(e.pass===Ne.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=Ne.TRANSLUCENT,o.depthMask=!1,o.blending=Gi.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:ae.NOTEQUAL,backFunction:ae.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:ae.KEEP,zFail:ae.KEEP,zPass:ae.KEEP},backOperation:{fail:ae.KEEP,zFail:ae.KEEP,zPass:ae.KEEP}};const s=ht(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=et.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function Mqe(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=Fqe(o);if(r!==s){const a=zqe(r),c=ht(o.renderState,!0);c.stencilTest.reference=a,o.renderState=et.fromCache(c),n&&(i.derivedCommand2D.renderState=c)}}function Fqe(e){return(e.renderState.stencilTest.reference&Rt.SKIP_LOD_MASK)>>>Rt.SKIP_LOD_BIT_SHIFT}function zqe(e){return Rt.CESIUM_3D_TILE_MASK|e<<Rt.SKIP_LOD_BIT_SHIFT}function Uqe(e){const t=mt.shallowClone(e),n=ht(e.renderState,!0);n.cull.enabled=!0,n.cull.face=Ho.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};const i=ht(t.uniformMap),o=new j(5,5);return i.u_polygonOffset=function(){return o},t.renderState=et.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function Hqe(e){const t=mt.shallowClone(e),n=ht(e.renderState,!0);return n.stencilTest.enabled=!0,n.stencilTest.mask=Rt.SKIP_LOD_MASK,n.stencilTest.reference=Rt.CESIUM_3D_TILE_MASK,n.stencilTest.frontFunction=gi.GREATER_OR_EQUAL,n.stencilTest.frontOperation.zPass=_t.REPLACE,n.stencilTest.backFunction=gi.GREATER_OR_EQUAL,n.stencilTest.backOperation.zPass=_t.REPLACE,n.stencilMask=Rt.CESIUM_3D_TILE_MASK|Rt.SKIP_LOD_MASK,t.renderState=et.fromCache(n),t}function Vqe(e,t){const n=e.shaderBuilder;n.addVertexLines(bqe),n.addFragmentLines(Aqe);const i=kqe(e),o=new ho({context:t.context,indexBuffer:i,attributes:e.attributes}),r=e.model;r._pipelineResources.push(o);const s=n.buildShaderProgram(t.context);r._pipelineResources.push(s);const a=e.alphaOptions.pass,c=r.sceneGraph,u=t.mode===le.SCENE3D;let d,h;if(!u&&!t.scene3DOnly&&r._projectTo2D)d=B.multiplyTransformation(c._computedModelMatrix,e.runtimeNode.computedTransform,new B),h=e.runtimePrimitive.boundingSphere2D;else{const E=u?c._computedModelMatrix:c._computedModelMatrix2D;d=B.multiplyTransformation(E,e.runtimeNode.computedTransform,new B),h=fe.transform(e.boundingSphere,d,e.boundingSphere)}let m=ht(et.fromCache(e.renderStateOptions),!0);m.cull.face=en.getCullFace(d,e.primitiveType),m=et.fromCache(m);const g=l(r.classificationType),p=g?!1:Po.castShadows(r.shadows),y=g?!1:Po.receiveShadows(r.shadows),b=g?void 0:e.pickId,C=new mt({boundingVolume:h,modelMatrix:d,uniformMap:e.uniformMap,renderState:m,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:b,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:p,receiveShadows:y});return g?new q2({primitiveRenderResources:e,command:C}):new jD({primitiveRenderResources:e,command:C})}function kqe(e){const t=e.wireframeIndexBuffer;if(l(t))return t;const n=e.indices;if(l(n)){if(!l(n.buffer))throw new x("Indices must be provided as a Buffer");return n.buffer}}const TJ={name:"TilesetPipelineStage"};TJ.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,De.FRAGMENT);const r={u_polygonOffset:function(){return j.ZERO}};e.uniformMap=hn(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}const i=e.renderStateOptions;i.stencilTest=Rt.setCesium3DTileBit(),i.stencilMask=Rt.CESIUM_3D_TILE_MASK};const Gqe=TJ,Wqe=`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 = 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 = texture2D(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 = texture2D(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
|
||
}`,EJ={name:"ImageBasedLightingPipelineStage"};EJ.process=function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,De.FRAGMENT),o.addUniform("vec2","model_iblFactor",De.FRAGMENT),hu.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",De.FRAGMENT),l(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,De.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,De.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",De.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,De.FRAGMENT),l(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,De.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,De.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",De.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",De.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",De.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,De.FRAGMENT)),l(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,De.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",De.FRAGMENT)),o.addFragmentLines(Wqe);const 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=hn(r,e.uniformMap)};const jqe=EJ,qqe=M.EPSILON16;function $2(e){e=A(e,A.EMPTY_OBJECT);const t=e.stage,n=e.runtimeArticulation;T.typeOf.object("options.stage",t),T.typeOf.object("options.runtimeArticulation",n),this._stage=t,this._runtimeArticulation=n,this._name=t.name,this._type=t.type,this._minimumValue=t.minimumValue,this._maximumValue=t.maximumValue,this._currentValue=t.initialValue}Object.defineProperties($2.prototype,{stage:{get:function(){return this._stage}},runtimeArticulation:{get:function(){return this._runtimeArticulation}},name:{get:function(){return this._name}},type:{get:function(){return this._type}},minimumValue:{get:function(){return this._minimumValue}},maximumValue:{get:function(){return this._maximumValue}},currentValue:{get:function(){return this._currentValue},set:function(e){T.typeOf.number("value",e),e=M.clamp(e,this.minimumValue,this.maximumValue),M.equalsEpsilon(this._currentValue,e,qqe)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const $qe=new f,nO=new J;$2.prototype.applyStageToMatrix=function(e){T.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=$qe;let o;switch(t){case Hl.XROTATE:o=J.fromRotationX(M.toRadians(n),nO),e=B.multiplyByMatrix3(e,o,e);break;case Hl.YROTATE:o=J.fromRotationY(M.toRadians(n),nO),e=B.multiplyByMatrix3(e,o,e);break;case Hl.ZROTATE:o=J.fromRotationZ(M.toRadians(n),nO),e=B.multiplyByMatrix3(e,o,e);break;case Hl.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case Hl.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case Hl.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=B.multiplyByTranslation(e,i,e);break;case Hl.XSCALE:i.x=n,i.y=1,i.z=1,e=B.multiplyByScale(e,i,e);break;case Hl.YSCALE:i.x=1,i.y=n,i.z=1,e=B.multiplyByScale(e,i,e);break;case Hl.ZSCALE:i.x=1,i.y=1,i.z=n,e=B.multiplyByScale(e,i,e);break;case Hl.UNIFORMSCALE:e=B.multiplyByUniformScale(e,n,e);break}return e};function qD(e){e=A(e,A.EMPTY_OBJECT);const t=e.articulation,n=e.sceneGraph;T.typeOf.object("options.articulation",t),T.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,Yqe(this)}Object.defineProperties(qD.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 Yqe(e){const n=e.articulation.stages,i=n.length,o=e._runtimeStages,r=e._runtimeStagesByName;for(let s=0;s<i;s++){const a=n[s],c=new $2({stage:a,runtimeArticulation:e});o.push(c);const u=a.name;r[u]=c}}qD.prototype.setArticulationStage=function(e,t){const n=this._runtimeStagesByName[e];l(n)&&(n.currentValue=t)};const Xqe=new B,Kqe=new B;qD.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=B.clone(B.IDENTITY,Xqe),t;const n=this._runtimeStages,i=n.length;for(t=0;t<i;t++)e=n[t].applyStageToMatrix(e);const o=this._runtimeNodes,r=o.length;for(t=0;t<r;t++){const s=o[t],a=B.multiplyTransformation(s.originalTransform,e,Kqe);s.transform=a}};const Jqe=`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;
|
||
}`,dy={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};dy.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,De.FRAGMENT),i.addFragmentLines(Jqe);const 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=Ne.TRANSLUCENT),i.addUniform("vec4",dy.COLOR_UNIFORM_NAME,De.FRAGMENT),o[dy.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",dy.COLOR_BLEND_UNIFORM_NAME,De.FRAGMENT),o[dy.COLOR_BLEND_UNIFORM_NAME]=function(){return kD.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=hn(o,e.uniformMap)};const TR=dy,Qqe=`#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 = texture2D(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 = texture2D(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(texture2D(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;
|
||
}
|
||
}
|
||
`,xJ={name:"ModelClippingPlanesPipelineStage"},Zqe=new j;xJ.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,De.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,De.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,De.FRAGMENT),Io.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,De.FRAGMENT);const s=Io.getTextureResolution(i,o,Zqe);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,De.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,De.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",De.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",De.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",De.FRAGMENT),r.addFragmentLines(Qqe);const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const c=H.clone(i.edgeColor);return c.alpha=i.edgeWidth,c},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=hn(a,e.uniformMap)};const e7e=xJ;function wJ(e,t){T.typeOf.object("model",e),T.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(wJ.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){l(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}}});const t7e=`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
|
||
`,n7e=`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
|
||
}
|
||
`,i7e=`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
|
||
}
|
||
`,Wx=new B,o7e=new B,r7e=new B,SJ={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:OJ,_transformsToTypedArray:ER};SJ.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(t7e);const s=e.model,a=s.sceneGraph,c=e.runtimeNode,u=n.mode!==le.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,d=[];g7e(e,n,i,d,u),b7e(e,n,i,d);const h={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,De.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",De.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",De.VERTEX),h.u_instance_modifiedModelView=function(){let m=B.multiplyTransformation(s.modelMatrix,a.components.transform,Wx);return u?B.multiplyTransformation(n.context.uniformState.view3D,m,Wx):(n.mode!==le.SCENE3D&&(m=cn.basisTo2D(n.mapProjection,m,Wx)),B.multiplyTransformation(n.context.uniformState.view,m,Wx))},h.u_instance_nodeTransform=function(){return B.multiplyTransformation(a.axisCorrectionMatrix,c.computedTransform,o7e)},r.addVertexLines(i7e)):r.addVertexLines(n7e),u){r.addDefine("USE_2D_INSTANCING",void 0,De.VERTEX),r.addUniform("mat4","u_modelView2D",De.VERTEX);const m=n.context,g=B.fromTranslation(c.instancingReferencePoint2D,new B);h.u_modelView2D=function(){return B.multiplyTransformation(m.uniformState.view,g,r7e)}}e.uniformMap=hn(h,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,d)};const Wb=new B,s7e=new f;function a7e(e,t,n,i,o){let r=B.multiplyTransformation(t,e,Wb);return r=B.multiplyTransformation(r,n,Wb),o=cn.basisTo2D(i.mapProjection,r,o),o}function c7e(e,t,n,i,o){const r=B.fromTranslation(e,Wb);let s=B.multiplyTransformation(t,r,Wb);s=B.multiplyTransformation(s,n,Wb);const a=B.getTranslation(s,s7e);return o=br.computeActualWgs84Position(i,a,o),o}function vJ(e,t,n){const i=e.model,o=i.sceneGraph;e.runtimeNode.node.instances.transformInWorldSpace?(t=B.multiplyTransformation(i.modelMatrix,o.components.transform,t),n=B.multiplyTransformation(o.axisCorrectionMatrix,e.runtimeNode.computedTransform,n)):(t=B.clone(o.computedModelMatrix,t),t=B.multiplyTransformation(t,e.runtimeNode.computedTransform,t),n=B.clone(B.IDENTITY,n))}const DJ=new B,IJ=new B,l7e=new B,u7e=new f;function d7e(e,t,n,i){const o=DJ,r=IJ;vJ(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const d=e[u],h=a7e(d,o,r,n,l7e),m=B.getTranslation(h,u7e),g=f.subtract(m,a,m);i[u]=B.setTranslation(h,g,i[u])}return i}function f7e(e,t,n,i){const o=DJ,r=IJ;vJ(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const d=e[u],h=c7e(d,o,r,n,d);i[u]=f.subtract(h,a,i[u])}return i}const h7e=new f,p7e=new f;function PJ(e,t){const n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=B.multiplyByPoint(i,n.instancingTranslationMin,h7e),r=br.computeActualWgs84Position(t,o,o),s=B.multiplyByPoint(i,n.instancingTranslationMax,p7e),a=br.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=f.lerp(r,a,.5,new f)}function ER(e){const n=e.length,i=new Float32Array(n*12);for(let o=0;o<n;o++){const 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 m7e(e){const n=e.length,i=new Float32Array(n*3);for(let o=0;o<n;o++){const r=e[o],s=3*o;i[s+0]=r[0],i[s+1]=r[4],i[s+2]=r[8]}return i}new f;new Te;new f;function OJ(e,t,n){const i=new Array(t),o=en.getAttributeBySemantic(e,ta.TRANSLATION),r=en.getAttributeBySemantic(e,ta.ROTATION),s=en.getAttributeBySemantic(e,ta.SCALE),a=new f(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=l(o),d=l(r),h=l(s),m=u?o.typedArray:new Float32Array(t*3);let g=d?r.typedArray:new Float32Array(t*4);d&&r.normalized&&(g=mi.dequantize(g,r.componentDatatype,r.type,t));let p;h?p=s.typedArray:(p=new Float32Array(t*3),p.fill(1));for(let b=0;b<t;b++){const C=new f(m[b*3],m[b*3+1],m[b*3+2]);f.maximumByComponent(a,C,a),f.minimumByComponent(c,C,c);const E=new Te(g[b*4],g[b*4+1],g[b*4+2],d?g[b*4+3]:1),w=new f(p[b*3],p[b*3+1],p[b*3+2]),S=B.fromTranslationQuaternionRotationScale(C,E,w,new B);i[b]=S}const y=n.runtimeNode;return y.instancingTranslationMin=c,y.instancingTranslationMax=a,u&&(o.typedArray=void 0),d&&(r.typedArray=void 0),h&&(s.typedArray=void 0),i}function _7e(e,t,n){const i=new Array(t),o=e.typedArray,r=new f(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new f(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let c=0;c<t;c++){const u=new f(o[c*3],o[c*3+1],o[c*3+2]);i[c]=u,f.minimumByComponent(r,u,r),f.maximumByComponent(s,u,s)}const a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function xR(e,t){const n=Tt.createVertexBuffer({context:t.context,typedArray:e,usage:nt.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function g7e(e,t,n,i,o){const r=en.getAttributeBySemantic(n,ta.ROTATION);l(r)?y7e(e,n,i,t,o):A7e(e,n,i,t,o)}function y7e(e,t,n,i,o){const r=e.shaderBuilder,s=t.attributes[0].count,a=e.model,c=e.runtimeNode;r.addDefine("HAS_INSTANCE_MATRICES");const u="Transform";let d,h=c.instancingTransformsBuffer;if(!l(h)){d=OJ(t,s,e);const y=ER(d);h=xR(y,i),a._modelResources.push(h),c.instancingTransformsBuffer=h}if(I5(e,h,n,u),!o)return;const m=ht(i);m.mode=le.COLUMBUS_VIEW,PJ(e,m);let g=c.instancingTransformsBuffer2D;if(!l(g)){const y=d7e(d,e,m,d),b=ER(y);g=xR(b,i),a._modelResources.push(g),c.instancingTransformsBuffer2D=g}I5(e,g,n,"Transform2D")}function A7e(e,t,n,i,o){const r=e.shaderBuilder,s=e.runtimeNode,a=en.getAttributeBySemantic(t,ta.TRANSLATION),c=en.getAttributeBySemantic(t,ta.SCALE);if(l(c)){r.addDefine("HAS_INSTANCE_SCALE");const C="Scale";iO(e,c.buffer,c.byteOffset,c.byteStride,n,C)}if(!l(a))return;let u;const d=a.typedArray;l(d)?u=_7e(a,a.count,e):l(s.instancingTranslationMin)||(s.instancingTranslationMin=a.min,s.instancingTranslationMax=a.max),r.addDefine("HAS_INSTANCE_TRANSLATION");const h="Translation";if(iO(e,a.buffer,a.byteOffset,a.byteStride,n,h),!o)return;const m=ht(i);m.mode=le.COLUMBUS_VIEW,PJ(e,m);let g=s.instancingTranslationBuffer2D;if(!l(g)){const C=f7e(u,e,m,u),E=m7e(C);g=xR(E,i),e.model._modelResources.push(g),s.instancingTranslationBuffer2D=g}iO(e,g,0,void 0,n,"Translation2D")}function I5(e,t,n,i){const r=ee.getSizeInBytes(ee.FLOAT),s=r*12,a=[{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:ee.FLOAT,normalize:!1,offsetInBytes:0,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:ee.FLOAT,normalize:!1,offsetInBytes:r*4,strideInBytes:s,instanceDivisor:1},{index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:4,componentDatatype:ee.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 iO(e,t,n,i,o,r){o.push({index:e.attributeIndex++,vertexBuffer:t,componentsPerAttribute:3,componentDatatype:ee.FLOAT,normalize:!1,offsetInBytes:n,strideInBytes:i,instanceDivisor:1}),e.shaderBuilder.addAttribute("vec3",`a_instance${r}`)}function b7e(e,t,n,i){const o=n.attributes,r=e.shaderBuilder;for(let s=0;s<o.length;s++){const a=o[s];a.semantic===ta.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:_n.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}const C7e=SJ,Y2={};Y2.name="ModelMatrixUpdateStage";Y2.update=function(e,t,n){const i=n.mode!==le.SCENE3D;if(!(i&&t._model._projectTo2D)&&e._transformDirty){const o=i?t._computedModelMatrix2D:t._computedModelMatrix;LJ(e,t,o,e.transformToRoot),e._transformDirty=!1}};function LJ(e,t,n,i){let o;i=B.multiplyTransformation(i,e.transform,new B),e.updateComputedTransform();const r=e.runtimePrimitives.length;for(o=0;o<r;o++){const c=e.runtimePrimitives[o].drawCommand;c.modelMatrix=B.multiplyTransformation(n,i,c.modelMatrix),c.cullFace=en.getCullFace(c.modelMatrix,c.primitiveType)}const s=e.children.length;for(o=0;o<s;o++){const a=t._runtimeNodes[e.children[o]];a._transformToRoot=B.clone(i,a._transformToRoot),LJ(a,t,n,i),a._transformDirty=!1}}const T7e=Y2,BJ={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:RJ,_countGeneratedBuffers:NJ};BJ.process=function(e,t,n){const i=e.model.statistics,o=t.instances,r=e.runtimeNode;RJ(i,o),NJ(i,r)};function RJ(e,t){if(!l(t))return;const n=t.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];l(r.buffer)&&e.addBuffer(r.buffer,!1)}}function NJ(e,t){l(t.instancingTransformsBuffer)&&e.addBuffer(t.instancingTransformsBuffer,!1),l(t.instancingTransformsBuffer2D)&&e.addBuffer(t.instancingTransformsBuffer2D,!1),l(t.instancingTranslationBuffer2D)&&e.addBuffer(t.instancingTranslationBuffer2D,!1)}const E7e=BJ;function j0(e){e=A(e,A.EMPTY_OBJECT);const t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;T.typeOf.object("options.node",t),T.typeOf.object("options.transform",n),T.typeOf.object("options.transformToRoot",i),T.typeOf.object("options.sceneGraph",o),T.typeOf.object("options.children",r),this._node=t,this._name=t.name,this._id=t.index,this._sceneGraph=o,this._children=r,this._originalTransform=B.clone(n,this._originalTransform),this._transform=B.clone(n,this._transform),this._transformToRoot=B.clone(i,this._transformToRoot),this._computedTransform=new B,this._transformDirty=!1,this._transformParameters=void 0,this._morphWeights=[],this._runtimeSkin=void 0,this._computedJointMatrices=[],this.show=!0,this.userAnimated=!1,this.pipelineStages=[],this.runtimePrimitives=[],this.updateStages=[],this.instancingTranslationMin=void 0,this.instancingTranslationMax=void 0,this.instancingTransformsBuffer=void 0,this.instancingTransformsBuffer2D=void 0,this.instancingTranslationBuffer2D=void 0,this.instancingReferencePoint2D=void 0,x7e(this)}Object.defineProperties(j0.prototype,{node:{get:function(){return this._node}},sceneGraph:{get:function(){return this._sceneGraph}},children:{get:function(){return this._children}},transform:{get:function(){return this._transform},set:function(e){this._transformDirty=!0,this._transform=B.clone(e,this._transform)}},transformToRoot:{get:function(){return this._transformToRoot}},computedTransform:{get:function(){return this._computedTransform}},originalTransform:{get:function(){return this._originalTransform}},translation:{get:function(){return l(this._transformParameters)?this._transformParameters.translation:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new x("The translation of a node cannot be set if it was defined using a matrix in the model.");const n=t.translation;f.equals(n,e)||(t.translation=f.clone(e,t.translation),oO(this,t))}},rotation:{get:function(){return l(this._transformParameters)?this._transformParameters.rotation:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new x("The rotation of a node cannot be set if it was defined using a matrix in the model.");const n=t.rotation;Te.equals(n,e)||(t.rotation=Te.clone(e,t.rotation),oO(this,t))}},scale:{get:function(){return l(this._transformParameters)?this._transformParameters.scale:void 0},set:function(e){const t=this._transformParameters;if(!l(t))throw new x("The scale of a node cannot be set if it was defined using a matrix in the model.");const n=t.scale;f.equals(n,e)||(t.scale=f.clone(e,t.scale),oO(this,t))}},morphWeights:{get:function(){return this._morphWeights},set:function(e){const t=e.length;if(this._morphWeights.length!==t)throw new x("value must have the same length as the original weights array.");for(let n=0;n<t;n++)this._morphWeights[n]=e[n]}},runtimeSkin:{get:function(){return this._runtimeSkin}},computedJointMatrices:{get:function(){return this._computedJointMatrices}}});function x7e(e){const t=e.transform,n=e.transformToRoot,i=e._computedTransform;e._computedTransform=B.multiply(n,t,i);const o=e.node;l(o.matrix)||(e._transformParameters=new RD(o.translation,o.rotation,o.scale)),l(o.morphWeights)&&(e._morphWeights=o.morphWeights.slice());const r=o.articulationName;if(l(r)){const c=e.sceneGraph._runtimeArticulations[r];l(c)&&c.runtimeNodes.push(e)}}function oO(e,t){e._transformDirty=!0,e._transform=B.fromTranslationRotationScale(t,e._transform)}j0.prototype.getChild=function(e){if(T.typeOf.number("index",e),e<0||e>=this.children.length)throw new x("index must be greater than or equal to 0 and less than the number of children.");return this.sceneGraph._runtimeNodes[this.children[e]]};j0.prototype.configurePipeline=function(){const e=this.node,t=this.pipelineStages;t.length=0;const n=this.updateStages;n.length=0,l(e.instances)&&t.push(C7e),t.push(E7e),n.push(T7e)};j0.prototype.updateComputedTransform=function(){this._computedTransform=B.multiply(this._transformToRoot,this._transform,this._computedTransform)};j0.prototype.updateJointMatrices=function(){const e=this._runtimeSkin;if(!l(e))return;e.updateJointMatrices();const t=this._computedJointMatrices,n=e.jointMatrices,i=n.length;for(let o=0;o<i;o++){l(t[o])||(t[o]=new B);const r=B.multiplyTransformation(this.transformToRoot,this.transform,t[o]),s=B.inverseTransformation(r,t[o]);t[o]=B.multiplyTransformation(s,n[o],t[o])}};const MJ={name:"AlphaPipelineStage"};MJ.process=function(e,t,n){const i=e.alphaOptions,o=e.model;i.pass=A(i.pass,o.opaquePass);const r=e.renderStateOptions;i.pass===Ne.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=Gi.ALPHA_BLEND);const s=e.shaderBuilder,a=e.uniformMap;l(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,De.FRAGMENT),s.addUniform("float","u_alphaCutoff",De.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};const w7e=MJ,FJ={name:"BatchTexturePipelineStage"};FJ.process=function(e,t,n){const 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};const c=s.batchTexture;i.addUniform("sampler2D","model_batchTexture"),o.model_batchTexture=function(){return A(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=hn(o,e.uniformMap)};const S7e=FJ,zJ={name:"ClassificationPipelineStage"};zJ.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,De.BOTH);const o=e.runtimePrimitive;l(o.batchLengths)||v7e(t,o)};function v7e(e,t){const n=en.getAttributeBySemantic(e,wt.POSITION);if(!l(n))throw new Ie("Primitives must have a position attribute to be used for classification.");let i;const o=e.indices,r=l(o);r&&(i=o.typedArray,o.typedArray=void 0);const s=r?o.count:n.count,a=en.getAttributeBySemantic(e,wt.FEATURE_ID,0);if(!l(a)){t.batchLengths=[s],t.batchOffsets=[0];return}const c=a.typedArray;a.typedArray=void 0;const u=[],d=[0],h=r?i[0]:0;let m=c[h],g=0;for(let y=1;y<s;y++){const b=r?i[y]:y,C=c[b];if(C!==m){const E=y-g,w=y;u.push(E),d.push(w),g=w,m=C}}const p=s-g;u.push(p),t.batchLengths=u,t.batchOffsets=d}const D7e=zJ,I7e=`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
|
||
}
|
||
`,P7e=`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;
|
||
}
|
||
`,UJ={name:"CPUStylingPipelineStage"};UJ.process=function(e,t,n){const i=e.model,o=e.shaderBuilder;o.addVertexLines(I7e),o.addFragmentLines(P7e),o.addDefine("USE_CPU_STYLING",void 0,De.BOTH),l(i.color)||(o.addUniform("float",TR.COLOR_BLEND_UNIFORM_NAME,De.FRAGMENT),e.uniformMap[TR.COLOR_BLEND_UNIFORM_NAME]=function(){return kD.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",De.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Ne.TRANSLUCENT}};const O7e=UJ,HJ={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};HJ.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};const X2=Object.freeze(HJ),L7e=`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;
|
||
}
|
||
`,B7e=`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);
|
||
}
|
||
`,R7e=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
|
||
initializeFeatureIds(featureIds, attributes);
|
||
initializeFeatureIdAliases(featureIds);
|
||
}
|
||
`,N7e=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
|
||
{
|
||
initializeFeatureIds(featureIds, attributes);
|
||
initializeFeatureIdAliases(featureIds);
|
||
setFeatureIdVaryings();
|
||
}
|
||
`,ui={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()"};ui.process=function(e,t,n){const i=e.shaderBuilder;M7e(i);const o=e.runtimeNode.node.instances;l(o)&&F7e(e,o,n),z7e(e,t,n),i.addVertexLines(N7e),i.addFragmentLines(R7e)};function M7e(e){e.addStruct(ui.STRUCT_ID_FEATURE_IDS_VS,ui.STRUCT_NAME_FEATURE_IDS,De.VERTEX),e.addStruct(ui.STRUCT_ID_FEATURE_IDS_FS,ui.STRUCT_NAME_FEATURE_IDS,De.FRAGMENT),e.addFunction(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,ui.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,De.VERTEX),e.addFunction(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,ui.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,De.FRAGMENT),e.addFunction(ui.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,ui.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,De.VERTEX),e.addFunction(ui.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,ui.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,De.FRAGMENT),e.addFunction(ui.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,ui.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,De.VERTEX)}function F7e(e,t,n){const i=t.featureIds,o=t.attributes[0].count;for(let r=0;r<i.length;r++){const s=i[r],a=s.positionalLabel;s instanceof Ot.FeatureIdAttribute?U7e(e,s,a):VJ(e,s,a,o,1,n);const c=s.label;l(c)&&kJ(e,a,c,De.BOTH)}}function z7e(e,t,n){const i=t.featureIds,r=en.getAttributeBySemantic(t,wt.POSITION).count;for(let s=0;s<i.length;s++){const a=i[s],c=a.positionalLabel;let u=De.BOTH;a instanceof Ot.FeatureIdAttribute?H7e(e,a,c):a instanceof Ot.FeatureIdImplicitRange?VJ(e,a,c,r,void 0,n):(V7e(e,a,c,s,n),u=De.FRAGMENT);const d=a.label;l(d)&&kJ(e,c,d,u)}}function U7e(e,t,n){const i=e.shaderBuilder;i.addStructField(ui.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(ui.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=`a_${r}${o}`,a=`v_${r}${o}`,c=`featureIds.${n} = int(czm_round(${s}));`,u=`featureIds.${n} = int(czm_round(${a}));`;i.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(ui.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function H7e(e,t,n){const i=e.shaderBuilder;i.addStructField(ui.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(ui.STRUCT_ID_FEATURE_IDS_FS,"int",n);const o=t.setIndex,r=n.replace(/_\d+$/,"_"),s=[`featureIds.${n} = int(czm_round(attributes.${r}${o}));`];i.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function VJ(e,t,n,i,o,r){k7e(e,t,i,o,r);const s=e.shaderBuilder,a=`a_implicit_${n}`;s.addAttribute("float",a);const c=`v_implicit_${n}`;s.addVarying("float",c),s.addStructField(ui.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(ui.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(ui.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function V7e(e,t,n,i,o){const r=`u_featureIdTexture_${i}`,s=e.uniformMap,a=t.textureReader;s[r]=function(){return A(a.texture,o.context.defaultTexture)};const c=a.channels,u=e.shaderBuilder;u.addStructField(ui.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,De.FRAGMENT);const d=`v_texCoord_${a.texCoord}`,h=`texture2D(${r}, ${d}).${c}`,m=`featureIds.${n} = czm_unpackUint(${h});`;u.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[m])}function kJ(e,t,n,i){const o=e.shaderBuilder,r=De.includesVertexShader(i);r&&o.addStructField(ui.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(ui.STRUCT_ID_FEATURE_IDS_FS,"int",n);const s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(ui.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function k7e(e,t,n,i,o){const r=e.model;let s,a;if(l(t.repeat)){const u=G7e(t,n);s=Tt.createVertexBuffer({context:o.context,typedArray:u,usage:nt.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);const d=!1;r.statistics.addBuffer(s,d)}else a=[t.offset];const c={index:e.attributeIndex++,instanceDivisor:i,value:a,vertexBuffer:s,normalize:!1,componentsPerAttribute:1,componentDatatype:ee.FLOAT,strideInBytes:ee.getSizeInBytes(ee.FLOAT),offsetInBytes:0};e.attributes.push(c)}function G7e(e,t){const 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}const K2=ui,W7e=`void metadataStage(
|
||
out Metadata metadata,
|
||
out MetadataClass metadataClass,
|
||
out MetadataStatistics metadataStatistics,
|
||
ProcessedAttributes attributes
|
||
)
|
||
{
|
||
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
||
}
|
||
`,j7e=`void metadataStage(
|
||
out Metadata metadata,
|
||
out MetadataClass metadataClass,
|
||
out MetadataStatistics metadataStatistics,
|
||
ProcessedAttributes attributes
|
||
)
|
||
{
|
||
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
|
||
setMetadataVaryings();
|
||
}
|
||
`,ti={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"}]};ti.process=function(e,t,n){var h;const{shaderBuilder:i,model:o}=e,{structuralMetadata:r={},content:s}=o,a=(h=s==null?void 0:s.tileset.metadataExtension)==null?void 0:h.statistics,c=q7e(r.propertyAttributes,t,a),u=Y7e(r.propertyTextures,a),d=c.concat(u);K7e(i,d),Z7e(i),i.addVertexLines(j7e),i.addFragmentLines(W7e);for(let m=0;m<c.length;m++){const g=c[m];e$e(e,g)}for(let m=0;m<u.length;m++){const g=u[m];n$e(e,g)}};function q7e(e,t,n){return l(e)?e.flatMap(i=>$7e(i,t,n)):[]}function $7e(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=en,s=e.class.id,a=n==null?void 0:n.classes[s],c=Object.entries(e.properties),u=new Array(c.length);for(let d=0;d<c.length;d++){const[h,m]=c[d],g=i(t,m.attribute),{glslType:p,variableName:y}=o(g);u[d]={metadataVariable:r(h),property:m,type:m.classProperty.type,glslType:p,variableName:y,propertyStatistics:a==null?void 0:a.properties[h],shaderDestination:De.BOTH}}return u}function Y7e(e,t){return l(e)?e.flatMap(n=>X7e(n,t)):[]}function X7e(e,t){const{sanitizeGlslIdentifier:n}=en,i=e.class.id,o=t==null?void 0: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++){const[c,u]=r[a];s[a]={metadataVariable:n(c),property:u,type:u.classProperty.type,glslType:u.getGlslType(),propertyStatistics:o==null?void 0:o.properties[c],shaderDestination:De.FRAGMENT}}return s}function K7e(e,t){const n=new Set,i=new Set;for(let a=0;a<t.length;a++){const{type:c,glslType:u,propertyStatistics:d}=t[a];n.add(u),l(d)&&c!==Bt.ENUM&&i.add(u)}const o=ti.METADATA_CLASS_FIELDS;for(const a of n){const c=`${a}MetadataClass`;s(c,a,o)}const r=ti.METADATA_STATISTICS_FIELDS;for(const a of i){const c=`${a}MetadataStatistics`;s(c,a,r)}function s(a,c,u){e.addStruct(a,a,De.BOTH);for(let d=0;d<u.length;d++){const{shaderName:h}=u[d],m=u[d].type==="float"?Q7e(c):c;e.addStructField(a,m,h)}}}const J7e={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function Q7e(e){const t=J7e[e];return l(t)?t:e}function Z7e(e){e.addStruct(ti.STRUCT_ID_METADATA_VS,ti.STRUCT_NAME_METADATA,De.VERTEX),e.addStruct(ti.STRUCT_ID_METADATA_FS,ti.STRUCT_NAME_METADATA,De.FRAGMENT),e.addStruct(ti.STRUCT_ID_METADATA_CLASS_VS,ti.STRUCT_NAME_METADATA_CLASS,De.VERTEX),e.addStruct(ti.STRUCT_ID_METADATA_CLASS_FS,ti.STRUCT_NAME_METADATA_CLASS,De.FRAGMENT),e.addStruct(ti.STRUCT_ID_METADATA_STATISTICS_VS,ti.STRUCT_NAME_METADATA_STATISTICS,De.VERTEX),e.addStruct(ti.STRUCT_ID_METADATA_STATISTICS_FS,ti.STRUCT_NAME_METADATA_STATISTICS,De.FRAGMENT),e.addFunction(ti.FUNCTION_ID_INITIALIZE_METADATA_VS,ti.FUNCTION_SIGNATURE_INITIALIZE_METADATA,De.VERTEX),e.addFunction(ti.FUNCTION_ID_INITIALIZE_METADATA_FS,ti.FUNCTION_SIGNATURE_INITIALIZE_METADATA,De.FRAGMENT),e.addFunction(ti.FUNCTION_ID_SET_METADATA_VARYINGS,ti.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,De.VERTEX)}function e$e(e,t){t$e(e,t),GJ(e.shaderBuilder,t),WJ(e.shaderBuilder,t)}function t$e(e,t){const{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=qJ({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:De.BOTH,property:o});n.addStructField(ti.STRUCT_ID_METADATA_VS,r,i),n.addStructField(ti.STRUCT_ID_METADATA_FS,r,i);const a=`metadata.${i} = ${s};`;n.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function n$e(e,t){i$e(e,t),GJ(e.shaderBuilder,t),WJ(e.shaderBuilder,t)}function i$e(e,t){const{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:c,index:u,texture:d}=s.textureReader,h=`u_propertyTexture_${u}`;i.hasOwnProperty(h)||(n.addUniform("sampler2D",h,De.FRAGMENT),i[h]=()=>d),n.addStructField(ti.STRUCT_ID_METADATA_FS,r,o);const m=`attributes.texCoord_${a}`,g=`texture2D(${h}, ${m}).${c}`,p=s.unpackInShader(g),y=qJ({valueExpression:p,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:De.FRAGMENT,property:s}),b=`metadata.${o} = ${y};`;n.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_FS,[b])}function GJ(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=jJ(ti.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(ti.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_FS,s),De.includesVertexShader(r)&&(e.addStructField(ti.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function WJ(e,t){const{propertyStatistics:n}=t;if(!l(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===Bt.ENUM)return;const s=ti.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,c=jJ(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(ti.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_FS,c),De.includesVertexShader(t.shaderDestination)&&(e.addStructField(ti.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(ti.FUNCTION_ID_INITIALIZE_METADATA_VS,c))}function jJ(e,t,n,i){return l(t)?e.map(o).filter(l):[];function o(r){const s=t[r.specName];if(l(s))return`${n}.${r.shaderName} = ${i}(${s});`}}function qJ(e){const{valueExpression:t,property:n}=e;if(!n.hasValueTransform)return t;const i=e.metadataVariable,o=`u_${i}_offset`,r=`u_${i}_scale`,{shaderBuilder:s,uniformMap:a}=e.renderResources,{glslType:c,shaderDestination:u}=e;s.addUniform(c,o,u),s.addUniform(c,r,u);const{offset:d,scale:h}=n;return a[o]=()=>d,a[r]=()=>h,`czm_valueTransform(${o}, ${r}, ${t})`}const A_=ti,o$e={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},wR=Object.freeze(o$e),rs={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:ki};rs.process=function(e,t,n){const i=e.shaderBuilder,o=e.model.customShader;l(o.lightingModel)&&(e.lightingOptions.lightingModel=o.lightingModel);const r=e.alphaOptions;o.translucencyMode===wR.TRANSLUCENT?r.pass=Ne.TRANSLUCENT:o.translucencyMode===wR.OPAQUE&&(r.pass=void 0);const s=f$e(o,t);if(!s.customShaderEnabled)return;if(_$e(i,o,s),s.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,De.BOTH),l(o.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,De.VERTEX),l(o.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,De.FRAGMENT);const u=X2.getDefineName(o.mode);i.addDefine(u,void 0,De.FRAGMENT)}const a=o.uniforms;for(const u in a)if(a.hasOwnProperty(u)){const d=a[u];i.addUniform(d.type,u)}const c=o.varyings;for(const u in c)if(c.hasOwnProperty(u)){const d=c[u];i.addVarying(d,u)}e.uniformMap=hn(e.uniformMap,o.uniformMap)};function r$e(e){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=en.getAttributeInfo(i);t[o.variableName]=o}return t}const s$e={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},a$e={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 $J(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=s$e[t],i=a$e[t];if(l(n))return{attributeField:[n,e],value:i}}function c$e(e,t,n){const i=YJ(t,e.usedVariablesVertex.attributeSet,!1),o=i.addToShader,r=i.missingAttributes;let s,a;const c=[],u=[];for(s in o)if(o.hasOwnProperty(s)){const h=[o[s].glslType,s];c.push(h),a=`vsInput.attributes.${s} = attributes.${s};`,u.push(a)}for(let d=0;d<r.length;d++){s=r[d];const h=$J(s);if(!l(h)){rs._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveVS",`Primitive is missing attribute ${s}, disabling custom vertex shader`);return}c.push(h.attributeField),a=`vsInput.attributes.${s} = ${h.value};`,u.push(a)}n.enabled=!0,n.attributeFields=c,n.initializationLines=u}function l$e(e){const 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 u$e(e,t,n){const i=YJ(t,e.usedVariablesFragment.attributeSet,!0),o=i.addToShader,r=i.missingAttributes;let s,a;const c=[],u=[];for(s in o)if(o.hasOwnProperty(s)){const m=[o[s].glslType,s];c.push(m),a=`fsInput.attributes.${s} = attributes.${s};`,u.push(a)}for(let h=0;h<r.length;h++){s=r[h];const m=$J(s);if(!l(m)){rs._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${s}, disabling custom fragment shader.`);return}c.push(m.attributeField),a=`fsInput.attributes.${s} = ${m.value};`,u.push(a)}const d=l$e(e);n.enabled=!0,n.attributeFields=c.concat(d.attributeFields),n.initializationLines=d.initializationLines.concat(u)}const d$e={positionWC:!0,positionEC:!0};function YJ(e,t,n){let i,o;const r={};for(o in e)if(e.hasOwnProperty(o)){const a=e[o];i=o,n&&o==="normalMC"?i="normalEC":n&&o==="tangentMC"&&(i="tangentEC"),t.hasOwnProperty(i)&&(r[i]=a)}const s=[];for(o in t)if(t.hasOwnProperty(o)){if(d$e.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 f$e(e,t){const n={enabled:!1},i={enabled:!1},o=r$e(t.attributes);l(e.vertexShaderText)&&c$e(e,o,n),l(e.fragmentShaderText)&&u$e(e,o,i);const 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 h$e(e,t){let n,i=rs.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(i,rs.STRUCT_NAME_ATTRIBUTES,De.VERTEX);const o=t.attributeFields;for(n=0;n<o.length;n++){const a=o[n],c=a[0],u=a[1];e.addStructField(i,c,u)}i=rs.STRUCT_ID_VERTEX_INPUT,e.addStruct(i,rs.STRUCT_NAME_VERTEX_INPUT,De.VERTEX),e.addStructField(i,rs.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,K2.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,A_.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,A_.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,A_.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=rs.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,rs.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,De.VERTEX);const s=t.initializationLines;e.addFunctionLines(r,s)}function p$e(e,t){let n,i=rs.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(i,rs.STRUCT_NAME_ATTRIBUTES,De.FRAGMENT);let o,r,s;const 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=rs.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(i,rs.STRUCT_NAME_FRAGMENT_INPUT,De.FRAGMENT),e.addStructField(i,rs.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,K2.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,A_.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,A_.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,A_.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const c=rs.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,rs.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,De.FRAGMENT);const u=t.initializationLines;e.addFunctionLines(c,u)}const m$e=[];function _$e(e,t,n){const i=n.vertexLines,o=m$e;i.enabled&&(h$e(e,i),o.length=0,o.push("#line 0",t.vertexShaderText,L7e),e.addVertexLines(o));const r=n.fragmentLines;r.enabled&&(p$e(e,r),o.length=0,o.push("#line 0",t.fragmentShaderText,B7e),e.addFragmentLines(o))}const g$e=rs,jb={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};jb.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=l(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,De.VERTEX),i.addFunction(jb.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,jb.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,De.VERTEX);const s=t.attributes;for(let a=0;a<s.length;a++){const c=s[a],u=c.quantization;if(!l(u))continue;const d=c.semantic===wt.POSITION,h=c.semantic===wt.TEXCOORD;if(r&&!d&&!h)continue;const m=en.getAttributeInfo(c);A$e(i,m),y$e(e,m)}};function y$e(e,t){const n=e.shaderBuilder,i=e.uniformMap,o=t.variableName,r=t.attribute.quantization;if(r.octEncoded){const s=`model_normalizationRange_${o}`;n.addUniform("float",s,De.VERTEX),i[s]=function(){return r.normalizationRange}}else{const s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,c=t.glslType;n.addUniform(c,s,De.VERTEX),n.addUniform(c,a,De.VERTEX);let u=r.quantizedVolumeOffset,d=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=P5(u,0),d=P5(d,1)),i[s]=function(){return u},i[a]=function(){return d}}}function P5(e,t){return e instanceof oe?e:new oe(e.x,e.y,e.z,t)}function A$e(e,t){const n=t.variableName,i=t.attribute.quantization;let o;i.octEncoded?o=b$e(n,i):o=C$e(n),e.addFunctionLines(jb.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function b$e(e,t){const n=`attributes.${e}`,i=`a_quantized_${e}`,o=`model_normalizationRange_${e}`,r=t.octEncodedZXY?".zxy":".xyz";return`${n} = czm_octDecode(${i}, ${o})${r};`}function C$e(e){const t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}const T$e=jb,E$e=`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);
|
||
}
|
||
`,x$e=`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;
|
||
}
|
||
`,O5=`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 = texture2D(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
|
||
}
|
||
`,qb={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)"};qb.process=function(e,t,n){const i=e.shaderBuilder;e.hasPropertyTable=!0;const o=e.model,r=e.runtimeNode.node,s=w$e(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),S$e(i);const c=s.featureIds.nullFeatureId,u=e.uniformMap;l(c)&&(i.addDefine("HAS_NULL_FEATURE_ID",void 0,a),i.addUniform("int","model_nullFeatureId",a),u.model_nullFeatureId=function(){return c}),s.shaderDestination===De.BOTH&&i.addVertexLines(O5),i.addFragmentLines(O5)};function L5(e){return e instanceof Ot.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function B5(e){return e instanceof Ot.FeatureIdTexture?De.FRAGMENT:De.BOTH}function w$e(e,t,n){let i,o;return l(t.instances)&&(o=en.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(o))?(i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:B5(o),featureIdDefine:L5(o)}):(o=en.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:B5(o),featureIdDefine:L5(o)})}function S$e(e){e.addStructField(qb.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(qb.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(qb.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}const SR=qb,Gr={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)"};Gr.process=function(e,t,n){const i=e.shaderBuilder,o=e.model;i.addStruct(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",De.VERTEX),i.addStruct(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",De.FRAGMENT),i.addStruct(SR.STRUCT_ID_SELECTED_FEATURE,SR.STRUCT_NAME_SELECTED_FEATURE,De.BOTH),i.addFunction(Gr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,Gr.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,De.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(Gr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,Gr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,De.VERTEX),i.addFunction(Gr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,Gr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,De.FRAGMENT),o.type===ha.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,De.FRAGMENT);const s=n.mode!==le.SCENE3D&&!n.scene3DOnly&&o._projectTo2D,a=l(e.runtimeNode.node.instances),c=s&&!a,u=t.attributes.length;for(let d=0;d<u;d++){const h=t.attributes[d],m=_n.getAttributeLocationCount(h.type);if(!l(h.buffer)&&!l(h.constant))throw new x("Attributes must be provided as a Buffer or constant value");const g=h.semantic===wt.POSITION;let p;m>1?(p=e.attributeIndex,e.attributeIndex+=m):g&&!c?p=0:p=e.attributeIndex++,v$e(e,h,p,m,s,a)}M$e(i,t.attributes),t.primitiveType===Ze.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(x$e),i.addFragmentLines(E$e)};function v$e(e,t,n,i,o,r){const s=e.shaderBuilder,a=en.getAttributeInfo(t),c=o&&!r;i>1?P$e(e,t,n,i):I$e(e,t,n,c),L$e(s,a,c),O$e(s,a),l(t.semantic)&&D$e(s,t),B$e(s,a,o),R$e(s,a,c),N$e(s,a)}function D$e(e,t){const n=t.semantic,i=t.setIndex;switch(n){case wt.NORMAL:e.addDefine("HAS_NORMALS");break;case wt.TANGENT:e.addDefine("HAS_TANGENTS");break;case wt.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case wt.TEXCOORD:case wt.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function I$e(e,t,n,i){const o=t.quantization;let r,s;l(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.semantic,c=t.setIndex;a===wt.FEATURE_ID&&c>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=c+1);const u=a===wt.POSITION,d=u?0:n,h=_n.getNumberOfComponents(r),m={index:d,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,count:t.count,componentsPerAttribute:h,componentDatatype:s,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};if(e.attributes.push(m),!u||!i)return;const g=e.runtimePrimitive.positionBuffer2D,p={index:n,vertexBuffer:g,count:t.count,componentsPerAttribute:h,componentDatatype:ee.FLOAT,offsetInBytes:0,strideInBytes:void 0,normalize:t.normalized};e.attributes.push(p)}function P$e(e,t,n,i){const o=t.quantization;let r,s;l(o)?(r=o.type,s=o.componentDatatype):(r=t.type,s=t.componentDatatype);const a=t.normalized,u=_n.getNumberOfComponents(r)/i,d=ee.getSizeInBytes(s),h=u*d,m=t.byteStride;for(let g=0;g<i;g++){const p=t.byteOffset+g*h,y={index:n+g,vertexBuffer:t.buffer,componentsPerAttribute:u,componentDatatype:s,offsetInBytes:p,strideInBytes:m,normalize:a};e.attributes.push(y)}}function O$e(e,t){const n=t.variableName;let 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 L$e(e,t,n){const i=t.attribute.semantic,o=t.variableName;let r,s;t.isQuantized?(r=`a_quantized_${o}`,s=t.quantizedGlslType):(r=`a_${o}`,s=t.glslType);const a=i===wt.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function B$e(e,t,n){const i=Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=Gr.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 R$e(e,t,n){const i=Gr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,o=t.variableName;if(o==="positionMC"&&n){const a="attributes.position2D = a_position2D;";e.addFunctionLines(i,[a])}if(t.isQuantized)return;const 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 N$e(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(l(n)&&!l(i))return;let o=Gr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const r=t.variableName;let s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=Gr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function M$e(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];r.semantic===wt.NORMAL?n=!0:r.semantic===wt.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(Gr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}const F$e=Gr,z$e=`#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;
|
||
}
|
||
`,U$e={UNLIT:0,PBR:1},yv=Object.freeze(U$e),XJ={name:"LightingPipelineStage"};XJ.process=function(e,t){const n=e.model,i=e.lightingOptions,o=e.shaderBuilder;if(l(n.lightColor)){o.addDefine("USE_CUSTOM_LIGHT_COLOR",void 0,De.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",De.FRAGMENT);const s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===yv.PBR?o.addDefine("LIGHTING_PBR",void 0,De.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,De.FRAGMENT),o.addFragmentLines(z$e)};const H$e=XJ,V$e=`// 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 = texture2D(u_normalTexture, normalTexCoords).rgb;
|
||
normal = normalize(tbn * (2.0 * n - 1.0));
|
||
#elif defined(GL_OES_standard_derivatives)
|
||
// 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 = texture2D(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(texture2D(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 = texture2D(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(texture2D(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(texture2D(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(texture2D(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 = texture2D(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
|
||
}
|
||
`,k$e=Ot.Material,rO=Ot.MetallicRoughness,sO=Ot.SpecularGlossiness,KJ={name:"MaterialPipelineStage",_processTexture:Ap,_processTextureTransform:JJ};KJ.process=function(e,t,n){const i=t.material,o=e.model,r=l(o.classificationType),s=r,a=e.uniformMap,c=e.shaderBuilder,u=n.context.defaultTexture,d=n.context.defaultNormalTexture,h=n.context.defaultEmissiveTexture;G$e(i,a,c,u,d,h,s),l(i.specularGlossiness)?W$e(i,a,c,u,s):j$e(i,a,c,u,s);const m=en.getAttributeBySemantic(t,wt.NORMAL),g=e.lightingOptions;i.unlit||!m||r?g.lightingModel=yv.UNLIT:g.lightingModel=yv.PBR;const p=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=p;const y=e.alphaOptions;i.alphaMode===dv.BLEND?y.pass=Ne.TRANSLUCENT:i.alphaMode===dv.MASK&&(y.alphaCutoff=i.alphaCutoff),c.addFragmentLines(V$e),i.doubleSided&&c.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,De.BOTH)};function JJ(e,t,n,i,o){const r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,De.FRAGMENT);const s=`${i}Transform`;e.addUniform("mat3",s,De.FRAGMENT),t[s]=function(){return n.transform}}function Ap(e,t,n,i,o,r){e.addUniform("sampler2D",i,De.FRAGMENT),t[i]=function(){return A(n.texture,r)};const s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,De.FRAGMENT);const c=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,c,De.FRAGMENT);const d=n.transform;l(d)&&!J.equals(d,J.IDENTITY)&&JJ(e,t,n,i,o)}function G$e(e,t,n,i,o,r,s){const a=e.emissiveTexture;l(a)&&!s&&Ap(n,t,a,"u_emissiveTexture","EMISSIVE",r);const c=e.emissiveFactor;l(c)&&!f.equals(c,k$e.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",De.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,De.FRAGMENT));const u=e.normalTexture;l(u)&&!s&&Ap(n,t,u,"u_normalTexture","NORMAL",o);const d=e.occlusionTexture;l(d)&&!s&&Ap(n,t,d,"u_occlusionTexture","OCCLUSION",i)}function W$e(e,t,n,i,o){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,De.FRAGMENT);const s=r.diffuseTexture;l(s)&&!o&&Ap(n,t,s,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;l(a)&&!oe.equals(a,sO.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",De.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,De.FRAGMENT));const c=r.specularGlossinessTexture;l(c)&&!o&&Ap(n,t,c,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const u=r.specularFactor;l(u)&&!f.equals(u,sO.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",De.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,De.FRAGMENT));const d=r.glossinessFactor;l(d)&&d!==sO.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",De.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,De.FRAGMENT))}function j$e(e,t,n,i,o){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,De.FRAGMENT);const s=r.baseColorTexture;l(s)&&!o&&Ap(n,t,s,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;l(a)&&!oe.equals(a,rO.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",De.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,De.FRAGMENT));const c=r.metallicRoughnessTexture;l(c)&&!o&&Ap(n,t,c,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const u=r.metallicFactor;l(u)&&u!==rO.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",De.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,De.FRAGMENT));const d=r.roughnessFactor;l(d)&&d!==rO.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",De.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,De.FRAGMENT))}const q$e=KJ,$$e=`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
|
||
}`,ws={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)"};ws.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,De.VERTEX),Z$e(n);const i=t.morphTargets.length;for(let a=0;a<i;a++){const c=t.morphTargets[a].attributes,u=c.length;for(let d=0;d<u;d++){const h=c[d],m=h.semantic;m!==wt.POSITION&&m!==wt.NORMAL&&m!==wt.TANGENT||(X$e(e,h,e.attributeIndex,a),e.attributeIndex++)}}eYe(n);const r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,De.VERTEX),n.addVertexLines($$e);const s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=hn(s,e.uniformMap)};const Y$e={attributeString:void 0,functionId:void 0};function X$e(e,t,n,i){const o=e.shaderBuilder;K$e(e,t,n);const r=J$e(t,Y$e);Q$e(o,r,i)}function K$e(e,t,n){const i={index:n,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:_n.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function J$e(e,t){switch(e.semantic){case wt.POSITION:t.attributeString="Position",t.functionId=ws.FUNCTION_ID_GET_MORPHED_POSITION;break;case wt.NORMAL:t.attributeString="Normal",t.functionId=ws.FUNCTION_ID_GET_MORPHED_NORMAL;break;case wt.TANGENT:t.attributeString="Tangent",t.functionId=ws.FUNCTION_ID_GET_MORPHED_TANGENT;break}return t}function Q$e(e,t,n){const 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 Z$e(e){e.addFunction(ws.FUNCTION_ID_GET_MORPHED_POSITION,ws.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,De.VERTEX);const t="vec3 morphedPosition = position;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(ws.FUNCTION_ID_GET_MORPHED_NORMAL,ws.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,De.VERTEX);const n="vec3 morphedNormal = normal;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(ws.FUNCTION_ID_GET_MORPHED_TANGENT,ws.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,De.VERTEX);const i="vec3 morphedTangent = tangent;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function eYe(e){const t="return morphedPosition;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_POSITION,[t]);const n="return morphedNormal;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);const i="return morphedTangent;";e.addFunctionLines(ws.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}const tYe=ws,QJ={name:"PickingPipelineStage"};QJ.process=function(e,t,n){const i=n.context,o=e.runtimeNode,r=e.shaderBuilder,s=e.model,a=o.node.instances;if(e.hasPropertyTable)nYe(e,t,a);else if(l(a))iYe(e,i);else{const c=ZJ(e),u=i.createPickId(c);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",De.FRAGMENT);const d=e.uniformMap;d.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function ZJ(e,t){const n=e.model;if(l(n.pickObject))return n.pickObject;const i={model:n,node:e.runtimeNode,primitive:e.runtimePrimitive};let o;if(ha.is3DTiles(n.type)){const r=n.content;o={content:r,primitive:r.tileset,detail:i}}else o={primitive:n,detail:i};return o.id=n.id,l(t)&&(o.instanceId=t),o}function nYe(e,t,n){const i=e.model;let o,r;const s=i.featureIdLabel,a=i.instanceFeatureIdLabel;l(i.featureTableId)?o=i.featureTableId:l(n)?(r=en.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=en.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);const c=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",De.FRAGMENT);const d=c.batchTexture;e.uniformMap.model_pickTexture=function(){return A(d.pickTexture,d.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function iYe(e,t){const n=e.instanceCount,i=new Array(n),o=new Uint8Array(n*4),r=e.model,s=r._pipelineResources;for(let h=0;h<n;h++){const m=ZJ(e,h),g=t.createPickId(m);s.push(g),i[h]=g;const p=g.color;o[h*4+0]=H.floatToByte(p.red),o[h*4+1]=H.floatToByte(p.green),o[h*4+2]=H.floatToByte(p.blue),o[h*4+3]=H.floatToByte(p.alpha)}r._pickIds=i;const a=Tt.createVertexBuffer({context:t,typedArray:o,usage:nt.STATIC_DRAW});a.vertexArrayDestroyable=!1;const c=!1;r.statistics.addBuffer(a,c),s.push(a);const u={index:e.attributeIndex++,vertexBuffer:a,componentsPerAttribute:4,componentDatatype:ee.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0,instanceDivisor:1};e.attributes.push(u);const d=e.shaderBuilder;d.addDefine("USE_PICKING",void 0,De.BOTH),d.addAttribute("vec4","a_pickColor"),d.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}const oYe=QJ,rYe=`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`,sYe=new oe,eQ={name:"PointCloudStylingPipelineStage"};eQ.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=o.style,s=o.structuralMetadata,a=l(s)?s.propertyAttributes:void 0,c=l(o.featureTableId)&&o.featureTables[o.featureTableId].featuresLength>0,u=!l(a)&&c;if(l(r)&&!u){const y=uYe(a),b=dYe(r,y);fYe(i,b);const E=hYe(b).indexOf("normalMC")>=0,w=en.getAttributeBySemantic(t,wt.NORMAL);if(E&&!w)throw new Ie("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,De.VERTEX),b.styleTranslucent&&(e.alphaOptions.pass=Ne.TRANSLUCENT)}const d=o.pointCloudShading;d.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,De.VERTEX),d.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,De.VERTEX);let h,m,g;ha.is3DTiles(o.type)&&(m=!0,h=o.content,g=h.tile.refine===Pa.ADD),i.addUniform("vec4","model_pointCloudParameters",De.VERTEX),i.addVertexLines(rYe);const p=e.uniformMap;p.model_pointCloudParameters=function(){const y=sYe;let b=1;m&&(b=g?5:h.tileset.maximumScreenSpaceError),y.x=A(d.maximumAttenuation,b),y.x*=n.pixelRatio;const C=aYe(e,t,d,h);y.y=C*d.geometricErrorScale;const E=n.context,w=n.camera.frustum;let S;return n.mode===le.SCENE2D||w instanceof Gt?S=Number.POSITIVE_INFINITY:S=E.drawingBufferHeight/n.camera.frustum.sseDenominator,y.z=S,m&&(y.w=h.tileset.timeSinceLoad),y}};const R5=new f;function aYe(e,t,n,i){if(l(i)){const d=i.tile.geometricError;if(d>0)return d}if(l(n.baseResolution))return n.baseResolution;const o=en.getAttributeBySemantic(t,wt.POSITION),r=o.count,s=e.runtimeNode.transform;let a=f.subtract(o.max,o.min,R5);a=B.multiplyByPointAsVector(s,a,R5);const c=a.x*a.y*a.z;return M.cbrt(c/r)}const cYe={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},lYe={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function uYe(e){const t=ht(lYe);if(!l(e))return t;for(let n=0;n<e.length;n++){const o=e[n].properties;for(const r in o)o.hasOwnProperty(r)&&(t[r]=`metadata.${r}`)}return t}const aO="ProcessedAttributes attributes, Metadata metadata, float tiles3d_tileset_time";function dYe(e,t){const n=cYe,i={translucent:!1};return n.colorStyleFunction=e.getColorShaderFunction(`getColorFromStyle(${aO})`,t,i),n.showStyleFunction=e.getShowShaderFunction(`getShowFromStyle(${aO})`,t,i),n.pointSizeStyleFunction=e.getPointSizeShaderFunction(`getPointSizeFromStyle(${aO})`,t,i),n.styleTranslucent=l(n.colorStyleFunction)&&i.translucent,n}function fYe(e,t){const n=t.colorStyleFunction;l(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,De.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));const i=t.showStyleFunction;l(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,De.VERTEX),e.addVertexLines(i));const o=t.pointSizeStyleFunction;l(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,De.VERTEX),e.addVertexLines(o))}function cO(e,t){const n=/attributes\.(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function hYe(e){const t=e.colorStyleFunction,n=e.showStyleFunction,i=e.pointSizeStyleFunction,o=[];return l(t)&&cO(t,o),l(n)&&cO(n,o),l(i)&&cO(i,o),o}const pYe=eQ,mYe=`void primitiveOutlineStage() {
|
||
v_outlineCoordinates = a_outlineCoordinates;
|
||
}
|
||
`,_Ye=`void primitiveOutlineStage(inout czm_modelMaterial material) {
|
||
if (!model_showOutline) {
|
||
return;
|
||
}
|
||
|
||
float outlineX =
|
||
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r;
|
||
float outlineY =
|
||
texture2D(model_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r;
|
||
float outlineZ =
|
||
texture2D(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);
|
||
}
|
||
|
||
`,tQ={name:"PrimitiveOutlinePipelineStage"};tQ.process=function(e,t,n){const i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,De.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");const r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:_n.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",De.FRAGMENT);const a=FT.createTexture(n.context);o.model_outlineTexture=function(){return a};const c=e.model;i.addUniform("vec4","model_outlineColor",De.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",De.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines(mYe),i.addFragmentLines(_Ye)};const gYe=tQ,nQ={name:"PrimitiveStatisticsPipelineStage",_countGeometry:iQ,_count2DPositions:oQ,_countMorphTargetAttributes:rQ,_countMaterialTextures:sQ,_countFeatureIdTextures:aQ,_countBinaryMetadata:cQ};nQ.process=function(e,t,n){const i=e.model,o=i.statistics;iQ(o,t),oQ(o,e.runtimePrimitive),rQ(o,t),sQ(o,t.material),aQ(o,t.featureIds),cQ(o,i)};function iQ(e,t){const n=l(t.indices)?t.indices.count:en.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===Ze.POINTS?e.pointsLength+=n:Ze.isTriangles(i)&&(e.trianglesLength+=yYe(i,n));const o=t.attributes,r=o.length;for(let c=0;c<r;c++){const u=o[c];if(l(u.buffer)){const d=l(u.typedArray);e.addBuffer(u.buffer,d)}}const s=t.outlineCoordinates;l(s)&&l(s.buffer)&&e.addBuffer(s.buffer,!1);const a=t.indices;if(l(a)&&l(a.buffer)){const c=l(a.typedArray);e.addBuffer(a.buffer,c)}}function yYe(e,t){switch(e){case Ze.TRIANGLES:return t/3;case Ze.TRIANGLE_STRIP:case Ze.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function oQ(e,t){const n=t.positionBuffer2D;l(n)&&e.addBuffer(n,!0)}function rQ(e,t){const n=t.morphTargets;if(!l(n))return;const i=!1,o=n.length;for(let r=0;r<o;r++){const s=n[r].attributes,a=s.length;for(let c=0;c<a;c++){const u=s[c];l(u.buffer)&&e.addBuffer(u.buffer,i)}}}function sQ(e,t){const n=AYe(t),i=n.length;for(let o=0;o<i;o++){const r=n[o];l(r)&&l(r.texture)&&e.addTexture(r.texture)}}function AYe(e){const t=e.metallicRoughness,n=[e.emissiveTexture,e.normalTexture,e.occlusionTexture,t.baseColorTexture,t.metallicRoughnessTexture],i=e.specularGlossiness;return l(i)&&(n.push(i.diffuseTexture),n.push(i.specularGlossinessTexture)),n}function aQ(e,t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];if(o instanceof Ot.FeatureIdTexture){const r=o.textureReader;l(r.texture)&&e.addTexture(r.texture)}}}function cQ(e,t){const n=t.structuralMetadata;l(n)&&(bYe(e,n),e.propertyTablesByteLength+=n.propertyTablesByteLength);const i=t.featureTables;if(!l(i))return;const o=i.length;for(let r=0;r<o;r++){const s=i[r];e.addBatchTexture(s.batchTexture)}}function bYe(e,t){const n=t.propertyTextures;if(!l(n))return;const i=n.length;for(let o=0;o<i;o++){const s=n[o].properties;for(const a in s)if(s.hasOwnProperty(a)){const u=s[a].textureReader;l(u.texture)&&e.addTexture(u.texture)}}}const CYe=nQ,TYe=new B,EYe=new B,lQ={name:"SceneMode2DPipelineStage"};lQ.process=function(e,t,n){const i=en.getAttributeBySemantic(t,wt.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=B.multiplyTransformation(s,a,TYe),u=SYe(e,c,n),d=e.runtimePrimitive;d.boundingSphere2D=u;const h=e.runtimeNode.node.instances;if(l(h))return;if(l(i.typedArray)){const y=IYe(i,c,u,n);d.positionBuffer2D=y,r._modelResources.push(y),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,De.VERTEX),o.addUniform("mat4","u_modelView2D",De.VERTEX);const m=B.fromTranslation(u.center,new B),g=n.context,p={u_modelView2D:function(){return B.multiplyTransformation(g.uniformState.view,m,EYe)}};e.uniformMap=hn(p,e.uniformMap)};const xYe=new f,wYe=new f;function SYe(e,t,n){const i=B.multiplyByPoint(t,e.positionMin,xYe),o=br.computeActualWgs84Position(n,i,i),r=B.multiplyByPoint(t,e.positionMax,wYe),s=br.computeActualWgs84Position(n,r,r);return fe.fromCornerPoints(o,s,new fe)}const uQ=new f;function vYe(e,t){const n=e.length,i=new Float32Array(n),o=t.quantizedVolumeOffset,r=t.quantizedVolumeStepSize;for(let s=0;s<n;s+=3){const a=f.fromArray(e,s,uQ),c=f.multiplyComponents(a,r,a),u=f.add(c,o,c);i[s]=u.x,i[s+1]=u.y,i[s+2]=u.z}return i}function DYe(e,t,n,i){let o;l(e.quantization)?o=vYe(e.typedArray,e.quantization):o=e.typedArray.slice();const r=e.byteOffset/Float32Array.BYTES_PER_ELEMENT,s=o.length,a=l(e.byteStride)?e.byteStride/Float32Array.BYTES_PER_ELEMENT:3;for(let c=r;c<s;c+=a){const u=f.fromArray(o,c,uQ);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z))continue;const d=B.multiplyByPoint(t,u,u),h=br.computeActualWgs84Position(i,d,d),m=f.subtract(h,n,h);o[c]=m.x,o[c+1]=m.y,o[c+2]=m.z}return o}function IYe(e,t,n,i){const o=ht(i);o.mode=le.COLUMBUS_VIEW;const r=n.center,s=DYe(e,t,r,o),a=Tt.createVertexBuffer({context:i.context,typedArray:s,usage:nt.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}const PYe=lQ,OYe=`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
|
||
}`,Km={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};Km.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,De.VERTEX),BYe(n,t);const i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,De.VERTEX),n.addVertexLines(OYe);const r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=hn(r,e.uniformMap)};function LYe(e){let t=-1;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];(r.semantic===wt.JOINTS||r.semantic===wt.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function BYe(e,t){e.addFunction(Km.FUNCTION_ID_GET_SKINNING_MATRIX,Km.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,De.VERTEX);const n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(Km.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o;const r=["x","y","z","w"],s=LYe(t);for(i=0;i<=s;i++)for(o=0;o<=3;o++){const c=r[o],u=`skinnedMatrix += a_weights_${i}.${c} * u_jointMatrices[int(a_joints_${i}.${c})];`;e.addFunctionLines(Km.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}const a="return skinnedMatrix;";e.addFunctionLines(Km.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}const RYe=Km,J2={};function NYe(e){const t=at.createTypedArray(e,e*2),n=e;let 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 MYe(e,t){const n=t.length,i=at.createTypedArray(e,n*2);let o=0;for(let r=0;r<n;r+=3){const 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 FYe(e){const t=e-2,n=2+t*4,i=at.createTypedArray(e,n);let 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 zYe(e,t){const i=t.length-2,o=2+i*4,r=at.createTypedArray(e,o);let s=0;r[s++]=t[0],r[s++]=t[1];for(let a=0;a<i;a++){const c=t[a],u=t[a+1],d=t[a+2];r[s++]=u,r[s++]=d,r[s++]=d,r[s++]=c}return r}function UYe(e){const t=e-2,n=2+t*4,i=at.createTypedArray(e,n);let 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 HYe(e,t){const i=t.length-2,o=2+i*4,r=at.createTypedArray(e,o);let s=0;const a=t[0];r[s++]=a,r[s++]=t[1];for(let c=0;c<i;c++){const u=t[c+1],d=t[c+2];r[s++]=u,r[s++]=d,r[s++]=d,r[s++]=a}return r}J2.createWireframeIndices=function(e,t,n){const i=l(n);if(e===Ze.TRIANGLES)return i?MYe(t,n):NYe(t);if(e===Ze.TRIANGLE_STRIP)return i?zYe(t,n):FYe(t);if(e===Ze.TRIANGLE_FAN)return i?HYe(t,n):UYe(t)};J2.getWireframeIndicesCount=function(e,t){return e===Ze.TRIANGLES?t*2:e===Ze.TRIANGLE_STRIP||e===Ze.TRIANGLE_FAN?2+(t-2)*4:t};const dQ=J2,fQ={name:"WireframePipelineStage"};fQ.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,De.FRAGMENT);const o=e.model,r=VYe(t,e.indices,n);o._pipelineResources.push(r),e.wireframeIndexBuffer=r;const s=!1;o.statistics.addBuffer(r,s);const a=e.primitiveType,c=e.count;e.primitiveType=Ze.LINES,e.count=dQ.getWireframeIndicesCount(a,c)};function VYe(e,t,n){const o=en.getAttributeBySemantic(e,wt.POSITION).count,r=n.context.webgl2;let s;if(l(t)){const d=t.buffer,h=t.count;l(d)&&r?(s=d.sizeInBytes===h?new Uint8Array(h):at.createTypedArray(o,h),d.getBufferData(s)):s=t.typedArray}const a=e.primitiveType,c=dQ.createWireframeIndices(a,o,s),u=at.fromSizeInBytes(c.BYTES_PER_ELEMENT);return Tt.createIndexBuffer({context:n.context,typedArray:c,usage:nt.STATIC_DRAW,indexDatatype:u})}const kYe=fQ;function hQ(e){e=A(e,A.EMPTY_OBJECT);const t=e.primitive,n=e.node,i=e.model;T.typeOf.object("options.primitive",t),T.typeOf.object("options.node",n),T.typeOf.object("options.model",i),this.primitive=t,this.node=n,this.model=i,this.pipelineStages=[],this.drawCommand=void 0,this.boundingSphere=void 0,this.boundingSphere2D=void 0,this.positionBuffer2D=void 0,this.batchLengths=void 0,this.batchOffsets=void 0,this.updateStages=[]}hQ.prototype.configurePipeline=function(e){const t=this.pipelineStages;t.length=0;const n=this.primitive,i=this.node,o=this.model,r=o.customShader,s=o.style,a=e.context.webgl2,u=e.mode!==le.SCENE3D&&!e.scene3DOnly&&o._projectTo2D,d=l(n.morphTargets)&&n.morphTargets.length>0,h=l(i.skin),m=l(r),p=!(m&&l(r.fragmentShaderText))||r.mode!==X2.REPLACE_MATERIAL,y=en.hasQuantizedAttributes(n.attributes),b=o.debugWireframe&&Ze.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),C=o.pointCloudShading,E=l(C)&&C.attenuation,w=l(C)&&C.backFaceCulling,S=n.primitiveType===Ze.POINTS&&(l(s)||E||w),P=o._enableShowOutline&&l(n.outlineCoordinates),L=GYe(o,i,n),z=l(o.classificationType);u&&t.push(PYe),t.push(F$e),b&&t.push(kYe),z&&t.push(D7e),d&&t.push(tYe),h&&t.push(RYe),S&&t.push(pYe),y&&t.push(T$e),p&&t.push(q$e),t.push(K2),t.push(A_),L.hasPropertyTable&&(t.push(SR),t.push(S7e),t.push(O7e)),m&&t.push(g$e),t.push(H$e),o.allowPicking&&t.push(oYe),P&&t.push(gYe),t.push(w7e),t.push(CYe)};function GYe(e,t,n){let i;return l(t.instances)&&(i=en.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(i))?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:(i=en.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),l(i)?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function Q2(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.skin",e.skin),T.typeOf.object("options.sceneGraph",e.sceneGraph),this._sceneGraph=e.sceneGraph;const t=e.skin;this._skin=t,this._inverseBindMatrices=void 0,this._joints=[],this._jointMatrices=[],WYe(this)}Object.defineProperties(Q2.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 WYe(e){const t=e.skin,n=t.inverseBindMatrices;e._inverseBindMatrices=n;const i=t.joints,o=i.length,r=e.sceneGraph._runtimeNodes,s=e.joints,a=e._jointMatrices;for(let c=0;c<o;c++){const u=i[c].index,d=r[u];s.push(d);const h=n[c],m=pQ(d,h,new B);a.push(m)}}function pQ(e,t,n){const i=B.multiplyTransformation(e.transformToRoot,e.transform,n);return n=B.multiplyTransformation(i,t,n),n}Q2.prototype.updateJointMatrices=function(){const e=this._jointMatrices,t=e.length;for(let n=0;n<t;n++){const i=this.joints[n],o=this.inverseBindMatrices[n];e[n]=pQ(i,o,e[n])}};function jYe(){this.pass=void 0,this.alphaCutoff=void 0}function qYe(e){T.typeOf.object("model",e),this.shaderBuilder=new _a,this.model=e,this.uniformMap={},this.alphaOptions=new jYe,this.renderStateOptions=et.getState(et.fromCache({depthTest:{enabled:!0,func:x_.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}const $Ye=`void silhouetteStage(inout vec4 color) {
|
||
if(model_silhouettePass) {
|
||
color = czm_gammaCorrect(model_silhouetteColor);
|
||
}
|
||
}`,YYe=`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
|
||
}
|
||
`,Av={name:"ModelSilhouettePipelineStage"};Av.silhouettesLength=0;Av.process=function(e,t,n){l(t._silhouetteId)||(t._silhouetteId=++Av.silhouettesLength);const i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,De.BOTH),i.addVertexLines(YYe),i.addFragmentLines($Ye),i.addUniform("vec4","model_silhouetteColor",De.FRAGMENT),i.addUniform("float","model_silhouetteSize",De.VERTEX),i.addUniform("bool","model_silhouettePass",De.BOTH);const o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=hn(o,e.uniformMap),e.hasSilhouette=!0};const XYe=Av,KYe=`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
|
||
}
|
||
`,aS={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};aS.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,De.FRAGMENT),i.addFragmentLines(KYe);const o={};i.addUniform("float",aS.SPLIT_DIRECTION_UNIFORM_NAME,De.FRAGMENT),o[aS.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=hn(o,e.uniformMap)};const JYe=aS;function QYe(e,t){T.typeOf.object("modelRenderResources",e),T.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=ht(e.uniformMap),this.alphaOptions=ht(e.alphaOptions),this.renderStateOptions=ht(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}function ZYe(e){e=A(e,A.EMPTY_OBJECT),this.lightingModel=A(e.lightingModel,yv.UNLIT)}function eXe(e,t){T.typeOf.object("nodeRenderResources",e),T.typeOf.object("runtimePrimitive",t),this.model=e.model,this.runtimeNode=e.runtimeNode,this.attributes=e.attributes.slice(),this.attributeIndex=e.attributeIndex,this.featureIdVertexAttributeSetIndex=e.featureIdVertexAttributeSetIndex,this.uniformMap=ht(e.uniformMap),this.alphaOptions=ht(e.alphaOptions),this.renderStateOptions=ht(e.renderStateOptions,!0),this.hasSilhouette=e.hasSilhouette,this.hasSkipLevelOfDetail=e.hasSkipLevelOfDetail,this.shaderBuilder=e.shaderBuilder.clone(),this.instanceCount=e.instanceCount,this.runtimePrimitive=t;const n=t.primitive;this.count=l(n.indices)?n.indices.count:en.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=en.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=f.clone(i.min,new f),this.positionMax=f.clone(i.max,new f),this.boundingSphere=fe.fromCornerPoints(this.positionMin,this.positionMax,new fe),this.lightingOptions=new ZYe,this.pickId=void 0}function Nc(e){e=A(e,A.EMPTY_OBJECT);const t=e.modelComponents;T.typeOf.object("options.model",e.model),T.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=B.clone(B.IDENTITY),this._computedModelMatrix2D=B.clone(B.IDENTITY),this._axisCorrectionMatrix=en.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new B),this._runtimeArticulations={},tXe(this)}Object.defineProperties(Nc.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 tXe(e){const t=e._components,n=t.scene,o=e._model.modelMatrix;mQ(e,o);const r=t.articulations,s=r.length,a=e._runtimeArticulations;for(let E=0;E<s;E++){const w=r[E],S=new qD({articulation:w,sceneGraph:e}),P=S.name;a[P]=S}const c=t.nodes,u=c.length;e._runtimeNodes=new Array(u);const h=n.nodes.length,m=B.IDENTITY;for(let E=0;E<h;E++){const w=n.nodes[E],S=_Q(e,w,m);e._rootNodes.push(S)}const g=t.skins,p=e._runtimeSkins,y=g.length;for(let E=0;E<y;E++){const w=g[E];p.push(new Q2({skin:w,sceneGraph:e}))}const b=e._skinnedNodes,C=b.length;for(let E=0;E<C;E++){const w=b[E],S=e._runtimeNodes[w],L=c[w].skin.index;S._runtimeSkin=p[L],S.updateJointMatrices()}e.applyArticulations()}function mQ(e,t){const n=e._components,i=e._model;e._computedModelMatrix=B.multiplyTransformation(t,n.transform,e._computedModelMatrix),e._computedModelMatrix=B.multiplyTransformation(e._computedModelMatrix,e._axisCorrectionMatrix,e._computedModelMatrix),e._computedModelMatrix=B.multiplyByUniformScale(e._computedModelMatrix,i.computedScale,e._computedModelMatrix)}const nXe=new f;function iXe(e,t){const n=e._computedModelMatrix,i=B.getTranslation(n,nXe);if(!f.equals(i,f.ZERO))e._computedModelMatrix2D=cn.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{const o=e.boundingSphere.center,r=cn.wgs84To2DModelMatrix(t.mapProjection,o,e._computedModelMatrix2D);e._computedModelMatrix2D=B.multiply(r,n,e._computedModelMatrix2D)}e._boundingSphere2D=fe.transform(e._boundingSphere,e._computedModelMatrix2D,e._boundingSphere2D)}function _Q(e,t,n){const i=[],o=en.getNodeTransform(t),r=t.children.length;for(let d=0;d<r;d++){const h=t.children[d],m=B.multiplyTransformation(n,o,new B),g=_Q(e,h,m);i.push(g)}const s=new j0({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let d=0;d<a;d++)s.runtimePrimitives.push(new hQ({primitive:t.primitives[d],node:t,model:e._model}));const c=t.index;e._runtimeNodes[c]=s,l(t.skin)&&e._skinnedNodes.push(c);const u=t.name;if(l(u)){const d=e._model,h=new wJ(d,s);d._nodesByName[u]=h}return c}const oXe=new f,rXe=new f,sXe=new f,aXe=new f;Nc.prototype.buildDrawCommands=function(e){const t=this._model,n=new qYe(t);t.statistics.clear(),this.configurePipeline(e);const i=this.modelPipelineStages;let o,r,s;for(o=0;o<i.length;o++)i[o].process(n,t,e);const a=f.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,oXe),c=f.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,rXe);for(o=0;o<this._runtimeNodes.length;o++){const u=this._runtimeNodes[o];if(!l(u))continue;u.configurePipeline();const d=u.pipelineStages,h=new QYe(n,u);for(r=0;r<d.length;r++)d[r].process(h,u.node,e);const m=u.computedTransform;for(r=0;r<u.runtimePrimitives.length;r++){const g=u.runtimePrimitives[r];g.configurePipeline(e);const p=g.pipelineStages,y=new eXe(h,g);for(s=0;s<p.length;s++)p[s].process(y,g.primitive,e);g.boundingSphere=fe.clone(y.boundingSphere,new fe);const b=B.multiplyByPoint(m,y.positionMin,sXe),C=B.multiplyByPoint(m,y.positionMax,aXe);f.minimumByComponent(a,b,a),f.maximumByComponent(c,C,c);const E=Vqe(y,e);g.drawCommand=E}}this._boundingSphere=fe.fromCornerPoints(a,c,new fe),this._boundingSphere=fe.transformWithoutScale(this._boundingSphere,this._axisCorrectionMatrix,this._boundingSphere),this._boundingSphere=fe.transform(this._boundingSphere,this._components.transform,this._boundingSphere),t._boundingSphere=fe.transform(this._boundingSphere,t.modelMatrix,t._boundingSphere),t._initialRadius=t._boundingSphere.radius,t._boundingSphere.radius*=t._clampedScale};Nc.prototype.configurePipeline=function(e){const t=this.modelPipelineStages;t.length=0;const n=this._model;l(n.color)&&t.push(TR),!l(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(jqe),n.isClippingEnabled()&&t.push(e7e),n.hasSilhouette(e)&&t.push(XYe),l(n.splitDirection)&&n.splitDirection!==Z_.NONE&&t.push(JYe),ha.is3DTiles(n.type)&&t.push(Gqe))};Nc.prototype.update=function(e,t){let n,i,o;for(n=0;n<this._runtimeNodes.length;n++){const r=this._runtimeNodes[n];if(!l(r))continue;for(i=0;i<r.updateStages.length;i++)r.updateStages[i].update(r,this,e);const s=e.mode!==le.SCENE3D&&this._model._projectTo2D;for(t&&!s&&this.updateJointMatrices(),i=0;i<r.runtimePrimitives.length;i++){const a=r.runtimePrimitives[i];for(o=0;o<a.updateStages.length;o++)a.updateStages[o].update(a,this)}}};Nc.prototype.updateModelMatrix=function(e,t){mQ(this,e),t.mode!==le.SCENE3D&&iXe(this,t);const n=this._rootNodes;for(let i=0;i<n.length;i++){const o=this._runtimeNodes[n[i]];o._transformDirty=!0}};Nc.prototype.updateJointMatrices=function(){const e=this._skinnedNodes,t=e.length;for(let n=0;n<t;n++){const i=e[n];this._runtimeNodes[i].updateJointMatrices()}};function gQ(e,t,n,i,o){if(n&&!t.show)return;const r=t.children.length;for(let c=0;c<r;c++){const u=t.getChild(c);gQ(e,u,n,i,o)}const s=t.runtimePrimitives,a=s.length;for(let c=0;c<a;c++){const u=s[c];i(u,o)}}function $D(e,t,n,i){const o=e._rootNodes,r=o.length;for(let s=0;s<r;s++){const a=o[s],c=e._runtimeNodes[a];gQ(e,c,t,n,i)}}const cXe={backFaceCulling:void 0};Nc.prototype.updateBackFaceCulling=function(e){const t=cXe;t.backFaceCulling=e,$D(this,!1,lXe,t)};function lXe(e,t){const n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}const uXe={shadowMode:void 0};Nc.prototype.updateShadows=function(e){const t=uXe;t.shadowMode=e,$D(this,!1,dXe,t)};function dXe(e,t){const n=e.drawCommand;n.shadows=t.shadowMode}const fXe={debugShowBoundingVolume:void 0};Nc.prototype.updateShowBoundingVolume=function(e){const t=fXe;t.debugShowBoundingVolume=e,$D(this,!1,hXe,t)};function hXe(e,t){const n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}const yQ=[],pXe={frameState:void 0,hasSilhouette:void 0};Nc.prototype.pushDrawCommands=function(e){const t=yQ;t.length=0;const n=pXe;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,$D(this,!0,mXe,n),e.commandList.push.apply(e.commandList,t)};function mXe(e,t){const n=t.frameState,i=t.hasSilhouette,o=n.passes,r=yQ,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}Nc.prototype.setArticulationStage=function(e,t){const n=e.split(" ");if(n.length!==2)return;const i=n[0],o=n[1],r=this._runtimeArticulations[i];l(r)&&r.setArticulationStage(o,t)};Nc.prototype.applyArticulations=function(){const e=this._runtimeArticulations;for(const t in e)e.hasOwnProperty(t)&&e[t].apply()};function q0(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new vt}Object.defineProperties(q0.prototype,{batchTexturesByteLength:{get:function(){const e=this._batchTextureIdMap.length,t=this._batchTextureIdMap.values;let n=0;for(let i=0;i<e;i++)n+=t[i].byteLength;return n}}});q0.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()};q0.prototype.addBuffer=function(e,t){if(T.typeOf.object("buffer",e),T.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){const n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};q0.prototype.addTexture=function(e){T.typeOf.object("texture",e),this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0};q0.prototype.addBatchTexture=function(e){T.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};const AQ={},Sm=Uint32Array.BYTES_PER_ELEMENT;AQ.parse=function(e,t){t=A(t,0),T.defined("arrayBuffer",e);const n=new Uint8Array(e),i=new DataView(e);t+=Sm;const o=i.getUint32(t,!0);if(o!==1)throw new Ie(`Only Point Cloud tile version 1 is supported. Version ${o} is not.`);t+=Sm,t+=Sm;const r=i.getUint32(t,!0);if(r===0)throw new Ie("Feature table must have a byte length greater than zero");t+=Sm;const s=i.getUint32(t,!0);t+=Sm;const a=i.getUint32(t,!0);t+=Sm;const c=i.getUint32(t,!0);t+=Sm;const u=Ya(n,t,r);t+=r;const d=new Uint8Array(e,t,s);t+=s;let h,m;a>0&&(h=Ya(n,t,a),t+=a,c>0&&(m=new Uint8Array(e,t,c),t+=c));const g=new om(u,d),p=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=p,!l(p))throw new Ie("Feature table global property: POINTS_LENGTH must be defined");let y=g.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(y)&&(y=f.unpack(y));const b=_Xe(g,h);if(b.rtcCenter=y,b.pointsLength=p,!b.hasPositions){const C=gXe(g);b.positions=C,b.hasPositions=b.hasPositions||l(C)}if(!b.hasPositions)throw new Ie("Either POSITION or POSITION_QUANTIZED must be defined.");if(!b.hasNormals){const C=AXe(g);b.normals=C,b.hasNormals=b.hasNormals||l(C)}if(!b.hasColors){const C=yXe(g);b.colors=C,b.hasColors=b.hasColors||l(C),b.hasConstantColor=l(b.constantColor),b.isTranslucent=l(C)&&C.isTranslucent}if(!b.hasBatchIds){const C=bXe(g);b.batchIds=C,b.hasBatchIds=b.hasBatchIds||l(C)}if(b.hasBatchIds){const C=g.getGlobalProperty("BATCH_LENGTH");if(!l(C))throw new Ie("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");b.batchLength=C}return l(m)&&(m=new Uint8Array(m),b.batchTableJson=h,b.batchTableBinary=m),b};function _Xe(e,t){const n=e.json;let i,o,r;const s=l(n.extensions)?n.extensions["3DTILES_draco_point_compression"]:void 0,a=l(t)&&l(t.extensions)?t.extensions["3DTILES_draco_point_compression"]:void 0;l(a)&&(r=a.properties);let c,u,d,h,m;if(l(s)){o=s.properties;const p=s.byteOffset,y=s.byteLength;if(!l(o)||!l(p)||!l(y))throw new Ie("Draco properties, byteOffset, and byteLength must be defined");i=e.buffer.slice(p,p+y),c=l(o.POSITION),u=l(o.RGB)||l(o.RGBA),d=l(o.NORMAL),h=l(o.BATCH_ID),m=l(o.RGBA)}let g;return l(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:hn(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:c,hasColors:u,isTranslucent:m,hasNormals:d,hasBatchIds:h}}function gXe(e){const t=e.json;let n;if(l(t.POSITION))return n=e.getPropertyArray("POSITION",ee.FLOAT,3),{name:wt.POSITION,semantic:wt.POSITION,typedArray:n,isQuantized:!1,componentDatatype:ee.FLOAT,type:_n.VEC3};if(l(t.POSITION_QUANTIZED)){n=e.getPropertyArray("POSITION_QUANTIZED",ee.UNSIGNED_SHORT,3);const i=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",ee.FLOAT,3);if(!l(i))throw new Ie("Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=(1<<16)-1,r=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",ee.FLOAT,3);if(!l(r))throw new Ie("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:wt.POSITION,semantic:wt.POSITION,typedArray:n,isQuantized:!0,componentDatatype:ee.FLOAT,type:_n.VEC3,quantizedRange:o,quantizedVolumeOffset:f.unpack(r),quantizedVolumeScale:f.unpack(i),quantizedComponentDatatype:ee.UNSIGNED_SHORT,quantizedType:_n.VEC3}}}function yXe(e){const t=e.json;let n;if(l(t.RGBA))return n=e.getPropertyArray("RGBA",ee.UNSIGNED_BYTE,4),{name:wt.COLOR,semantic:wt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.UNSIGNED_BYTE,type:_n.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(l(t.RGB))return n=e.getPropertyArray("RGB",ee.UNSIGNED_BYTE,3),{name:"COLOR",semantic:wt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.UNSIGNED_BYTE,type:_n.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(l(t.RGB565))return n=e.getPropertyArray("RGB565",ee.UNSIGNED_SHORT,1),{name:"COLOR",semantic:wt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.FLOAT,type:_n.VEC3,normalized:!1,isRGB565:!0,isTranslucent:!1};if(l(t.CONSTANT_RGBA)){const i=e.getGlobalProperty("CONSTANT_RGBA",ee.UNSIGNED_BYTE,4),o=i[3],r=H.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:wt.COLOR,semantic:wt.COLOR,setIndex:0,constantColor:r,componentDatatype:ee.FLOAT,type:_n.VEC4,isQuantized:!1,isTranslucent:s}}}function AXe(e){const t=e.json;let n;if(l(t.NORMAL))return n=e.getPropertyArray("NORMAL",ee.FLOAT,3),{name:wt.NORMAL,semantic:wt.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:ee.FLOAT,type:_n.VEC3};if(l(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",ee.UNSIGNED_BYTE,2);const i=8;return{name:wt.NORMAL,semantic:wt.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<i)-1,quantizedType:_n.VEC2,quantizedComponentDatatype:ee.UNSIGNED_BYTE,componentDatatype:ee.FLOAT,type:_n.VEC3}}}function bXe(e){const t=e.json;if(l(t.BATCH_ID)){const n=e.getPropertyArray("BATCH_ID",ee.UNSIGNED_SHORT,1);return{name:wt.FEATURE_ID,semantic:wt.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:ee.fromTypedArray(n),type:_n.SCALAR}}}const bQ=AQ,CXe=Ot.Components,TXe=Ot.Scene,EXe=Ot.Node,xXe=Ot.Primitive,wXe=Ot.Attribute,N5=Ot.Quantization,SXe=Ot.FeatureIdAttribute,vXe=Ot.Material,DXe=Ot.MetallicRoughness;function bp(e){e=A(e,A.EMPTY_OBJECT);const t=e.arrayBuffer,n=A(e.byteOffset,0);T.typeOf.object("options.arrayBuffer",t),this._arrayBuffer=t,this._byteOffset=n,this._loadAttributesFor2D=A(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=Ft.UNLOADED,this._buffers=[],this._components=void 0,this._transform=B.IDENTITY}l(Object.create)&&(bp.prototype=Object.create(mr.prototype),bp.prototype.constructor=bp);Object.defineProperties(bp.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});bp.prototype.load=function(){this._parsedContent=bQ.parse(this._arrayBuffer,this._byteOffset),this._state=Ft.PROCESSING;const e=this;this._promise=new Promise(function(t,n){e._process=function(i){if(e._state===Ft.PROCESSING){if(l(e._decodePromise))return;const o=IXe(e,i.context);l(o)&&o.then(t).catch(n)}}})};bp.prototype.process=function(e){this._process(e)};function IXe(e,t){const i=e._parsedContent.draco;let o;if(l(i)?o=ls.decodePointCloud(i,t):o=Promise.resolve(),!!l(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return l(r)&&PXe(e,i,r),VXe(e,t),e._state=Ft.READY,e}).catch(function(r){e.unload(),e._state=Ft.FAILED;const s="Failed to load Draco pnts";return Promise.reject(e.getError(s,r))})}function PXe(e,t,n){e._state=Ft.READY;const i=e._parsedContent;let o;if(l(n.POSITION)){if(o={name:"POSITION",semantic:wt.POSITION,typedArray:n.POSITION.array,componentDatatype:ee.FLOAT,type:_n.VEC3,isQuantized:!1},l(n.POSITION.data.quantization)){const a=n.POSITION.data.quantization,c=a.range,u=f.fromElements(c,c,c),d=f.unpack(a.minValues),h=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=h,o.quantizedVolumeOffset=d,o.quantizedVolumeScale=u,o.quantizedComponentDatatype=h<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT,o.quantizedType=_n.VEC3}i.positions=o}if(l(n.NORMAL)){if(o={name:"NORMAL",semantic:wt.NORMAL,typedArray:n.NORMAL.array,componentDatatype:ee.FLOAT,type:_n.VEC3,isQuantized:!1,octEncoded:!1,octEncodedZXY:!1},l(n.NORMAL.data.quantization)){const a=(1<<n.NORMAL.data.quantization.quantizationBits)-1;o.quantizedRange=a,o.octEncoded=!0,o.octEncodedZXY=!0,o.quantizedComponentDatatype=ee.UNSIGNED_BYTE,o.quantizedType=_n.VEC2}i.normals=o}if(l(n.RGBA)?i.colors={name:"COLOR",semantic:wt.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:ee.UNSIGNED_BYTE,type:_n.VEC4,normalized:!0,isTranslucent:!0}:l(n.RGB)&&(i.colors={name:"COLOR",semantic:wt.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:ee.UNSIGNED_BYTE,type:_n.VEC3,normalized:!0,isTranslucent:!1}),l(n.BATCH_ID)){const a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:wt.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:ee.fromTypedArray(a),type:_n.SCALAR}}let r=i.batchTableJson;const s=t.batchTableProperties;for(const a in s)if(s.hasOwnProperty(a)){const c=n[a];l(r)||(r={}),i.hasDracoBatchTable=!0;const u=c.data;r[a]={byteOffset:u.byteOffset,type:OXe(u.componentsPerAttribute),componentType:LXe(u.componentDatatype),typedArray:c.array}}i.batchTableJson=r}function OXe(e){switch(e){case 1:return"SCALAR";case 2:return"VEC2";case 3:return"VEC3";case 4:return"VEC4";default:throw new x("componentsPerAttribute must be a number from 1-4")}}function LXe(e){switch(e){case ae.BYTE:return"BYTE";case ae.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case ae.SHORT:return"SHORT";case ae.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case ae.INT:return"INT";case ae.UNSIGNED_INT:return"UNSIGNED_INT";case ae.DOUBLE:return"DOUBLE";case ae.FLOAT:return"FLOAT";default:throw new x("value is not a valid WebGL constant")}}function BA(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new N5,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new N5;const a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=f.ZERO;const c=t.quantizedVolumeScale;o.quantizedVolumeDimensions=c,o.quantizedVolumeStepSize=f.divideByScalar(c,a,new f),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}const r=new wXe;if(r.name=t.name,r.semantic=t.semantic,r.setIndex=t.setIndex,r.componentDatatype=t.componentDatatype,r.type=t.type,r.normalized=A(t.normalized,!1),r.min=t.min,r.max=t.max,r.quantization=o,t.isRGB565&&(i=mi.decodeRGB565(i)),l(t.constantColor)){const a=new Array(4);r.constant=H.pack(t.constantColor,a)}else{const a=Tt.createVertexBuffer({typedArray:i,context:n,usage:nt.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}const s=e._loadAttributesFor2D;return r.semantic===wt.POSITION&&s&&(r.typedArray=i),r}let M5,jx;function BXe(e){if(!l(jx)){M5=new nD(0),jx=new Array(e);for(let t=0;t<e;++t)jx[t]=M5.random()}return jx}const RXe=new f,NXe=new f,MXe=new f;function FXe(e){const t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=BXe(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE;let c=f.fromElements(s,s,s,RXe),u=f.fromElements(a,a,a,NXe),d,h,m;if(e.isQuantized)c=f.ZERO,u=e.quantizedVolumeScale;else for(d=0;d<o;++d)h=Math.floor(r[d]*i),m=f.unpack(t,h*3,MXe),f.minimumByComponent(c,m,c),f.maximumByComponent(u,m,u);e.min=f.clone(c),e.max=f.clone(u)}const zXe={name:wt.COLOR,semantic:wt.COLOR,setIndex:0,constantColor:H.DARKGRAY,componentDatatype:ee.FLOAT,type:_n.VEC4,isQuantized:!1,isTranslucent:!1};function UXe(e,t,n){const i=[];let o;const r=t.positions;return l(r)&&(FXe(r),o=BA(e,r,n),o.count=t.pointsLength,i.push(o)),l(t.normals)&&(o=BA(e,t.normals,n),i.push(o)),l(t.colors)?(o=BA(e,t.colors,n),i.push(o)):(o=BA(e,zXe,n),i.push(o)),l(t.batchIds)&&(o=BA(e,t.batchIds,n),i.push(o)),i}function HXe(e,t){const n=e.batchLength,i=e.pointsLength,o=e.batchTableBinary,r=!l(e.batchIds);if(l(o)||e.hasDracoBatchTable){const s=A(n,i);return hg({count:s,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new vu({schema:{},propertyTables:[]})}function VXe(e,t){const n=e._parsedContent,i=new DXe;i.metallicFactor=0,i.roughnessFactor=.9;const o=new vXe;o.metallicRoughness=i;const r=n.colors;l(r)&&r.isTranslucent&&(o.alphaMode=dv.BLEND);const s=!l(n.normals);o.unlit=s;const a=new xXe;if(a.attributes=UXe(e,n,t),a.primitiveType=Ze.POINTS,a.material=o,l(n.batchIds)){const g=new SXe;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}const c=new EXe;c.index=0,c.primitives=[a];const u=new TXe;u.nodes=[c],u.upAxis=cs.Z,u.forwardAxis=cs.X;const d=new CXe;d.scene=u,d.nodes=[c];const h=[];d.structuralMetadata=HXe(n,h),h.length>0&&kXe(e,a,h,t),l(n.rtcCenter)&&(d.transform=B.multiplyByTranslation(d.transform,n.rtcCenter,d.transform));const m=n.positions;l(m)&&m.isQuantized&&(d.transform=B.multiplyByTranslation(d.transform,m.quantizedVolumeOffset,d.transform)),e._components=d,e._parsedContent=void 0,e._arrayBuffer=void 0}function kXe(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s<r;s++){const a=n[s],c=Tt.createVertexBuffer({typedArray:a.typedArray,context:i,usage:nt.STATIC_DRAW});c.vertexArrayDestroyable=!1,e._buffers.push(c),a.buffer=c,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}bp.prototype.unload=function(){const 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};function Ei(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.loader",e.loader),T.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=A(e.type,ha.GLTF),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=B.clone(this.modelMatrix),this._scale=A(e.scale,1),this._minimumPixelSize=A(e.minimumPixelSize,0),this._maximumScale=e.maximumScale,this._clampedScale=l(this._maximumScale)?Math.min(this._scale,this._maximumScale):this._scale,this._computedScale=this._clampedScale,this._updateModelMatrix=!1,this.referenceMatrix=void 0,this._iblReferenceFrameMatrix=J.clone(J.IDENTITY),this._resourcesLoaded=!1,this._drawCommandsBuilt=!1,this._ready=!1,this._customShader=e.customShader,this._content=e.content,this._texturesLoaded=!1,this._defaultTexture=void 0,this._activeAnimations=new Zf(this),this._clampAnimations=A(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=H.clone(e.color),this._colorBlendMode=A(e.colorBlendMode,kD.HIGHLIGHT),this._colorBlendAmount=A(e.colorBlendAmount,.5);const t=A(e.silhouetteColor,H.RED);this._silhouetteColor=H.clone(t),this._silhouetteSize=A(e.silhouetteSize,0),this._silhouetteDirty=!1,this._silhouetteId=void 0,this._cull=A(e.cull,!0),this._opaquePass=A(e.opaquePass,Ne.OPAQUE),this._allowPicking=A(e.allowPicking,!0),this._show=A(e.show,!0),this._style=void 0,this._styleDirty=!1,this._styleCommandsNeeded=void 0;let n=A(e.featureIdLabel,"featureId_0");typeof n=="number"&&(n=`featureId_${n}`),this._featureIdLabel=n;let i=A(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 fe,this._initialRadius=void 0,this._heightReference=A(e.heightReference,St.NONE),this._heightDirty=this._heightReference!==St.NONE,this._removeUpdateHeightCallback=void 0,this._clampedModelMatrix=void 0;const o=e.scene;l(o)&&l(o.terrainProviderChanged)&&(this._terrainProviderChangedCallback=o.terrainProviderChanged.addEventListener(function(){this._heightDirty=!0},this)),this._scene=o,this._distanceDisplayCondition=e.distanceDisplayCondition;const r=new zT(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;l(s)&&s.owner===void 0?Io.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=B.clone(B.IDENTITY),this._lightColor=f.clone(e.lightColor),this._imageBasedLighting=l(e.imageBasedLighting)?e.imageBasedLighting:new z0,this._shouldDestroyImageBasedLighting=!l(e.imageBasedLighting),this._backFaceCulling=A(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=A(e.shadows,Po.ENABLED),this._shadowsDirty=!1,this._debugShowBoundingVolumeDirty=!1,this._debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this._enableDebugWireframe=A(e.enableDebugWireframe,!1),this._enableShowOutline=A(e.enableShowOutline,!0),this._debugWireframe=A(e.debugWireframe,!1),this._debugWireframe===!0&&this._enableDebugWireframe===!1&&this.type===ha.GLTF&&ki("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 ai(a)),this._credit=a,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=A(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=A(e.splitDirection,Z_.NONE),this._enableShowOutline=A(e.enableShowOutline,!0),this.showOutline=A(e.showOutline,!0),this.outlineColor=A(e.outlineColor,H.BLACK),this._classificationType=e.classificationType,this._statistics=new q0,this._sceneMode=void 0,this._projectTo2D=A(e.projectTo2D,!1),this._skipLevelOfDetail=!1,this._ignoreCommands=A(e.ignoreCommands,!1),this._completeLoad=function(c,u){},this._texturesLoadedPromise=void 0,this._readyPromise=jXe(this),this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function GXe(e,t){const n=e._featureTables,i=t.propertyTables,o=i.length;for(let r=0;r<o;r++){const s=i[r],a=new or({model:e,propertyTable:s});n.push(a)}return n}function WXe(e,t){const n=t._featureIdLabel,i=t._instanceFeatureIdLabel;let o,r,s,a;for(o=0;o<e.nodes.length;o++)if(a=e.nodes[o],l(a.instances)&&(s=en.getFeatureIdsByLabel(a.instances.featureIds,i),l(s)&&l(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++){const c=a.primitives[r],u=en.getFeatureIdsByLabel(c.featureIds,n);if(l(u))return u.propertyTableId}if(t._featureTables.length===1)return 0}function vR(e,t){if(!l(e)&&!l(t))return!1;if(l(e)!==l(t))return!0;const n=e.alpha,i=t.alpha;return Math.floor(n)!==Math.floor(i)||Math.ceil(n)!==Math.ceil(i)}function jXe(e){const t=e._loader,n=e._resource;t.load();const i=t.promise.then(function(s){if(!l(s))return;const a=s.components;if(!l(a)){if(s.isUnloaded())return;throw new Ie("Failed to load model.")}const c=a.structuralMetadata;l(c)&&c.propertyTableCount>0&&GXe(e,c);const u=new Nc({model:e,modelComponents:a});e._sceneGraph=u,e._gltfCredits=u.components.asset.credits;const d=e._resource.credits;if(l(d)){const h=d.length;for(let m=0;m<h;m++)e._resourceCredits.push(d[m])}e._resourcesLoaded=!0}),o=A(t.texturesLoadedPromise,Promise.resolve());e._texturesLoadedPromise=o.then(function(){!l(e)||e.isDestroyed()||(e._texturesLoaded=!0,t._incrementallyLoadTextures&&e.resetDrawCommands())}).catch(en.getFailedLoadFunction(e,"model",n));const r=new Promise(function(s,a){e._completeLoad=function(c,u){u.afterRender.push(function(){return c._ready=!0,s(c),!0})}});return i.then(function(){return r}).catch(en.getFailedLoadFunction(e,"model",n))}Object.defineProperties(Ei.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){T.defined("pointCloudShading",e),e!==this._pointCloudShading&&this.resetDrawCommands(),this._pointCloudShading=e}},customShader:{get:function(){return this._customShader},set:function(e){e!==this._customShader&&this.resetDrawCommands(),this._customShader=e}},sceneGraph:{get:function(){return this._sceneGraph}},content:{get:function(){return this._content}},heightReference:{get:function(){return this._heightReference},set:function(e){e!==this._heightReference&&(this._heightDirty=!0),this._heightReference=e}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far must be greater than near");this._distanceDisplayCondition=jt.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){vR(e,this._color)&&this.resetDrawCommands(),this._color=H.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(!H.equals(e,this._silhouetteColor)){const t=vR(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=H.clone(e,this._silhouetteColor)}},silhouetteSize:{get:function(){return this._silhouetteSize},set:function(e){if(e!==this._silhouetteSize){const t=this._silhouetteSize,n=e>0&&t===0||e===0&&t>0;this._silhouetteDirty=this._silhouetteDirty||n,this._backFaceCullingDirty=this._backFaceCullingDirty||n}this._silhouetteSize=e}},boundingSphere:{get:function(){if(!this._ready)throw new x("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");const e=l(this._clampedModelMatrix)?this._clampedModelMatrix:this.modelMatrix;return TQ(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===ha.GLTF&&ki("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}`),T.typeOf.string("value",e),e!==this._featureIdLabel&&(this._featureTableIdDirty=!0),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),T.typeOf.string("value",e),e!==this._instanceFeatureIdLabel&&(this._featureTableIdDirty=!0),this._instanceFeatureIdLabel=e}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){e!==this._clippingPlanes&&(Io.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){l(e)!==l(this._lightColor)&&this.resetDrawCommands(),this._lightColor=f.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){T.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1,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}}});Ei.prototype.getNode=function(e){if(!this._ready)throw new x("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");return T.typeOf.string("name",e),this._nodesByName[e]};Ei.prototype.setArticulationStage=function(e,t){if(T.typeOf.number("value",t),!this._ready)throw new x("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");this._sceneGraph.setArticulationStage(e,t)};Ei.prototype.applyArticulations=function(){if(!this._ready)throw new x("The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true.");this._sceneGraph.applyArticulations()};Ei.prototype.makeStyleDirty=function(){this._styleDirty=!0};Ei.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const qXe=new B,$Xe=new J,YXe=new B;Ei.prototype.update=function(e){if(XXe(this,e),KXe(this,e),JXe(this,e),!this._resourcesLoaded||e.mode===le.MORPHING)return;QXe(this),ZXe(this),eKe(this,e),tKe(this),nKe(this,e),iKe(this,e),oKe(this,e),rKe(this,e),this._defaultTexture=e.context.defaultTexture,sKe(this,e),aKe(this,e),cKe(this),lKe(this,e),fKe(this,e);const t=this;if(!t._ready){t._completeLoad(t,e);return}dKe(this),hKe(this,e),pKe(this),mKe(this,e)};function XXe(e,t){(!e._resourcesLoaded||!e._texturesLoaded)&&e._loader.process(t)}function KXe(e,t){l(e._customShader)&&e._customShader.update(t)}function JXe(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function QXe(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;l(n)&&n.propertyTableCount>0&&(e.featureTableId=WXe(t,e),e._styleDirty=!0,e.resetDrawCommands())}function ZXe(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function eKe(e,t){const n=e._featureTables,i=n.length;let o=!1;for(let r=0;r<i;r++)n[r].update(t),n[r].styleCommandsNeededDirty&&(o=!0);o&&CQ(e)}function CQ(e){const t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=$C.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function tKe(e){const t=e.pointCloudShading;t.attenuation!==e._attenuation&&(e.resetDrawCommands(),e._attenuation=t.attenuation),t.backFaceCulling!==e._pointCloudBackFaceCulling&&(e.resetDrawCommands(),e._pointCloudBackFaceCulling=t.backFaceCulling)}function nKe(e,t){e._silhouetteDirty&&(EQ(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function iKe(e,t){const n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function oKe(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 rKe(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function sKe(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function aKe(e,t){if(!B.equals(e.modelMatrix,e._modelMatrix)){if(t.mode!==le.SCENE3D&&e._projectTo2D)throw new x("Model.modelMatrix cannot be changed in 2D or Columbus View if projectTo2D is true.");e._updateModelMatrix=!0,e._modelMatrix=B.clone(e.modelMatrix,e._modelMatrix)}}const Xu=new f,cS=new Ce;function cKe(e){if(!e._updateModelMatrix&&!e._heightDirty&&e._minimumPixelSize===0)return;l(e._removeUpdateHeightCallback)&&(e._removeUpdateHeightCallback(),e._removeUpdateHeightCallback=void 0);const t=e._scene;if(!l(t)||!l(t.globe)||e.heightReference===St.NONE){if(e.heightReference!==St.NONE)throw new x("Height reference is not supported without a scene and globe.");e._clampedModelMatrix=void 0;return}const n=t.globe,i=n.ellipsoid,o=e.modelMatrix;Xu.x=o[12],Xu.y=o[13],Xu.z=o[14];const r=i.cartesianToCartographic(Xu);l(e._clampedModelMatrix)||(e._clampedModelMatrix=B.clone(o,new B));const s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,F5(e,i,r));const a=n.getHeight(r);if(l(a)){const c=F5(e,i,r);Ce.clone(r,cS),cS.height=a,i.cartographicToCartesian(cS,Xu),c(Xu)}e._heightDirty=!1,e._updateModelMatrix=!0}function lKe(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;const n=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;TQ(e,n),uKe(e,n,t)}function TQ(e,t){e._clampedScale=l(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=f.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=fe.transform(e._boundingSphere,t,e._boundingSphere)}function uKe(e,t,n){let i=e.scale;if(e.minimumPixelSize!==0&&!e._projectTo2D){const o=n.context,r=Math.max(o.drawingBufferWidth,o.drawingBufferHeight);B.getTranslation(t,Xu),e._sceneMode!==le.SCENE3D&&br.computeActualWgs84Position(n,Xu,Xu);const s=e._boundingSphere.radius,a=_Ke(Xu,s,n),c=1/a;Math.min(c*(2*s),r)<e.minimumPixelSize&&(i=e.minimumPixelSize*a/(2*e._initialRadius))}e._computedScale=l(e.maximumScale)?Math.min(e.maximumScale,i):i}function dKe(e){if(!e._idDirty)return;e._idDirty=!1;const t=e._id,n=e._pickIds,i=n.length;for(let o=0;o<i;++o)n[o].object.id=t}function fKe(e,t){const n=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix,i=A(e.referenceMatrix,n),o=t.context,r=e._imageBasedLighting;if(r.useSphericalHarmonicCoefficients||r.useSpecularEnvironmentMaps){let s=$Xe,a=qXe;a=B.multiply(o.uniformState.view3D,i,a),s=B.getMatrix3(a,s),s=J.getRotation(s,s),e._iblReferenceFrameMatrix=J.transpose(s,e._iblReferenceFrameMatrix)}if(e.isClippingEnabled()){let s=YXe;s=B.multiply(o.uniformState.view3D,i,s),s=B.multiply(s,e._clippingPlanes.modelMatrix,s),e._clippingPlanesMatrix=B.inverseTranspose(s,e._clippingPlanesMatrix)}}function hKe(e,t){const n=e._sceneGraph;if(e._updateModelMatrix||e._minimumPixelSize!==0){const o=l(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;l(e.classificationType)||(i=e._userAnimationDirty||e._activeAnimations.update(t)),n.update(t,i),e._userAnimationDirty=!1}function pKe(e){if(!e._showCreditsOnScreenDirty)return;e._showCreditsOnScreenDirty=!1;const t=e._showCreditsOnScreen;l(e._credit)&&(e._credit.showOnScreen=t);const n=e._resourceCredits,i=n.length;for(let s=0;s<i;s++)n[s].showOnScreen=t;const o=e._gltfCredits,r=o.length;for(let s=0;s<r;s++)o[s].showOnScreen=t}function mKe(e,t){const n=yKe(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&&(AKe(e,t),e._sceneGraph.pushDrawCommands(t))}const lO=new fe;function _Ke(e,t,n){return lO.center=e,lO.radius=t,n.camera.getPixelSize(lO,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}function F5(e,t,n){return function(i){if(e.heightReference===St.RELATIVE_TO_GROUND){const r=t.cartesianToCartographic(i,cS);r.height+=n.height,t.cartographicToCartesian(r,i)}const o=e._clampedModelMatrix;B.clone(e.modelMatrix,o),o[12]=i.x,o[13]=i.y,o[14]=i.z,e._heightDirty=!0}}const gKe=new f;function yKe(e,t){const n=e.distanceDisplayCondition;if(!l(n))return!0;const i=n.near*n.near,o=n.far*n.far;let r;if(t.mode===le.SCENE2D){const a=(t.camera.frustum.right-t.camera.frustum.left)*.5;r=a*a}else{const s=B.getTranslation(e.modelMatrix,gKe);br.computeActualWgs84Position(t,s,s),r=f.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function AKe(e,t){const n=t.creditDisplay,i=e._credit;l(i)&&n.addCredit(i);const o=e._resourceCredits,r=o.length;for(let c=0;c<r;c++)n.addCredit(o[c]);const s=e._gltfCredits,a=s.length;for(let c=0;c<a;c++)n.addCredit(s[c])}Ei.prototype.isTranslucent=function(){const e=this.color;return l(e)&&e.alpha>0&&e.alpha<1};Ei.prototype.isInvisible=function(){const e=this.color;return l(e)&&e.alpha===0};function EQ(e){return e.context.stencilBuffer}Ei.prototype.hasSilhouette=function(e){return EQ(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!l(this._classificationType)};function bKe(e){return e.context.stencilBuffer}Ei.prototype.hasSkipLevelOfDetail=function(e){if(!ha.is3DTiles(this.type))return!1;const n=this._content.tileset;return bKe(e)&&n.skipLevelOfDetail};Ei.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return l(e)&&e.enabled&&e.length!==0};Ei.prototype.isDestroyed=function(){return!1};Ei.prototype.destroy=function(){const e=this._loader;l(e)&&e.destroy();const t=this._featureTables;if(l(t)){const i=t.length;for(let o=0;o<i;o++)t[o].destroy()}this.destroyPipelineResources(),this.destroyModelResources(),l(this._removeUpdateHeightCallback)&&(this._removeUpdateHeightCallback(),this._removeUpdateHeightCallback=void 0),l(this._terrainProviderChangedCallback)&&(this._terrainProviderChangedCallback(),this._terrainProviderChangedCallback=void 0);const n=this._clippingPlanes;l(n)&&!n.isDestroyed()&&n.owner===this&&n.destroy(),this._clippingPlanes=void 0,this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=void 0,He(this)};Ei.prototype.destroyPipelineResources=function(){const e=this._pipelineResources;for(let t=0;t<e.length;t++)e[t].destroy();this._pipelineResources.length=0,this._pickIds.length=0};Ei.prototype.destroyModelResources=function(){const e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0};Ei.fromGltf=function(e){if(e=A(e,A.EMPTY_OBJECT),!l(e.url)&&!l(e.gltf))throw new x("options.url is required.");const t=A(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:l(e.classificationType)},i=A(e.basePath,""),o=Me.createIfNeeded(i);l(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=Me.createIfNeeded(t);const r=new ou(n),a=l(e.content)?ha.TILE_GLTF:ha.GLTF,c=UT(r,a,e);return c.resource=n.gltfResource,new Ei(c)};Ei.fromB3dm=function(e){const 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:l(e.classificationType)},n=new gp(t),i=UT(n,ha.TILE_B3DM,e);return new Ei(i)};Ei.fromPnts=function(e){const t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new bp(t),i=UT(n,ha.TILE_PNTS,e);return new Ei(i)};Ei.fromI3dm=function(e){const 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 xf(t),i=UT(n,ha.TILE_I3DM,e);return new Ei(i)};Ei.fromGeoJson=function(e){const t={geoJson:e.geoJson},n=new yp(t),i=UT(n,ha.TILE_GEOJSON,e);return new Ei(i)};Ei.prototype.applyColorAndShow=function(e){const t=this._color,n=l(e)&&l(e.color),i=l(e)&&l(e.show);this._color=n?e.color.evaluateColor(void 0,this._color):H.clone(H.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,vR(t,this._color)&&this.resetDrawCommands()};Ei.prototype.applyStyle=function(e){const t=this.type===ha.TILE_PNTS,n=l(this.featureTableId)&&this.featureTables[this.featureTableId].featuresLength>0,i=l(this.structuralMetadata)?this.structuralMetadata.propertyAttributes:void 0,o=l(i)&&l(i[0]);if(t&&(!n||o)){this.resetDrawCommands();return}n?(this.featureTables[this.featureTableId].applyStyle(e),CQ(this)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function UT(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}}function Uo(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(Uo.prototype,{featuresLength:{get:function(){const e=this._model,t=e.featureTables,n=e.featureTableId;return l(t)&&l(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(){const 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(){const e=this._model,t=e.featureTables,n=e.featureTableId;if(l(t)&&l(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}}});Uo.prototype.getFeature=function(e){const t=this._model,n=t.featureTableId;if(!l(n))throw new x("No feature ID set is selected. Make sure Cesium3DTileset.featureIdLabel or Cesium3DTileset.instanceFeatureIdLabel is defined");const i=t.featureTables[n];if(!l(i))throw new x("No feature table found for the selected feature ID set");const o=i.featuresLength;if(!l(e)||e<0||e>=o)throw new x(`featureId is required and must be between 0 and featuresLength - 1 (${o-1}).`);return i.getFeature(e)};Uo.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;return l(i)?n.featureTables[i].hasProperty(e,t):!1};Uo.prototype.applyDebugSettings=function(e,t){t=e?t:H.WHITE,this.featuresLength===0?this._model.color=t:l(this.batchTable)&&this.batchTable.setAllColor(t)};Uo.prototype.applyStyle=function(e){this._model.style=e};Uo.prototype.update=function(e,t){const 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;const o=e.clippingPlanes;n.referenceMatrix=e.clippingPlanesOriginMatrix,l(o)&&i.clippingPlanesDirty&&(n._clippingPlanes=o.enabled&&i._isClipped?o:void 0),l(o)&&l(n._clippingPlanes)&&n._clippingPlanes!==o&&(n._clippingPlanes=o,n._clippingPlanesState=0),n.update(t)};Uo.prototype.isDestroyed=function(){return!1};Uo.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),He(this)};Uo.fromGltf=function(e,t,n,i){const o=new Uo(e,t,n),s=HT(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const c=Ei.fromGltf(s);return o._model=c,o._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:cf.REPEAT}),u}),o};Uo.fromB3dm=function(e,t,n,i,o){const r=new Uo(e,t,n),a=HT(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=c;const u=Ei.fromB3dm(a);return r._model=u,r._readyPromise=u.readyPromise.then(function(d){return d.activeAnimations.addAll({loop:cf.REPEAT}),d}),r};Uo.fromI3dm=function(e,t,n,i,o){const r=new Uo(e,t,n),a=HT(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=Ei.fromI3dm(a);return r._model=c,r._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:cf.REPEAT}),u}),r};Uo.fromPnts=function(e,t,n,i,o){const r=new Uo(e,t,n),a=HT(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=Ei.fromPnts(a);return r._model=c,r._readyPromise=c.readyPromise,r};Uo.fromGeoJson=function(e,t,n,i){const o=new Uo(e,t,n),s=HT(e,t,o,{geoJson:i,resource:n}),a=Ei.fromGeoJson(s);return o._model=a,o._readyPromise=a.readyPromise,o};function HT(e,t,n,i){const o={cull:!1,releaseGltfJson:!0,opaquePass:Ne.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 hn(i,o)}function eh(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=CKe(this,i)}Object.defineProperties(eh.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 CKe(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}eh.prototype.hasProperty=function(e,t){return!1};eh.prototype.getFeature=function(e){};eh.prototype.applyDebugSettings=function(e,t){};eh.prototype.applyStyle=function(e){};eh.prototype.update=function(e,t){};eh.prototype.isDestroyed=function(){return!1};eh.prototype.destroy=function(){return He(this)};function Ut(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new x("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new x("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=kt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=kt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");o=kt.clone(o)}if(l(r)){if(r.far<=r.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=jt.clone(r)}this._show=A(e.show,!0),this._position=f.clone(A(e.position,f.ZERO)),this._actualPosition=f.clone(this._position),this._pixelOffset=j.clone(A(e.pixelOffset,j.ZERO)),this._translate=new j(0,0),this._eyeOffset=f.clone(A(e.eyeOffset,f.ZERO)),this._heightReference=A(e.heightReference,St.NONE),this._verticalOrigin=A(e.verticalOrigin,Hi.CENTER),this._horizontalOrigin=A(e.horizontalOrigin,La.CENTER),this._scale=A(e.scale,1),this._color=H.clone(A(e.color,H.WHITE)),this._rotation=A(e.rotation,0),this._alignedAxis=f.clone(A(e.alignedAxis,f.ZERO)),this._width=e.width,this._height=e.height,this._scaleByDistance=o,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._sizeInMeters=A(e.sizeInMeters,!1),this._distanceDisplayCondition=r,this._disableDepthTestDistance=e.disableDepthTestDistance,this._id=e.id,this._collection=A(e.collection,t),this._pickId=void 0,this._pickPrimitive=A(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;const s=e.image;let a=e.imageId;l(s)&&(l(a)||(typeof s=="string"?a=s:l(s.src)?a=s.src:a=Ms()),this._imageId=a,this._image=s),l(e.imageSubRegion)&&(this._imageId=a,this._imageSubRegion=e.imageSubRegion),l(this._billboardCollection._textureAtlas)&&this._loadImage(),this._actualClampedPosition=void 0,this._removeCallbackFunc=void 0,this._mode=le.SCENE3D,this._clusterShow=!0,this._outlineColor=H.clone(A(e.outlineColor,H.BLACK)),this._outlineWidth=A(e.outlineWidth,0),this._updateClamping()}const z5=Ut.SHOW_INDEX=0,lS=Ut.POSITION_INDEX=1,xQ=Ut.PIXEL_OFFSET_INDEX=2,TKe=Ut.EYE_OFFSET_INDEX=3,EKe=Ut.HORIZONTAL_ORIGIN_INDEX=4,xKe=Ut.VERTICAL_ORIGIN_INDEX=5,wKe=Ut.SCALE_INDEX=6,uS=Ut.IMAGE_INDEX_INDEX=7,U5=Ut.COLOR_INDEX=8,SKe=Ut.ROTATION_INDEX=9,vKe=Ut.ALIGNED_AXIS_INDEX=10,DKe=Ut.SCALE_BY_DISTANCE_INDEX=11,IKe=Ut.TRANSLUCENCY_BY_DISTANCE_INDEX=12,PKe=Ut.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,OKe=Ut.DISTANCE_DISPLAY_CONDITION=14,LKe=Ut.DISABLE_DEPTH_DISTANCE=15;Ut.TEXTURE_COORDINATE_BOUNDS=16;const H5=Ut.SDF_INDEX=17;Ut.NUMBER_OF_PROPERTIES=18;function ro(e,t){const n=e._billboardCollection;l(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(Ut.prototype,{show:{get:function(){return this._show},set:function(e){T.typeOf.bool("value",e),this._show!==e&&(this._show=e,ro(this,z5))}},position:{get:function(){return this._position},set:function(e){T.typeOf.object("value",e);const t=this._position;f.equals(t,e)||(f.clone(e,t),f.clone(e,this._actualPosition),this._updateClamping(),ro(this,lS))}},heightReference:{get:function(){return this._heightReference},set:function(e){T.typeOf.number("value",e);const t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),ro(this,lS))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){T.typeOf.object("value",e);const t=this._pixelOffset;j.equals(t,e)||(j.clone(e,t),ro(this,xQ))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._scaleByDistance;kt.equals(t,e)||(this._scaleByDistance=kt.clone(e,t),ro(this,DKe))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._translucencyByDistance;kt.equals(t,e)||(this._translucencyByDistance=kt.clone(e,t),ro(this,IKe))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(l(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;kt.equals(t,e)||(this._pixelOffsetScaleByDistance=kt.clone(e,t),ro(this,PKe))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){T.typeOf.object("value",e);const t=this._eyeOffset;f.equals(t,e)||(f.clone(e,t),ro(this,TKe))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){T.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,ro(this,EKe))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){T.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,ro(this,xKe))}},scale:{get:function(){return this._scale},set:function(e){T.typeOf.number("value",e),this._scale!==e&&(this._scale=e,ro(this,wKe))}},color:{get:function(){return this._color},set:function(e){T.typeOf.object("value",e);const t=this._color;H.equals(t,e)||(H.clone(e,t),ro(this,U5))}},rotation:{get:function(){return this._rotation},set:function(e){T.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,ro(this,SKe))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){T.typeOf.object("value",e);const t=this._alignedAxis;f.equals(t,e)||(f.clone(e,t),ro(this,vKe))}},width:{get:function(){return A(this._width,this._imageWidth)},set:function(e){l(e)&&T.typeOf.number("value",e),this._width!==e&&(this._width=e,ro(this,uS))}},height:{get:function(){return A(this._height,this._imageHeight)},set:function(e){l(e)&&T.typeOf.number("value",e),this._height!==e&&(this._height=e,ro(this,uS))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){T.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,ro(this,U5))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!jt.equals(e,this._distanceDisplayCondition)){if(l(e)&&(T.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");this._distanceDisplayCondition=jt.clone(e,this._distanceDisplayCondition),ro(this,OKe)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(l(e)&&(T.typeOf.number("value",e),e<0))throw new x("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance!==e&&(this._disableDepthTestDistance=e,ro(this,LKe))}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickPrimitive:{get:function(){return this._pickPrimitive},set:function(e){this._pickPrimitive=e,l(this._pickId)&&(this._pickId.object.primitive=e)}},pickId:{get:function(){return this._pickId}},image:{get:function(){return this._imageId},set:function(e){l(e)?typeof e=="string"?this.setImage(e,e):e instanceof Me?this.setImage(e.url,e):l(e.src)?this.setImage(e.src,e):this.setImage(Ms(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,ro(this,uS))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=f.clone(e,this._actualClampedPosition),ro(this,lS)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,ro(this,z5))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;H.equals(t,e)||(H.clone(e,t),ro(this,H5))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,ro(this,H5))}}});Ut.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};Ut.prototype._updateClamping=function(){Ut._updateClamping(this._billboardCollection,this)};const _b=new Ce,V5=new f;Ut._updateClamping=function(e,t){const n=e._scene;if(!l(n)||!l(n.globe)){if(t._heightReference!==St.NONE)throw new x("Height reference is not supported without a scene and globe.");return}const i=n.globe,o=i.ellipsoid,r=i._surface,s=n.frameState.mode,a=s!==t._mode;if(t._mode=s,(t._heightReference===St.NONE||a)&&l(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===St.NONE||!l(t._position))return;const c=o.cartesianToCartographic(t._position);if(!l(c)){t._actualClampedPosition=void 0;return}l(t._removeCallbackFunc)&&t._removeCallbackFunc();function u(h){if(t._heightReference===St.RELATIVE_TO_GROUND)if(t._mode===le.SCENE3D){const m=o.cartesianToCartographic(h,_b);m.height+=c.height,o.cartographicToCartesian(m,h)}else h.x+=c.height;t._clampedPosition=f.clone(h,t._clampedPosition)}t._removeCallbackFunc=r.updateHeight(c,u),Ce.clone(c,_b);const d=i.getHeight(c);l(d)&&(_b.height=d),o.cartographicToCartesian(_b,V5),u(V5)};Ut.prototype._loadImage=function(){const e=this._billboardCollection._textureAtlas,t=this._imageId,n=this._image,i=this._imageSubRegion;let o;const r=this;function s(a){if(r._imageId!==t||r._image!==n||!Ye.equals(r._imageSubRegion,i))return;const 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,ro(r,uS)}if(l(n)){const a=e.getImageIndex(t);if(l(a)){s(a);return}o=e.addImage(t,n)}l(i)&&(o=e.addSubRegion(t,i)),this._imageIndexPromise=o,l(o)&&o.then(s).catch(function(a){console.error(`Error loading image for billboard: ${a}`),r._imageIndexPromise=void 0})};Ut.prototype.setImage=function(e,t){if(!l(e))throw new x("id is required.");if(!l(t))throw new x("image is required.");this._imageId!==e&&(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=e,this._image=t,l(this._billboardCollection._textureAtlas)&&this._loadImage())};Ut.prototype.setImageSubRegion=function(e,t){if(!l(e))throw new x("id is required.");if(!l(t))throw new x("subRegion is required.");this._imageId===e&&Ye.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=Ye.clone(t),l(this._billboardCollection._textureAtlas)&&this._loadImage())};Ut.prototype._setTranslate=function(e){if(!l(e))throw new x("value is required.");const t=this._translate;j.equals(t,e)||(j.clone(e,t),ro(this,xQ))};Ut.prototype._getActualPosition=function(){return l(this._clampedPosition)?this._clampedPosition:this._actualPosition};Ut.prototype._setActualPosition=function(e){l(this._clampedPosition)||f.clone(e,this._actualPosition),ro(this,lS)};const k5=new oe;Ut._computeActualPosition=function(e,t,n,i){return l(e._clampedPosition)?(n.mode!==e._mode&&e._updateClamping(),e._clampedPosition):n.mode===le.SCENE3D?t:(B.multiplyByPoint(i,t,k5),br.computeActualWgs84Position(n,k5))};const wQ=new f;Ut._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=B.multiplyByPoint(e,t,wQ),a=br.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(l(a))return j.add(a,i,a),a};const qx=new j(0,0);Ut.prototype.computeScreenSpacePosition=function(e,t){const n=this._billboardCollection;if(l(t)||(t=new j),!l(n))throw new x("Billboard must be in a collection. Was it removed?");if(!l(e))throw new x("scene is required.");j.clone(this._pixelOffset,qx),j.add(qx,this._translate,qx);let i=n.modelMatrix,o=this._position;if(l(this._clampedPosition)&&(o=this._clampedPosition,e.mode!==le.SCENE3D)){const s=e.mapProjection,a=s.ellipsoid,c=s.unproject(o,_b);o=a.cartographicToCartesian(c,wQ),i=B.IDENTITY}return Ut._computeScreenSpacePosition(i,o,this._eyeOffset,qx,e,t)};Ut.getScreenSpaceBoundingBox=function(e,t,n){let i=e.width,o=e.height;const r=e.scale;i*=r,o*=r;let s=t.x;e.horizontalOrigin===La.RIGHT?s-=i:e.horizontalOrigin===La.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===Hi.BOTTOM||e.verticalOrigin===Hi.BASELINE?a-=o:e.verticalOrigin===Hi.CENTER&&(a-=o*.5),l(n)||(n=new Ye),n.x=s,n.y=a,n.width=i,n.height=o,n};Ut.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&f.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)&&H.equals(this._color,e._color)&&j.equals(this._pixelOffset,e._pixelOffset)&&j.equals(this._translate,e._translate)&&f.equals(this._eyeOffset,e._eyeOffset)&&kt.equals(this._scaleByDistance,e._scaleByDistance)&&kt.equals(this._translucencyByDistance,e._translucencyByDistance)&&kt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&jt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Ut.prototype._destroy=function(){l(this._customData)&&(this._billboardCollection._scene.globe._surface.removeTileCustomData(this._customData),this._customData=void 0),l(this._removeCallbackFunc)&&(this._removeCallbackFunc(),this._removeCallbackFunc=void 0),this.image=void 0,this._pickId=this._pickId&&this._pickId.destroy(),this._billboardCollection=void 0};const BKe={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},Ko=Object.freeze(BKe),RKe={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},uc=Object.freeze(RKe);function of(e,t,n,i,o){this.bottomLeft=A(e,j.ZERO),this.topRight=A(t,j.ZERO),this.childNode1=n,this.childNode2=i,this.imageIndex=o}const NKe=new j(16,16);function pd(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.borderWidthInPixels,1),n=A(e.initialSize,NKe);if(!l(e.context))throw new x("context is required.");if(t<0)throw new x("borderWidthInPixels must be greater than or equal to zero.");if(n.x<1||n.y<1)throw new x("initialSize must be greater than zero.");this._context=e.context,this._pixelFormat=A(e.pixelFormat,rt.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=Ms(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties(pd.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return l(this._texture)||(this._texture=new Wt({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 MKe(e,t){const n=e._context,i=e.numberOfImages,o=2,r=e._borderWidthInPixels;if(i>0){const s=e._texture.width,a=e._texture.height,c=o*(s+t.width+r),u=o*(a+t.height+r),d=s/c,h=a/u,m=new of(new j(s+r,r),new j(c,a)),g=new of(new j,new j(c,a),e._root,m),p=new of(new j(r,a+r),new j(c,u)),y=new of(new j,new j(c,u),g,p);for(let E=0;E<e._textureCoordinates.length;E++){const w=e._textureCoordinates[E];l(w)&&(w.x*=d,w.y*=h,w.width*=d,w.height*=h)}const b=new Wt({context:e._context,width:c,height:u,pixelFormat:e._pixelFormat}),C=new Yr({context:n,colorTextures:[e._texture],destroyAttachments:!1});C._bind(),b.copyFromFramebuffer(0,0,0,0,c,u),C._unBind(),C.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=b,e._root=y}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 Wt({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),e._root=new of(new j(r,r),new j(s,a))}}function dS(e,t,n){if(l(t)){if(!l(t.childNode1)&&!l(t.childNode2)){if(l(t.imageIndex))return;const 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 of(new j(t.bottomLeft.x,t.bottomLeft.y),new j(t.bottomLeft.x+n.width,t.topRight.y));const a=t.bottomLeft.x+n.width+e._borderWidthInPixels;a<t.topRight.x&&(t.childNode2=new of(new j(a,t.bottomLeft.y),new j(t.topRight.x,t.topRight.y)))}else{t.childNode1=new of(new j(t.bottomLeft.x,t.bottomLeft.y),new j(t.topRight.x,t.bottomLeft.y+n.height));const a=t.bottomLeft.y+n.height+e._borderWidthInPixels;a<t.topRight.y&&(t.childNode2=new of(new j(t.bottomLeft.x,a),new j(t.topRight.x,t.topRight.y)))}return dS(e,t.childNode1,n)}return dS(e,t.childNode1,n)||dS(e,t.childNode2,n)}}function SQ(e,t,n){const i=dS(e,e._root,t);if(l(i)){i.imageIndex=n;const 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,u=i.bottomLeft.y/r,d=s/o,h=a/r;e._textureCoordinates[n]=new Ye(c,u,d,h),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else MKe(e,t),SQ(e,t,n);e._guid=Ms()}function vQ(e,t){if(!l(e)||e.isDestroyed())return-1;const n=e.numberOfImages;return SQ(e,t,n),n}pd.prototype.getImageIndex=function(e){if(!l(e))throw new x("id is required.");return this._indexHash[e]};pd.prototype.addImageSync=function(e,t){if(!l(e))throw new x("id is required.");if(!l(t))throw new x("image is required.");let n=this._indexHash[e];return l(n)||(n=vQ(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n};pd.prototype.addImage=function(e,t){if(!l(e))throw new x("id is required.");if(!l(t))throw new x("image is required.");let n=this._idHash[e];if(l(n))return n;if(typeof t=="function"){if(t=t(e),!l(t))throw new x("image is required.")}else(typeof t=="string"||t instanceof Me)&&(t=Me.createIfNeeded(t).fetchImage());const i=this;return n=Promise.resolve(t).then(function(o){const r=vQ(i,o);return i._indexHash[e]=r,r}),this._idHash[e]=n,n};pd.prototype.addSubRegion=function(e,t){if(!l(e))throw new x("id is required.");if(!l(t))throw new x("subRegion is required.");const n=this._idHash[e];if(!l(n))throw new Ie(`image with id "${e}" not found in the atlas.`);const i=this;return Promise.resolve(n).then(function(o){if(o===-1)return-1;const r=i._texture.width,s=i._texture.height,a=i.numberOfImages,c=i._textureCoordinates[o],u=c.x+t.x/r,d=c.y+t.y/s,h=t.width/r,m=t.height/s;return i._textureCoordinates.push(new Ye(u,d,h,m)),i._guid=Ms(),a})};pd.prototype.isDestroyed=function(){return!1};pd.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),He(this)};const FKe=Ut.SHOW_INDEX,$b=Ut.POSITION_INDEX,DQ=Ut.PIXEL_OFFSET_INDEX,IQ=Ut.EYE_OFFSET_INDEX,zKe=Ut.HORIZONTAL_ORIGIN_INDEX,UKe=Ut.VERTICAL_ORIGIN_INDEX,HKe=Ut.SCALE_INDEX,RA=Ut.IMAGE_INDEX_INDEX,PQ=Ut.COLOR_INDEX,VKe=Ut.ROTATION_INDEX,kKe=Ut.ALIGNED_AXIS_INDEX,OQ=Ut.SCALE_BY_DISTANCE_INDEX,LQ=Ut.TRANSLUCENCY_BY_DISTANCE_INDEX,BQ=Ut.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,RQ=Ut.DISTANCE_DISPLAY_CONDITION,GKe=Ut.DISABLE_DEPTH_DISTANCE,WKe=Ut.TEXTURE_COORDINATE_BOUNDS,NQ=Ut.SDF_INDEX,Z2=Ut.NUMBER_OF_PROPERTIES;let Xi;const jKe={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},qKe={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 pa(e){e=A(e,A.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(Z2),this._maxSize=0,this._maxEyeOffset=0,this._maxScale=1,this._maxPixelOffset=0,this._allHorizontalCenter=!0,this._allVerticalCenter=!0,this._allSizedInMeters=!0,this._baseVolume=new fe,this._baseVolumeWC=new fe,this._baseVolume2D=new fe,this._boundingVolume=new fe,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=A(e.show,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowTextureAtlas=A(e.debugShowTextureAtlas,!1),this.blendOption=A(e.blendOption,Ko.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=le.SCENE3D,this._buffersUsage=[nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW],this._highlightColor=H.clone(H.WHITE);const t=this;this._uniforms={u_atlas:function(){return t._textureAtlas.texture},u_highlightColor:function(){return t._highlightColor}};const n=this._scene;l(n)&&l(n.terrainProviderChanged)&&(this._removeCallbackFunc=n.terrainProviderChanged.addEventListener(function(){const i=this._billboards,o=i.length;for(let r=0;r<o;++r)l(i[r])&&i[r]._updateClamping()},this))}Object.defineProperties(pa.prototype,{length:{get:function(){return eF(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 MQ(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}pa.prototype.add=function(e){const t=new Ut(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};pa.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};pa.prototype.removeAll=function(){MQ(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function eF(e){if(e._billboardsRemoved){e._billboardsRemoved=!1;const t=[],n=e._billboards,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];l(s)&&(s._index=r++,t.push(s))}e._billboards=t}}pa.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};pa.prototype.contains=function(e){return l(e)&&e._billboardCollection===this};pa.prototype.get=function(e){return T.typeOf.number("index",e),eF(this),this._billboards[e]};let uO;function $Ke(e){let n=e.cache.billboardCollection_indexBufferBatched;if(l(n))return n;const 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=Tt.createIndexBuffer({context:e,typedArray:o,usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function YKe(e){let t=e.cache.billboardCollection_indexBufferInstanced;return l(t)||(t=Tt.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function XKe(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return l(t)||(t=Tt.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:nt.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}pa.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<Z2;++i){const o=n[i]===0?nt.STATIC_DRAW:nt.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function KKe(e,t,n,i,o,r){const s=[{index:Xi.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[$b]},{index:Xi.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[$b]},{index:Xi.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[DQ]},{index:Xi.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[LQ]},{index:Xi.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[PQ]},{index:Xi.eyeOffset,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[IQ]},{index:Xi.scaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[OQ]},{index:Xi.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[BQ]},{index:Xi.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[RQ]},{index:Xi.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[WKe]}];i&&s.push({index:Xi.direction,componentsPerAttribute:2,componentDatatype:ee.FLOAT,vertexBuffer:XKe(e)}),l(o)&&s.push({index:Xi.a_batchId,componentsPerAttribute:1,componentDatatype:ee.FLOAT,bufferUsage:nt.STATIC_DRAW}),r&&s.push({index:Xi.sdf,componentsPerAttribute:2,componentDatatype:ee.FLOAT,usage:n[NQ]});const a=i?t:4*t;return new Rr(e,s,a,i)}const dO=new Rn;function FQ(e,t,n,i,o){let r;const s=i[Xi.positionHighAndScale],a=i[Xi.positionLowAndRotation],c=o._getActualPosition();e._mode===le.SCENE3D&&(fe.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),Rn.fromCartesian(c,dO);const u=o.scale,d=o.rotation;d!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,u);const h=dO.high,m=dO.low;e._instanced?(r=o._index,s(r,h.x,h.y,h.z,u),a(r,m.x,m.y,m.z,d)):(r=o._index*4,s(r+0,h.x,h.y,h.z,u),s(r+1,h.x,h.y,h.z,u),s(r+2,h.x,h.y,h.z,u),s(r+3,h.x,h.y,h.z,u),a(r+0,m.x,m.y,m.z,d),a(r+1,m.x,m.y,m.z,d),a(r+2,m.x,m.y,m.z,d),a(r+3,m.x,m.y,m.z,d))}const Xc=new j,Wc=32768,Vy=65536,fO=4096,sd=256,JKe=128,QKe=32,ZKe=8,zQ=4,eJe=1/256,UQ=0,HQ=2,VQ=3,kQ=1;function GQ(e,t,n,i,o){let r;const s=i[Xi.compressedAttribute0],a=o.pixelOffset,c=a.x,u=a.y,d=o._translate,h=d.x,m=d.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+h),Math.abs(-u+m));const g=o.horizontalOrigin;let p=o._verticalOrigin,y=o.show&&o.clusterShow;o.color.alpha===0&&(y=!1),p===Hi.BASELINE&&(p=Hi.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&g===La.CENTER,e._allVerticalCenter=e._allVerticalCenter&&p===Hi.CENTER;let b=0,C=0,E=0,w=0;const S=o._imageIndex;if(S!==-1){const V=n[S];if(!l(V))throw new x(`Invalid billboard image index: ${S}`);b=V.x,C=V.y,E=V.width,w=V.height}const P=b+E,L=C+w;let z=Math.floor(M.clamp(c,-Wc,Wc)+Wc)*JKe;z+=(g+1)*QKe,z+=(p+1)*ZKe,z+=(y?1:0)*zQ;let R=Math.floor(M.clamp(u,-Wc,Wc)+Wc)*sd,F=Math.floor(M.clamp(h,-Wc,Wc)+Wc)*sd;const U=(M.clamp(m,-Wc,Wc)+Wc)*eJe,D=Math.floor(U),I=Math.floor((U-D)*sd);R+=D,F+=I,Xc.x=b,Xc.y=C;const _=mi.compressTextureCoordinates(Xc);Xc.x=P;const v=mi.compressTextureCoordinates(Xc);Xc.y=L;const O=mi.compressTextureCoordinates(Xc);Xc.x=b;const N=mi.compressTextureCoordinates(Xc);e._instanced?(r=o._index,s(r,z,R,F,_)):(r=o._index*4,s(r+0,z+UQ,R,F,_),s(r+1,z+HQ,R,F,v),s(r+2,z+VQ,R,F,O),s(r+3,z+kQ,R,F,N))}function WQ(e,t,n,i,o){let r;const s=i[Xi.compressedAttribute1],a=o.alignedAxis;f.equals(a,f.ZERO)||(e._shaderAlignedAxis=!0);let c=0,u=1,d=1,h=1;const m=o.translucencyByDistance;l(m)&&(c=m.near,u=m.nearValue,d=m.far,h=m.farValue,(u!==1||h!==1)&&(e._shaderTranslucencyByDistance=!0));let g=0;const p=o._imageIndex;if(p!==-1){const w=n[p];if(!l(w))throw new x(`Invalid billboard image index: ${p}`);g=w.width}const y=e._textureAtlas.texture.width,b=Math.round(A(o.width,y*g));e._maxSize=Math.max(e._maxSize,b);let C=M.clamp(b,0,Vy),E=0;Math.abs(f.magnitudeSquared(a)-1)<M.EPSILON6&&(E=mi.octEncodeFloat(a)),u=M.clamp(u,0,1),u=u===1?255:u*255|0,C=C*sd+u,h=M.clamp(h,0,1),h=h===1?255:h*255|0,E=E*sd+h,e._instanced?(r=o._index,s(r,C,E,c,d)):(r=o._index*4,s(r+0,C,E,c,d),s(r+1,C,E,c,d),s(r+2,C,E,c,d),s(r+3,C,E,c,d))}function DR(e,t,n,i,o){let r;const s=i[Xi.compressedAttribute2],a=o.color,c=l(e._batchTable)?H.WHITE:o.getPickId(t.context).color,u=o.sizeInMeters?1:0,d=Math.abs(f.magnitudeSquared(o.alignedAxis)-1)<M.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&u===1;let h=0;const m=o._imageIndex;if(m!==-1){const z=n[m];if(!l(z))throw new x(`Invalid billboard image index: ${m}`);h=z.height}const g=e._textureAtlas.texture.dimensions,p=Math.round(A(o.height,g.y*h));e._maxSize=Math.max(e._maxSize,p);let y=A(o._labelHorizontalOrigin,-2);y+=2;const b=p*zQ+y;let C=H.floatToByte(a.red),E=H.floatToByte(a.green),w=H.floatToByte(a.blue);const S=C*Vy+E*sd+w;C=H.floatToByte(c.red),E=H.floatToByte(c.green),w=H.floatToByte(c.blue);const P=C*Vy+E*sd+w;let L=H.floatToByte(a.alpha)*Vy+H.floatToByte(c.alpha)*sd;L+=u*2+d,e._instanced?(r=o._index,s(r,S,P,L,b)):(r=o._index*4,s(r+0,S,P,L,b),s(r+1,S,P,L,b),s(r+2,S,P,L,b),s(r+3,S,P,L,b))}function IR(e,t,n,i,o){let r;const s=i[Xi.eyeOffset],a=o.eyeOffset;let c=a.z;if(o._heightReference!==St.NONE&&(c*=1.005),e._maxEyeOffset=Math.max(e._maxEyeOffset,Math.abs(a.x),Math.abs(a.y),Math.abs(c)),e._instanced){let u=0,d=0;const h=o._imageIndex;if(h!==-1){const g=n[h];if(!l(g))throw new x(`Invalid billboard image index: ${h}`);u=g.width,d=g.height}Xc.x=u,Xc.y=d;const m=mi.compressTextureCoordinates(Xc);r=o._index,s(r,a.x,a.y,c,m)}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 jQ(e,t,n,i,o){let r;const s=i[Xi.scaleByDistance];let a=0,c=1,u=1,d=1;const h=o.scaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,d=h.farValue,(c!==1||d!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,d)):(r=o._index*4,s(r+0,a,c,u,d),s(r+1,a,c,u,d),s(r+2,a,c,u,d),s(r+3,a,c,u,d))}function qQ(e,t,n,i,o){let r;const s=i[Xi.pixelOffsetScaleByDistance];let a=0,c=1,u=1,d=1;const h=o.pixelOffsetScaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,d=h.farValue,(c!==1||d!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,d)):(r=o._index*4,s(r+0,a,c,u,d),s(r+1,a,c,u,d),s(r+2,a,c,u,d),s(r+3,a,c,u,d))}function $Q(e,t,n,i,o){let r;const s=i[Xi.compressedAttribute3];let a=0,c=Number.MAX_VALUE;const u=o.distanceDisplayCondition;l(u)&&(a=u.near,c=u.far,a*=a,c*=c,e._shaderDistanceDisplayCondition=!0);let d=o.disableDepthTestDistance;const h=o.heightReference===St.CLAMP_TO_GROUND&&t.context.depthTexture;l(d)||(d=h?5e3:0),d*=d,(h||d>0)&&(e._shaderDisableDepthDistance=!0,d===Number.POSITIVE_INFINITY&&(d=-1));let m,g;if(l(o._labelDimensions))g=o._labelDimensions.x,m=o._labelDimensions.y;else{let C=0,E=0;const w=o._imageIndex;if(w!==-1){const P=n[w];if(!l(P))throw new x(`Invalid billboard image index: ${w}`);C=P.height,E=P.width}m=Math.round(A(o.height,e._textureAtlas.texture.dimensions.y*C));const S=e._textureAtlas.texture.width;g=Math.round(A(o.width,S*E))}const p=Math.floor(M.clamp(g,0,fO)),y=Math.floor(M.clamp(m,0,fO)),b=p*fO+y;e._instanced?(r=o._index,s(r,a,c,d,b)):(r=o._index*4,s(r+0,a,c,d,b),s(r+1,a,c,d,b),s(r+2,a,c,d,b),s(r+3,a,c,d,b))}function YQ(e,t,n,i,o){if(o.heightReference===St.CLAMP_TO_GROUND){const p=e._scene,y=t.context,b=t.globeTranslucencyState.translucent,C=l(p.globe)&&p.globe.depthTestAgainstTerrain;e._shaderClampToGround=y.depthTexture&&!b&&C}let r;const s=i[Xi.textureCoordinateBoundsOrLabelTranslate];if(It.maximumVertexTextureImageUnits>0){let p=0,y=0;l(o._labelTranslate)&&(p=o._labelTranslate.x,y=o._labelTranslate.y),e._instanced?(r=o._index,s(r,p,y,0,0)):(r=o._index*4,s(r+0,p,y,0,0),s(r+1,p,y,0,0),s(r+2,p,y,0,0),s(r+3,p,y,0,0));return}let a=0,c=0,u=0,d=0;const h=o._imageIndex;if(h!==-1){const p=n[h];if(!l(p))throw new x(`Invalid billboard image index: ${h}`);a=p.x,c=p.y,u=p.width,d=p.height}const m=a+u,g=c+d;e._instanced?(r=o._index,s(r,a,c,m,g)):(r=o._index*4,s(r+0,a,c,m,g),s(r+1,a,c,m,g),s(r+2,a,c,m,g),s(r+3,a,c,m,g))}function tJe(e,t,n,i,o){if(!l(e._batchTable))return;const r=i[Xi.a_batchId],s=o._batchIndex;let 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 XQ(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[Xi.sdf],a=o.outlineColor,c=o.outlineWidth,u=H.floatToByte(a.red),d=H.floatToByte(a.green),h=H.floatToByte(a.blue),m=u*Vy+d*sd+h,g=c/uc.RADIUS,p=H.floatToByte(a.alpha)*Vy+H.floatToByte(g)*sd;e._instanced?(r=o._index,s(r,m,p)):(r=o._index*4,s(r+0,m+UQ,p),s(r+1,m+HQ,p),s(r+2,m+VQ,p),s(r+3,m+kQ,p))}function nJe(e,t,n,i,o){FQ(e,t,n,i,o),GQ(e,t,n,i,o),WQ(e,t,n,i,o),DR(e,t,n,i,o),IR(e,t,n,i,o),jQ(e,t,n,i,o),qQ(e,t,n,i,o),$Q(e,t,n,i,o),YQ(e,t,n,i,o),tJe(e,t,n,i,o),XQ(e,t,n,i,o)}function hO(e,t,n,i,o,r){let s;i.mode===le.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const u=t[c],d=u.position,h=Ut._computeActualPosition(u,d,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):fe.expand(s,h,s))}r&&fe.fromPoints(a,s)}function iJe(e,t){const n=t.mode,i=e._billboards,o=e._billboardsToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==le.SCENE3D&&!B.equals(r,e.modelMatrix)?(e._mode=n,B.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===le.SCENE3D||n===le.SCENE2D||n===le.COLUMBUS_VIEW)&&hO(e,i,i.length,t,r,!0)):n===le.MORPHING?hO(e,i,i.length,t,r,!0):(n===le.SCENE2D||n===le.COLUMBUS_VIEW)&&hO(e,o,e._billboardsToUpdateIndex,t,r,!1)}function oJe(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);const r=i*e._maxPixelOffset+e._maxEyeOffset;n.radius+=o+r}function rJe(e,t){const n=`uniform sampler2D billboard_texture;
|
||
varying vec2 v_textureCoordinates;
|
||
void main()
|
||
{
|
||
gl_FragColor = texture2D(billboard_texture, v_textureCoordinates);
|
||
}
|
||
`,i=t.createViewportQuadCommand(n,{uniformMap:{billboard_texture:function(){return e._textureAtlas.texture}}});return i.pass=Ne.OVERLAY,i}const sJe=[];pa.prototype.update=function(e){if(eF(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,Xi=this._instanced?qKe:jKe,uO=this._instanced?YKe:$Ke;let o=this._textureAtlas;if(!l(o)){o=this._textureAtlas=new pd({context:i});for(let R=0;R<n;++R)t[R]._loadImage()}const r=o.textureCoordinates;if(r.length===0)return;iJe(this,e),t=this._billboards,n=t.length;const s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,u=o.guid,d=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let h;const m=e.passes,g=m.pick;if(d||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let R=0;R<Z2;++R)c[R]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=KKe(i,n,this._buffersUsage,this._instanced,this._batchTable,this._sdf),h=this._vaf.writers;for(let R=0;R<n;++R){const F=this._billboards[R];F._dirty=!1,nJe(this,e,r,h,F)}this._vaf.commit(uO(i))}this._billboardsToUpdateIndex=0}else if(a>0){const R=sJe;R.length=0,(c[$b]||c[VKe]||c[HKe])&&R.push(FQ),(c[RA]||c[DQ]||c[zKe]||c[UKe]||c[FKe])&&(R.push(GQ),this._instanced&&R.push(IR)),(c[RA]||c[kKe]||c[LQ])&&(R.push(WQ),R.push(DR)),(c[RA]||c[PQ])&&R.push(DR),c[IQ]&&R.push(IR),c[OQ]&&R.push(jQ),c[BQ]&&R.push(qQ),(c[RQ]||c[GKe]||c[RA]||c[$b])&&R.push($Q),(c[RA]||c[$b])&&R.push(YQ),c[NQ]&&R.push(XQ);const F=R.length;if(h=this._vaf.writers,a/n>.1){for(let U=0;U<a;++U){const D=s[U];D._dirty=!1;for(let I=0;I<F;++I)R[I](this,e,r,h,D)}this._vaf.commit(uO(i))}else{for(let U=0;U<a;++U){const D=s[U];D._dirty=!1;for(let I=0;I<F;++I)R[I](this,e,r,h,D);this._instanced?this._vaf.subCommit(D._index,1):this._vaf.subCommit(D._index*4,4)}this._vaf.endSubCommits()}this._billboardsToUpdateIndex=0}if(a>n*1.5&&(s.length=n),!l(this._vaf)||!l(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,fe.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let p,y=B.IDENTITY;e.mode===le.SCENE3D?(y=this.modelMatrix,p=fe.clone(this._baseVolumeWC,this._boundingVolume)):p=fe.clone(this._baseVolume2D,this._boundingVolume),oJe(this,e,p);const b=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,b){this._blendOption===Ko.OPAQUE||this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=et.fromCache({depthTest:{enabled:!0,func:ae.LESS},depthMask:!0}):this._rsOpaque=void 0;const R=this._blendOption===Ko.TRANSLUCENT;this._blendOption===Ko.TRANSLUCENT||this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=et.fromCache({depthTest:{enabled:!0,func:R?ae.LEQUAL:ae.LESS},depthMask:R,blending:Gi.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let C,E,w,S,P;const L=It.maximumVertexTextureImageUnits>0;if(b||this._shaderRotation!==this._compiledShaderRotation||this._shaderAlignedAxis!==this._compiledShaderAlignedAxis||this._shaderScaleByDistance!==this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance!==this._compiledShaderTranslucencyByDistance||this._shaderPixelOffsetScaleByDistance!==this._compiledShaderPixelOffsetScaleByDistance||this._shaderDistanceDisplayCondition!==this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance||this._shaderClampToGround!==this._compiledShaderClampToGround||this._sdf!==this._compiledSDF){C=uEe,E=lEe,P=[],l(this._batchTable)&&(P.push("VECTOR_TILE"),C=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(C),E=this._batchTable.getFragmentShaderCallback(!1,void 0)(E)),w=new We({defines:P,sources:[C]}),this._instanced&&w.defines.push("INSTANCED"),this._shaderRotation&&w.defines.push("ROTATION"),this._shaderAlignedAxis&&w.defines.push("ALIGNED_AXIS"),this._shaderScaleByDistance&&w.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&w.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderPixelOffsetScaleByDistance&&w.defines.push("EYE_DISTANCE_PIXEL_OFFSET"),this._shaderDistanceDisplayCondition&&w.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&w.defines.push("DISABLE_DEPTH_DISTANCE"),this._shaderClampToGround&&(L?w.defines.push("VERTEX_DEPTH_CHECK"):w.defines.push("FRAGMENT_DEPTH_CHECK"));const R=1-uc.CUTOFF;this._sdf&&w.defines.push("SDF");const F=l(this._batchTable)?"VECTOR_TILE":"";this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT&&(S=new We({defines:["OPAQUE",F],sources:[E]}),this._shaderClampToGround&&(L?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._sp=Cn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Xi}),S=new We({defines:["TRANSLUCENT",F],sources:[E]}),this._shaderClampToGround&&(L?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._spTranslucent=Cn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Xi})),this._blendOption===Ko.OPAQUE&&(S=new We({defines:[F],sources:[E]}),this._shaderClampToGround&&(L?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._sp=Cn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Xi})),this._blendOption===Ko.TRANSLUCENT&&(S=new We({defines:[F],sources:[E]}),this._shaderClampToGround&&(L?S.defines.push("VERTEX_DEPTH_CHECK"):S.defines.push("FRAGMENT_DEPTH_CHECK")),this._sdf&&(S.defines.push("SDF"),S.defines.push(`SDF_EDGE ${R}`)),this._spTranslucent=Cn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Xi})),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}const z=e.commandList;if(m.render||m.pick){const R=this._colorCommands,F=this._blendOption===Ko.OPAQUE,U=this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT,D=this._vaf.va,I=D.length;let _=this._uniforms,v;l(this._batchTable)?(_=this._batchTable.getUniformMapCallback()(_),v=this._batchTable.getPickId()):v="v_pickColor",R.length=I;const O=U?I*2:I;for(let N=0;N<O;++N){let V=R[N];l(V)||(V=R[N]=new mt);const k=F||U&&N%2===0;V.pass=k||!U?Ne.OPAQUE:Ne.TRANSLUCENT,V.owner=this;const G=U?Math.floor(N/2):N;V.boundingVolume=p,V.modelMatrix=y,V.count=D[G].indicesCount,V.shaderProgram=k?this._sp:this._spTranslucent,V.uniformMap=_,V.vertexArray=D[G].va,V.renderState=k?this._rsOpaque:this._rsTranslucent,V.debugShowBoundingVolume=this.debugShowBoundingVolume,V.pickId=v,this._instanced&&(V.count=6,V.instanceCount=n),z.push(V)}this.debugShowTextureAtlas&&(l(this.debugCommand)||(this.debugCommand=rJe(this,e.context)),z.push(this.debugCommand))}};pa.prototype.isDestroyed=function(){return!1};pa.prototype.destroy=function(){return l(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(),MQ(this._billboards),He(this)};function KQ(e,t,n,i,o){return function(){const r=document.createElement("canvas"),s=o+2*i;r.height=r.width=s;const 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}}function ur(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),fy(this)}const aJe=new Ce;Object.defineProperties(ur.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=H.clone(e,this._color),fy(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,fy(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=H.clone(e,this._pointOutlineColor),fy(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,fy(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){l(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){const t=A(this._heightOffset,0),n=this._content.tileset.ellipsoid,i=n.cartesianToCartographic(this._billboard.position,aJe);i.height=i.height-t+e;const 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=H.clone(e,this._polyline.material.uniforms.color)}},image:{get:function(){return this._billboardImage},set:function(e){const t=this._billboardImage!==e;this._billboardImage=e,t&&fy(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(){const e=this._pickIds;return e[0]=this._billboard.pickId,e[1]=this._label.pickId,e[2]=this._polyline.pickId,e}}});ur.defaultColor=H.WHITE;ur.defaultPointOutlineColor=H.BLACK;ur.defaultPointOutlineWidth=0;ur.defaultPointSize=8;function fy(e){const t=e._billboard;if(l(e._billboardImage)&&e._billboardImage!==t.image){t.image=e._billboardImage;return}if(l(e._billboardImage))return;const n=A(e._color,ur.defaultColor),i=A(e._pointOutlineColor,ur.defaultPointOutlineColor),o=A(e._pointOutlineWidth,ur.defaultPointOutlineWidth),r=A(e._pointSize,ur.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,c=e._billboardOutlineWidth,u=e._billboardSize;if(H.equals(n,s)&&H.equals(i,a)&&o===c&&r===u)return;e._billboardColor=H.clone(n,e._billboardColor),e._billboardOutlineColor=H.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const d=n.alpha,h=n.toCssColorString(),m=i.toCssColorString(),g=JSON.stringify([h,r,m,o]);t.setImage(g,KQ(d,h,m,o,r))}ur.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};ur.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};ur.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};ur.prototype.getPropertyInherited=function(e){return As.getPropertyInherited(this._content,this._batchId,e)};ur.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};ur.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};ur.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};ur.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function cJe(e,t,n,i,o){const r=e.measureText(t);if(!!/\S/.test(t)){const a=document.defaultView.getComputedStyle(e.canvas).getPropertyValue("font-size").replace("px",""),c=document.createElement("canvas"),u=100,d=r.width+u|0,h=3*a,m=h/2;c.width=d,c.height=h;const 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,u/2,m)),o&&(g.fillStyle="black",g.fillText(t,u/2,m));const p=g.getImageData(0,0,d,h).data,y=p.length,b=d*4;let C,E,w,S;for(C=0;C<y;++C)if(p[C]!==255){w=C/b|0;break}for(C=y-1;C>=0;--C)if(p[C]!==255){S=C/b|0;break}let P=-1;for(C=0;C<d&&P===-1;++C)for(E=0;E<h;++E){const L=C*4+E*b;if(p[L]!==255||p[L+1]!==255||p[L+2]!==255||p[L+3]!==255){P=C;break}}return{width:r.width,height:S-w,ascent:m-w,descent:S-m,minx:P-u/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}let vm;function lJe(e,t){if(!l(e))throw new x("text is required.");if(e==="")return;t=A(t,A.EMPTY_OBJECT);const n=A(t.font,"10px sans-serif"),i=A(t.stroke,!1),o=A(t.fill,!0),r=A(t.strokeWidth,1),s=A(t.backgroundColor,H.TRANSPARENT),a=A(t.padding,0),c=a*2,u=document.createElement("canvas");u.width=1,u.height=1,u.style.font=n;const d=u.getContext("2d");l(vm)||(l(d.imageSmoothingEnabled)?vm="imageSmoothingEnabled":l(d.mozImageSmoothingEnabled)?vm="mozImageSmoothingEnabled":l(d.webkitImageSmoothingEnabled)?vm="webkitImageSmoothingEnabled":l(d.msImageSmoothingEnabled)&&(vm="msImageSmoothingEnabled")),d.font=n,d.lineJoin="round",d.lineWidth=r,d[vm]=!1,u.style.visibility="hidden",document.body.appendChild(u);const h=cJe(d,e,n,i,o);u.dimensions=h,document.body.removeChild(u),u.style.visibility="";const m=-h.minx,g=Math.ceil(h.width)+m+c,p=h.height+c,y=p-h.ascent+a,b=p-y+c;if(u.width=g,u.height=p,d.font=n,d.lineJoin="round",d.lineWidth=r,d[vm]=!1,s!==H.TRANSPARENT&&(d.fillStyle=s.toCssColorString(),d.fillRect(0,0,u.width,u.height)),i){const C=A(t.strokeColor,H.BLACK);d.strokeStyle=C.toCssColorString(),d.strokeText(e,m+a,b)}if(o){const C=A(t.fillColor,H.WHITE);d.fillStyle=C.toCssColorString(),d.fillText(e,m+a,b)}return u}var uJe=dJe,Yb=1e20;function dJe(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,u,d,h,m,g,p,y;if(ArrayBuffer.isView(e)||Array.isArray(e)){if(!t.width||!t.height)throw Error("For raw data width and height should be provided by options");r=t.width,s=t.height,c=e,t.stride?d=t.stride:d=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(m=e,h=m.getContext("2d"),r=m.width,s=m.height,g=h.getImageData(0,0,r,s),c=g.data,d=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(m=e.canvas,h=e,r=m.width,s=m.height,g=h.getImageData(0,0,r,s),c=g.data,d=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,c=g.data,d=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&c instanceof window.Uint8ClampedArray||window.Uint8Array&&c instanceof window.Uint8Array)for(u=c,c=Array(r*s),p=0,y=Math.floor(u.length/d);p<y;p++)c[p]=u[p*d+o]/255;else if(d!==1)throw Error("Raw data can have only 1 value per pixel");var b=Array(r*s),C=Array(r*s),E=Array(a),w=Array(a),S=Array(a+1),P=Array(a);for(p=0,y=r*s;p<y;p++){var L=c[p];b[p]=L===1?0:L===0?Yb:Math.pow(Math.max(0,.5-L),2),C[p]=L===1?Yb:L===0?0:Math.pow(Math.max(0,L-.5),2)}G5(b,r,s,E,w,P,S),G5(C,r,s,E,w,P,S);var z=window.Float32Array?new Float32Array(r*s):new Array(r*s);for(p=0,y=r*s;p<y;p++)z[p]=Math.min(Math.max(1-((b[p]-C[p])/i+n),0),1);return z}function G5(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(W5(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(W5(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function W5(e,t,n,i,o){n[0]=0,i[0]=-Yb,i[1]=+Yb;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]=+Yb}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]]}}const fJe={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},Zl=Object.freeze(fJe),j5={};let q5=0;const hJe=256,pJe=new H(.165,.165,.165,.8),mJe=new j(7,5),gr=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function Dm(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function NA(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function MA(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function JQ(e){let t=j5[e._font];if(!l(t)){const n=document.createElement("div");n.style.position="absolute",n.style.opacity=0,n.style.font=e._font,document.body.appendChild(n);let i=parseFloat(MA(n,"line-height"));isNaN(i)&&(i=void 0),t={family:MA(n,"font-family"),size:MA(n,"font-size").replace("px",""),style:MA(n,"font-style"),weight:MA(n,"font-weight"),lineHeight:i},document.body.removeChild(n),q5<hJe&&(j5[e._font]=t,q5++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function mu(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new x("disableDepthTestDistance must be greater than 0.0.");let n=e.translucencyByDistance,i=e.pixelOffsetScaleByDistance,o=e.scaleByDistance,r=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new x("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=kt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=kt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");o=kt.clone(o)}if(l(r)){if(r.far<=r.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=jt.clone(r)}this._renderedText=void 0,this._text=void 0,this._show=A(e.show,!0),this._font=A(e.font,"30px sans-serif"),this._fillColor=H.clone(A(e.fillColor,H.WHITE)),this._outlineColor=H.clone(A(e.outlineColor,H.BLACK)),this._outlineWidth=A(e.outlineWidth,1),this._showBackground=A(e.showBackground,!1),this._backgroundColor=H.clone(A(e.backgroundColor,pJe)),this._backgroundPadding=j.clone(A(e.backgroundPadding,mJe)),this._style=A(e.style,Zl.FILL),this._verticalOrigin=A(e.verticalOrigin,Hi.BASELINE),this._horizontalOrigin=A(e.horizontalOrigin,La.LEFT),this._pixelOffset=j.clone(A(e.pixelOffset,j.ZERO)),this._eyeOffset=f.clone(A(e.eyeOffset,f.ZERO)),this._position=f.clone(A(e.position,f.ZERO)),this._scale=A(e.scale,1),this._id=e.id,this._translucencyByDistance=n,this._pixelOffsetScaleByDistance=i,this._scaleByDistance=o,this._heightReference=A(e.heightReference,St.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=A(e.text,""),this._relativeSize=1,JQ(this),this._updateClamping()}Object.defineProperties(mu.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new x("value is required.");if(this._show!==e){this._show=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;l(r)&&(r.show=e)}const n=this._backgroundBillboard;l(n)&&(n.show=e)}}},position:{get:function(){return this._position},set:function(e){if(!l(e))throw new x("value is required.");const t=this._position;if(!f.equals(t,e)){f.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o].billboard;l(s)&&(s.position=e)}const i=this._backgroundBillboard;l(i)&&(i.position=e),this._updateClamping()}}},heightReference:{get:function(){return this._heightReference},set:function(e){if(!l(e))throw new x("value is required.");if(e!==this._heightReference){this._heightReference=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i].billboard;l(r)&&(r.heightReference=e)}const n=this._backgroundBillboard;l(n)&&(n.heightReference=e),NA(this),this._updateClamping()}}},text:{get:function(){return this._text},set:function(e){if(!l(e))throw new x("value is required.");if(this._text!==e){this._text=e;const t=e.replace(/\u00ad/g,"");this._renderedText=mu.enableRightToLeftDetection?CJe(t):t,Dm(this)}}},font:{get:function(){return this._font},set:function(e){if(!l(e))throw new x("value is required.");this._font!==e&&(this._font=e,Dm(this),JQ(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._fillColor;H.equals(t,e)||(H.clone(e,t),Dm(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;H.equals(t,e)||(H.clone(e,t),Dm(this))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!l(e))throw new x("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,Dm(this))}},showBackground:{get:function(){return this._showBackground},set:function(e){if(!l(e))throw new x("value is required.");this._showBackground!==e&&(this._showBackground=e,Dm(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._backgroundColor;if(!H.equals(t,e)){H.clone(e,t);const n=this._backgroundBillboard;l(n)&&(n.color=t)}}},backgroundPadding:{get:function(){return this._backgroundPadding},set:function(e){if(!l(e))throw new x("value is required.");const t=this._backgroundPadding;j.equals(t,e)||(j.clone(e,t),NA(this))}},style:{get:function(){return this._style},set:function(e){if(!l(e))throw new x("value is required.");this._style!==e&&(this._style=e,Dm(this))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){if(!l(e))throw new x("value is required.");const t=this._pixelOffset;if(!j.equals(t,e)){j.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.pixelOffset=e)}const i=this._backgroundBillboard;l(i)&&(i.pixelOffset=e)}}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");const t=this._translucencyByDistance;if(!kt.equals(t,e)){this._translucencyByDistance=kt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.translucencyByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.translucencyByDistance=e)}}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;if(!kt.equals(t,e)){this._pixelOffsetScaleByDistance=kt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.pixelOffsetScaleByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.pixelOffsetScaleByDistance=e)}}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");const t=this._scaleByDistance;if(!kt.equals(t,e)){this._scaleByDistance=kt.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.scaleByDistance=e)}const i=this._backgroundBillboard;l(i)&&(i.scaleByDistance=e)}}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){if(!l(e))throw new x("value is required.");const t=this._eyeOffset;if(!f.equals(t,e)){f.clone(e,t);const n=this._glyphs;for(let o=0,r=n.length;o<r;o++){const s=n[o];l(s.billboard)&&(s.billboard.eyeOffset=e)}const i=this._backgroundBillboard;l(i)&&(i.eyeOffset=e)}}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){if(!l(e))throw new x("value is required.");this._horizontalOrigin!==e&&(this._horizontalOrigin=e,NA(this))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){if(!l(e))throw new x("value is required.");if(this._verticalOrigin!==e){this._verticalOrigin=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.verticalOrigin=e)}const n=this._backgroundBillboard;l(n)&&(n.verticalOrigin=e),NA(this)}}},scale:{get:function(){return this._scale},set:function(e){if(!l(e))throw new x("value is required.");if(this._scale!==e){this._scale=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.scale=e*this._relativeSize)}const n=this._backgroundBillboard;l(n)&&(n.scale=e*this._relativeSize),NA(this)}}},totalScale:{get:function(){return this._scale*this._relativeSize}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far must be greater than near");if(!jt.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=jt.clone(e,this._distanceDisplayCondition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.distanceDisplayCondition=e)}const n=this._backgroundBillboard;l(n)&&(n.distanceDisplayCondition=e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(l(e)&&e<0)throw new x("disableDepthTestDistance must be greater than 0.0.");this._disableDepthTestDistance=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.disableDepthTestDistance=e)}const n=this._backgroundBillboard;l(n)&&(n.disableDepthTestDistance=e)}}},id:{get:function(){return this._id},set:function(e){if(this._id!==e){this._id=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.id=e)}const n=this._backgroundBillboard;l(n)&&(n.id=e)}}},pickId:{get:function(){if(!(this._glyphs.length===0||!l(this._glyphs[0].billboard)))return this._glyphs[0].billboard.pickId}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=f.clone(e,this._actualClampedPosition);const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard._clampedPosition=e)}const n=this._backgroundBillboard;l(n)&&(n._clampedPosition=e)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){if(this._clusterShow!==e){this._clusterShow=e;const t=this._glyphs;for(let i=0,o=t.length;i<o;i++){const r=t[i];l(r.billboard)&&(r.billboard.clusterShow=e)}const n=this._backgroundBillboard;l(n)&&(n.clusterShow=e)}}}});mu.prototype._updateClamping=function(){Ut._updateClamping(this._labelCollection,this)};mu.prototype.computeScreenSpacePosition=function(e,t){if(!l(e))throw new x("scene is required.");l(t)||(t=new j);const i=this._labelCollection.modelMatrix,o=l(this._actualClampedPosition)?this._actualClampedPosition:this._position;return Ut._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};mu.getScreenSpaceBoundingBox=function(e,t,n){let i=0,o=0,r=0,s=0;const a=e.totalScale,c=e._backgroundBillboard;if(l(c))i=t.x+c._translate.x,o=t.y-c._translate.y,r=c.width*a,s=c.height*a,e.verticalOrigin===Hi.BOTTOM||e.verticalOrigin===Hi.BASELINE?o-=s:e.verticalOrigin===Hi.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let u=0,d=0;const h=e._glyphs,m=h.length;for(let g=0;g<m;++g){const p=h[g],y=p.billboard;if(!l(y))continue;const b=t.x+y._translate.x;let C=t.y-y._translate.y;const E=p.dimensions.width*a,w=p.dimensions.height*a;e.verticalOrigin===Hi.BOTTOM||e.verticalOrigin===Hi.BASELINE?C-=w:e.verticalOrigin===Hi.CENTER&&(C-=w*.5),e._verticalOrigin===Hi.TOP?C+=uc.PADDING*a:(e._verticalOrigin===Hi.BOTTOM||e._verticalOrigin===Hi.BASELINE)&&(C-=uc.PADDING*a),i=Math.min(i,b),o=Math.min(o,C),u=Math.max(u,b+E),d=Math.max(d,C+w)}r=u-i,s=d-o}return l(n)||(n=new Ye),n.x=i,n.y=o,n.width=r,n.height=s,n};mu.prototype.equals=function(e){return this===e||l(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&&f.equals(this._position,e._position)&&H.equals(this._fillColor,e._fillColor)&&H.equals(this._outlineColor,e._outlineColor)&&H.equals(this._backgroundColor,e._backgroundColor)&&j.equals(this._backgroundPadding,e._backgroundPadding)&&j.equals(this._pixelOffset,e._pixelOffset)&&f.equals(this._eyeOffset,e._eyeOffset)&&kt.equals(this._translucencyByDistance,e._translucencyByDistance)&&kt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&kt.equals(this._scaleByDistance,e._scaleByDistance)&&jt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};mu.prototype.isDestroyed=function(){return!1};mu.enableRightToLeftDetection=!1;function _Je(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[];let r="",s=gr.LTR,a="";const c=e.length;for(let u=0;u<c;++u){const d=e.charAt(u);t.test(d)?a=gr.RTL:n.test(d)?a=gr.LTR:i.test(d)?a=gr.BRACKETS:a=gr.WEAK,u===0&&(s=a),s===a&&a!==gr.BRACKETS?r+=d:(r!==""&&o.push({Type:s,Word:r}),s=a,r=d)}return o.push({Type:a,Word:r}),o}function gJe(e){return e.split("").reverse().join("")}function FA(e,t,n){return e.slice(0,t)+n+e.slice(t)}function yJe(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}const AJe="א-ת",bJe="-ۿݐ-ݿࢠ-ࣿ",$5=new RegExp(`[${AJe}${bJe}]`);function CJe(e){const t=e.split(`
|
||
`);let n="";for(let i=0;i<t.length;i++){const o=t[i],r=$5.test(o.charAt(0)),s=_Je(o,$5);let a=0,c="";for(let u=0;u<s.length;++u){const d=s[u],h=d.Type===gr.BRACKETS?yJe(d.Word):gJe(d.Word);r?d.Type===gr.RTL?(c=h+c,a=0):d.Type===gr.LTR?(c=FA(c,a,d.Word),a+=d.Word.length):(d.Type===gr.WEAK||d.Type===gr.BRACKETS)&&(d.Type===gr.WEAK&&s[u-1].Type===gr.BRACKETS?c=h+c:s[u-1].Type===gr.RTL?(c=h+c,a=0):s.length>u+1?s[u+1].Type===gr.RTL?(c=h+c,a=0):(c=FA(c,a,d.Word),a+=d.Word.length):c=FA(c,0,h)):d.Type===gr.RTL?c=FA(c,a,h):d.Type===gr.LTR?(c+=d.Word,a=c.length):(d.Type===gr.WEAK||d.Type===gr.BRACKETS)&&(u>0&&s[u-1].Type===gr.RTL?s.length>u+1?s[u+1].Type===gr.RTL?c=FA(c,a,h):(c+=d.Word,a=c.length):c+=d.Word:(c+=d.Word,a=c.length))}n+=c,i<t.length-1&&(n+=`
|
||
`)}return n}var PR={},TJe={get exports(){return PR},set exports(e){PR=e}};(function(e){function t(){var n=0,i=1,o=2,r=3,s=4,a=5,c=6,u=7,d=8,h=9,m=10,g=11,p=12,y=13,b=14,C=15,E=16,w=17,S=0,P=1,L=2,z=3,R=4;function F(_,v){return 55296<=_.charCodeAt(v)&&_.charCodeAt(v)<=56319&&56320<=_.charCodeAt(v+1)&&_.charCodeAt(v+1)<=57343}function U(_,v){v===void 0&&(v=0);var O=_.charCodeAt(v);if(55296<=O&&O<=56319&&v<_.length-1){var N=O,V=_.charCodeAt(v+1);return 56320<=V&&V<=57343?(N-55296)*1024+(V-56320)+65536:N}if(56320<=O&&O<=57343&&v>=1){var N=_.charCodeAt(v-1),V=O;return 55296<=N&&N<=56319?(N-55296)*1024+(V-56320)+65536:V}return O}function D(_,v,O){var N=[_].concat(v).concat([O]),V=N[N.length-2],k=O,G=N.lastIndexOf(b);if(G>1&&N.slice(1,G).every(function(q){return q==r})&&[r,y,w].indexOf(_)==-1)return L;var W=N.lastIndexOf(s);if(W>0&&N.slice(1,W).every(function(q){return q==s})&&[p,s].indexOf(V)==-1)return N.filter(function(q){return q==s}).length%2==1?z:R;if(V==n&&k==i)return S;if(V==o||V==n||V==i)return k==b&&v.every(function(q){return q==r})?L:P;if(k==o||k==n||k==i)return P;if(V==c&&(k==c||k==u||k==h||k==m))return S;if((V==h||V==u)&&(k==u||k==d))return S;if((V==m||V==d)&&k==d)return S;if(k==r||k==C)return S;if(k==a)return S;if(V==p)return S;var K=N.indexOf(r)!=-1?N.lastIndexOf(r)-1:N.length-2;return[y,w].indexOf(N[K])!=-1&&N.slice(K+1,-1).every(function(q){return q==r})&&k==b||V==C&&[E,w].indexOf(k)!=-1?S:v.indexOf(s)!=-1?L:V==s&&k==s?S:P}this.nextBreak=function(_,v){if(v===void 0&&(v=0),v<0)return 0;if(v>=_.length-1)return _.length;for(var O=I(U(_,v)),N=[],V=v+1;V<_.length;V++)if(!F(_,V-1)){var k=I(U(_,V));if(D(O,N,k))return V;N.push(k)}return _.length},this.splitGraphemes=function(_){for(var v=[],O=0,N;(N=this.nextBreak(_,O))<_.length;)v.push(_.slice(O,N)),O=N;return O<_.length&&v.push(_.slice(O)),v},this.iterateGraphemes=function(_){var v=0,O={next:function(){var N,V;return(V=this.nextBreak(_,v))<_.length?(N=_.slice(v,V),v=V,{value:N,done:!1}):v<_.length?(N=_.slice(v),v=_.length,{value:N,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(O[Symbol.iterator]=function(){return O}),O},this.countGraphemes=function(_){for(var v=0,O=0,N;(N=this.nextBreak(_,O))<_.length;)O=N,v++;return O<_.length&&v++,v};function I(_){return 1536<=_&&_<=1541||_==1757||_==1807||_==2274||_==3406||_==69821||70082<=_&&_<=70083||_==72250||72326<=_&&_<=72329||_==73030?p:_==13?n:_==10?i: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?o: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?r:127462<=_&&_<=127487?s:_==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?a:4352<=_&&_<=4447||43360<=_&&_<=43388?c:4448<=_&&_<=4519||55216<=_&&_<=55238?u:4520<=_&&_<=4607||55243<=_&&_<=55291?d:_==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?h: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?m:_==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?y:127995<=_&&_<=127999?b:_==8205?C:_==9792||_==9794||9877<=_&&_<=9878||_==9992||_==10084||_==127752||_==127806||_==127859||_==127891||_==127908||_==127912||_==127979||_==127981||_==128139||128187<=_&&_<=128188||_==128295||_==128300||_==128488||_==128640||_==128658?E:128102<=_&&_<=128105?w:g}return this}e.exports&&(e.exports=t)})(TJe);const EJe=PR;function xJe(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function wJe(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const SJe=1.2,QQ="ID_WHITE_PIXEL",OR=new j(4,4),vJe=new Ye(1,1,1,1);function DJe(e){const t=document.createElement("canvas");t.width=OR.x,t.height=OR.y;const n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(QQ,t)}const jc={};function IJe(e,t,n,i,o,r,s){return jc.font=t,jc.fillColor=n,jc.strokeColor=i,jc.strokeWidth=o,jc.padding=uc.PADDING,s===Hi.CENTER?jc.textBaseline="middle":s===Hi.TOP?jc.textBaseline="top":jc.textBaseline="bottom",jc.fill=r===Zl.FILL||r===Zl.FILL_AND_OUTLINE,jc.stroke=r===Zl.OUTLINE||r===Zl.FILL_AND_OUTLINE,jc.backgroundColor=H.BLACK,lJe(e,jc)}function LR(e,t){t.textureInfo=void 0,t.dimensions=void 0;const n=t.billboard;l(n)&&(n.show=!1,n.image=void 0,l(n._removeCallbackFunc)&&(n._removeCallbackFunc(),n._removeCallbackFunc=void 0),e._spareBillboards.push(n),t.billboard=void 0)}function PJe(e,t,n,i){i.index=e.addImageSync(t,n)}const OJe=new EJe;function LJe(e,t){const n=t._renderedText,i=OJe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;let a,c,u;if(t._relativeSize=t._fontSize/uc.FONT_SIZE,o<s)for(c=o;c<s;++c)LR(e,r[c]);r.length=o;const d=t._showBackground&&n.split(`
|
||
`).join("").length>0;let h=t._backgroundBillboard;const m=e._backgroundBillboardCollection;d?(l(h)||(h=m.add({collection:e,image:QQ,imageSubRegion:vJe}),t._backgroundBillboard=h),h.color=t._backgroundColor,h.show=t._show,h.position=t._position,h.eyeOffset=t._eyeOffset,h.pixelOffset=t._pixelOffset,h.horizontalOrigin=La.LEFT,h.verticalOrigin=t._verticalOrigin,h.heightReference=t._heightReference,h.scale=t.totalScale,h.pickPrimitive=t,h.id=t._id,h.translucencyByDistance=t._translucencyByDistance,h.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,h.scaleByDistance=t._scaleByDistance,h.distanceDisplayCondition=t._distanceDisplayCondition,h.disableDepthTestDistance=t._disableDepthTestDistance):l(h)&&(m.remove(h),t._backgroundBillboard=h=void 0);const g=e._glyphTextureCache;for(u=0;u<o;++u){const p=i[u],y=t._verticalOrigin,b=JSON.stringify([p,t._fontFamily,t._fontStyle,t._fontWeight,+y]);let C=g[b];if(!l(C)){const E=`${t._fontStyle} ${t._fontWeight} ${uc.FONT_SIZE}px ${t._fontFamily}`,w=IJe(p,E,H.WHITE,H.WHITE,0,Zl.FILL,y);if(C=new wJe(e,-1,w.dimensions),g[b]=C,w.width>0&&w.height>0){const S=uJe(w,{cutoff:uc.CUTOFF,radius:uc.RADIUS}),P=w.getContext("2d"),L=w.width,z=w.height,R=P.getImageData(0,0,L,z);for(let F=0;F<L;F++)for(let U=0;U<z;U++){const D=U*L+F,I=S[D]*255,_=D*4;R.data[_+0]=I,R.data[_+1]=I,R.data[_+2]=I,R.data[_+3]=I}P.putImageData(R,0,0),p!==" "&&PJe(e._textureAtlas,b,w,C)}}if(a=r[u],l(a)?C.index===-1?LR(e,a):l(a.textureInfo)&&(a.textureInfo=void 0):(a=new xJe,r[u]=a),a.textureInfo=C,a.dimensions=C.dimensions,C.index!==-1){let E=a.billboard;const w=e._spareBillboards;l(E)||(w.length>0?E=w.pop():(E=e._billboardCollection.add({collection:e}),E._labelDimensions=new j,E._labelTranslate=new j),a.billboard=E),E.show=t._show,E.position=t._position,E.eyeOffset=t._eyeOffset,E.pixelOffset=t._pixelOffset,E.horizontalOrigin=La.LEFT,E.verticalOrigin=t._verticalOrigin,E.heightReference=t._heightReference,E.scale=t.totalScale,E.pickPrimitive=t,E.id=t._id,E.image=b,E.translucencyByDistance=t._translucencyByDistance,E.pixelOffsetScaleByDistance=t._pixelOffsetScaleByDistance,E.scaleByDistance=t._scaleByDistance,E.distanceDisplayCondition=t._distanceDisplayCondition,E.disableDepthTestDistance=t._disableDepthTestDistance,E._batchIndex=t._batchIndex,E.outlineColor=t.outlineColor,t.style===Zl.FILL_AND_OUTLINE?(E.color=t._fillColor,E.outlineWidth=t.outlineWidth):t.style===Zl.FILL?(E.color=t._fillColor,E.outlineWidth=0):t.style===Zl.OUTLINE&&(E.color=H.TRANSPARENT,E.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function Y5(e,t,n){return t===La.CENTER?-e/2:t===La.RIGHT?-(e+n.x):n.x}const Ao=new j,BJe=new j;function RJe(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let c=Number.NEGATIVE_INFINITY,u=0,d=1,h;const m=t.length,g=e._backgroundBillboard,p=j.clone(l(g)?e._backgroundPadding:j.ZERO,BJe);for(p.x/=e._relativeSize,p.y/=e._relativeSize,h=0;h<m;++h)n.charAt(h)===`
|
||
`?(a.push(r),++d,r=0):(i=t[h],o=i.dimensions,u=Math.max(u,o.height-o.descent),c=Math.max(c,o.descent),r+=o.width-o.minx,h<m-1&&(r+=t[h+1].dimensions.minx),s=Math.max(s,r));a.push(r);const y=u+c,b=e.totalScale,C=e._horizontalOrigin,E=e._verticalOrigin;let w=0,S=a[w],P=Y5(S,C,p);const L=(l(e._lineHeight)?e._lineHeight:SJe*e._fontSize)/e._relativeSize,z=L*(d-1);let R=s,F=y+z;l(g)&&(R+=p.x*2,F+=p.y*2,g._labelHorizontalOrigin=C),Ao.x=P*b,Ao.y=0;let U=!0,D=0;for(h=0;h<m;++h)if(n.charAt(h)===`
|
||
`)++w,D+=L,S=a[w],P=Y5(S,C,p),Ao.x=P*b,U=!0;else if(i=t[h],o=i.dimensions,E===Hi.TOP?(Ao.y=o.height-u-p.y,Ao.y+=uc.PADDING):E===Hi.CENTER?Ao.y=(z+o.height-u)/2:E===Hi.BASELINE?(Ao.y=z,Ao.y-=uc.PADDING):(Ao.y=z+c+p.y,Ao.y-=uc.PADDING),Ao.y=(Ao.y-o.descent-D)*b,U&&(Ao.x-=uc.PADDING*b,U=!1),l(i.billboard)&&(i.billboard._setTranslate(Ao),i.billboard._labelDimensions.x=R,i.billboard._labelDimensions.y=F,i.billboard._labelHorizontalOrigin=C),h<m-1){const I=t[h+1];Ao.x+=(o.width-o.minx+I.dimensions.minx)*b}if(l(g)&&n.split(`
|
||
`).join("").length>0&&(C===La.CENTER?P=-s/2-p.x:C===La.RIGHT?P=-(s+p.x*2):P=0,Ao.x=P*b,E===Hi.TOP?Ao.y=y-u-c:E===Hi.CENTER?Ao.y=(y-u)/2-c:E===Hi.BASELINE?Ao.y=-p.y-c:Ao.y=0,Ao.y=Ao.y*b,g.width=R,g.height=F,g._setTranslate(Ao),g._labelTranslate=j.clone(Ao,g._labelTranslate)),e.heightReference===St.CLAMP_TO_GROUND)for(h=0;h<m;++h){i=t[h];const I=i.billboard;l(I)&&(I._labelTranslate=j.clone(Ao,I._labelTranslate))}}function ZQ(e,t){const n=t._glyphs;for(let i=0,o=n.length;i<o;++i)LR(e,n[i]);l(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,l(t._removeCallbackFunc)&&t._removeCallbackFunc(),He(t)}function Mc(e){e=A(e,A.EMPTY_OBJECT),this._scene=e.scene,this._batchTable=e.batchTable,this._textureAtlas=void 0,this._backgroundTextureAtlas=void 0,this._backgroundBillboardCollection=new pa({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new pa({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=H.clone(H.WHITE),this.show=A(e.show,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.blendOption=A(e.blendOption,Ko.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(Mc.prototype,{length:{get:function(){return this._labels.length}}});Mc.prototype.add=function(e){const t=new mu(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Mc.prototype.remove=function(e){if(l(e)&&e._labelCollection===this){const t=this._labels.indexOf(e);if(t!==-1)return this._labels.splice(t,1),ZQ(this,e),!0}return!1};Mc.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)ZQ(this,e[t]);e.length=0};Mc.prototype.contains=function(e){return l(e)&&e._labelCollection===this};Mc.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._labels[e]};Mc.prototype.update=function(e){if(!this.show)return;const t=this._billboardCollection,n=this._backgroundBillboardCollection;t.modelMatrix=this.modelMatrix,t.debugShowBoundingVolume=this.debugShowBoundingVolume,n.modelMatrix=this.modelMatrix,n.debugShowBoundingVolume=this.debugShowBoundingVolume;const i=e.context;l(this._textureAtlas)||(this._textureAtlas=new pd({context:i}),t.textureAtlas=this._textureAtlas),l(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new pd({context:i,initialSize:OR}),n.textureAtlas=this._backgroundTextureAtlas,DJe(this._backgroundTextureAtlas));const o=this._labelsToUpdate.length;for(let s=0;s<o;++s){const a=this._labelsToUpdate[s];if(a.isDestroyed())continue;const c=a._glyphs.length;a._rebindAllGlyphs&&(LJe(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(RJe(a),a._repositionAllGlyphs=!1);const u=a._glyphs.length-c;this._totalGlyphCount+=u}const r=n.length>0?Ko.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)};Mc.prototype.isDestroyed=function(){return!1};Mc.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(),He(this)};const Ba={};Ba.numberOfPoints=function(e,t,n){const i=f.distance(e,t);return Math.ceil(i/n)};Ba.numberOfPointsRhumbLine=function(e,t,n){const 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))))};const NJe=new Ce;Ba.extractHeights=function(e,t){const n=e.length,i=new Array(n);for(let o=0;o<n;o++){const r=e[o];i[o]=t.cartesianToCartographic(r,NJe).height}return i};const MJe=new B,FJe=new f,X5=new f,zJe=new Pt(f.UNIT_X,0),K5=new f,UJe=new Pt(f.UNIT_X,0),HJe=new f,VJe=new f,tF=[];function eZ(e,t,n){const i=tF;i.length=e;let o;if(t===n){for(o=0;o<e;o++)i[o]=t;return i}const s=(n-t)/e;for(o=0;o<e;o++){const a=t+o*s;i[o]=a}return i}const YD=new Ce,bv=new Ce,Np=new f,nF=new f,kJe=new f,pO=new qf;let zA=new ps;function GJe(e,t,n,i,o,r,s,a){const c=i.scaleToGeodeticSurface(e,nF),u=i.scaleToGeodeticSurface(t,kJe),d=Ba.numberOfPoints(e,t,n),h=i.cartesianToCartographic(c,YD),m=i.cartesianToCartographic(u,bv),g=eZ(d,o,r);pO.setEndPoints(h,m);const p=pO.surfaceDistance/d;let y=a;h.height=o;let b=i.cartographicToCartesian(h,Np);f.pack(b,s,y),y+=3;for(let C=1;C<d;C++){const E=pO.interpolateUsingSurfaceDistance(C*p,bv);E.height=g[C],b=i.cartographicToCartesian(E,Np),f.pack(b,s,y),y+=3}return y}function WJe(e,t,n,i,o,r,s,a){const c=i.cartesianToCartographic(e,YD),u=i.cartesianToCartographic(t,bv),d=Ba.numberOfPointsRhumbLine(c,u,n);c.height=0,u.height=0;const h=eZ(d,o,r);zA.ellipsoid.equals(i)||(zA=new ps(void 0,void 0,i)),zA.setEndPoints(c,u);const m=zA.surfaceDistance/d;let g=a;c.height=o;let p=i.cartographicToCartesian(c,Np);f.pack(p,s,g),g+=3;for(let y=1;y<d;y++){const b=zA.interpolateUsingSurfaceDistance(y*m,bv);b.height=h[y],p=i.cartographicToCartesian(b,Np),f.pack(p,s,g),g+=3}return g}Ba.wrapLongitude=function(e,t){const n=[],i=[];if(l(e)&&e.length>0){t=A(t,B.IDENTITY);const o=B.inverseTransformation(t,MJe),r=B.multiplyByPoint(o,f.ZERO,FJe),s=f.normalize(B.multiplyByPointAsVector(o,f.UNIT_Y,X5),X5),a=Pt.fromPointNormal(r,s,zJe),c=f.normalize(B.multiplyByPointAsVector(o,f.UNIT_X,K5),K5),u=Pt.fromPointNormal(r,c,UJe);let d=1;n.push(f.clone(e[0]));let h=n[0];const m=e.length;for(let g=1;g<m;++g){const p=e[g];if(Pt.getPointDistance(u,h)<0||Pt.getPointDistance(u,p)<0){const y=pr.lineSegmentPlane(h,p,a,HJe);if(l(y)){const b=f.multiplyByScalar(s,5e-9,VJe);Pt.getPointDistance(a,h)<0&&f.negate(b,b),n.push(f.add(y,b,new f)),i.push(d+1),f.negate(b,b),n.push(f.add(y,b,new f)),d=1}}n.push(f.clone(e[g])),d++,h=p}i.push(d)}return{positions:n,lengths:i}};Ba.generateArc=function(e){l(e)||(e={});const t=e.positions;if(!l(t))throw new x("options.positions is required.");const n=t.length,i=A(e.ellipsoid,me.WGS84);let o=A(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const y=i.scaleToGeodeticSurface(t[0],nF);if(o=r?o[0]:o,o!==0){const b=i.geodeticSurfaceNormal(y,Np);f.multiplyByScalar(b,o,b),f.add(y,b,y)}return[y.x,y.y,y.z]}let s=e.minDistance;if(!l(s)){const y=A(e.granularity,M.RADIANS_PER_DEGREE);s=M.chordLength(y,i.maximumRadius)}let a=0,c;for(c=0;c<n-1;c++)a+=Ba.numberOfPoints(t[c],t[c+1],s);const u=(a+1)*3,d=new Array(u);let h=0;for(c=0;c<n-1;c++){const y=t[c],b=t[c+1],C=r?o[c]:o,E=r?o[c+1]:o;h=GJe(y,b,s,i,C,E,d,h)}tF.length=0;const m=t[n-1],g=i.cartesianToCartographic(m,YD);g.height=r?o[n-1]:o;const p=i.cartographicToCartesian(g,Np);return f.pack(p,d,u-3),d};const J5=new Ce,jJe=new Ce;Ba.generateRhumbArc=function(e){l(e)||(e={});const t=e.positions;if(!l(t))throw new x("options.positions is required.");const n=t.length,i=A(e.ellipsoid,me.WGS84);let o=A(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const C=i.scaleToGeodeticSurface(t[0],nF);if(o=r?o[0]:o,o!==0){const E=i.geodeticSurfaceNormal(C,Np);f.multiplyByScalar(E,o,E),f.add(C,E,C)}return[C.x,C.y,C.z]}const s=A(e.granularity,M.RADIANS_PER_DEGREE);let a=0,c,u=i.cartesianToCartographic(t[0],J5),d;for(c=0;c<n-1;c++)d=i.cartesianToCartographic(t[c+1],jJe),a+=Ba.numberOfPointsRhumbLine(u,d,s),u=Ce.clone(d,J5);const h=(a+1)*3,m=new Array(h);let g=0;for(c=0;c<n-1;c++){const C=t[c],E=t[c+1],w=r?o[c]:o,S=r?o[c+1]:o;g=WJe(C,E,s,i,w,S,m,g)}tF.length=0;const p=t[n-1],y=i.cartesianToCartographic(p,YD);y.height=r?o[n-1]:o;const b=i.cartographicToCartesian(y,Np);return f.pack(b,m,h-3),m};Ba.generateCartesianArc=function(e){const t=Ba.generateArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=f.unpack(t,o*3);return i};Ba.generateCartesianRhumbArc=function(e){const t=Ba.generateRhumbArc(e),n=t.length/3,i=new Array(n);for(let o=0;o<n;o++)i[o]=f.unpack(t,o*3);return i};const yr=Ba;function zr(e,t){e=A(e,A.EMPTY_OBJECT),this._show=A(e.show,!0),this._width=A(e.width,1),this._loop=A(e.loop,!1),this._distanceDisplayCondition=e.distanceDisplayCondition,this._material=e.material,l(this._material)||(this._material=ze.fromType(ze.ColorType,{color:new H(1,1,1,1)}));let n=e.positions;l(n)||(n=[]),this._positions=n,this._actualPositions=da(n,f.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(f.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;l(t)&&(i=B.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=yr.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(nZ),this._polylineCollection=t,this._dirty=!1,this._pickId=void 0,this._boundingVolume=fe.fromPoints(this._actualPositions),this._boundingVolumeWC=fe.transform(this._boundingVolume,this._modelMatrix),this._boundingVolume2D=new fe}const tZ=zr.POSITION_INDEX=0,qJe=zr.SHOW_INDEX=1,$Je=zr.WIDTH_INDEX=2,YJe=zr.MATERIAL_INDEX=3,Xb=zr.POSITION_SIZE_INDEX=4,XJe=zr.DISTANCE_DISPLAY_CONDITION=5,nZ=zr.NUMBER_OF_PROPERTIES=6;function Qd(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;l(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(zr.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new x("value is required.");e!==this._show&&(this._show=e,Qd(this,qJe))}},positions:{get:function(){return this._positions},set:function(e){if(!l(e))throw new x("value is required.");let t=da(e,f.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(f.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Qd(this,Xb),this._positions=e,this._actualPositions=t,this._length=t.length,this._boundingVolume=fe.fromPoints(this._actualPositions,this._boundingVolume),this._boundingVolumeWC=fe.transform(this._boundingVolume,this._modelMatrix,this._boundingVolumeWC),Qd(this,tZ),this.update()}},material:{get:function(){return this._material},set:function(e){if(!l(e))throw new x("material is required.");this._material!==e&&(this._material=e,Qd(this,YJe))}},width:{get:function(){return this._width},set:function(e){if(!l(e))throw new x("value is required.");const t=this._width;e!==t&&(this._width=e,Qd(this,$Je))}},loop:{get:function(){return this._loop},set:function(e){if(!l(e))throw new x("value is required.");if(e!==this._loop){let t=this._actualPositions;e?t.length>2&&!f.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(f.clone(t[0]))):t.length>2&&f.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Qd(this,Xb)}}},id:{get:function(){return this._id},set:function(e){this._id=e,l(this._pickId)&&(this._pickId.object.id=e)}},pickId:{get:function(){return this._pickId}},isDestroyed:{get:function(){return!l(this._polylineCollection)}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");jt.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=jt.clone(e,this._distanceDisplayCondition),Qd(this,XJe))}}});zr.prototype.update=function(){let e=B.IDENTITY;l(this._polylineCollection)&&(e=this._polylineCollection.modelMatrix);const t=this._segments.positions.length,n=this._segments.lengths,i=this._propertiesChanged[tZ]>0||this._propertiesChanged[Xb]>0;if((!B.equals(e,this._modelMatrix)||i)&&(this._segments=yr.wrapLongitude(this._actualPositions,e),this._boundingVolumeWC=fe.transform(this._boundingVolume,e,this._boundingVolumeWC)),this._modelMatrix=B.clone(e,this._modelMatrix),this._segments.positions.length!==t)Qd(this,Xb);else{const o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Qd(this,Xb);break}}};zr.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};zr.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<nZ-1;++t)e[t]=0};zr.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const KJe=zr.SHOW_INDEX,JJe=zr.WIDTH_INDEX,BR=zr.POSITION_INDEX,QJe=zr.MATERIAL_INDEX,Q5=zr.POSITION_SIZE_INDEX,ZJe=zr.DISTANCE_DISPLAY_CONDITION,iZ=zr.NUMBER_OF_PROPERTIES,Ga={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 Qa(e){e=A(e,A.EMPTY_OBJECT),this.show=A(e.show,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=A(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(iZ),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:nt.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=H.clone(H.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(Qa.prototype,{length:{get:function(){return iF(this),this._polylines.length}}});Qa.prototype.add=function(e){const t=new zr(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};Qa.prototype.remove=function(e){if(this.contains(e)){if(this._polylinesRemoved=!0,this._createVertexArray=!0,this._createBatchTable=!0,l(e._bucket)){const t=e._bucket;t.shaderProgram=t.shaderProgram&&t.shaderProgram.destroy()}return e._destroy(),!0}return!1};Qa.prototype.removeAll=function(){oF(this),cZ(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};Qa.prototype.contains=function(e){return l(e)&&e._polylineCollection===this};Qa.prototype.get=function(e){if(!l(e))throw new x("index is required.");return iF(this),this._polylines[e]};function eQe(e,t){l(e._batchTable)&&e._batchTable.destroy();const n=[{functionName:"batchTable_getWidthAndShow",componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:2},{functionName:"batchTable_getPickColor",componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0},{functionName:"batchTable_getCenterHigh",componentDatatype:ee.FLOAT,componentsPerAttribute:3},{functionName:"batchTable_getCenterLowAndRadius",componentDatatype:ee.FLOAT,componentsPerAttribute:4},{functionName:"batchTable_getDistanceDisplayCondition",componentDatatype:ee.FLOAT,componentsPerAttribute:2}];e._batchTable=new Cd(t,n,e._polylines.length)}const oZ=new Rn,rZ=new oe,sZ=new j;Qa.prototype.update=function(e){if(iF(this),this._polylines.length===0||!this.show)return;sQe(this,e);const t=e.context,n=e.mapProjection;let i,o=this._propertiesChanged;if(this._createBatchTable){if(It.maximumVertexTextureImageUnits===0)throw new Ie("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");eQe(this,t),this._createBatchTable=!1}if(this._createVertexArray||nQe(this))tG(this,t,n);else if(this._polylinesUpdated){const c=this._polylinesToUpdate;if(this._mode!==le.SCENE3D){const u=c.length;for(let d=0;d<u;++d)i=c[d],i.update()}if(o[Q5]||o[QJe])tG(this,t,n);else{const u=c.length,d=this._polylineBuckets;for(let h=0;h<u;++h){i=c[h],o=i._propertiesChanged;const m=i._bucket;let g=0;for(const p in d)if(d.hasOwnProperty(p)){if(d[p]===m){o[BR]&&m.writeUpdate(g,i,this._positionBuffer,n);break}g+=d[p].lengthOfPositions}if((o[KJe]||o[JJe])&&this._batchTable.setBatchedAttribute(i._index,0,new j(i._width,i._show)),this._batchTable.attributes.length>2){if(o[BR]||o[Q5]){const p=e.mode===le.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,y=Rn.fromCartesian(p.center,oZ),b=oe.fromElements(y.low.x,y.low.y,y.low.z,p.radius,rZ);this._batchTable.setBatchedAttribute(i._index,2,y.high),this._batchTable.setBatchedAttribute(i._index,3,b)}if(o[ZJe]){const p=sZ;p.x=0,p.y=Number.MAX_VALUE;const y=i.distanceDisplayCondition;l(y)&&(p.x=y.near,p.y=y.far),this._batchTable.setBatchedAttribute(i._index,4,p)}}i._clean()}}c.length=0,this._polylinesUpdated=!1}o=this._propertiesChanged;for(let c=0;c<iZ;++c)o[c]=0;let r=B.IDENTITY;e.mode===le.SCENE3D&&(r=this.modelMatrix);const s=e.passes,a=e.morphTime!==0;if((!l(this._opaqueRS)||this._opaqueRS.depthTest.enabled!==a)&&(this._opaqueRS=et.fromCache({depthMask:a,depthTest:{enabled:a}})),(!l(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=et.fromCache({blending:Gi.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){const c=this._colorCommands;tQe(this,e,c,r)}};const UA=new fe,Z5=new fe;function tQe(e,t,n,i){const o=t.context,r=t.commandList,s=n.length;let a=0,c=!0;const u=e._vertexArrays,d=e.debugShowBoundingVolume,m=e._batchTable.getUniformMapCallback(),g=u.length;for(let p=0;p<g;++p){const y=u[p],b=y.buckets,C=b.length;for(let E=0;E<C;++E){const w=b[E];let S=w.offset;const P=w.bucket.shaderProgram,L=w.bucket.polylines,z=L.length;let R,F,U=0,D,I;for(let _=0;_<z;++_){const v=L[_],O=oQe(v._material);if(O!==R){if(l(R)&&U>0){const G=F.isTranslucent();a>=s?(D=new mt({owner:e}),n.push(D)):D=n[a],++a,I=hn(m(F._uniforms),e._uniformMap),D.boundingVolume=fe.clone(UA,D.boundingVolume),D.modelMatrix=i,D.shaderProgram=P,D.vertexArray=y.va,D.renderState=G?e._translucentRS:e._opaqueRS,D.pass=G?Ne.TRANSLUCENT:Ne.OPAQUE,D.debugShowBoundingVolume=d,D.pickId="v_pickColor",D.uniformMap=I,D.count=U,D.offset=S,S+=U,U=0,c=!0,r.push(D)}F=v._material,F.update(o),R=O}const N=v._locatorBuckets,V=N.length;for(let G=0;G<V;++G){const W=N[G];W.locator===w&&(U+=W.count)}let k;t.mode===le.SCENE3D?k=v._boundingVolumeWC:t.mode===le.COLUMBUS_VIEW?k=v._boundingVolume2D:t.mode===le.SCENE2D?l(v._boundingVolume2D)&&(k=fe.clone(v._boundingVolume2D,Z5),k.center.x=0):l(v._boundingVolumeWC)&&l(v._boundingVolume2D)&&(k=fe.union(v._boundingVolumeWC,v._boundingVolume2D,Z5)),c?(c=!1,fe.clone(k,UA)):fe.union(k,UA,UA)}l(R)&&U>0&&(a>=s?(D=new mt({owner:e}),n.push(D)):D=n[a],++a,I=hn(m(F._uniforms),e._uniformMap),D.boundingVolume=fe.clone(UA,D.boundingVolume),D.modelMatrix=i,D.shaderProgram=P,D.vertexArray=y.va,D.renderState=F.isTranslucent()?e._translucentRS:e._opaqueRS,D.pass=F.isTranslucent()?Ne.TRANSLUCENT:Ne.OPAQUE,D.debugShowBoundingVolume=d,D.pickId="v_pickColor",D.uniformMap=I,D.count=U,D.offset=S,c=!0,r.push(D)),R=void 0}}n.length=a}Qa.prototype.isDestroyed=function(){return!1};Qa.prototype.destroy=function(){return aZ(this),oF(this),cZ(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),He(this)};function nQe(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[BR]?(i.bufferUsage!==nt.STREAM_DRAW&&(t=!0,i.bufferUsage=nt.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==nt.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=nt.STATIC_DRAW):i.frameCount--),t}const eG=[0,0,0];function tG(e,t,n){e._createVertexArray=!1,oF(e),aZ(e),rQe(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let c=0;const u=[[]];let d=0;const h=e._polylineBuckets;let m,g;for(m in h)h.hasOwnProperty(m)&&(g=h[m],g.updateShader(t,r,s),d+=g.lengthOfPositions);if(d>0){const p=e._mode,y=new Float32Array(6*d*3),b=new Float32Array(d*4);let C,E=0,w=0,S=0;for(m in h)if(h.hasOwnProperty(m)){g=h[m],g.write(y,b,E,w,S,r,t,n),p===le.MORPHING&&(l(C)||(C=new Float32Array(6*d*3)),g.writeForMorph(C,E));const I=g.lengthOfPositions;E+=6*I*3,w+=I*4,S+=I*4,c=g.updateIndices(i,a,u,c)}const P=e._positionBufferUsage.bufferUsage,L=nt.STATIC_DRAW;e._positionBuffer=Tt.createVertexBuffer({context:t,typedArray:y,usage:P});let z;l(C)&&(z=Tt.createVertexBuffer({context:t,typedArray:C,usage:P})),e._texCoordExpandAndBatchIndexBuffer=Tt.createVertexBuffer({context:t,typedArray:b,usage:L});const R=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT;let U=0;const D=i.length;for(let I=0;I<D;++I)if(o=i[I],o.length>0){const _=new Uint16Array(o),v=Tt.createIndexBuffer({context:t,typedArray:_,usage:nt.STATIC_DRAW,indexDatatype:at.UNSIGNED_SHORT});U+=a[I];const O=6*(I*(R*M.SIXTY_FOUR_KILOBYTES)-U*R),N=R+O,V=R+N,k=R+V,G=R+k,W=R+G,K=I*(F*M.SIXTY_FOUR_KILOBYTES)-U*F,q=[{index:Ga.position3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:O,strideInBytes:6*R},{index:Ga.position3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:N,strideInBytes:6*R},{index:Ga.position2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:O,strideInBytes:6*R},{index:Ga.position2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:N,strideInBytes:6*R},{index:Ga.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:Ga.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:Ga.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:Ga.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:Ga.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:G,strideInBytes:6*R},{index:Ga.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:W,strideInBytes:6*R},{index:Ga.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:G,strideInBytes:6*R},{index:Ga.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:W,strideInBytes:6*R},{index:Ga.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ee.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:K}];let te,Y,X,$;p===le.SCENE3D?(Y=e._positionBuffer,te="vertexBuffer",X=eG,$="value"):p===le.SCENE2D||p===le.COLUMBUS_VIEW?(Y=eG,te="value",X=e._positionBuffer,$="vertexBuffer"):(Y=z,te="vertexBuffer",X=e._positionBuffer,$="vertexBuffer"),q[0][te]=Y,q[1][te]=Y,q[2][$]=X,q[3][$]=X,q[4][te]=Y,q[5][te]=Y,q[6][$]=X,q[7][$]=X,q[8][te]=Y,q[9][te]=Y,q[10][$]=X,q[11][$]=X;const se=new ho({context:t,attributes:q,indexBuffer:v});e._vertexArrays.push({va:se,buckets:u[I]})}}}function iQe(e,t){return t instanceof Wt?t.id:t}const $x=[];function oQe(e){const t=ze._uniformList[e.type],n=t.length;$x.length=2*n;let i=0;for(let o=0;o<n;++o){const r=t[o];$x[i]=r,$x[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify($x,iQe)}`}function rQe(e){const t=e._mode,n=e._modelMatrix,i=e._polylineBuckets={},o=e._polylines,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a._actualPositions.length>1){a.update();const c=a.material;let u=i[c.type];l(u)||(u=i[c.type]=new Bd(c,t,n)),u.addPolyline(a)}}}function sQe(e,t){const n=t.mode;(e._mode!==n||!B.equals(e._modelMatrix,e.modelMatrix))&&(e._mode=n,e._modelMatrix=B.clone(e.modelMatrix),e._createVertexArray=!0)}function iF(e){if(e._polylinesRemoved){e._polylinesRemoved=!1;const t=[],n=[];let i=0,o;const 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 oF(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)if(!t[i].isDestroyed){const o=t[i]._bucket;l(o)&&(o.shaderProgram=o.shaderProgram&&o.shaderProgram.destroy())}}function aZ(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}Qa.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function cZ(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function mO(e,t,n){this.count=e,this.offset=t,this.bucket=n}function Bd(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}Bd.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};Bd.prototype.updateShader=function(e,t,n){if(l(this.shaderProgram))return;const i=["DISTANCE_DISPLAY_CONDITION"];n&&i.push("VECTOR_TILE"),this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g)!==-1&&i.push("POLYLINE_DASH"),gn.isInternetExplorer()||i.push("CLIP_POLYLINE");const o=new We({defines:i,sources:[`varying vec4 v_pickColor;
|
||
`,this.material.shaderSource,Oq]}),r=t.getVertexShaderCallback()(vEe),s=new We({defines:i,sources:[hT,r]});this.shaderProgram=Cn.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:Ga})};function lZ(e){return f.dot(f.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(Pt.ORIGIN_ZX_PLANE)===xn.INTERSECTING}Bd.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===le.SCENE3D||!lZ(e))return t=e._actualPositions.length,t*4-4;let n=0;const i=e._segments.lengths;t=i.length;for(let o=0;o<t;++o)n+=i[o]*4-4;return n};const Sr=new f,Zc=new f,el=new f,Cv=new f,aQe=new oe,cQe=new j;Bd.prototype.write=function(e,t,n,i,o,r,s,a){const c=this.mode,u=a.ellipsoid.maximumRadius*M.PI,d=this.polylines,h=d.length;for(let m=0;m<h;++m){const g=d[m],p=g.width,y=g.show&&p>0,b=g._index,C=this.getSegments(g,a),E=C.positions,w=C.lengths,S=E.length,P=g.getPickId(s).color;let L=0,z=0,R;for(let V=0;V<S;++V){V===0?g._loop?R=E[S-2]:(R=Cv,f.subtract(E[0],E[1],R),f.add(E[0],R,R)):R=E[V-1],f.clone(R,Zc),f.clone(E[V],Sr),V===S-1?g._loop?R=E[1]:(R=Cv,f.subtract(E[S-1],E[S-2],R),f.add(E[S-1],R,R)):R=E[V+1],f.clone(R,el);const k=w[L];V===z+k&&(z+=k,++L);const G=V-z===0,W=V===z+w[L]-1;c===le.SCENE2D&&(Zc.z=0,Sr.z=0,el.z=0),(c===le.SCENE2D||c===le.MORPHING)&&(G||W)&&u-Math.abs(Sr.x)<1&&((Sr.x<0&&Zc.x>0||Sr.x>0&&Zc.x<0)&&f.clone(Sr,Zc),(Sr.x<0&&el.x>0||Sr.x>0&&el.x<0)&&f.clone(Sr,el));const K=G?2:0,q=W?2:4;for(let te=K;te<q;++te){Rn.writeElements(Sr,e,n),Rn.writeElements(Zc,e,n+6),Rn.writeElements(el,e,n+12);const Y=te-2<0?-1:1;t[o]=V/(S-1),t[o+1]=2*(te%2)-1,t[o+2]=Y,t[o+3]=b,n+=6*3,o+=4}}const F=aQe;F.x=H.floatToByte(P.red),F.y=H.floatToByte(P.green),F.z=H.floatToByte(P.blue),F.w=H.floatToByte(P.alpha);const U=cQe;U.x=p,U.y=y?1:0;const D=c===le.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,I=Rn.fromCartesian(D.center,oZ),_=I.high,v=oe.fromElements(I.low.x,I.low.y,I.low.z,D.radius,rZ),O=sZ;O.x=0,O.y=Number.MAX_VALUE;const N=g.distanceDisplayCondition;l(N)&&(O.x=N.near,O.y=N.far),r.setBatchedAttribute(b,0,U),r.setBatchedAttribute(b,1,F),r.attributes.length>2&&(r.setBatchedAttribute(b,2,_),r.setBatchedAttribute(b,3,v),r.setBatchedAttribute(b,4,O))}};const lQe=new f,uQe=new f,dQe=new f,nG=new f;Bd.prototype.writeForMorph=function(e,t){const n=this.modelMatrix,i=this.polylines,o=i.length;for(let r=0;r<o;++r){const s=i[r],a=s._segments.positions,c=s._segments.lengths,u=a.length;let d=0,h=0;for(let m=0;m<u;++m){let g;m===0?s._loop?g=a[u-2]:(g=nG,f.subtract(a[0],a[1],g),f.add(a[0],g,g)):g=a[m-1],g=B.multiplyByPoint(n,g,uQe);const p=B.multiplyByPoint(n,a[m],lQe);let y;m===u-1?s._loop?y=a[1]:(y=nG,f.subtract(a[u-1],a[u-2],y),f.add(a[u-1],y,y)):y=a[m+1],y=B.multiplyByPoint(n,y,dQe);const b=c[d];m===h+b&&(h+=b,++d);const C=m-h===0,E=m===h+c[d]-1,w=C?2:0,S=E?2:4;for(let P=w;P<S;++P)Rn.writeElements(p,e,t),Rn.writeElements(g,e,t+6),Rn.writeElements(y,e,t+12),t+=6*3}}};const fQe=new Array(1);Bd.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new mO(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);const u=this.polylines,d=u.length;for(let h=0;h<d;++h){const m=u[h];m._locatorBuckets=[];let g;if(this.mode===le.SCENE3D){g=fQe;const y=m._actualPositions.length;if(y>0)g[0]=y;else continue}else g=m._segments.lengths;const p=g.length;if(p>0){let y=0;for(let b=0;b<p;++b){const C=g[b]-1;for(let E=0;E<C;++E)c+4>M.SIXTY_FOUR_KILOBYTES&&(m._locatorBuckets.push({locator:r,count:y}),y=0,t.push(4),a=[],e.push(a),c=0,r.count=s,s=0,i=0,r=new mO(0,0,this),n[++o]=[r]),a.push(c,c+2,c+1),a.push(c+1,c+2,c+3),y+=6,s+=6,i+=6,c+=4}m._locatorBuckets.push({locator:r,count:y}),c+4>M.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new mO(0,0,this),n[++o]=[r])}m._clean()}return r.count=s,i};Bd.prototype.getPolylineStartIndex=function(e){const t=this.polylines;let n=0;const i=t.length;for(let o=0;o<i;++o){const r=t[o];if(r===e)break;n+=r._actualLength}return n};const Gg={positions:void 0,lengths:void 0},iG=new Array(1),hQe=new f,pQe=new Ce;Bd.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===le.SCENE3D)return iG[0]=n.length,Gg.positions=n,Gg.lengths=iG,Gg;lZ(e)&&(n=e._segments.positions);const i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length;let a,c=hQe;for(let u=0;u<s;++u)a=n[u],c=B.multiplyByPoint(r,a,c),o.push(t.project(i.cartesianToCartographic(c,pQe)));if(o.length>0){e._boundingVolume2D=fe.fromPoints(o,e._boundingVolume2D);const u=e._boundingVolume2D.center;e._boundingVolume2D.center=new f(u.z,u.x,u.y)}return Gg.positions=o,Gg.lengths=e._segments.lengths,Gg};let oG;Bd.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*M.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=oG;const c=6*s*3;!l(a)||a.length<c?a=oG=new Float32Array(c):a.length>c&&(a=new Float32Array(a.buffer,0,c));const u=this.getSegments(t,i),d=u.positions,h=u.lengths;let m=0,g=0,p=0,y;s=d.length;for(let b=0;b<s;++b){b===0?t._loop?y=d[s-2]:(y=Cv,f.subtract(d[0],d[1],y),f.add(d[0],y,y)):y=d[b-1],f.clone(y,Zc),f.clone(d[b],Sr),b===s-1?t._loop?y=d[1]:(y=Cv,f.subtract(d[s-1],d[s-2],y),f.add(d[s-1],y,y)):y=d[b+1],f.clone(y,el);const C=h[g];b===p+C&&(p+=C,++g);const E=b-p===0,w=b===p+h[g]-1;o===le.SCENE2D&&(Zc.z=0,Sr.z=0,el.z=0),(o===le.SCENE2D||o===le.MORPHING)&&(E||w)&&r-Math.abs(Sr.x)<1&&((Sr.x<0&&Zc.x>0||Sr.x>0&&Zc.x<0)&&f.clone(Sr,Zc),(Sr.x<0&&el.x>0||Sr.x>0&&el.x<0)&&f.clone(Sr,el));const S=E?2:0,P=w?2:4;for(let L=S;L<P;++L)Rn.writeElements(Sr,a,m),Rn.writeElements(Zc,a,m+6),Rn.writeElements(el,a,m+12),m+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};function sm(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 pa({batchTable:e.batchTable}),this._labelCollection=new Mc({batchTable:e.batchTable}),this._polylineCollection=new Qa,this._polylineCollection._useHighlightColor=!0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=SQe(this)}Object.defineProperties(sm.prototype,{pointsLength:{get:function(){return this._billboardCollection.length}},texturesByteLength:{get:function(){const e=this._billboardCollection.textureAtlas.texture.sizeInBytes,t=this._labelCollection._textureAtlas.texture.sizeInBytes;return e+t}},readyPromise:{get:function(){return this._readyPromise}}});function mQe(e,t){const n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+ge.packedLength+me.packedLength,s=new Float64Array(r);let a=0;return s[a++]=i,s[a++]=o,ge.pack(n,s,a),a+=ge.packedLength,me.pack(t,s,a),s}const _Qe=new Vi("createVectorTilePoints",5),gQe=new f;function yQe(e,t){let n;if(!l(e._verticesPromise)){n=e._positions;let i=e._packedBuffer;l(i)||(n=e._positions=n.slice(),e._batchIds=e._batchIds.slice(),i=e._packedBuffer=mQe(e,t));const o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=e._verticesPromise=_Qe.scheduleTask(r,o);return l(s)?s.then(function(a){e._positions=new Float64Array(a.positions);const c=e._billboardCollection,u=e._labelCollection,d=e._polylineCollection;n=e._positions;const h=e._batchIds,m=n.length/3;for(let g=0;g<m;++g){const p=h[g],y=f.unpack(n,g*3,gQe),b=c.add();b.position=y,b._batchIndex=p;const C=u.add();C.text=" ",C.position=y,C._batchIndex=p;const E=d.add();E.positions=[f.clone(y),f.clone(y)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}):void 0}}sm.prototype.createFeatures=function(e,t){const n=this._billboardCollection,i=this._labelCollection,o=this._polylineCollection,r=this._batchIds,s=r.length;for(let a=0;a<s;++a){const c=r[a],u=n.get(a),d=i.get(a),h=o.get(a);t[c]=new ur(e,c,u,d,h)}};sm.prototype.applyDebugSettings=function(e,t){e?(H.clone(t,this._billboardCollection._highlightColor),H.clone(t,this._labelCollection._highlightColor),H.clone(t,this._polylineCollection._highlightColor)):(H.clone(H.WHITE,this._billboardCollection._highlightColor),H.clone(H.WHITE,this._labelCollection._highlightColor),H.clone(H.WHITE,this._polylineCollection._highlightColor))};function AQe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.pointSize=ur.defaultPointSize,s.color=ur.defaultColor,s.pointOutlineColor=ur.defaultPointOutlineColor,s.pointOutlineWidth=ur.defaultPointOutlineWidth,s.labelColor=H.WHITE,s.labelOutlineColor=H.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=Zl.FILL,s.labelText=void 0,s.backgroundColor=new H(.165,.165,.165,.8),s.backgroundPadding=new j(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=H.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=La.CENTER,s.verticalOrigin=Hi.CENTER,s.labelHorizontalOrigin=La.RIGHT,s.labelVerticalOrigin=Hi.BASELINE}}const bQe=new H,CQe=new H,TQe=new H,EQe=new H,xQe=new H,wQe=new H,HA=new kt,VA=new kt,_O=new jt;sm.prototype.applyStyle=function(e,t){if(!l(e)){AQe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];if(l(e.show)&&(s.show=e.show.evaluate(s)),l(e.pointSize)&&(s.pointSize=e.pointSize.evaluate(s)),l(e.color)&&(s.color=e.color.evaluateColor(s,bQe)),l(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,CQe)),l(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),l(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,TQe)),l(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,EQe)),l(e.labelOutlineWidth)&&(s.labelOutlineWidth=e.labelOutlineWidth.evaluate(s)),l(e.font)&&(s.font=e.font.evaluate(s)),l(e.labelStyle)&&(s.labelStyle=e.labelStyle.evaluate(s)),l(e.labelText)?s.labelText=e.labelText.evaluate(s):s.labelText=void 0,l(e.backgroundColor)&&(s.backgroundColor=e.backgroundColor.evaluateColor(s,xQe)),l(e.backgroundPadding)&&(s.backgroundPadding=e.backgroundPadding.evaluate(s)),l(e.backgroundEnabled)&&(s.backgroundEnabled=e.backgroundEnabled.evaluate(s)),l(e.scaleByDistance)){const a=e.scaleByDistance.evaluate(s);HA.near=a.x,HA.nearValue=a.y,HA.far=a.z,HA.farValue=a.w,s.scaleByDistance=HA}else s.scaleByDistance=void 0;if(l(e.translucencyByDistance)){const a=e.translucencyByDistance.evaluate(s);VA.near=a.x,VA.nearValue=a.y,VA.far=a.z,VA.farValue=a.w,s.translucencyByDistance=VA}else s.translucencyByDistance=void 0;if(l(e.distanceDisplayCondition)){const a=e.distanceDisplayCondition.evaluate(s);_O.near=a.x,_O.far=a.y,s.distanceDisplayCondition=_O}else s.distanceDisplayCondition=void 0;l(e.heightOffset)&&(s.heightOffset=e.heightOffset.evaluate(s)),l(e.anchorLineEnabled)&&(s.anchorLineEnabled=e.anchorLineEnabled.evaluate(s)),l(e.anchorLineColor)&&(s.anchorLineColor=e.anchorLineColor.evaluateColor(s,wQe)),l(e.image)?s.image=e.image.evaluate(s):s.image=void 0,l(e.disableDepthTestDistance)&&(s.disableDepthTestDistance=e.disableDepthTestDistance.evaluate(s)),l(e.horizontalOrigin)&&(s.horizontalOrigin=e.horizontalOrigin.evaluate(s)),l(e.verticalOrigin)&&(s.verticalOrigin=e.verticalOrigin.evaluate(s)),l(e.labelHorizontalOrigin)&&(s.labelHorizontalOrigin=e.labelHorizontalOrigin.evaluate(s)),l(e.labelVerticalOrigin)&&(s.labelVerticalOrigin=e.labelVerticalOrigin.evaluate(s))}};function SQe(e){return new Promise(function(t,n){e._update=function(i,o){const r=yQe(i,o.mapProjection.ellipsoid);i._ready&&(i._polylineCollection.update(o),i._billboardCollection.update(o),i._labelCollection.update(o)),l(r)&&r.then(function(){t()}).catch(function(s){n(s)})}})}sm.prototype.update=function(e){this._update(this,e)};sm.prototype.isDestroyed=function(){return!1};sm.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(),He(this)};function th(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=A(e.ellipsoid,me.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=A(e.center,f.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=BQe(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=vo.BOTH}Object.defineProperties(th.prototype,{trianglesLength:{get:function(){return l(this._primitive)?this._primitive.trianglesLength:0}},geometryByteLength:{get:function(){return l(this._primitive)?this._primitive.geometryByteLength:0}},readyPromise:{get:function(){return this._readyPromise}}});function vQe(e){const t=new Float64Array(3+f.packedLength+me.packedLength+ge.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,f.pack(e._center,t,n),n+=f.packedLength,me.pack(e._ellipsoid,t,n),n+=me.packedLength,ge.pack(e._rectangle,t,n),t}function DQe(e,t){let n=1;const i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=zt.unpack(t,n),n+=zt.packedLength;const r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){const c=H.unpack(t,n);n+=H.packedLength;const u=t[n++],d=t[n++],h=t[n++],m=new Array(h);for(let g=0;g<h;++g)m[g]=t[n++];s[a]=new sv({color:c,offset:u,count:d,batchIds:m})}}const IQe=new Vi("createVectorTilePolygons",5),PQe=new H;function OQe(e){if(!l(e._primitive)&&!l(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(!l(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(ge.center(e._rectangle)),r=e._transferrableBatchIds=new Uint32Array(e._batchIds),s=e._batchTableColors=new Uint32Array(r.length);const g=e._batchTable,p=s.length;for(let y=0;y<p;++y){const b=g.getColor(y,PQe);s[y]=b.toRgba()}a=e._packedBuffer=vQe(e)}const c=[t.buffer,n.buffer,i.buffer,o.buffer,r.buffer,s.buffer,a.buffer],u={packedBuffer:a.buffer,positions:t.buffer,counts:n.buffer,indexCounts:i.buffer,indices:o.buffer,batchIds:r.buffer,batchTableColors:s.buffer};let d=e._polygonMinimumHeights,h=e._polygonMaximumHeights;l(d)&&l(h)&&(d=d.slice(),h=h.slice(),c.push(d.buffer,h.buffer),u.minimumHeights=d,u.maximumHeights=h);const m=e._verticesPromise=IQe.scheduleTask(u,c);return l(m)?m.then(function(g){e._positions=void 0,e._counts=void 0,e._polygonMinimumHeights=void 0,e._polygonMaximumHeights=void 0;const p=new Float64Array(g.packedBuffer),y=p[0];DQe(e,p),e._indices=at.getSizeInBytes(y)===2?new Uint16Array(g.indices):new Uint32Array(g.indices),e._indexOffsets=new Uint32Array(g.indexOffsets),e._indexCounts=new Uint32Array(g.indexCounts),e._batchedPositions=new Float32Array(g.positions),e._vertexBatchIds=new Uint16Array(g.batchIds),e._ready=!0}):void 0}}function LQe(e){e._ready&&!l(e._primitive)&&(e._primitive=new Dd({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)}th.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};th.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};th.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};th.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function BQe(e){return new Promise(function(t,n){e._update=function(i,o){const r=OQe(i);i._ready&&(i._primitive.debugWireframe=i.debugWireframe,i._primitive.forceRebatch=i.forceRebatch,i._primitive.classificationType=i.classificationType,i._primitive.update(o)),l(r)&&r.then(function(){LQe(i),t(i)}).catch(function(s){n(s)})}})}th.prototype.update=function(e){this._update(this,e)};th.prototype.isDestroyed=function(){return!1};th.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),He(this)};function Al(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,me.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=H.clone(H.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=$Qe(this),this._verticesPromise=void 0}Object.defineProperties(Al.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function RQe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ge.packedLength+me.packedLength+f.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,ge.pack(t,a,c),c+=ge.packedLength,me.pack(o,a,c),c+=me.packedLength,f.pack(r,a,c),a}const NQe=new Vi("createVectorTilePolylines",5),hy={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function MQe(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(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=RQe(e));const 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},u=e._verticesPromise=NQe.scheduleTask(c,a);return l(u)?u.then(function(d){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(d.decodedPositions),e._decodedPositionOffsets=new Uint32Array(d.decodedPositionOffsets)),e._currentPositions=new Float32Array(d.currentPositions),e._previousPositions=new Float32Array(d.previousPositions),e._nextPositions=new Float32Array(d.nextPositions),e._expandAndWidth=new Float32Array(d.expandAndWidth),e._vertexBatchIds=new Uint16Array(d.batchIds);const h=d.indexDatatype;e._indices=h===at.UNSIGNED_SHORT?new Uint16Array(d.indices):new Uint32Array(d.indices),e._ready=!0}):void 0}}function FQe(e,t){if(e._ready&&!l(e._va)){const n=e._currentPositions,i=e._previousPositions,o=e._nextPositions,r=e._expandAndWidth,s=e._vertexBatchIds,a=e._indices;let c=i.byteLength+n.byteLength+o.byteLength;c+=r.byteLength+s.byteLength+a.byteLength,e._trianglesLength=a.length/3,e._geometryByteLength=c;const u=Tt.createVertexBuffer({context:t,typedArray:i,usage:nt.STATIC_DRAW}),d=Tt.createVertexBuffer({context:t,typedArray:n,usage:nt.STATIC_DRAW}),h=Tt.createVertexBuffer({context:t,typedArray:o,usage:nt.STATIC_DRAW}),m=Tt.createVertexBuffer({context:t,typedArray:r,usage:nt.STATIC_DRAW}),g=Tt.createVertexBuffer({context:t,typedArray:s,usage:nt.STATIC_DRAW}),p=Tt.createIndexBuffer({context:t,typedArray:a,usage:nt.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?at.UNSIGNED_SHORT:at.UNSIGNED_INT}),y=[{index:hy.previousPosition,vertexBuffer:u,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:hy.currentPosition,vertexBuffer:d,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:hy.nextPosition,vertexBuffer:h,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:hy.expandAndWidth,vertexBuffer:m,componentDatatype:ee.FLOAT,componentsPerAttribute:2},{index:hy.a_batchId,vertexBuffer:g,componentDatatype:ee.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new ho({context:t,attributes:y,indexBuffer:p}),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}}const kA=new B,rG=new f;function zQe(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return B.clone(n,kA),B.multiplyByPoint(kA,e._center,rG),B.setTranslation(kA,rG,kA),kA},u_highlightColor:function(){return e._highlightColor}})}function UQe(e){if(l(e._rs))return;const t={enabled:!0,factor:-5,units:-5};e._rs=et.fromCache({blending:Gi.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}const HQe=`uniform vec4 u_highlightColor;
|
||
void main()
|
||
{
|
||
gl_FragColor = u_highlightColor;
|
||
}
|
||
`;function VQe(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(HEe),o=n.getFragmentShaderCallback(!1,void 0,!1)(HQe),r=new We({defines:["VECTOR_TILE",gn.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[hT,i]}),s=new We({defines:["VECTOR_TILE"],sources:[o]});e._sp=Cn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:hy})}function kQe(e,t){if(!l(e._command)){const n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new mt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:Ne.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}Al.getPolylinePositions=function(e,t){const n=e._batchIds,i=e._decodedPositions,o=e._decodedPositionOffsets;if(!l(n)||!l(i))return;let r,s;const a=n.length;let c=0,u=0;for(r=0;r<a;++r)n[r]===t&&(c+=o[r+1]-o[r]);if(c===0)return;const d=new Float64Array(c*3);for(r=0;r<a;++r)if(n[r]===t){const h=o[r],m=o[r+1]-h;for(s=0;s<m;++s){const g=(h+s)*3;d[u++]=i[g],d[u++]=i[g+1],d[u++]=i[g+2]}}return d};Al.prototype.getPositions=function(e){return Al.getPolylinePositions(this,e)};Al.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new As(e,r)}};Al.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function GQe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=H.WHITE}}const WQe=new H,jQe=H.WHITE,qQe=!0;Al.prototype.applyStyle=function(e,t){if(!l(e)){GQe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=l(e.color)?e.color.evaluateColor(s,WQe):jQe,s.show=l(e.show)?e.show.evaluate(s):qQe}};function $Qe(e){return new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=MQe(i);if(zQe(i,r),VQe(i,r),UQe(i),i._ready){const a=o.passes;(a.render||a.pick)&&kQe(i,o)}l(s)&&s.then(function(){FQe(i,r),t()}).catch(function(a){n(a)})}})}Al.prototype.update=function(e){this._update(this,e)};Al.prototype.isDestroyed=function(){return!1};Al.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),He(this)};function nh(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,me.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 j(lo._defaultMinTerrainHeight,lo._defaultMaxTerrainHeight),this._boundingVolume=zt.fromRectangle(e.rectangle,lo._defaultMinTerrainHeight,lo._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=H.clone(H.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=aZe(this),this._verticesPromise=void 0}Object.defineProperties(nh.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function YQe(e,t,n){const i=lo.getMinimumMaximumHeights(t,n),o=i.minimumTerrainHeight,r=i.maximumTerrainHeight,s=e._minimumMaximumVectorHeights;s.x=o,s.y=r;const a=e._boundingVolume,c=e._rectangle;zt.fromRectangle(c,o,r,n,a)}function XQe(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+ge.packedLength+me.packedLength+f.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,ge.pack(t,a,c),c+=ge.packedLength,me.pack(o,a,c),c+=me.packedLength,f.pack(r,a,c),a}const KQe=new Vi("createVectorTileClampedPolylines"),kh={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function JQe(e,t){if(!l(e._va)&&!l(e._verticesPromise)){let n=e._positions,i=e._widths,o=e._counts,r=e._transferrableBatchIds,s=e._packedBuffer;l(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=XQe(e));const 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},u=e._verticesPromise=KQe.scheduleTask(c,a);return l(u)?u.then(function(d){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(d.decodedPositions),e._decodedPositionOffsets=new Uint32Array(d.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(d.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(d.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(d.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(d.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(d.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(d.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(d.vertexBatchIds);const h=d.indexDatatype;e._indices=h===at.UNSIGNED_SHORT?new Uint16Array(d.indices):new Uint32Array(d.indices),e._ready=!0}):void 0}}function QQe(e,t){if(e._ready&&!l(e._va)){const n=e._startEllipsoidNormals,i=e._endEllipsoidNormals,o=e._startPositionAndHeights,r=e._endPositionAndHeights,s=e._startFaceNormalAndVertexCornerIds,a=e._endFaceNormalAndHalfWidths,c=e._vertexBatchIds,u=e._indices;let d=n.byteLength+i.byteLength;d+=o.byteLength+r.byteLength,d+=s.byteLength+a.byteLength,d+=c.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=d;const h=Tt.createVertexBuffer({context:t,typedArray:n,usage:nt.STATIC_DRAW}),m=Tt.createVertexBuffer({context:t,typedArray:i,usage:nt.STATIC_DRAW}),g=Tt.createVertexBuffer({context:t,typedArray:o,usage:nt.STATIC_DRAW}),p=Tt.createVertexBuffer({context:t,typedArray:r,usage:nt.STATIC_DRAW}),y=Tt.createVertexBuffer({context:t,typedArray:s,usage:nt.STATIC_DRAW}),b=Tt.createVertexBuffer({context:t,typedArray:a,usage:nt.STATIC_DRAW}),C=Tt.createVertexBuffer({context:t,typedArray:c,usage:nt.STATIC_DRAW}),E=Tt.createIndexBuffer({context:t,typedArray:u,usage:nt.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?at.UNSIGNED_SHORT:at.UNSIGNED_INT}),w=[{index:kh.startEllipsoidNormal,vertexBuffer:h,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:kh.endEllipsoidNormal,vertexBuffer:m,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:kh.startPositionAndHeight,vertexBuffer:g,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:kh.endPositionAndHeight,vertexBuffer:p,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:kh.startFaceNormalAndVertexCorner,vertexBuffer:y,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:kh.endFaceNormalAndHalfWidth,vertexBuffer:b,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:kh.a_batchId,vertexBuffer:C,componentDatatype:ee.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new ho({context:t,attributes:w,indexBuffer:E}),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}}const GA=new B,sG=new f;function ZQe(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return B.clone(n,GA),B.multiplyByPoint(GA,e._center,sG),B.setTranslation(GA,sG,GA),GA},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function aG(e){return et.fromCache({cull:{enabled:!0,face:Ho.FRONT},blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:gi.EQUAL,frontOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},backFunction:gi.EQUAL,backOperation:{fail:_t.KEEP,zFail:_t.KEEP,zPass:_t.KEEP},reference:Rt.CESIUM_3D_TILE_MASK,mask:Rt.CESIUM_3D_TILE_MASK}})}function eZe(e){l(e._rs)||(e._rs=aG(!1),e._rs3DTiles=aG(!0))}function tZe(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(UEe),o=n.getFragmentShaderCallback(!1,void 0,!0)(zEe),r=new We({defines:["VECTOR_TILE",gn.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[hT,i]}),s=new We({defines:["VECTOR_TILE"],sources:[o]});e._sp=Cn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:kh})}function nZe(e,t){let n=e._command;if(!l(e._command)){const o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new mt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:Ne.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const r=mt.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=Ne.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}const i=e._classificationType;(i===vo.TERRAIN||i===vo.BOTH)&&t.commandList.push(n),(i===vo.CESIUM_3D_TILE||i===vo.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}nh.prototype.getPositions=function(e){return Al.getPolylinePositions(this,e)};nh.prototype.createFeatures=function(e,t){const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o];t[r]=new As(e,r)}};nh.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function iZe(e,t){const n=e._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.show=!0,s.color=H.WHITE}}const oZe=new H,rZe=H.WHITE,sZe=!0;nh.prototype.applyStyle=function(e,t){if(!l(e)){iZe(this,t);return}const n=this._batchIds,i=n.length;for(let o=0;o<i;++o){const r=n[o],s=t[r];s.color=l(e.color)?e.color.evaluateColor(s,oZe):rZe,s.show=l(e.show)?e.show.evaluate(s):sZe}};function aZe(e){return lo.initialize().then(function(){return YQe(e,e._rectangle,e._ellipsoid),new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=JQe(i);if(ZQe(i,r),tZe(i,r),eZe(i),i._ready){const a=o.passes;(a.render||a.pick)&&nZe(i,o)}l(s)&&s.then(function(){QQe(i,r),t(i)}).catch(function(a){n(a)})}})})}nh.prototype.update=function(e){this._update(this,e)};nh.prototype.isDestroyed=function(){return!1};nh.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),He(this)};const gO=32767,cZe=new Ce,lZe=new f;function uZe(e,t,n,i,o){const r=e.length/3,s=e.subarray(0,r),a=e.subarray(r,2*r),c=e.subarray(2*r,3*r);mi.zigZagDeltaDecode(s,a,c);const u=new Float64Array(e.length);for(let d=0;d<r;++d){const h=s[d],m=a[d],g=c[d],p=M.lerp(t.west,t.east,h/gO),y=M.lerp(t.south,t.north,m/gO),b=M.lerp(n,i,g/gO),C=Ce.fromRadians(p,y,b,cZe),E=o.cartographicToCartesian(C,lZe);f.pack(E,u,d*3)}return u}function Rd(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,mZe(this,i,o)}Object.defineProperties(Rd.prototype,{featuresLength:{get:function(){return l(this._batchTable)?this._batchTable.featuresLength:0}},pointsLength:{get:function(){return l(this._points)?this._points.pointsLength:0}},trianglesLength:{get:function(){let e=0;return l(this._polygons)&&(e+=this._polygons.trianglesLength),l(this._polylines)&&(e+=this._polylines.trianglesLength),e}},geometryByteLength:{get:function(){let e=0;return l(this._polygons)&&(e+=this._polygons.geometryByteLength),l(this._polylines)&&(e+=this._polylines.geometryByteLength),e}},texturesByteLength:{get:function(){return l(this._points)?this._points.texturesByteLength:0}},batchTableByteLength:{get:function(){return l(this._batchTable)?this._batchTable.batchTableByteLength:0}},innerContents:{get:function(){}},readyPromise:{get:function(){const e=l(this._points)?this._points.readyPromise:void 0,t=l(this._polygons)?this._polygons.readyPromise:void 0,n=l(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 dZe(e){return function(t,n){l(e._polygons)&&e._polygons.updateCommands(t,n)}}function fZe(e,t){let n,i,o,r;const s=A(e.POLYGONS_LENGTH,0),a=A(e.POLYLINES_LENGTH,0),c=A(e.POINTS_LENGTH,0);if(s>0&&l(e.POLYGON_BATCH_IDS)){const m=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,m,s)}if(a>0&&l(e.POLYLINE_BATCH_IDS)){const m=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,m,a)}if(c>0&&l(e.POINT_BATCH_IDS)){const m=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,m,c)}const u=l(n)||l(i)||l(o),d=s>0&&!l(n)||a>0&&!l(i)||c>0&&!l(o);if(u&&d)throw new Ie("If one group of batch ids is defined, then all batch ids must be defined.");if(!l(n)&&!l(i)&&!l(o)){let m=0;if(!l(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=m++;if(!l(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=m++;if(!l(o)&&c>0)for(o=new Uint16Array(c),r=0;r<c;++r)o[r]=m++}return{polygons:n,polylines:i,points:o}}const Ml=Uint32Array.BYTES_PER_ELEMENT;function hZe(e){return new Al(e)}function pZe(e){return new nh(e)}function mZe(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Ml;const r=o.getUint32(n,!0);if(r!==1)throw new Ie(`Only Vector tile version 1 is supported. Version ${r} is not.`);n+=Ml;const s=o.getUint32(n,!0);if(n+=Ml,s===0)return Promise.resolve(e);const a=o.getUint32(n,!0);if(n+=Ml,a===0)throw new Ie("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=Ml;const u=o.getUint32(n,!0);n+=Ml;const d=o.getUint32(n,!0);n+=Ml;const h=o.getUint32(n,!0);n+=Ml;const m=o.getUint32(n,!0);n+=Ml;const g=o.getUint32(n,!0);n+=Ml;const p=o.getUint32(n,!0);n+=Ml;const y=Ya(i,n,a);n+=a;const b=new Uint8Array(t,n,c);n+=c;let C,E;u>0&&(C=Ya(i,n,u),n+=u,d>0&&(E=new Uint8Array(t,n,d),E=new Uint8Array(E),n+=d));const w=A(y.POLYGONS_LENGTH,0),S=A(y.POLYLINES_LENGTH,0),P=A(y.POINTS_LENGTH,0),L=w+S+P,z=new Pi(e,L,C,E,dZe(e));if(e._batchTable=z,L===0)return;const R=new om(y,b),F=R.getGlobalProperty("REGION");if(!l(F))throw new Ie("Feature table global property: REGION must be defined");const U=ge.unpack(F),D=F[4],I=F[5],_=e._tile.computedTransform;let v=R.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(v)?(v=f.unpack(v),B.multiplyByPoint(_,v,v)):(v=ge.center(U),v.height=M.lerp(D,I,.5),v=me.WGS84.cartographicToCartesian(v));const O=fZe(y,b);if(n+=(4-n%4)%4,w>0){R.featuresLength=w;const N=A(R.getPropertyArray("POLYGON_COUNTS",ee.UNSIGNED_INT,1),R.getPropertyArray("POLYGON_COUNT",ee.UNSIGNED_INT,1));if(!l(N))throw new Ie("Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const V=A(R.getPropertyArray("POLYGON_INDEX_COUNTS",ee.UNSIGNED_INT,1),R.getPropertyArray("POLYGON_INDEX_COUNT",ee.UNSIGNED_INT,1));if(!l(V))throw new Ie("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const k=N.reduce(function(Y,X){return Y+X*2},0),G=V.reduce(function(Y,X){return Y+X},0),W=new Uint32Array(t,n,G);n+=h;const K=new Uint16Array(t,n,k);n+=m;let q,te;l(y.POLYGON_MINIMUM_HEIGHTS)&&l(y.POLYGON_MAXIMUM_HEIGHTS)&&(q=R.getPropertyArray("POLYGON_MINIMUM_HEIGHTS",ee.FLOAT,1),te=R.getPropertyArray("POLYGON_MAXIMUM_HEIGHTS",ee.FLOAT,1)),e._polygons=new th({positions:K,counts:N,indexCounts:V,indices:W,minimumHeight:D,maximumHeight:I,polygonMinimumHeights:q,polygonMaximumHeights:te,center:v,rectangle:U,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:z,batchIds:O.polygons,modelMatrix:_})}if(S>0){R.featuresLength=S;const N=A(R.getPropertyArray("POLYLINE_COUNTS",ee.UNSIGNED_INT,1),R.getPropertyArray("POLYLINE_COUNT",ee.UNSIGNED_INT,1));if(!l(N))throw new Ie("Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0");let V=R.getPropertyArray("POLYLINE_WIDTHS",ee.UNSIGNED_SHORT,1);if(!l(V)){V=new Uint16Array(S);for(let te=0;te<S;++te)V[te]=2}const k=N.reduce(function(te,Y){return te+Y*3},0),G=new Uint16Array(t,n,k);n+=g;const W=e._tileset,K=W.examineVectorLinesFunction;if(l(K)){const te=uZe(new Uint16Array(G),U,D,I,me.WGS84);_Ze(te,N,O.polylines,z,e.url,K)}let q=hZe;l(W.classificationType)&&(q=pZe),e._polylines=q({positions:G,widths:V,counts:N,batchIds:O.polylines,minimumHeight:D,maximumHeight:I,center:v,rectangle:U,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:z,classificationType:W.classificationType,keepDecodedPositions:W.vectorKeepDecodedPositions})}if(P>0){const N=new Uint16Array(t,n,P*3);n+=p,e._points=new sm({positions:N,batchIds:O.points,minimumHeight:D,maximumHeight:I,rectangle:U,batchTable:z})}return Promise.resolve(e)}function rF(e){const t=e.featuresLength;if(!l(e._features)&&t>0){const n=new Array(t);l(e._polygons)&&e._polygons.createFeatures(e,n),l(e._polylines)&&e._polylines.createFeatures(e,n),l(e._points)&&e._points.createFeatures(e,n),e._features=n}}Rd.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Rd.prototype.getFeature=function(e){const t=this.featuresLength;if(!l(e)||e<0||e>=t)throw new x(`batchId is required and between zero and featuresLength - 1 (${t-1}).`);return l(this._features)||rF(this),this._features[e]};Rd.prototype.applyDebugSettings=function(e,t){l(this._polygons)&&this._polygons.applyDebugSettings(e,t),l(this._polylines)&&this._polylines.applyDebugSettings(e,t),l(this._points)&&this._points.applyDebugSettings(e,t)};Rd.prototype.applyStyle=function(e){l(this._features)||rF(this),l(this._polygons)&&this._polygons.applyStyle(e,this._features),l(this._polylines)&&this._polylines.applyStyle(e,this._features),l(this._points)&&this._points.applyStyle(e,this._features)};Rd.prototype.update=function(e,t){let n=!0;l(this._polygons)&&(this._polygons.classificationType=this._tileset.classificationType,this._polygons.debugWireframe=this._tileset.debugWireframe,this._polygons.update(t),n=n&&this._polygons._ready),l(this._polylines)&&(this._polylines.update(t),n=n&&this._polylines._ready),l(this._points)&&(this._points.update(t),n=n&&this._points._ready),l(this._batchTable)&&n&&(l(this._features)||rF(this),this._batchTable.update(e,t))};Rd.prototype.getPolylinePositions=function(e){const t=this._polylines;if(l(t))return t.getPositions(e)};Rd.prototype.isDestroyed=function(){return!1};Rd.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(),He(this)};function _Ze(e,t,n,i,o,r){const s=t.length;let a=0;for(let c=0;c<s;c++){const u=t[c]*3,d=e.slice(a,a+u);a+=u,r(d,n[c],o,i)}}const uZ={b3dm:function(e,t,n,i,o){return Uo.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return Uo.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return Uo.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return new Kf(e,t,n,i,o,uZ)},externalTileset:function(e,t,n,i){return new eh(e,t,n,i)},geom:function(e,t,n,i,o){return new Jf(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new Rd(e,t,n,i,o)},subt:function(e,t,n,i,o){return new vc(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return new vc(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new Ie("Invalid glb content");const a=new DataView(i,o).getUint32(8,!0),c=new Uint8Array(i,o,a);return Uo.fromGltf(e,t,n,c)},gltf:function(e,t,n,i){return Uo.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return Uo.fromGeoJson(e,t,n,i)}},dZ=uZ,gZe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Go=Object.freeze(gZe),Vl={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"};Vl.isBinaryFormat=function(e){switch(e){case Vl.BATCHED_3D_MODEL:case Vl.INSTANCED_3D_MODEL:case Vl.COMPOSITE:case Vl.POINT_CLOUD:case Vl.VECTOR:case Vl.GEOMETRY:case Vl.IMPLICIT_SUBTREE:case Vl.VOXEL_BINARY:case Vl.GLTF_BINARY:return!0;default:return!1}};const qa=Object.freeze(Vl);function md(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(md.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){throw new x("Empty3DTileContent cannot have content metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(e){throw new x("Empty3DTileContent cannot have group metadata")}}});md.prototype.hasProperty=function(e,t){return!1};md.prototype.getFeature=function(e){};md.prototype.applyDebugSettings=function(e,t){};md.prototype.applyStyle=function(e){};md.prototype.update=function(e,t){};md.prototype.isDestroyed=function(){return!1};md.prototype.destroy=function(){return He(this)};function ih(e){e=A(e,A.EMPTY_OBJECT);const t=e.content,n=e.class;T.typeOf.object("options.content",t),T.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(ih.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});ih.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};ih.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};ih.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};ih.prototype.getProperty=function(e){return Xt.getProperty(e,this._properties,this._class)};ih.prototype.setProperty=function(e,t){return Xt.setProperty(e,t,this._properties,this._class)};ih.prototype.getPropertyBySemantic=function(e){return Xt.getPropertyBySemantic(e,this._properties,this._class)};ih.prototype.setPropertyBySemantic=function(e,t){return Xt.setPropertyBySemantic(e,t,this._properties,this._class)};function XD(e,t){const n=hr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){XD._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}const i=A(e.schema.classes,A.EMPTY_OBJECT);if(l(n.class)){const o=i[n.class];return new ih({content:n,class:o})}}XD._oneTimeWarning=ki;function fZ(e,t){const n=e.metadataExtension;if(!l(n))return;const i=n.groups,o=hr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"].group:t.group;if(typeof o=="number")return i[o];const r=n.groupIds.findIndex(function(s){return s===o});return r>=0?i[r]:void 0}function oh(e){e=A(e,A.EMPTY_OBJECT);const t=e.tile,n=e.class;T.typeOf.object("options.tile",t),T.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(oh.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});oh.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};oh.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};oh.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};oh.prototype.getProperty=function(e){return Xt.getProperty(e,this._properties,this._class)};oh.prototype.setProperty=function(e,t){return Xt.setProperty(e,t,this._properties,this._class)};oh.prototype.getPropertyBySemantic=function(e){return Xt.getPropertyBySemantic(e,this._properties,this._class)};oh.prototype.setPropertyBySemantic=function(e,t){return Xt.setPropertyBySemantic(e,t,this._properties,this._class)};function sF(e,t){const n=hr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){sF._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}const i=A(e.schema.classes,A.EMPTY_OBJECT);if(l(n.class)){const o=i[n.class];return new oh({tile:n,class:o})}}sF._oneTimeWarning=ki;function hZ(e){const t=new Uint8Array(e);let n=ND(t);if(n==="glTF"&&(n="glb"),qa.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=yZe(t);if(l(i.root))return{contentType:qa.EXTERNAL_TILESET,jsonPayload:i};if(l(i.asset))return{contentType:qa.GLTF,jsonPayload:i};if(l(i.tileAvailability))return{contentType:qa.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(l(i.type))return{contentType:qa.GEOJSON,jsonPayload:i};if(l(i.voxelTable))return{contentType:qa.VOXEL_JSON,jsonPayload:i};throw new Ie("Invalid tile content.")}function yZe(e){let t;try{t=Ya(e)}catch{throw new Ie("Invalid tile content.")}return t}function Du(e,t,n,i){this._tileset=e,this._tile=t,this._tilesetResource=n,this._contents=[],this._contentsCreated=!1;const o=l(i.contents)?i.contents:i.content;this._innerContentHeaders=o,this._requestsInFlight=0,this._cancelCount=0;const 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++){const a=n.getDerivedResource({url:o[s].uri}),c=bi.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=c}this._contentsFetchedPromise=void 0}Object.defineProperties(Du.prototype,{featurePropertiesDirty:{get:function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)if(e[n].featurePropertiesDirty)return!0;return!1},set:function(e){const 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;const 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(){throw new x("Multiple3DTileContent cannot have metadata")}},batchTable:{get:function(){}},group:{get:function(){},set:function(){throw new x("Multiple3DTileContent cannot have group metadata")}},innerContentUrls:{get:function(){return this._innerContentHeaders.map(function(e){return e.uri})}},contentsFetchedPromise:{get:function(){return this._contentsFetchedPromise}}});function RR(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function AZe(e,t){e._cancelCount++,e._tile._contentState=t;const n=e.tileset.statistics;n.numberOfPendingRequests-=e._requestsInFlight,n.numberOfAttemptedRequests+=e._requestsInFlight,e._requestsInFlight=0;const i=e._innerContentHeaders.length;e._arrayFetchPromises=new Array(i)}Du.prototype.requestInnerContents=function(){if(!bZe(this._serverKeys))return this._serverKeys.length;const e=this._innerContentHeaders;RR(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=CZe(this,t,this._cancelCount,this._tile._contentState);return this._contentsFetchedPromise=TZe(this),0};function bZe(e){const t={};for(let n=0;n<e.length;n++){const i=e[n];l(t[i])?t[i]++:t[i]=1}for(const n in t)if(t.hasOwnProperty(n)&&!bi.serverHasOpenSlots(n,t[n]))return!1;return bi.heapHasOpenSlots(e.length)}function CZe(e,t,n,i){const o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],c=new dd({throttle:!0,throttleByServer:!0,type:Y_.TILES3D,priorityFunction:s,serverKey:a});o.request=c,e._requests[t]=c;const u=o.fetchArrayBuffer();return l(u)?u.then(function(d){if(!(n<e._cancelCount))return RR(e,-1),d}).catch(function(d){if(!(n<e._cancelCount)){if(o.request.state===Do.CANCELLED){AZe(e,i);return}RR(e,-1),pZ(e,t,d)}}):Promise.resolve(void 0)}function TZe(e){const t=e._cancelCount;return Promise.all(e._arrayFetchPromises).then(function(n){if(t<e._cancelCount)return;const i=n.map(function(o,r){if(l(o))return EZe(e,o,r)});e._contentsCreated=!0,e._contents=i.filter(l)})}function EZe(e,t,n){const i=hZ(t);if(i.contentType===qa.EXTERNAL_TILESET){const h=new Ie("External tilesets are disallowed inside multiple contents");return pZ(e,n,h)}e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===qa.GEOMETRY||i.contentType===qa.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const c=dZ[i.contentType];l(i.binaryPayload)?a=c(o,s,r,i.binaryPayload.buffer,0):a=c(o,s,r,i.jsonPayload);const u=e._innerContentHeaders[n];if(s.hasImplicitContentMetadata){const h=s.implicitSubtree,m=s.implicitCoordinates;a.metadata=h.getContentMetadataView(m,n)}else s.hasImplicitContent||(a.metadata=XD(o,u));const d=fZ(o,u);return l(d)&&(a.group=new v2({metadata:d})),a}function pZ(e,t,n){const i=e._tileset,o=e._innerContentResources[t].url,r=l(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}`))}Du.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];l(t)&&t.cancel()}};Du.prototype.hasProperty=function(e,t){return!1};Du.prototype.getFeature=function(e){};Du.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Du.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Du.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};Du.prototype.isDestroyed=function(){return!1};Du.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return He(this)};const VT={},xZe=new f,mZ=new f,_Z=new f,gZ=new f,yZ=new zt;VT.validOutline=function(e){T.defined("positions",e);const n=zt.fromPoints(e,yZ).halfAxes,i=J.getColumn(n,0,mZ),o=J.getColumn(n,1,_Z),r=J.getColumn(n,2,gZ),s=f.magnitude(i),a=f.magnitude(o),c=f.magnitude(r);return!(s===0&&(a===0||c===0)||a===0&&c===0)};VT.computeProjectTo2DArguments=function(e,t,n,i){T.defined("positions",e),T.defined("centerResult",t),T.defined("planeAxis1Result",n),T.defined("planeAxis2Result",i);const o=zt.fromPoints(e,yZ),r=o.halfAxes,s=J.getColumn(r,0,mZ),a=J.getColumn(r,1,_Z),c=J.getColumn(r,2,gZ),u=f.magnitude(s),d=f.magnitude(a),h=f.magnitude(c),m=Math.min(u,d,h);if(u===0&&(d===0||h===0)||d===0&&h===0)return!1;let g,p;return(m===d||m===h)&&(g=s),m===u?g=a:m===h&&(p=a),(m===u||m===d)&&(p=c),f.normalize(g,n),f.normalize(p,i),f.clone(o.center,t),!0};function AZ(e,t,n,i,o){const r=f.subtract(e,t,xZe),s=f.dot(n,r),a=f.dot(i,r);return j.fromElements(s,a,o)}VT.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=AZ(i[r],e,t,n);return o}};VT.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return AZ(i,e,t,n,o)}};const fS=VT,xo={};xo.computeHierarchyPackedLength=function(e,t){let n=0;const i=[e];for(;i.length>0;){const o=i.pop();if(!l(o))continue;n+=2;const r=o.positions,s=o.holes;if(l(r)&&r.length>0&&(n+=r.length*t.packedLength),l(s)){const a=s.length;for(let c=0;c<a;++c)i.push(s[c])}}return n};xo.packPolygonHierarchy=function(e,t,n,i){const o=[e];for(;o.length>0;){const r=o.pop();if(!l(r))continue;const s=r.positions,a=r.holes;if(t[n++]=l(s)?s.length:0,t[n++]=l(a)?a.length:0,l(s)){const c=s.length;for(let u=0;u<c;++u,n+=i.packedLength)i.pack(s[u],t,n)}if(l(a)){const c=a.length;for(let u=0;u<c;++u)o.push(a[u])}}return n};xo.unpackPolygonHierarchy=function(e,t,n){const 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]=xo.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};const Im=new j;function bZ(e,t,n,i){return j.subtract(t,e,Im),j.multiplyByScalar(Im,n/i,Im),j.add(e,Im,Im),[Im.x,Im.y]}const Sh=new f;function wZe(e,t,n,i){return f.subtract(t,e,Sh),f.multiplyByScalar(Sh,n/i,Sh),f.add(e,Sh,Sh),[Sh.x,Sh.y,Sh.z]}xo.subdivideLineCount=function(e,t,n){const o=f.distance(e,t)/n,r=Math.max(0,Math.ceil(M.log2(o)));return Math.pow(2,r)};const aF=new Ce,cF=new Ce,SZe=new Ce,vZe=new f,cG=new ps;xo.subdivideRhumbLineCount=function(e,t,n,i){const o=e.cartesianToCartographic(t,aF),r=e.cartesianToCartographic(n,cF),a=new ps(o,r,e).surfaceDistance/i,c=Math.max(0,Math.ceil(M.log2(a)));return Math.pow(2,c)};xo.subdivideTexcoordLine=function(e,t,n,i,o,r){const s=xo.subdivideLineCount(n,i,o),a=j.distance(e,t),c=a/s,u=r;u.length=s*2;let d=0;for(let h=0;h<s;h++){const m=bZ(e,t,h*c,a);u[d++]=m[0],u[d++]=m[1]}return u};xo.subdivideLine=function(e,t,n,i){const o=xo.subdivideLineCount(e,t,n),r=f.distance(e,t),s=r/o;l(i)||(i=[]);const a=i;a.length=o*3;let c=0;for(let u=0;u<o;u++){const d=wZe(e,t,u*s,r);a[c++]=d[0],a[c++]=d[1],a[c++]=d[2]}return a};xo.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){const a=n.cartesianToCartographic(i,aF),c=n.cartesianToCartographic(o,cF);cG.setEndPoints(a,c);const u=cG.surfaceDistance/r,d=Math.max(0,Math.ceil(M.log2(u))),h=Math.pow(2,d),m=j.distance(e,t),g=m/h,p=s;p.length=h*2;let y=0;for(let b=0;b<h;b++){const C=bZ(e,t,b*g,m);p[y++]=C[0],p[y++]=C[1]}return p};xo.subdivideRhumbLine=function(e,t,n,i,o){const r=e.cartesianToCartographic(t,aF),s=e.cartesianToCartographic(n,cF),a=new ps(r,s,e),c=a.surfaceDistance/i,u=Math.max(0,Math.ceil(M.log2(c))),d=Math.pow(2,u),h=a.surfaceDistance/d;l(o)||(o=[]);const m=o;m.length=d*3;let g=0;for(let p=0;p<d;p++){const y=a.interpolateUsingSurfaceDistance(p*h,SZe),b=e.cartographicToCartesian(y,vZe);m[g++]=b.x,m[g++]=b.y,m[g++]=b.z}return m};const DZe=new f,IZe=new f,PZe=new f,OZe=new f;xo.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=A(i,me.WGS84);const r=DZe;let s=IZe;const a=PZe;let c=OZe;if(l(e)&&l(e.attributes)&&l(e.attributes.position)){const u=e.attributes.position.values,d=u.length/2;for(let h=0;h<d;h+=3)f.fromArray(u,h,a),i.geodeticSurfaceNormal(a,r),c=i.scaleToGeodeticSurface(a,c),s=f.multiplyByScalar(r,n,s),s=f.add(c,s,s),u[h+d]=s.x,u[h+1+d]=s.y,u[h+2+d]=s.z,o&&(c=f.clone(a,c)),s=f.multiplyByScalar(r,t,s),s=f.add(c,s,s),u[h]=s.x,u[h+1]=s.y,u[h+2]=s.z}return e};xo.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],o=new Td;o.enqueue(e);let r,s,a;for(;o.length!==0;){const c=o.dequeue();let u=c.positions;if(t)for(a=u.length,r=0;r<a;r++)n.scaleToGeodeticSurface(u[r],u[r]);if(u=da(u,f.equalsEpsilon,!0),u.length<3)continue;const d=c.holes?c.holes.length:0;for(r=0;r<d;r++){const h=c.holes[r];let m=h.positions;if(t)for(a=m.length,s=0;s<a;++s)n.scaleToGeodeticSurface(m[s],m[s]);if(m=da(m,f.equalsEpsilon,!0),m.length<3)continue;i.push(m);let g=0;for(l(h.holes)&&(g=h.holes.length),s=0;s<g;s++)o.enqueue(h.holes[s])}i.push(u)}return i};xo.polygonsFromHierarchy=function(e,t,n,i,o){const r=[],s=[],a=new Td;for(a.enqueue(e);a.length!==0;){const c=a.dequeue();let u=c.positions;const d=c.holes;let h,m;if(i)for(m=u.length,h=0;h<m;h++)o.scaleToGeodeticSurface(u[h],u[h]);if(t||(u=da(u,f.equalsEpsilon,!0)),u.length<3)continue;let g=n(u);if(!l(g))continue;const p=[];let y=no.computeWindingOrder2D(g);y===ml.CLOCKWISE&&(g.reverse(),u=u.slice().reverse());let b=u.slice();const C=l(d)?d.length:0,E=[];let w;for(h=0;h<C;h++){const S=d[h];let P=S.positions;if(i)for(m=P.length,w=0;w<m;++w)o.scaleToGeodeticSurface(P[w],P[w]);if(t||(P=da(P,f.equalsEpsilon,!0)),P.length<3)continue;const L=n(P);if(!l(L))continue;y=no.computeWindingOrder2D(L),y===ml.CLOCKWISE&&(L.reverse(),P=P.slice().reverse()),E.push(P),p.push(b.length),b=b.concat(P),g=g.concat(L);let z=0;for(l(S.holes)&&(z=S.holes.length),w=0;w<z;w++)a.enqueue(S.holes[w])}r.push({outerRing:u,holes:E}),s.push({positions:b,positions2D:g,holes:p})}return{hierarchy:r,polygons:s}};const LZe=new j,BZe=new f,RZe=new Te,NZe=new J;xo.computeBoundingRectangle=function(e,t,n,i,o){const r=Te.fromAxisAngle(e,i,RZe),s=J.fromQuaternion(r,NZe);let a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY;const h=n.length;for(let m=0;m<h;++m){const g=f.clone(n[m],BZe);J.multiplyByVector(s,g,g);const p=t(g,LZe);l(p)&&(a=Math.min(a,p.x),c=Math.max(c,p.x),u=Math.min(u,p.y),d=Math.max(d,p.y))}return o.x=a,o.y=u,o.width=c-a,o.height=d-u,o};xo.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=no.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const c=t.positions,u=l(n),d=u?n.positions:void 0;if(o){const h=c.length,m=new Array(h*3);let g=0;for(let b=0;b<h;b++){const C=c[b];m[g++]=C.x,m[g++]=C.y,m[g++]=C.z}const p={attributes:{position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:m})},indices:a,primitiveType:Ze.TRIANGLES};u&&(p.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:j.packArray(d)}));const y=new Lt(p);return r.normal?Yi.computeNormal(y):y}if(s===Bn.GEODESIC)return no.computeSubdivision(e,c,a,d,i);if(s===Bn.RHUMB)return no.computeRhumbLineSubdivision(e,c,a,d,i)};const lG=[],uG=[],MZe=new f,FZe=new f;xo.computeWallGeometry=function(e,t,n,i,o,r){let s,a,c,u,d,h,m,g,p,y=e.length,b=0,C=0;const E=l(t),w=E?t.positions:void 0;if(o)for(a=y*3*2,s=new Array(a*2),E&&(p=y*2*2,g=new Array(p*2)),c=0;c<y;c++)u=e[c],d=e[(c+1)%y],s[b]=s[b+a]=u.x,++b,s[b]=s[b+a]=u.y,++b,s[b]=s[b+a]=u.z,++b,s[b]=s[b+a]=d.x,++b,s[b]=s[b+a]=d.y,++b,s[b]=s[b+a]=d.z,++b,E&&(h=w[c],m=w[(c+1)%y],g[C]=g[C+p]=h.x,++C,g[C]=g[C+p]=h.y,++C,g[C]=g[C+p]=m.x,++C,g[C]=g[C+p]=m.y,++C);else{const R=M.chordLength(i,n.maximumRadius);let F=0;if(r===Bn.GEODESIC)for(c=0;c<y;c++)F+=xo.subdivideLineCount(e[c],e[(c+1)%y],R);else if(r===Bn.RHUMB)for(c=0;c<y;c++)F+=xo.subdivideRhumbLineCount(n,e[c],e[(c+1)%y],R);for(a=(F+y)*3,s=new Array(a*2),E&&(p=(F+y)*2,g=new Array(p*2)),c=0;c<y;c++){u=e[c],d=e[(c+1)%y];let U,D;E&&(h=w[c],m=w[(c+1)%y]),r===Bn.GEODESIC?(U=xo.subdivideLine(u,d,R,uG),E&&(D=xo.subdivideTexcoordLine(h,m,u,d,R,lG))):r===Bn.RHUMB&&(U=xo.subdivideRhumbLine(n,u,d,R,uG),E&&(D=xo.subdivideTexcoordRhumbLine(h,m,n,u,d,R,lG)));const I=U.length;for(let _=0;_<I;++_,++b)s[b]=U[_],s[b+a]=U[_];if(s[b]=d.x,s[b+a]=d.x,++b,s[b]=d.y,s[b+a]=d.y,++b,s[b]=d.z,s[b+a]=d.z,++b,E){const _=D.length;for(let v=0;v<_;++v,++C)g[C]=D[v],g[C+p]=D[v];g[C]=m.x,g[C+p]=m.x,++C,g[C]=m.y,g[C+p]=m.y,++C}}}y=s.length;const S=at.createTypedArray(y/3,y-e.length*6);let P=0;for(y/=6,c=0;c<y;c++){const R=c,F=R+1,U=R+y,D=U+1;u=f.fromArray(s,R*3,MZe),d=f.fromArray(s,F*3,FZe),!f.equalsEpsilon(u,d,M.EPSILON10,M.EPSILON10)&&(S[P++]=R,S[P++]=U,S[P++]=F,S[P++]=F,S[P++]=U,S[P++]=D)}const L={attributes:new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})}),indices:S,primitiveType:Ze.TRIANGLES};return E&&(L.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:g})),new Lt(L)};const Gn=xo;function zZe(e){const t=e.length,n=new Float64Array(t*3),i=at.createTypedArray(t,t*2);let o=0,r=0;for(let a=0;a<t;a++){const c=e[a];n[o++]=c.x,n[o++]=c.y,n[o++]=c.z,i[r++]=a,i[r++]=(a+1)%t}const s=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:n})});return new Lt({attributes:s,indices:i,primitiveType:Ze.LINES})}function rc(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy;T.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=Gn.computeHierarchyPackedLength(t,f)+1}rc.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions}};return new rc(t)};rc.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),n=Gn.packPolygonHierarchy(e._polygonHierarchy,t,n,f),t[n]=e.packedLength,t};const UZe={polygonHierarchy:{}};rc.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=Gn.unpackPolygonHierarchy(e,t,f);t=i.startingIndex,delete i.startingIndex;const o=e[t];return l(n)||(n=new rc(UZe)),n._polygonHierarchy=i,n.packedLength=o,n};rc.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=da(n,f.equalsEpsilon,!0),n.length<3||!fS.validOutline(n))return;const o=Gn.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;const r=[];for(let c=0;c<o.length;c++){const u=new ln({geometry:zZe(o[c])});r.push(u)}const s=Yi.combineInstances(r)[0],a=fe.fromPoints(t.positions);return new Lt({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};let Yx=new Ce;function kT(e){T.typeOf.object("options",e),T.typeOf.string("options.token",e.token);const t=io.fromToken(e.token),n=A(e.minimumHeight,0),i=A(e.maximumHeight,0),o=A(e.ellipsoid,me.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;const r=YZe(t,n,i,o);this._boundingPlanes=r;const s=QZe(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=wO(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=f.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=wO(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=wO(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]]);const c=t.getCenter();Yx=o.cartesianToCartographic(c,Yx),Yx.height=(i+n)/2,this.center=o.cartographicToCartesian(Yx,c),this._boundingSphere=fe.fromPoints(s)}const HZe=new f,VZe=new Ce,kZe=new f,GZe=new Ce,WZe=new f,jZe=new f,qZe=new f,$Ze=new f;function YZe(e,t,n,i){const o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,HZe),a=i.cartesianToCartographic(r,VZe);a.height=n;const c=i.cartographicToCartesian(a,kZe),u=Pt.fromPointNormal(c,s);o[0]=u;let d=0,h;const m=[];let g,p;for(h=0;h<4;h++){g=e.getVertex(h),m[h]=g,p=i.cartesianToCartographic(g,GZe),p.height=t;const b=Pt.getPointDistance(u,i.cartographicToCartesian(p,WZe));b<d&&(d=b)}const y=Pt.clone(u);for(y.normal=f.negate(y.normal,y.normal),y.distance=y.distance*-1+d,o[1]=y,h=0;h<4;h++){g=m[h];const b=m[(h+1)%4],C=i.geodeticSurfaceNormal(g,jZe),E=f.subtract(b,g,$Ze);let w=f.cross(E,C,qZe);w=f.normalize(w,w),o[2+h]=Pt.fromPointNormal(g,w)}return o}let Pm=new f,Om=new f,Lm=new f,yO=new f,AO=new f,bO=new f;const XZe=new f,KZe=new f,JZe=new f;let CO=new f,TO=new f,EO=new f,vh=new f;const zu=new J;function dG(e,t,n){Pm=e.normal,Om=t.normal,Lm=n.normal,yO=f.multiplyByScalar(e.normal,-e.distance,yO),AO=f.multiplyByScalar(t.normal,-t.distance,AO),bO=f.multiplyByScalar(n.normal,-n.distance,bO),CO=f.multiplyByScalar(f.cross(Om,Lm,XZe),f.dot(yO,Pm),CO),TO=f.multiplyByScalar(f.cross(Lm,Pm,KZe),f.dot(AO,Om),TO),EO=f.multiplyByScalar(f.cross(Pm,Om,JZe),f.dot(bO,Lm),EO),zu[0]=Pm.x,zu[1]=Om.x,zu[2]=Lm.x,zu[3]=Pm.y,zu[4]=Om.y,zu[5]=Lm.y,zu[6]=Pm.z,zu[7]=Om.z,zu[8]=Lm.z;const i=J.determinant(zu);return vh=f.add(CO,TO,vh),vh=f.add(vh,EO,vh),new f(vh.x/i,vh.y/i,vh.z/i)}function QZe(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=dG(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=dG(e[1],e[2+(n+3)%4],e[2+n%4]);return t}let xO=new f,Wg=new f;function wO(e,t){const n=[];for(let i=0;i<4;i++)xO=f.subtract(t[(i+1)%4],t[i],xO),Wg=f.cross(e.normal,xO,Wg),Wg=f.normalize(Wg,Wg),n[i]=f.clone(Wg);return n}Object.defineProperties(kT.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const SO=new f;kT.prototype.distanceToCamera=function(e){T.defined("frameState",e);const t=e.camera.positionWC,n=[],i=[];let o;Pt.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):Pt.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,Pt.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=vO(Pt.projectPointOntoPlane(c,t,SO),i[0],c,o),f.distance(a,t);if(n.length===2){if(n[0]===0){const m=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=CZ(t,m[0],m[1]),f.distance(a,t)}let d=Number.MAX_VALUE,h;for(r=0;r<2;r++)c=this._boundingPlanes[n[r]],a=vO(Pt.projectPointOntoPlane(c,t,SO),i[r],c,this._edgeNormals[n[r]]),h=f.distanceSquared(a,t),h<d&&(d=h);return Math.sqrt(d)}else if(n.length>3)return a=vO(Pt.projectPointOntoPlane(this._boundingPlanes[1],t,SO),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),f.distance(a,t);const u=n[1]===2&&n[2]===5?0:1;return n[0]===0?f.distance(t,this._vertices[(n[1]-2+u)%4]):f.distance(t,this._vertices[4+(n[1]-2+u)%4])};const ZZe=new f,eet=new f;function CZ(e,t,n){const i=f.subtract(n,t,ZZe),o=f.subtract(e,t,eet);let r=f.dot(i,o);if(r<=0)return t;const s=f.dot(i,i);return r>=s?n:(r=r/s,new f((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const tet=new Pt(f.UNIT_X,0);function vO(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let c=0;c<t.length;c++){const u=Pt.fromPointNormal(t[c],i[c],tet);Pt.getPointDistance(u,e)<0||(a=CZ(e,t[c],t[(c+1)%4]),r=f.distance(e,a),r<o&&(o=r,s=a))}return l(s)?s:e}kT.prototype.intersectPlane=function(e){T.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++)f.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?xn.INSIDE:n===this._vertices.length?xn.OUTSIDE:xn.INTERSECTING};kT.prototype.createDebugVolume=function(e){T.defined("color",e);const t=new B.clone(B.IDENTITY),n=new rc({polygonHierarchy:{positions:this._planeVertices[0]}}),i=rc.createGeometry(n),o=new ln({geometry:i,id:"outline",modelMatrix:t,attributes:{color:pn.fromColor(e)}}),r=new rc({polygonHierarchy:{positions:this._planeVertices[1]}}),s=rc.createGeometry(r),a=new ln({geometry:s,id:"outline",modelMatrix:t,attributes:{color:pn.fromColor(e)}}),c=[];for(let u=0;u<4;u++){const d=new rc({polygonHierarchy:{positions:this._planeVertices[2+u]}}),h=rc.createGeometry(d);c[u]=new ln({geometry:h,id:"outline",modelMatrix:t,attributes:{color:pn.fromColor(e)}})}return new Jt({geometryInstances:[c[0],c[1],c[2],c[3],a,o],appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})};function rh(e,t){t===0&&(t=M.EPSILON7),this._boundingSphere=new fe(e,t)}Object.defineProperties(rh.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}}});rh.prototype.distanceToCamera=function(e){T.defined("frameState",e);const t=this._boundingSphere;return Math.max(0,f.distance(t.center,e.camera.positionWC)-t.radius)};rh.prototype.intersectPlane=function(e){return T.defined("plane",e),fe.intersectPlane(this._boundingSphere,e)};rh.prototype.update=function(e,t){f.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};rh.prototype.createDebugVolume=function(e){T.defined("color",e);const t=new vp({radius:this.radius}),n=B.fromTranslation(this.center,new B.clone(B.IDENTITY)),i=new ln({geometry:t,id:"outline",modelMatrix:n,attributes:{color:pn.fromColor(e)}});return new Jt({geometryInstances:i,appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})};const net=new f,iet=new f,oet=new f,ret=new f;function Vm(e,t,n){n=f.cross(e,t,n);const i=f.magnitude(n);return f.multiplyByScalar(n,M.EPSILON7/i,n)}function DO(e,t){const n=f.normalize(e,ret),i=f.equalsEpsilon(n,f.UNIT_X,M.EPSILON6)?f.UNIT_Y:f.UNIT_X;return Vm(e,i,t)}function TZ(e){let t=J.getColumn(e,0,net),n=J.getColumn(e,1,iet),i=J.getColumn(e,2,oet);const o=f.equals(t,f.ZERO),r=f.equals(n,f.ZERO),s=f.equals(i,f.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=M.EPSILON7,e[4]=M.EPSILON7,e[8]=M.EPSILON7,e):(o&&!r&&!s?t=Vm(n,i,t):!o&&r&&!s?n=Vm(t,i,n):!o&&!r&&s?i=Vm(n,t,i):o?r?s||(t=DO(i,t),n=Vm(i,t,n)):(t=DO(n,t),i=Vm(n,t,i)):(n=DO(t,n),i=Vm(n,t,i)),J.setColumn(e,0,t,e),J.setColumn(e,1,n,e),J.setColumn(e,2,i,e),e)}function _u(e,t){t=TZ(t),this._orientedBoundingBox=new zt(e,t),this._boundingSphere=fe.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(_u.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});_u.prototype.distanceToCamera=function(e){return T.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};_u.prototype.intersectPlane=function(e){return T.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};_u.prototype.update=function(e,t){f.clone(e,this._orientedBoundingBox.center),t=TZ(t),J.clone(t,this._orientedBoundingBox.halfAxes),fe.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};_u.prototype.createDebugVolume=function(e){T.defined("color",e);const t=new Tc({minimum:new f(-1,-1,-1),maximum:new f(1,1,1)}),n=B.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new ln({geometry:t,id:"outline",modelMatrix:n,attributes:{color:pn.fromColor(e)}});return new Jt({geometryInstances:i,appearance:new wn({translucent:!1,flat:!0}),asynchronous:!1})};function uo(e,t,n,i){this._tileset=e,this._header=n;const o=l(n.contents),r=o&&n.contents.length>1||hr(n,"3DTILES_multiple_contents"),s=o&&!r?n.contents[0]:n.content;this._contentHeader=s,this.transform=l(n.transform)?B.unpack(n.transform):B.clone(B.IDENTITY);const a=l(i)?i.computedTransform:e.modelMatrix,c=B.multiply(a,this.transform,new B),u=l(i)?i._initialTransform:B.IDENTITY;this._initialTransform=B.multiply(u,this.transform,new B),this.computedTransform=c,this._boundingVolume=this.createBoundingVolume(n.boundingVolume,c),this._boundingVolume2D=void 0;let d;l(s)&&l(s.boundingVolume)&&(d=this.createBoundingVolume(s.boundingVolume,c)),this._contentBoundingVolume=d,this._contentBoundingVolume2D=void 0;let h;l(n.viewerRequestVolume)&&(h=this.createBoundingVolume(n.viewerRequestVolume,c)),this._viewerRequestVolume=h,this.geometricError=n.geometricError,this._geometricError=n.geometricError,l(this._geometricError)||(this._geometricError=l(i)?i.geometricError:e._geometricError,uo._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let m;l(n.refine)?((n.refine==="replace"||n.refine==="add")&&uo._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),m=n.refine.toUpperCase()==="REPLACE"?Pa.REPLACE:Pa.ADD):l(i)?m=i.refine:m=Pa.REPLACE,this.refine=m,this.children=[],this.parent=i;let g,p=!1,y,b,C;if(t=Me.createIfNeeded(t),r)y=Go.UNLOADED,b=t.clone();else if(l(s)){let P=s.uri;l(s.url)&&(uo._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),P=s.url),P===""?(uo._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 md(e,this),p=!0,y=Go.READY):(y=Go.UNLOADED,b=t.getDerivedResource({url:P}),C=bi.getServerKey(b.getUrlComponent()))}else g=new md(e,this),p=!0,y=Go.READY;this._content=g,this._contentResource=b,this._contentState=y,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=C,this.hasEmptyContent=p,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.metadata=sF(e,n),this.cacheNode=void 0;const E=n.expire;let w,S;l(E)&&(w=E.duration,l(E.date)&&(S=ie.fromIso8601(E.date))),this.expireDuration=w,this.expireDate=S,this.lastStyleTime=0,this._optimChildrenWithinParent=xy.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=H.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 ie,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}uo._deprecationWarning=$p;Object.defineProperties(uo.prototype,{tileset:{get:function(){return this._tileset}},content:{get:function(){return this._content}},boundingVolume:{get:function(){return this._boundingVolume}},contentBoundingVolume:{get:function(){return A(this._contentBoundingVolume,this._boundingVolume)}},boundingSphere:{get:function(){return this._boundingVolume.boundingSphere}},extras:{get:function(){return this._header.extras}},color:{get:function(){return l(this._color)||(this._color=new H),H.clone(this._color)},set:function(e){this._color=H.clone(e,this._color),this._colorDirty=!0}},contentAvailable:{get:function(){return this.contentReady&&!this.hasEmptyContent&&!this.hasTilesetContent&&!this.hasImplicitContent||l(this._expiredContent)&&!this.contentFailed}},contentReady:{get:function(){return this._contentState===Go.READY}},contentUnloaded:{get:function(){return this._contentState===Go.UNLOADED}},contentExpired:{get:function(){return this._contentState===Go.EXPIRED}},contentFailed:{get:function(){return this._contentState===Go.FAILED}},contentReadyToProcessPromise:{get:function(){return this._contentReadyToProcessPromise}},contentReadyPromise:{get:function(){return this._contentReadyPromise}},commandsLength:{get:function(){return this._commandsLength}}});const Dh=new f;function set(e,t){const n=e._tileset,i=t.camera,o=e.boundingSphere,r=o.radius,s=f.multiplyByScalar(i.directionWC,e._centerZDepth,Dh),a=f.add(i.positionWC,s,Dh),c=f.subtract(a,o.center,Dh);if(f.magnitude(c)>r){const w=f.normalize(c,Dh),S=f.multiplyByScalar(w,r,Dh),P=f.add(o.center,S,Dh),L=f.subtract(P,i.positionWC,Dh),z=f.normalize(L,Dh);e._foveatedFactor=1-Math.abs(f.dot(i.directionWC,z))}else e._foveatedFactor=0;const h=e.refine===Pa.REPLACE,m=n._skipLevelOfDetail;if(h&&!m||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&h&&m||n._pass===ra.PRELOAD_FLIGHT||n._pass===ra.PRELOAD)return!1;const g=1-Math.cos(i.frustum.fov*.5),p=n.foveatedConeSize*g;if(e._foveatedFactor<=p)return!1;const y=g-p,b=M.clamp((e._foveatedFactor-p)/y,0,1),C=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.maximumScreenSpaceError,b),E=e._screenSpaceError===0&&l(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.maximumScreenSpaceError-C<=E}const EZ=new ie;uo.prototype.getScreenSpaceError=function(e,t,n){const i=this._tileset,o=A(n,1),r=l(this.parent)?this.parent.geometricError:i._geometricError,s=t?r:this.geometricError;if(s===0)return 0;const a=e.camera;let c=a.frustum;const u=e.context,d=u.drawingBufferWidth,h=u.drawingBufferHeight*o;let m;if(e.mode===le.SCENE2D||c instanceof Gt){l(c._offCenterFrustum)&&(c=c._offCenterFrustum);const g=Math.max(c.top-c.bottom,c.right-c.left)/Math.max(d,h);m=s/g}else{const g=Math.max(this._distanceToCamera,M.EPSILON7),p=a.frustum.sseDenominator;if(m=s*h/(g*p),i.dynamicScreenSpaceError){const y=i._dynamicScreenSpaceErrorComputedDensity,b=i.dynamicScreenSpaceErrorFactor,C=M.fog(g,y)*b;m-=C}}return m/=e.pixelRatio,m};function aet(e,t){if(e.progressiveResolutionHeightFraction<=0||e.progressiveResolutionHeightFraction>.5)return!1;let n=t._screenSpaceErrorProgressiveResolution>e._maximumScreenSpaceError;t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!1;const i=t.parent,o=e._maximumScreenSpaceError,r=t._screenSpaceErrorProgressiveResolution<=o,s=l(i)&&i._screenSpaceErrorProgressiveResolution>o;return r&&s&&(t._priorityProgressiveResolutionScreenSpaceErrorLeaf=!0,n=!0),n}function cet(e,t){const n=t.parent,o=l(n)&&(!e._skipLevelOfDetail||t._screenSpaceError===0||n.hasTilesetContent||n.hasImplicitContent)?n._screenSpaceError:t._screenSpaceError;return e.root._screenSpaceError-o}uo.prototype.updateVisibility=function(e){const t=this.parent,n=this._tileset,i=l(t)?t.computedTransform:n.modelMatrix,o=l(t)?t._visibilityPlaneMask:ar.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!==ar.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=cet(n,this),this._priorityProgressiveResolution=aet(n,this),this.priorityDeferred=set(this,e)};uo.prototype.updateExpiration=function(){if(l(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=ie.now(EZ);ie.lessThan(this.expireDate,e)&&(this._contentState=Go.EXPIRED,this._expiredContent=this._content)}};function uet(e){if(l(e.expireDuration)){const t=ie.now(EZ);ie.addSeconds(t,e.expireDuration,t),l(e.expireDate)?ie.lessThan(e.expireDate,t)&&ie.clone(t,e.expireDate):e.expireDate=ie.clone(t)}}function det(e){return function(){return e._priority}}uo.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?fet(this):het(this)};function fet(e){let t=e._content;const n=e._tileset;if(!l(t)){const r=hr(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new Du(n,e,e._contentResource.clone(),r),e._content=t}const i=t.requestInnerContents();if(i>0)return i;e._contentState=Go.LOADING;const o=t.contentsFetchedPromise.then(function(){if(!(e._contentState!==Go.LOADING||!l(t.readyPromise))){if(e.isDestroyed()){IO(e,n);return}return e._contentState=Go.PROCESSING,t}});return e._contentReadyToProcessPromise=o,e._contentReadyPromise=o.then(function(r){if(l(r))return t.readyPromise}).then(function(r){if(l(r)){if(e.isDestroyed()){IO(e,n);return}return e._selectedFrame=0,e.lastStyleTime=0,ie.now(e._loadTimestamp),e._contentState=Go.READY,r}}).catch(function(r){IO(e,n)}),0}function IO(e,t,n){e._contentState===Go.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Go.FAILED}function het(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new dd({throttle:!0,throttleByServer:!0,type:Y_.TILES3D,priorityFunction:det(e),serverKey:e._serverKey});e._request=i,t.request=i;const o=t.fetchArrayBuffer();if(!l(o))return 1;const r=e._contentState,s=e._tileset;e._contentState=Go.LOADING,++s.statistics.numberOfPendingRequests;const a=o.then(function(c){if(e.isDestroyed()){PO(e,s);return}const u=pet(e,c);return n&&(e.expireDate=void 0),e._content=u,e._contentState=Go.PROCESSING,u});return e._contentReadyToProcessPromise=a,e._contentReadyPromise=a.then(function(c){if(l(c))return--s.statistics.numberOfPendingRequests,c.readyPromise}).then(function(c){if(l(c)){if(e.isDestroyed()){PO(e,s);return}return uet(e),e._selectedFrame=0,e.lastStyleTime=0,ie.now(e._loadTimestamp),e._contentState=Go.READY,c}}).catch(function(c){return i.state===Do.CANCELLED?(e._contentState=r,--s.statistics.numberOfPendingRequests,++s.statistics.numberOfAttemptedRequests,Promise.reject("Cancelled")):(PO(e,s),Promise.reject(c))}),0}function PO(e,t){e._contentState===Go.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Go.FAILED}function pet(e,t){const n=hZ(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===qa.GEOMETRY||n.contentType===qa.VECTOR,(n.contentType===qa.IMPLICIT_SUBTREE||n.contentType===qa.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===qa.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=dZ[n.contentType];l(n.binaryPayload)?o=r(i,e,e._contentResource,n.binaryPayload.buffer,0):o=r(i,e,e._contentResource,n.jsonPayload);const s=e._contentHeader;if(e.hasImplicitContentMetadata){const c=e.implicitSubtree,u=e.implicitCoordinates;o.metadata=c.getContentMetadataView(u,0)}else e.hasImplicitContent||(o.metadata=XD(i,s));const a=fZ(i,s);return l(a)&&(o.group=new v2({metadata:a})),o}uo.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};uo.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Go.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())};const xZ=new fe;function lF(e,t){if(t.mode!==le.SCENE3D&&!l(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=fe.projectTo2D(n,t.mapProjection,xZ);e._boundingVolume2D=new rh(i.center,i.radius)}return t.mode!==le.SCENE3D?e._boundingVolume2D:e._boundingVolume}function met(e,t){if(t.mode!==le.SCENE3D&&!l(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=fe.projectTo2D(n,t.mapProjection,xZ);e._contentBoundingVolume2D=new rh(i.center,i.radius)}return t.mode!==le.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}uo.prototype.visibility=function(e,t){const n=e.cullingVolume,i=lF(this,e),o=this._tileset,r=o.clippingPlanes;if(l(r)&&r.enabled){const s=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=s!==xn.INSIDE,s===xn.OUTSIDE)return ar.MASK_OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};uo.prototype.contentVisibility=function(e){if(!l(this._contentBoundingVolume)||this._visibilityPlaneMask===ar.MASK_INSIDE)return xn.INSIDE;const t=e.cullingVolume,n=met(this,e),i=this._tileset,o=i.clippingPlanes;if(l(o)&&o.enabled){const r=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=r!==xn.INSIDE,r===xn.OUTSIDE)return xn.OUTSIDE}return t.computeVisibility(n)};uo.prototype.distanceToTile=function(e){return lF(this,e).distanceToCamera(e)};const _et=new f;uo.prototype.distanceToTileCenter=function(e){const n=lF(this,e).boundingVolume,i=f.subtract(n.center,e.camera.positionWC,_et);return f.dot(e.camera.directionWC,i)};uo.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!l(t)||t.distanceToCamera(e)===0};const wZ=new J,SZ=new f,get=new J,vZ=new f,DZ=new ge,yet=new zt,NR=new B;function Aet(e,t,n){let i=f.fromElements(e[0],e[1],e[2],vZ),o=J.fromArray(e,3,get);i=B.multiplyByPoint(t,i,i);const r=B.getMatrix3(t,wZ);return o=J.multiply(r,o,o),l(n)?(n.update(i,o),n):new _u(i,o)}function bet(e,t,n,i){const o=ge.unpack(e,0,DZ),r=e[4],s=e[5],a=zt.fromRectangle(o,r,s,me.WGS84,yet);let c=a.center,u=a.halfAxes;t=B.multiplyTransformation(t,B.inverseTransformation(n,NR),NR),c=B.multiplyByPoint(t,c,c);const d=B.getMatrix3(t,wZ);return u=J.multiply(d,u,u),l(i)&&i instanceof _u?(i.update(c,u),i):new _u(c,u)}function Cet(e,t,n,i){if(!B.equalsEpsilon(t,n,M.EPSILON8))return bet(e,t,n,i);if(l(i))return i;const o=ge.unpack(e,0,DZ);return new fd({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function Tet(e,t,n){let i=f.fromElements(e[0],e[1],e[2],vZ),o=e[3];i=B.multiplyByPoint(t,i,i);const r=B.getScale(t,SZ),s=f.maximumComponent(r);return o*=s,l(n)?(n.update(i,o),n):new rh(i,o)}uo.prototype.createBoundingVolume=function(e,t,n){if(!l(e))throw new Ie("boundingVolume must be defined");if(hr(e,"3DTILES_bounding_volume_S2"))return new kT(e.extensions["3DTILES_bounding_volume_S2"]);if(l(e.box))return Aet(e.box,t,n);if(l(e.region))return Cet(e.region,t,this._initialTransform,n);if(l(e.sphere))return Tet(e.sphere,t,n);throw new Ie("boundingVolume must contain a sphere, region, or box")};uo.prototype.updateTransform=function(e){e=A(e,B.IDENTITY);const t=B.multiply(e,this.transform,NR);if(!!B.equals(t,this.computedTransform))return;B.clone(t,this.computedTransform);const i=this._header,o=this._contentHeader;this._boundingVolume=this.createBoundingVolume(i.boundingVolume,this.computedTransform,this._boundingVolume),l(this._contentBoundingVolume)&&(this._contentBoundingVolume=this.createBoundingVolume(o.boundingVolume,this.computedTransform,this._contentBoundingVolume)),l(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()};uo.prototype.updateGeometricErrorScale=function(){const e=B.getScale(this.computedTransform,SZ),t=f.maximumComponent(e);this.geometricError=this._geometricError*t};function Eet(e,t,n,i){if(!i.isRender)return;const o=l(e._contentHeader)&&l(e._contentHeader.boundingVolume),r=e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent,s=t.debugShowBoundingVolume||t.debugShowContentBoundingVolume&&!o;if(s){let u;e._finalResolution?r?u=H.DARKGRAY:u=H.WHITE:u=H.YELLOW,l(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(u)),e._debugBoundingVolume.update(n);const d=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");d.color=pn.toValue(u,d.color)}else!s&&l(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(l(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(H.BLUE)),e._debugContentBoundingVolume.update(n)):!t.debugShowContentBoundingVolume&&l(e._debugContentBoundingVolume)&&(e._debugContentBoundingVolume=e._debugContentBoundingVolume.destroy()),t.debugShowViewerRequestVolume&&l(e._viewerRequestVolume)?(l(e._debugViewerRequestVolume)||(e._debugViewerRequestVolume=e._viewerRequestVolume.createDebugVolume(H.YELLOW)),e._debugViewerRequestVolume.update(n)):!t.debugShowViewerRequestVolume&&l(e._debugViewerRequestVolume)&&(e._debugViewerRequestVolume=e._debugViewerRequestVolume.destroy());const a=t.debugColorizeTiles&&!e._debugColorizeTiles||l(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=H.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function xet(e,t,n){const i=e._content,o=e._expiredContent;if(!e.hasMultipleContents&&l(o)){if(!e.contentReady){o.update(t,n);return}e._expiredContent.destroy(),e._expiredContent=void 0}i.update(t,n)}function wet(e,t){const n=t.clippingPlanes;let i=0;l(n)&&e._isClipped&&n.enabled&&(i=n.clippingPlanesState),i!==e._clippingPlanesState&&(e._clippingPlanesState=i,e.clippingPlanesDirty=!0)}uo.prototype.update=function(e,t,n){const i=t.commandList.length;wet(this,e),Eet(this,e,t,n),xet(this,e,t);const r=t.commandList.length-i;this._commandsLength=r;for(let s=0;s<r;++s){const a=t.commandList[i+s],c=a.pass===Ne.TRANSLUCENT;a.depthForTranslucentClassification=c}this.clippingPlanesDirty=!1};const fG=[];uo.prototype.process=function(e,t){const n=t.commandList;t.commandList=fG,this._content.update(e,t),fG.length=0,t.commandList=n};function hG(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function Xx(e,t,n){return Math.max(M.normalize(e,t,n)-M.EPSILON7,0)}uo.prototype.updatePriority=function(){const e=this.tileset,t=e.preferLeaves,n=e._minimumPriority,i=e._maximumPriority,o=4,r=1,s=0,a=o,c=s+a,u=o,d=c+u,h=r,m=Math.pow(10,d),g=d+h,p=r,y=Math.pow(10,g),b=g+p,C=Math.pow(10,b);let E=Xx(this._depth,n.depth,i.depth);E=t?1-E:E;const S=!e._skipLevelOfDetail&&this.refine===Pa.REPLACE?Xx(this._priorityHolder._distanceToCamera,n.distance,i.distance):Xx(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),P=hG(S,a,s),L=this._priorityProgressiveResolution?0:m,z=Xx(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),R=hG(z,u,c),F=this.priorityDeferred?y:0,U=e._pass===ra.PRELOAD_FLIGHT?0:C;this._priority=E+P+L+R+F+U};uo.prototype.isDestroyed=function(){return!1};uo.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(),He(this)};function _d(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.group,i=e.class;T.typeOf.object("options.group",n),T.typeOf.object("options.class",i);const o=l(n.properties)?n.properties:{};this._class=i,this._properties=o,this._id=t,this._extras=n.extras,this._extensions=n.extensions}Object.defineProperties(_d.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}}});_d.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};_d.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};_d.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};_d.prototype.getProperty=function(e){return Xt.getProperty(e,this._properties,this._class)};_d.prototype.setProperty=function(e,t){return Xt.setProperty(e,t,this._properties,this._class)};_d.prototype.getPropertyBySemantic=function(e){return Xt.getPropertyBySemantic(e,this._properties,this._class)};_d.prototype.setPropertyBySemantic=function(e,t){return Xt.setPropertyBySemantic(e,t,this._properties,this._class)};function sh(e){e=A(e,A.EMPTY_OBJECT);const t=e.tileset,n=e.class;T.typeOf.object("options.tileset",t),T.typeOf.object("options.class",n);const i=l(t.properties)?t.properties:{};this._class=n,this._properties=i,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(sh.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});sh.prototype.hasProperty=function(e){return Xt.hasProperty(e,this._properties,this._class)};sh.prototype.hasPropertyBySemantic=function(e){return Xt.hasPropertyBySemantic(e,this._properties,this._class)};sh.prototype.getPropertyIds=function(e){return Xt.getPropertyIds(this._properties,this._class,e)};sh.prototype.getProperty=function(e){return Xt.getProperty(e,this._properties,this._class)};sh.prototype.setProperty=function(e,t){return Xt.setProperty(e,t,this._properties,this._class)};sh.prototype.getPropertyBySemantic=function(e){return Xt.getPropertyBySemantic(e,this._properties,this._class)};sh.prototype.setPropertyBySemantic=function(e,t){return Xt.setPropertyBySemantic(e,t,this._properties,this._class)};function IZ(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataJson,n=e.schema;T.typeOf.object("options.metadataJson",t),T.typeOf.object("options.schema",n);const i=A(t.metadata,t.tileset);let o;l(i)&&(o=new sh({tileset:i,class:n.classes[i.class]}));let r=[];const s=[],a=t.groups;if(Array.isArray(a)){const c=a.length;for(let u=0;u<c;u++){const d=a[u];s.push(new _d({group:d,class:n.classes[d.class]}))}}else if(l(a)){r=Object.keys(a).sort();const c=r.length;for(let u=0;u<c;u++){const d=r[u];if(a.hasOwnProperty(d)){const h=a[d];s.push(new _d({id:d,group:a[d],class:n.classes[h.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(IZ.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}}});const PZ={},vet=new f;PZ.checkChildrenWithinParent=function(e){T.typeOf.object("tile",e);const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof _u||i instanceof fd){const o=i._orientedBoundingBox;e._optimChildrenWithinParent=xy.USE_OPTIMIZATION;for(let r=0;r<n;++r){const a=t[r].boundingVolume;if(!(a instanceof _u||a instanceof fd)){e._optimChildrenWithinParent=xy.SKIP_OPTIMIZATION;break}const c=a._orientedBoundingBox,u=f.subtract(c.center,o.center,vet),d=f.magnitude(u);f.divideByScalar(u,d,u);const h=Math.abs(o.halfAxes[0]*u.x)+Math.abs(o.halfAxes[1]*u.y)+Math.abs(o.halfAxes[2]*u.z)+Math.abs(o.halfAxes[3]*u.x)+Math.abs(o.halfAxes[4]*u.y)+Math.abs(o.halfAxes[5]*u.z)+Math.abs(o.halfAxes[6]*u.x)+Math.abs(o.halfAxes[7]*u.y)+Math.abs(o.halfAxes[8]*u.z),m=Math.abs(c.halfAxes[0]*u.x)+Math.abs(c.halfAxes[1]*u.y)+Math.abs(c.halfAxes[2]*u.z)+Math.abs(c.halfAxes[3]*u.x)+Math.abs(c.halfAxes[4]*u.y)+Math.abs(c.halfAxes[5]*u.z)+Math.abs(c.halfAxes[6]*u.x)+Math.abs(c.halfAxes[7]*u.y)+Math.abs(c.halfAxes[8]*u.z);if(h<=m+d){e._optimChildrenWithinParent=xy.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===xy.USE_OPTIMIZATION};const Det=PZ;function GT(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(GT.prototype,{length:{get:function(){return this._length}}});function Iet(e,t,n){this.item=e,this.previous=t,this.next=n}GT.prototype.add=function(e){const t=new Iet(e,this.tail,void 0);return l(this.tail)?(this.tail.next=t,this.tail=t):(this.head=t,this.tail=t),++this._length,t};function OZ(e,t){l(t.previous)&&l(t.next)?(t.previous.next=t.next,t.next.previous=t.previous):l(t.previous)?(t.previous.next=void 0,e.tail=t.previous):l(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}GT.prototype.remove=function(e){l(e)&&(OZ(this,e),--this._length)};GT.prototype.splice=function(e,t){if(e===t)return;OZ(this,t);const n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e};function mg(){this._list=new GT,this._sentinel=this._list.add(),this._trimTiles=!1}mg.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};mg.prototype.touch=function(e){const t=e.cacheNode;l(t)&&this._list.splice(this._sentinel,t)};mg.prototype.add=function(e){l(e.cacheNode)||(e.cacheNode=this._list.add(e))};mg.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;l(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))};mg.prototype.unloadTiles=function(e,t){const n=this._trimTiles;this._trimTiles=!1;const i=this._list,o=e.maximumMemoryUsage*1024*1024,r=this._sentinel;let s=i.head;for(;s!==r&&(e.totalMemoryUsageInBytes>o||n);){const a=s.item;s=s.next,this.unloadTile(e,a,t)}};mg.prototype.trim=function(){this._trimTiles=!0};function KD(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 MR(e,t){let n;return t==="_loadTimestamp"?n=ie.toDate(e).getTime():n=e,n}KD.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=MR(e,n),this._referenceMaximum[n]=MR(t,n)};function Pet(e,t){const n=e.tilePropertyName;if(l(n)){const i=MR(t[n],n);return l(i)?(e._maximum=Math.max(i,e._maximum),e._minimum=Math.min(i,e._minimum),i):(e.tilePropertyName=void 0,i)}}const OO=[new H(.1,.1,.1,1),new H(.153,.278,.878,1),new H(.827,.231,.49,1),new H(.827,.188,.22,1),new H(1,.592,.259,1),new H(1,.843,0,1)];KD.prototype.colorize=function(e,t){const n=this.tilePropertyName;if(!l(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=Pet(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const s=r-o+M.EPSILON7,c=M.clamp(i-o,0,s)/s,u=OO.length-1,d=c*u,h=Math.floor(d),m=Math.ceil(d),g=d-h,p=OO[h],y=OO[m],b=H.clone(H.WHITE);b.red=M.lerp(p.red,y.red,g),b.green=M.lerp(p.green,y.green,g),b.blue=M.lerp(p.blue,y.blue,g),e._debugColor=b};KD.prototype.resetMinimumMaximum=function(){const e=this.tilePropertyName;if(l(e)){const t=this._referenceMinimum[e],n=this._referenceMaximum[e],i=l(t)&&l(n);this._previousMinimum=i?t:this._minimum,this._previousMaximum=i?n:this._maximum,this._minimum=Number.MAX_VALUE,this._maximum=-Number.MAX_VALUE}};function ad(){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}ad.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 JD(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,c=t.geometryByteLength,u=t.texturesByteLength,d=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-u:u,e.batchTableByteLength+=n?-d:d):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),l(o)){const h=o.length;for(let m=0;m<h;++m)JD(e,o[m],n,i)}}ad.prototype.incrementSelectionCounts=function(e){JD(this,e,!1,!1)};ad.prototype.incrementLoadCounts=function(e){JD(this,e,!1,!0)};ad.prototype.decrementLoadCounts=function(e){JD(this,e,!0,!0)};ad.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};function WT(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(WT.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});WT.prototype.makeDirty=function(){this._styleDirty=!0};WT.prototype.resetDirty=function(){this._styleDirty=!1};WT.prototype.applyStyle=function(e){if(!e.ready||l(this._style)&&!this._style._ready)return;const t=this._styleDirty;t&&++this._lastStyleTime;const n=this._lastStyleTime,i=e._statistics,o=t?e._selectedTiles:e._selectedTilesToStyle,r=o.length;for(let s=0;s<r;++s){const a=o[s];if(a.lastStyleTime!==n){const c=a.content;a.lastStyleTime=n,c.applyStyle(this._style),i.numberOfFeaturesStyled+=c.featuresLength,++i.numberOfTilesStyled}}};function Oet(e,t,n){const i=hr(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;T.typeOf.object("implicitTiling",i),this.baseResource=e,this.geometricError=t.geometricError,this.metadataSchema=n;const o=t.boundingVolume;if(!l(o.box)&&!l(o.region)&&!hr(o,"3DTILES_bounding_volume_S2")&&!hr(o,"3DTILES_bounding_volume_cylinder"))throw new Ie("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 Me({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=Let(t);for(let s=0;s<r.length;s++){const a=r[s];this.contentHeaders.push(ht(a,!0));const c=new Me({url:a.uri});this.contentUriTemplates.push(c)}this.contentCount=this.contentHeaders.length,this.tileHeader=Bet(t),this.subdivisionScheme=Lr[i.subdivisionScheme],this.branchingFactor=Lr.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,l(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function Let(e){if(hr(e,"3DTILES_multiple_contents")){const t=e.extensions["3DTILES_multiple_contents"];return l(t.contents)?t.contents:t.content}return l(e.contents)?e.contents:l(e.content)?[e.content]:[]}function Bet(e){const t=ht(e,!0);return l(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}const jT={};function pG(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function LO(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function mG(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 BO(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}jT.encode2D=function(e,t){if(T.typeOf.number("x",e),T.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new x("inputs must be 16-bit unsigned integers");return(pG(e)|pG(t)<<1)>>>0};jT.decode2D=function(e,t){if(T.typeOf.number("mortonIndex",e),e<0||e>4294967295)throw new x("input must be a 32-bit unsigned integer");return l(t)||(t=new Array(2)),t[0]=mG(e),t[1]=mG(e>>1),t};jT.encode3D=function(e,t,n){if(T.typeOf.number("x",e),T.typeOf.number("y",t),T.typeOf.number("z",n),e<0||e>1023||t<0||t>1023||n<0||n>1023)throw new x("inputs must be 10-bit unsigned integers");return LO(e)|LO(t)<<1|LO(n)<<2};jT.decode3D=function(e,t){if(T.typeOf.number("mortonIndex",e),e<0||e>1073741823)throw new x("input must be a 30-bit unsigned integer");return l(t)||(t=new Array(3)),t[0]=BO(e),t[1]=BO(e>>1),t[2]=BO(e>>2),t};const Tv=jT;function fo(e){if(T.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),T.typeOf.number("options.subtreeLevels",e.subtreeLevels),T.typeOf.number("options.level",e.level),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),e.subdivisionScheme===Lr.OCTREE&&T.typeOf.number("options.z",e.z),e.level<0)throw new x("level must be non-negative");if(e.x<0)throw new x("x must be non-negative");if(e.y<0)throw new x("y must be non-negative");if(e.subdivisionScheme===Lr.OCTREE&&e.z<0)throw new x("z must be non-negative");const t=1<<e.level;if(e.x>=t)throw new x("x is out of range");if(e.y>=t)throw new x("y is out of range");if(e.subdivisionScheme===Lr.OCTREE&&e.z>=t)throw new x("z is out of range");this.subdivisionScheme=e.subdivisionScheme,this.subtreeLevels=e.subtreeLevels,this.level=e.level,this.x=e.x,this.y=e.y,this.z=void 0,e.subdivisionScheme===Lr.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===Lr.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===Lr.OCTREE?Tv.encode3D(this.x,this.y,this.z):Tv.encode2D(this.x,this.y)}},tileIndex:{get:function(){const e=this.subdivisionScheme===Lr.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function uF(e,t){if(e.subdivisionScheme!==t.subdivisionScheme)throw new x("coordinates must have same subdivisionScheme");if(e.subtreeLevels!==t.subtreeLevels)throw new x("coordinates must have same subtreeLevels")}fo.prototype.getDescendantCoordinates=function(e){T.typeOf.object("offsetCoordinates",e),uF(this,e);const t=this.level+e.level,n=(this.x<<e.level)+e.x,i=(this.y<<e.level)+e.y;if(this.subdivisionScheme===Lr.OCTREE){const 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){if(T.typeOf.number("offsetLevels",e),e<0)throw new x("offsetLevels must be non-negative");if(e>this.level)throw new x("ancestor cannot be above the tileset root");const t=1<<e,n=this.level-e,i=Math.floor(this.x/t),o=Math.floor(this.y/t);if(this.subdivisionScheme===Lr.OCTREE){const 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){if(T.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new x("this is not an ancestor of descendant");uF(this,e);const t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===Lr.OCTREE){const 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){T.typeOf.number("childIndex",e);const t=Lr.getBranchingFactor(this.subdivisionScheme);if(e<0||t<=e)throw new x(`childIndex must be at least 0 and less than ${t}`);const n=this.level+1,i=2*this.x+e%2,o=2*this.y+Math.floor(e/2)%2;if(this.subdivisionScheme===Lr.OCTREE){const r=2*this.z+Math.floor(e/4)%2;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.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){T.typeOf.object("descendantCoordinates",e),uF(this,e);const t=e.level-this.level;if(t<=0)return!1;const n=e.x>>t,i=e.y>>t,o=this.x===n,r=this.y===i;if(this.subdivisionScheme===Lr.OCTREE){const s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};fo.prototype.isEqual=function(e){return T.typeOf.object("otherCoordinates",e),this.subdivisionScheme===e.subdivisionScheme&&this.subtreeLevels===e.subtreeLevels&&this.level===e.level&&this.x===e.x&&this.y===e.y&&(this.subdivisionScheme===Lr.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(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===Lr.OCTREE&&(e.z=this.z),e};const _G=[0,0,0];fo.fromMortonIndex=function(e,t,n,i){let o;return e===Lr.OCTREE?(o=Tv.decode3D(i,_G),new fo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=Tv.decode2D(i,_G),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===Lr.OCTREE?(i=Math.floor(M.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(M.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),fo.fromMortonIndex(e,t,i,r)};function Mr(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.url",e.url),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._extensionsUsed=void 0,this._extensions=void 0,this._modelUpAxis=void 0,this._modelForwardAxis=void 0,this._cache=new mg,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=A(e.showCreditsOnScreen,!1),this._cullWithChildrenBounds=A(e.cullWithChildrenBounds,!0),this._allTilesAdditive=!0,this._hasMixedContent=!1,this._stencilClearCommand=void 0,this._backfaceCommands=new la,this._maximumScreenSpaceError=A(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=A(e.maximumMemoryUsage,512),this._styleEngine=new WT,this._styleApplied=!1,this._modelMatrix=l(e.modelMatrix)?B.clone(e.modelMatrix):B.clone(B.IDENTITY),this._statistics=new ad,this._statisticsLast=new ad,this._statisticsPerPass=new Array(ra.NUMBER_OF_PASSES);for(let r=0;r<ra.NUMBER_OF_PASSES;++r)this._statisticsPerPass[r]=new ad;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 KD(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=A(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=A(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=M.clamp(A(e.progressiveResolutionHeightFraction,.3),0,.5),this.preferLeaves=A(e.preferLeaves,!1),this._tilesLoaded=!1,this._initialTilesLoaded=!1,this._tileDebugLabels=void 0,this._classificationType=e.classificationType,this._ellipsoid=A(e.ellipsoid,me.WGS84),this._initialClippingPlanesOriginMatrix=B.IDENTITY,this._clippingPlanesOriginMatrix=void 0,this._clippingPlanesOriginMatrixDirty=!0,this._vectorClassificationOnly=A(e.vectorClassificationOnly,!1),this._vectorKeepDecodedPositions=A(e.vectorKeepDecodedPositions,!1),this.preloadWhenHidden=A(e.preloadWhenHidden,!1),this.preloadFlightDestinations=A(e.preloadFlightDestinations,!0),this._pass=void 0,this.dynamicScreenSpaceError=A(e.dynamicScreenSpaceError,!1),this.foveatedScreenSpaceError=A(e.foveatedScreenSpaceError,!0),this._foveatedConeSize=A(e.foveatedConeSize,.1),this._foveatedMinimumScreenSpaceErrorRelaxation=A(e.foveatedMinimumScreenSpaceErrorRelaxation,0),this.foveatedInterpolationCallback=A(e.foveatedInterpolationCallback,M.lerp),this.foveatedTimeDelay=A(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=A(e.shadows,Po.ENABLED),this.show=A(e.show,!0),this.colorBlendMode=iS.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new zT(e.pointCloudShading),this._pointCloudEyeDomeLighting=new im,this.loadProgress=new Ke,this.allTilesLoaded=new Ke,this.initialTilesLoaded=new Ke,this.tileLoad=new Ke,this.tileUnload=new Ke,this.tileFailed=new Ke,this.tileVisible=new Ke,this.skipLevelOfDetail=A(e.skipLevelOfDetail,!1),this._skipLevelOfDetail=this.skipLevelOfDetail,this._disableSkipLevelOfDetail=!1,this.baseScreenSpaceError=A(e.baseScreenSpaceError,1024),this.skipScreenSpaceErrorFactor=A(e.skipScreenSpaceErrorFactor,16),this.skipLevels=A(e.skipLevels,1),this.immediatelyLoadDesiredLevelOfDetail=A(e.immediatelyLoadDesiredLevelOfDetail,!1),this.loadSiblings=A(e.loadSiblings,!1),this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,l(e.imageBasedLighting)?(this._imageBasedLighting=e.imageBasedLighting,this._shouldDestroyImageBasedLighting=!1):(this._imageBasedLighting=new z0,this._shouldDestroyImageBasedLighting=!0),this.lightColor=e.lightColor,this.backFaceCulling=A(e.backFaceCulling,!0),this._enableShowOutline=A(e.enableShowOutline,!0),this.showOutline=A(e.showOutline,!0),this.outlineColor=A(e.outlineColor,H.BLACK),this.splitDirection=A(e.splitDirection,Z_.NONE),this._projectTo2D=A(e.projectTo2D,!1),this.debugFreezeFrame=A(e.debugFreezeFrame,!1),this.debugColorizeTiles=A(e.debugColorizeTiles,!1),this._enableDebugWireframe=A(e.enableDebugWireframe,!1),this.debugWireframe=A(e.debugWireframe,!1),this.debugWireframe===!0&&this._enableDebugWireframe===!1&&ki("tileset-debug-wireframe-ignored","enableDebugWireframe must be set to true in the Cesium3DTileset constructor, otherwise debugWireframe will be ignored."),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.debugShowContentBoundingVolume=A(e.debugShowContentBoundingVolume,!1),this.debugShowViewerRequestVolume=A(e.debugShowViewerRequestVolume,!1),this._tileDebugLabels=void 0,this.debugPickedTileLabelOnly=!1,this.debugPickedTile=void 0,this.debugPickPosition=void 0,this.debugShowGeometricError=A(e.debugShowGeometricError,!1),this.debugShowRenderingStatistics=A(e.debugShowRenderingStatistics,!1),this.debugShowMemoryUsage=A(e.debugShowMemoryUsage,!1),this.debugShowUrl=A(e.debugShowUrl,!1),this.examineVectorLinesFunction=void 0,this._metadataExtension=void 0,this._customShader=e.customShader;let t=A(e.featureIdLabel,"featureId_0");typeof t=="number"&&(t=`featureId_${t}`),this._featureIdLabel=t;let n=A(e.instanceFeatureIdLabel,"instanceFeatureId_0");typeof n=="number"&&(n=`instanceFeatureId_${n}`),this._instanceFeatureIdLabel=n,this._schemaLoader=void 0;const i=this;let o;this._readyPromise=Promise.resolve(e.url).then(function(r){let s;return o=Me.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,Mr.loadJson(o)}).then(function(r){if(!i.isDestroyed())return Ret(i,r)}).then(function(r){if(i.isDestroyed())return;i._root=i.loadTileset(o,r);const s=l(r.asset.gltfUpAxis)?cs.fromName(r.asset.gltfUpAxis):cs.Y,a=A(e.modelUpAxis,s),c=A(e.modelForwardAxis,cs.X),u=r.asset;i._asset=u,i._properties=r.properties,i._geometricError=r.geometricError,i._extensionsUsed=r.extensionsUsed,i._extensions=r.extensions,i._modelUpAxis=a,i._modelForwardAxis=c,i._extras=r.extras;const d=u.extras;if(l(d)&&l(d.cesium)&&l(d.cesium.credits)){const p=d.cesium.credits;let y=i._credits;l(y)||(y=[],i._credits=y);for(let b=0;b<p.length;++b){const C=p[b];y.push(new ai(C.html,i._showCreditsOnScreen))}}const m=i._root.createBoundingVolume(r.root.boundingVolume,B.IDENTITY).boundingSphere.center,g=i._ellipsoid.cartesianToCartographic(m);return l(g)&&g.height>lo._defaultMinTerrainHeight&&(i._initialClippingPlanesOriginMatrix=cn.eastNorthUpToFixedFrame(m)),i._clippingPlanesOriginMatrix=B.clone(i._initialClippingPlanesOriginMatrix),i})}Object.defineProperties(Mr.prototype,{isCesium3DTileset:{get:function(){return!0}},asset:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._asset}},extensions:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._extensions}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Io.setOwner(e,this,"_clippingPlanes")}},properties:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._properties}},ready:{get:function(){return l(this._root)}},readyPromise:{get:function(){return this._readyPromise}},tilesLoaded:{get:function(){return this._tilesLoaded}},resource:{get:function(){return this._resource}},basePath:{get:function(){return $p("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(l(this._metadataExtension))return this._metadataExtension.tileset}},schema:{get:function(){if(l(this._metadataExtension))return this._metadataExtension.schema}},maximumScreenSpaceError:{get:function(){return this._maximumScreenSpaceError},set:function(e){T.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){T.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){T.defined("pointCloudShading",e),this._pointCloudShading=e}},root:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._root}},boundingSphere:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._root.updateTransform(this._modelMatrix),this._root.boundingSphere}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){this._modelMatrix=B.clone(e,this._modelMatrix)}},timeSinceLoad:{get:function(){return this._timeSinceLoad}},totalMemoryUsageInBytes:{get:function(){const e=this._statistics;return e.texturesByteLength+e.geometryByteLength+e.batchTableByteLength}},clippingPlanesOriginMatrix:{get:function(){return l(this._clippingPlanesOriginMatrix)?(this._clippingPlanesOriginMatrixDirty&&(B.multiply(this.root.computedTransform,this._initialClippingPlanesOriginMatrix,this._clippingPlanesOriginMatrix),this._clippingPlanesOriginMatrixDirty=!1),this._clippingPlanesOriginMatrix):B.IDENTITY}},styleEngine:{get:function(){return this._styleEngine}},statistics:{get:function(){return this._statistics}},classificationType:{get:function(){return this._classificationType}},ellipsoid:{get:function(){return this._ellipsoid}},foveatedConeSize:{get:function(){return this._foveatedConeSize},set:function(e){T.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),T.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){T.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),T.typeOf.number.lessThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,this.maximumScreenSpaceError),this._foveatedMinimumScreenSpaceErrorRelaxation=e}},extras:{get:function(){if(!this.ready)throw new x("The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.");return this._extras}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){T.typeOf.object("imageBasedLighting",this._imageBasedLighting),e!==this._imageBasedLighting&&(this._shouldDestroyImageBasedLighting&&!this._imageBasedLighting.isDestroyed()&&this._imageBasedLighting.destroy(),this._imageBasedLighting=e,this._shouldDestroyImageBasedLighting=!1)}},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}`),T.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),T.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}});Mr.loadJson=function(e){return Me.createIfNeeded(e).fetchJson()};Mr.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};Mr.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!l(i))throw new Ie("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new Ie("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");l(t.extensionsRequired)&&Mr.checkSupportedExtensions(t.extensionsRequired);const o=this._statistics,r=i.tilesetVersion;l(r)&&(this._basePath+=`?v=${r}`,e=e.clone(),e.setQueryParameters({v:r}));const s=gG(this,e,t.root,n);l(n)&&(n.children.push(s),s._depth=n._depth+1);const a=[];for(a.push(s);a.length>0;){const c=a.pop();++o.numberOfTilesTotal,this._allTilesAdditive=this._allTilesAdditive&&c.refine===Pa.ADD;const u=c._header.children;if(l(u)){const d=u.length;for(let h=0;h<d;++h){const m=u[h],g=gG(this,e,m,c);c.children.push(g),g._depth=c._depth+1,a.push(g)}}this._cullWithChildrenBounds&&Det.checkChildrenWithinParent(c)}return s};function gG(e,t,n,i){if(l(n.implicitTiling)||hr(n,"3DTILES_implicit_tiling")){const r=e.schema,s=new Oet(t,n,r),a=new fo({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),c=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,d=ht(n,!0);d.contents=[{uri:c}],delete d.content,delete d.extensions;const h=new uo(e,t,d,i);return h.implicitTileset=s,h.implicitCoordinates=a,h}return new uo(e,t,n,i)}function Ret(e,t){const n=hr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let i;if(l(n.schemaUri)){const o=e._resource.getDerivedResource({url:n.schemaUri});i=yt.loadSchema({resource:o})}else if(l(n.schema))i=yt.loadSchema({schema:n.schema});else return Promise.resolve(t);return e._schemaLoader=i,i.promise.then(function(o){return e._metadataExtension=new IZ({schema:o.schema,metadataJson:n}),t})}const yG=new f,Net=new Ce,Met=new B,Fet=new f,zet=new f,Uet=new f;function Het(e,t){let n,i,o,r,s;const a=t.camera,c=e._root,u=c.contentBoundingVolume;if(u instanceof fd)n=f.normalize(a.positionWC,yG),i=a.directionWC,o=a.positionCartographic.height,r=u.minimumHeight,s=u.maximumHeight;else{const C=B.inverseTransformation(c.computedTransform,Met),E=t.mapProjection.ellipsoid,w=u.boundingVolume,S=B.multiplyByPoint(C,w.center,Fet);if(f.magnitude(S)>E.minimumRadius){const P=Ce.fromCartesian(S,E,Net);n=f.normalize(a.positionWC,yG),i=a.directionWC,o=a.positionCartographic.height,r=0,s=P.height*2}else{const P=B.multiplyByPoint(C,a.positionWC,zet);if(n=f.UNIT_Z,i=B.multiplyByPointAsVector(C,a.directionWC,Uet),i=f.normalize(i,i),o=P.z,u instanceof _u){const L=c._header.boundingVolume.box[11];r=S.z-L,s=S.z+L}else if(u instanceof rh){const L=w.radius;r=S.z-L,s=S.z+L}}}const d=e.dynamicScreenSpaceErrorHeightFalloff,h=r+(s-r)*d,m=s,g=M.clamp((o-h)/(m-h),0,1);let y=1-Math.abs(f.dot(i,n));y=y*(1-g);let b=e.dynamicScreenSpaceErrorDensity;b*=y,e._dynamicScreenSpaceErrorComputedDensity=b}function Vet(e,t){if(t.hasEmptyContent)return;const n=e._statistics,i=t.contentExpired,o=t.requestContent();if(o>0){n.numberOfAttemptedRequests+=o;return}i&&(t.hasTilesetContent||t.hasImplicitContent?Zet(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(jet(e,t)).catch(function(r){}),t.contentReadyPromise.then($et(e,t)).catch(qet(e,t))}function ket(e,t){return e._priority-t._priority}Mr.prototype.postPassesUpdate=function(e){this.ready&&(Get(this,e),ttt(this,e),this._cache.unloadTiles(this,BZ),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};Mr.prototype.prePassesUpdate=function(e){if(!this.ready)return;Xet(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,l(t)&&t.enabled&&t.update(e),l(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time)),this._timeSinceLoad=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!l(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&Het(this,e),e.newFrame&&this._cache.reset()};function Get(e,t){const n=e._requestedTilesInFlight;let i=0;const o=n.length;for(let r=0;r<o;++r){const s=n[r],a=t.frameNumber-s._touchedFrame>=1;if(s._contentState!==Go.LOADING){++i;continue}else if(a){s.cancelRequests(),++i;continue}i>0&&(n[r-i]=s)}n.length-=i}function Wet(e,t){const n=e._requestedTiles,i=n.length;n.sort(ket);for(let o=0;o<i;++o)Vet(e,n[o])}function jet(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function qet(e,t){return function(n){if(t._contentState!==Go.FAILED)return;const i=t._contentResource.url,o=l(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 $et(e,t){return function(n){--e._statistics.numberOfTilesProcessing,l(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 Yet(e){const t=e._processingQueue,n=t.length;let i=0;for(let o=0;o<n;++o){const r=t[o];if(r._contentState!==Go.PROCESSING){++i;continue}i>0&&(t[o-i]=r)}t.length-=i}function Xet(e,t){Yet(e);const n=e._processingQueue,i=n.length;for(let o=0;o<i;++o)n[o].process(e,t)}const Kx=new f,Ket={maximumFractionDigits:3};function AG(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,Ket):Math.round(t).toLocaleString()}function RO(e){const t=e.boundingVolume.boundingVolume,n=t.halfAxes,i=t.radius;let o=f.clone(t.center,Kx);if(l(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(l(i)){let r=f.normalize(t.center,Kx);r=f.multiplyByScalar(r,.75*i,Kx),o=f.add(r,t.center,Kx)}return o}function NO(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: ${AG(e.content.texturesByteLength)}`,i+=`
|
||
Geometry Memory: ${AG(e.content.geometryByteLength)}`,o+=2),t.debugShowUrl)if(e.hasMultipleContents){i+=`
|
||
Urls:`;const 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++;const 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 Jet(e,t){let n,i;const o=e._selectedTiles,r=o.length,s=e._emptyTiles,a=s.length;if(e._tileDebugLabels.removeAll(),e.debugPickedTileLabelOnly){if(l(e.debugPickedTile)){const c=l(e.debugPickPosition)?e.debugPickPosition:RO(e.debugPickedTile),u=NO(e.debugPickedTile,e,c);u.pixelOffset=new j(15,-15)}}else{for(n=0;n<r;++n)i=o[n],NO(i,e,RO(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&NO(i,e,RO(i))}e._tileDebugLabels.update(t)}function Qet(e,t,n){e._styleEngine.applyStyle(e),e._styleApplied=!0;const i=n.isRender,o=e._statistics,r=t.commandList,s=r.length,a=e._selectedTiles,c=a.length,u=e._emptyTiles,d=u.length,h=e.tileVisible;let m,g;const p=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,p&&(l(e._stencilClearCommand)||(e._stencilClearCommand=new co({stencil:0,pass:Ne.CESIUM_3D_TILE,renderState:et.fromCache({stencilMask:Rt.SKIP_LOD_MASK})})),r.push(e._stencilClearCommand));const y=r.length;for(m=0;m<c;++m)g=a[m],i&&h.raiseEvent(g),g.update(e,t,n),o.incrementSelectionCounts(g.content),++o.selected;for(m=0;m<d;++m)g=u[m],g.update(e,t,n);let b=r.length-y;if(e._backfaceCommands.trim(),p){const C=e._backfaceCommands.values,E=C.length;for(r.length+=E,m=b-1;m>=0;--m)r[y+E+m]=r[y+m];for(m=0;m<E;++m)r[y+m]=C[m]}b=r.length-s,o.numberOfCommands=b,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&b>0&&e._pointCloudEyeDomeLighting.update(t,s,e.pointCloudShading,e.boundingSphere),i&&(e.debugShowGeometricError||e.debugShowRenderingStatistics||e.debugShowMemoryUsage||e.debugShowUrl?(l(e._tileDebugLabels)||(e._tileDebugLabels=new Mc),Jet(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const LZ=[];function Zet(e,t){const n=t,i=LZ;for(i.push(t);i.length>0;){t=i.pop();const o=t.children,r=o.length;for(let s=0;s<r;++s)i.push(o[s]);t!==n&&(ett(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function BZ(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function ett(e,t){e._cache.unloadTile(e,t,BZ),t.destroy()}Mr.prototype.trimLoadedTiles=function(){this._cache.trim()};function ttt(e,t){const n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;ad.clone(n,i);const 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 ntt(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 itt(e,t){(t.frameNumber!==e._updatedModelMatrixFrame||!l(e._previousModelMatrix))&&(e._updatedModelMatrixFrame=t.frameNumber,e._modelMatrixChanged=!B.equals(e.modelMatrix,e._previousModelMatrix),e._modelMatrixChanged&&(e._previousModelMatrix=B.clone(e.modelMatrix,e._previousModelMatrix)))}function ott(e,t,n,i){if(t.mode===le.MORPHING||!e.ready)return!1;const o=e._statistics;o.clear();const r=i.isRender;++e._updatedVisibilityFrame,ntt(e),itt(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const s=i.traversal.selectTiles(e,t);if(i.requestTiles&&Wet(e),Qet(e,t,i),ad.clone(o,n),r){const a=e._credits;if(l(a)&&o.selected!==0){const c=a.length;for(let u=0;u<c;++u){const d=a[u];d.showOnScreen=e._showCreditsOnScreen,t.creditDisplay.addCredit(d)}}}return s}Mr.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};Mr.prototype.updateForPass=function(e,t){T.typeOf.object("frameState",e),T.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===ra.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===ra.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===ra.REQUEST_RENDER_MODE_DEFER_CHECK&&(!this._cullRequestsWhileMoving&&this.foveatedTimeDelay<=0||!this.show))return;const i=e.commandList,o=e.camera,r=e.cullingVolume;t.ready=!1;const s=ra.getPassOptions(n),a=s.ignoreCommands,c=A(t.commandList,i),u=c.length;e.commandList=c,e.camera=A(t.camera,o),e.cullingVolume=A(t.cullingVolume,r);const d=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=ott(this,e,d,s)),a&&(c.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};Mr.prototype.hasExtension=function(e){return l(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};Mr.prototype.isDestroyed=function(){return!1};Mr.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),l(this._schemaLoader)&&yt.unload(this._schemaLoader),l(this._root)){const e=LZ;for(e.push(this._root);e.length>0;){const t=e.pop();t.destroy();const 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,He(this)};Mr.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};Mr.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!Mr.supportedExtensions[e[t]])throw new Ie(`Unsupported 3D Tiles Extension: ${e[t]}`)};const rtt=new B;function Mp(e,t){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(Mp.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new vt,this._onCollectionChanged(t,t.values,[],[])}Mp.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._entitiesToVisualize.values,n=this._tilesetHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._tileset;let c,u=n[s.id];const d=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0);let h;if(d&&(h=s.computeModelMatrix(e,rtt),c=Me.createIfNeeded(Z.getValueOrUndefined(a._uri,e))),!d){l(u)&&(u.tilesetPrimitive.show=!1);continue}let m=l(u)?u.tilesetPrimitive:void 0;(!l(m)||c.url!==u.url)&&(l(m)&&(i.removeAndDestroy(m),delete n[s.id]),m=new Mr({url:c}),m.id=s,i.add(m),u={tilesetPrimitive:m,url:c.url,loadFail:!1},n[s.id]=u,stt(m,s,n)),m.show=!0,l(h)&&(m.modelMatrix=h),m.maximumScreenSpaceError=Z.getValueOrDefault(a.maximumScreenSpaceError,e,m.maximumScreenSpaceError)}return!0};Mp.prototype.isDestroyed=function(){return!1};Mp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Mp.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)FR(this,e[i],t,n);return He(this)};Mp.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new x("entity is required.");if(!l(t))throw new x("result is required.");const n=this._tilesetHash[e.id];if(!l(n)||n.loadFail)return gt.FAILED;const i=n.tilesetPrimitive;return!l(i)||!i.show?gt.FAILED:i.ready?(fe.clone(i.boundingSphere,t),gt.DONE):gt.PENDING};Mp.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._tilesetHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],l(r._tileset)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],l(r._tileset)?s.set(r.id,r):(FR(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],FR(this,r,a,c),s.remove(r.id)};function FR(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}function stt(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}const bG={id:void 0};function qT(e){if(e._firing){e._refire=!0;return}if(e._suspendCount===0){const 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;const 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 ma(e){this._owner=e,this._entities=new vt,this._addedEntities=new vt,this._removedEntities=new vt,this._changedEntities=new vt,this._suspendCount=0,this._collectionChanged=new Ke,this._id=Ms(),this._show=!0,this._firing=!1,this._refire=!1}ma.prototype.suspendEvents=function(){this._suspendCount++};ma.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new x("resumeEvents can not be called before suspendEvents.");this._suspendCount--,qT(this)};Object.defineProperties(ma.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(!l(e))throw new x("value is required.");if(e===this._show)return;this.suspendEvents();let t;const 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++){const 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}}});ma.prototype.computeAvailability=function(){let e=ft.MAXIMUM_VALUE,t=ft.MINIMUM_VALUE;const n=this._entities.values;for(let i=0,o=n.length;i<o;i++){const s=n[i].availability;if(l(s)){const a=s.start,c=s.stop;ie.lessThan(a,e)&&!a.equals(ft.MINIMUM_VALUE)&&(e=a),ie.greaterThan(c,t)&&!c.equals(ft.MAXIMUM_VALUE)&&(t=c)}}return ft.MAXIMUM_VALUE.equals(e)&&(e=ft.MINIMUM_VALUE),ft.MINIMUM_VALUE.equals(t)&&(t=ft.MAXIMUM_VALUE),new rn({start:e,stop:t})};ma.prototype.add=function(e){if(!l(e))throw new x("entity is required.");e instanceof Nr||(e=new Nr(e));const t=e.id,n=this._entities;if(n.contains(t))throw new Ie(`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(ma.prototype._onEntityDefinitionChanged,this),qT(this),e};ma.prototype.remove=function(e){return l(e)?this.removeById(e.id):!1};ma.prototype.contains=function(e){if(!l(e))throw new x("entity is required");return this._entities.get(e.id)===e};ma.prototype.removeById=function(e){if(!l(e))return!1;const 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(ma.prototype._onEntityDefinitionChanged,this),qT(this),!0):!1};ma.prototype.removeAll=function(){const e=this._entities,t=e.length,n=e.values,i=this._addedEntities,o=this._removedEntities;for(let r=0;r<t;r++){const s=n[r],a=s.id,c=i.get(a);l(c)||(s.definitionChanged.removeEventListener(ma.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),qT(this)};ma.prototype.getById=function(e){if(!l(e))throw new x("id is required.");return this._entities.get(e)};ma.prototype.getOrCreateEntity=function(e){if(!l(e))throw new x("id is required.");let t=this._entities.get(e);return l(t)||(bG.id=e,t=new Nr(bG),this.add(t)),t};ma.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),qT(this)};function Nd(){this._removalFunctions=[]}Nd.prototype.add=function(e,t,n){if(!l(e))throw new x("event is required");const i=e.addEventListener(t,n);this._removalFunctions.push(i);const o=this;return function(){i();const r=o._removalFunctions;r.splice(r.indexOf(i),1)}};Nd.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};function dF(e,t){return ie.compare(e.start,t.start)}function Oo(e){if(this._intervals=[],this._changedEvent=new Ke,l(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(Oo.prototype,{changedEvent:{get:function(){return this._changedEvent}},start:{get:function(){const e=this._intervals;return e.length===0?void 0:e[0].start}},isStartIncluded:{get:function(){const e=this._intervals;return e.length===0?!1:e[0].isStartIncluded}},stop:{get:function(){const e=this._intervals,t=e.length;return t===0?void 0:e[t-1].stop}},isStopIncluded:{get:function(){const 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}}});Oo.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof Oo))return!1;const n=this._intervals,i=e._intervals,o=n.length;if(o!==i.length)return!1;for(let r=0;r<o;r++)if(!rn.equals(n[r],i[r],t))return!1;return!0};Oo.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._intervals[e]};Oo.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};Oo.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};Oo.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};Oo.prototype.contains=function(e){return this.indexOf(e)>=0};const MO=new rn;Oo.prototype.indexOf=function(e){if(!l(e))throw new x("date is required");const t=this._intervals;MO.start=e,MO.stop=e;let n=Bs(t,MO,dF);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&&rn.contains(t[n-1],e)?n-1:~n)};Oo.prototype.findInterval=function(e){e=A(e,A.EMPTY_OBJECT);const 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++){const c=r[s];if((!l(t)||c.start.equals(t))&&(!l(n)||c.stop.equals(n))&&(!l(i)||c.isStartIncluded===i)&&(!l(o)||c.isStopIncluded===o))return r[s]}};Oo.prototype.addInterval=function(e,t){if(!l(e))throw new x("interval is required");if(e.isEmpty)return;const n=this._intervals;if(n.length===0||ie.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=Bs(n,e,dF);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=ie.compare(n[i-1].stop,e.start),(o>0||o===0&&(n[i-1].isStopIncluded||e.isStartIncluded))&&((l(t)?t(n[i-1].data,e.data):n[i-1].data===e.data)?(ie.greaterThan(e.stop,n[i-1].stop)?e=new rn({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new rn({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=ie.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new rn({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 rn({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=ie.compare(e.stop,n[i].start),o>0||o===0&&(e.isStopIncluded||n[i].isStartIncluded));)if(l(t)?t(n[i].data,e.data):n[i].data===e.data)e=new rn({start:e.start,stop:ie.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:ie.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new rn({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)};Oo.prototype.removeInterval=function(e){if(!l(e))throw new x("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=Bs(t,e,dF);n<0&&(n=~n);let i=!1;for(n>0&&(ie.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(ie.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 rn({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 rn({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 rn({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&ie.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 rn({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new rn({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(ie.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new rn({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};Oo.prototype.intersect=function(e,t,n){if(!l(e))throw new x("other is required.");const i=new Oo;let o=0,r=0;const s=this._intervals,a=e._intervals;for(;o<s.length&&r<a.length;){const c=s[o],u=a[r];if(ie.lessThan(c.stop,u.start))++o;else if(ie.lessThan(u.stop,c.start))++r;else{if(l(n)||l(t)&&t(c.data,u.data)||!l(t)&&u.data===c.data){const d=rn.intersect(c,u,new rn,n);d.isEmpty||i.addInterval(d,t)}ie.lessThan(c.stop,u.stop)||c.stop.equals(u.stop)&&!c.isStopIncluded&&u.isStopIncluded?++o:++r}}return i};Oo.fromJulianDateArray=function(e,t){if(!l(e))throw new x("options is required.");if(!l(e.julianDates))throw new x("options.iso8601Array is required.");l(t)||(t=new Oo);const n=e.julianDates,i=n.length,o=e.dataCallback,r=A(e.isStartIncluded,!0),s=A(e.isStopIncluded,!0),a=A(e.leadingInterval,!1),c=A(e.trailingInterval,!1);let u,d=0;a&&(++d,u=new rn({start:ft.MINIMUM_VALUE,stop:n[0],isStartIncluded:!0,isStopIncluded:!r}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u));for(let h=0;h<i-1;++h){let m=n[h];const g=n[h+1];u=new rn({start:m,stop:g,isStartIncluded:t.length===d?r:!0,isStopIncluded:h===i-2?s:!1}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u),m=g}return c&&(u=new rn({start:n[i-1],stop:ft.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u)),t};const Gs=new uT,WA=[0,31,28,31,30,31,30,31,31,30,31,30,31];function zR(e,t,n){l(n)||(n=new ie),ie.toGregorianDate(e,Gs);let i=Gs.millisecond+t.millisecond,o=Gs.second+t.second,r=Gs.minute+t.minute,s=Gs.hour+t.hour,a=Gs.day+t.day,c=Gs.month+t.month,u=Gs.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),WA[2]=zS(u)?29:28;a>WA[c]||c>=13;)a>WA[c]&&(a-=WA[c],++c),c>=13&&(--c,u+=Math.floor(c/12),c=c%12,++c),WA[2]=zS(u)?29:28;return Gs.millisecond=i,Gs.second=o,Gs.minute=r,Gs.hour=s,Gs.day=a,Gs.month=c,Gs.year=u,ie.fromGregorianDate(Gs,n)}const att=new ie,ctt=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function RZ(e,t){if(!l(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"){const n=e.match(ctt);if(!l(n))return!1;if(l(n[1])&&(t.year=Number(n[1].replace(",","."))),l(n[2])&&(t.month=Number(n[2].replace(",","."))),l(n[3])&&(t.day=Number(n[3].replace(",","."))*7),l(n[4])&&(t.day+=Number(n[4].replace(",","."))),l(n[5])&&(t.hour=Number(n[5].replace(",","."))),l(n[6])&&(t.minute=Number(n[6].replace(",","."))),l(n[7])){const i=Number(n[7].replace(",","."));t.second=Math.floor(i),t.millisecond=i%1*1e3}}else e[e.length-1]!=="Z"&&(e+="Z"),ie.toGregorianDate(ie.fromIso8601(e,att),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const Kb=new uT;Oo.fromIso8601=function(e,t){if(!l(e))throw new x("options is required.");if(!l(e.iso8601))throw new x("options.iso8601 is required.");const n=e.iso8601.split("/"),i=ie.fromIso8601(n[0]),o=ie.fromIso8601(n[1]),r=[];if(!RZ(n[2],Kb))r.push(i,o);else{let s=ie.clone(i);for(r.push(s);ie.compare(s,o)<0;)s=zR(s,Kb),ie.compare(o,s)<=0&&ie.clone(o,s),r.push(s)}return Oo.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Oo.fromIso8601DateArray=function(e,t){if(!l(e))throw new x("options is required.");if(!l(e.iso8601Dates))throw new x("options.iso8601Dates is required.");return Oo.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return ie.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};Oo.fromIso8601DurationArray=function(e,t){if(!l(e))throw new x("options is required.");if(!l(e.epoch))throw new x("options.epoch is required.");if(!l(e.iso8601Durations))throw new x("options.iso8601Durations is required.");const n=e.epoch,i=e.iso8601Durations,o=A(e.relativeToPrevious,!1),r=[];let s,a;const c=i.length;for(let u=0;u<c;++u)(RZ(i[u],Kb)||u===0)&&(o&&l(a)?s=zR(a,Kb):s=zR(n,Kb),r.push(s),a=s);return Oo.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};function ltt(e,t,n,i){function o(){n.raiseEvent(e)}const r=[];t.removeAll();const s=i.length;for(let a=0;a<s;a++){const c=i.get(a);l(c.data)&&r.indexOf(c.data)===-1&&t.add(c.data.definitionChanged,o)}}function B_(){this._eventHelper=new Nd,this._definitionChanged=new Ke,this._intervals=new Oo,this._intervals.changedEvent.addEventListener(B_.prototype._intervalsChanged,this)}Object.defineProperties(B_.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});B_.prototype.getValue=function(e,t){if(!l(e))throw new x("time is required");const n=this._intervals.findDataForIntervalContainingDate(e);if(l(n))return n.getValue(e,t)};B_.prototype.equals=function(e){return this===e||e instanceof B_&&this._intervals.equals(e._intervals,Z.equals)};B_.prototype._intervalsChanged=function(){ltt(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};function Fp(e){this._referenceFrame=A(e,fa.FIXED),this._definitionChanged=new Ke,this._composite=new B_,this._composite.definitionChanged.addEventListener(Fp.prototype._raiseDefinitionChanged,this)}Object.defineProperties(Fp.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}}});Fp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,fa.FIXED,t)};Fp.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new x("time is required.");if(!l(t))throw new x("referenceFrame is required.");const i=this._composite._intervals.findDataForIntervalContainingDate(e);if(l(i))return i.getValueInReferenceFrame(e,t,n)};Fp.prototype.equals=function(e){return this===e||e instanceof Fp&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Z.equals)};Fp.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const utt={ROUNDED:0,MITERED:1,BEVELED:2},cr=Object.freeze(utt),ns=[new f,new f],dtt=new f,ftt=new f,htt=new f,ptt=new f,mtt=new f,_tt=new f,gtt=new f,ytt=new f,Att=new f,py=new f,Jx=new f,YC={};let FO=new Ce;function btt(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];FO=t.cartesianToCartographic(o,FO),n[i]=FO.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function zO(e,t,n,i){const o=e[0],r=e[1],s=f.angleBetween(o,r),a=Math.ceil(s/i),c=new Array(a);let u;if(t===n){for(u=0;u<a;u++)c[u]=t;return c.push(n),c}const h=(n-t)/a;for(u=1;u<a;u++){const m=t+u*h;c[u]=m}return c[0]=t,c.push(n),c}const Ev=new f,xv=new f;function Ctt(e,t,n,i){const o=new ys(n,i),r=o.projectPointOntoPlane(f.add(n,e,Ev),Ev),s=o.projectPointOntoPlane(f.add(n,t,xv),xv),a=j.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}const Ttt=new f(-1,0,0);let Bm=new B;const Ett=new B;let UO=new J;const xtt=J.IDENTITY.clone(),wtt=new f,Stt=new oe,CG=new f;function rf(e,t,n,i,o,r,s,a){let c=wtt,u=Stt;Bm=cn.eastNorthUpToFixedFrame(e,o,Bm),c=B.multiplyByPointAsVector(Bm,Ttt,c),c=f.normalize(c,c);const d=Ctt(c,t,e,o);UO=J.fromRotationZ(d,UO),CG.z=r,Bm=B.multiplyTransformation(Bm,B.fromRotationTranslation(UO,CG,Ett),Bm);const h=xtt;h[0]=s;for(let m=0;m<a;m++)for(let g=0;g<n.length;g+=3)u=f.fromArray(n,g,u),u=J.multiplyByVector(h,u,u),u=B.multiplyByPoint(Bm,u,u),i.push(u.x,u.y,u.z);return i}const vtt=new f;function HO(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){const c=f.fromArray(e,a,vtt);i=rf(c,t,n,i,o,r[a/3],s,1)}return i}function Dtt(e,t){const n=e.length,i=new Array(n*6);let o=0;const r=t.x+t.width/2,s=t.y+t.height/2;let 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];const u=a.x-r,d=a.y-s;i[o++]=u,i[o++]=0,i[o++]=d,i[o++]=u,i[o++]=0,i[o++]=d}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}function TG(e,t){const n=e.length,i=new Array(n*3);let o=0;const 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}const EG=new Te,xG=new f,wG=new J;function SG(e,t,n,i,o,r,s,a,c,u){const d=f.angleBetween(f.subtract(t,e,py),f.subtract(n,e,Jx)),h=i===cr.BEVELED?0:Math.ceil(d/M.toRadians(5));let m;o?m=J.fromQuaternion(Te.fromAxisAngle(f.negate(e,py),d/(h+1),EG),wG):m=J.fromQuaternion(Te.fromAxisAngle(e,d/(h+1),EG),wG);let g,p;if(t=f.clone(t,xG),h>0){const y=u?2:1;for(let b=0;b<h;b++)t=J.multiplyByVector(m,t,t),g=f.subtract(t,e,py),g=f.normalize(g,g),o||(g=f.negate(g,g)),p=r.scaleToGeodeticSurface(t,Jx),s=rf(p,g,a,s,r,c,1,y)}else g=f.subtract(t,e,py),g=f.normalize(g,g),o||(g=f.negate(g,g)),p=r.scaleToGeodeticSurface(t,Jx),s=rf(p,g,a,s,r,c,1,1),n=f.clone(n,xG),g=f.subtract(n,e,py),g=f.normalize(g,g),o||(g=f.negate(g,g)),p=r.scaleToGeodeticSurface(n,Jx),s=rf(p,g,a,s,r,c,1,1);return s}YC.removeDuplicatesFromShape=function(e){const t=e.length,n=[];for(let i=t-1,o=0;o<t;i=o++){const r=e[i],s=e[o];j.equals(r,s)||n.push(s)}return n};YC.angleIsGreaterThanPi=function(e,t,n,i){const o=new ys(n,i),r=o.projectPointOntoPlane(f.add(n,e,Ev),Ev),s=o.projectPointOntoPlane(f.add(n,t,xv),xv);return s.x*r.y-s.y*r.x>=0};const Itt=new f,Ptt=new f;YC.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=btt(e,r),a=i._granularity,c=i._cornerType,u=o?Dtt(t,n):TG(t,n),d=o?TG(t,n):void 0,h=n.height/2,m=n.width/2;let g=e.length,p=[],y=o?[]:void 0,b=dtt,C=ftt,E=htt,w=ptt,S=mtt,P=_tt,L=gtt,z=ytt,R=Att,F=e[0],U=e[1];w=r.geodeticSurfaceNormal(F,w),b=f.subtract(U,F,b),b=f.normalize(b,b),z=f.cross(w,b,z),z=f.normalize(z,z);let D=s[0],I=s[1];o&&(y=rf(F,z,d,y,r,D+h,1,1)),R=f.clone(F,R),F=U,C=f.negate(b,C);let _,v;for(let V=1;V<g-1;V++){const k=o?2:1;if(U=e[V+1],F.equals(U)){ki("Positions are too close and are considered equivalent with rounding error.");continue}b=f.subtract(U,F,b),b=f.normalize(b,b),E=f.add(b,C,E),E=f.normalize(E,E),w=r.geodeticSurfaceNormal(F,w);const G=f.multiplyByScalar(w,f.dot(b,w),Itt);f.subtract(b,G,G),f.normalize(G,G);const W=f.multiplyByScalar(w,f.dot(C,w),Ptt);if(f.subtract(C,W,W),f.normalize(W,W),!M.equalsEpsilon(Math.abs(f.dot(G,W)),1,M.EPSILON7)){E=f.cross(E,w,E),E=f.cross(w,E,E),E=f.normalize(E,E);const q=1/Math.max(.25,f.magnitude(f.cross(E,C,py))),te=YC.angleIsGreaterThanPi(b,C,F,r);te?(S=f.add(F,f.multiplyByScalar(E,q*m,E),S),P=f.add(S,f.multiplyByScalar(z,m,P),P),ns[0]=f.clone(R,ns[0]),ns[1]=f.clone(P,ns[1]),_=zO(ns,D+h,I+h,a),v=yr.generateArc({positions:ns,granularity:a,ellipsoid:r}),p=HO(v,z,u,p,r,_,1),z=f.cross(w,b,z),z=f.normalize(z,z),L=f.add(S,f.multiplyByScalar(z,m,L),L),c===cr.ROUNDED||c===cr.BEVELED?SG(S,P,L,c,te,r,p,u,I+h,o):(E=f.negate(E,E),p=rf(F,E,u,p,r,I+h,q,k)),R=f.clone(L,R)):(S=f.add(F,f.multiplyByScalar(E,q*m,E),S),P=f.add(S,f.multiplyByScalar(z,-m,P),P),ns[0]=f.clone(R,ns[0]),ns[1]=f.clone(P,ns[1]),_=zO(ns,D+h,I+h,a),v=yr.generateArc({positions:ns,granularity:a,ellipsoid:r}),p=HO(v,z,u,p,r,_,1),z=f.cross(w,b,z),z=f.normalize(z,z),L=f.add(S,f.multiplyByScalar(z,-m,L),L),c===cr.ROUNDED||c===cr.BEVELED?SG(S,P,L,c,te,r,p,u,I+h,o):p=rf(F,E,u,p,r,I+h,q,k),R=f.clone(L,R)),C=f.negate(b,C)}else p=rf(R,z,u,p,r,D+h,1,1),R=F;D=I,I=s[V+1],F=U}ns[0]=f.clone(R,ns[0]),ns[1]=f.clone(F,ns[1]),_=zO(ns,D+h,I+h,a),v=yr.generateArc({positions:ns,granularity:a,ellipsoid:r}),p=HO(v,z,u,p,r,_,1),o&&(y=rf(F,z,d,y,r,I+h,1,1)),g=p.length;const O=o?g+y.length:g,N=new Float64Array(O);return N.set(p),o&&N.set(y,g),N};const XC=YC,fF={},ky=new f,NZ=new f,Ott=new f,vG=new f,Ta=[new f,new f],MZ=new f,FZ=new f,zZ=new f,Ltt=new f,Btt=new f,Rtt=new f,Ntt=new f,Mtt=new f,Ftt=new f,ztt=new f,DG=new Te,IG=new J;function wv(e,t,n,i,o){const r=f.angleBetween(f.subtract(t,e,ky),f.subtract(n,e,NZ)),s=i===cr.BEVELED?1:Math.ceil(r/M.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 u;o?u=J.fromQuaternion(Te.fromAxisAngle(f.negate(e,ky),r/s,DG),IG):u=J.fromQuaternion(Te.fromAxisAngle(e,r/s,DG),IG);let d=0;t=f.clone(t,ky);for(let h=0;h<s;h++)t=J.multiplyByVector(u,t,t),c[d++]=t.x,c[d++]=t.y,c[d++]=t.z;return c}function Utt(e){let t=MZ,n=FZ,i=zZ,o=e[1];n=f.fromArray(e[1],o.length-3,n),i=f.fromArray(e[0],0,i),t=f.midpoint(n,i,t);const r=wv(t,n,i,cr.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=f.fromArray(a,a.length-3,n),i=f.fromArray(o,0,i),t=f.midpoint(n,i,t);const c=wv(t,n,i,cr.ROUNDED,!1);return[r,c]}function PG(e,t,n,i){let o=ky;return i||(t=f.negate(t,t)),o=f.add(e,t,o),[o.x,o.y,o.z,n.x,n.y,n.z]}function VO(e,t,n,i){const o=new Array(e.length),r=new Array(e.length),s=f.multiplyByScalar(t,n,ky),a=f.negate(s,NZ);let c=0,u=e.length-1;for(let d=0;d<e.length;d+=3){const h=f.fromArray(e,d,Ott),m=f.add(h,a,vG);o[c++]=m.x,o[c++]=m.y,o[c++]=m.z;const g=f.add(h,s,vG);r[u--]=g.z,r[u--]=g.y,r[u--]=g.x}return i.push(o,r),i}fF.addAttribute=function(e,t,n,i){const o=t.x,r=t.y,s=t.z;l(n)&&(e[n]=o,e[n+1]=r,e[n+2]=s),l(i)&&(e[i]=s,e[i-1]=r,e[i-2]=o)};const Htt=new f,Vtt=new f;fF.computePositions=function(e){const t=e.granularity,n=e.positions,i=e.ellipsoid,o=e.width/2,r=e.cornerType,s=e.saveAttributes;let a=MZ,c=FZ,u=zZ,d=Ltt,h=Btt,m=Rtt,g=Ntt,p=Mtt,y=Ftt,b=ztt,C=[];const E=s?[]:void 0,w=s?[]:void 0;let S=n[0],P=n[1];c=f.normalize(f.subtract(P,S,c),c),a=i.geodeticSurfaceNormal(S,a),d=f.normalize(f.cross(a,c,d),d),s&&(E.push(d.x,d.y,d.z),w.push(a.x,a.y,a.z)),g=f.clone(S,g),S=P,u=f.negate(c,u);let L;const z=[];let R;const F=n.length;for(R=1;R<F-1;R++){a=i.geodeticSurfaceNormal(S,a),P=n[R+1],c=f.normalize(f.subtract(P,S,c),c),h=f.normalize(f.add(c,u,h),h);const D=f.multiplyByScalar(a,f.dot(c,a),Htt);f.subtract(c,D,D),f.normalize(D,D);const I=f.multiplyByScalar(a,f.dot(u,a),Vtt);if(f.subtract(u,I,I),f.normalize(I,I),!M.equalsEpsilon(Math.abs(f.dot(D,I)),1,M.EPSILON7)){h=f.cross(h,a,h),h=f.cross(a,h,h),h=f.normalize(h,h);const v=o/Math.max(.25,f.magnitude(f.cross(h,u,ky))),O=XC.angleIsGreaterThanPi(c,u,S,i);h=f.multiplyByScalar(h,v,h),O?(p=f.add(S,h,p),b=f.add(p,f.multiplyByScalar(d,o,b),b),y=f.add(p,f.multiplyByScalar(d,o*2,y),y),Ta[0]=f.clone(g,Ta[0]),Ta[1]=f.clone(b,Ta[1]),L=yr.generateArc({positions:Ta,granularity:t,ellipsoid:i}),C=VO(L,d,o,C),s&&(E.push(d.x,d.y,d.z),w.push(a.x,a.y,a.z)),m=f.clone(y,m),d=f.normalize(f.cross(a,c,d),d),y=f.add(p,f.multiplyByScalar(d,o*2,y),y),g=f.add(p,f.multiplyByScalar(d,o,g),g),r===cr.ROUNDED||r===cr.BEVELED?z.push({leftPositions:wv(p,m,y,r,O)}):z.push({leftPositions:PG(S,f.negate(h,h),y,O)})):(y=f.add(S,h,y),b=f.add(y,f.negate(f.multiplyByScalar(d,o,b),b),b),p=f.add(y,f.negate(f.multiplyByScalar(d,o*2,p),p),p),Ta[0]=f.clone(g,Ta[0]),Ta[1]=f.clone(b,Ta[1]),L=yr.generateArc({positions:Ta,granularity:t,ellipsoid:i}),C=VO(L,d,o,C),s&&(E.push(d.x,d.y,d.z),w.push(a.x,a.y,a.z)),m=f.clone(p,m),d=f.normalize(f.cross(a,c,d),d),p=f.add(y,f.negate(f.multiplyByScalar(d,o*2,p),p),p),g=f.add(y,f.negate(f.multiplyByScalar(d,o,g),g),g),r===cr.ROUNDED||r===cr.BEVELED?z.push({rightPositions:wv(y,m,p,r,O)}):z.push({rightPositions:PG(S,h,p,O)})),u=f.negate(c,u)}S=P}a=i.geodeticSurfaceNormal(S,a),Ta[0]=f.clone(g,Ta[0]),Ta[1]=f.clone(S,Ta[1]),L=yr.generateArc({positions:Ta,granularity:t,ellipsoid:i}),C=VO(L,d,o,C),s&&(E.push(d.x,d.y,d.z),w.push(a.x,a.y,a.z));let U;return r===cr.ROUNDED&&(U=Utt(C)),{positions:C,corners:z,lefts:E,normals:w,endPositions:U}};const Ui=fF,UZ=new f,HZ=new f,hS=new f,pS=new f,ktt=new f,VZ=new f,$h=new f,jg=new f;function kZ(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function Fl(e,t,n,i,o,r){const s=e.normals,a=e.tangents,c=e.bitangents,u=f.normalize(f.cross(n,t,$h),$h);r.normal&&Ui.addAttribute(s,t,i,o),r.tangent&&Ui.addAttribute(a,u,i,o),r.bitangent&&Ui.addAttribute(c,n,i,o)}function GZ(e,t,n){const i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,c=new Ji;let u,d=0,h=0,m,g=0,p;for(m=0;m<i.length;m+=2)p=i[m].length-3,d+=p,g+=p*2,h+=i[m+1].length-3;for(d+=3,h+=3,m=0;m<o.length;m++){u=o[m];const $=o[m].leftPositions;l($)?(p=$.length,d+=p,g+=p):(p=o[m].rightPositions.length,h+=p,g+=p)}const y=l(r);let b;y&&(b=r[0].length-3,d+=b,h+=b,b/=3,g+=b*6);const C=d+h,E=new Float64Array(C),w=t.normal?new Float32Array(C):void 0,S=t.tangent?new Float32Array(C):void 0,P=t.bitangent?new Float32Array(C):void 0,L={normals:w,tangents:S,bitangents:P};let z=0,R=C-1,F,U,D,I,_=UZ,v=HZ,O,N;const V=b/2,k=at.createTypedArray(C/3,g);let G=0;if(y){N=hS,O=pS;const $=r[0];for(_=f.fromArray(a,0,_),v=f.fromArray(s,0,v),m=0;m<V;m++)N=f.fromArray($,(V-1-m)*3,N),O=f.fromArray($,(V+m)*3,O),Ui.addAttribute(E,O,z),Ui.addAttribute(E,N,void 0,R),Fl(L,_,v,z,R,t),U=z/3,I=U+1,F=(R-2)/3,D=F-1,k[G++]=F,k[G++]=U,k[G++]=D,k[G++]=D,k[G++]=U,k[G++]=I,z+=3,R-=3}let W=0,K=0,q=i[W++],te=i[W++];E.set(q,z),E.set(te,R-te.length+1),v=f.fromArray(s,K,v);let Y,X;for(p=te.length-3,m=0;m<p;m+=3)Y=n.geodeticSurfaceNormal(f.fromArray(q,m,$h),$h),X=n.geodeticSurfaceNormal(f.fromArray(te,p-m,jg),jg),_=f.normalize(f.add(Y,X,_),_),Fl(L,_,v,z,R,t),U=z/3,I=U+1,F=(R-2)/3,D=F-1,k[G++]=F,k[G++]=U,k[G++]=D,k[G++]=D,k[G++]=U,k[G++]=I,z+=3,R-=3;for(Y=n.geodeticSurfaceNormal(f.fromArray(q,p,$h),$h),X=n.geodeticSurfaceNormal(f.fromArray(te,p,jg),jg),_=f.normalize(f.add(Y,X,_),_),K+=3,m=0;m<o.length;m++){let $;u=o[m];const se=u.leftPositions,ue=u.rightPositions;let re,he,ce=VZ,Q=hS,ne=pS;if(_=f.fromArray(a,K,_),l(se)){for(Fl(L,_,v,void 0,R,t),R-=3,re=I,he=D,$=0;$<se.length/3;$++)ce=f.fromArray(se,$*3,ce),k[G++]=re,k[G++]=he-$-1,k[G++]=he-$,Ui.addAttribute(E,ce,void 0,R),Q=f.fromArray(E,(he-$-1)*3,Q),ne=f.fromArray(E,re*3,ne),v=f.normalize(f.subtract(Q,ne,v),v),Fl(L,_,v,void 0,R,t),R-=3;ce=f.fromArray(E,re*3,ce),Q=f.subtract(f.fromArray(E,he*3,Q),ce,Q),ne=f.subtract(f.fromArray(E,(he-$)*3,ne),ce,ne),v=f.normalize(f.add(Q,ne,v),v),Fl(L,_,v,z,void 0,t),z+=3}else{for(Fl(L,_,v,z,void 0,t),z+=3,re=D,he=I,$=0;$<ue.length/3;$++)ce=f.fromArray(ue,$*3,ce),k[G++]=re,k[G++]=he+$,k[G++]=he+$+1,Ui.addAttribute(E,ce,z),Q=f.fromArray(E,re*3,Q),ne=f.fromArray(E,(he+$)*3,ne),v=f.normalize(f.subtract(Q,ne,v),v),Fl(L,_,v,z,void 0,t),z+=3;ce=f.fromArray(E,re*3,ce),Q=f.subtract(f.fromArray(E,(he+$)*3,Q),ce,Q),ne=f.subtract(f.fromArray(E,he*3,ne),ce,ne),v=f.normalize(f.negate(f.add(ne,Q,v),v),v),Fl(L,_,v,void 0,R,t),R-=3}for(q=i[W++],te=i[W++],q.splice(0,3),te.splice(te.length-3,3),E.set(q,z),E.set(te,R-te.length+1),p=te.length-3,K+=3,v=f.fromArray(s,K,v),$=0;$<te.length;$+=3)Y=n.geodeticSurfaceNormal(f.fromArray(q,$,$h),$h),X=n.geodeticSurfaceNormal(f.fromArray(te,p-$,jg),jg),_=f.normalize(f.add(Y,X,_),_),Fl(L,_,v,z,R,t),I=z/3,U=I-1,D=(R-2)/3,F=D+1,k[G++]=F,k[G++]=U,k[G++]=D,k[G++]=D,k[G++]=U,k[G++]=I,z+=3,R-=3;z-=3,R+=3}if(_=f.fromArray(a,a.length-3,_),Fl(L,_,v,z,R,t),y){z+=3,R-=3,N=hS,O=pS;const $=r[1];for(m=0;m<V;m++)N=f.fromArray($,(b-m-1)*3,N),O=f.fromArray($,m*3,O),Ui.addAttribute(E,N,void 0,R),Ui.addAttribute(E,O,z),Fl(L,_,v,z,R,t),I=z/3,U=I-1,D=(R-2)/3,F=D+1,k[G++]=F,k[G++]=U,k[G++]=D,k[G++]=D,k[G++]=U,k[G++]=I,z+=3,R-=3}if(c.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:E}),t.st){const $=new Float32Array(C/3*2);let se,ue,re=0;if(y){d/=3,h/=3;const he=Math.PI/(b+1);ue=1/(d-b+1),se=1/(h-b+1);let ce;const Q=b/2;for(m=Q+1;m<b+1;m++)ce=M.PI_OVER_TWO+he*m,$[re++]=se*(1+Math.cos(ce)),$[re++]=.5*(1+Math.sin(ce));for(m=1;m<h-b+1;m++)$[re++]=m*se,$[re++]=0;for(m=b;m>Q;m--)ce=M.PI_OVER_TWO-m*he,$[re++]=1-se*(1+Math.cos(ce)),$[re++]=.5*(1+Math.sin(ce));for(m=Q;m>0;m--)ce=M.PI_OVER_TWO-he*m,$[re++]=1-ue*(1+Math.cos(ce)),$[re++]=.5*(1+Math.sin(ce));for(m=d-b;m>0;m--)$[re++]=m*ue,$[re++]=1;for(m=1;m<Q+1;m++)ce=M.PI_OVER_TWO+he*m,$[re++]=ue*(1+Math.cos(ce)),$[re++]=.5*(1+Math.sin(ce))}else{for(d/=3,h/=3,ue=1/(d-1),se=1/(h-1),m=0;m<h;m++)$[re++]=m*se,$[re++]=0;for(m=d;m>0;m--)$[re++]=(m-1)*ue,$[re++]=1}c.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:$})}return t.normal&&(c.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:L.normals})),t.tangent&&(c.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:L.tangents})),t.bitangent&&(c.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:L.bitangents})),{attributes:c,indices:k}}function Gtt(e,t){if(!t.normal&&!t.tangent&&!t.bitangent&&!t.st)return e;const n=e.position.values;let i,o;(t.normal||t.bitangent)&&(i=e.normal.values,o=e.bitangent.values);const r=e.position.values.length/18,s=r*3,a=r*2,c=s*2;let u;if(t.normal||t.bitangent||t.tangent){const d=t.normal?new Float32Array(s*6):void 0,h=t.tangent?new Float32Array(s*6):void 0,m=t.bitangent?new Float32Array(s*6):void 0;let g=UZ,p=HZ,y=hS,b=pS,C=ktt,E=VZ,w=c;for(u=0;u<s;u+=3){const S=w+c;g=f.fromArray(n,u,g),p=f.fromArray(n,u+s,p),y=f.fromArray(n,(u+3)%s,y),p=f.subtract(p,g,p),y=f.subtract(y,g,y),b=f.normalize(f.cross(p,y,b),b),t.normal&&(Ui.addAttribute(d,b,S),Ui.addAttribute(d,b,S+3),Ui.addAttribute(d,b,w),Ui.addAttribute(d,b,w+3)),(t.tangent||t.bitangent)&&(E=f.fromArray(i,u,E),t.bitangent&&(Ui.addAttribute(m,E,S),Ui.addAttribute(m,E,S+3),Ui.addAttribute(m,E,w),Ui.addAttribute(m,E,w+3)),t.tangent&&(C=f.normalize(f.cross(E,b,C),C),Ui.addAttribute(h,C,S),Ui.addAttribute(h,C,S+3),Ui.addAttribute(h,C,w),Ui.addAttribute(h,C,w+3))),w+=6}if(t.normal){for(d.set(i),u=0;u<s;u+=3)d[u+s]=-i[u],d[u+s+1]=-i[u+1],d[u+s+2]=-i[u+2];e.normal.values=d}else e.normal=void 0;if(t.bitangent?(m.set(o),m.set(o,s),e.bitangent.values=m):e.bitangent=void 0,t.tangent){const S=e.tangent.values;h.set(S),h.set(S,s),e.tangent.values=h}}if(t.st){const d=e.st.values,h=new Float32Array(a*6);h.set(d),h.set(d,a);let m=a*2;for(let g=0;g<2;g++){for(h[m++]=d[0],h[m++]=d[1],u=2;u<a;u+=2){const p=d[u],y=d[u+1];h[m++]=p,h[m++]=y,h[m++]=p,h[m++]=y}h[m++]=d[0],h[m++]=d[1]}e.st.values=h}return e}function kO(e,t,n){n[t++]=e[0],n[t++]=e[1],n[t++]=e[2];for(let i=3;i<e.length;i+=3){const 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 Wtt(e,t){const n=new Fe({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=Ui.computePositions(e),r=GZ(o,n,i),s=e.height,a=e.extrudedHeight;let c=r.attributes;const u=r.indices;let d=c.position.values,h=d.length;const m=new Float64Array(h*6);let g=new Float64Array(h);g.set(d);let p=new Float64Array(h*4);d=no.scaleToGeodeticHeight(d,s,i),p=kO(d,0,p),g=no.scaleToGeodeticHeight(g,a,i),p=kO(g,h*2,p),m.set(d),m.set(g,h),m.set(p,h*2),c.position.values=m,c=Gtt(c,t);let y;const b=h/3;if(e.shadowVolume){const F=c.normal.values;h=F.length;let U=new Float32Array(h*6);for(y=0;y<h;y++)F[y]=-F[y];U.set(F,h),U=kO(F,h*4,U),c.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:U}),t.normal||(c.normal=void 0)}if(l(e.offsetAttribute)){let F=new Uint8Array(b*6);if(e.offsetAttribute===yn.TOP)F=F.fill(1,0,b).fill(1,b*2,b*4);else{const U=e.offsetAttribute===yn.NONE?0:1;F=F.fill(U)}c.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}const C=u.length,E=b+b,w=at.createTypedArray(m.length/3,C*2+E*3);w.set(u);let S=C;for(y=0;y<C;y+=3){const F=u[y],U=u[y+1],D=u[y+2];w[S++]=D+b,w[S++]=U+b,w[S++]=F+b}let P,L,z,R;for(y=0;y<E;y+=2)P=y+E,L=P+E,z=P+1,R=L+1,w[S++]=P,w[S++]=L,w[S++]=z,w[S++]=z,w[S++]=L,w[S++]=R;return{attributes:c,indices:w}}const OG=new f,jA=new f,tl=new Ce;function LG(e,t,n,i,o,r){const s=f.subtract(t,e,OG);f.normalize(s,s);const a=n.geodeticSurfaceNormal(e,jA),c=f.cross(s,a,OG);f.multiplyByScalar(c,i,c);let u=o.latitude,d=o.longitude,h=r.latitude,m=r.longitude;f.add(e,c,jA),n.cartesianToCartographic(jA,tl);let g=tl.latitude,p=tl.longitude;u=Math.min(u,g),d=Math.min(d,p),h=Math.max(h,g),m=Math.max(m,p),f.subtract(e,c,jA),n.cartesianToCartographic(jA,tl),g=tl.latitude,p=tl.longitude,u=Math.min(u,g),d=Math.min(d,p),h=Math.max(h,g),m=Math.max(m,p),o.latitude=u,o.longitude=d,r.latitude=h,r.longitude=m}const qc=new f,qA=new f,Ua=new Ce,Ha=new Ce;function WZ(e,t,n,i,o){e=kZ(e,t);const r=da(e,f.equalsEpsilon),s=r.length;if(s<2||n<=0)return new ge;const a=n*.5;Ua.latitude=Number.POSITIVE_INFINITY,Ua.longitude=Number.POSITIVE_INFINITY,Ha.latitude=Number.NEGATIVE_INFINITY,Ha.longitude=Number.NEGATIVE_INFINITY;let c,u;if(i===cr.ROUNDED){const m=r[0];f.subtract(m,r[1],qc),f.normalize(qc,qc),f.multiplyByScalar(qc,a,qc),f.add(m,qc,qA),t.cartesianToCartographic(qA,tl),c=tl.latitude,u=tl.longitude,Ua.latitude=Math.min(Ua.latitude,c),Ua.longitude=Math.min(Ua.longitude,u),Ha.latitude=Math.max(Ha.latitude,c),Ha.longitude=Math.max(Ha.longitude,u)}for(let m=0;m<s-1;++m)LG(r[m],r[m+1],t,a,Ua,Ha);const d=r[s-1];f.subtract(d,r[s-2],qc),f.normalize(qc,qc),f.multiplyByScalar(qc,a,qc),f.add(d,qc,qA),LG(d,qA,t,a,Ua,Ha),i===cr.ROUNDED&&(t.cartesianToCartographic(qA,tl),c=tl.latitude,u=tl.longitude,Ua.latitude=Math.min(Ua.latitude,c),Ua.longitude=Math.min(Ua.longitude,u),Ha.latitude=Math.max(Ha.latitude,c),Ha.longitude=Math.max(Ha.longitude,u));const h=l(o)?o:new ge;return h.north=Ha.latitude,h.south=Ua.latitude,h.east=Ha.longitude,h.west=Ua.longitude,h}function gu(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;T.defined("options.positions",t),T.defined("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._vertexFormat=Fe.clone(A(e.vertexFormat,Fe.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,cr.ROUNDED),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createCorridorGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this.packedLength=1+t.length*f.packedLength+me.packedLength+Fe.packedLength+7}gu.pack=function(e,t,n){T.defined("value",e),T.defined("array",t),n=A(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=f.packedLength)f.pack(i[r],t,n);return me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.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]=A(e._offsetAttribute,-1),t};const jZ=me.clone(me.UNIT_SPHERE),qZ=new Fe,$d={positions:void 0,ellipsoid:jZ,vertexFormat:qZ,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};gu.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let p=0;p<i;++p,t+=f.packedLength)o[p]=f.unpack(e,t);const r=me.unpack(e,t,jZ);t+=me.packedLength;const s=Fe.unpack(e,t,qZ);t+=Fe.packedLength;const a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],m=e[t++]===1,g=e[t];return l(n)?(n._positions=o,n._ellipsoid=me.clone(r,n._ellipsoid),n._vertexFormat=Fe.clone(s,n._vertexFormat),n._width=a,n._height=c,n._extrudedHeight=u,n._cornerType=d,n._granularity=h,n._shadowVolume=m,n._offsetAttribute=g===-1?void 0:g,n):($d.positions=o,$d.width=a,$d.height=c,$d.extrudedHeight=u,$d.cornerType=d,$d.granularity=h,$d.shadowVolume=m,$d.offsetAttribute=g===-1?void 0:g,new gu($d))};gu.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.positions,i=e.width;T.defined("options.positions",n),T.defined("options.width",i);const o=A(e.ellipsoid,me.WGS84),r=A(e.cornerType,cr.ROUNDED);return WZ(n,o,i,r,t)};gu.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=kZ(t,i);const o=da(t,f.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!M.equalsEpsilon(r,s,0,M.EPSILON2),c=e._vertexFormat,u={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let d;if(a)u.height=r,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,d=Wtt(u,c);else{const g=Ui.computePositions(u);if(d=GZ(g,c,i),d.attributes.position.values=no.scaleToGeodeticHeight(d.attributes.position.values,r,i),l(e._offsetAttribute)){const p=e._offsetAttribute===yn.NONE?0:1,y=d.attributes.position.values.length,b=new Uint8Array(y/3).fill(p);d.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}}const h=d.attributes,m=fe.fromVertices(h.position.values,void 0,3);return c.position||(d.attributes.position.values=void 0),new Lt({attributes:h,indices:d.indices,primitiveType:Ze.TRIANGLES,boundingSphere:m,offsetAttribute:e._offsetAttribute})};gu.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new gu({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Fe.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(gu.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=WZ(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const BG=new f,RG=new f,jtt=new f;function qtt(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function $Z(e,t){const n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new Ji;let a,c=0,u=0,d,h=0,m;for(d=0;d<i.length;d+=2)m=i[d].length-3,c+=m,h+=m/3*4,u+=i[d+1].length-3;for(c+=3,u+=3,d=0;d<o.length;d++){a=o[d];const O=o[d].leftPositions;l(O)?(m=O.length,c+=m,h+=m/3*2):(m=o[d].rightPositions.length,u+=m,h+=m/3*2)}const g=l(r);let p;g&&(p=r[0].length-3,c+=p,u+=p,p/=3,h+=p*4);const y=c+u,b=new Float64Array(y);let C=0,E=y-1,w,S,P,L,z,R;const F=p/2,U=at.createTypedArray(y/3,h+4);let D=0;if(U[D++]=C/3,U[D++]=(E-2)/3,g){n.push(C/3),R=BG,z=RG;const O=r[0];for(d=0;d<F;d++)R=f.fromArray(O,(F-1-d)*3,R),z=f.fromArray(O,(F+d)*3,z),Ui.addAttribute(b,z,C),Ui.addAttribute(b,R,void 0,E),S=C/3,L=S+1,w=(E-2)/3,P=w-1,U[D++]=w,U[D++]=P,U[D++]=S,U[D++]=L,C+=3,E-=3}let I=0,_=i[I++],v=i[I++];for(b.set(_,C),b.set(v,E-v.length+1),m=v.length-3,n.push(C/3,(E-2)/3),d=0;d<m;d+=3)S=C/3,L=S+1,w=(E-2)/3,P=w-1,U[D++]=w,U[D++]=P,U[D++]=S,U[D++]=L,C+=3,E-=3;for(d=0;d<o.length;d++){let O;a=o[d];const N=a.leftPositions,V=a.rightPositions;let k,G=jtt;if(l(N)){for(E-=3,k=P,n.push(L),O=0;O<N.length/3;O++)G=f.fromArray(N,O*3,G),U[D++]=k-O-1,U[D++]=k-O,Ui.addAttribute(b,G,void 0,E),E-=3;n.push(k-Math.floor(N.length/6)),t===cr.BEVELED&&n.push((E-2)/3+1),C+=3}else{for(C+=3,k=L,n.push(P),O=0;O<V.length/3;O++)G=f.fromArray(V,O*3,G),U[D++]=k+O,U[D++]=k+O+1,Ui.addAttribute(b,G,C),C+=3;n.push(k+Math.floor(V.length/6)),t===cr.BEVELED&&n.push(C/3-1),E-=3}for(_=i[I++],v=i[I++],_.splice(0,3),v.splice(v.length-3,3),b.set(_,C),b.set(v,E-v.length+1),m=v.length-3,O=0;O<v.length;O+=3)L=C/3,S=L-1,P=(E-2)/3,w=P+1,U[D++]=w,U[D++]=P,U[D++]=S,U[D++]=L,C+=3,E-=3;C-=3,E+=3,n.push(C/3,(E-2)/3)}if(g){C+=3,E-=3,R=BG,z=RG;const O=r[1];for(d=0;d<F;d++)R=f.fromArray(O,(p-d-1)*3,R),z=f.fromArray(O,d*3,z),Ui.addAttribute(b,R,void 0,E),Ui.addAttribute(b,z,C),L=C/3,S=L-1,P=(E-2)/3,w=P+1,U[D++]=w,U[D++]=P,U[D++]=S,U[D++]=L,C+=3,E-=3;n.push(C/3)}else n.push(C/3,(E-2)/3);return U[D++]=C/3,U[D++]=(E-2)/3,s.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:b}),{attributes:s,indices:U,wallIndices:n}}function $tt(e){const t=e.ellipsoid,n=Ui.computePositions(e),i=$Z(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,c=i.indices;let u=a.position.values,d=u.length,h=new Float64Array(d);h.set(u);const m=new Float64Array(d*2);if(u=no.scaleToGeodeticHeight(u,r,t),h=no.scaleToGeodeticHeight(h,s,t),m.set(u),m.set(h,d),a.position.values=m,d/=3,l(e.offsetAttribute)){let w=new Uint8Array(d*2);if(e.offsetAttribute===yn.TOP)w=w.fill(1,0,d);else{const S=e.offsetAttribute===yn.NONE?0:1;w=w.fill(S)}a.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}let g;const p=c.length,y=at.createTypedArray(m.length/3,(p+o.length)*2);y.set(c);let b=p;for(g=0;g<p;g+=2){const w=c[g],S=c[g+1];y[b++]=w+d,y[b++]=S+d}let C,E;for(g=0;g<o.length;g++)C=o[g],E=C+d,y[b++]=C,y[b++]=E;return{attributes:a,indices:y}}function KC(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;T.typeOf.object("options.positions",t),T.typeOf.number("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,cr.ROUNDED),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*f.packedLength+me.packedLength+6}KC.pack=function(e,t,n){T.typeOf.object("value",e),T.typeOf.object("array",t),n=A(n,0);const i=e._positions,o=i.length;t[n++]=o;for(let r=0;r<o;++r,n+=f.packedLength)f.pack(i[r],t,n);return me.pack(e._ellipsoid,t,n),n+=me.packedLength,t[n++]=e._width,t[n++]=e._height,t[n++]=e._extrudedHeight,t[n++]=e._cornerType,t[n++]=e._granularity,t[n]=A(e._offsetAttribute,-1),t};const YZ=me.clone(me.UNIT_SPHERE),Ih={positions:void 0,ellipsoid:YZ,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};KC.unpack=function(e,t,n){T.typeOf.object("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let m=0;m<i;++m,t+=f.packedLength)o[m]=f.unpack(e,t);const r=me.unpack(e,t,YZ);t+=me.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t];return l(n)?(n._positions=o,n._ellipsoid=me.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=c,n._cornerType=u,n._granularity=d,n._offsetAttribute=h===-1?void 0:h,n):(Ih.positions=o,Ih.width=s,Ih.height=a,Ih.extrudedHeight=c,Ih.cornerType=u,Ih.granularity=d,Ih.offsetAttribute=h===-1?void 0:h,new KC(Ih))};KC.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=qtt(t,i);const o=da(t,f.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!M.equalsEpsilon(r,s,0,M.EPSILON2),c={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!1};let u;if(a)c.height=r,c.extrudedHeight=s,c.offsetAttribute=e._offsetAttribute,u=$tt(c);else{const m=Ui.computePositions(c);if(u=$Z(m,c.cornerType),u.attributes.position.values=no.scaleToGeodeticHeight(u.attributes.position.values,r,i),l(e._offsetAttribute)){const g=u.attributes.position.values.length,p=e._offsetAttribute===yn.NONE?0:1,y=new Uint8Array(g/3).fill(p);u.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}}const d=u.attributes,h=fe.fromVertices(d.position.values,void 0,3);return new Lt({attributes:d,indices:u.indices,primitiveType:Ze.LINES,boundingSphere:h,offsetAttribute:e._offsetAttribute})};const Ytt=new $o(0);function Zt(e){Wn.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}l(Object.create)&&(Zt.prototype=Object.create(Wn.prototype),Zt.prototype.constructor=Zt);Object.defineProperties(Zt.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Zt.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!l(t.height)&&!l(t.extrudedHeight)&&$r.isSupported(this._scene)};Zt.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return t===0||l(n)&&n!==t};Zt.prototype._computeCenter=x.throwInstantiationError;Zt.prototype._onEntityPropertyChanged=function(e,t,n,i){if(Wn.prototype._onEntityPropertyChanged.call(this,e,t,n,i),this._observedPropertyNames.indexOf(t)===-1)return;const o=this._entity[this._geometryPropertyName];if(!l(o))return;l(o.zIndex)&&(l(o.height)||l(o.extrudedHeight))&&ki(ki.geometryZIndex),this._zIndex=A(o.zIndex,Ytt),l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0);const r=o.heightReference,s=o.extrudedHeightReference;if(l(r)||l(s)){const a=new O_(this._computeCenter.bind(this),!this._dynamic);this._terrainOffsetProperty=new dg(this._scene,a,r,s)}};Zt.prototype.destroy=function(){l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),Wn.prototype.destroy.call(this)};Zt.getGeometryHeight=function(e,t){if(T.defined("heightReference",t),!l(e)){t!==St.NONE&&ki(ki.geometryHeightReference);return}return t!==St.CLAMP_TO_GROUND?e:0};Zt.getGeometryExtrudedHeight=function(e,t){if(T.defined("extrudedHeightReference",t),!l(e)){t!==St.NONE&&ki(ki.geometryExtrudedHeightReference);return}return t!==St.CLAMP_TO_GROUND?e:Zt.CLAMP_TO_GROUND};Zt.CLAMP_TO_GROUND="clamp";Zt.computeGeometryOffsetAttribute=function(e,t,n,i){(!l(e)||!l(t))&&(t=St.NONE),(!l(n)||!l(i))&&(i=St.NONE);let o=0;if(t!==St.NONE&&o++,i===St.RELATIVE_TO_GROUND&&o++,o===2)return yn.ALL;if(o===1)return yn.TOP};const XZ=new H,KZ=f.ZERO,JZ=new f,QZ=new ge;function Xtt(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 ru(e,t){Zt.call(this,{entity:e,scene:t,geometryOptions:new Xtt(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}l(Object.create)&&(ru.prototype=Object.create(Zt.prototype),ru.prototype.constructor=ru);ru.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof nn){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,XZ)),l(o)||(o=H.WHITE),i.color=pn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,KZ,JZ))),new ln({id:t,geometry:new gu(this._options),attributes:i})};ru.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,XZ),o={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return l(this._options.offsetAttribute)&&(o.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,KZ,JZ))),new ln({id:t,geometry:new KC(this._options),attributes:o})};ru.prototype._computeCenter=function(e,t){const n=Z.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!l(n)||n.length===0))return f.clone(n[Math.floor(n.length/2)],t)};ru.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.width)||Wn.prototype._isHidden.call(this,e,t)};ru.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Z.isConstant(t.height)||!Z.isConstant(t.extrudedHeight)||!Z.isConstant(t.granularity)||!Z.isConstant(t.width)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.cornerType)||!Z.isConstant(t.zIndex)||this._onTerrain&&!Z.isConstant(this._materialProperty)&&!(this._materialProperty instanceof nn)};ru.prototype._setStaticOptions=function(e,t){let n=Z.getValueOrUndefined(t.height,ft.MINIMUM_VALUE);const i=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE);let o=Z.getValueOrUndefined(t.extrudedHeight,ft.MINIMUM_VALUE);const r=Z.getValueOrDefault(t.extrudedHeightReference,ft.MINIMUM_VALUE,St.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof nn?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ft.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(ft.MINIMUM_VALUE),s.granularity=Z.getValueOrUndefined(t.granularity,ft.MINIMUM_VALUE),s.cornerType=Z.getValueOrUndefined(t.cornerType,ft.MINIMUM_VALUE),s.offsetAttribute=Zt.computeGeometryOffsetAttribute(n,i,o,r),s.height=Zt.getGeometryHeight(n,i),o=Zt.getGeometryExtrudedHeight(o,r),o===Zt.CLAMP_TO_GROUND&&(o=lo.getMinimumMaximumHeights(gu.computeRectangle(s,QZ)).minimumTerrainHeight),s.extrudedHeight=o};ru.DynamicGeometryUpdater=Gy;function Gy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Gy.prototype=Object.create(yi.prototype),Gy.prototype.constructor=Gy);Gy.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.positions)||!l(i.width)||yi.prototype._isHidden.call(this,e,t,n)};Gy.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,St.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,St.NONE);l(s)&&!l(o)&&(o=0),i.positions=Z.getValueOrUndefined(t.positions,n),i.width=Z.getValueOrUndefined(t.width,n),i.granularity=Z.getValueOrUndefined(t.granularity,n),i.cornerType=Z.getValueOrUndefined(t.cornerType,n),i.offsetAttribute=Zt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Zt.getGeometryHeight(o,r),s=Zt.getGeometryExtrudedHeight(s,a),s===Zt.CLAMP_TO_GROUND&&(s=lo.getMinimumMaximumHeights(gu.computeRectangle(i,QZ)).minimumTerrainHeight),i.extrudedHeight=s};function QD(){x.throwInstantiationError()}Object.defineProperties(QD.prototype,{name:{get:x.throwInstantiationError},clock:{get:x.throwInstantiationError},entities:{get:x.throwInstantiationError},isLoading:{get:x.throwInstantiationError},changedEvent:{get:x.throwInstantiationError},errorEvent:{get:x.throwInstantiationError},loadingEvent:{get:x.throwInstantiationError},show:{get:x.throwInstantiationError},clustering:{get:x.throwInstantiationError}});QD.prototype.update=function(e){x.throwInstantiationError()};QD.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};function fi(e,t){if(e=A(e,A.EMPTY_OBJECT),l(e.disableDepthTestDistance)&&e.disableDepthTestDistance<0)throw new x("disableDepthTestDistance must be greater than or equal to 0.0.");let n=e.translucencyByDistance,i=e.scaleByDistance,o=e.distanceDisplayCondition;if(l(n)){if(n.far<=n.near)throw new x("translucencyByDistance.far must be greater than translucencyByDistance.near.");n=kt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");i=kt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=jt.clone(o)}this._show=A(e.show,!0),this._position=f.clone(A(e.position,f.ZERO)),this._actualPosition=f.clone(this._position),this._color=H.clone(A(e.color,H.WHITE)),this._outlineColor=H.clone(A(e.outlineColor,H.TRANSPARENT)),this._outlineWidth=A(e.outlineWidth,0),this._pixelSize=A(e.pixelSize,10),this._scaleByDistance=i,this._translucencyByDistance=n,this._distanceDisplayCondition=o,this._disableDepthTestDistance=A(e.disableDepthTestDistance,0),this._id=e.id,this._collection=A(e.collection,t),this._clusterShow=!0,this._pickId=void 0,this._pointPrimitiveCollection=t,this._dirty=!1,this._index=-1}const NG=fi.SHOW_INDEX=0,ZZ=fi.POSITION_INDEX=1,Ktt=fi.COLOR_INDEX=2,Jtt=fi.OUTLINE_COLOR_INDEX=3,Qtt=fi.OUTLINE_WIDTH_INDEX=4,Ztt=fi.PIXEL_SIZE_INDEX=5,ent=fi.SCALE_BY_DISTANCE_INDEX=6,tnt=fi.TRANSLUCENCY_BY_DISTANCE_INDEX=7,nnt=fi.DISTANCE_DISPLAY_CONDITION_INDEX=8,int=fi.DISABLE_DEPTH_DISTANCE_INDEX=9;fi.NUMBER_OF_PROPERTIES=10;function $c(e,t){const n=e._pointPrimitiveCollection;l(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(fi.prototype,{show:{get:function(){return this._show},set:function(e){if(!l(e))throw new x("value is required.");this._show!==e&&(this._show=e,$c(this,NG))}},position:{get:function(){return this._position},set:function(e){if(!l(e))throw new x("value is required.");const t=this._position;f.equals(t,e)||(f.clone(e,t),f.clone(e,this._actualPosition),$c(this,ZZ))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");const t=this._scaleByDistance;kt.equals(t,e)||(this._scaleByDistance=kt.clone(e,t),$c(this,ent))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far distance must be greater than near distance.");const t=this._translucencyByDistance;kt.equals(t,e)||(this._translucencyByDistance=kt.clone(e,t),$c(this,tnt))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!l(e))throw new x("value is required.");this._pixelSize!==e&&(this._pixelSize=e,$c(this,Ztt))}},color:{get:function(){return this._color},set:function(e){if(!l(e))throw new x("value is required.");const t=this._color;H.equals(t,e)||(H.clone(e,t),$c(this,Ktt))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;H.equals(t,e)||(H.clone(e,t),$c(this,Jtt))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!l(e))throw new x("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,$c(this,Qtt))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(l(e)&&e.far<=e.near)throw new x("far must be greater than near");jt.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=jt.clone(e,this._distanceDisplayCondition),$c(this,nnt))}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(this._disableDepthTestDistance!==e){if(!l(e)||e<0)throw new x("disableDepthTestDistance must be greater than or equal to 0.0.");this._disableDepthTestDistance=e,$c(this,int)}}},id:{get:function(){return this._id},set:function(e){this._id=e,l(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,$c(this,NG))}}});fi.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};fi.prototype._getActualPosition=function(){return this._actualPosition};fi.prototype._setActualPosition=function(e){f.clone(e,this._actualPosition),$c(this,ZZ)};const MG=new oe;fi._computeActualPosition=function(e,t,n){return t.mode===le.SCENE3D?e:(B.multiplyByPoint(n,e,MG),br.computeActualWgs84Position(t,MG))};const FG=new oe;fi._computeScreenSpacePosition=function(e,t,n,i){const o=B.multiplyByVector(e,oe.fromElements(t.x,t.y,t.z,1,FG),FG);return br.wgs84ToWindowCoordinates(n,o,i)};fi.prototype.computeScreenSpacePosition=function(e,t){const n=this._pointPrimitiveCollection;if(l(t)||(t=new j),!l(n))throw new x("PointPrimitive must be in a collection.");if(!l(e))throw new x("scene is required.");const i=n.modelMatrix,o=fi._computeScreenSpacePosition(i,this._actualPosition,e,t);if(l(o))return o.y=e.canvas.clientHeight-o.y,o};fi.getScreenSpaceBoundingBox=function(e,t,n){const i=e.pixelSize,o=i*.5,r=t.x-o,s=t.y-o,a=i,c=i;return l(n)||(n=new Ye),n.x=r,n.y=s,n.width=a,n.height=c,n};fi.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&f.equals(this._position,e._position)&&H.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&H.equals(this._outlineColor,e._outlineColor)&&kt.equals(this._scaleByDistance,e._scaleByDistance)&&kt.equals(this._translucencyByDistance,e._translucencyByDistance)&&jt.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};fi.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const ont=fi.SHOW_INDEX,UR=fi.POSITION_INDEX,eee=fi.COLOR_INDEX,rnt=fi.OUTLINE_COLOR_INDEX,snt=fi.OUTLINE_WIDTH_INDEX,ant=fi.PIXEL_SIZE_INDEX,tee=fi.SCALE_BY_DISTANCE_INDEX,nee=fi.TRANSLUCENCY_BY_DISTANCE_INDEX,iee=fi.DISTANCE_DISPLAY_CONDITION_INDEX,cnt=fi.DISABLE_DEPTH_DISTANCE_INDEX,hF=fi.NUMBER_OF_PROPERTIES,Js={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function Fc(e){e=A(e,A.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(hF),this._maxPixelSize=1,this._baseVolume=new fe,this._baseVolumeWC=new fe,this._baseVolume2D=new fe,this._boundingVolume=new fe,this._boundingVolumeDirty=!1,this._colorCommands=[],this.show=A(e.show,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._modelMatrix=B.clone(B.IDENTITY),this.debugShowBoundingVolume=A(e.debugShowBoundingVolume,!1),this.blendOption=A(e.blendOption,Ko.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=le.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW,nt.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(Fc.prototype,{length:{get:function(){return pF(this),this._pointPrimitives.length}}});function oee(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Fc.prototype.add=function(e){const t=new fi(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};Fc.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Fc.prototype.removeAll=function(){oee(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function pF(e){if(e._pointPrimitivesRemoved){e._pointPrimitivesRemoved=!1;const t=[],n=e._pointPrimitives,i=n.length;for(let o=0,r=0;o<i;++o){const s=n[o];s&&(s._index=r++,t.push(s))}e._pointPrimitives=t}}Fc.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};Fc.prototype.contains=function(e){return l(e)&&e._pointPrimitiveCollection===this};Fc.prototype.get=function(e){if(!l(e))throw new x("index is required.");return pF(this),this._pointPrimitives[e]};Fc.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<hF;++i){const o=n[i]===0?nt.STATIC_DRAW:nt.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function lnt(e,t,n){return new Rr(e,[{index:Js.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[UR]},{index:Js.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[UR]},{index:Js.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[eee]},{index:Js.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[nee]},{index:Js.scaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[tee]},{index:Js.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ee.FLOAT,usage:n[iee]}],t)}const GO=new Rn;function ree(e,t,n,i){const o=i._index,r=i._getActualPosition();e._mode===le.SCENE3D&&(fe.expand(e._baseVolume,r,e._baseVolume),e._boundingVolumeDirty=!0),Rn.fromCartesian(r,GO);const s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);const c=n[Js.positionHighAndSize],u=GO.high;c(o,u.x,u.y,u.z,s);const d=n[Js.positionLowAndOutline],h=GO.low;d(o,h.x,h.y,h.z,a)}const Qx=65536,gb=256;function see(e,t,n,i){const o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor;let c=H.floatToByte(r.red),u=H.floatToByte(r.green),d=H.floatToByte(r.blue);const h=c*Qx+u*gb+d;c=H.floatToByte(a.red),u=H.floatToByte(a.green),d=H.floatToByte(a.blue);const m=c*Qx+u*gb+d;c=H.floatToByte(s.red),u=H.floatToByte(s.green),d=H.floatToByte(s.blue);const g=c*Qx+u*gb+d,p=H.floatToByte(r.alpha)*Qx+H.floatToByte(a.alpha)*gb+H.floatToByte(s.alpha),y=n[Js.compressedAttribute0];y(o,h,m,g,p)}function aee(e,t,n,i){const o=i._index;let r=0,s=1,a=1,c=1;const u=i.translucencyByDistance;l(u)&&(r=u.near,s=u.nearValue,a=u.far,c=u.farValue,(s!==1||c!==1)&&(e._shaderTranslucencyByDistance=!0));let d=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(d=!1),s=M.clamp(s,0,1),s=s===1?255:s*255|0;const h=(d?1:0)*gb+s;c=M.clamp(c,0,1),c=c===1?255:c*255|0;const m=c,g=n[Js.compressedAttribute1];g(o,h,m,r,a)}function cee(e,t,n,i){const o=i._index,r=n[Js.scaleByDistance];let s=0,a=1,c=1,u=1;const d=i.scaleByDistance;l(d)&&(s=d.near,a=d.nearValue,c=d.far,u=d.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,c,u)}function lee(e,t,n,i){const o=i._index,r=n[Js.distanceDisplayConditionAndDisableDepth];let s=0,a=Number.MAX_VALUE;const c=i.distanceDisplayCondition;l(c)&&(s=c.near,a=c.far,s*=s,a*=a,e._shaderDistanceDisplayCondition=!0);let u=i.disableDepthTestDistance;u*=u,u>0&&(e._shaderDisableDepthDistance=!0,u===Number.POSITIVE_INFINITY&&(u=-1)),r(o,s,a,u)}function unt(e,t,n,i){ree(e,t,n,i),see(e,t,n,i),aee(e,t,n,i),cee(e,t,n,i),lee(e,t,n,i)}function WO(e,t,n,i,o,r){let s;i.mode===le.SCENE3D?(s=e._baseVolume,e._boundingVolumeDirty=!0):s=e._baseVolume2D;const a=[];for(let c=0;c<n;++c){const u=t[c],d=u.position,h=fi._computeActualPosition(d,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):fe.expand(s,h,s))}r&&fe.fromPoints(a,s)}function dnt(e,t){const n=t.mode,i=e._pointPrimitives,o=e._pointPrimitivesToUpdate,r=e._modelMatrix;e._createVertexArray||e._mode!==n||n!==le.SCENE3D&&!B.equals(r,e.modelMatrix)?(e._mode=n,B.clone(e.modelMatrix,r),e._createVertexArray=!0,(n===le.SCENE3D||n===le.SCENE2D||n===le.COLUMBUS_VIEW)&&WO(e,i,i.length,t,r,!0)):n===le.MORPHING?WO(e,i,i.length,t,r,!0):(n===le.SCENE2D||n===le.COLUMBUS_VIEW)&&WO(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function fnt(e,t,n){const o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}const hnt=[];Fc.prototype.update=function(e){if(pF(this),!this.show)return;this._maxTotalPointSize=It.maximumAliasedPointSize,dnt(this,e);const n=this._pointPrimitives.length,i=this._pointPrimitivesToUpdate,o=this._pointPrimitivesToUpdateIndex,r=this._propertiesChanged,s=this._createVertexArray;let a;const c=e.context,u=e.passes,d=u.pick;if(s||!d&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let P=0;P<hF;++P)r[P]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=lnt(c,n,this._buffersUsage),a=this._vaf.writers;for(let P=0;P<n;++P){const L=this._pointPrimitives[P];L._dirty=!1,unt(this,c,a,L)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){const P=hnt;P.length=0,(r[UR]||r[snt]||r[ant])&&P.push(ree),(r[eee]||r[rnt])&&P.push(see),(r[ont]||r[nee])&&P.push(aee),r[tee]&&P.push(cee),(r[iee]||r[cnt])&&P.push(lee);const L=P.length;if(a=this._vaf.writers,o/n>.1){for(let z=0;z<o;++z){const R=i[z];R._dirty=!1;for(let F=0;F<L;++F)P[F](this,c,a,R)}this._vaf.commit()}else{for(let z=0;z<o;++z){const R=i[z];R._dirty=!1;for(let F=0;F<L;++F)P[F](this,c,a,R);this._vaf.subCommit(R._index,1)}this._vaf.endSubCommits()}this._pointPrimitivesToUpdateIndex=0}if(o>n*1.5&&(i.length=n),!l(this._vaf)||!l(this._vaf.va))return;this._boundingVolumeDirty&&(this._boundingVolumeDirty=!1,fe.transform(this._baseVolume,this.modelMatrix,this._baseVolumeWC));let h,m=B.IDENTITY;e.mode===le.SCENE3D?(m=this.modelMatrix,h=fe.clone(this._baseVolumeWC,this._boundingVolume)):h=fe.clone(this._baseVolume2D,this._boundingVolume),fnt(this,e,h);const g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===Ko.OPAQUE||this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=et.fromCache({depthTest:{enabled:!0,func:ae.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===Ko.TRANSLUCENT||this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=et.fromCache({depthTest:{enabled:!0,func:ae.LEQUAL},depthMask:!1,blending:Gi.ALPHA_BLEND}):this._rsTranslucent=void 0),this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let p,y;(g||this._shaderScaleByDistance&&!this._compiledShaderScaleByDistance||this._shaderTranslucencyByDistance&&!this._compiledShaderTranslucencyByDistance||this._shaderDistanceDisplayCondition&&!this._compiledShaderDistanceDisplayCondition||this._shaderDisableDepthDistance!==this._compiledShaderDisableDepthDistance)&&(p=new We({sources:[TEe]}),this._shaderScaleByDistance&&p.defines.push("EYE_DISTANCE_SCALING"),this._shaderTranslucencyByDistance&&p.defines.push("EYE_DISTANCE_TRANSLUCENCY"),this._shaderDistanceDisplayCondition&&p.defines.push("DISTANCE_DISPLAY_CONDITION"),this._shaderDisableDepthDistance&&p.defines.push("DISABLE_DEPTH_DISTANCE"),this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT&&(y=new We({defines:["OPAQUE"],sources:[zE]}),this._sp=Cn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:Js}),y=new We({defines:["TRANSLUCENT"],sources:[zE]}),this._spTranslucent=Cn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:Js})),this._blendOption===Ko.OPAQUE&&(y=new We({sources:[zE]}),this._sp=Cn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:Js})),this._blendOption===Ko.TRANSLUCENT&&(y=new We({sources:[zE]}),this._spTranslucent=Cn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:Js})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let b,C,E,w;const S=e.commandList;if(u.render||d){const P=this._colorCommands,L=this._blendOption===Ko.OPAQUE,z=this._blendOption===Ko.OPAQUE_AND_TRANSLUCENT;b=this._vaf.va,C=b.length,P.length=C;const R=z?C*2:C;for(w=0;w<R;++w){const F=L||z&&w%2===0;E=P[w],l(E)||(E=P[w]=new mt),E.primitiveType=Ze.POINTS,E.pass=F||!z?Ne.OPAQUE:Ne.TRANSLUCENT,E.owner=this;const U=z?Math.floor(w/2):w;E.boundingVolume=h,E.modelMatrix=m,E.shaderProgram=F?this._sp:this._spTranslucent,E.uniformMap=this._uniforms,E.vertexArray=b[U].va,E.renderState=F?this._rsOpaque:this._rsTranslucent,E.debugShowBoundingVolume=this.debugShowBoundingVolume,E.pickId="v_pickColor",S.push(E)}}};Fc.prototype.isDestroyed=function(){return!1};Fc.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(),oee(this._pointPrimitives),He(this)};function HR(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;uee(e,t,s,i,o,r%2),HR(e,t,n,i,s-1,r+1),HR(e,t,n,s+1,o,r+1)}function uee(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const u=o-i+1,d=n-i+1,h=Math.log(u),m=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*m*(u-m)/u)*(d-u/2<0?-1:1),p=Math.max(i,Math.floor(n-d*m/u+g)),y=Math.min(o,Math.floor(n+(u-d)*m/u+g));uee(e,t,n,p,y,r)}const s=t[2*n+r];let a=i,c=o;for($A(e,t,i,n),t[2*o+r]>s&&$A(e,t,i,o);a<c;){for($A(e,t,a,c),a++,c--;t[2*a+r]<s;)a++;for(;t[2*c+r]>s;)c--}t[2*i+r]===s?$A(e,t,i,c):(c++,$A(e,t,c,o)),c<=n&&(i=c+1),n<=c&&(o=c-1)}}function $A(e,t,n,i){jO(e,n,i),jO(t,2*n,2*i),jO(t,2*n+1,2*i+1)}function jO(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function pnt(e,t,n,i,o,r,s){const a=[0,e.length-1,0],c=[];let u,d;for(;a.length;){const h=a.pop(),m=a.pop(),g=a.pop();if(m-g<=s){for(let b=g;b<=m;b++)u=t[2*b],d=t[2*b+1],u>=n&&u<=o&&d>=i&&d<=r&&c.push(e[b]);continue}const p=Math.floor((g+m)/2);u=t[2*p],d=t[2*p+1],u>=n&&u<=o&&d>=i&&d<=r&&c.push(e[p]);const y=(h+1)%2;(h===0?n<=u:i<=d)&&(a.push(g),a.push(p-1),a.push(y)),(h===0?o>=u:r>=d)&&(a.push(p+1),a.push(m),a.push(y))}return c}function mnt(e,t,n,i,o,r){const s=[0,e.length-1,0],a=[],c=o*o;for(;s.length;){const u=s.pop(),d=s.pop(),h=s.pop();if(d-h<=r){for(let b=h;b<=d;b++)zG(t[2*b],t[2*b+1],n,i)<=c&&a.push(e[b]);continue}const m=Math.floor((h+d)/2),g=t[2*m],p=t[2*m+1];zG(g,p,n,i)<=c&&a.push(e[m]);const y=(u+1)%2;(u===0?n-o<=g:i-o<=p)&&(s.push(h),s.push(m-1),s.push(y)),(u===0?n+o>=g:i+o>=p)&&(s.push(m+1),s.push(d),s.push(y))}return a}function zG(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}const _nt=e=>e[0],gnt=e=>e[1];class ynt{constructor(t,n=_nt,i=gnt,o=64,r=Float64Array){this.nodeSize=o,this.points=t;const s=t.length<65536?Uint16Array:Uint32Array,a=this.ids=new s(t.length),c=this.coords=new r(t.length*2);for(let u=0;u<t.length;u++)a[u]=u,c[2*u]=n(t[u]),c[2*u+1]=i(t[u]);HR(a,c,o,0,a.length-1,0)}range(t,n,i,o){return pnt(this.ids,this.coords,t,n,i,o,this.nodeSize)}within(t,n,i){return mnt(this.ids,this.coords,t,n,i,this.nodeSize)}}function Iu(e){e=A(e,A.EMPTY_OBJECT),this._enabled=A(e.enabled,!1),this._pixelRange=A(e.pixelRange,80),this._minimumClusterSize=A(e.minimumClusterSize,2),this._clusterBillboards=A(e.clusterBillboards,!0),this._clusterLabels=A(e.clusterLabels,!0),this._clusterPoints=A(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 Ke,this.show=A(e.show,!0)}function Ant(e){return e.coord.x}function bnt(e){return e.coord.y}function UG(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}const Cnt=new Ye;function HG(e,t,n,i,o){if(l(e._labelCollection)&&i._clusterLabels?o=mu.getScreenSpaceBoundingBox(e,t,o):l(e._billboardCollection)&&i._clusterBillboards?o=Ut.getScreenSpaceBoundingBox(e,t,o):l(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=fi.getScreenSpaceBoundingBox(e,t,o)),UG(o,n),i._clusterLabels&&!l(e._labelCollection)&&l(e.id)&&dee(i,e.id.id)&&l(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=mu.getScreenSpaceBoundingBox(s,t,Cnt);UG(a,n),o=Ye.union(o,a,o)}return o}function Tnt(e,t){if(e.clusterShow=!0,!l(e._labelCollection)&&l(e.id)&&dee(t,e.id.id)&&l(e.id._label)){const n=t._collectionIndicesByEntity[e.id.id].labelIndex,i=t._labelCollection.get(n);i.clusterShow=!0}}function VG(e,t,n,i){const 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 dee(e,t){return l(e)&&l(e._collectionIndicesByEntity[t])&&l(e._collectionIndicesByEntity[t].labelIndex)}function qO(e,t,n,i,o){if(!l(e))return;const r=e.length;for(let s=0;s<r;++s){const a=e.get(s);if(a.clusterShow=!1,!a.show||o._scene.mode===le.SCENE3D&&!i.isPointVisible(a.position))continue;const c=o._clusterLabels&&l(a._labelCollection),u=o._clusterBillboards&&l(a.id._billboard),d=o._clusterPoints&&l(a.id._point);if(c&&(d||u))continue;const h=a.computeScreenSpacePosition(n);l(h)&&t.push({index:s,collection:e,clustered:!1,coord:h})}}const Ent=new Ye,xnt=new Ye,wnt=new Ye;function Snt(e){return function(t){if(l(t)&&t<.05||!e.enabled)return;const n=e._scene,i=e._labelCollection,o=e._billboardCollection,r=e._pointCollection;if(!l(i)&&!l(o)&&!l(r)||!e._clusterBillboards&&!e._clusterLabels&&!e._clusterPoints)return;let s=e._clusterLabelCollection,a=e._clusterBillboardCollection,c=e._clusterPointCollection;l(s)?s.removeAll():s=e._clusterLabelCollection=new Mc({scene:n}),l(a)?a.removeAll():a=e._clusterBillboardCollection=new pa({scene:n}),l(c)?c.removeAll():c=e._clusterPointCollection=new Fc;const u=e._pixelRange,d=e._minimumClusterSize,h=e._previousClusters,m=[],g=e._previousHeight,p=n.camera.positionCartographic.height,y=n.mapProjection.ellipsoid,b=n.camera.positionWC,C=new El(y,b),E=[];e._clusterLabels&&qO(i,E,n,C,e),e._clusterBillboards&&qO(o,E,n,C,e),e._clusterPoints&&qO(r,E,n,C,e);let w,S,P,L,z,R,F,U,D,I,_,v;const O=new ynt(E,Ant,bnt,64,Int32Array);if(p<g)for(P=h.length,w=0;w<P;++w){const N=h[w];if(!C.isPointVisible(N.position))continue;const V=Ut._computeScreenSpacePosition(B.IDENTITY,N.position,f.ZERO,j.ZERO,n);if(!l(V))continue;const k=1-p/g;let G=N.width=N.width*k,W=N.height=N.height*k;G=Math.max(G,N.minimumWidth),W=Math.max(W,N.minimumHeight);const K=V.x-G*.5,q=V.y-W*.5,te=V.x+G,Y=V.y+W;for(z=O.range(K,q,te,Y),R=z.length,I=0,D=[],S=0;S<R;++S)F=z[S],U=E[F],U.clustered||(++I,_=U.collection,v=U.index,D.push(_.get(v).id));if(I>=d)for(VG(N.position,I,D,e),m.push(N),S=0;S<R;++S)E[z[S]].clustered=!0}for(P=E.length,w=0;w<P;++w){const N=E[w];if(N.clustered)continue;N.clustered=!0,_=N.collection,v=N.index;const V=_.get(v);L=HG(V,N.coord,u,e,Ent);const k=Ye.clone(L,xnt);z=O.range(L.x,L.y,L.x+L.width,L.y+L.height),R=z.length;const G=f.clone(V.position);for(I=1,D=[V.id],S=0;S<R;++S)if(F=z[S],U=E[F],!U.clustered){const W=U.collection.get(U.index),K=HG(W,U.coord,u,e,wnt);f.add(W.position,G,G),Ye.union(k,K,k),++I,D.push(W.id)}if(I>=d){const W=f.multiplyByScalar(G,1/I,G);for(VG(W,I,D,e),m.push({position:W,width:k.width,height:k.height,minimumWidth:L.width,minimumHeight:L.height}),S=0;S<R;++S)E[z[S]].clustered=!0}else Tnt(V,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=m,e._previousHeight=p}}Iu.prototype._initialize=function(e){this._scene=e;const t=Snt(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(Iu.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 mF(e,t,n,i){return function(o){let r=this[e];l(this._collectionIndicesByEntity)||(this._collectionIndicesByEntity={});let s=this._collectionIndicesByEntity[o.id];if(l(s)||(s=this._collectionIndicesByEntity[o.id]={billboardIndex:void 0,labelIndex:void 0,pointIndex:void 0}),l(r)&&l(s[i]))return r.get(s[i]);l(r)||(r=this[e]=new t({scene:this._scene}));let a,c;const u=this[n];u.length>0?(a=u.pop(),c=r.get(a)):(c=r.add(),a=r.length-1),s[i]=a;const d=this;return Promise.resolve().then(function(){d._clusterDirty=!0}),c}}function _F(e,t){const n=e._collectionIndicesByEntity[t];!l(n.billboardIndex)&&!l(n.labelIndex)&&!l(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}Iu.prototype.getLabel=mF("_labelCollection",Mc,"_unusedLabelIndices","labelIndex");Iu.prototype.removeLabel=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._labelCollection)||!l(t)||!l(t.labelIndex))return;const n=t.labelIndex;t.labelIndex=void 0,_F(this,e.id);const i=this._labelCollection.get(n);i.show=!1,i.text="",i.id=void 0,this._unusedLabelIndices.push(n),this._clusterDirty=!0};Iu.prototype.getBillboard=mF("_billboardCollection",pa,"_unusedBillboardIndices","billboardIndex");Iu.prototype.removeBillboard=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._billboardCollection)||!l(t)||!l(t.billboardIndex))return;const n=t.billboardIndex;t.billboardIndex=void 0,_F(this,e.id);const i=this._billboardCollection.get(n);i.id=void 0,i.show=!1,i.image=void 0,this._unusedBillboardIndices.push(n),this._clusterDirty=!0};Iu.prototype.getPoint=mF("_pointCollection",Fc,"_unusedPointIndices","pointIndex");Iu.prototype.removePoint=function(e){const t=this._collectionIndicesByEntity&&this._collectionIndicesByEntity[e.id];if(!l(this._pointCollection)||!l(t)||!l(t.pointIndex))return;const n=t.pointIndex;t.pointIndex=void 0,_F(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function $O(e){if(!l(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function vnt(e){e.enabled||(l(e._clusterLabelCollection)&&e._clusterLabelCollection.destroy(),l(e._clusterBillboardCollection)&&e._clusterBillboardCollection.destroy(),l(e._clusterPointCollection)&&e._clusterPointCollection.destroy(),e._clusterLabelCollection=void 0,e._clusterBillboardCollection=void 0,e._clusterPointCollection=void 0,$O(e._labelCollection),$O(e._billboardCollection),$O(e._pointCollection))}Iu.prototype.update=function(e){if(!this.show)return;let t;l(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),l(this._billboardCollection)&&this._billboardCollection.length>0&&!l(this._billboardCollection.get(0).width)&&(t=e.commandList,e.commandList=[],this._billboardCollection.update(e),e.commandList=t),this._enabledDirty&&(this._enabledDirty=!1,vnt(this),this._clusterDirty=!0),this._clusterDirty&&(this._clusterDirty=!1,this._cluster()),l(this._clusterLabelCollection)&&this._clusterLabelCollection.update(e),l(this._clusterBillboardCollection)&&this._clusterBillboardCollection.update(e),l(this._clusterPointCollection)&&this._clusterPointCollection.update(e),l(this._labelCollection)&&this._labelCollection.update(e),l(this._billboardCollection)&&this._billboardCollection.update(e),l(this._pointCollection)&&this._pointCollection.update(e)};Iu.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(),l(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};function gF(e){this._name=e,this._clock=void 0,this._changed=new Ke,this._error=new Ke,this._isLoading=!1,this._loading=new Ke,this._entityCollection=new ma(this),this._entityCluster=new Iu}Object.defineProperties(gF.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){QD.setLoading(this,e)}},changedEvent:{get:function(){return this._changed}},errorEvent:{get:function(){return this._error}},loadingEvent:{get:function(){return this._loading}},show:{get:function(){return this._entityCollection.show},set:function(e){this._entityCollection.show=e}},clustering:{get:function(){return this._entityCluster},set:function(e){if(!l(e))throw new x("value must be defined.");this._entityCluster=e}}});gF.prototype.update=function(e){return!0};const fee={};fee.computePositions=function(e,t,n,i,o){const r=e*.5,s=-r,a=i+i,c=o?2*a:a,u=new Float64Array(c*3);let d,h=0,m=0;const g=o?a*3:0,p=o?(a+i)*3:i*3;for(d=0;d<i;d++){const y=d/i*M.TWO_PI,b=Math.cos(y),C=Math.sin(y),E=b*n,w=C*n,S=b*t,P=C*t;u[m+g]=E,u[m+g+1]=w,u[m+g+2]=s,u[m+p]=S,u[m+p+1]=P,u[m+p+2]=r,m+=3,o&&(u[h++]=E,u[h++]=w,u[h++]=s,u[h++]=S,u[h++]=P,u[h++]=r)}return u};const hee=fee,YO=new j,Dnt=new f,Int=new f,Pnt=new f,Ont=new f;function wf(e){e=A(e,A.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=A(e.vertexFormat,Fe.DEFAULT),r=A(e.slices,128);if(!l(t))throw new x("options.length must be defined.");if(!l(n))throw new x("options.topRadius must be defined.");if(!l(i))throw new x("options.bottomRadius must be defined.");if(r<3)throw new x("options.slices must be greater than or equal to 3.");if(l(e.offsetAttribute)&&e.offsetAttribute===yn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._vertexFormat=Fe.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}wf.packedLength=Fe.packedLength+5;wf.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n]=A(e._offsetAttribute,-1),t};const pee=new Fe,qg={vertexFormat:pee,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};wf.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=Fe.unpack(e,t,pee);t+=Fe.packedLength;const o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return l(n)?(n._vertexFormat=Fe.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=c===-1?void 0:c,n):(qg.length=o,qg.topRadius=r,qg.bottomRadius=s,qg.slices=a,qg.offsetAttribute=c===-1?void 0:c,new wf(qg))};wf.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._vertexFormat,r=e._slices;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=r+r,a=r+s,c=s+s,u=hee.computePositions(t,n,i,r,!0),d=o.st?new Float32Array(c*2):void 0,h=o.normal?new Float32Array(c*3):void 0,m=o.tangent?new Float32Array(c*3):void 0,g=o.bitangent?new Float32Array(c*3):void 0;let p;const y=o.normal||o.tangent||o.bitangent;if(y){const z=o.tangent||o.bitangent;let R=0,F=0,U=0;const D=Math.atan2(i-n,t),I=Dnt;I.z=Math.sin(D);const _=Math.cos(D);let v=Pnt,O=Int;for(p=0;p<r;p++){const N=p/r*M.TWO_PI,V=_*Math.cos(N),k=_*Math.sin(N);y&&(I.x=V,I.y=k,z&&(v=f.normalize(f.cross(f.UNIT_Z,I,v),v)),o.normal&&(h[R++]=I.x,h[R++]=I.y,h[R++]=I.z,h[R++]=I.x,h[R++]=I.y,h[R++]=I.z),o.tangent&&(m[F++]=v.x,m[F++]=v.y,m[F++]=v.z,m[F++]=v.x,m[F++]=v.y,m[F++]=v.z),o.bitangent&&(O=f.normalize(f.cross(I,v,O),O),g[U++]=O.x,g[U++]=O.y,g[U++]=O.z,g[U++]=O.x,g[U++]=O.y,g[U++]=O.z))}for(p=0;p<r;p++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=-1),o.tangent&&(m[F++]=1,m[F++]=0,m[F++]=0),o.bitangent&&(g[U++]=0,g[U++]=-1,g[U++]=0);for(p=0;p<r;p++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=1),o.tangent&&(m[F++]=1,m[F++]=0,m[F++]=0),o.bitangent&&(g[U++]=0,g[U++]=1,g[U++]=0)}const b=12*r-12,C=at.createTypedArray(c,b);let E=0,w=0;for(p=0;p<r-1;p++)C[E++]=w,C[E++]=w+2,C[E++]=w+3,C[E++]=w,C[E++]=w+3,C[E++]=w+1,w+=2;for(C[E++]=s-2,C[E++]=0,C[E++]=1,C[E++]=s-2,C[E++]=1,C[E++]=s-1,p=1;p<r-1;p++)C[E++]=s+p+1,C[E++]=s+p,C[E++]=s;for(p=1;p<r-1;p++)C[E++]=a,C[E++]=a+p,C[E++]=a+p+1;let S=0;if(o.st){const z=Math.max(n,i);for(p=0;p<c;p++){const R=f.fromArray(u,p*3,Ont);d[S++]=(R.x+z)/(2*z),d[S++]=(R.y+z)/(2*z)}}const P=new Ji;o.position&&(P.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})),o.normal&&(P.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:h})),o.tangent&&(P.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:m})),o.bitangent&&(P.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(P.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:d})),YO.x=t*.5,YO.y=Math.max(i,n);const L=new fe(f.ZERO,j.magnitude(YO));if(l(e._offsetAttribute)){t=u.length;const z=e._offsetAttribute===yn.NONE?0:1,R=new Uint8Array(t/3).fill(z);P.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:R})}return new Lt({attributes:P,indices:C,primitiveType:Ze.TRIANGLES,boundingSphere:L,offsetAttribute:e._offsetAttribute})};let XO;wf.getUnitCylinder=function(){return l(XO)||(XO=wf.createGeometry(new wf({topRadius:1,bottomRadius:1,length:1,vertexFormat:Fe.POSITION_ONLY}))),XO};const KO=new j;function y0(e){e=A(e,A.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=A(e.slices,128),r=Math.max(A(e.numberOfVerticalLines,16),0);if(T.typeOf.number("options.positions",t),T.typeOf.number("options.topRadius",n),T.typeOf.number("options.bottomRadius",i),T.typeOf.number.greaterThanOrEquals("options.slices",o,3),l(e.offsetAttribute)&&e.offsetAttribute===yn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._length=t,this._topRadius=n,this._bottomRadius=i,this._slices=o,this._numberOfVerticalLines=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderOutlineGeometry"}y0.packedLength=6;y0.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),t[n++]=e._length,t[n++]=e._topRadius,t[n++]=e._bottomRadius,t[n++]=e._slices,t[n++]=e._numberOfVerticalLines,t[n]=A(e._offsetAttribute,-1),t};const Rm={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};y0.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=e[t++],o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return l(n)?(n._length=i,n._topRadius=o,n._bottomRadius=r,n._slices=s,n._numberOfVerticalLines=a,n._offsetAttribute=c===-1?void 0:c,n):(Rm.length=i,Rm.topRadius=o,Rm.bottomRadius=r,Rm.slices=s,Rm.numberOfVerticalLines=a,Rm.offsetAttribute=c===-1?void 0:c,new y0(Rm))};y0.createGeometry=function(e){let t=e._length;const n=e._topRadius,i=e._bottomRadius,o=e._slices,r=e._numberOfVerticalLines;if(t<=0||n<0||i<0||n===0&&i===0)return;const s=o*2,a=hee.computePositions(t,n,i,o,!1);let c=o*2,u;if(r>0){const y=Math.min(r,o);u=Math.round(o/y),c+=y}const d=at.createTypedArray(s,c*2);let h=0,m;for(m=0;m<o-1;m++)d[h++]=m,d[h++]=m+1,d[h++]=m+o,d[h++]=m+1+o;if(d[h++]=o-1,d[h++]=0,d[h++]=o+o-1,d[h++]=o,r>0)for(m=0;m<o;m+=u)d[h++]=m,d[h++]=m+o;const g=new Ji;g.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:a}),KO.x=t*.5,KO.y=Math.max(i,n);const p=new fe(f.ZERO,j.magnitude(KO));if(l(e._offsetAttribute)){t=a.length;const y=e._offsetAttribute===yn.NONE?0:1,b=new Uint8Array(t/3).fill(y);g.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:b})}return new Lt({attributes:g,indices:d,primitiveType:Ze.LINES,boundingSphere:p,offsetAttribute:e._offsetAttribute})};const mee=f.ZERO,_ee=new f,Lnt=new f,gee=new H;function Bnt(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 gc(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new Bnt(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}l(Object.create)&&(gc.prototype=Object.create(Wn.prototype),gc.prototype.constructor=gc);Object.defineProperties(gc.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});gc.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Ii.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof nn){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,gee)),l(a)||(a=H.WHITE),s.color=pn.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,mee,_ee))),new ln({id:t,geometry:new wf(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:s})};gc.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,gee),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,mee,_ee))),new ln({id:t,geometry:new y0(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:r})};gc.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};gc.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.length)||!l(t.topRadius)||!l(t.bottomRadius)||Wn.prototype._isHidden.call(this,e,t)};gc.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.length.isConstant||!t.topRadius.isConstant||!t.bottomRadius.isConstant||!Z.isConstant(t.slices)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.numberOfVerticalLines)};gc.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof nn?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(ft.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(ft.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(ft.MINIMUM_VALUE),i.slices=Z.getValueOrUndefined(t.slices,ft.MINIMUM_VALUE),i.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,ft.MINIMUM_VALUE),i.offsetAttribute=n!==St.NONE?yn.ALL:void 0};gc.prototype._onEntityPropertyChanged=S2;gc.DynamicGeometryUpdater=Wy;function Wy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Wy.prototype=Object.create(yi.prototype),Wy.prototype.constructor=Wy);Wy.prototype._isHidden=function(e,t,n){const i=this._options,o=Z.getValueOrUndefined(e.position,n,Lnt);return!l(o)||!l(i.length)||!l(i.topRadius)||!l(i.bottomRadius)||yi.prototype._isHidden.call(this,e,t,n)};Wy.prototype._setOptions=function(e,t,n){const i=Z.getValueOrDefault(t.heightReference,n,St.NONE),o=this._options;o.length=Z.getValueOrUndefined(t.length,n),o.topRadius=Z.getValueOrUndefined(t.topRadius,n),o.bottomRadius=Z.getValueOrUndefined(t.bottomRadius,n),o.slices=Z.getValueOrUndefined(t.slices,n),o.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,n),o.offsetAttribute=i!==St.NONE?yn.ALL:void 0};const Rnt={NONE:0,HOLD:1,EXTRAPOLATE:2},Dy=Object.freeze(Rnt),yF={type:"Linear"};yF.getRequiredDataPoints=function(e){return 2};yF.interpolateOrderZero=function(e,t,n,i,o){if(t.length!==2)throw new x("The xTable provided to the linear interpolator must have exactly two elements.");if(i<=0)throw new x("There must be at least 1 dependent variable for each independent variable.");l(o)||(o=new Array(i));let r,s,a;const c=t[0],u=t[1];if(c===u)throw new x("Divide by zero error: xTable[0] and xTable[1] are equal");for(r=0;r<i;r++)s=n[r],a=n[r+i],o[r]=((a-s)*e+u*s-c*a)/(u-c);return o};const Nnt=yF;function b_(e){let t=e._targetProperty;if(!l(t)){let n=e._targetEntity;if(!l(n)){if(n=e._targetCollection.getById(e._targetId),!l(n)){e._targetEntity=e._targetProperty=void 0;return}n.definitionChanged.addEventListener(Dc.prototype._onTargetEntityDefinitionChanged,e),e._targetEntity=n}const i=e._targetPropertyNames;t=e._targetEntity;for(let o=0,r=i.length;o<r&&l(t);++o)t=t[i[o]];e._targetProperty=t}return t}function Dc(e,t,n){if(!l(e))throw new x("targetCollection is required.");if(!l(t)||t==="")throw new x("targetId is required.");if(!l(n)||n.length===0)throw new x("targetPropertyNames is required.");for(let i=0;i<n.length;i++){const o=n[i];if(!l(o)||o==="")throw new x("reference contains invalid properties.")}this._targetCollection=e,this._targetId=t,this._targetPropertyNames=n,this._targetProperty=void 0,this._targetEntity=void 0,this._definitionChanged=new Ke,e.collectionChanged.addEventListener(Dc.prototype._onCollectionChanged,this)}Object.defineProperties(Dc.prototype,{isConstant:{get:function(){return Z.isConstant(b_(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=b_(this);return l(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 b_(this)}}});Dc.fromString=function(e,t){if(!l(e))throw new x("targetCollection is required.");if(!l(t))throw new x("referenceString is required.");let n;const i=[];let o=!0,r=!1,s="";for(let a=0;a<t.length;++a){const 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 Dc(e,n,i)};Dc.prototype.getValue=function(e,t){const n=b_(this);return l(n)?n.getValue(e,t):void 0};Dc.prototype.getValueInReferenceFrame=function(e,t,n){const i=b_(this);return l(i)?i.getValueInReferenceFrame(e,t,n):void 0};Dc.prototype.getType=function(e){const t=b_(this);return l(t)?t.getType(e):void 0};Dc.prototype.equals=function(e){if(this===e)return!0;const t=this._targetPropertyNames,n=e._targetPropertyNames;if(this._targetCollection!==e._targetCollection||this._targetId!==e._targetId||t.length!==n.length)return!1;const i=this._targetPropertyNames.length;for(let o=0;o<i;o++)if(t[o]!==n[o])return!1;return!0};Dc.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){l(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};Dc.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;l(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(Dc.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):l(i)||(i=b_(this),l(i)&&this._definitionChanged.raiseEvent(this))};const kG={packedLength:1,pack:function(e,t,n){n=A(n,0),t[n]=e},unpack:function(e,t,n){return t=A(t,0),e[t]}};function GG(e,t,n){let i;const 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 WG(e,t){return e instanceof ie?e:typeof e=="string"?ie.fromIso8601(e):ie.addSeconds(t,e,new ie)}const JO=[],QO=[];function ZD(e,t,n,i,o){let r=0,s,a,c,u,d,h;for(;r<i.length;){d=WG(i[r],e),c=Bs(t,d,ie.compare);let m=0,g=0;if(c<0){for(c=~c,u=c*o,a=void 0,h=t[c];r<i.length&&(d=WG(i[r],e),!(l(a)&&ie.compare(a,d)>=0||l(h)&&ie.compare(d,h)>=0));){for(JO[m++]=d,r=r+1,s=0;s<o;s++)QO[g++]=i[r],r=r+1;a=d}m>0&&(QO.length=g,GG(n,u,QO),JO.length=m,GG(t,c,JO))}else{for(s=0;s<o;s++)r++,n[c*o+s]=i[r];r++}}}function Pu(e,t){T.defined("type",e);let n=e;n===Number&&(n=kG);let i=n.packedLength,o=A(n.packedInterpolationLength,i),r=0,s;if(l(t)){const a=t.length;s=new Array(a);for(let c=0;c<a;c++){let u=t[c];u===Number&&(u=kG);const d=u.packedLength;i+=d,o+=A(u.packedInterpolationLength,d),s[c]=u}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=Nnt,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 Ke,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=Dy.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=Dy.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(Pu.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))}}});Pu.prototype.getValue=function(e,t){T.defined("time",e);const n=this._times,i=n.length;if(i===0)return;let o;const r=this._innerType,s=this._values;let a=Bs(n,e,ie.compare);if(a<0){if(a=~a,a===0){const S=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===Dy.NONE||o!==0&&ie.secondsDifference(S,e)>o)return;if(this._backwardExtrapolationType===Dy.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const S=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===Dy.NONE||o!==0&&ie.secondsDifference(e,S)>o)return;if(this._forwardExtrapolationType===Dy.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const c=this._xTable,u=this._yTable,d=this._interpolationAlgorithm,h=this._packedInterpolationLength,m=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const S=Math.min(d.getRequiredDataPoints(this._interpolationDegree,m),i);S!==this._numberOfPoints&&(this._numberOfPoints=S,c.length=S,u.length=S*h)}const g=this._numberOfPoints-1;if(g<1)return;let p=0,y=i-1;if(y-p+1>=g+1){let S=a-(g/2|0)-1;S<p&&(S=p);let P=S+g;P>y&&(P=y,S=P-g,S<p&&(S=p)),p=S,y=P}const C=y-p+1;for(let S=0;S<C;++S)c[S]=ie.secondsDifference(n[p+S],n[y]);if(l(r.convertPackedArrayForInterpolation))r.convertPackedArrayForInterpolation(s,p,y,u);else{let S=0;const P=this._packedLength;let L=p*P;const z=(y+1)*P;for(;L<z;)u[S]=s[L],L++,S++}const E=ie.secondsDifference(e,n[y]);let w;if(m===0||!l(d.interpolate))w=d.interpolateOrderZero(E,c,u,h,this._interpolationResult);else{const S=Math.floor(h/(m+1));w=d.interpolate(E,c,u,S,m,m,this._interpolationResult)}return l(r.unpackInterpolationResult)?r.unpackInterpolationResult(w,s,p,y,t):r.unpack(w,0,t)}return r.unpack(s,a*this._packedLength,t)};Pu.prototype.setInterpolationOptions=function(e){if(!l(e))return;let t=!1;const n=e.interpolationAlgorithm,i=e.interpolationDegree;l(n)&&this._interpolationAlgorithm!==n&&(this._interpolationAlgorithm=n,t=!0),l(i)&&this._interpolationDegree!==i&&(this._interpolationDegree=i,t=!0),t&&(this._updateTableLength=!0,this._definitionChanged.raiseEvent(this))};Pu.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);T.defined("time",e),T.defined("value",t),o&&T.defined("derivatives",n);const r=this._innerType,s=[];if(s.push(e),r.pack(t,s,s.length),o){const a=i.length;for(let c=0;c<a;c++)i[c].pack(n[c],s,s.length)}ZD(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Pu.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);if(T.defined("times",e),T.defined("values",t),e.length!==t.length)throw new x("times and values must be the same length.");if(o&&(!l(n)||n.length!==e.length))throw new x("times and derivativeValues must be the same length.");const 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){const u=n[c],d=i.length;for(let h=0;h<d;h++)i[h].pack(u[h],a,a.length)}ZD(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Pu.prototype.addSamplesPackedArray=function(e,t){T.defined("packedSamples",e),ZD(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};Pu.prototype.removeSample=function(e){T.defined("time",e);const t=Bs(this._times,e,ie.compare);return t<0?!1:(yee(this,t,1),!0)};function yee(e,t,n){const i=e._packedLength;e._times.splice(t,n),e._values.splice(t*i,n*i),e._updateTableLength=!0,e._definitionChanged.raiseEvent(e)}Pu.prototype.removeSamples=function(e){T.defined("timeInterval",e);const t=this._times;let n=Bs(t,e.start,ie.compare);n<0?n=~n:e.isStartIncluded||++n;let i=Bs(t,e.stop,ie.compare);i<0?i=~i:e.isStopIncluded&&++i,yee(this,n,i-n)};Pu.prototype.equals=function(e){if(this===e)return!0;if(!l(e)||this._type!==e._type||this._interpolationDegree!==e._interpolationDegree||this._interpolationAlgorithm!==e._interpolationAlgorithm)return!1;const t=this._derivativeTypes,n=l(t),i=e._derivativeTypes,o=l(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}const a=this._times,c=e._times;if(s=a.length,s!==c.length)return!1;for(r=0;r<s;r++)if(!ie.equals(a[r],c[r]))return!1;const u=this._values,d=e._values;for(s=u.length,r=0;r<s;r++)if(u[r]!==d[r])return!1;return!0};Pu._mergeNewSamples=ZD;function Ic(e,t){t=A(t,0);let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=f}this._numberOfDerivatives=t,this._property=new Pu(f,n),this._definitionChanged=new Ke,this._referenceFrame=A(e,fa.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(Ic.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}}});Ic.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,fa.FIXED,t)};Ic.prototype.getValueInReferenceFrame=function(e,t,n){if(T.defined("time",e),T.defined("referenceFrame",t),n=this._property.getValue(e,n),l(n))return tm.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};Ic.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};Ic.prototype.addSample=function(e,t,n){const i=this._numberOfDerivatives;if(i>0&&(!l(n)||n.length!==i))throw new x("derivatives length must be equal to the number of derivatives.");this._property.addSample(e,t,n)};Ic.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};Ic.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};Ic.prototype.removeSample=function(e){return this._property.removeSample(e)};Ic.prototype.removeSamples=function(e){this._property.removeSamples(e)};Ic.prototype.equals=function(e){return this===e||e instanceof Ic&&Z.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};function zp(e){this._definitionChanged=new Ke,this._intervals=new Oo,this._intervals.changedEvent.addEventListener(zp.prototype._intervalsChanged,this),this._referenceFrame=A(e,fa.FIXED)}Object.defineProperties(zp.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}}});zp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,fa.FIXED,t)};zp.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new x("time is required.");if(!l(t))throw new x("referenceFrame is required.");const i=this._intervals.findDataForIntervalContainingDate(e);if(l(i))return tm.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};zp.prototype.equals=function(e){return this===e||e instanceof zp&&this._intervals.equals(e._intervals,Z.equals)&&this._referenceFrame===e._referenceFrame};zp.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};function Fa(){this._dataSources=[],this._dataSourceAdded=new Ke,this._dataSourceRemoved=new Ke,this._dataSourceMoved=new Ke}Object.defineProperties(Fa.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}}});Fa.prototype.add=function(e){if(!l(e))throw new x("dataSource is required.");const 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})};Fa.prototype.remove=function(e,t){t=A(t,!1);const 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};Fa.prototype.removeAll=function(e){e=A(e,!1);const t=this._dataSources;for(let n=0,i=t.length;n<i;++n){const o=t[n];this._dataSourceRemoved.raiseEvent(this,o),e&&typeof o.destroy=="function"&&o.destroy()}this._dataSources=[]};Fa.prototype.contains=function(e){return this.indexOf(e)!==-1};Fa.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};Fa.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._dataSources[e]};Fa.prototype.getByName=function(e){if(!l(e))throw new x("name is required.");return this._dataSources.filter(function(t){return t.name===e})};function eI(e,t){if(!l(t))throw new x("dataSource is required.");const n=e.indexOf(t);if(n===-1)throw new x("dataSource is not in this collection.");return n}function Aee(e,t,n){const i=e._dataSources,o=i.length-1;if(t=M.clamp(t,0,o),n=M.clamp(n,0,o),t===n)return;const r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}Fa.prototype.raise=function(e){const t=eI(this._dataSources,e);Aee(this,t,t+1)};Fa.prototype.lower=function(e){const t=eI(this._dataSources,e);Aee(this,t,t-1)};Fa.prototype.raiseToTop=function(e){const t=eI(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))};Fa.prototype.lowerToBottom=function(e){const t=eI(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};Fa.prototype.isDestroyed=function(){return!1};Fa.prototype.destroy=function(){return this.removeAll(!0),He(this)};function Md(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties(Md.prototype,{length:{get:function(){return this._length}}});Md.prototype.add=function(e,t){T.defined("primitive",e),l(t)&&T.typeOf.number("zIndex",t),t=A(t,0);let n=this._collections[t];if(!l(n)){n=new qo({destroyPrimitives:!1}),n._zIndex=t,this._collections[t]=n;const i=this._collectionsArray;let 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};Md.prototype.set=function(e,t){return T.defined("primitive",e),T.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};Md.prototype.remove=function(e,t){if(this.contains(e)){const n=e._zIndex,i=this._collections[n];let 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};Md.prototype.removeAll=function(){const e=this._collectionsArray;for(let t=0;t<e.length;t++){const n=e[t];n.destroyPrimitives=!0,n.destroy()}this._collections={},this._collectionsArray=[],this._length=0};Md.prototype.contains=function(e){if(!l(e))return!1;const t=this._collections[e._zIndex];return l(t)&&t.contains(e)};Md.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};Md.prototype.isDestroyed=function(){return!1};Md.prototype.destroy=function(){return this.removeAll(),He(this)};function _g(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new vt}_g.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};_g.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);l(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};_g.prototype.update=function(e){const t=this._dynamicUpdaters.values;for(let n=0,i=t.length;n<i;n++)t[n].update(e);return!0};_g.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};_g.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),l(e)&&l(e.getBoundingSphere)?e.getBoundingSphere(t):gt.FAILED};const AF={},Zx=new f,jG=new f,qG=new Te,$G=new J;function $g(e,t,n,i,o,r,s,a,c,u){const d=e+t;f.multiplyByScalar(i,Math.cos(d),Zx),f.multiplyByScalar(n,Math.sin(d),jG),f.add(Zx,jG,Zx);let h=Math.cos(e);h=h*h;let m=Math.sin(e);m=m*m;const p=r/Math.sqrt(s*h+o*m)/a;return Te.fromAxisAngle(Zx,p,qG),J.fromQuaternion(qG,$G),J.multiplyByVector($G,c,u),f.normalize(u,u),f.multiplyByScalar(u,a,u),u}const bee=new f,Cee=new f,VR=new f,Mnt=new f;AF.raisePositionsToHeight=function(e,t,n){const 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,u=n?c:0;for(let d=0;d<c;d+=3){const h=d+1,m=d+2,g=f.fromArray(e,d,bee);i.scaleToGeodeticSurface(g,g);const p=f.clone(g,Cee),y=i.geodeticSurfaceNormal(g,Mnt),b=f.multiplyByScalar(y,o,VR);f.add(g,b,g),n&&(f.multiplyByScalar(y,r,b),f.add(p,b,p),a[d+u]=p.x,a[h+u]=p.y,a[m+u]=p.z),a[d]=g.x,a[h]=g.y,a[m]=g.z}return a};const Fnt=new f,znt=new f,Unt=new f;AF.computeEllipsePositions=function(e,t,n){const i=e.semiMinorAxis,o=e.semiMajorAxis,r=e.rotation,s=e.center,a=e.granularity*8,c=i*i,u=o*o,d=o*i,h=f.magnitude(s),m=f.normalize(s,Fnt);let g=f.cross(f.UNIT_Z,s,znt);g=f.normalize(g,g);const p=f.cross(m,g,Unt);let y=1+Math.ceil(M.PI_OVER_TWO/a);const b=M.PI_OVER_TWO/(y-1);let C=M.PI_OVER_TWO-y*b;C<0&&(y-=Math.ceil(Math.abs(C)/b));const E=2*(y*(y+2)),w=t?new Array(E*3):void 0;let S=0,P=bee,L=Cee;const z=y*4*3;let R=z-1,F=0;const U=n?new Array(z):void 0;let D,I,_,v,O;for(C=M.PI_OVER_TWO,P=$g(C,r,p,g,c,d,u,h,m,P),t&&(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z),n&&(U[R--]=P.z,U[R--]=P.y,U[R--]=P.x),C=M.PI_OVER_TWO-b,D=1;D<y+1;++D){if(P=$g(C,r,p,g,c,d,u,h,m,P),L=$g(Math.PI-C,r,p,g,c,d,u,h,m,L),t){for(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,_=2*D+2,I=1;I<_-1;++I)v=I/(_-1),O=f.lerp(P,L,v,VR),w[S++]=O.x,w[S++]=O.y,w[S++]=O.z;w[S++]=L.x,w[S++]=L.y,w[S++]=L.z}n&&(U[R--]=P.z,U[R--]=P.y,U[R--]=P.x,U[F++]=L.x,U[F++]=L.y,U[F++]=L.z),C=M.PI_OVER_TWO-(D+1)*b}for(D=y;D>1;--D){if(C=M.PI_OVER_TWO-(D-1)*b,P=$g(-C,r,p,g,c,d,u,h,m,P),L=$g(C+Math.PI,r,p,g,c,d,u,h,m,L),t){for(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,_=2*(D-1)+2,I=1;I<_-1;++I)v=I/(_-1),O=f.lerp(P,L,v,VR),w[S++]=O.x,w[S++]=O.y,w[S++]=O.z;w[S++]=L.x,w[S++]=L.y,w[S++]=L.z}n&&(U[R--]=P.z,U[R--]=P.y,U[R--]=P.x,U[F++]=L.x,U[F++]=L.y,U[F++]=L.z)}C=M.PI_OVER_TWO,P=$g(-C,r,p,g,c,d,u,h,m,P);const N={};return t&&(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,N.positions=w,N.numPts=y),n&&(U[R--]=P.z,U[R--]=P.y,U[R--]=P.x,N.outerPositions=U),N};const Mf=AF,A0=new f,kR=new f,GR=new f,YG=new f,vr=new j,Tee=new J,Hnt=new J,WR=new Te,Eee=new f,xee=new f,wee=new f,Sv=new Ce,See=new f,vee=new j,Dee=new j;function Iee(e,t,n){const i=t.vertexFormat,o=t.center,r=t.semiMajorAxis,s=t.semiMinorAxis,a=t.ellipsoid,c=t.stRotation,u=n?e.length/3*2:e.length/3,d=t.shadowVolume,h=i.st?new Float32Array(u*2):void 0,m=i.normal?new Float32Array(u*3):void 0,g=i.tangent?new Float32Array(u*3):void 0,p=i.bitangent?new Float32Array(u*3):void 0,y=d?new Float32Array(u*3):void 0;let b=0,C=Eee,E=xee,w=wee;const S=new nr(a),P=S.project(a.cartesianToCartographic(o,Sv),See),L=a.scaleToGeodeticSurface(o,A0);a.geodeticSurfaceNormal(L,L);let z=Tee,R=Hnt;if(c!==0){let O=Te.fromAxisAngle(L,c,WR);z=J.fromQuaternion(O,z),O=Te.fromAxisAngle(L,-c,WR),R=J.fromQuaternion(O,R)}else z=J.clone(J.IDENTITY,z),R=J.clone(J.IDENTITY,R);const F=j.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,vee),U=j.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Dee);let D=e.length;const I=n?D:0,_=I/3*2;for(let O=0;O<D;O+=3){const N=O+1,V=O+2,k=f.fromArray(e,O,A0);if(i.st){const G=J.multiplyByVector(z,k,kR),W=S.project(a.cartesianToCartographic(G,Sv),GR);f.subtract(W,P,W),vr.x=(W.x+r)/(2*r),vr.y=(W.y+s)/(2*s),F.x=Math.min(vr.x,F.x),F.y=Math.min(vr.y,F.y),U.x=Math.max(vr.x,U.x),U.y=Math.max(vr.y,U.y),n&&(h[b+_]=vr.x,h[b+1+_]=vr.y),h[b++]=vr.x,h[b++]=vr.y}(i.normal||i.tangent||i.bitangent||d)&&(C=a.geodeticSurfaceNormal(k,C),d&&(y[O+I]=-C.x,y[N+I]=-C.y,y[V+I]=-C.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(E=f.normalize(f.cross(f.UNIT_Z,C,E),E),J.multiplyByVector(R,E,E)),i.normal&&(m[O]=C.x,m[N]=C.y,m[V]=C.z,n&&(m[O+I]=-C.x,m[N+I]=-C.y,m[V+I]=-C.z)),i.tangent&&(g[O]=E.x,g[N]=E.y,g[V]=E.z,n&&(g[O+I]=-E.x,g[N+I]=-E.y,g[V+I]=-E.z)),i.bitangent&&(w=f.normalize(f.cross(C,E,w),w),p[O]=w.x,p[N]=w.y,p[V]=w.z,n&&(p[O+I]=w.x,p[N+I]=w.y,p[V+I]=w.z))))}if(i.st){D=h.length;for(let O=0;O<D;O+=2)h[O]=(h[O]-F.x)/(U.x-F.x),h[O+1]=(h[O+1]-F.y)/(U.y-F.y)}const v=new Ji;if(i.position){const O=Mf.raisePositionsToHeight(e,t,n);v.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:O})}if(i.st&&(v.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&(v.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:m})),i.tangent&&(v.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(v.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),d&&(v.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),n&&l(t.offsetAttribute)){let O=new Uint8Array(u);if(t.offsetAttribute===yn.TOP)O=O.fill(1,0,u/2);else{const N=t.offsetAttribute===yn.NONE?0:1;O=O.fill(N)}v.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:O})}return v}function Pee(e){const t=new Array(12*(e*(e+1))-6);let 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}let Nm=new f;function Vnt(e){const t=e.center;Nm=f.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,Nm),e.height,Nm),Nm=f.add(t,Nm,Nm);const n=new fe(Nm,e.semiMajorAxis),i=Mf.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=Iee(o,e,!1);let a=Pee(r);return a=at.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function knt(e,t){const n=t.vertexFormat,i=t.center,o=t.semiMajorAxis,r=t.semiMinorAxis,s=t.ellipsoid,a=t.height,c=t.extrudedHeight,u=t.stRotation,d=e.length/3*2,h=new Float64Array(d*3),m=n.st?new Float32Array(d*2):void 0,g=n.normal?new Float32Array(d*3):void 0,p=n.tangent?new Float32Array(d*3):void 0,y=n.bitangent?new Float32Array(d*3):void 0,b=t.shadowVolume,C=b?new Float32Array(d*3):void 0;let E=0,w=Eee,S=xee,P=wee;const L=new nr(s),z=L.project(s.cartesianToCartographic(i,Sv),See),R=s.scaleToGeodeticSurface(i,A0);s.geodeticSurfaceNormal(R,R);const F=Te.fromAxisAngle(R,u,WR),U=J.fromQuaternion(F,Tee),D=j.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,vee),I=j.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Dee);let _=e.length;const v=_/3*2;for(let N=0;N<_;N+=3){const V=N+1,k=N+2;let G=f.fromArray(e,N,A0),W;if(n.st){const q=J.multiplyByVector(U,G,kR),te=L.project(s.cartesianToCartographic(q,Sv),GR);f.subtract(te,z,te),vr.x=(te.x+o)/(2*o),vr.y=(te.y+r)/(2*r),D.x=Math.min(vr.x,D.x),D.y=Math.min(vr.y,D.y),I.x=Math.max(vr.x,I.x),I.y=Math.max(vr.y,I.y),m[E+v]=vr.x,m[E+1+v]=vr.y,m[E++]=vr.x,m[E++]=vr.y}G=s.scaleToGeodeticSurface(G,G),W=f.clone(G,kR),w=s.geodeticSurfaceNormal(G,w),b&&(C[N+_]=-w.x,C[V+_]=-w.y,C[k+_]=-w.z);let K=f.multiplyByScalar(w,a,YG);if(G=f.add(G,K,G),K=f.multiplyByScalar(w,c,K),W=f.add(W,K,W),n.position&&(h[N+_]=W.x,h[V+_]=W.y,h[k+_]=W.z,h[N]=G.x,h[V]=G.y,h[k]=G.z),n.normal||n.tangent||n.bitangent){P=f.clone(w,P);const q=f.fromArray(e,(N+3)%_,YG);f.subtract(q,G,q);const te=f.subtract(W,G,GR);w=f.normalize(f.cross(te,q,w),w),n.normal&&(g[N]=w.x,g[V]=w.y,g[k]=w.z,g[N+_]=w.x,g[V+_]=w.y,g[k+_]=w.z),n.tangent&&(S=f.normalize(f.cross(P,w,S),S),p[N]=S.x,p[V]=S.y,p[k]=S.z,p[N+_]=S.x,p[N+1+_]=S.y,p[N+2+_]=S.z),n.bitangent&&(y[N]=P.x,y[V]=P.y,y[k]=P.z,y[N+_]=P.x,y[V+_]=P.y,y[k+_]=P.z)}}if(n.st){_=m.length;for(let N=0;N<_;N+=2)m[N]=(m[N]-D.x)/(I.x-D.x),m[N+1]=(m[N+1]-D.y)/(I.y-D.y)}const O=new Ji;if(n.position&&(O.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h})),n.st&&(O.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:m})),n.normal&&(O.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(O.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),n.bitangent&&(O.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),b&&(O.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:C})),l(t.offsetAttribute)){let N=new Uint8Array(d);if(t.offsetAttribute===yn.TOP)N=N.fill(1,0,d/2);else{const V=t.offsetAttribute===yn.NONE?0:1;N=N.fill(V)}O.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:N})}return O}function Gnt(e){const t=e.length/3,n=at.createTypedArray(t,t*6);let i=0;for(let o=0;o<t;o++){const 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}const ew=new fe,tw=new fe;function Wnt(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=f.multiplyByScalar(n.geodeticSurfaceNormal(t,A0),e.height,A0);ew.center=f.add(t,o,ew.center),ew.radius=i,o=f.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),tw.center=f.add(t,o,tw.center),tw.radius=i;const r=Mf.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,c=r.outerPositions,u=fe.union(ew,tw),d=Iee(s,e,!0);let h=Pee(a);const m=h.length;h.length=m*2;const g=s.length/3;for(let S=0;S<m;S+=3)h[S+m]=h[S+2]+g,h[S+1+m]=h[S+1]+g,h[S+2+m]=h[S]+g;const p=at.createTypedArray(g*2/3,h),y=new Lt({attributes:d,indices:p,primitiveType:Ze.TRIANGLES}),b=knt(c,e);h=Gnt(c);const C=at.createTypedArray(c.length*2/3,h),E=new Lt({attributes:b,indices:C,primitiveType:Ze.TRIANGLES}),w=Yi.combineInstances([new ln({geometry:y}),new ln({geometry:E})]);return{boundingSphere:u,attributes:w[0].attributes,indices:w[0].indices}}function Oee(e,t,n,i,o,r,s){const c=Mf.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,u=c.length/3,d=new Array(u);for(let m=0;m<u;++m)d[m]=f.fromArray(c,m*3);const h=ge.fromCartesianArray(d,r,s);return h.width>M.PI&&(h.north=h.north>0?M.PI_OVER_TWO-M.EPSILON7:h.north,h.south=h.south<0?M.EPSILON7-M.PI_OVER_TWO:h.south,h.east=M.PI,h.west=-M.PI),h}function bl(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,me.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,M.RADIANS_PER_DEGREE),s=A(e.vertexFormat,Fe.DEFAULT);if(T.defined("options.center",t),T.typeOf.number("options.semiMajorAxis",i),T.typeOf.number("options.semiMinorAxis",o),i<o)throw new x("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new x("granularity must be greater than zero.");const a=A(e.height,0),c=A(e.extrudedHeight,a);this._center=f.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=me.clone(n),this._rotation=A(e.rotation,0),this._stRotation=A(e.stRotation,0),this._height=Math.max(c,a),this._granularity=r,this._vertexFormat=Fe.clone(s),this._extrudedHeight=Math.min(c,a),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createEllipseGeometry",this._offsetAttribute=e.offsetAttribute,this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0}bl.packedLength=f.packedLength+me.packedLength+Fe.packedLength+9;bl.pack=function(e,t,n){return T.defined("value",e),T.defined("array",t),n=A(n,0),f.pack(e._center,t,n),n+=f.packedLength,me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.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]=A(e._offsetAttribute,-1),t};const Lee=new f,Bee=new me,Ree=new Fe,Uu={center:Lee,ellipsoid:Bee,vertexFormat:Ree,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};bl.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=f.unpack(e,t,Lee);t+=f.packedLength;const o=me.unpack(e,t,Bee);t+=me.packedLength;const r=Fe.unpack(e,t,Ree);t+=Fe.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],m=e[t++],g=e[t++]===1,p=e[t];return l(n)?(n._center=f.clone(i,n._center),n._ellipsoid=me.clone(o,n._ellipsoid),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=c,n._stRotation=u,n._height=d,n._granularity=h,n._extrudedHeight=m,n._shadowVolume=g,n._offsetAttribute=p===-1?void 0:p,n):(Uu.height=d,Uu.extrudedHeight=m,Uu.granularity=h,Uu.stRotation=u,Uu.rotation=c,Uu.semiMajorAxis=s,Uu.semiMinorAxis=a,Uu.shadowVolume=g,Uu.offsetAttribute=p===-1?void 0:p,new bl(Uu))};bl.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.center,i=A(e.ellipsoid,me.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=A(e.granularity,M.RADIANS_PER_DEGREE),a=A(e.rotation,0);if(T.defined("options.center",n),T.typeOf.number("options.semiMajorAxis",o),T.typeOf.number("options.semiMinorAxis",r),o<r)throw new x("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(s<=0)throw new x("granularity must be greater than zero.");return Oee(n,o,r,a,s,i,t)};bl.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!M.equalsEpsilon(t,n,0,M.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const 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};let r;if(i)o.extrudedHeight=n,o.shadowVolume=e._shadowVolume,o.offsetAttribute=e._offsetAttribute,r=Wnt(o);else if(r=Vnt(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===yn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Lt({attributes:r.attributes,indices:r.indices,primitiveType:Ze.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};bl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new bl({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Fe.POSITION_ONLY,shadowVolume:!0})};function jnt(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const i=Mf.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]=f.fromArray(i,c*3);const s=e._ellipsoid,a=e.rectangle;return Lt._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(bl.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=Oee(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=jnt(this)),this._textureCoordinateRotationPoints}}});const XG=new f;let Mm=new f;function qnt(e){const t=e.center;Mm=f.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,Mm),e.height,Mm),Mm=f.add(t,Mm,Mm);const n=new fe(Mm,e.semiMajorAxis),i=Mf.computeEllipsePositions(e,!1,!0).outerPositions,o=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:Mf.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=at.createTypedArray(r,r*2);let a=0;for(let c=0;c<r;++c)s[a++]=c,s[a++]=(c+1)%r;return{boundingSphere:n,attributes:o,indices:s}}const nw=new fe,iw=new fe;function $nt(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=f.multiplyByScalar(n.geodeticSurfaceNormal(t,XG),e.height,XG);nw.center=f.add(t,o,nw.center),nw.radius=i,o=f.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),iw.center=f.add(t,o,iw.center),iw.radius=i;let r=Mf.computeEllipsePositions(e,!1,!0).outerPositions;const s=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:Mf.raisePositionsToHeight(r,e,!0)})});r=s.position.values;const a=fe.union(nw,iw);let c=r.length/3;if(l(e.offsetAttribute)){let p=new Uint8Array(c);if(e.offsetAttribute===yn.TOP)p=p.fill(1,0,c/2);else{const y=e.offsetAttribute===yn.NONE?0:1;p=p.fill(y)}s.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}let u=A(e.numberOfVerticalLines,16);u=M.clamp(u,0,c/2);const d=at.createTypedArray(c,c*2+u*2);c/=2;let h=0,m;for(m=0;m<c;++m)d[h++]=m,d[h++]=(m+1)%c,d[h++]=m+c,d[h++]=(m+1)%c+c;let g;if(u>0){const p=Math.min(u,c);g=Math.round(c/p);const y=Math.min(g*u,c);for(m=0;m<y;m+=g)d[h++]=m,d[h++]=m+c}return{boundingSphere:a,attributes:s,indices:d}}function b0(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,me.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,M.RADIANS_PER_DEGREE);if(!l(t))throw new x("center is required.");if(!l(i))throw new x("semiMajorAxis is required.");if(!l(o))throw new x("semiMinorAxis is required.");if(i<o)throw new x("semiMajorAxis must be greater than or equal to the semiMinorAxis.");if(r<=0)throw new x("granularity must be greater than zero.");const s=A(e.height,0),a=A(e.extrudedHeight,s);this._center=f.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=me.clone(n),this._rotation=A(e.rotation,0),this._height=Math.max(a,s),this._granularity=r,this._extrudedHeight=Math.min(a,s),this._numberOfVerticalLines=Math.max(A(e.numberOfVerticalLines,16),0),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipseOutlineGeometry"}b0.packedLength=f.packedLength+me.packedLength+8;b0.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");return n=A(n,0),f.pack(e._center,t,n),n+=f.packedLength,me.pack(e._ellipsoid,t,n),n+=me.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]=A(e._offsetAttribute,-1),t};const Nee=new f,Mee=new me,Yd={center:Nee,ellipsoid:Mee,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};b0.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=f.unpack(e,t,Nee);t+=f.packedLength;const o=me.unpack(e,t,Mee);t+=me.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++],m=e[t];return l(n)?(n._center=f.clone(i,n._center),n._ellipsoid=me.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=c,n._granularity=u,n._extrudedHeight=d,n._numberOfVerticalLines=h,n._offsetAttribute=m===-1?void 0:m,n):(Yd.height=c,Yd.extrudedHeight=d,Yd.granularity=u,Yd.rotation=a,Yd.semiMajorAxis=r,Yd.semiMinorAxis=s,Yd.numberOfVerticalLines=h,Yd.offsetAttribute=m===-1?void 0:m,new b0(Yd))};b0.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!M.equalsEpsilon(t,n,0,M.EPSILON2);e._center=e._ellipsoid.scaleToGeodeticSurface(e._center,e._center);const o={center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:e._ellipsoid,rotation:e._rotation,height:t,granularity:e._granularity,numberOfVerticalLines:e._numberOfVerticalLines};let r;if(i)o.extrudedHeight=n,o.offsetAttribute=e._offsetAttribute,r=$nt(o);else if(r=qnt(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===yn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Lt({attributes:r.attributes,indices:r.indices,primitiveType:Ze.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};const Fee=new H,zee=f.ZERO,Uee=new f,Hee=new ge;function Ynt(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 su(e,t){Zt.call(this,{entity:e,scene:t,geometryOptions:new Ynt(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}l(Object.create)&&(su.prototype=Object.create(Zt.prototype),su.prototype.constructor=su);su.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof nn){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,Fee)),l(o)||(o=H.WHITE),i.color=pn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,zee,Uee))),new ln({id:t,geometry:new bl(this._options),attributes:i})};su.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,Fee),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,zee,Uee))),new ln({id:t,geometry:new b0(this._options),attributes:r})};su.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};su.prototype._isHidden=function(e,t){const n=e.position;return!l(n)||!l(t.semiMajorAxis)||!l(t.semiMinorAxis)||Wn.prototype._isHidden.call(this,e,t)};su.prototype._isDynamic=function(e,t){return!e.position.isConstant||!t.semiMajorAxis.isConstant||!t.semiMinorAxis.isConstant||!Z.isConstant(t.rotation)||!Z.isConstant(t.height)||!Z.isConstant(t.extrudedHeight)||!Z.isConstant(t.granularity)||!Z.isConstant(t.stRotation)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.numberOfVerticalLines)||!Z.isConstant(t.zIndex)||this._onTerrain&&!Z.isConstant(this._materialProperty)&&!(this._materialProperty instanceof nn)};su.prototype._setStaticOptions=function(e,t){let n=Z.getValueOrUndefined(t.height,ft.MINIMUM_VALUE);const i=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE);let o=Z.getValueOrUndefined(t.extrudedHeight,ft.MINIMUM_VALUE);const r=Z.getValueOrDefault(t.extrudedHeightReference,ft.MINIMUM_VALUE,St.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof nn?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(ft.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(ft.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(ft.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=Z.getValueOrUndefined(t.rotation,ft.MINIMUM_VALUE),s.granularity=Z.getValueOrUndefined(t.granularity,ft.MINIMUM_VALUE),s.stRotation=Z.getValueOrUndefined(t.stRotation,ft.MINIMUM_VALUE),s.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,ft.MINIMUM_VALUE),s.offsetAttribute=Zt.computeGeometryOffsetAttribute(n,i,o,r),s.height=Zt.getGeometryHeight(n,i),o=Zt.getGeometryExtrudedHeight(o,r),o===Zt.CLAMP_TO_GROUND&&(o=lo.getMinimumMaximumHeights(bl.computeRectangle(s,Hee)).minimumTerrainHeight),s.extrudedHeight=o};su.DynamicGeometryUpdater=jy;function jy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(jy.prototype=Object.create(yi.prototype),jy.prototype.constructor=jy);jy.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.center)||!l(i.semiMajorAxis)||!l(i.semiMinorAxis)||yi.prototype._isHidden.call(this,e,t,n)};jy.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,St.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,St.NONE);l(s)&&!l(o)&&(o=0),i.center=Z.getValueOrUndefined(e.position,n,i.center),i.semiMajorAxis=Z.getValueOrUndefined(t.semiMajorAxis,n),i.semiMinorAxis=Z.getValueOrUndefined(t.semiMinorAxis,n),i.rotation=Z.getValueOrUndefined(t.rotation,n),i.granularity=Z.getValueOrUndefined(t.granularity,n),i.stRotation=Z.getValueOrUndefined(t.stRotation,n),i.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,n),i.offsetAttribute=Zt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Zt.getGeometryHeight(o,r),s=Zt.getGeometryExtrudedHeight(s,a),s===Zt.CLAMP_TO_GROUND&&(s=lo.getMinimumMaximumHeights(bl.computeRectangle(i,Hee)).minimumTerrainHeight),i.extrudedHeight=s};const Xnt=new nn(H.WHITE),bF=f.ZERO,CF=new f,Knt=new f,Jnt=new f,TF=new H,Qnt=new f(1,1,1);function Znt(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 yc(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new Znt(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}l(Object.create)&&(yc.prototype=Object.create(Wn.prototype),yc.prototype.constructor=yc);Object.defineProperties(yc.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});yc.prototype.createFillGeometryInstance=function(e,t,n){T.defined("time",e);const i=this._entity,o=i.isAvailable(e);let r;const s=new Xn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),c=Ii.fromDistanceDisplayCondition(a),u={show:s,distanceDisplayCondition:c,color:void 0,offset:void 0};if(this._materialProperty instanceof nn){let d;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(d=this._materialProperty.color.getValue(e,TF)),l(d)||(d=H.WHITE),r=pn.fromColor(d),u.color=r}return l(this._options.offsetAttribute)&&(u.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,bF,CF))),new ln({id:i,geometry:new hc(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:u})};yc.prototype.createOutlineGeometryInstance=function(e,t,n){T.defined("time",e);const i=this._entity,o=i.isAvailable(e),r=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,TF),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new Xn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(r),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(s),offset:void 0};return l(this._options.offsetAttribute)&&(a.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,bF,CF))),new ln({id:i,geometry:new Ec(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:a})};yc.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};yc.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.radii)||Wn.prototype._isHidden.call(this,e,t)};yc.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.radii.isConstant||!Z.isConstant(t.innerRadii)||!Z.isConstant(t.stackPartitions)||!Z.isConstant(t.slicePartitions)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.minimumClock)||!Z.isConstant(t.maximumClock)||!Z.isConstant(t.minimumCone)||!Z.isConstant(t.maximumCone)||!Z.isConstant(t.subdivisions)};yc.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof nn?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(ft.MINIMUM_VALUE,i.radii),i.innerRadii=Z.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=Z.getValueOrUndefined(t.minimumClock,ft.MINIMUM_VALUE),i.maximumClock=Z.getValueOrUndefined(t.maximumClock,ft.MINIMUM_VALUE),i.minimumCone=Z.getValueOrUndefined(t.minimumCone,ft.MINIMUM_VALUE),i.maximumCone=Z.getValueOrUndefined(t.maximumCone,ft.MINIMUM_VALUE),i.stackPartitions=Z.getValueOrUndefined(t.stackPartitions,ft.MINIMUM_VALUE),i.slicePartitions=Z.getValueOrUndefined(t.slicePartitions,ft.MINIMUM_VALUE),i.subdivisions=Z.getValueOrUndefined(t.subdivisions,ft.MINIMUM_VALUE),i.offsetAttribute=n!==St.NONE?yn.ALL:void 0};yc.prototype._onEntityPropertyChanged=S2;yc.DynamicGeometryUpdater=Jb;function Jb(e,t,n){yi.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new B,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new f,this._material={}}l(Object.create)&&(Jb.prototype=Object.create(yi.prototype),Jb.prototype.constructor=Jb);Jb.prototype.update=function(e){T.defined("time",e);const t=this._entity,n=t.ellipsoid;if(!t.isShowing||!t.isAvailable(e)||!Z.getValueOrDefault(n.show,e,!0)){l(this._primitive)&&(this._primitive.show=!1),l(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const i=Z.getValueOrUndefined(n.radii,e,Knt);let o=l(i)?t.computeModelMatrixForHeightReference(e,n.heightReference,i.z*.5,this._scene.mapProjection.ellipsoid,this._modelMatrix):void 0;if(!l(o)||!l(i)){l(this._primitive)&&(this._primitive.show=!1),l(this._outlinePrimitive)&&(this._outlinePrimitive.show=!1);return}const r=Z.getValueOrDefault(n.fill,e,!0),s=Z.getValueOrDefault(n.outline,e,!1),a=Z.getValueOrClonedDefault(n.outlineColor,e,H.BLACK,TF),c=Or.getValue(e,A(n.material,Xnt),this._material),u=Z.getValueOrUndefined(n.innerRadii,e,Jnt),d=Z.getValueOrUndefined(n.minimumClock,e),h=Z.getValueOrUndefined(n.maximumClock,e),m=Z.getValueOrUndefined(n.minimumCone,e),g=Z.getValueOrUndefined(n.maximumCone,e),p=Z.getValueOrUndefined(n.stackPartitions,e),y=Z.getValueOrUndefined(n.slicePartitions,e),b=Z.getValueOrUndefined(n.subdivisions,e),C=Z.getValueOrDefault(n.outlineWidth,e,1),E=Z.getValueOrDefault(n.heightReference,e,St.NONE),w=E!==St.NONE?yn.ALL:void 0,S=this._scene.mode,P=S===le.SCENE3D&&E===St.NONE,L=this._options,z=this._geometryUpdater.shadowsProperty.getValue(e),F=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),U=Z.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,bF,CF);if(!P||this._lastSceneMode!==S||!l(this._primitive)||L.stackPartitions!==p||L.slicePartitions!==y||l(u)&&!f.equals(L.innerRadii!==u)||L.minimumClock!==d||L.maximumClock!==h||L.minimumCone!==m||L.maximumCone!==g||L.subdivisions!==b||this._lastOutlineWidth!==C||L.offsetAttribute!==w){const I=this._primitives;if(I.removeAndDestroy(this._primitive),I.removeAndDestroy(this._outlinePrimitive),this._primitive=void 0,this._outlinePrimitive=void 0,this._lastSceneMode=S,this._lastOutlineWidth=C,L.stackPartitions=p,L.slicePartitions=y,L.subdivisions=b,L.offsetAttribute=w,L.radii=f.clone(P?Qnt:i,L.radii),l(u))if(P){const N=f.magnitude(i);L.innerRadii=f.fromElements(u.x/N,u.y/N,u.z/N,L.innerRadii)}else L.innerRadii=f.clone(u,L.innerRadii);else L.innerRadii=void 0;L.minimumClock=d,L.maximumClock=h,L.minimumCone=m,L.maximumCone=g;const _=new Zo({material:c,translucent:c.isTranslucent(),closed:!0});L.vertexFormat=_.vertexFormat;const v=this._geometryUpdater.createFillGeometryInstance(e,P,this._modelMatrix);this._primitive=I.add(new Jt({geometryInstances:v,appearance:_,asynchronous:!1,shadows:z}));const O=this._geometryUpdater.createOutlineGeometryInstance(e,P,this._modelMatrix);this._outlinePrimitive=I.add(new Jt({geometryInstances:O,appearance:new wn({flat:!0,translucent:O.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(C)}}),asynchronous:!1,shadows:z})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=H.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=F,this._lastOffset=f.clone(U,this._lastOffset)}else if(this._primitive.ready){const I=this._primitive,_=this._outlinePrimitive;I.show=!0,_.show=!0,I.appearance.material=c;let v=this._attributes;l(v)||(v=I.getGeometryInstanceAttributes(t),this._attributes=v),r!==this._lastShow&&(v.show=Xn.toValue(r,v.show),this._lastShow=r);let O=this._outlineAttributes;l(O)||(O=_.getGeometryInstanceAttributes(t),this._outlineAttributes=O),s!==this._lastOutlineShow&&(O.show=Xn.toValue(s,O.show),this._lastOutlineShow=s),H.equals(a,this._lastOutlineColor)||(O.color=pn.toValue(a,O.color),H.clone(a,this._lastOutlineColor)),jt.equals(F,this._lastDistanceDisplayCondition)||(v.distanceDisplayCondition=Ii.toValue(F,v.distanceDisplayCondition),O.distanceDisplayCondition=Ii.toValue(F,O.distanceDisplayCondition),jt.clone(F,this._lastDistanceDisplayCondition)),f.equals(U,this._lastOffset)||(v.offset=jo.toValue(U,v.offset),O.offset=jo.toValue(U,v.offset),f.clone(U,this._lastOffset))}P&&(i.x=Math.max(i.x,.001),i.y=Math.max(i.y,.001),i.z=Math.max(i.z,.001),o=B.multiplyByScale(o,i,o),this._primitive.modelMatrix=o,this._outlinePrimitive.modelMatrix=o)};function C0(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.vertexFormat,Fe.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}C0.packedLength=Fe.packedLength;C0.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),Fe.pack(e._vertexFormat,t,n),t};const Vee=new Fe,eit={vertexFormat:Vee};C0.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=Fe.unpack(e,t,Vee);return l(n)?(n._vertexFormat=Fe.clone(i,n._vertexFormat),n):new C0(eit)};const ow=new f(-.5,-.5,0),rw=new f(.5,.5,0);C0.createGeometry=function(e){const t=e._vertexFormat,n=new Ji;let i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=ow.x,o[1]=ow.y,o[2]=0,o[3]=rw.x,o[4]=ow.y,o[5]=0,o[6]=rw.x,o[7]=rw.y,o[8]=0,o[9]=ow.x,o[10]=rw.y,o[11]=0,n.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:o}),t.normal){const 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 Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:r})}if(t.st){const 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 Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:r})}if(t.tangent){const 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 Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:r})}if(t.bitangent){const 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 Ue({componentDatatype:ee.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 Lt({attributes:n,indices:i,primitiveType:Ze.TRIANGLES,boundingSphere:new fe(f.ZERO,Math.sqrt(2))})};function T0(){this._workerName="createPlaneOutlineGeometry"}T0.packedLength=0;T0.pack=function(e,t){return T.defined("value",e),T.defined("array",t),t};T0.unpack=function(e,t,n){return T.defined("array",e),l(n)?n:new T0};const Ph=new f(-.5,-.5,0),sw=new f(.5,.5,0);T0.createGeometry=function(){const e=new Ji,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=Ph.x,n[1]=Ph.y,n[2]=Ph.z,n[3]=sw.x,n[4]=Ph.y,n[5]=Ph.z,n[6]=sw.x,n[7]=sw.y,n[8]=Ph.z,n[9]=Ph.x,n[10]=sw.y,n[11]=Ph.z,e.position=new Ue({componentDatatype:ee.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 Lt({attributes:e,indices:t,primitiveType:Ze.LINES,boundingSphere:new fe(f.ZERO,Math.sqrt(2))})};const tit=new f,kee=new H;function nit(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function hl(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new nit(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}l(Object.create)&&(hl.prototype=Object.create(Wn.prototype),hl.prototype.constructor=hl);hl.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Ii.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof nn){let g;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,kee)),l(g)||(g=H.WHITE),o=pn.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};const c=t.plane,u=this._options;let d=t.computeModelMatrix(e);const h=Z.getValueOrDefault(c.plane,e,u.plane),m=Z.getValueOrUndefined(c.dimensions,e,u.dimensions);return u.plane=h,u.dimensions=m,d=EF(h,m,d,d),new ln({id:t,geometry:new C0(this._options),modelMatrix:d,attributes:i})};hl.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,kee),o=this._distanceDisplayConditionProperty.getValue(e),r=t.plane,s=this._options;let a=t.computeModelMatrix(e);const c=Z.getValueOrDefault(r.plane,e,s.plane),u=Z.getValueOrUndefined(r.dimensions,e,s.dimensions);return s.plane=c,s.dimensions=u,a=EF(c,u,a,a),new ln({id:t,geometry:new T0,modelMatrix:a,attributes:{show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o)}})};hl.prototype._isHidden=function(e,t){return!l(t.plane)||!l(t.dimensions)||!l(e.position)||Wn.prototype._isHidden.call(this,e,t)};hl.prototype._getIsClosed=function(e){return!1};hl.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!Z.isConstant(t.outlineWidth)};hl.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof nn,i=this._options;i.vertexFormat=n?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(ft.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(ft.MINIMUM_VALUE,i.dimensions)};hl.DynamicGeometryUpdater=qy;function qy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(qy.prototype=Object.create(yi.prototype),qy.prototype.constructor=qy);qy.prototype._isHidden=function(e,t,n){const i=this._options,o=Z.getValueOrUndefined(e.position,n,tit);return!l(o)||!l(i.plane)||!l(i.dimensions)||yi.prototype._isHidden.call(this,e,t,n)};qy.prototype._setOptions=function(e,t,n){const i=this._options;i.plane=Z.getValueOrDefault(t.plane,n,i.plane),i.dimensions=Z.getValueOrUndefined(t.dimensions,n,i.dimensions)};const iit=new f,oit=new f,rit=new f,sit=new f,ait=new J,cit=new J,lit=new B;function EF(e,t,n,i){const o=e.normal,r=e.distance,s=f.multiplyByScalar(o,-r,rit);let a=f.clone(f.UNIT_Z,oit);M.equalsEpsilon(Math.abs(f.dot(a,o)),1,M.EPSILON8)&&(a=f.clone(f.UNIT_Y,a));const c=f.cross(a,o,iit);a=f.cross(o,c,a),f.normalize(c,c),f.normalize(a,a);const u=ait;J.setColumn(u,0,c,u),J.setColumn(u,1,a,u),J.setColumn(u,2,o,u);const d=f.fromElements(t.x,t.y,1,sit),h=J.multiplyByScale(u,d,cit),m=B.fromRotationTranslation(h,s,lit);return B.multiplyTransformation(n,m,i)}hl.createPrimitiveMatrix=EF;const uit=new f,dit=new Ye,fit=new j,hit=new j,pit=new f,mit=new f,_it=new f,YA=new f,git=new f,yit=new f,KG=new Te,Ait=new J,bit=new J,Cit=new f;function Tit(e,t,n,i,o,r,s,a,c){const u=e.positions;let d=no.triangulate(e.positions2D,e.holes);d.length<3&&(d=[0,1,2]);const h=at.createTypedArray(u.length,d.length);h.set(d);let m=Ait;if(i!==0){let D=Te.fromAxisAngle(s,i,KG);if(m=J.fromQuaternion(D,m),t.tangent||t.bitangent){D=Te.fromAxisAngle(s,-i,KG);const I=J.fromQuaternion(D,bit);a=f.normalize(J.multiplyByVector(I,a,a),a),t.bitangent&&(c=f.normalize(f.cross(s,a,c),c))}}else m=J.clone(J.IDENTITY,m);const g=hit;t.st&&(g.x=n.x,g.y=n.y);const p=u.length,y=p*3,b=new Float64Array(y),C=t.normal?new Float32Array(y):void 0,E=t.tangent?new Float32Array(y):void 0,w=t.bitangent?new Float32Array(y):void 0,S=t.st?new Float32Array(p*2):void 0;let P=0,L=0,z=0,R=0,F=0;for(let D=0;D<p;D++){const I=u[D];if(b[P++]=I.x,b[P++]=I.y,b[P++]=I.z,t.st)if(l(o)&&o.positions.length===p)S[F++]=o.positions[D].x,S[F++]=o.positions[D].y;else{const _=J.multiplyByVector(m,I,uit),v=r(_,fit);j.subtract(v,g,v);const O=M.clamp(v.x/n.width,0,1),N=M.clamp(v.y/n.height,0,1);S[F++]=O,S[F++]=N}t.normal&&(C[L++]=s.x,C[L++]=s.y,C[L++]=s.z),t.tangent&&(E[R++]=a.x,E[R++]=a.y,E[R++]=a.z),t.bitangent&&(w[z++]=c.x,w[z++]=c.y,w[z++]=c.z)}const U=new Ji;return t.position&&(U.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:b})),t.normal&&(U.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:C})),t.tangent&&(U.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(U.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:w})),t.st&&(U.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:S})),new Lt({attributes:U,indices:h,primitiveType:Ze.TRIANGLES})}function R_(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy,n=e.textureCoordinates;T.defined("options.polygonHierarchy",t);const i=A(e.vertexFormat,Fe.DEFAULT);this._vertexFormat=Fe.clone(i),this._polygonHierarchy=t,this._stRotation=A(e.stRotation,0),this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=Gn.computeHierarchyPackedLength(t,f)+Fe.packedLength+me.packedLength+(l(n)?Gn.computeHierarchyPackedLength(n,j):1)+2}R_.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions},vertexFormat:e.vertexFormat,stRotation:e.stRotation,ellipsoid:e.ellipsoid,textureCoordinates:e.textureCoordinates};return new R_(t)};R_.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),n=Gn.packPolygonHierarchy(e._polygonHierarchy,t,n,f),me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n++]=e._stRotation,l(e._textureCoordinates)?n=Gn.packPolygonHierarchy(e._textureCoordinates,t,n,j):t[n++]=-1,t[n++]=e.packedLength,t};const Eit=me.clone(me.UNIT_SPHERE),xit=new Fe,wit={polygonHierarchy:{}};R_.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=Gn.unpackPolygonHierarchy(e,t,f);t=i.startingIndex,delete i.startingIndex;const o=me.unpack(e,t,Eit);t+=me.packedLength;const r=Fe.unpack(e,t,xit);t+=Fe.packedLength;const s=e[t++],a=e[t]===-1?void 0:Gn.unpackPolygonHierarchy(e,t,j);l(a)?(t=a.startingIndex,delete a.startingIndex):t++;const c=e[t++];return l(n)||(n=new R_(wit)),n._polygonHierarchy=i,n._ellipsoid=me.clone(o,n._ellipsoid),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=c,n};R_.createGeometry=function(e){const t=e._vertexFormat,n=e._polygonHierarchy,i=e._stRotation,o=e._textureCoordinates,r=l(o);let s=n.positions;if(s=da(s,f.equalsEpsilon,!0),s.length<3)return;let a=pit,c=mit,u=_it,d=git;const h=yit;if(!fS.computeProjectTo2DArguments(s,YA,d,h))return;if(a=f.cross(d,h,a),a=f.normalize(a,a),!f.equalsEpsilon(YA,f.ZERO,M.EPSILON6)){const F=e._ellipsoid.geodeticSurfaceNormal(YA,Cit);f.dot(a,F)<0&&(a=f.negate(a,a),d=f.negate(d,d))}const g=fS.createProjectPointsTo2DFunction(YA,d,h),p=fS.createProjectPointTo2DFunction(YA,d,h);t.tangent&&(c=f.clone(d,c)),t.bitangent&&(u=f.clone(h,u));const y=Gn.polygonsFromHierarchy(n,r,g,!1),b=y.hierarchy,C=y.polygons,E=function(F){return F},w=r?Gn.polygonsFromHierarchy(o,!0,E,!1).polygons:void 0;if(b.length===0)return;s=b[0].outerRing;const S=fe.fromPoints(s),P=Gn.computeBoundingRectangle(a,p,s,i,dit),L=[];for(let F=0;F<C.length;F++){const U=new ln({geometry:Tit(C[F],t,P,i,r?w[F]:void 0,p,a,c,u)});L.push(U)}const z=Yi.combineInstances(L)[0];z.attributes.position.values=new Float64Array(z.attributes.position.values),z.indices=at.createTypedArray(z.attributes.position.values.length/3,z.indices);const R=z.attributes;return t.position||delete R.position,new Lt({attributes:R,indices:z.indices,primitiveType:z.primitiveType,boundingSphere:S})};const Sit=new Ce,JG=new Ce;function vit(e,t,n,i){const r=i.cartesianToCartographic(e,Sit).height,s=i.cartesianToCartographic(t,JG);s.height=r,i.cartographicToCartesian(s,t);const a=i.cartesianToCartographic(n,JG);a.height=r-100,i.cartographicToCartesian(a,n)}const Dit=new Ye,Iit=new f,Pit=new f,Oit=new f,Lit=new f,Bit=new f,Rit=new f;let aw=new f,Hu=new f,Yg=new f;const Nit=new j,Mit=new j,Fit=new f,QG=new Te,zit=new J,Uit=new J;function ZO(e){const t=e.vertexFormat,n=e.geometry,i=e.shadowVolume,o=n.attributes.position.values,r=l(n.attributes.st)?n.attributes.st.values:void 0;let s=o.length;const a=e.wall,c=e.top||a,u=e.bottom||a;if(t.st||t.normal||t.tangent||t.bitangent||i){const d=e.boundingRectangle,h=e.tangentPlane,m=e.ellipsoid,g=e.stRotation,p=e.perPositionHeight,y=Nit;y.x=d.x,y.y=d.y;const b=t.st?new Float32Array(2*(s/3)):void 0;let C;t.normal&&(p&&c&&!a?C=n.attributes.normal.values:C=new Float32Array(s));const E=t.tangent?new Float32Array(s):void 0,w=t.bitangent?new Float32Array(s):void 0,S=i?new Float32Array(s):void 0;let P=0,L=0,z=Pit,R=Oit,F=Lit,U=!0,D=zit,I=Uit;if(g!==0){let O=Te.fromAxisAngle(h._plane.normal,g,QG);D=J.fromQuaternion(O,D),O=Te.fromAxisAngle(h._plane.normal,-g,QG),I=J.fromQuaternion(O,I)}else D=J.clone(J.IDENTITY,D),I=J.clone(J.IDENTITY,I);let _=0,v=0;c&&u&&(_=s/2,v=s/3,s/=2);for(let O=0;O<s;O+=3){const N=f.fromArray(o,O,Fit);if(t.st&&!l(r)){let V=J.multiplyByVector(D,N,Iit);V=m.scaleToGeodeticSurface(V,V);const k=h.projectPointOntoPlane(V,Mit);j.subtract(k,y,k);const G=M.clamp(k.x/d.width,0,1),W=M.clamp(k.y/d.height,0,1);u&&(b[P+v]=G,b[P+1+v]=W),c&&(b[P]=G,b[P+1]=W),P+=2}if(t.normal||t.tangent||t.bitangent||i){const V=L+1,k=L+2;if(a){if(O+3<s){const G=f.fromArray(o,O+3,Bit);if(U){const W=f.fromArray(o,O+s,Rit);p&&vit(N,G,W,m),f.subtract(G,N,G),f.subtract(W,N,W),z=f.normalize(f.cross(W,G,z),z),U=!1}f.equalsEpsilon(G,N,M.EPSILON10)&&(U=!0)}(t.tangent||t.bitangent)&&(F=m.geodeticSurfaceNormal(N,F),t.tangent&&(R=f.normalize(f.cross(F,z,R),R)))}else z=m.geodeticSurfaceNormal(N,z),(t.tangent||t.bitangent)&&(p&&(aw=f.fromArray(C,L,aw),Hu=f.cross(f.UNIT_Z,aw,Hu),Hu=f.normalize(J.multiplyByVector(I,Hu,Hu),Hu),t.bitangent&&(Yg=f.normalize(f.cross(aw,Hu,Yg),Yg))),R=f.cross(f.UNIT_Z,z,R),R=f.normalize(J.multiplyByVector(I,R,R),R),t.bitangent&&(F=f.normalize(f.cross(z,R,F),F)));t.normal&&(e.wall?(C[L+_]=z.x,C[V+_]=z.y,C[k+_]=z.z):u&&(C[L+_]=-z.x,C[V+_]=-z.y,C[k+_]=-z.z),(c&&!p||a)&&(C[L]=z.x,C[V]=z.y,C[k]=z.z)),i&&(a&&(z=m.geodeticSurfaceNormal(N,z)),S[L+_]=-z.x,S[V+_]=-z.y,S[k+_]=-z.z),t.tangent&&(e.wall?(E[L+_]=R.x,E[V+_]=R.y,E[k+_]=R.z):u&&(E[L+_]=-R.x,E[V+_]=-R.y,E[k+_]=-R.z),c&&(p?(E[L]=Hu.x,E[V]=Hu.y,E[k]=Hu.z):(E[L]=R.x,E[V]=R.y,E[k]=R.z))),t.bitangent&&(u&&(w[L+_]=F.x,w[V+_]=F.y,w[k+_]=F.z),c&&(p?(w[L]=Yg.x,w[V]=Yg.y,w[k]=Yg.z):(w[L]=F.x,w[V]=F.y,w[k]=F.z))),L+=3}}t.st&&!l(r)&&(n.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:b})),t.normal&&(n.attributes.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:C})),t.tangent&&(n.attributes.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(n.attributes.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:w})),i&&(n.attributes.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:S}))}if(e.extrude&&l(e.offsetAttribute)){const d=o.length/3;let h=new Uint8Array(d);if(e.offsetAttribute===yn.TOP)c&&u||a?h=h.fill(1,0,d/2):c&&(h=h.fill(1));else{const m=e.offsetAttribute===yn.NONE?0:1;h=h.fill(m)}n.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return n}const Hit=new Ce,Vit=new Ce,Oh={westOverIDL:0,eastOverIDL:0};let Xg=new qf;function Gee(e,t,n,i,o){if(o=A(o,new ge),!l(e)||e.length<3)return o.west=0,o.north=0,o.south=0,o.east=0,o;if(n===Bn.RHUMB)return ge.fromCartesianArray(e,t,o);Xg.ellipsoid.equals(t)||(Xg=new qf(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,Oh.westOverIDL=Number.POSITIVE_INFINITY,Oh.eastOverIDL=Number.NEGATIVE_INFINITY;const r=1/M.chordLength(i,t.maximumRadius),s=e.length;let a=t.cartesianToCartographic(e[0],Vit),c=Hit,u;for(let d=1;d<s;d++)u=c,c=a,a=t.cartesianToCartographic(e[d],u),Xg.setEndPoints(c,a),ZG(Xg,r,o,Oh);return u=c,c=a,a=t.cartesianToCartographic(e[0],u),Xg.setEndPoints(c,a),ZG(Xg,r,o,Oh),o.east-o.west>Oh.eastOverIDL-Oh.westOverIDL&&(o.west=Oh.westOverIDL,o.east=Oh.eastOverIDL,o.east>M.PI&&(o.east=o.east-M.TWO_PI),o.west>M.PI&&(o.west=o.west-M.TWO_PI)),o}const kit=new Ce;function ZG(e,t,n,i){const o=e.surfaceDistance,r=Math.ceil(o*t),s=r>0?o/(r-1):Number.POSITIVE_INFINITY;let a=0;for(let c=0;c<r;c++){const u=e.interpolateUsingSurfaceDistance(a,kit);a+=s;const d=u.longitude,h=u.latitude;n.west=Math.min(n.west,d),n.east=Math.max(n.east,d),n.south=Math.min(n.south,h),n.north=Math.max(n.north,h);const m=d>=0?d:d+M.TWO_PI;i.westOverIDL=Math.min(i.westOverIDL,m),i.eastOverIDL=Math.max(i.eastOverIDL,m)}}const e8=[];function Git(e,t,n,i,o,r,s,a,c,u){const d={walls:[]};let h;if(s||a){const E=Gn.createGeometryFromPositions(e,t,n,i,r,c,u),w=E.attributes.position.values,S=E.indices;let P,L;if(s&&a){const z=w.concat(w);P=z.length/3,L=at.createTypedArray(P,S.length*2),L.set(S);const R=S.length,F=P/2;for(h=0;h<R;h+=3){const U=L[h]+F,D=L[h+1]+F,I=L[h+2]+F;L[h+R]=I,L[h+1+R]=D,L[h+2+R]=U}if(E.attributes.position.values=z,r&&c.normal){const U=E.attributes.normal.values;E.attributes.normal.values=new Float32Array(z.length),E.attributes.normal.values.set(U)}if(c.st&&l(n)){const U=E.attributes.st.values;E.attributes.st.values=new Float32Array(P*2),E.attributes.st.values=U.concat(U)}E.indices=L}else if(a){for(P=w.length/3,L=at.createTypedArray(P,S.length),h=0;h<S.length;h+=3)L[h]=S[h+2],L[h+1]=S[h+1],L[h+2]=S[h];E.indices=L}d.topAndBottom=new ln({geometry:E})}let m=o.outerRing,g=ys.fromPoints(m,e),p=g.projectPointsOntoPlane(m,e8),y=no.computeWindingOrder2D(p);y===ml.CLOCKWISE&&(m=m.slice().reverse());let b=Gn.computeWallGeometry(m,n,e,i,r,u);d.walls.push(new ln({geometry:b}));const C=o.holes;for(h=0;h<C.length;h++){let E=C[h];g=ys.fromPoints(E,e),p=g.projectPointsOntoPlane(E,e8),y=no.computeWindingOrder2D(p),y===ml.COUNTER_CLOCKWISE&&(E=E.slice().reverse()),b=Gn.computeWallGeometry(E,n,e,i,r,u),d.walls.push(new ln({geometry:b}))}return d}function Pc(e){if(T.typeOf.object("options",e),T.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),l(e.perPositionHeight)&&e.perPositionHeight&&l(e.height))throw new x("Cannot use both options.perPositionHeight and options.height");if(l(e.arcType)&&e.arcType!==Bn.GEODESIC&&e.arcType!==Bn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.vertexFormat,Fe.DEFAULT),i=A(e.ellipsoid,me.WGS84),o=A(e.granularity,M.RADIANS_PER_DEGREE),r=A(e.stRotation,0),s=e.textureCoordinates,a=A(e.perPositionHeight,!1),c=a&&l(e.extrudedHeight);let u=A(e.height,0),d=A(e.extrudedHeight,u);if(!c){const h=Math.max(u,d);d=Math.min(u,d),u=h}this._vertexFormat=Fe.clone(n),this._ellipsoid=me.clone(i),this._granularity=o,this._stRotation=r,this._height=u,this._extrudedHeight=d,this._closeTop=A(e.closeTop,!0),this._closeBottom=A(e.closeBottom,!0),this._polygonHierarchy=t,this._perPositionHeight=a,this._perPositionHeightExtrude=c,this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createPolygonGeometry",this._offsetAttribute=e.offsetAttribute,this._arcType=A(e.arcType,Bn.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=Gn.computeHierarchyPackedLength(t,f)+me.packedLength+Fe.packedLength+(s?Gn.computeHierarchyPackedLength(s,j):1)+12}Pc.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.positions",e.positions);const 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 Pc(t)};Pc.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),n=Gn.packPolygonHierarchy(e._polygonHierarchy,t,n,f),me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.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++]=A(e._offsetAttribute,-1),t[n++]=e._arcType,l(e._textureCoordinates)?n=Gn.packPolygonHierarchy(e._textureCoordinates,t,n,j):t[n++]=-1,t[n++]=e.packedLength,t};const Wit=me.clone(me.UNIT_SPHERE),jit=new Fe,qit={polygonHierarchy:{}};Pc.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=Gn.unpackPolygonHierarchy(e,t,f);t=i.startingIndex,delete i.startingIndex;const o=me.unpack(e,t,Wit);t+=me.packedLength;const r=Fe.unpack(e,t,jit);t+=Fe.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++]===1,h=e[t++]===1,m=e[t++]===1,g=e[t++]===1,p=e[t++]===1,y=e[t++],b=e[t++],C=e[t]===-1?void 0:Gn.unpackPolygonHierarchy(e,t,j);l(C)?(t=C.startingIndex,delete C.startingIndex):t++;const E=e[t++];return l(n)||(n=new Pc(qit)),n._polygonHierarchy=i,n._ellipsoid=me.clone(o,n._ellipsoid),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=c,n._stRotation=u,n._perPositionHeightExtrude=d,n._perPositionHeight=h,n._closeTop=m,n._closeBottom=g,n._shadowVolume=p,n._offsetAttribute=y===-1?void 0:y,n._arcType=b,n._textureCoordinates=C,n.packedLength=E,n};Pc.computeRectangle=function(e,t){T.typeOf.object("options",e),T.typeOf.object("options.polygonHierarchy",e.polygonHierarchy);const n=A(e.granularity,M.RADIANS_PER_DEGREE),i=A(e.arcType,Bn.GEODESIC);if(i!==Bn.GEODESIC&&i!==Bn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const o=e.polygonHierarchy,r=A(e.ellipsoid,me.WGS84);return Gee(o.positions,r,i,n,t)};Pc.createGeometry=function(e){const t=e._vertexFormat,n=e._ellipsoid,i=e._granularity,o=e._stRotation,r=e._polygonHierarchy,s=e._perPositionHeight,a=e._closeTop,c=e._closeBottom,u=e._arcType,d=e._textureCoordinates,h=l(d);let m=r.positions;if(m.length<3)return;const g=ys.fromPoints(m,n),p=Gn.polygonsFromHierarchy(r,h,g.projectPointsOntoPlane.bind(g),!s,n),y=p.hierarchy,b=p.polygons,C=function(_){return _},E=h?Gn.polygonsFromHierarchy(d,!0,C,!1).polygons:void 0;if(y.length===0)return;m=y[0].outerRing;const w=Gn.computeBoundingRectangle(g.plane.normal,g.projectPointOntoPlane.bind(g),m,o,Dit),S=[],P=e._height,L=e._extrudedHeight,z=e._perPositionHeightExtrude||!M.equalsEpsilon(P,L,0,M.EPSILON2),R={perPositionHeight:s,vertexFormat:t,geometry:void 0,tangentPlane:g,boundingRectangle:w,ellipsoid:n,stRotation:o,textureCoordinates:void 0,bottom:!1,top:!0,wall:!1,extrude:!1,arcType:u};let F;if(z)for(R.extrude=!0,R.top=a,R.bottom=c,R.shadowVolume=e._shadowVolume,R.offsetAttribute=e._offsetAttribute,F=0;F<b.length;F++){const _=Git(n,b[F],h?E[F]:void 0,i,y[F],s,a,c,t,u);let v;a&&c?(v=_.topAndBottom,R.geometry=Gn.scaleToGeodeticHeightExtruded(v.geometry,P,L,n,s)):a?(v=_.topAndBottom,v.geometry.attributes.position.values=no.scaleToGeodeticHeight(v.geometry.attributes.position.values,P,n,!s),R.geometry=v.geometry):c&&(v=_.topAndBottom,v.geometry.attributes.position.values=no.scaleToGeodeticHeight(v.geometry.attributes.position.values,L,n,!0),R.geometry=v.geometry),(a||c)&&(R.wall=!1,v.geometry=ZO(R),S.push(v));const O=_.walls;R.wall=!0;for(let N=0;N<O.length;N++){const V=O[N];R.geometry=Gn.scaleToGeodeticHeightExtruded(V.geometry,P,L,n,s),V.geometry=ZO(R),S.push(V)}}else for(F=0;F<b.length;F++){const _=new ln({geometry:Gn.createGeometryFromPositions(n,b[F],h?E[F]:void 0,i,s,t,u)});if(_.geometry.attributes.position.values=no.scaleToGeodeticHeight(_.geometry.attributes.position.values,P,n,!s),R.geometry=_.geometry,_.geometry=ZO(R),l(e._offsetAttribute)){const v=_.geometry.attributes.position.values.length,O=e._offsetAttribute===yn.NONE?0:1,N=new Uint8Array(v/3).fill(O);_.geometry.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:N})}S.push(_)}const U=Yi.combineInstances(S)[0];U.attributes.position.values=new Float64Array(U.attributes.position.values),U.indices=at.createTypedArray(U.attributes.position.values.length/3,U.indices);const D=U.attributes,I=fe.fromVertices(D.position.values);return t.position||delete D.position,new Lt({attributes:D,indices:U.indices,primitiveType:U.primitiveType,boundingSphere:I,offsetAttribute:e._offsetAttribute})};Pc.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Pc({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Fe.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})};function $it(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const n=e._ellipsoid,i=e._polygonHierarchy.positions,o=e.rectangle;return Lt._textureCoordinateRotationPoints(i,t,n,o)}Object.defineProperties(Pc.prototype,{rectangle:{get:function(){if(!l(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=Gee(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=$it(this)),this._textureCoordinateRotationPoints}}});const Wee=[],vv=[];function Yit(e,t,n,i,o){const s=ys.fromPoints(t,e).projectPointsOntoPlane(t,Wee);no.computeWindingOrder2D(s)===ml.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,d=t.length,h=0;if(i)for(c=new Float64Array(d*2*3),u=0;u<d;u++){const p=t[u],y=t[(u+1)%d];c[h++]=p.x,c[h++]=p.y,c[h++]=p.z,c[h++]=y.x,c[h++]=y.y,c[h++]=y.z}else{let p=0;if(o===Bn.GEODESIC)for(u=0;u<d;u++)p+=Gn.subdivideLineCount(t[u],t[(u+1)%d],n);else if(o===Bn.RHUMB)for(u=0;u<d;u++)p+=Gn.subdivideRhumbLineCount(e,t[u],t[(u+1)%d],n);for(c=new Float64Array(p*3),u=0;u<d;u++){let y;o===Bn.GEODESIC?y=Gn.subdivideLine(t[u],t[(u+1)%d],n,vv):o===Bn.RHUMB&&(y=Gn.subdivideRhumbLine(e,t[u],t[(u+1)%d],n,vv));const b=y.length;for(let C=0;C<b;++C)c[h++]=y[C]}}d=c.length/3;const m=d*2,g=at.createTypedArray(d,m);for(h=0,u=0;u<d-1;u++)g[h++]=u,g[h++]=u+1;return g[h++]=d-1,g[h++]=0,new ln({geometry:new Lt({attributes:new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})}),indices:g,primitiveType:Ze.LINES})})}function Xit(e,t,n,i,o){const s=ys.fromPoints(t,e).projectPointsOntoPlane(t,Wee);no.computeWindingOrder2D(s)===ml.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,d=t.length;const h=new Array(d);let m=0;if(i)for(c=new Float64Array(d*2*3*2),u=0;u<d;++u){h[u]=m/3;const b=t[u],C=t[(u+1)%d];c[m++]=b.x,c[m++]=b.y,c[m++]=b.z,c[m++]=C.x,c[m++]=C.y,c[m++]=C.z}else{let b=0;if(o===Bn.GEODESIC)for(u=0;u<d;u++)b+=Gn.subdivideLineCount(t[u],t[(u+1)%d],n);else if(o===Bn.RHUMB)for(u=0;u<d;u++)b+=Gn.subdivideRhumbLineCount(e,t[u],t[(u+1)%d],n);for(c=new Float64Array(b*3*2),u=0;u<d;++u){h[u]=m/3;let C;o===Bn.GEODESIC?C=Gn.subdivideLine(t[u],t[(u+1)%d],n,vv):o===Bn.RHUMB&&(C=Gn.subdivideRhumbLine(e,t[u],t[(u+1)%d],n,vv));const E=C.length;for(let w=0;w<E;++w)c[m++]=C[w]}}d=c.length/(3*2);const g=h.length,p=(d*2+g)*2,y=at.createTypedArray(d+g,p);for(m=0,u=0;u<d;++u)y[m++]=u,y[m++]=(u+1)%d,y[m++]=u+d,y[m++]=(u+1)%d+d;for(u=0;u<g;u++){const b=h[u];y[m++]=b,y[m++]=b+d}return new ln({geometry:new Lt({attributes:new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})}),indices:y,primitiveType:Ze.LINES})})}function N_(e){if(T.typeOf.object("options",e),T.typeOf.object("options.polygonHierarchy",e.polygonHierarchy),e.perPositionHeight&&l(e.height))throw new x("Cannot use both options.perPositionHeight and options.height");if(l(e.arcType)&&e.arcType!==Bn.GEODESIC&&e.arcType!==Bn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.ellipsoid,me.WGS84),i=A(e.granularity,M.RADIANS_PER_DEGREE),o=A(e.perPositionHeight,!1),r=o&&l(e.extrudedHeight),s=A(e.arcType,Bn.GEODESIC);let a=A(e.height,0),c=A(e.extrudedHeight,a);if(!r){const u=Math.max(a,c);c=Math.min(a,c),a=u}this._ellipsoid=me.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=Gn.computeHierarchyPackedLength(t,f)+me.packedLength+8}N_.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),n=Gn.packPolygonHierarchy(e._polygonHierarchy,t,n,f),me.pack(e._ellipsoid,t,n),n+=me.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++]=A(e._offsetAttribute,-1),t[n]=e.packedLength,t};const Kit=me.clone(me.UNIT_SPHERE),Jit={polygonHierarchy:{}};N_.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=Gn.unpackPolygonHierarchy(e,t,f);t=i.startingIndex,delete i.startingIndex;const o=me.unpack(e,t,Kit);t+=me.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++]===1,u=e[t++]===1,d=e[t++],h=e[t++],m=e[t];return l(n)||(n=new N_(Jit)),n._polygonHierarchy=i,n._ellipsoid=me.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=u,n._perPositionHeightExtrude=c,n._arcType=d,n._offsetAttribute=h===-1?void 0:h,n.packedLength=m,n};N_.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),T.defined("options.positions",e.positions);const 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 N_(t)};N_.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=Gn.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a;const c=[],u=M.chordLength(n,t.maximumRadius),d=e._height,h=e._extrudedHeight,m=e._perPositionHeightExtrude||!M.equalsEpsilon(d,h,0,M.EPSILON2);let g,p;if(m)for(p=0;p<s.length;p++){if(a=Xit(t,s[p],u,o,r),a.geometry=Gn.scaleToGeodeticHeightExtruded(a.geometry,d,h,t,o),l(e._offsetAttribute)){const C=a.geometry.attributes.position.values.length/3;let E=new Uint8Array(C);e._offsetAttribute===yn.TOP?E=E.fill(1,0,C/2):(g=e._offsetAttribute===yn.NONE?0:1,E=E.fill(g)),a.geometry.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}c.push(a)}else for(p=0;p<s.length;p++){if(a=Yit(t,s[p],u,o,r),a.geometry.attributes.position.values=no.scaleToGeodeticHeight(a.geometry.attributes.position.values,d,t,!o),l(e._offsetAttribute)){const C=a.geometry.attributes.position.values.length;g=e._offsetAttribute===yn.NONE?0:1;const E=new Uint8Array(C/3).fill(g);a.geometry.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}c.push(a)}const y=Yi.combineInstances(c)[0],b=fe.fromVertices(y.attributes.position.values);return new Lt({attributes:y.attributes,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:b,offsetAttribute:e._offsetAttribute})};const jee="Entity polygons cannot have both height and perPositionHeight. height will be ignored",qee="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",$ee=new H,Yee=f.ZERO,Xee=new f,Kee=new ge,Qit=[],Zit=new j;function eot(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 Ac(e,t){Zt.call(this,{entity:e,scene:t,geometryOptions:new eot(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}l(Object.create)&&(Ac.prototype=Object.create(Zt.prototype),Ac.prototype.constructor=Ac);Ac.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof nn){let s;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,$ee)),l(s)||(s=H.WHITE),o.color=pn.fromColor(s)}l(i.offsetAttribute)&&(o.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,Yee,Xee)));let r;return i.perPositionHeight&&!l(i.extrudedHeight)?r=new R_(i):r=new Pc(i),new ln({id:t,geometry:r,attributes:o})};Ac.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=this._options,o=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,$ee),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(o),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(r),offset:void 0};l(i.offsetAttribute)&&(s.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,Yee,Xee)));let a;return i.perPositionHeight&&!l(i.extrudedHeight)?a=new rc(i):a=new N_(i),new ln({id:t,geometry:a,attributes:s})};Ac.prototype._computeCenter=function(e,t){const n=Z.getValueOrUndefined(this._entity.polygon.hierarchy,e);if(!l(n))return;const i=n.positions;if(i.length===0)return;const o=this._scene.mapProjection.ellipsoid,r=ys.fromPoints(i,o),s=r.projectPointsOntoPlane(i,Qit),a=s.length;let c=0,u=a-1,d=new j;for(let m=0;m<a;u=m++){const g=s[m],p=s[u],y=g.x*p.y-p.x*g.y;let b=j.add(g,p,Zit);b=j.multiplyByScalar(b,y,b),d=j.add(d,b,d),c+=y}const h=1/(c*3);return d=j.multiplyByScalar(d,h,d),r.projectPointOntoEllipsoid(d,t)};Ac.prototype._isHidden=function(e,t){return!l(t.hierarchy)||Wn.prototype._isHidden.call(this,e,t)};Ac.prototype._isOnTerrain=function(e,t){const n=Zt.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=l(i)&&(i.isConstant?i.getValue(ft.MINIMUM_VALUE):!0);return n&&!o};Ac.prototype._isDynamic=function(e,t){return!t.hierarchy.isConstant||!Z.isConstant(t.height)||!Z.isConstant(t.extrudedHeight)||!Z.isConstant(t.granularity)||!Z.isConstant(t.stRotation)||!Z.isConstant(t.textureCoordinates)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.perPositionHeight)||!Z.isConstant(t.closeTop)||!Z.isConstant(t.closeBottom)||!Z.isConstant(t.zIndex)||!Z.isConstant(t.arcType)||this._onTerrain&&!Z.isConstant(this._materialProperty)&&!(this._materialProperty instanceof nn)};Ac.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof nn,i=this._options;i.vertexFormat=n?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat;const o=t.hierarchy.getValue(ft.MINIMUM_VALUE);let r=Z.getValueOrUndefined(t.height,ft.MINIMUM_VALUE);const s=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE);let a=Z.getValueOrUndefined(t.extrudedHeight,ft.MINIMUM_VALUE);const c=Z.getValueOrDefault(t.extrudedHeightReference,ft.MINIMUM_VALUE,St.NONE),u=Z.getValueOrDefault(t.perPositionHeight,ft.MINIMUM_VALUE,!1);r=Zt.getGeometryHeight(r,s);let d;u?(l(r)&&(r=void 0,ki(jee)),s!==St.NONE&&u&&(r=void 0,ki(qee))):(l(a)&&!l(r)&&(r=0),d=Zt.computeGeometryOffsetAttribute(r,s,a,c)),i.polygonHierarchy=o,i.granularity=Z.getValueOrUndefined(t.granularity,ft.MINIMUM_VALUE),i.stRotation=Z.getValueOrUndefined(t.stRotation,ft.MINIMUM_VALUE),i.perPositionHeight=u,i.closeTop=Z.getValueOrDefault(t.closeTop,ft.MINIMUM_VALUE,!0),i.closeBottom=Z.getValueOrDefault(t.closeBottom,ft.MINIMUM_VALUE,!0),i.offsetAttribute=d,i.height=r,i.arcType=Z.getValueOrDefault(t.arcType,ft.MINIMUM_VALUE,Bn.GEODESIC),i.textureCoordinates=Z.getValueOrUndefined(t.textureCoordinates,ft.MINIMUM_VALUE),a=Zt.getGeometryExtrudedHeight(a,c),a===Zt.CLAMP_TO_GROUND&&(a=lo.getMinimumMaximumHeights(Pc.computeRectangle(i,Kee)).minimumTerrainHeight),i.extrudedHeight=a};Ac.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight,i=l(n)&&n!==t;return!e.perPositionHeight&&(!i&&t===0||i&&e.closeTop&&e.closeBottom)};Ac.DynamicGeometryUpdater=$y;function $y(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&($y.prototype=Object.create(yi.prototype),$y.prototype.constructor=$y);$y.prototype._isHidden=function(e,t,n){return!l(this._options.polygonHierarchy)||yi.prototype._isHidden.call(this,e,t,n)};$y.prototype._setOptions=function(e,t,n){const i=this._options;i.polygonHierarchy=Z.getValueOrUndefined(t.hierarchy,n);let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,St.NONE),s=Z.getValueOrDefault(t.extrudedHeightReference,n,St.NONE);let a=Z.getValueOrUndefined(t.extrudedHeight,n);const c=Z.getValueOrUndefined(t.perPositionHeight,n);o=Zt.getGeometryHeight(o,s);let u;c?(l(o)&&(o=void 0,ki(jee)),r!==St.NONE&&c&&(o=void 0,ki(qee))):(l(a)&&!l(o)&&(o=0),u=Zt.computeGeometryOffsetAttribute(o,r,a,s)),i.granularity=Z.getValueOrUndefined(t.granularity,n),i.stRotation=Z.getValueOrUndefined(t.stRotation,n),i.textureCoordinates=Z.getValueOrUndefined(t.textureCoordinates,n),i.perPositionHeight=Z.getValueOrUndefined(t.perPositionHeight,n),i.closeTop=Z.getValueOrDefault(t.closeTop,n,!0),i.closeBottom=Z.getValueOrDefault(t.closeBottom,n,!0),i.offsetAttribute=u,i.height=o,i.arcType=Z.getValueOrDefault(t.arcType,n,Bn.GEODESIC),a=Zt.getGeometryExtrudedHeight(a,s),a===Zt.CLAMP_TO_GROUND&&(a=lo.getMinimumMaximumHeights(Pc.computeRectangle(i,Kee)).minimumTerrainHeight),i.extrudedHeight=a};function tot(e,t,n,i){const o=new Ji;i.position&&(o.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:e}));const r=t.length,s=e.length/3,a=(s-r*2)/(r*2),c=no.triangulate(t),u=(a-1)*r*6+c.length*2,d=at.createTypedArray(s,u);let h,m,g,p,y,b;const C=r*2;let E=0;for(h=0;h<a-1;h++){for(m=0;m<r-1;m++)g=m*2+h*r*2,b=g+C,p=g+1,y=p+C,d[E++]=p,d[E++]=g,d[E++]=y,d[E++]=y,d[E++]=g,d[E++]=b;g=r*2-2+h*r*2,p=g+1,y=p+C,b=g+C,d[E++]=p,d[E++]=g,d[E++]=y,d[E++]=y,d[E++]=g,d[E++]=b}if(i.st||i.tangent||i.bitangent){const P=new Float32Array(s*2),L=1/(a-1),z=1/n.height,R=n.height/2;let F,U,D=0;for(h=0;h<a;h++){for(F=h*L,U=z*(t[0].y+R),P[D++]=F,P[D++]=U,m=1;m<r;m++)U=z*(t[m].y+R),P[D++]=F,P[D++]=U,P[D++]=F,P[D++]=U;U=z*(t[0].y+R),P[D++]=F,P[D++]=U}for(m=0;m<r;m++)F=0,U=z*(t[m].y+R),P[D++]=F,P[D++]=U;for(m=0;m<r;m++)F=(a-1)*L,U=z*(t[m].y+R),P[D++]=F,P[D++]=U;o.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:new Float32Array(P)})}const w=s-r*2;for(h=0;h<c.length;h+=3){const P=c[h]+w,L=c[h+1]+w,z=c[h+2]+w;d[E++]=P,d[E++]=L,d[E++]=z,d[E++]=z+r,d[E++]=L+r,d[E++]=P+r}let S=new Lt({attributes:o,indices:d,boundingSphere:fe.fromVertices(e),primitiveType:Ze.TRIANGLES});if(i.normal&&(S=Yi.computeNormal(S)),i.tangent||i.bitangent){try{S=Yi.computeTangentAndBitangent(S)}catch{ki("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 JC(e){e=A(e,A.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!l(t))throw new x("options.polylinePositions is required.");if(!l(n))throw new x("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._cornerType=A(e.cornerType,cr.ROUNDED),this._vertexFormat=Fe.clone(A(e.vertexFormat,Fe.DEFAULT)),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*f.packedLength;i+=1+n.length*j.packedLength,this.packedLength=i+me.packedLength+Fe.packedLength+2}JC.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=f.packedLength)f.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=j.packedLength)j.pack(s[i],t,n);return me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const Jee=me.clone(me.UNIT_SPHERE),Qee=new Fe,XA={polylinePositions:void 0,shapePositions:void 0,ellipsoid:Jee,vertexFormat:Qee,cornerType:void 0,granularity:void 0};JC.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=f.packedLength)r[i]=f.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=j.packedLength)s[i]=j.unpack(e,t);const a=me.unpack(e,t,Jee);t+=me.packedLength;const c=Fe.unpack(e,t,Qee);t+=Fe.packedLength;const u=e[t++],d=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=me.clone(a,n._ellipsoid),n._vertexFormat=Fe.clone(c,n._vertexFormat),n._cornerType=u,n._granularity=d,n):(XA.polylinePositions=r,XA.shapePositions=s,XA.cornerType=u,XA.granularity=d,new JC(XA))};const not=new Ye;JC.createGeometry=function(e){const t=e._positions,n=da(t,f.equalsEpsilon);let i=e._shape;if(i=XC.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;no.computeWindingOrder2D(i)===ml.CLOCKWISE&&i.reverse();const o=Ye.fromPoints(i,not),r=XC.computePositions(n,i,o,e,!0);return tot(r,i,o,e._vertexFormat)};function iot(e,t){const n=new Ji;n.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,o=n.position.values.length/3,s=e.length/3/i,a=at.createTypedArray(o,2*i*(s+1));let c,u,d=0;c=0;let h=c*i;for(u=0;u<i-1;u++)a[d++]=u+h,a[d++]=u+h+1;for(a[d++]=i-1+h,a[d++]=h,c=s-1,h=c*i,u=0;u<i-1;u++)a[d++]=u+h,a[d++]=u+h+1;for(a[d++]=i-1+h,a[d++]=h,c=0;c<s-1;c++){const g=i*c,p=g+i;for(u=0;u<i;u++)a[d++]=u+g,a[d++]=u+p}return new Lt({attributes:n,indices:at.createTypedArray(o,a),boundingSphere:fe.fromVertices(e),primitiveType:Ze.LINES})}function QC(e){e=A(e,A.EMPTY_OBJECT);const t=e.polylinePositions,n=e.shapePositions;if(!l(t))throw new x("options.polylinePositions is required.");if(!l(n))throw new x("options.shapePositions is required.");this._positions=t,this._shape=n,this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._cornerType=A(e.cornerType,cr.ROUNDED),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*f.packedLength;i+=1+n.length*j.packedLength,this.packedLength=i+me.packedLength+2}QC.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=f.packedLength)f.pack(o[i],t,n);const s=e._shape;for(r=s.length,t[n++]=r,i=0;i<r;++i,n+=j.packedLength)j.pack(s[i],t,n);return me.pack(e._ellipsoid,t,n),n+=me.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const Zee=me.clone(me.UNIT_SPHERE),KA={polylinePositions:void 0,shapePositions:void 0,ellipsoid:Zee,height:void 0,cornerType:void 0,granularity:void 0};QC.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=f.packedLength)r[i]=f.unpack(e,t);o=e[t++];const s=new Array(o);for(i=0;i<o;++i,t+=j.packedLength)s[i]=j.unpack(e,t);const a=me.unpack(e,t,Zee);t+=me.packedLength;const c=e[t++],u=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=me.clone(a,n._ellipsoid),n._cornerType=c,n._granularity=u,n):(KA.polylinePositions=r,KA.shapePositions=s,KA.cornerType=c,KA.granularity=u,new QC(KA))};const oot=new Ye;QC.createGeometry=function(e){const t=e._positions,n=da(t,f.equalsEpsilon);let i=e._shape;if(i=XC.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;no.computeWindingOrder2D(i)===ml.CLOCKWISE&&i.reverse();const o=Ye.fromPoints(i,oot),r=XC.computePositions(n,i,o,e,!1);return iot(r,i)};const ete=new H;function rot(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 cd(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new rot(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}l(Object.create)&&(cd.prototype=Object.create(Wn.prototype),cd.prototype.constructor=cd);cd.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Ii.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof nn){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,ete)),l(c)||(c=H.WHITE),o=pn.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new ln({id:t,geometry:new JC(this._options),attributes:i})};cd.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,ete),o=this._distanceDisplayConditionProperty.getValue(e);return new ln({id:t,geometry:new QC(this._options),attributes:{show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o)}})};cd.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.shape)||Wn.prototype._isHidden.call(this,e,t)};cd.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!Z.isConstant(t.granularity)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.cornerType)};cd.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof nn;o.vertexFormat=r?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(ft.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(ft.MINIMUM_VALUE,o.shape),o.granularity=l(n)?n.getValue(ft.MINIMUM_VALUE):void 0,o.cornerType=l(i)?i.getValue(ft.MINIMUM_VALUE):void 0};cd.DynamicGeometryUpdater=Yy;function Yy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Yy.prototype=Object.create(yi.prototype),Yy.prototype.constructor=Yy);Yy.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.polylinePositions)||!l(i.shapePositions)||yi.prototype._isHidden.call(this,e,t,n)};Yy.prototype._setOptions=function(e,t,n){const i=this._options;i.polylinePositions=Z.getValueOrUndefined(t.positions,n,i.polylinePositions),i.shapePositions=Z.getValueOrUndefined(t.shape,n),i.granularity=Z.getValueOrUndefined(t.granularity,n),i.cornerType=Z.getValueOrUndefined(t.cornerType,n)};const xF=new f,tte=new f,nte=new f,ite=new f,ote=new ge,sot=new j,aot=new fe,cot=new fe;function rte(e,t){const n=new Lt({attributes:new Ji,primitiveType:Ze.TRIANGLES});return n.attributes.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function lot(e,t,n,i){const 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;let c=0;const u=ite,d=nte;let h=tte;if(t.normal||t.tangent||t.bitangent)for(let m=0;m<o;m+=3){const g=f.fromArray(e,m,xF),p=c+1,y=c+2;h=n.geodeticSurfaceNormal(g,h),(t.tangent||t.bitangent)&&(f.cross(f.UNIT_Z,h,d),J.multiplyByVector(i,d,d),f.normalize(d,d),t.bitangent&&f.normalize(f.cross(h,d,u),u)),t.normal&&(r[c]=h.x,r[p]=h.y,r[y]=h.z),t.tangent&&(s[c]=d.x,s[p]=d.y,s[y]=d.z),t.bitangent&&(a[c]=u.x,a[p]=u.y,a[y]=u.z),c+=3}return rte(t,{positions:e,normals:r,tangents:s,bitangents:a})}const wF=new f,ste=new f;function uot(e,t,n){const 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;let a=0,c=0,u=0,d=!0,h=ite,m=nte,g=tte;if(t.normal||t.tangent||t.bitangent)for(let p=0;p<i;p+=6){const y=f.fromArray(e,p,xF),b=f.fromArray(e,(p+6)%i,wF);if(d){const C=f.fromArray(e,(p+3)%i,ste);f.subtract(b,y,b),f.subtract(C,y,C),g=f.normalize(f.cross(C,b,g),g),d=!1}f.equalsEpsilon(b,y,M.EPSILON10)&&(d=!0),(t.tangent||t.bitangent)&&(h=n.geodeticSurfaceNormal(y,h),t.tangent&&(m=f.normalize(f.cross(h,g,m),m))),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++]=m.x,r[c++]=m.y,r[c++]=m.z,r[c++]=m.x,r[c++]=m.y,r[c++]=m.z),t.bitangent&&(s[u++]=h.x,s[u++]=h.y,s[u++]=h.z,s[u++]=h.x,s[u++]=h.y,s[u++]=h.z)}return rte(t,{positions:e,normals:o,tangents:r,bitangents:s})}function ate(e,t){const n=e._vertexFormat,i=e._ellipsoid,o=t.height,r=t.width,s=t.northCap,a=t.southCap;let c=0,u=o,d=o,h=0;s&&(c=1,d-=1,h+=1),a&&(u-=1,d-=1,h+=1),h+=r*d;const m=n.position?new Float64Array(h*3):void 0,g=n.st?new Float32Array(h*2):void 0;let p=0,y=0;const b=xF,C=sot;let E=Number.MAX_VALUE,w=Number.MAX_VALUE,S=-Number.MAX_VALUE,P=-Number.MAX_VALUE;for(let I=c;I<u;++I)for(let _=0;_<r;++_)va.computePosition(t,i,n.st,I,_,b,C),m[p++]=b.x,m[p++]=b.y,m[p++]=b.z,n.st&&(g[y++]=C.x,g[y++]=C.y,E=Math.min(E,C.x),w=Math.min(w,C.y),S=Math.max(S,C.x),P=Math.max(P,C.y));if(s&&(va.computePosition(t,i,n.st,0,0,b,C),m[p++]=b.x,m[p++]=b.y,m[p++]=b.z,n.st&&(g[y++]=C.x,g[y++]=C.y,E=C.x,w=C.y,S=C.x,P=C.y)),a&&(va.computePosition(t,i,n.st,o-1,0,b,C),m[p++]=b.x,m[p++]=b.y,m[p]=b.z,n.st&&(g[y++]=C.x,g[y]=C.y,E=Math.min(E,C.x),w=Math.min(w,C.y),S=Math.max(S,C.x),P=Math.max(P,C.y))),n.st&&(E<0||w<0||S>1||P>1))for(let I=0;I<g.length;I+=2)g[I]=(g[I]-E)/(S-E),g[I+1]=(g[I+1]-w)/(P-w);const L=lot(m,n,i,t.tangentRotationMatrix);let z=6*(r-1)*(d-1);s&&(z+=3*(r-1)),a&&(z+=3*(r-1));const R=at.createTypedArray(h,z);let F=0,U=0,D;for(D=0;D<d-1;++D){for(let I=0;I<r-1;++I){const _=F,v=_+r,O=v+1,N=_+1;R[U++]=_,R[U++]=v,R[U++]=N,R[U++]=N,R[U++]=v,R[U++]=O,++F}++F}if(s||a){let I=h-1;const _=h-1;s&&a&&(I=h-2);let v,O;if(F=0,s)for(D=0;D<r-1;D++)v=F,O=v+1,R[U++]=I,R[U++]=v,R[U++]=O,++F;if(a)for(F=(d-1)*r,D=0;D<r-1;D++)v=F,O=v+1,R[U++]=v,R[U++]=_,R[U++]=O,++F}return L.indices=R,n.st&&(L.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:g})),L}function Kg(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 Jg(e,t,n,i){return e[t++]=i[n],e[t++]=i[n+1],e[t++]=i[n],e[t]=i[n+1],e}const SF=new Fe;function dot(e,t){const n=e._shadowVolume,i=e._offsetAttribute,o=e._vertexFormat,r=e._extrudedHeight,s=e._surfaceHeight,a=e._ellipsoid,c=t.height,u=t.width;let d;if(n){const Ee=Fe.clone(o,SF);Ee.normal=!0,e._vertexFormat=Ee}const h=ate(e,t);n&&(e._vertexFormat=o);let m=no.scaleToGeodeticHeight(h.attributes.position.values,s,a,!1);m=new Float64Array(m);let g=m.length;const p=g*2,y=new Float64Array(p);y.set(m);const b=no.scaleToGeodeticHeight(h.attributes.position.values,r,a);y.set(b,g),h.attributes.position.values=y;const C=o.normal?new Float32Array(p):void 0,E=o.tangent?new Float32Array(p):void 0,w=o.bitangent?new Float32Array(p):void 0,S=o.st?new Float32Array(p/3*2):void 0;let P,L;if(o.normal){for(L=h.attributes.normal.values,C.set(L),d=0;d<g;d++)L[d]=-L[d];C.set(L,g),h.attributes.normal.values=C}if(n){L=h.attributes.normal.values,o.normal||(h.attributes.normal=void 0);const Ee=new Float32Array(p);for(d=0;d<g;d++)L[d]=-L[d];Ee.set(L,g),h.attributes.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:Ee})}let z;const R=l(i);if(R){const Ee=g/3*2;let Be=new Uint8Array(Ee);i===yn.TOP?Be=Be.fill(1,0,Ee/2):(z=i===yn.NONE?0:1,Be=Be.fill(z)),h.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:Be})}if(o.tangent){const Ee=h.attributes.tangent.values;for(E.set(Ee),d=0;d<g;d++)Ee[d]=-Ee[d];E.set(Ee,g),h.attributes.tangent.values=E}if(o.bitangent){const Ee=h.attributes.bitangent.values;w.set(Ee),w.set(Ee,g),h.attributes.bitangent.values=w}o.st&&(P=h.attributes.st.values,S.set(P),S.set(P,g/3*2),h.attributes.st.values=S);const F=h.indices,U=F.length,D=g/3,I=at.createTypedArray(p/3,U*2);for(I.set(F),d=0;d<U;d+=3)I[d+U]=F[d+2]+D,I[d+1+U]=F[d+1]+D,I[d+2+U]=F[d]+D;h.indices=I;const _=t.northCap,v=t.southCap;let O=c,N=2,V=0,k=4,G=4;_&&(N-=1,O-=1,V+=1,k-=2,G-=1),v&&(N-=1,O-=1,V+=1,k-=2,G-=1),V+=N*u+2*O-k;const W=(V+G)*2;let K=new Float64Array(W*3);const q=n?new Float32Array(W*3):void 0;let te=R?new Uint8Array(W):void 0,Y=o.st?new Float32Array(W*2):void 0;const X=i===yn.TOP;R&&!X&&(z=i===yn.ALL?1:0,te=te.fill(z));let $=0,se=0,ue=0,re=0;const he=u*O;let ce;for(d=0;d<he;d+=u)ce=d*3,K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,d*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1);if(v){const Ee=_?he+1:he;for(ce=Ee*3,d=0;d<2;d++)K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,Ee*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1)}else for(d=he-u;d<he;d++)ce=d*3,K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,d*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1);for(d=he-1;d>0;d-=u)ce=d*3,K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,d*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1);if(_){const Ee=he;for(ce=Ee*3,d=0;d<2;d++)K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,Ee*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1)}else for(d=u-1;d>=0;d--)ce=d*3,K=Kg(K,$,ce,m,b),$+=6,o.st&&(Y=Jg(Y,se,d*2,P),se+=4),n&&(ue+=3,q[ue++]=L[ce],q[ue++]=L[ce+1],q[ue++]=L[ce+2]),X&&(te[re++]=1,re+=1);let Q=uot(K,o,a);o.st&&(Q.attributes.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:Y})),n&&(Q.attributes.extrudeDirection=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:q})),R&&(Q.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:te}));const ne=at.createTypedArray(W,V*6);let de,_e,Se,ve;g=K.length/3;let Le=0;for(d=0;d<g-1;d+=2){de=d,ve=(de+2)%g;const Ee=f.fromArray(K,de*3,wF),Be=f.fromArray(K,ve*3,ste);f.equalsEpsilon(Ee,Be,M.EPSILON10)||(_e=(de+1)%g,Se=(_e+2)%g,ne[Le++]=de,ne[Le++]=_e,ne[Le++]=ve,ne[Le++]=ve,ne[Le++]=_e,ne[Le++]=Se)}return Q.indices=ne,Q=Yi.combineInstances([new ln({geometry:h}),new ln({geometry:Q})]),Q[0]}const fot=[new f,new f,new f,new f],cte=new Ce,hot=new Ce;function vF(e,t,n,i,o){if(n===0)return ge.clone(e,o);const r=va.computeOptions(e,t,n,0,ote,cte),s=r.height,a=r.width,c=fot;return va.computePosition(r,i,!1,0,0,c[0]),va.computePosition(r,i,!1,0,a-1,c[1]),va.computePosition(r,i,!1,s-1,0,c[2]),va.computePosition(r,i,!1,s-1,a-1,c[3]),ge.fromCartesianArray(c,i,o)}function Cl(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle;if(T.typeOf.object("rectangle",t),ge.validate(t),t.north<t.south)throw new x("options.rectangle.north must be greater than or equal to options.rectangle.south");const n=A(e.height,0),i=A(e.extrudedHeight,n);this._rectangle=ge.clone(t),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=A(e.rotation,0),this._stRotation=A(e.stRotation,0),this._vertexFormat=Fe.clone(A(e.vertexFormat,Fe.DEFAULT)),this._extrudedHeight=Math.min(n,i),this._shadowVolume=A(e.shadowVolume,!1),this._workerName="createRectangleGeometry",this._offsetAttribute=e.offsetAttribute,this._rotatedRectangle=void 0,this._textureCoordinateRotationPoints=void 0}Cl.packedLength=ge.packedLength+me.packedLength+Fe.packedLength+7;Cl.pack=function(e,t,n){return T.typeOf.object("value",e),T.defined("array",t),n=A(n,0),ge.pack(e._rectangle,t,n),n+=ge.packedLength,me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.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]=A(e._offsetAttribute,-1),t};const lte=new ge,ute=me.clone(me.UNIT_SPHERE),Lh={rectangle:lte,ellipsoid:ute,vertexFormat:SF,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};Cl.unpack=function(e,t,n){T.defined("array",e),t=A(t,0);const i=ge.unpack(e,t,lte);t+=ge.packedLength;const o=me.unpack(e,t,ute);t+=me.packedLength;const r=Fe.unpack(e,t,SF);t+=Fe.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],d=e[t++],h=e[t++]===1,m=e[t];return l(n)?(n._rectangle=ge.clone(i,n._rectangle),n._ellipsoid=me.clone(o,n._ellipsoid),n._vertexFormat=Fe.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=c,n._stRotation=u,n._extrudedHeight=d,n._shadowVolume=h,n._offsetAttribute=m===-1?void 0:m,n):(Lh.granularity=s,Lh.height=a,Lh.rotation=c,Lh.stRotation=u,Lh.extrudedHeight=d,Lh.shadowVolume=h,Lh.offsetAttribute=m===-1?void 0:m,new Cl(Lh))};Cl.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.rectangle;if(T.typeOf.object("rectangle",n),ge.validate(n),n.north<n.south)throw new x("options.rectangle.north must be greater than or equal to options.rectangle.south");const i=A(e.granularity,M.RADIANS_PER_DEGREE),o=A(e.ellipsoid,me.WGS84),r=A(e.rotation,0);return vF(n,i,r,o,t)};const pot=new J,t8=new Te,mot=new Ce;Cl.createGeometry=function(e){if(M.equalsEpsilon(e._rectangle.north,e._rectangle.south,M.EPSILON10)||M.equalsEpsilon(e._rectangle.east,e._rectangle.west,M.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=va.computeOptions(t,e._granularity,i,o,ote,cte,hot),a=pot;if(o!==0||i!==0){const g=ge.center(t,mot),p=n.geodeticSurfaceNormalCartographic(g,wF);Te.fromAxisAngle(p,-o,t8),J.fromQuaternion(t8,a)}else J.clone(J.IDENTITY,a);const c=e._surfaceHeight,u=e._extrudedHeight,d=!M.equalsEpsilon(c,u,0,M.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let h,m;if(t=e._rectangle,d){h=dot(e,s);const g=fe.fromRectangle3D(t,n,c,cot),p=fe.fromRectangle3D(t,n,u,aot);m=fe.union(g,p)}else{if(h=ate(e,s),h.attributes.position.values=no.scaleToGeodeticHeight(h.attributes.position.values,c,n,!1),l(e._offsetAttribute)){const g=h.attributes.position.values.length,p=e._offsetAttribute===yn.NONE?0:1,y=new Uint8Array(g/3).fill(p);h.attributes.applyOffset=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}m=fe.fromRectangle3D(t,n,c)}return r.position||delete h.attributes.position,new Lt({attributes:h.attributes,indices:h.indices,primitiveType:h.primitiveType,boundingSphere:m,offsetAttribute:e._offsetAttribute})};Cl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Cl({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Fe.POSITION_ONLY,shadowVolume:!0})};const n8=new ge,_ot=[new j,new j,new j],got=new dt,yot=new Ce;function Aot(e){if(e._stRotation===0)return[0,0,0,1,1,0];const t=ge.clone(e._rectangle,n8),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=vF(t,n,o,i,n8),s=_ot;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;const a=e.rectangle,c=dt.fromRotation(e._stRotation,got),u=ge.center(a,yot);for(let p=0;p<3;++p){const y=s[p];y.x-=u.longitude,y.y-=u.latitude,dt.multiplyByVector(c,y,y),y.x+=u.longitude,y.y+=u.latitude,y.x=(y.x-a.west)/a.width,y.y=(y.y-a.south)/a.height}const d=s[0],h=s[1],m=s[2],g=new Array(6);return j.pack(d,g),j.pack(h,g,2),j.pack(m,g,4),g}Object.defineProperties(Cl.prototype,{rectangle:{get:function(){return l(this._rotatedRectangle)||(this._rotatedRectangle=vF(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=Aot(this)),this._textureCoordinateRotationPoints}}});const dte=new H,fte=f.ZERO,hte=new f,pte=new ge,bot=new ge,Cot=new Ce;function Tot(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 au(e,t){Zt.call(this,{entity:e,scene:t,geometryOptions:new Tot(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}l(Object.create)&&(au.prototype=Object.create(Zt.prototype),au.prototype.constructor=au);au.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof nn){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,dte)),l(o)||(o=H.WHITE),i.color=pn.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,fte,hte))),new ln({id:t,geometry:new Cl(this._options),attributes:i})};au.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,dte),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=jo.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,fte,hte))),new ln({id:t,geometry:new v_(this._options),attributes:r})};au.prototype._computeCenter=function(e,t){const n=Z.getValueOrUndefined(this._entity.rectangle.coordinates,e,bot);if(!l(n))return;const i=ge.center(n,Cot);return Ce.toCartesian(i,me.WGS84,t)};au.prototype._isHidden=function(e,t){return!l(t.coordinates)||Wn.prototype._isHidden.call(this,e,t)};au.prototype._isDynamic=function(e,t){return!t.coordinates.isConstant||!Z.isConstant(t.height)||!Z.isConstant(t.extrudedHeight)||!Z.isConstant(t.granularity)||!Z.isConstant(t.stRotation)||!Z.isConstant(t.rotation)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.zIndex)||this._onTerrain&&!Z.isConstant(this._materialProperty)&&!(this._materialProperty instanceof nn)};au.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof nn;let i=Z.getValueOrUndefined(t.height,ft.MINIMUM_VALUE);const o=Z.getValueOrDefault(t.heightReference,ft.MINIMUM_VALUE,St.NONE);let r=Z.getValueOrUndefined(t.extrudedHeight,ft.MINIMUM_VALUE);const s=Z.getValueOrDefault(t.extrudedHeightReference,ft.MINIMUM_VALUE,St.NONE);l(r)&&!l(i)&&(i=0);const a=this._options;a.vertexFormat=n?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(ft.MINIMUM_VALUE,a.rectangle),a.granularity=Z.getValueOrUndefined(t.granularity,ft.MINIMUM_VALUE),a.stRotation=Z.getValueOrUndefined(t.stRotation,ft.MINIMUM_VALUE),a.rotation=Z.getValueOrUndefined(t.rotation,ft.MINIMUM_VALUE),a.offsetAttribute=Zt.computeGeometryOffsetAttribute(i,o,r,s),a.height=Zt.getGeometryHeight(i,o),r=Zt.getGeometryExtrudedHeight(r,s),r===Zt.CLAMP_TO_GROUND&&(r=lo.getMinimumMaximumHeights(Cl.computeRectangle(a,pte)).minimumTerrainHeight),a.extrudedHeight=r};au.DynamicGeometryUpdater=Xy;function Xy(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Xy.prototype=Object.create(yi.prototype),Xy.prototype.constructor=Xy);Xy.prototype._isHidden=function(e,t,n){return!l(this._options.rectangle)||yi.prototype._isHidden.call(this,e,t,n)};Xy.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,St.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,St.NONE);l(s)&&!l(o)&&(o=0),i.rectangle=Z.getValueOrUndefined(t.coordinates,n,i.rectangle),i.granularity=Z.getValueOrUndefined(t.granularity,n),i.stRotation=Z.getValueOrUndefined(t.stRotation,n),i.rotation=Z.getValueOrUndefined(t.rotation,n),i.offsetAttribute=Zt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Zt.getGeometryHeight(o,r),s=Zt.getGeometryExtrudedHeight(s,a),s===Zt.CLAMP_TO_GROUND&&(s=lo.getMinimumMaximumHeights(Cl.computeRectangle(i,pte)).minimumTerrainHeight),i.extrudedHeight=s};const i8=new H,Eot=new jt,xot=new jt,wot=f.ZERO,Sot=new f;function Ou(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 vt,this.updaters=new vt,this.updatersWithAttributes=new vt,this.attributes=new vt,this.subscriptions=new vt,this.showsUpdated=new vt,this.itemsToRemove=[],this.invalidated=!1;let a;l(o)&&(a=o.definitionChanged.addEventListener(Ou.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}Ou.prototype.onMaterialChanged=function(){this.invalidated=!0};Ou.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:l(t)?t.equals(n):!1};Ou.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantFill||!e.fillMaterialProperty.isConstant||!Z.isConstant(e.distanceDisplayConditionProperty)||!Z.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Ou.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Ou.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0){l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i);let c;l(this.depthFailAppearanceType)&&(l(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Or.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),c=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Jt({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{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0),l(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof nn)&&(this.depthFailMaterial=Or.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],d=this.geometry.get(u.id);let h=this.attributes.get(d.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!u.fillMaterialProperty.isConstant||c){const b=u.fillMaterialProperty.color,C=Z.getValueOrDefault(b,e,H.WHITE,i8);H.equals(h._lastColor,C)||(h._lastColor=H.clone(C,h._lastColor),h.color=pn.toValue(C,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}if(l(this.depthFailAppearanceType)&&u.depthFailMaterialProperty instanceof nn&&(!u.depthFailMaterialProperty.isConstant||c)){const b=u.depthFailMaterialProperty.color,C=Z.getValueOrDefault(b,e,H.WHITE,i8);H.equals(h._lastDepthFailColor,C)||(h._lastDepthFailColor=H.clone(C,h._lastDepthFailColor),h.depthFailColor=pn.toValue(C,h.depthFailColor))}const m=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const b=Z.getValueOrDefault(p,e,xot,Eot);jt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(b,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!Z.isConstant(y)){const b=Z.getValueOrDefault(y,e,wot,Sot);f.equals(b,h._lastOffset)||(h._lastOffset=f.clone(b,h._lastOffset),h.offset=jo.toValue(b,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Ou.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=Xn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Ou.prototype.contains=function(e){return this.updaters.contains(e.id)};Ou.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?gt.FAILED:(i.boundingSphere.clone(t),gt.DONE)};Ou.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),l(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};function rl(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}rl.prototype.add=function(e,t){let n,i;const o=t.createFillGeometryInstance(e);o.attributes.color.value[3]===255?(n=this._solidItems,i=!1):(n=this._translucentItems,i=!0);const r=n.length;for(let a=0;a<r;a++){const c=n[a];if(c.isMaterial(t)){c.add(t,o);return}}const s=new Ou(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function o8(e,t){const n=e.length;for(let i=n-1;i>=0;i--){const o=e[i];if(o.remove(t))return o.updaters.length===0&&(e.splice(i,1),o.destroy()),!0}return!1}rl.prototype.remove=function(e){o8(this._solidItems,e)||o8(this._translucentItems,e)};function r8(e,t,n){let i=!1;const o=t.length;for(let r=0;r<o;++r){const s=t[r],a=s.itemsToRemove,c=a.length;if(c>0)for(r=0;r<c;r++){const u=a[r];s.remove(u),e.add(n,u),i=!0}}return i}function cw(e,t,n,i){let o=t.length,r;for(r=o-1;r>=0;r--){const s=t[r];if(s.invalidated){t.splice(r,1);const a=s.updaters.values,c=a.length;for(let u=0;u<c;u++)e.add(n,a[u]);s.destroy()}}for(o=t.length,r=0;r<o;++r)i=t[r].update(n)&&i;return i}rl.prototype.update=function(e){let t=cw(this,this._solidItems,e,!0);t=cw(this,this._translucentItems,e,t)&&t;const n=r8(this,this._solidItems,e),i=r8(this,this._translucentItems,e);return(n||i)&&(t=cw(this,this._solidItems,e,t)&&t,t=cw(this,this._translucentItems,e,t)&&t),t};function s8(e,t,n){const i=e.length;for(let o=0;o<i;o++){const r=e[o];if(r.contains(t))return r.getBoundingSphere(t,n)}return gt.FAILED}rl.prototype.getBoundingSphere=function(e,t){const n=s8(this._solidItems,e,t);return n===gt.FAILED?s8(this._translucentItems,e,t):n};function a8(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}rl.prototype.removeAllPrimitives=function(){a8(this._solidItems),a8(this._translucentItems)};const vot=new jt,Dot=new jt,Iot=f.ZERO,Pot=new f;function Lu(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 vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new vt,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new vt,this.attributes=new vt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Lu.prototype.onMaterialChanged,this),this.subscriptions=new vt,this.showsUpdated=new vt}Lu.prototype.onMaterialChanged=function(){this.invalidated=!0};Lu.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty,i=this.depthFailMaterialProperty,o=e.depthFailMaterialProperty;if(n===t&&o===i)return!0;let r=l(t)&&t.equals(n);return r=(!l(i)&&!l(o)||l(i)&&i.equals(o))&&r,r};Lu.prototype.add=function(e,t){const n=t.id;if(this.updaters.set(n,t),this.geometry.set(n,t.createFillGeometryInstance(e)),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!Z.isConstant(t.distanceDisplayConditionProperty)||!Z.isConstant(t.terrainOffsetProperty))this.updatersWithAttributes.set(n,t);else{const 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};Lu.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};const Oot=new H;Lu.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0){l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Or.getValue(e,this.materialProperty,this.material);let a;l(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Or.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Jt({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{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Or.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,l(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof nn)&&(this.depthFailMaterial=Or.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,d=this.geometry.get(c.id);let h=this.attributes.get(d.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),l(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof nn&&!c.depthFailMaterialProperty.isConstant){const b=c.depthFailMaterialProperty.color,C=Z.getValueOrDefault(b,e,H.WHITE,Oot);H.equals(h._lastDepthFailColor,C)||(h._lastDepthFailColor=H.clone(C,h._lastDepthFailColor),h.depthFailColor=pn.toValue(C,h.depthFailColor))}const m=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const b=Z.getValueOrDefault(p,e,Dot,vot);jt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(b,h.distanceDisplayCondition))}const y=c.terrainOffsetProperty;if(!Z.isConstant(y)){const b=Z.getValueOrDefault(y,e,Iot,Pot);f.equals(b,h._lastOffset)||(h._lastOffset=f.clone(b,h._lastOffset),h.offset=jo.toValue(b,h.offset))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};Lu.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=Xn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Lu.prototype.contains=function(e){return this.updaters.contains(e.id)};Lu.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?gt.FAILED:(i.boundingSphere.clone(t),gt.DONE)};Lu.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function sl(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}sl.prototype.add=function(e,t){const n=this._items,i=n.length;for(let r=0;r<i;r++){const s=n[r];if(s.isMaterial(t)){s.add(e,t);return}}const o=new Lu(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};sl.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};sl.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const 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};sl.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return gt.FAILED};sl.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};function Lot(e,t,n,i,o){mte(e,t,n||0,i||e.length-1,o||Bot)}function mte(e,t,n,i,o){for(;i>n;){if(i-n>600){var r=i-n+1,s=t-n+1,a=Math.log(r),c=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*c*(r-c)/r)*(s-r/2<0?-1:1),d=Math.max(n,Math.floor(t-s*c/r+u)),h=Math.min(i,Math.floor(t+(r-s)*c/r+u));mte(e,t,d,h,o)}var m=e[t],g=n,p=i;for(JA(e,n,t),o(e[i],m)>0&&JA(e,n,i);g<p;){for(JA(e,g,p),g++,p--;o(e[g],m)<0;)g++;for(;o(e[p],m)>0;)p--}o(e[n],m)===0?JA(e,n,p):(p++,JA(e,p,i)),p<=t&&(n=p+1),t<=p&&(i=p-1)}}function JA(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function Bot(e,t){return e<t?-1:e>t?1:0}class Rot{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const i=[];if(!uw(t,n))return i;const o=this.toBBox,r=[];for(;n;){for(let s=0;s<n.children.length;s++){const a=n.children[s],c=n.leaf?o(a):a;uw(t,c)&&(n.leaf?i.push(a):tL(t,c)?this._all(a,i):r.push(a))}n=r.pop()}return i}collides(t){let n=this.data;if(!uw(t,n))return!1;const i=[];for(;n;){for(let o=0;o<n.children.length;o++){const r=n.children[o],s=n.leaf?this.toBBox(r):r;if(uw(t,s)){if(n.leaf||tL(t,s))return!0;i.push(r)}}n=i.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let i=0;i<t.length;i++)this.insert(t[i]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const i=this.data;this.data=n,n=i}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=my([]),this}remove(t,n){if(!t)return this;let i=this.data;const o=this.toBBox(t),r=[],s=[];let a,c,u;for(;i||r.length;){if(i||(i=r.pop(),c=r[r.length-1],a=s.pop(),u=!0),i.leaf){const d=Not(t,i.children,n);if(d!==-1)return i.children.splice(d,1),r.push(i),this._condense(r),this}!u&&!i.leaf&&tL(i,o)?(r.push(i),s.push(a),a=0,c=i,i=i.children[0]):c?(a++,i=c.children[a],u=!1):i=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const i=[];for(;t;)t.leaf?n.push(...t.children):i.push(...t.children),t=i.pop();return n}_build(t,n,i,o){const r=i-n+1;let s=this._maxEntries,a;if(r<=s)return a=my(t.slice(n,i+1)),Qg(a,this.toBBox),a;o||(o=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,o-1))),a=my([]),a.leaf=!1,a.height=o;const c=Math.ceil(r/s),u=c*Math.ceil(Math.sqrt(s));c8(t,n,i,u,this.compareMinX);for(let d=n;d<=i;d+=u){const h=Math.min(d+u-1,i);c8(t,d,h,c,this.compareMinY);for(let m=d;m<=h;m+=c){const g=Math.min(m+c-1,h);a.children.push(this._build(t,m,g,o-1))}}return Qg(a,this.toBBox),a}_chooseSubtree(t,n,i,o){for(;o.push(n),!(n.leaf||o.length-1===i);){let r=1/0,s=1/0,a;for(let c=0;c<n.children.length;c++){const u=n.children[c],d=eL(u),h=zot(t,u)-d;h<s?(s=h,r=d<r?d:r,a=u):h===s&&d<r&&(r=d,a=u)}n=a||n.children[0]}return n}_insert(t,n,i){const o=i?t:this.toBBox(t),r=[],s=this._chooseSubtree(o,this.data,n,r);for(s.children.push(t),Ab(s,o);n>=0&&r[n].children.length>this._maxEntries;)this._split(r,n),n--;this._adjustParentBBoxes(o,r,n)}_split(t,n){const i=t[n],o=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,o);const s=this._chooseSplitIndex(i,r,o),a=my(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,Qg(i,this.toBBox),Qg(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=my([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Qg(this.data,this.toBBox)}_chooseSplitIndex(t,n,i){let o,r=1/0,s=1/0;for(let a=n;a<=i-n;a++){const c=yb(t,0,a,this.toBBox),u=yb(t,a,i,this.toBBox),d=Uot(c,u),h=eL(c)+eL(u);d<r?(r=d,o=a,s=h<s?h:s):d===r&&h<s&&(s=h,o=a)}return o||i-n}_chooseSplitAxis(t,n,i){const o=t.leaf?this.compareMinX:Mot,r=t.leaf?this.compareMinY:Fot,s=this._allDistMargin(t,n,i,o),a=this._allDistMargin(t,n,i,r);s<a&&t.children.sort(o)}_allDistMargin(t,n,i,o){t.children.sort(o);const r=this.toBBox,s=yb(t,0,n,r),a=yb(t,i-n,i,r);let c=lw(s)+lw(a);for(let u=n;u<i-n;u++){const d=t.children[u];Ab(s,t.leaf?r(d):d),c+=lw(s)}for(let u=i-n-1;u>=n;u--){const d=t.children[u];Ab(a,t.leaf?r(d):d),c+=lw(a)}return c}_adjustParentBBoxes(t,n,i){for(let o=i;o>=0;o--)Ab(n[o],t)}_condense(t){for(let n=t.length-1,i;n>=0;n--)t[n].children.length===0?n>0?(i=t[n-1].children,i.splice(i.indexOf(t[n]),1)):this.clear():Qg(t[n],this.toBBox)}}function Not(e,t,n){if(!n)return t.indexOf(e);for(let i=0;i<t.length;i++)if(n(e,t[i]))return i;return-1}function Qg(e,t){yb(e,0,e.children.length,t,e)}function yb(e,t,n,i,o){o||(o=my(null)),o.minX=1/0,o.minY=1/0,o.maxX=-1/0,o.maxY=-1/0;for(let r=t;r<n;r++){const s=e.children[r];Ab(o,e.leaf?i(s):s)}return o}function Ab(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Mot(e,t){return e.minX-t.minX}function Fot(e,t){return e.minY-t.minY}function eL(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function lw(e){return e.maxX-e.minX+(e.maxY-e.minY)}function zot(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function Uot(e,t){const n=Math.max(e.minX,t.minX),i=Math.max(e.minY,t.minY),o=Math.min(e.maxX,t.maxX),r=Math.min(e.maxY,t.maxY);return Math.max(0,o-n)*Math.max(0,r-i)}function tL(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function uw(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function my(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function c8(e,t,n,i,o){const r=[t,n];for(;r.length;){if(n=r.pop(),t=r.pop(),n-t<=i)continue;const s=t+Math.ceil((n-t)/i/2)*i;Lot(e,s,t,n,o),r.push(t,s,s,n)}}function $T(){this._tree=new Rot}function M_(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}M_.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};$T.prototype.insert=function(e,t){T.typeOf.string("id",e),T.typeOf.object("rectangle",t);const n=M_.fromRectangleAndId(e,t,new M_);this._tree.insert(n)};function Hot(e,t){return e.id===t.id}const Vot=new M_;$T.prototype.remove=function(e,t){T.typeOf.string("id",e),T.typeOf.object("rectangle",t);const n=M_.fromRectangleAndId(e,t,Vot);this._tree.remove(n,Hot)};const kot=new M_;$T.prototype.collides=function(e){T.typeOf.object("rectangle",e);const t=M_.fromRectangleAndId("",e,kot);return this._tree.collides(t)};const Got=new H,Wot=new jt,jot=new jt;function ah(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 vt,this.updaters=new vt,this.updatersWithAttributes=new vt,this.attributes=new vt,this.subscriptions=new vt,this.showsUpdated=new vt,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new $T}ah.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};ah.prototype.add=function(e,t){const 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||!Z.isConstant(e.distanceDisplayConditionProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};ah.prototype.remove=function(e){const 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);const i=this.subscriptions.get(t);return l(i)&&(i(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};ah.prototype.update=function(e){let t=!0;const n=0;let i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new $r({show:!1,asynchronous:!0,geometryInstances:s.slice(),classificationType:this.classificationType}),o.add(i,this.zIndex),t=!1;else{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],d=this.geometry.get(u.id);let h=this.attributes.get(d.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!u.fillMaterialProperty.isConstant||c){const y=u.fillMaterialProperty.color,b=Z.getValueOrDefault(y,e,H.WHITE,Got);H.equals(h._lastColor,b)||(h._lastColor=H.clone(b,h._lastColor),h.color=pn.toValue(b,h.color))}const m=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,jot,Wot);jt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(y,h.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};ah.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=Xn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};ah.prototype.contains=function(e){return this.updaters.contains(e.id)};ah.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getBoundingSphere(e.entity);return l(i)?(i.clone(t),gt.DONE):gt.FAILED};ah.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;l(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;l(n)&&(e.remove(n),this.oldPrimitive=void 0)};function F_(e,t){this._batches=[],this._primitives=e,this._classificationType=t}F_.prototype.add=function(e,t){const n=t.createFillGeometryInstance(e),i=this._batches,o=Z.getValueOrDefault(t.zIndex,0);let r;const s=i.length;for(let a=0;a<s;++a){const c=i[a];if(c.zIndex===o&&!c.overlapping(n.geometry.rectangle)){r=c;break}}return l(r)||(r=new ah(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};F_.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};F_.prototype.update=function(e){let t,n,i=!0;const o=this._batches,r=o.length;for(t=0;t<r;++t)i=o[t].update(e)&&i;for(t=0;t<r;++t){const s=o[t],a=s.itemsToRemove,c=a.length;for(let u=0;u<c;u++){n=a[u],s.remove(n);const d=this.add(e,n);s.isDirty=!0,d.isDirty=!0}}for(t=r-1;t>=0;--t){const s=o[t];s.isDirty&&(i=o[t].update(e)&&i,s.isDirty=!1),s.geometry.length===0&&o.splice(t,1)}return i};F_.prototype.getBoundingSphere=function(e,t){const n=this._batches,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return gt.FAILED};F_.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const qot=new jt,$ot=new jt;function vl(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new vt,this.material=void 0,this.updatersWithAttributes=new vt,this.attributes=new vt,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(vl.prototype.onMaterialChanged,this),this.subscriptions=new vt,this.showsUpdated=new vt,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new $T}vl.prototype.onMaterialChanged=function(){this.invalidated=!0};vl.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};vl.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof nn&&t instanceof nn?!0:l(t)&&t.equals(n)};vl.prototype.add=function(e,t,n){const 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||!Z.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const 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};vl.prototype.remove=function(e){const 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);const i=this.subscriptions.get(t);return l(i)&&(i(),this.subscriptions.remove(t)),!0}return!1};vl.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.primitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),this.material=Or.getValue(e,this.materialProperty,this.material),n=new $r({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{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.material=Or.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material;const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,d=this.geometry.get(c.id);let h=this.attributes.get(d.id.id);l(h)||(h=n.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h));const m=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,$ot,qot);jt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};vl.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=Xn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};vl.prototype.contains=function(e){return this.updaters.contains(e.id)};vl.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?gt.FAILED:(i.boundingSphere.clone(t),gt.DONE)};vl.prototype.destroy=function(){const e=this.primitive,t=this.primitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function $0(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}$0.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=ms.shouldUseSphericalCoordinates(o.geometry.rectangle),s=Z.getValueOrDefault(t.zIndex,0);for(let c=0;c<i;++c){const u=n[c];if(u.isMaterial(t)&&u.usingSphericalTextureCoordinates===r&&u.zIndex===s&&!u.overlapping(o.geometry.rectangle)){u.add(e,t,o);return}}const a=new vl(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};$0.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};$0.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const 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};$0.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return gt.FAILED};$0.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const Yot=new H,Xot=new jt,Kot=new jt,Jot=f.ZERO,Qot=new f;function Ff(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 vt,this.updaters=new vt,this.updatersWithAttributes=new vt,this.attributes=new vt,this.itemsToRemove=[],this.subscriptions=new vt,this.showsUpdated=new vt}Ff.prototype.add=function(e,t){const n=e.id;if(this.createPrimitive=!0,this.geometry.set(n,t),this.updaters.set(n,e),!e.hasConstantOutline||!e.outlineColorProperty.isConstant||!Z.isConstant(e.distanceDisplayConditionProperty)||!Z.isConstant(e.terrainOffsetProperty))this.updatersWithAttributes.set(n,e);else{const i=this;this.subscriptions.set(n,e.entity.definitionChanged.addEventListener(function(o,r,s,a){r==="isShowing"&&i.showsUpdated.set(e.id,e)}))}};Ff.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t),this.showsUpdated.remove(t)),!0}return!1};Ff.prototype.update=function(e){let t=!0,n=0,i=this.primitive;const o=this.primitives;let r;if(this.createPrimitive){const s=this.geometry.values;if(s.length>0)l(i)&&(l(this.oldPrimitive)?o.remove(i):this.oldPrimitive=i),i=new Jt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new wn({flat:!0,translucent:this.translucent,renderState:{lineWidth:this.width}}),shadows:this.shadows}),o.add(i),t=!1;else{l(i)&&(o.remove(i),i=void 0);const c=this.oldPrimitive;l(c)&&(o.remove(c),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=i,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(l(i)&&i.ready){i.show=!0,l(this.oldPrimitive)&&(o.remove(this.oldPrimitive),this.oldPrimitive=void 0);const s=this.updatersWithAttributes.values,a=s.length,c=this.waitingOnCreate;for(r=0;r<a;r++){const u=s[r],d=this.geometry.get(u.id);let h=this.attributes.get(d.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!u.outlineColorProperty.isConstant||c){const b=u.outlineColorProperty,C=Z.getValueOrDefault(b,e,H.WHITE,Yot);H.equals(h._lastColor,C)||(h._lastColor=H.clone(C,h._lastColor),h.color=pn.toValue(C,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}const m=u.entity.isShowing&&(u.hasConstantOutline||u.isOutlineVisible(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const b=Z.getValueOrDefault(p,e,Kot,Xot);jt.equals(b,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(b,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(b,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!Z.isConstant(y)){const b=Z.getValueOrDefault(y,e,Jot,Qot);f.equals(b,h._lastOffset)||(h._lastOffset=f.clone(b,h._lastOffset),h.offset=jo.toValue(b,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};Ff.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=this.geometry.get(o.id);let s=this.attributes.get(r.id.id);l(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));const a=o.entity.isShowing,c=s.show[0]===1;a!==c&&(s.show=Xn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};Ff.prototype.contains=function(e){return this.updaters.contains(e.id)};Ff.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?gt.FAILED:(i.boundingSphere.clone(t),gt.DONE)};Ff.prototype.removeAllPrimitives=function(){const e=this.primitives,t=this.primitive;l(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());const n=this.oldPrimitive;l(n)&&(e.remove(n),this.oldPrimitive=void 0)};function z_(e,t,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new vt,this._translucentBatches=new vt}z_.prototype.add=function(e,t){const n=t.createOutlineGeometryInstance(e),i=this._scene.clampLineWidth(t.outlineWidth);let o,r;n.attributes.color.value[3]===255?(o=this._solidBatches,r=o.get(i),l(r)||(r=new Ff(this._primitives,!1,i,this._shadows),o.set(i,r)),r.add(t,n)):(o=this._translucentBatches,r=o.get(i),l(r)||(r=new Ff(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};z_.prototype.remove=function(e){let t;const n=this._solidBatches.values,i=n.length;for(t=0;t<i;t++)if(n[t].remove(e))return;const o=this._translucentBatches.values,r=o.length;for(t=0;t<r;t++)if(o[t].remove(e))return};z_.prototype.update=function(e){let t,n,i,o;const r=this._solidBatches.values,s=r.length,a=this._translucentBatches.values,c=a.length;let u,d=!0,h=!1;do{for(h=!1,n=0;n<s;n++){o=r[n],d=o.update(e),u=o.itemsToRemove;const m=u.length;if(m>0)for(h=!0,t=0;t<m;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n<c;n++){o=a[n],d=o.update(e),u=o.itemsToRemove;const m=u.length;if(m>0)for(h=!0,t=0;t<m;t++)i=u[t],o.remove(i),this.add(e,i)}}while(h);return d};z_.prototype.getBoundingSphere=function(e,t){let n;const i=this._solidBatches.values,o=i.length;for(n=0;n<o;n++){const a=i[n];if(a.contains(e))return a.getBoundingSphere(e,t)}const r=this._translucentBatches.values,s=r.length;for(n=0;n<s;n++){const a=r[n];if(a.contains(e))return a.getBoundingSphere(e,t)}return gt.FAILED};z_.prototype.removeAllPrimitives=function(){let e;const t=this._solidBatches.values,n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._translucentBatches.values,o=i.length;for(e=0;e<o;e++)i[e].removeAllPrimitives()};const _te={};function Zot(e,t){return M.equalsEpsilon(e.latitude,t.latitude,M.EPSILON10)&&M.equalsEpsilon(e.longitude,t.longitude,M.EPSILON10)}const ert=new Ce,trt=new Ce;function nrt(e,t,n,i){t=da(t,f.equalsEpsilon);const o=t.length;if(o<2)return;const r=l(i),s=l(n),a=new Array(o),c=new Array(o),u=new Array(o),d=t[0];a[0]=d;const h=e.cartesianToCartographic(d,ert);s&&(h.height=n[0]),c[0]=h.height,r?u[0]=i[0]:u[0]=0;const m=c[0],g=u[0];let p=m===g,y=1;for(let b=1;b<o;++b){const C=t[b],E=e.cartesianToCartographic(C,trt);s&&(E.height=n[b]),p=p&&E.height===0,Zot(h,E)?h.height<E.height&&(c[y-1]=E.height):(a[y]=C,c[y]=E.height,r?u[y]=i[b]:u[y]=0,p=p&&c[y]===u[y],Ce.clone(E,h),++y)}if(!(p||y<2))return a.length=y,c.length=y,u.length=y,{positions:a,topHeights:c,bottomHeights:u}}const irt=new Array(2),ort=new Array(2),rrt={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};_te.computePositions=function(e,t,n,i,o,r){const s=nrt(e,t,n,i);if(!l(s))return;t=s.positions,n=s.topHeights,i=s.bottomHeights;const a=t.length,c=a-2;let u,d;const h=M.chordLength(o,e.maximumRadius),m=rrt;if(m.minDistance=h,m.ellipsoid=e,r){let g=0,p;for(p=0;p<a-1;p++)g+=yr.numberOfPoints(t[p],t[p+1],h)+1;u=new Float64Array(g*3),d=new Float64Array(g*3);const y=irt,b=ort;m.positions=y,m.height=b;let C=0;for(p=0;p<a-1;p++){y[0]=t[p],y[1]=t[p+1],b[0]=n[p],b[1]=n[p+1];const E=yr.generateArc(m);u.set(E,C),b[0]=i[p],b[1]=i[p+1],d.set(yr.generateArc(m),C),C+=E.length}}else m.positions=t,m.height=n,u=new Float64Array(yr.generateArc(m)),m.height=i,d=new Float64Array(yr.generateArc(m));return{bottomPositions:d,topPositions:u,numCorners:c}};const gte=_te,nL=new f,dw=new f,srt=new f,l8=new f,art=new f,crt=new f,lrt=new f;function U_(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!l(t))throw new x("options.positions is required.");if(l(n)&&n.length!==t.length)throw new x("options.positions and options.maximumHeights must have the same length.");if(l(i)&&i.length!==t.length)throw new x("options.positions and options.minimumHeights must have the same length.");const o=A(e.vertexFormat,Fe.DEFAULT),r=A(e.granularity,M.RADIANS_PER_DEGREE),s=A(e.ellipsoid,me.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Fe.clone(o),this._granularity=r,this._ellipsoid=me.clone(s),this._workerName="createWallGeometry";let a=1+t.length*f.packedLength+2;l(i)&&(a+=i.length),l(n)&&(a+=n.length),this.packedLength=a+me.packedLength+Fe.packedLength+1}U_.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=f.packedLength)f.pack(o[i],t,n);const s=e._minimumHeights;if(r=l(s)?s.length:0,t[n++]=r,l(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=l(a)?a.length:0,t[n++]=r,l(a))for(i=0;i<r;++i)t[n++]=a[i];return me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n]=e._granularity,t};const yte=me.clone(me.UNIT_SPHERE),Ate=new Fe,QA={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:yte,vertexFormat:Ate,granularity:void 0};U_.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=f.packedLength)r[i]=f.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++];const c=me.unpack(e,t,yte);t+=me.packedLength;const u=Fe.unpack(e,t,Ate);t+=Fe.packedLength;const d=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=me.clone(c,n._ellipsoid),n._vertexFormat=Fe.clone(u,n._vertexFormat),n._granularity=d,n):(QA.positions=r,QA.minimumHeights=s,QA.maximumHeights=a,QA.granularity=d,new U_(QA))};U_.fromConstantHeights=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t))throw new x("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=l(o),a=l(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let d=0;d<u;++d)s&&(n[d]=o),a&&(i[d]=r)}const c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new U_(c)};U_.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=gte.computePositions(s,t,i,n,r,!0);if(!l(a))return;const c=a.bottomPositions,u=a.topPositions,d=a.numCorners;let h=u.length,m=h*2;const g=o.position?new Float64Array(m):void 0,p=o.normal?new Float32Array(m):void 0,y=o.tangent?new Float32Array(m):void 0,b=o.bitangent?new Float32Array(m):void 0,C=o.st?new Float32Array(m/3*2):void 0;let E=0,w=0,S=0,P=0,L=0,z=lrt,R=crt,F=art,U=!0;h/=3;let D,I=0;const _=1/(h-d-1);for(D=0;D<h;++D){const k=D*3,G=f.fromArray(u,k,nL),W=f.fromArray(c,k,dw);if(o.position&&(g[E++]=W.x,g[E++]=W.y,g[E++]=W.z,g[E++]=G.x,g[E++]=G.y,g[E++]=G.z),o.st&&(C[L++]=I,C[L++]=0,C[L++]=I,C[L++]=1),o.normal||o.tangent||o.bitangent){let K=f.clone(f.ZERO,l8);const q=f.subtract(G,s.geodeticSurfaceNormal(G,dw),dw);if(D+1<h&&(K=f.fromArray(u,k+3,l8)),U){const te=f.subtract(K,G,srt),Y=f.subtract(q,G,nL);z=f.normalize(f.cross(Y,te,z),z),U=!1}f.equalsEpsilon(G,K,M.EPSILON10)?U=!0:(I+=_,o.tangent&&(R=f.normalize(f.subtract(K,G,R),R)),o.bitangent&&(F=f.normalize(f.cross(z,R,F),F))),o.normal&&(p[w++]=z.x,p[w++]=z.y,p[w++]=z.z,p[w++]=z.x,p[w++]=z.y,p[w++]=z.z),o.tangent&&(y[P++]=R.x,y[P++]=R.y,y[P++]=R.z,y[P++]=R.x,y[P++]=R.y,y[P++]=R.z),o.bitangent&&(b[S++]=F.x,b[S++]=F.y,b[S++]=F.z,b[S++]=F.x,b[S++]=F.y,b[S++]=F.z)}}const v=new Ji;o.position&&(v.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(v.normal=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),o.tangent&&(v.tangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),o.bitangent&&(v.bitangent=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:b})),o.st&&(v.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:C}));const O=m/3;m-=6*(d+1);const N=at.createTypedArray(O,m);let V=0;for(D=0;D<O-2;D+=2){const k=D,G=D+2,W=f.fromArray(g,k*3,nL),K=f.fromArray(g,G*3,dw);if(f.equalsEpsilon(W,K,M.EPSILON10))continue;const q=D+1,te=D+3;N[V++]=q,N[V++]=k,N[V++]=te,N[V++]=te,N[V++]=k,N[V++]=G}return new Lt({attributes:v,indices:N,primitiveType:Ze.TRIANGLES,boundingSphere:new fe.fromVertices(g)})};const u8=new f,d8=new f;function H_(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.maximumHeights,i=e.minimumHeights;if(!l(t))throw new x("options.positions is required.");if(l(n)&&n.length!==t.length)throw new x("options.positions and options.maximumHeights must have the same length.");if(l(i)&&i.length!==t.length)throw new x("options.positions and options.minimumHeights must have the same length.");const o=A(e.granularity,M.RADIANS_PER_DEGREE),r=A(e.ellipsoid,me.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=me.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*f.packedLength+2;l(i)&&(s+=i.length),l(n)&&(s+=n.length),this.packedLength=s+me.packedLength+1}H_.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=f.packedLength)f.pack(o[i],t,n);const s=e._minimumHeights;if(r=l(s)?s.length:0,t[n++]=r,l(s))for(i=0;i<r;++i)t[n++]=s[i];const a=e._maximumHeights;if(r=l(a)?a.length:0,t[n++]=r,l(a))for(i=0;i<r;++i)t[n++]=a[i];return me.pack(e._ellipsoid,t,n),n+=me.packedLength,t[n]=e._granularity,t};const bte=me.clone(me.UNIT_SPHERE),ZA={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:bte,granularity:void 0};H_.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=f.packedLength)r[i]=f.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++];const c=me.unpack(e,t,bte);t+=me.packedLength;const u=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=me.clone(c,n._ellipsoid),n._granularity=u,n):(ZA.positions=r,ZA.minimumHeights=s,ZA.maximumHeights=a,ZA.granularity=u,new H_(ZA))};H_.fromConstantHeights=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions;if(!l(t))throw new x("options.positions is required.");let n,i;const o=e.minimumHeight,r=e.maximumHeight,s=l(o),a=l(r);if(s||a){const u=t.length;n=s?new Array(u):void 0,i=a?new Array(u):void 0;for(let d=0;d<u;++d)s&&(n[d]=o),a&&(i[d]=r)}const c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid};return new H_(c)};H_.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._granularity,r=e._ellipsoid,s=gte.computePositions(r,t,i,n,o,!1);if(!l(s))return;const a=s.bottomPositions,c=s.topPositions;let u=c.length,d=u*2;const h=new Float64Array(d);let m=0;u/=3;let g;for(g=0;g<u;++g){const E=g*3,w=f.fromArray(c,E,u8),S=f.fromArray(a,E,d8);h[m++]=S.x,h[m++]=S.y,h[m++]=S.z,h[m++]=w.x,h[m++]=w.y,h[m++]=w.z}const p=new Ji({position:new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h})}),y=d/3;d=2*y-4+y;const b=at.createTypedArray(y,d);let C=0;for(g=0;g<y-2;g+=2){const E=g,w=g+2,S=f.fromArray(h,E*3,u8),P=f.fromArray(h,w*3,d8);if(f.equalsEpsilon(S,P,M.EPSILON10))continue;const L=g+1,z=g+3;b[C++]=L,b[C++]=E,b[C++]=L,b[C++]=z,b[C++]=E,b[C++]=w}return b[C++]=y-2,b[C++]=y-1,new Lt({attributes:p,indices:b,primitiveType:Ze.LINES,boundingSphere:new fe.fromVertices(h)})};const Cte=new H;function urt(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 cu(e,t){Wn.call(this,{entity:e,scene:t,geometryOptions:new urt(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}l(Object.create)&&(cu.prototype=Object.create(Wn.prototype),cu.prototype.constructor=cu);cu.prototype.createFillGeometryInstance=function(e){if(T.defined("time",e),!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e);let i,o;const r=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=Ii.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof nn){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,Cte)),l(c)||(c=H.WHITE),o=pn.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new ln({id:t,geometry:new U_(this._options),attributes:i})};cu.prototype.createOutlineGeometryInstance=function(e){if(T.defined("time",e),!this._outlineEnabled)throw new x("This instance does not represent an outlined geometry.");const t=this._entity,n=t.isAvailable(e),i=Z.getValueOrDefault(this._outlineColorProperty,e,H.BLACK,Cte),o=this._distanceDisplayConditionProperty.getValue(e);return new ln({id:t,geometry:new H_(this._options),attributes:{show:new Xn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:pn.fromColor(i),distanceDisplayCondition:Ii.fromDistanceDisplayCondition(o)}})};cu.prototype._isHidden=function(e,t){return!l(t.positions)||Wn.prototype._isHidden.call(this,e,t)};cu.prototype._getIsClosed=function(e){return!1};cu.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!Z.isConstant(t.minimumHeights)||!Z.isConstant(t.maximumHeights)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.granularity)};cu.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof nn,s=this._options;s.vertexFormat=r?wn.VERTEX_FORMAT:Zo.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(ft.MINIMUM_VALUE,s.positions),s.minimumHeights=l(n)?n.getValue(ft.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=l(i)?i.getValue(ft.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=l(o)?o.getValue(ft.MINIMUM_VALUE):void 0};cu.DynamicGeometryUpdater=Ky;function Ky(e,t,n){yi.call(this,e,t,n)}l(Object.create)&&(Ky.prototype=Object.create(yi.prototype),Ky.prototype.constructor=Ky);Ky.prototype._isHidden=function(e,t,n){return!l(this._options.positions)||yi.prototype._isHidden.call(this,e,t,n)};Ky.prototype._setOptions=function(e,t,n){const i=this._options;i.positions=Z.getValueOrUndefined(t.positions,n,i.positions),i.minimumHeights=Z.getValueOrUndefined(t.minimumHeights,n,i.minimumHeights),i.maximumHeights=Z.getValueOrUndefined(t.maximumHeights,n,i.maximumHeights),i.granularity=Z.getValueOrUndefined(t.granularity,n)};const drt=[],f8=[_c,gc,ru,su,yc,hl,Ac,cd,au,cu];function YT(e,t){this.entity=e,this.scene=t;const n=new Array(f8.length),i=new Ke;function o(s){i.raiseEvent(s)}const r=new Nd;for(let s=0;s<n.length;s++){const a=new f8[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(YT.prototype._onEntityPropertyChanged,this)}YT.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)};YT.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};YT.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),He(this)};function Tl(e,t,n,i){T.defined("scene",e),T.defined("entityCollection",t),n=A(n,e.primitives),i=A(i,e.groundPrimitives),this._scene=e,this._primitives=n,this._groundPrimitives=i,this._entityCollection=void 0,this._addedObjects=new vt,this._removedObjects=new vt,this._changedObjects=new vt;const o=Po.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);const r=Nr.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new z_(n,e,s),this._outlineBatches[o+s]=new z_(n,e,s),this._closedColorBatches[s]=new rl(n,wn,void 0,!0,s),this._closedColorBatches[o+s]=new rl(n,wn,void 0,!0,s),this._closedMaterialBatches[s]=new sl(n,Zo,void 0,!0,s),this._closedMaterialBatches[o+s]=new sl(n,Zo,void 0,!0,s),this._openColorBatches[s]=new rl(n,wn,void 0,!1,s),this._openColorBatches[o+s]=new rl(n,wn,void 0,!1,s),this._openMaterialBatches[s]=new sl(n,Zo,void 0,!1,s),this._openMaterialBatches[o+s]=new sl(n,Zo,void 0,!1,s);const a=vo.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(a),u=[];if(r)for(s=0;s<a;++s)u.push(new $0(i,s,Zo)),c[s]=new F_(i,s);else for(s=0;s<a;++s)c[s]=new F_(i,s);this._groundColorBatches=c,this._groundMaterialBatches=u,this._dynamicBatch=new _g(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new vt,this._updaterSets=new vt,this._entityCollection=t,t.collectionChanged.addEventListener(Tl.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,drt)}Tl.prototype.update=function(e){T.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,u,d;const h=this;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,d=this._updaterSets.get(u),d.entity===c?d.forEach(function(y){h._removeUpdater(y),h._insertUpdaterIntoBatch(e,y)}):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],u=c.id,d=this._updaterSets.get(u),d.forEach(this._removeUpdater.bind(this)),d.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)c=n[a],u=c.id,d=new YT(c,this._scene),this._updaterSets.set(u,d),d.forEach(function(y){h._insertUpdaterIntoBatch(e,y)}),this._subscriptions.set(u,d.geometryChanged.addEventListener(Tl._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let m=!0;const g=this._batches,p=g.length;for(a=0;a<p;a++)m=g[a].update(e)&&m;return m};const frt=[],hrt=new fe;Tl.prototype.getBoundingSphere=function(e,t){T.defined("entity",e),T.defined("result",t);const n=frt,i=hrt;let o=0,r=gt.DONE;const s=this._batches,a=s.length,c=e.id,u=this._updaterSets.get(c).updaters;for(let d=0;d<u.length;d++){const h=u[d];for(let m=0;m<a;m++){if(r=s[m].getBoundingSphere(h,i),r===gt.PENDING)return gt.PENDING;r===gt.DONE&&(n[o]=fe.clone(i,n[o]),o++)}}return o===0?gt.FAILED:(n.length=o,fe.fromBoundingSpheres(n,t),gt.DONE)};Tl.prototype.isDestroyed=function(){return!1};Tl.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Tl.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();this._subscriptions.removeAll();const o=this._updaterSets.values;for(n=o.length,e=0;e<n;e++)o[e].destroy();return this._updaterSets.removeAll(),He(this)};Tl.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};Tl.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));const i=Po.NUMBER_OF_SHADOW_MODES;if(t.outlineEnabled&&(l(t.terrainOffsetProperty)?this._outlineBatches[i+n].add(e,t):this._outlineBatches[n].add(e,t)),t.fillEnabled)if(t.onTerrain){const o=t.classificationTypeProperty.getValue(e);t.fillMaterialProperty instanceof nn?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof nn?l(t.terrainOffsetProperty)?this._closedColorBatches[i+n].add(e,t):this._closedColorBatches[n].add(e,t):l(t.terrainOffsetProperty)?this._closedMaterialBatches[i+n].add(e,t):this._closedMaterialBatches[n].add(e,t):t.fillMaterialProperty instanceof nn?l(t.terrainOffsetProperty)?this._openColorBatches[i+n].add(e,t):this._openColorBatches[n].add(e,t):l(t.terrainOffsetProperty)?this._openMaterialBatches[i+n].add(e,t):this._openMaterialBatches[n].add(e,t)};Tl._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!l(t.get(o))&&!l(n.get(o))&&n.set(o,i)};Tl.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let 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)};const prt=1,mrt="30px sans-serif",_rt=Zl.FILL,grt=H.WHITE,yrt=H.BLACK,Art=1,brt=!1,Crt=new H(.165,.165,.165,.8),Trt=new j(7,5),Ert=j.ZERO,xrt=f.ZERO,wrt=St.NONE,Srt=La.CENTER,vrt=Hi.CENTER,Drt=new f,Irt=new H,Prt=new H,Ort=new H,Lrt=new j,Brt=new f,Rrt=new j,Nrt=new kt,Mrt=new kt,Frt=new kt,zrt=new jt;function h8(e){this.entity=e,this.label=void 0,this.index=void 0}function Up(e,t){if(!l(e))throw new x("entityCluster is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(Up.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new vt,this._onCollectionChanged(t,t.values,[],[])}Up.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._label;let c,u=r.label,d=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(d&&(h=Z.getValueOrUndefined(s._position,e,Drt),c=Z.getValueOrUndefined(a._text,e),d=l(h)&&l(c)),!d){jR(r,s,n);continue}Z.isConstant(s._position)||(n._clusterDirty=!0);let m=!1;const g=Z.getValueOrDefault(a._heightReference,e,wrt);l(u)||(u=n.getLabel(s),u.id=s,r.label=u,m=f.equals(u.position,h)&&u.heightReference===g),u.show=!0,u.position=h,u.text=c,u.scale=Z.getValueOrDefault(a._scale,e,prt),u.font=Z.getValueOrDefault(a._font,e,mrt),u.style=Z.getValueOrDefault(a._style,e,_rt),u.fillColor=Z.getValueOrDefault(a._fillColor,e,grt,Irt),u.outlineColor=Z.getValueOrDefault(a._outlineColor,e,yrt,Prt),u.outlineWidth=Z.getValueOrDefault(a._outlineWidth,e,Art),u.showBackground=Z.getValueOrDefault(a._showBackground,e,brt),u.backgroundColor=Z.getValueOrDefault(a._backgroundColor,e,Crt,Ort),u.backgroundPadding=Z.getValueOrDefault(a._backgroundPadding,e,Trt,Lrt),u.pixelOffset=Z.getValueOrDefault(a._pixelOffset,e,Ert,Rrt),u.eyeOffset=Z.getValueOrDefault(a._eyeOffset,e,xrt,Brt),u.heightReference=g,u.horizontalOrigin=Z.getValueOrDefault(a._horizontalOrigin,e,Srt),u.verticalOrigin=Z.getValueOrDefault(a._verticalOrigin,e,vrt),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,Nrt),u.pixelOffsetScaleByDistance=Z.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,Mrt),u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,Frt),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,zrt),u.disableDepthTestDistance=Z.getValueOrUndefined(a._disableDepthTestDistance,e),m&&u._updateClamping()}return!0};Up.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new x("entity is required.");if(!l(t))throw new x("result is required.");const n=this._items.get(e.id);if(!l(n)||!l(n.label))return gt.FAILED;const i=n.label;return t.center=f.clone(A(i._clampedPosition,i.position),t.center),t.radius=0,gt.DONE};Up.prototype.isDestroyed=function(){return!1};Up.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Up.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return He(this)};Up.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._label)&&l(r._position)&&s.set(r.id,new h8(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._label)&&l(r._position)?s.contains(r.id)||s.set(r.id,new h8(r)):(jR(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],jR(s.get(r.id),r,a),s.remove(r.id)};function jR(e,t,n){l(e)&&(e.label=void 0,n.removeLabel(t))}function Urt(e,t,n){return T.typeOf.object("terrainProvider",e),T.typeOf.number("level",t),T.defined("positions",n),e.readyPromise.then(function(){return krt(e,t,n)})}function Hrt(e,t){const n=e[0],i=n.terrainProvider.requestTileGeometry(n.x,n.y,n.level);if(!i)return!1;const o=i.then(Grt(n)).catch(Wrt(n));return e.shift(),t.push(o),!0}function Vrt(e){return new Promise(function(t){setTimeout(t,e)})}function qR(e,t){return e.length?Hrt(e,t)?qR(e,t):Vrt(100).then(()=>qR(e,t)):Promise.resolve()}function krt(e,t,n){const i=e.tilingScheme;let o;const r=[],s={};for(o=0;o<n.length;++o){const c=i.positionToTileXY(n[o],t),u=c.toString();if(!s.hasOwnProperty(u)){const d={x:c.x,y:c.y,level:t,tilingScheme:i,terrainProvider:e,positions:[]};s[u]=d,r.push(d)}s[u].positions.push(n[o])}const a=[];return qR(r,a).then(function(){return Promise.all(a).then(function(){return n})})}function p8(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function Grt(e){const 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){const s=t[r];if(!p8(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){const s=t[r];p8(s,i,n)}}):Promise.resolve()}}function Wrt(e){const t=e.positions;return function(){for(let n=0;n<t.length;++n){const i=t[n];i.height=void 0}}}const iL=new j;function tI(e,t){if(!l(e))throw new x("terrainProvider is required.");if(!l(t))throw new x("positions is required.");return e.readyPromise.then(function(){const n=[],i=[],o=e.availability;if(!l(o))throw new x("sampleTerrainMostDetailed requires a terrain provider that has tile availability.");const r=[];for(let s=0;s<t.length;++s){const a=t[s],c=o.computeMaximumLevelAtPosition(a);if(i[s]=c,c===0){e.tilingScheme.positionToTileXY(a,1,iL);const d=e.loadTileDataAvailability(iL.x,iL.y,1);l(d)&&r.push(d)}let u=n[c];l(u)||(n[c]=u=[]),u.push(a)}return Promise.all(r).then(function(){return Promise.all(n.map(function(s,a){if(l(s))return Urt(e,a,s)}))}).then(function(){const s=[];for(let a=0;a<t.length;++a){const c=t[a];o.computeMaximumLevelAtPosition(c)!==i[a]&&s.push(c)}if(s.length>0)return tI(e,s)}).then(function(){return t})})}const jrt=1,qrt=0,$rt=!0,Yrt=!0,Xrt=Po.ENABLED,Krt=St.NONE,Jrt=H.RED,Qrt=0,Zrt=H.WHITE,est=kD.HIGHLIGHT,tst=.5,nst=new j(1,1),ist=new B,ost=new B,m8=new H;function gd(e,t){T.typeOf.object("scene",e),T.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(gd.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new vt,this._onCollectionChanged(t,t.values,[],[])}gd.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._entitiesToVisualize.values,n=this._modelHash,i=this._primitives;for(let o=0,r=t.length;o<r;o++){const s=t[o],a=s._model;let c,u=n[s.id],d=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(d&&(h=s.computeModelMatrix(e,ist),c=Me.createIfNeeded(Z.getValueOrUndefined(a._uri,e)),d=l(h)&&l(c)),!d){l(u)&&(u.modelPrimitive.show=!1);continue}let m=l(u)?u.modelPrimitive:void 0;if((!l(m)||c.url!==u.url)&&(l(m)&&(i.removeAndDestroy(m),delete n[s.id]),m=Ei.fromGltf({url:c,incrementallyLoadTextures:Z.getValueOrDefault(a._incrementallyLoadTextures,e,$rt),scene:this._scene}),m.id=s,i.add(m),u={modelPrimitive:m,url:c.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1,awaitingSampleTerrain:!1,clampedBoundingSphere:void 0,sampleTerrainFailed:!1},n[s.id]=u,sst(m,s,n)),m.show=!0,m.scale=Z.getValueOrDefault(a._scale,e,jrt),m.minimumPixelSize=Z.getValueOrDefault(a._minimumPixelSize,e,qrt),m.maximumScale=Z.getValueOrUndefined(a._maximumScale,e),m.modelMatrix=B.clone(h,m.modelMatrix),m.shadows=Z.getValueOrDefault(a._shadows,e,Xrt),m.heightReference=Z.getValueOrDefault(a._heightReference,e,Krt),m.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e),m.silhouetteColor=Z.getValueOrDefault(a._silhouetteColor,e,Jrt,m8),m.silhouetteSize=Z.getValueOrDefault(a._silhouetteSize,e,Qrt),m.color=Z.getValueOrDefault(a._color,e,Zrt,m8),m.colorBlendMode=Z.getValueOrDefault(a._colorBlendMode,e,est),m.colorBlendAmount=Z.getValueOrDefault(a._colorBlendAmount,e,tst),m.clippingPlanes=Z.getValueOrUndefined(a._clippingPlanes,e),m.clampAnimations=Z.getValueOrDefault(a._clampAnimations,e,Yrt),m.imageBasedLighting.imageBasedLightingFactor=Z.getValueOrDefault(a._imageBasedLightingFactor,e,nst),m.lightColor=Z.getValueOrUndefined(a._lightColor,e),m.customShader=Z.getValueOrUndefined(a._customShader,e),m.ready){const g=Z.getValueOrDefault(a._runAnimations,e,!0);u.animationsRunning!==g&&(g?m.activeAnimations.addAll({loop:cf.REPEAT}):m.activeAnimations.removeAll(),u.animationsRunning=g);const p=Z.getValueOrUndefined(a._nodeTransformations,e,u.nodeTransformationsScratch);if(l(p)){const C=Object.keys(p);for(let E=0,w=C.length;E<w;++E){const S=C[E],P=p[S];if(!l(P))continue;const L=m.getNode(S);if(!l(L))continue;const z=B.fromTranslationRotationScale(P,ost);L.matrix=B.multiply(L.originalMatrix,z,z)}}let y=!1;const b=Z.getValueOrUndefined(a._articulations,e,u.articulationsScratch);if(l(b)){const C=Object.keys(b);for(let E=0,w=C.length;E<w;++E){const S=C[E],P=b[S];l(P)&&(y=!0,m.setArticulationStage(S,P))}}y&&m.applyArticulations()}}return!0};gd.prototype.isDestroyed=function(){return!1};gd.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(gd.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)$R(this,e[i],t,n);return He(this)};gd._sampleTerrainMostDetailed=tI;const Zg=new f,_8=new Ce;gd.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new x("entity is required.");if(!l(t))throw new x("result is required.");const n=this._modelHash[e.id];if(!l(n)||n.loadFail)return gt.FAILED;const i=n.modelPrimitive;if(!l(i)||!i.show)return gt.FAILED;if(!i.ready)return gt.PENDING;const r=this._scene.globe,s=r.ellipsoid,a=r.terrainProvider;if(i.heightReference!==St.NONE){if(!a.ready)return gt.PENDING;const u=i.modelMatrix;Zg.x=u[12],Zg.y=u[13],Zg.z=u[14];const d=s.cartesianToCartographic(Zg);if(!l(a.availability)){i.heightReference===St.CLAMP_TO_GROUND&&(d.height=0);const g=s.cartographicToCartesian(d);return fe.clone(i.boundingSphere,t),t.center=g,gt.DONE}let h=this._modelHash[e.id].clampedBoundingSphere;return this._modelHash[e.id].sampleTerrainFailed?(this._modelHash[e.id].sampleTerrainFailed=!1,gt.FAILED):l(h)?(fe.clone(h,t),this._modelHash[e.id].clampedBoundingSphere=void 0,gt.DONE):(h=new fe,this._modelHash[e.id].awaitingSampleTerrain||(Ce.clone(d,_8),this._modelHash[e.id].awaitingSampleTerrain=!0,gd._sampleTerrainMostDetailed(a,[_8]).then(p=>{this._modelHash[e.id].awaitingSampleTerrain=!1;const y=p[0];i.heightReference===St.RELATIVE_TO_GROUND&&(y.height+=d.height),s.cartographicToCartesian(y,Zg),fe.clone(i.boundingSphere,h),h.center=Zg,this._modelHash[e.id].clampedBoundingSphere=fe.clone(h)}).catch(p=>{this._modelHash[e.id].sampleTerrainFailed=!0,this._modelHash[e.id].awaitingSampleTerrain=!1})),gt.PENDING)}return fe.clone(i.boundingSphere,t),gt.DONE};gd.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._entitiesToVisualize,a=this._modelHash,c=this._primitives;for(o=t.length-1;o>-1;o--)r=t[o],l(r._model)&&l(r._position)&&s.set(r.id,r);for(o=i.length-1;o>-1;o--)r=i[o],l(r._model)&&l(r._position)?(rst(r,a),s.set(r.id,r)):($R(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],$R(this,r,a,c),s.remove(r.id)};function $R(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function rst(e,t){const n=t[e.id];l(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function sst(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}function Hp(e){this._definitionChanged=new Ke,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(Hp.prototype,{isConstant:{get:function(){return Z.isConstant(this._value)}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return l(this._value)?this._value.referenceFrame:fa.FIXED}}});Hp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,fa.FIXED,t)};Hp.prototype.setValue=function(e){this._value!==e&&(this._value=e,l(this._removeSubscription)&&(this._removeSubscription(),this._removeSubscription=void 0),l(e)&&(this._removeSubscription=e.definitionChanged.addEventListener(this._raiseDefinitionChanged,this)),this._definitionChanged.raiseEvent(this))};Hp.prototype.getValueInReferenceFrame=function(e,t,n){if(!l(e))throw new x("time is required.");if(!l(t))throw new x("referenceFrame is required.");if(l(this._value))return n=this._value.getValueInReferenceFrame(e,t,n),l(n)?me.WGS84.scaleToGeodeticSurface(n,n):void 0};Hp.prototype.equals=function(e){return this===e||e instanceof Hp&&this._value===e._value};Hp.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const ast=60,cst=1,Tte=new rn,oL=new rn,rL=new rn;function g8(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function lst(e,t,n,i,o,r,s,a,c){let u=a,d;d=e.getValueInReferenceFrame(t,r,c[u]),l(d)&&(c[u++]=d);let h=!l(o)||ie.lessThanOrEquals(o,t)||ie.greaterThanOrEquals(o,n),m=0;const g=i.length;let p=i[m];const y=n;let b=!1,C,E,w;for(;m<g;){if(!h&&ie.greaterThanOrEquals(p,o)&&(d=e.getValueInReferenceFrame(o,r,c[u]),l(d)&&(c[u++]=d),h=!0),ie.greaterThan(p,t)&&ie.lessThan(p,y)&&!p.equals(o)&&(d=e.getValueInReferenceFrame(p,r,c[u]),l(d)&&(c[u++]=d)),m<g-1){if(s>0&&!b){const S=i[m+1],P=ie.secondsDifference(S,p);b=P>s,b&&(C=Math.ceil(P/s),E=0,w=P/Math.max(C,2),C=Math.max(C-1,1))}if(b&&E<C){p=ie.addSeconds(p,w,new ie),E++;continue}}b=!1,m++,p=i[m]}return d=e.getValueInReferenceFrame(n,r,c[u]),l(d)&&(c[u++]=d),u}function ust(e,t,n,i,o,r,s,a){let c,u=0,d=s,h=t;const m=Math.max(r,60);let g=!l(i)||ie.lessThanOrEquals(i,t)||ie.greaterThanOrEquals(i,n);for(;ie.lessThan(h,n);)!g&&ie.greaterThanOrEquals(h,i)&&(g=!0,c=e.getValueInReferenceFrame(i,o,a[d]),l(c)&&(a[d]=c,d++)),c=e.getValueInReferenceFrame(h,o,a[d]),l(c)&&(a[d]=c,d++),u++,h=ie.addSeconds(t,m*u,new ie);return c=e.getValueInReferenceFrame(n,o,a[d]),l(c)&&(a[d]=c,d++),d}function dst(e,t,n,i,o,r,s,a){rL.start=t,rL.stop=n;let c=s;const u=e.intervals;for(let d=0;d<u.length;d++){const h=u.get(d);if(!rn.intersect(h,rL,Tte).isEmpty){let m=h.start;h.isStartIncluded||(h.isStopIncluded?m=h.stop:m=ie.addSeconds(h.start,ie.secondsDifference(h.stop,h.start)/2,new ie));const g=e.getValueInReferenceFrame(m,o,a[c]);l(g)&&(a[c]=g,c++)}}return c}function fst(e,t,n,i,o,r,s,a){const c=e.getValueInReferenceFrame(t,o,a[s]);return l(c)&&(a[s++]=c),s}function hst(e,t,n,i,o,r,s,a){oL.start=t,oL.stop=n;let c=s;const u=e.intervals;for(let d=0;d<u.length;d++){const h=u.get(d);if(!rn.intersect(h,oL,Tte).isEmpty){const m=h.start,g=h.stop;let p=t;ie.greaterThan(m,p)&&(p=m);let y=n;ie.lessThan(g,y)&&(y=g),c=Ete(h.data,p,y,i,o,r,c,a)}}return c}function Ete(e,t,n,i,o,r,s,a){for(;e instanceof Dc;)e=e.resolvedProperty;if(e instanceof Ic){const c=e._property._times;s=lst(e,t,n,c,i,o,r,s,a)}else e instanceof Fp?s=hst(e,t,n,i,o,r,s,a):e instanceof zp?s=dst(e,t,n,i,o,r,s,a):e instanceof Nf||e instanceof Hp&&Z.isConstant(e)?s=fst(e,t,n,i,o,r,s,a):s=ust(e,t,n,i,o,r,s,a);return s}function xte(e,t,n,i,o,r,s){l(s)||(s=[]);const a=Ete(e,t,n,i,o,r,0,s);return s.length=a,s}const y8=new J;function XT(e,t){this._unusedIndexes=[],this._polylineCollection=new Qa,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}XT.prototype.update=function(e){if(this._referenceFrame===fa.INERTIAL){let t=cn.computeIcrfToFixedMatrix(e,y8);l(t)||(t=cn.computeTemeToPseudoFixedMatrix(e,y8)),B.fromRotationTranslation(t,f.ZERO,this._polylineCollection.modelMatrix)}};XT.prototype.updateObject=function(e,t){const n=t.entity,i=n._path,o=n._position;let r,s;const a=i._show;let c=t.polyline,u=n.isShowing&&n.isAvailable(e)&&(!l(a)||a.getValue(e));if(u){const h=Z.getValueOrUndefined(i._leadTime,e),m=Z.getValueOrUndefined(i._trailTime,e),g=n._availability,p=l(g),y=l(h),b=l(m);if(u=p||y&&b,u){if(b&&(r=ie.addSeconds(e,-m,new ie)),y&&(s=ie.addSeconds(e,h,new ie)),p){const C=g.start,E=g.stop;(!b||ie.greaterThan(C,r))&&(r=C),(!y||ie.lessThan(E,s))&&(s=E)}u=ie.lessThan(r,s)}}if(!u){l(c)&&(this._unusedIndexes.push(t.index),t.polyline=void 0,c.show=!1,t.index=void 0);return}if(!l(c)){const h=this._unusedIndexes;if(h.length>0){const g=h.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}const d=Z.getValueOrDefault(i._resolution,e,ast);c.show=!0,c.positions=xte(o,r,s,e,this._referenceFrame,d,c.positions.slice()),c.material=Or.getValue(e,i._material,c.material),c.width=Z.getValueOrDefault(i._width,e,cst),c.distanceDisplayCondition=Z.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)};XT.prototype.removeObject=function(e){const t=e.polyline;l(t)&&(this._unusedIndexes.push(e.index),e.polyline=void 0,t.show=!1,t.id=void 0,e.index=void 0)};XT.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),He(this)};function Vp(e,t){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(Vp.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new vt,this._onCollectionChanged(t,t.values,[],[])}Vp.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._updaters;for(const i in t)t.hasOwnProperty(i)&&t[i].update(e);const n=this._items.values;if(n.length===0&&l(this._updaters)&&Object.keys(this._updaters).length>0){for(const i in t)t.hasOwnProperty(i)&&t[i].destroy();this._updaters={}}for(let i=0,o=n.length;i<o;i++){const r=n[i],a=r.entity._position,c=r.updater;let u=fa.FIXED;this._scene.mode===le.SCENE3D&&(u=a.referenceFrame);let d=this._updaters[u];if(c===d&&l(d)){d.updateObject(e,r);continue}l(c)&&c.removeObject(r),l(d)||(d=new XT(this._scene,u),d.update(e),this._updaters[u]=d),r.updater=d,l(d)&&d.updateObject(e,r)}return!0};Vp.prototype.isDestroyed=function(){return!1};Vp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Vp.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return He(this)};Vp.prototype._onCollectionChanged=function(e,t,n,i){let o,r,s;const a=this._items;for(o=t.length-1;o>-1;o--)r=t[o],l(r._path)&&l(r._position)&&a.set(r.id,new g8(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._path)&&l(r._position)?a.contains(r.id)||a.set(r.id,new g8(r)):(s=a.get(r.id),l(s)&&(l(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),l(s)&&(l(s.updater)&&s.updater.removeObject(s),a.remove(r.id))};Vp._subSample=xte;const A8=H.WHITE,b8=H.BLACK,C8=0,T8=1,E8=0,x8=new H,pst=new f,w8=new H,S8=new kt,v8=new kt,D8=new jt;function I8(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 kp(e,t){if(!l(e))throw new x("entityCluster is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(kp.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new vt,this._onCollectionChanged(t,t.values,[],[])}kp.prototype.update=function(e){if(!l(e))throw new x("time is required.");const t=this._items.values,n=this._cluster;for(let i=0,o=t.length;i<o;i++){const r=t[i],s=r.entity,a=s._point;let c=r.pointPrimitive,u=r.billboard;const d=Z.getValueOrDefault(a._heightReference,e,St.NONE);let h=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),m;if(h&&(m=Z.getValueOrUndefined(s._position,e,pst),h=l(m)),!h){Qb(r,s,n);continue}Z.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,p=!1;if(d!==St.NONE&&!l(u)?(l(c)&&(Qb(r,s,n),c=void 0),u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u,g=!0,p=f.equals(u.position,m)&&u.heightReference===d):d===St.NONE&&!l(c)&&(l(u)&&(Qb(r,s,n),u=void 0),c=n.getPoint(s),c.id=s,r.pointPrimitive=c),l(c))c.show=!0,c.position=m,c.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,S8),c.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,v8),c.color=Z.getValueOrDefault(a._color,e,A8,x8),c.outlineColor=Z.getValueOrDefault(a._outlineColor,e,b8,w8),c.outlineWidth=Z.getValueOrDefault(a._outlineWidth,e,C8),c.pixelSize=Z.getValueOrDefault(a._pixelSize,e,T8),c.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,D8),c.disableDepthTestDistance=Z.getValueOrDefault(a._disableDepthTestDistance,e,E8);else if(l(u)){u.show=!0,u.position=m,u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,S8),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,v8),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,D8),u.disableDepthTestDistance=Z.getValueOrDefault(a._disableDepthTestDistance,e,E8),u.heightReference=d;const y=Z.getValueOrDefault(a._color,e,A8,x8),b=Z.getValueOrDefault(a._outlineColor,e,b8,w8),C=Math.round(Z.getValueOrDefault(a._outlineWidth,e,C8));let E=Math.max(1,Math.round(Z.getValueOrDefault(a._pixelSize,e,T8)));if(C>0?(u.scale=1,g=g||C!==r.outlineWidth||E!==r.pixelSize||!H.equals(y,r.color)||!H.equals(b,r.outlineColor)):(u.scale=E/50,E=50,g=g||C!==r.outlineWidth||!H.equals(y,r.color)||!H.equals(b,r.outlineColor)),g){r.color=H.clone(y,r.color),r.outlineColor=H.clone(b,r.outlineColor),r.pixelSize=E,r.outlineWidth=C;const w=y.alpha,S=y.toCssColorString(),P=b.toCssColorString(),L=JSON.stringify([S,E,P,C]);u.setImage(L,KQ(w,S,P,C,E))}p&&u._updateClamping()}}return!0};kp.prototype.getBoundingSphere=function(e,t){if(!l(e))throw new x("entity is required.");if(!l(t))throw new x("result is required.");const n=this._items.get(e.id);if(!l(n)||!(l(n.pointPrimitive)||l(n.billboard)))return gt.FAILED;if(l(n.pointPrimitive))t.center=f.clone(n.pointPrimitive.position,t.center);else{const i=n.billboard;if(!l(i._clampedPosition))return gt.PENDING;t.center=f.clone(i._clampedPosition,t.center)}return t.radius=0,gt.DONE};kp.prototype.isDestroyed=function(){return!1};kp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(kp.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return He(this)};kp.prototype._onCollectionChanged=function(e,t,n,i){let o,r;const s=this._items,a=this._cluster;for(o=t.length-1;o>-1;o--)r=t[o],l(r._point)&&l(r._position)&&s.set(r.id,new I8(r));for(o=i.length-1;o>-1;o--)r=i[o],l(r._point)&&l(r._position)?s.contains(r.id)||s.set(r.id,new I8(r)):(Qb(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],Qb(s.get(r.id),r,a),s.remove(r.id)};function Qb(e,t,n){if(l(e)){const i=e.pointPrimitive;if(l(i)){e.pointPrimitive=void 0,n.removePoint(t);return}const o=e.billboard;l(o)&&(e.billboard=void 0,n.removeBillboard(t))}}const wte=[];function mst(e,t,n,i,o){const r=wte;r.length=o;let s;const a=n.red,c=n.green,u=n.blue,d=n.alpha,h=i.red,m=i.green,g=i.blue,p=i.alpha;if(H.equals(n,i)){for(s=0;s<o;s++)r[s]=H.clone(n);return r}const y=(h-a)/o,b=(m-c)/o,C=(g-u)/o,E=(p-d)/o;for(s=0;s<o;s++)r[s]=new H(a+s*y,c+s*b,u+s*C,d+s*E);return r}function ZC(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.colors,i=A(e.width,1),o=A(e.colorsPerVertex,!1);if(!l(t)||t.length<2)throw new x("At least two positions are required.");if(typeof i!="number")throw new x("width must be a number");if(l(n)&&(o&&n.length<t.length||!o&&n.length<t.length-1))throw new x("colors has an invalid length.");this._positions=t,this._colors=n,this._width=i,this._colorsPerVertex=o,this._vertexFormat=Fe.clone(A(e.vertexFormat,Fe.DEFAULT)),this._arcType=A(e.arcType,Bn.GEODESIC),this._granularity=A(e.granularity,M.RADIANS_PER_DEGREE),this._ellipsoid=me.clone(A(e.ellipsoid,me.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*f.packedLength;r+=l(n)?1+n.length*H.packedLength:1,this.packedLength=r+me.packedLength+Fe.packedLength+4}ZC.pack=function(e,t,n){if(!l(e))throw new x("value is required");if(!l(t))throw new x("array is required");n=A(n,0);let i;const o=e._positions;let r=o.length;for(t[n++]=r,i=0;i<r;++i,n+=f.packedLength)f.pack(o[i],t,n);const s=e._colors;for(r=l(s)?s.length:0,t[n++]=r,i=0;i<r;++i,n+=H.packedLength)H.pack(s[i],t,n);return me.pack(e._ellipsoid,t,n),n+=me.packedLength,Fe.pack(e._vertexFormat,t,n),n+=Fe.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const Ste=me.clone(me.UNIT_SPHERE),vte=new Fe,Fm={positions:void 0,colors:void 0,ellipsoid:Ste,vertexFormat:vte,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};ZC.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);let i,o=e[t++];const r=new Array(o);for(i=0;i<o;++i,t+=f.packedLength)r[i]=f.unpack(e,t);o=e[t++];const s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=H.packedLength)s[i]=H.unpack(e,t);const a=me.unpack(e,t,Ste);t+=me.packedLength;const c=Fe.unpack(e,t,vte);t+=Fe.packedLength;const u=e[t++],d=e[t++]===1,h=e[t++],m=e[t];return l(n)?(n._positions=r,n._colors=s,n._ellipsoid=me.clone(a,n._ellipsoid),n._vertexFormat=Fe.clone(c,n._vertexFormat),n._width=u,n._colorsPerVertex=d,n._arcType=h,n._granularity=m,n):(Fm.positions=r,Fm.colors=s,Fm.width=u,Fm.colorsPerVertex=d,Fm.arcType=h,Fm.granularity=m,new ZC(Fm))};const P8=new f,O8=new f,L8=new f,B8=new f;ZC.createGeometry=function(e){const t=e._width,n=e._vertexFormat;let i=e._colors;const o=e._colorsPerVertex,r=e._arcType,s=e._granularity,a=e._ellipsoid;let c,u,d;const h=[];let m=da(e._positions,f.equalsEpsilon,!1,h);if(l(i)&&h.length>0){let O=0,N=h[0];i=i.filter(function(V,k){let G=!1;return o?G=k===N||k===0&&N===1:G=k+1===N,G?(O++,N=h[O],!1):!0})}let g=m.length;if(g<2||t<=0)return;if(r===Bn.GEODESIC||r===Bn.RHUMB){let O,N;r===Bn.GEODESIC?(O=M.chordLength(s,a.maximumRadius),N=yr.numberOfPoints):(O=s,N=yr.numberOfPointsRhumbLine);const V=yr.extractHeights(m,a);if(l(i)){let k=1;for(c=0;c<g-1;++c)k+=N(m[c],m[c+1],O);const G=new Array(k);let W=0;for(c=0;c<g-1;++c){const K=m[c],q=m[c+1],te=i[c],Y=N(K,q,O);if(o&&c<k){const X=i[c+1],$=mst(K,q,te,X,Y),se=$.length;for(u=0;u<se;++u)G[W++]=$[u]}else for(u=0;u<Y;++u)G[W++]=H.clone(te)}G[W]=H.clone(i[i.length-1]),i=G,wte.length=0}r===Bn.GEODESIC?m=yr.generateCartesianArc({positions:m,minDistance:O,ellipsoid:a,height:V}):m=yr.generateCartesianRhumbArc({positions:m,granularity:O,ellipsoid:a,height:V})}g=m.length;const p=g*4-4,y=new Float64Array(p*3),b=new Float64Array(p*3),C=new Float64Array(p*3),E=new Float32Array(p*2),w=n.st?new Float32Array(p*2):void 0,S=l(i)?new Uint8Array(p*4):void 0;let P=0,L=0,z=0,R=0,F;for(u=0;u<g;++u){u===0?(F=P8,f.subtract(m[0],m[1],F),f.add(m[0],F,F)):F=m[u-1],f.clone(F,L8),f.clone(m[u],O8),u===g-1?(F=P8,f.subtract(m[g-1],m[g-2],F),f.add(m[g-1],F,F)):F=m[u+1],f.clone(F,B8);let O,N;l(S)&&(u!==0&&!o?O=i[u-1]:O=i[u],u!==g-1&&(N=i[u]));const V=u===0?2:0,k=u===g-1?2:4;for(d=V;d<k;++d){f.pack(O8,y,P),f.pack(L8,b,P),f.pack(B8,C,P),P+=3;const G=d-2<0?-1:1;if(E[L++]=2*(d%2)-1,E[L++]=G*t,n.st&&(w[z++]=u/(g-1),w[z++]=Math.max(E[L-2],0)),l(S)){const W=d<2?O:N;S[R++]=H.floatToByte(W.red),S[R++]=H.floatToByte(W.green),S[R++]=H.floatToByte(W.blue),S[R++]=H.floatToByte(W.alpha)}}}const U=new Ji;U.position=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:y}),U.prevPosition=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:b}),U.nextPosition=new Ue({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:C}),U.expandAndWidth=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:E}),n.st&&(U.st=new Ue({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:w})),l(S)&&(U.color=new Ue({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:4,values:S,normalize:!0}));const D=at.createTypedArray(p,g*6-6);let I=0,_=0;const v=g-1;for(u=0;u<v;++u)D[_++]=I,D[_++]=I+2,D[_++]=I+1,D[_++]=I+1,D[_++]=I+2,D[_++]=I+3,I+=4;return new Lt({attributes:U,indices:D,primitiveType:Ze.TRIANGLES,boundingSphere:fe.fromPoints(m),geometryType:Cy.POLYLINES})};const _st=new $o(0),Dv={},R8=new H,gst=new nn(H.WHITE),yst=new $o(!0),Ast=new $o(Po.DISABLED),bst=new $o(new jt),Cst=new $o(vo.BOTH);function Tst(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Est(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function Bu(e,t){if(!l(e))throw new x("entity is required");if(!l(t))throw new x("scene is required");this._entity=e,this._scene=t,this._entitySubscription=e.definitionChanged.addEventListener(Bu.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new Ke,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 Tst,this._groundGeometryOptions=new Est,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Nr.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(Bu.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||!l(this._entity.availability)&&Z.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}}});Bu.prototype.isOutlineVisible=function(e){return!1};Bu.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e);return A(n,!1)};Bu.prototype.createFillGeometryInstance=function(e){if(!l(e))throw new x("time is required.");if(!this._fillEnabled)throw new x("This instance does not represent a filled geometry.");const t=this._entity,n=t.isAvailable(e),i=new Xn(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=Ii.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r};let a;return this._materialProperty instanceof nn&&(l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,R8)),l(a)||(a=H.WHITE),s.color=pn.fromColor(a)),this.clampToGround?new ln({id:t,geometry:new Bf(this._groundGeometryOptions),attributes:s}):(l(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof nn&&(l(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,R8)),l(a)||(a=H.WHITE),s.depthFailColor=pn.fromColor(a)),new ln({id:t,geometry:new ZC(this._geometryOptions),attributes:s}))};Bu.prototype.createOutlineGeometryInstance=function(e){throw new x("This instance does not represent an outlined geometry.")};Bu.prototype.isDestroyed=function(){return!1};Bu.prototype.destroy=function(){this._entitySubscription(),He(this)};Bu.prototype._onEntityPropertyChanged=function(e,t,n,i){if(!(t==="availability"||t==="polyline"))return;const o=this._entity.polyline;if(!l(o)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const r=o.positions,s=o.show;if(l(s)&&s.isConstant&&!s.getValue(ft.MINIMUM_VALUE)||!l(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const a=o.zIndex,c=A(o.material,gst),u=c instanceof nn;this._materialProperty=c,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=A(s,yst),this._shadowsProperty=A(o.shadows,Ast),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,bst),this._classificationTypeProperty=A(o.classificationType,Cst),this._fillEnabled=!0,this._zIndex=A(a,_st);const d=o.width,h=o.arcType,m=o.clampToGround,g=o.granularity;if(!r.isConstant||!Z.isConstant(d)||!Z.isConstant(h)||!Z.isConstant(g)||!Z.isConstant(m)||!Z.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{const p=this._geometryOptions,y=r.getValue(ft.MINIMUM_VALUE,p.positions);if(!l(y)||y.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let b;u&&(!l(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof nn)?b=ea.VERTEX_FORMAT:b=Is.VERTEX_FORMAT,p.vertexFormat=b,p.positions=y,p.width=l(d)?d.getValue(ft.MINIMUM_VALUE):void 0,p.arcType=l(h)?h.getValue(ft.MINIMUM_VALUE):void 0,p.granularity=l(g)?g.getValue(ft.MINIMUM_VALUE):void 0;const C=this._groundGeometryOptions;C.positions=y,C.width=p.width,C.arcType=p.arcType,C.granularity=p.granularity,this._clampToGround=l(m)?m.getValue(ft.MINIMUM_VALUE):!1,!this._clampToGround&&l(a)&&ki("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Bu.prototype.createDynamicUpdater=function(e,t){if(T.defined("primitives",e),T.defined("groundPrimitives",t),!this._dynamic)throw new x("This instance does not represent dynamic geometry.");return new KT(e,t,this)};const ey={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function KT(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 Dte(e){if(l(e._line))return e._line;const t=e._geometryUpdater._scene.id;let n=Dv[t];const i=e._primitives;!l(n)||n.isDestroyed()?(n=new Qa,Dv[t]=n,i.add(n)):i.contains(n)||i.add(n);const o=n.add();return o.id=e._geometryUpdater._entity,e._line=o,o}KT.prototype.update=function(e){const t=this._geometryUpdater,n=t._entity,i=n.polyline,o=i.positions;let r=Z.getValueOrUndefined(o,e,this._positions);t._clampToGround=Z.getValueOrDefault(i._clampToGround,e,!1),t._groundGeometryOptions.positions=r,t._groundGeometryOptions.width=Z.getValueOrDefault(i._width,e,1),t._groundGeometryOptions.arcType=Z.getValueOrDefault(i._arcType,e,Bn.GEODESIC),t._groundGeometryOptions.granularity=Z.getValueOrDefault(i._granularity,e,9999);const s=this._groundPrimitives;if(l(this._groundPolylinePrimitive)&&(s.remove(this._groundPolylinePrimitive),this._groundPolylinePrimitive=void 0),t.clampToGround){if(!n.isShowing||!n.isAvailable(e)||!Z.getValueOrDefault(i._show,e,!0)||!l(r)||r.length<2)return;const d=t.fillMaterialProperty;let h;if(d instanceof nn)h=new ea;else{const m=Or.getValue(e,d,this._material);h=new Is({material:m,translucent:m.isTranslucent()}),this._material=m}this._groundPolylinePrimitive=s.add(new yl({geometryInstances:t.createFillGeometryInstance(e),appearance:h,classificationType:t.classificationTypeProperty.getValue(e),asynchronous:!1}),Z.getValueOrUndefined(t.zIndex,e)),l(this._line)&&(this._line.show=!1);return}const a=Dte(this);if(!n.isShowing||!n.isAvailable(e)||!Z.getValueOrDefault(i._show,e,!0)){a.show=!1;return}if(!l(r)||r.length<2){a.show=!1;return}let c=Bn.GEODESIC;c=Z.getValueOrDefault(i._arcType,e,c);const u=t._scene.globe;c!==Bn.NONE&&l(u)&&(ey.ellipsoid=u.ellipsoid,ey.positions=r,ey.granularity=Z.getValueOrUndefined(i._granularity,e),ey.height=yr.extractHeights(r,u.ellipsoid),c===Bn.GEODESIC?r=yr.generateCartesianArc(ey):r=yr.generateCartesianRhumbArc(ey)),a.show=!0,a.positions=r.slice(),a.material=Or.getValue(e,t.fillMaterialProperty,a.material),a.width=Z.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=Z.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};KT.prototype.getBoundingSphere=function(e){if(T.defined("result",e),this._geometryUpdater.clampToGround){const t=this._groundPolylinePrimitive;if(l(t)&&t.show&&t.ready){const n=t.getGeometryInstanceAttributes(this._geometryUpdater._entity);if(l(n)&&l(n.boundingSphere))return fe.clone(n.boundingSphere,e),gt.DONE}return l(t)&&!t.ready?gt.PENDING:gt.DONE}else{const t=Dte(this);if(t.show&&t.positions.length>0)return fe.fromPoints(t.positions,e),gt.DONE}return gt.FAILED};KT.prototype.isDestroyed=function(){return!1};KT.prototype.destroy=function(){const t=this._geometryUpdater._scene.id,n=Dv[t];l(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete Dv[t])),l(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),He(this)};const xst=new H,wst=new jt,Sst=new jt;function Ru(e,t,n,i,o){let r;n instanceof nn?r=ea:r=Is,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new vt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new vt,this.material=void 0,this.updatersWithAttributes=new vt,this.attributes=new vt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(Ru.prototype.onMaterialChanged,this),this.subscriptions=new vt,this.showsUpdated=new vt,this.zIndex=i,this._asynchronous=o}Ru.prototype.onMaterialChanged=function(){this.invalidated=!0};Ru.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof nn&&t instanceof nn?!0:l(t)&&t.equals(n)};Ru.prototype.add=function(e,t,n){const i=t.id;if(this.updaters.set(i,t),this.geometry.set(i,n),!t.hasConstantFill||!t.fillMaterialProperty.isConstant||!Z.isConstant(t.distanceDisplayConditionProperty))this.updatersWithAttributes.set(i,t);else{const 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};Ru.prototype.remove=function(e){const t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);const n=this.subscriptions.get(t);return l(n)&&(n(),this.subscriptions.remove(t)),!0}return!1};Ru.prototype.update=function(e){let t=!0,n=this.primitive;const i=this.orderedGroundPrimitives,o=this.geometry.values;let r;if(this.createPrimitive){if(o.length>0)l(n)&&(l(this.oldPrimitive)?i.remove(n):this.oldPrimitive=n),n=new yl({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===Is&&(this.material=Or.getValue(e,this.materialProperty,this.material),n.appearance.material=this.material),i.add(n,this.zIndex),t=!1;else{l(n)&&(i.remove(n),n=void 0);const a=this.oldPrimitive;l(a)&&(i.remove(a),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=n,this.createPrimitive=!1}else if(l(n)&&n.ready){n.show=!0,l(this.oldPrimitive)&&(i.remove(this.oldPrimitive),this.oldPrimitive=void 0),this.appearanceType===Is&&(this.material=Or.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material);const s=this.updatersWithAttributes.values,a=s.length;for(r=0;r<a;r++){const c=s[r],u=c.entity,d=this.geometry.get(c.id);let h=this.attributes.get(d.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(d.id),this.attributes.set(d.id.id,h)),!c.fillMaterialProperty.isConstant){const y=c.fillMaterialProperty.color,b=Z.getValueOrDefault(y,e,H.WHITE,xst);H.equals(h._lastColor,b)||(h._lastColor=H.clone(b,h._lastColor),h.color=pn.toValue(b,h.color))}const m=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;m!==g&&(h.show=Xn.toValue(m,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,Sst,wst);jt.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=jt.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=Ii.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};Ru.prototype.updateShows=function(e){const t=this.showsUpdated.values,n=t.length;for(let i=0;i<n;i++){const o=t[i],r=o.entity,s=this.geometry.get(o.id);let a=this.attributes.get(s.id.id);l(a)||(a=e.getGeometryInstanceAttributes(s.id),this.attributes.set(s.id.id,a));const c=r.isShowing,u=a.show[0]===1;c!==u&&(a.show=Xn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};Ru.prototype.contains=function(e){return this.updaters.contains(e.id)};Ru.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return gt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?gt.FAILED:(i.boundingSphere.clone(t),gt.DONE)};Ru.prototype.destroy=function(){const e=this.primitive,t=this.orderedGroundPrimitives;l(e)&&t.remove(e);const n=this.oldPrimitive;l(n)&&t.remove(n),this.removeMaterialSubscription()};function Y0(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=A(n,!0)}Y0.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=Z.getValueOrDefault(t.zIndex,0);for(let a=0;a<i;++a){const c=n[a];if(c.isMaterial(t)&&c.zIndex===r){c.add(e,t,o);return}}const s=new Ru(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};Y0.prototype.remove=function(e){const t=this._items,n=t.length;for(let i=n-1;i>=0;i--){const o=t[i];if(o.remove(e)){o.updaters.length===0&&(t.splice(i,1),o.destroy());break}}};Y0.prototype.update=function(e){let t;const n=this._items,i=n.length;for(t=i-1;t>=0;t--){const r=n[t];if(r.invalidated){n.splice(t,1);const 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};Y0.prototype.getBoundingSphere=function(e,t){const n=this._items,i=n.length;for(let o=0;o<i;o++){const r=n[o];if(r.contains(e))return r.getBoundingSphere(e,t)}return gt.FAILED};Y0.prototype.removeAllPrimitives=function(){const e=this._items,t=e.length;for(let n=0;n<t;n++)e[n].destroy();this._items.length=0};const vst=[];function N8(e,t){const n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function M8(e,t,n){if(n.isDynamic){e._dynamicBatch.add(t,n);return}if(n.clampToGround&&n.fillEnabled){const s=n.classificationTypeProperty.getValue(t);e._groundBatches[s].add(t,n);return}let i;n.fillEnabled&&(i=n.shadowsProperty.getValue(t));let o=0;l(n.depthFailMaterialProperty)&&(o=n.depthFailMaterialProperty instanceof nn?1:2);let r;l(i)&&(r=i+o*Po.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof nn?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function yd(e,t,n,i){T.defined("scene",e),T.defined("entityCollection",t),i=A(i,e.groundPrimitives),n=A(n,e.primitives),this._scene=e,this._primitives=n,this._entityCollection=void 0,this._addedObjects=new vt,this._removedObjects=new vt,this._changedObjects=new vt;let o;const r=Po.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 rl(n,ea,void 0,!1,o),this._materialBatches[o]=new sl(n,Is,void 0,!1,o),this._colorBatches[o+r]=new rl(n,ea,ea,!1,o),this._materialBatches[o+r]=new sl(n,Is,ea,!1,o),this._colorBatches[o+r*2]=new rl(n,ea,Is,!1,o),this._materialBatches[o+r*2]=new sl(n,Is,Is,!1,o);this._dynamicBatch=new _g(n,i);const s=vo.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new Y0(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new vt,this._updaters=new vt,this._entityCollection=t,t.collectionChanged.addEventListener(yd.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,vst)}yd.prototype.update=function(e){T.defined("time",e);const t=this._addedObjects,n=t.values,i=this._removedObjects,o=i.values,r=this._changedObjects,s=r.values;let a,c,u,d;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,d=this._updaters.get(u),d.entity===c?(N8(this,d),M8(this,e,d)):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],u=c.id,d=this._updaters.get(u),N8(this,d),d.destroy(),this._updaters.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)c=n[a],u=c.id,d=new Bu(c,this._scene),this._updaters.set(u,d),M8(this,e,d),this._subscriptions.set(u,d.geometryChanged.addEventListener(yd._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let h=!0;const m=this._batches,g=m.length;for(a=0;a<g;a++)h=m[a].update(e)&&h;return h};const Dst=[],Ist=new fe;yd.prototype.getBoundingSphere=function(e,t){T.defined("entity",e),T.defined("result",t);const n=Dst,i=Ist;let o=0,r=gt.DONE;const s=this._batches,a=s.length,c=this._updaters.get(e.id);for(let u=0;u<a;u++){if(r=s[u].getBoundingSphere(c,i),r===gt.PENDING)return gt.PENDING;r===gt.DONE&&(n[o]=fe.clone(i,n[o]),o++)}return o===0?gt.FAILED:(n.length=o,fe.fromBoundingSpheres(n,t),gt.DONE)};yd.prototype.isDestroyed=function(){return!1};yd.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(yd.prototype._onCollectionChanged,this),this._addedObjects.removeAll(),this._removedObjects.removeAll();let e;const t=this._batches;let n=t.length;for(e=0;e<n;e++)t[e].removeAllPrimitives();const i=this._subscriptions.values;for(n=i.length,e=0;e<n;e++)i[e]();return this._subscriptions.removeAll(),He(this)};yd._onGeometryChanged=function(e){const t=this._removedObjects,n=this._changedObjects,i=e.entity,o=i.id;!l(t.get(o))&&!l(n.get(o))&&n.set(o,i)};yd.prototype._onCollectionChanged=function(e,t,n){const i=this._addedObjects,o=this._removedObjects,r=this._changedObjects;let 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)};function Dl(e){T.typeOf.object("options",e),T.typeOf.object("options.scene",e.scene),T.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),$r.initializeTerrainHeights(),yl.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new Nd,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=A(e.visualizersCallback,Dl.defaultVisualizersCallback);let i=!1;const o=new qo,r=new qo;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,d=n.length;u<d;u++)this._onDataSourceAdded(n,n.get(u));const s=new gF;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,c;if(!i){const u=this,d=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),c(),u._removeDefaultDataSourceListener=void 0,u._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(d),c=n.dataSourceAdded.addEventListener(d)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=c,this._ready=!1}Dl.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new Lp(t,i),new Tl(e,i,n._primitives,n._groundPrimitives),new Up(t,i),new gd(e,i),new Mp(e,i),new kp(t,i),new Vp(e,i),new yd(e,i,n._primitives,n._groundPrimitives)]};Object.defineProperties(Dl.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}}});Dl.prototype.isDestroyed=function(){return!1};Dl.prototype.destroy=function(){this._eventHelper.removeAll();const 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),l(this._removeDefaultDataSourceListener)?(this._removeDefaultDataSourceListener(),this._removeDataSourceCollectionListener()):(this._scene.primitives.remove(this._primitives),this._scene.groundPrimitives.remove(this._groundPrimitives)),He(this)};Dl.prototype.update=function(e){if(T.defined("time",e),!lo.initialized)return this._ready=!1,!1;let t=!0,n,i,o,r;const s=this._dataSourceCollection,a=s.length;for(n=0;n<a;n++){const c=s.get(n);for(l(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};Dl.prototype._postRender=function(){const e=this._scene.frameState,t=this._dataSourceCollection,n=t.length;for(let i=0;i<n;i++){const o=t.get(i),r=o.credit;l(r)&&e.creditDisplay.addCredit(r);const s=o._resourceCredits;if(l(s)){const a=s.length;for(let c=0;c<a;c++)e.creditDisplay.addCredit(s[c])}}};const Pst=[],Ost=new fe;Dl.prototype.getBoundingSphere=function(e,t,n){if(T.defined("entity",e),T.typeOf.bool("allowPartial",t),T.defined("result",n),!this._ready)return gt.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;const m=this._dataSourceCollection;for(o=m.length,i=0;i<o;i++){const g=m.get(i);if(g.entities.contains(e)){r=g;break}}}if(!l(r))return gt.FAILED;const s=Pst,a=Ost;let c=0,u=gt.DONE;const d=r._visualizers,h=d.length;for(i=0;i<h;i++){const m=d[i];if(l(m.getBoundingSphere)){if(u=d[i].getBoundingSphere(e,a),!t&&u===gt.PENDING)return gt.PENDING;u===gt.DONE&&(s[c]=fe.clone(a,s[c]),c++)}}return c===0?gt.FAILED:(s.length=c,fe.fromBoundingSpheres(s,n),gt.DONE)};Dl.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new qo),s=o.add(new Md);t._primitives=r,t._groundPrimitives=s;const a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};Dl.prototype._onDataSourceRemoved=function(e,t){const n=this._primitives,i=this._groundPrimitives,o=t._primitives,r=t._groundPrimitives,s=t.clustering;o.remove(s);const a=t._visualizers,c=a.length;for(let u=0;u<c;u++)a[u].destroy();n.remove(o),i.remove(r),t._visualizers=void 0};Dl.prototype._onDataSourceMoved=function(e,t,n){const 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))};const F8=new J,z8=new J,U8=new J,Lst=new B,fw=new f,H8=new f,sL=new f,aL=new f,V8=new f,k8=new f,ty=new ie,Bst=1.25;function Rst(e,t,n,i,o,r,s){const a=e.scene.mode;let c=o.getValue(r,e._lastCartesian);if(l(c)){let u=!1,d=!1,h,m,g;if(a===le.SCENE3D){ie.addSeconds(r,.001,ty);let E=o.getValue(ty,fw);if(l(E)||(ie.addSeconds(r,-.001,ty),E=o.getValue(ty,fw),d=!0),l(E)){let w=cn.computeFixedToIcrfMatrix(r,F8),S=cn.computeFixedToIcrfMatrix(ty,z8),P;!l(w)||!l(S)?(P=cn.computeTemeToPseudoFixedMatrix(r,U8),w=J.transpose(P,F8),S=cn.computeTemeToPseudoFixedMatrix(ty,z8),J.transpose(S,S)):P=J.transpose(w,U8);const L=J.multiplyByVector(w,c,V8),z=J.multiplyByVector(S,E,k8);f.subtract(L,z,aL);const R=f.magnitude(aL)*1e3,F=M.GRAVITATIONALPARAMETER,U=-F/(R*R-2*F/f.magnitude(L));U<0||U>Bst*s.maximumRadius?(h=H8,f.normalize(c,h),f.negate(h,h),g=f.clone(f.UNIT_Z,sL),m=f.cross(g,h,fw),f.magnitude(m)>M.EPSILON7&&(f.normalize(h,h),f.normalize(m,m),g=f.cross(h,m,sL),f.normalize(g,g),u=!0)):f.equalsEpsilon(c,E,M.EPSILON7)||(g=H8,f.normalize(L,g),f.normalize(z,z),m=f.cross(g,z,sL),d&&(m=f.multiplyByScalar(m,-1,m)),f.equalsEpsilon(m,f.ZERO,M.EPSILON7)||(h=f.cross(m,g,fw),J.multiplyByVector(P,h,h),J.multiplyByVector(P,m,m),J.multiplyByVector(P,g,g),f.normalize(h,h),f.normalize(m,m),f.normalize(g,g),u=!0))}}l(e.boundingSphere)&&(c=e.boundingSphere.center);let p,y,b;i&&(p=f.clone(t.position,aL),y=f.clone(t.direction,V8),b=f.clone(t.up,k8));const C=Lst;u?(C[0]=h.x,C[1]=h.y,C[2]=h.z,C[3]=0,C[4]=m.x,C[5]=m.y,C[6]=m.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):cn.eastNorthUpToFixedFrame(c,s,C),t._setTransform(C),i&&(f.clone(p,t.position),f.clone(y,t.direction),f.clone(b,t.up),f.cross(y,b,t.right))}if(n){const u=a===le.SCENE2D||f.equals(e._offset3D,f.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,u)}}function eT(e,t,n){T.defined("entity",e),T.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=A(n,me.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new f,this._defaultOffset3D=void 0,this._offset3D=new f}Object.defineProperties(eT,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=f.clone(e,new f)}}});eT.defaultOffset3D=new f(-14e3,3500,3500);const hw=new D_,Nst=new f;eT.prototype.update=function(e,t){T.defined("time",e);const n=this.scene,i=this.ellipsoid,o=n.mode;if(o===le.MORPHING)return;const r=this.entity,s=r.position;if(!l(s))return;const a=r!==this._lastEntity,c=o!==this._mode,u=n.camera;let d=a||c,h=!0;if(a){const m=r.viewFrom,g=l(m);if(!g&&l(t)){hw.pitch=-M.PI_OVER_FOUR,hw.range=0;const p=s.getValue(e,Nst);if(l(p)){const y=2-1/Math.max(1,f.magnitude(p)/i.maximumRadius);hw.pitch*=y}u.viewBoundingSphere(t,hw),this.boundingSphere=t,d=!1,h=!1}else(!g||!l(m.getValue(e,this._offset3D)))&&f.clone(eT._defaultOffset3D,this._offset3D)}else!c&&this._mode!==le.SCENE2D&&f.clone(u.position,this._offset3D);this._lastEntity=r,this._mode=o,Rst(this,u,d,h,s,e,i)};function lf(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}const km=new ge;function Mst(e,t,n,i){const o=i.length;for(let r=0;r<o;++r){const s=i[r];if(s.x===t&&s.y===n&&s.level===e)return!0}return!1}lf.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let m=n;m<=o;++m)for(let g=t;g<=i;++g)Mst(e,g,m,s)||s.push(new _y(r,void 0,0,g,m));r.tileXYToRectangle(t,n,e,km);const a=km.west,c=km.north;r.tileXYToRectangle(i,o,e,km);const u=km.east,d=km.south,h=new Vst(e,a,d,u,c);for(let m=0;m<s.length;++m){const g=s[m];DF(g.extent,h)&&kst(this._maximumLevel,g,h)}};lf.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(gy(i.extent,e)){t=i;break}}return l(t)?bb(void 0,t,e):-1};const Fst=[],zst=[],Ust=new ge,Hst=new ge;lf.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=Fst;t.length=0,e.east<e.west?(t.push(ge.fromRadians(-Math.PI,e.south,e.east,e.north,Ust)),t.push(ge.fromRadians(e.west,e.south,Math.PI,e.north,Hst))):t.push(e);const n=zst;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)Cb(n,this._rootNodes[i],t);for(i=n.length-1;i>=0;--i)if(l(n[i])&&n[i].length===0)return i;return 0};const G8=new Ce;lf.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,km);return ge.center(i,G8),this.computeMaximumLevelAtPosition(G8)>=e};lf.prototype.computeChildMaskForTile=function(e,t,n){const 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 _y(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(_y.prototype,{nw:{get:function(){return this._nw||(this._nw=new _y(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new _y(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new _y(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new _y(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function Vst(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function DF(e,t){const 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 kst(e,t,n){for(;t.level<e;)if(pw(t.nw.extent,n))t=t.nw;else if(pw(t.ne.extent,n))t=t.ne;else if(pw(t.sw.extent,n))t=t.sw;else if(pw(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=Bs(t.rectangles,n.level,Gst);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function Gst(e,t){return e.level-t}function pw(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function gy(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function bb(e,t,n){let i=0,o=!1;for(;!o;){const r=t._nw&&gy(t._nw.extent,n),s=t._ne&&gy(t._ne.extent,n),a=t._sw&&gy(t._sw.extent,n),c=t._se&&gy(t._se.extent,n);if(r+s+a+c>1){r&&(i=Math.max(i,bb(t,t._nw,n))),s&&(i=Math.max(i,bb(t,t._ne,n))),a&&(i=Math.max(i,bb(t,t._sw,n))),c&&(i=Math.max(i,bb(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;){const r=t.rectangles;for(let s=r.length-1;s>=0&&r[s].level>i;--s){const a=r[s];gy(a,n)&&(i=a.level)}t=t.parent}return i}function Cb(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||DF(t.extent,n[i]);if(!o)return;const r=t.rectangles;for(i=0;i<r.length;++i){const s=r[i];e[s.level]||(e[s.level]=n),e[s.level]=Wst(e[s.level],s)}Cb(e,t._nw,n),Cb(e,t._ne,n),Cb(e,t._sw,n),Cb(e,t._se,n)}function Wst(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];DF(o,t)?(o.west<t.west&&n.push(new ge(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new ge(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new ge(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new ge(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}function Ite(){}Ite.prototype.geocode=function(e){T.typeOf.string("query",e);const t=e.match(/[^\s,\n]+/g);if(t.length===2||t.length===3){let n=+t[0],i=+t[1];const o=t.length===3?+t[2]:300;if(isNaN(n)&&isNaN(i)){const r=/^(\d+.?\d*)([nsew])/i;for(let s=0;s<t.length;++s){const 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)){const r={displayName:e,destination:f.fromDegrees(n,i,o)};return Promise.resolve([r])}}return Promise.resolve([])};const nI={};nI.clipTriangleAtAxisAlignedThreshold=function(e,t,n,i,o,r){if(!l(e))throw new x("threshold is required.");if(!l(t))throw new x("keepAbove is required.");if(!l(n))throw new x("u0 is required.");if(!l(i))throw new x("u1 is required.");if(!l(o))throw new x("u2 is required.");l(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);const u=s+a+c;let d,h,m,g,p,y;return u===1?s?(d=(e-n)/(i-n),h=(e-n)/(o-n),r.push(1),r.push(2),h!==1&&(r.push(-1),r.push(0),r.push(2),r.push(h)),d!==1&&(r.push(-1),r.push(0),r.push(1),r.push(d))):a?(m=(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)),m!==1&&(r.push(-1),r.push(1),r.push(2),r.push(m))):c&&(p=(e-o)/(n-o),y=(e-o)/(i-o),r.push(0),r.push(1),y!==1&&(r.push(-1),r.push(2),r.push(1),r.push(y)),p!==1&&(r.push(-1),r.push(2),r.push(0),r.push(p))):u===2?!s&&n!==e?(g=(e-i)/(n-i),p=(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(p)):!a&&i!==e?(y=(e-o)/(i-o),d=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(y),r.push(-1),r.push(0),r.push(1),r.push(d)):!c&&o!==e&&(h=(e-n)/(o-n),m=(e-i)/(o-i),r.push(2),r.push(-1),r.push(0),r.push(2),r.push(h),r.push(-1),r.push(1),r.push(2),r.push(m)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};nI.computeBarycentricCoordinates=function(e,t,n,i,o,r,s,a,c){if(!l(e))throw new x("x is required.");if(!l(t))throw new x("y is required.");if(!l(n))throw new x("x1 is required.");if(!l(i))throw new x("y1 is required.");if(!l(o))throw new x("x2 is required.");if(!l(r))throw new x("y2 is required.");if(!l(s))throw new x("x3 is required.");if(!l(a))throw new x("y3 is required.");const u=n-s,d=s-o,h=r-a,m=i-a,g=1/(h*u+d*m),p=t-a,y=e-s,b=(h*y+d*p)*g,C=(-m*y+u*p)*g,E=1-b-C;return l(c)?(c.x=b,c.y=C,c.z=E,c):new f(b,C,E)};nI.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,c){T.typeOf.number("x00",e),T.typeOf.number("y00",t),T.typeOf.number("x01",n),T.typeOf.number("y01",i),T.typeOf.number("x10",o),T.typeOf.number("y10",r),T.typeOf.number("x11",s),T.typeOf.number("y11",a);const u=(s-o)*(t-r)-(a-r)*(e-o),d=(n-e)*(t-r)-(i-t)*(e-o),h=(a-r)*(n-e)-(s-o)*(i-t);if(h===0)return;const m=u/h,g=d/h;if(m>=0&&m<=1&&g>=0&&g<=1)return l(c)||(c=new j),c.x=e+m*(n-e),c.y=t+m*(i-t),c};const Pte=nI;function Gp(e){if(!l(e)||!l(e.quantizedVertices))throw new x("options.quantizedVertices is required.");if(!l(e.indices))throw new x("options.indices is required.");if(!l(e.minimumHeight))throw new x("options.minimumHeight is required.");if(!l(e.maximumHeight))throw new x("options.maximumHeight is required.");if(!l(e.maximumHeight))throw new x("options.maximumHeight is required.");if(!l(e.boundingSphere))throw new x("options.boundingSphere is required.");if(!l(e.horizonOcclusionPoint))throw new x("options.horizonOcclusionPoint is required.");if(!l(e.westIndices))throw new x("options.westIndices is required.");if(!l(e.southIndices))throw new x("options.southIndices is required.");if(!l(e.eastIndices))throw new x("options.eastIndices is required.");if(!l(e.northIndices))throw new x("options.northIndices is required.");if(!l(e.westSkirtHeight))throw new x("options.westSkirtHeight is required.");if(!l(e.southSkirtHeight))throw new x("options.southSkirtHeight is required.");if(!l(e.eastSkirtHeight))throw new x("options.eastSkirtHeight is required.");if(!l(e.northSkirtHeight))throw new x("options.northSkirtHeight is required.");this._quantizedVertices=e.quantizedVertices,this._encodedNormals=e.encodedNormals,this._indices=e.indices,this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._boundingSphere=e.boundingSphere,this._orientedBoundingBox=e.orientedBoundingBox,this._horizonOcclusionPoint=e.horizonOcclusionPoint,this._credits=e.credits;const 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=_w(e.westIndices,o,t),this._southIndices=_w(e.southIndices,r,t),this._eastIndices=_w(e.eastIndices,o,t),this._northIndices=_w(e.northIndices,r,t),this._westSkirtHeight=e.westSkirtHeight,this._southSkirtHeight=e.southSkirtHeight,this._eastSkirtHeight=e.eastSkirtHeight,this._northSkirtHeight=e.northSkirtHeight,this._childTileMask=A(e.childTileMask,15),this._createdByUpsampling=A(e.createdByUpsampling,!1),this._waterMask=e.waterMask,this._mesh=void 0}Object.defineProperties(Gp.prototype,{credits:{get:function(){return this._credits}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}},canUpsample:{get:function(){return l(this._mesh)}}});const mw=[];function _w(e,t,n){mw.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)mw[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(mw.sort(t),at.createTypedArray(n,mw)):e}const Ote="createVerticesFromQuantizedTerrainMesh",jst=new Vi(Ote),qst=new Vi(Ote,bd.maximumAsynchronousTasks);Gp.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.tilingScheme",e.tilingScheme),T.typeOf.number("options.x",e.x),T.typeOf.number("options.y",e.y),T.typeOf.number("options.level",e.level);const t=e.tilingScheme,n=e.x,i=e.y,o=e.level,r=A(e.exaggeration,1),s=A(e.exaggerationRelativeHeight,0),a=A(e.throttle,!0),c=t.ellipsoid,u=t.tileXYToRectangle(n,i,o),h=(a?qst:jst).scheduleTask({minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,quantizedVertices:this._quantizedVertices,octEncodedNormals:this._encodedNormals,includeWebMercatorT:!0,indices:this._indices,westIndices:this._westIndices,southIndices:this._southIndices,eastIndices:this._eastIndices,northIndices:this._northIndices,westSkirtHeight:this._westSkirtHeight,southSkirtHeight:this._southSkirtHeight,eastSkirtHeight:this._eastSkirtHeight,northSkirtHeight:this._northSkirtHeight,rectangle:u,relativeToCenter:this._boundingSphere.center,ellipsoid:c,exaggeration:r,exaggerationRelativeHeight:s});if(!l(h))return;const m=this;return Promise.resolve(h).then(function(g){const p=m._quantizedVertices.length/3,y=p+m._westIndices.length+m._southIndices.length+m._eastIndices.length+m._northIndices.length,b=at.createTypedArray(y,g.indices),C=new Float32Array(g.vertices),E=g.center,w=g.minimumHeight,S=g.maximumHeight,P=m._boundingSphere,L=m._orientedBoundingBox,z=A(f.clone(g.occludeePointInScaledSpace),m._horizonOcclusionPoint),R=g.vertexStride,F=Cr.clone(g.encoding);return m._mesh=new fD(E,C,b,g.indexCountWithoutSkirts,p,w,S,P,z,R,L,F,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),m._quantizedVertices=void 0,m._encodedNormals=void 0,m._indices=void 0,m._uValues=void 0,m._vValues=void 0,m._heightValues=void 0,m._westIndices=void 0,m._southIndices=void 0,m._eastIndices=void 0,m._northIndices=void 0,m._mesh})};const $st=new Vi("upsampleQuantizedTerrainMesh",bd.maximumAsynchronousTasks);Gp.prototype.upsample=function(e,t,n,i,o,r,s){if(!l(e))throw new x("tilingScheme is required.");if(!l(t))throw new x("thisX is required.");if(!l(n))throw new x("thisY is required.");if(!l(i))throw new x("thisLevel is required.");if(!l(o))throw new x("descendantX is required.");if(!l(r))throw new x("descendantY is required.");if(!l(s))throw new x("descendantLevel is required.");if(s-i>1)throw new x("Upsampling through more than one level at a time is not currently supported.");const c=this._mesh;if(!l(this._mesh))return;const u=t*2!==o,d=n*2===r,h=e.ellipsoid,m=e.tileXYToRectangle(o,r,s),g=$st.scheduleTask({vertices:c.vertices,vertexCountWithoutSkirts:c.vertexCountWithoutSkirts,indices:c.indices,indexCountWithoutSkirts:c.indexCountWithoutSkirts,encoding:c.encoding,minimumHeight:this._minimumHeight,maximumHeight:this._maximumHeight,isEastChild:u,isNorthChild:d,childRectangle:m,ellipsoid:h});if(!l(g))return;let p=Math.min(this._westSkirtHeight,this._eastSkirtHeight);p=Math.min(p,this._southSkirtHeight),p=Math.min(p,this._northSkirtHeight);const y=u?p*.5:this._westSkirtHeight,b=d?p*.5:this._southSkirtHeight,C=u?this._eastSkirtHeight:p*.5,E=d?this._northSkirtHeight:p*.5,w=this._credits;return Promise.resolve(g).then(function(S){const P=new Uint16Array(S.vertices),L=at.createTypedArray(P.length/3,S.indices);let z;return l(S.encodedNormals)&&(z=new Uint8Array(S.encodedNormals)),new Gp({quantizedVertices:P,indices:L,encodedNormals:z,minimumHeight:S.minimumHeight,maximumHeight:S.maximumHeight,boundingSphere:fe.clone(S.boundingSphere),orientedBoundingBox:zt.clone(S.orientedBoundingBox),horizonOcclusionPoint:f.clone(S.horizonOcclusionPoint),westIndices:S.westIndices,southIndices:S.southIndices,eastIndices:S.eastIndices,northIndices:S.northIndices,westSkirtHeight:y,southSkirtHeight:b,eastSkirtHeight:C,northSkirtHeight:E,childTileMask:0,credits:w,createdByUpsampling:!0})})};const YR=32767,Lte=new f;Gp.prototype.interpolateHeight=function(e,t,n){let i=M.clamp((t-e.west)/e.width,0,1);i*=YR;let o=M.clamp((n-e.south)/e.height,0,1);return o*=YR,l(this._mesh)?Jst(this,i,o):Qst(this,i,o)};function Bte(e,t,n,i,o,r,s,a){const c=Math.min(n,o,s),u=Math.max(n,o,s),d=Math.min(i,r,a),h=Math.max(i,r,a);return e>=c&&e<=u&&t>=d&&t<=h}const Yst=new j,Xst=new j,Kst=new j;function Jst(e,t,n){const i=e._mesh,o=i.vertices,r=i.encoding,s=i.indices;for(let a=0,c=s.length;a<c;a+=3){const u=s[a],d=s[a+1],h=s[a+2],m=r.decodeTextureCoordinates(o,u,Yst),g=r.decodeTextureCoordinates(o,d,Xst),p=r.decodeTextureCoordinates(o,h,Kst);if(Bte(t,n,m.x,m.y,g.x,g.y,p.x,p.y)){const y=Pte.computeBarycentricCoordinates(t,n,m.x,m.y,g.x,g.y,p.x,p.y,Lte);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){const b=r.decodeHeight(o,u),C=r.decodeHeight(o,d),E=r.decodeHeight(o,h);return y.x*b+y.y*C+y.z*E}}}}function Qst(e,t,n){const i=e._uValues,o=e._vValues,r=e._heightValues,s=e._indices;for(let a=0,c=s.length;a<c;a+=3){const u=s[a],d=s[a+1],h=s[a+2],m=i[u],g=i[d],p=i[h],y=o[u],b=o[d],C=o[h];if(Bte(t,n,m,y,g,b,p,C)){const E=Pte.computeBarycentricCoordinates(t,n,m,y,g,b,p,C,Lte);if(E.x>=-1e-15&&E.y>=-1e-15&&E.z>=-1e-15){const w=E.x*r[u]+E.y*r[d]+E.z*r[h];return M.lerp(e._minimumHeight,e._maximumHeight,w/YR)}}}}Gp.prototype.isChildAvailable=function(e,t,n,i){if(!l(e))throw new x("thisX is required.");if(!l(t))throw new x("thisY is required.");if(!l(n))throw new x("childX is required.");if(!l(i))throw new x("childY is required.");let o=2;return n!==e*2&&++o,i!==t*2&&(o-=2),(this._childTileMask&1<<o)!==0};Gp.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function Zst(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 gg(e){if(!l(e)||!l(e.url))throw new x("options.url is required.");this._heightmapWidth=65,this._heightmapStructure=void 0,this._hasWaterMask=!1,this._hasVertexNormals=!1,this._ellipsoid=e.ellipsoid,this._requestVertexNormals=A(e.requestVertexNormals,!1),this._requestWaterMask=A(e.requestWaterMask,!1),this._requestMetadata=A(e.requestMetadata,!0),this._errorEvent=new Ke;let t=e.credit;typeof t=="string"&&(t=new ai(t)),this._credit=t,this._availability=void 0,this._ready=!1,this._tileCredits=void 0;const n=this;let i,o,r;const s=this._layers=[];let a="";const c=[];let u=0;this._readyPromise=Promise.resolve(e.url).then(function(y){const b=Me.createIfNeeded(y);return b.appendForwardSlash(),i=b,o=i.getDerivedResource({url:"layer.json"}),n._tileCredits=b.credits,p()});function d(y){let b;if(!y.format)return b="The tile format is not specified in the layer.json file.",r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b));if(!y.tiles||y.tiles.length===0)return b="The layer.json file does not specify any tile URL templates.",r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b));let C=!1,E=!1,w=!1,S=!0,P=!1;if(y.format==="heightmap-1.0")P=!0,l(n._heightmapStructure)||(n._heightmapStructure={heightScale:1/5,heightOffset:-1e3,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1,lowestEncodedHeight:0,highestEncodedHeight:256*256-1}),E=!0,n._requestWaterMask=!0;else if(y.format.indexOf("quantized-mesh-1.")!==0)return b=`The tile format "${y.format}" is invalid or not supported.`,r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b));const L=y.tiles,z=y.maxzoom;if(u=Math.max(u,z),!y.projection||y.projection==="EPSG:4326")n._tilingScheme=new aa({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else if(y.projection==="EPSG:3857")n._tilingScheme=new ga({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else return b=`The projection "${y.projection}" is invalid or not supported.`,r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b));if(n._levelZeroMaximumGeometricError=tr.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._heightmapWidth,n._tilingScheme.getNumberOfXTilesAtLevel(0)),!y.scheme||y.scheme==="tms"||y.scheme==="slippyMap")n._scheme=y.scheme;else return b=`The scheme "${y.scheme}" is invalid or not supported.`,r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b));let R;l(y.extensions)&&y.extensions.indexOf("octvertexnormals")!==-1?C=!0:l(y.extensions)&&y.extensions.indexOf("vertexnormals")!==-1&&(C=!0,S=!1),l(y.extensions)&&y.extensions.indexOf("watermask")!==-1&&(E=!0),l(y.extensions)&&y.extensions.indexOf("metadata")!==-1&&(w=!0);const F=y.metadataAvailability,U=y.available;let D;if(l(U)&&!l(F)){D=new lf(n._tilingScheme,U.length);for(let _=0;_<U.length;++_){const v=U[_],O=n._tilingScheme.getNumberOfYTilesAtLevel(_);l(c[_])||(c[_]=[]);for(let N=0;N<v.length;++N){const V=v[N],k=O-V.endY-1,G=O-V.startY-1;c[_].push([V.startX,k,V.endX,G]),D.addAvailableTileRange(_,V.startX,k,V.endX,G)}}}else l(F)&&(R=new lf(n._tilingScheme,z),D=new lf(n._tilingScheme,z),c[0]=[[0,0,1,0]],D.addAvailableTileRange(0,0,0,1,0));n._hasWaterMask=n._hasWaterMask||E,n._hasVertexNormals=n._hasVertexNormals||C,n._hasMetadata=n._hasMetadata||w,l(y.attribution)&&(a.length>0&&(a+=" "),a+=y.attribution),s.push(new Zst({resource:i,version:y.version,isHeightmap:P,tileUrlTemplates:L,availability:D,hasVertexNormals:C,hasWaterMask:E,hasMetadata:w,availabilityLevels:F,availabilityTilesLoaded:R,littleEndianExtensionSize:S}));const I=y.parentUrl;if(l(I)){if(!l(D))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:I}),i.appendForwardSlash(),o=i.getDerivedResource({url:"layer.json"});const _=o.fetchJson();return Promise.resolve(_).then(d).catch(h)}return Promise.resolve(!0)}function h(y){const b=`An error occurred while accessing ${o.url}.`;return r=ao.reportError(r,n,n._errorEvent,b),r.retry?p():Promise.reject(new Ie(b))}function m(y){return d(y).then(function(){if(l(r))return;const b=c.length;if(b>0){const C=n._availability=new lf(n._tilingScheme,u);for(let E=0;E<b;++E){const w=c[E];for(let S=0;S<w.length;++S){const P=w[S];C.addAvailableTileRange(E,P[0],P[1],P[2],P[3])}}}if(a.length>0){const C=new ai(a);l(n._tileCredits)?n._tileCredits.push(C):n._tileCredits=[C]}return n._ready=!0,Promise.resolve(!0)})}function g(y){return l(y)&&y.statusCode===404?m({tilejson:"2.1.0",format:"heightmap-1.0",version:"1.0.0",scheme:"tms",tiles:["{z}/{x}/{y}.terrain?v={version}"]}):h()}function p(){return Promise.resolve(o.fetchJson()).then(m).catch(g)}}const cL={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function W8(e){return!l(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 eat(e,t,n,i,o){const r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new fu({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 tat(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const c=3,u=c+1,d=Float64Array.BYTES_PER_ELEMENT*c,h=Float64Array.BYTES_PER_ELEMENT*u,m=3,g=Uint16Array.BYTES_PER_ELEMENT*m,p=3;let y=Uint16Array.BYTES_PER_ELEMENT,b=y*p;const C=new DataView(t),E=new f(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0));a+=d;const w=C.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const S=C.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const P=new fe(new f(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0)),C.getFloat64(a+d,!0));a+=h;const L=new f(C.getFloat64(a,!0),C.getFloat64(a+8,!0),C.getFloat64(a+16,!0));a+=d;const z=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const R=new Uint16Array(t,a,z*3);a+=z*g,z>64*1024&&(y=Uint32Array.BYTES_PER_ELEMENT,b=y*p);const F=R.subarray(0,z),U=R.subarray(z,2*z),D=R.subarray(z*2,3*z);mi.zigZagDeltaDecode(F,U,D),a%y!==0&&(a+=y-a%y);const I=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const _=at.createTypedArrayFromArrayBuffer(z,t,a,I*p);a+=I*b;let v=0;const O=_.length;for(let re=0;re<O;++re){const he=_[re];_[re]=v-he,he===0&&++v}const N=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const V=at.createTypedArrayFromArrayBuffer(z,t,a,N);a+=N*y;const k=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const G=at.createTypedArrayFromArrayBuffer(z,t,a,k);a+=k*y;const W=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const K=at.createTypedArrayFromArrayBuffer(z,t,a,W);a+=W*y;const q=C.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const te=at.createTypedArrayFromArrayBuffer(z,t,a,q);a+=q*y;let Y,X;for(;a<C.byteLength;){const re=C.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const he=C.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,re===cL.OCT_VERTEX_NORMALS&&e._requestVertexNormals)Y=new Uint8Array(t,a,z*2);else if(re===cL.WATER_MASK&&e._requestWaterMask)X=new Uint8Array(t,a,he);else if(re===cL.METADATA&&e._requestMetadata){const ce=C.getUint32(a,!0);if(ce>0){const ne=Ya(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,ce).available;if(l(ne))for(let de=0;de<ne.length;++de){const _e=n+de+1,Se=ne[de],ve=e._tilingScheme.getNumberOfYTilesAtLevel(_e);for(let Le=0;Le<Se.length;++Le){const Ee=Se[Le],Be=ve-Ee.endY-1,Pe=ve-Ee.startY-1;e.availability.addAvailableTileRange(_e,Ee.startX,Be,Ee.endX,Pe),r.availability.addAvailableTileRange(_e,Ee.startX,Be,Ee.endX,Pe)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=he}const $=e.getLevelMaximumGeometricError(n)*5,se=e._tilingScheme.tileXYToRectangle(i,o,n),ue=zt.fromRectangle(se,w,S,e._tilingScheme.ellipsoid);return new Gp({center:E,minimumHeight:w,maximumHeight:S,boundingSphere:P,orientedBoundingBox:ue,horizonOcclusionPoint:L,quantizedVertices:R,encodedNormals:Y,indices:_,westIndices:V,southIndices:G,eastIndices:K,northIndices:te,westSkirtHeight:$,southSkirtHeight:$,eastSkirtHeight:$,northSkirtHeight:$,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:X,credits:e._tileCredits})}gg.prototype.requestTileGeometry=function(e,t,n,i){if(!this._ready)throw new x("requestTileGeometry must not be called before the terrain provider is ready.");const o=this._layers;let r;const s=o.length;if(s===1)r=o[0];else for(let a=0;a<s;++a){const c=o[a];if(!l(c.availability)||c.availability.isTileAvailable(n,e,t)){r=c;break}}return Rte(this,e,t,n,r,i)};function Rte(e,t,n,i,o,r){if(!l(o))return Promise.reject(new Ie("Terrain tile doesn't exist"));const s=o.tileUrlTemplates;if(s.length===0)return;let a;!e._scheme||e._scheme==="tms"?a=e._tilingScheme.getNumberOfYTilesAtLevel(i)-n-1:a=n;const 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 u,d;const h=s[(t+a+i)%s.length],m=o.resource;l(m._ionEndpoint)&&!l(m._ionEndpoint.externalType)?(c.length!==0&&(d={extensions:c.join("-")}),u=W8(void 0)):u=W8(c);const g=m.getDerivedResource({url:h,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:d,headers:u,request:r}).fetchArrayBuffer();if(l(g))return g.then(function(p){return l(p)?l(e._heightmapStructure)?eat(e,p):tat(e,p,i,t,n,o):Promise.reject(new Ie("Mesh buffer doesn't exist."))})}Object.defineProperties(gg.prototype,{errorEvent:{get:function(){return this._errorEvent}},credit:{get:function(){if(!this._ready)throw new x("credit must not be called before the terrain provider is ready.");return this._credit}},tilingScheme:{get:function(){if(!this._ready)throw new x("tilingScheme must not be called before the terrain provider is ready.");return this._tilingScheme}},ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},hasWaterMask:{get:function(){if(!this._ready)throw new x("hasWaterMask must not be called before the terrain provider is ready.");return this._hasWaterMask&&this._requestWaterMask}},hasVertexNormals:{get:function(){if(!this._ready)throw new x("hasVertexNormals must not be called before the terrain provider is ready.");return this._hasVertexNormals&&this._requestVertexNormals}},hasMetadata:{get:function(){if(!this._ready)throw new x("hasMetadata must not be called before the terrain provider is ready.");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(){if(!this._ready)throw new x("availability must not be called before the terrain provider is ready.");return this._availability}}});gg.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};gg.prototype.getTileDataAvailable=function(e,t,n){if(!l(this._availability))return;if(n>this._availability._maximumLevel)return!1;if(this._availability.isTileAvailable(n,e,t))return!0;if(!this._hasMetadata)return!1;const i=this._layers,o=i.length;for(let r=0;r<o;++r)if(Nte(this,e,t,n,i[r],r===0).result)return;return!1};gg.prototype.loadTileDataAvailability=function(e,t,n){if(!l(this._availability)||n>this._availability._maximumLevel||this._availability.isTileAvailable(n,e,t)||!this._hasMetadata)return;const i=this._layers,o=i.length;for(let r=0;r<o;++r){const s=Nte(this,e,t,n,i[r],r===0);if(l(s.promise))return s.promise}};function XR(e,t,n,i){if(i===0)return;const 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 Nte(e,t,n,i,o,r){if(!l(o.availabilityLevels))return{result:!1};let s;const a=function(){delete o.availabilityPromiseCache[s]},c=o.availabilityTilesLoaded,u=o.availability;let d=XR(o,t,n,i);for(;l(d);){if(u.isTileAvailable(d.level,d.x,d.y)&&!c.isTileAvailable(d.level,d.x,d.y)){let h;if(!r&&(s=`${d.level}-${d.x}-${d.y}`,h=o.availabilityPromiseCache[s],!l(h))){const m=new dd({throttle:!1,throttleByServer:!0,type:Y_.TERRAIN});h=Rte(e,d.x,d.y,d.level,o,m),l(h)&&(o.availabilityPromiseCache[s]=h,h.then(a))}return{result:!0,promise:h}}d=XR(o,d.x,d.y,d.level)}return{result:!1}}gg._getAvailabilityTile=XR;function yu(e){T.typeOf.object("options",e),T.defined("options.comparator",e.comparator),l(e.maximumLength)&&T.typeOf.number.greaterThanOrEquals("options.maximumLength",e.maximumLength,0),this._comparator=e.comparator,this._maximumLength=e.maximumLength,this._array=l(e.maximumLength)?new Array(e.maximumLength):[],this._length=0}Object.defineProperties(yu.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(l(e)){for(T.typeOf.number.greaterThanOrEquals("maximumLength",e,0);this._length>e;)this.removeMinimum();this._array.length=e}this._maximumLength=e}},internalArray:{get:function(){return this._array}},comparator:{get:function(){return this._comparator}}});yu.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new yu({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};yu.prototype.reset=function(){this._length=0;const e=this._maximumLength;if(l(e))for(let t=0;t<e;t++)this._array[t]=void 0;else this._array.length=0};yu.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)Mte(this,t)};yu.prototype.insert=function(e){let t;const n=this._maximumLength;if(l(n)){if(n===0)return;if(this._length===n){const o=this._array[0];if(this._comparator(e,o)<=0)return e;t=this.removeMinimum()}}const i=this._length;return this._array[i]=e,this._length++,Mte(this,i),t};yu.prototype.removeMinimum=function(){const e=this._length;if(e===0)return;this._length--;const t=this._array[0];return e>=2&&(this._array[0]=this._array[e-1],Fte(this,0)),this._array[e-1]=void 0,t};yu.prototype.removeMaximum=function(){const e=this._length;if(e===0)return;this._length--;let t;if(e<=2)t=this._array[e-1];else{const n=IF(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&Fte(this,n)}return this._array[e-1]=void 0,t};yu.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};yu.prototype.getMaximum=function(){const e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[IF(this,1,2)?1:2]};function Iv(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function Zb(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function IF(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function Mte(e,t){if(t===0)return;const n=Math.floor(M.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=Zb(e,t,i);for(o!==n&&(Iv(e,t,i),t=i);t>=3;){const r=Math.floor((t-3)/4);if(Zb(e,t,r)!==o)break;Iv(e,t,r),t=r}}function Fte(e,t){const n=e._length,i=Math.floor(M.log2(t+1))%2===0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){Zb(e,s,r)===i&&(r=s);const a=2*o+1,c=Math.max(Math.min(n-a,4),0);for(let u=0;u<c;u++){const d=a+u;Zb(e,d,r)===i&&(r=d)}}if(Zb(e,r,t)===i&&(Iv(e,r,t),r!==o&&r!==s)){const a=Math.floor((r-1)/2);IF(e,r,a)===i&&Iv(e,r,a)}t=r}}const nat={SEARCH:0,AUTOCOMPLETE:1},PF=Object.freeze(nat);function OF(e){T.defined("url",e),this._url=Me.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(OF.prototype,{url:{get:function(){return this._url}}});OF.prototype.geocode=function(e,t){return T.typeOf.string("query",e),this._url.getDerivedResource({url:t===PF.AUTOCOMPLETE?"autocomplete":"search",queryParameters:{text:e}}).fetchJson().then(function(i){return i.features.map(function(o){let r;const s=o.bbox;if(l(s))r=ge.fromDegrees(s[0],s[1],s[2],s[3]);else{const a=o.geometry.coordinates[0],c=o.geometry.coordinates[1];r=f.fromDegrees(a,c)}return{displayName:o.properties.label,destination:r}})})};function zte(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.scene",e.scene);const t=A(e.accessToken,h_.defaultAccessToken),n=Me.createIfNeeded(A(e.server,h_.defaultServer));n.appendForwardSlash();const i=h_.getDefaultTokenCredit(t);l(i)&&e.scene.frameState.creditDisplay.addDefaultCredit(ai.clone(i));const o=n.getDerivedResource({url:"v1/geocode"});l(t)&&o.appendQueryParameters({access_token:t}),this._accessToken=t,this._server=n,this._pelias=new OF(o)}zte.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)};function iat(e){return e=A(e,A.EMPTY_OBJECT),new gg({url:hs.fromAssetId(1),requestVertexNormals:A(e.requestVertexNormals,!1),requestWaterMask:A(e.requestWaterMask,!1)})}function oat(e,t,n){const 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}function na(){this.orientedBoundingBox=new zt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._minBounds=f.clone(na.DefaultMinBounds,new f),this._maxBounds=f.clone(na.DefaultMaxBounds,new f),this.shaderUniforms={boxUvToRenderBoundsTransform:new B,boxUvToRenderBoundsScale:new f,boxUvToRenderBoundsTranslate:new f,boxUvToShapeUvScale:new f,boxUvToShapeUvTranslate:new f},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}const rat=new f,KR=new f,sat=new J,aat=new B,cat=new f,lat=new f,uat=new J,dat=new f,fat=new f,hat=new f,pat=new f,mat=B.fromRotationTranslation(J.fromUniformScale(2,new J),new f(-1,-1,-1),new B),_at=B.fromRotation(J.fromColumnMajorArray([0,0,1,0,1,0,1,0,0],new J),new B),gat=B.fromRotation(J.fromColumnMajorArray([1,0,0,0,0,1,0,1,0],new J),new B);na.prototype.update=function(e,t,n,i,o){i=A(i,na.DefaultMinBounds),o=A(o,na.DefaultMaxBounds),T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n);const r=na.DefaultMinBounds,s=na.DefaultMaxBounds;t=this._minBounds=f.clamp(t,r,s,this._minBounds),n=this._maxBounds=f.clamp(n,r,s,this._maxBounds),i=f.clamp(i,r,s,dat),o=f.clamp(o,r,s,fat);const a=f.clamp(t,i,o,hat),c=f.clamp(n,i,o,pat),u=B.getScale(e,KR);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||u.x===0||u.y===0||u.z===0)return!1;this.shapeTransform=B.clone(e,this.shapeTransform),this.orientedBoundingBox=Ute(a,c,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=fe.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const d=this.shaderUniforms,h=this.shaderDefines;for(const y in h)h.hasOwnProperty(y)&&(h[y]=void 0);const m=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;let p=0;if(h.BOX_INTERSECTION_INDEX=p,p+=1,m){h.BOX_HAS_RENDER_BOUNDS=!0;const y=a,b=c,C=f.fromElements(2/(y.x===b.x?1:b.x-y.x),2/(y.y===b.y?1:b.y-y.y),2/(y.z===b.z?1:b.z-y.z),lat),E=f.fromElements(-C.x*.5*(y.x+b.x),-C.y*.5*(y.y+b.y),-C.z*.5*(y.z+b.z),cat);let w=B.fromRotationTranslation(J.fromScale(C,uat),E,aat);if(y.x===b.x||y.y===b.y||y.z===b.z){h.BOX_IS_2D=!0;let S;y.x===b.x?S=_at:y.y===b.y?S=gat:y.z===b.z&&(S=B.IDENTITY),w=B.multiplyTransformation(S,w,w)}d.boxUvToRenderBoundsTransform=B.multiplyTransformation(w,mat,d.boxUvToRenderBoundsTransform),d.boxUvToRenderBoundsScale=B.getScale(d.boxUvToRenderBoundsTransform,d.boxUvToRenderBoundsScale),d.boxUvToRenderBoundsTranslate=B.getTranslation(d.boxUvToRenderBoundsTransform,d.boxUvToRenderBoundsTranslate)}if(g){h.BOX_HAS_SHAPE_BOUNDS=!0;const y=t,b=n;d.boxUvToShapeUvScale=f.fromElements(2/(y.x===b.x?1:b.x-y.x),2/(y.y===b.y?1:b.y-y.y),2/(y.z===b.z?1:b.z-y.z),d.boxUvToShapeUvScale),d.boxUvToShapeUvTranslate=f.fromElements(-d.boxUvToShapeUvScale.x*(y.x*.5+.5),-d.boxUvToShapeUvScale.y*(y.y*.5+.5),-d.boxUvToShapeUvScale.z*(y.z*.5+.5),d.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=p,!0};const yat=new f,Aat=new f;na.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),c=f.fromElements(M.lerp(r.x,s.x,a*t),M.lerp(r.y,s.y,a*n),M.lerp(r.z,s.z,a*i),yat),u=f.fromElements(M.lerp(r.x,s.x,a*(t+1)),M.lerp(r.y,s.y,a*(n+1)),M.lerp(r.z,s.z,a*(i+1)),Aat);return Ute(c,u,this.shapeTransform,o)};na.prototype.computeApproximateStepSize=function(e){return T.typeOf.object("dimensions",e),1/f.maximumComponent(e)};na.DefaultMinBounds=Object.freeze(new f(-1,-1,-1));na.DefaultMaxBounds=Object.freeze(new f(1,1,1));function Ute(e,t,n,i){const o=na.DefaultMinBounds,r=na.DefaultMaxBounds;if(f.equals(e,o)&&f.equals(t,r))i.center=B.getTranslation(n,i.center),i.halfAxes=B.getMatrix3(n,i.halfAxes);else{let a=B.getScale(n,KR);const c=f.midpoint(e,t,rat);i.center=B.multiplyByPoint(n,c,i.center),a=f.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),KR);const u=B.getRotation(n,sat);i.halfAxes=J.setScale(u,a,i.halfAxes)}return i}function Fo(){this.orientedBoundingBox=new zt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._minimumRadius=Fo.DefaultMinBounds.x,this._maximumRadius=Fo.DefaultMaxBounds.x,this._minimumHeight=Fo.DefaultMinBounds.y,this._maximumHeight=Fo.DefaultMaxBounds.y,this._minimumAngle=Fo.DefaultMinBounds.z,this._maximumAngle=Fo.DefaultMaxBounds.z,this.shaderUniforms={cylinderUvToRenderBoundsScale:new f,cylinderUvToRenderBoundsTranslate:new f,cylinderUvToRenderRadiusMin:0,cylinderRenderAngleMinMax:new j,cylinderUvToShapeUvRadius:new j,cylinderUvToShapeUvHeight:new j,cylinderUvToShapeUvAngle:new j,cylinderShapeUvAngleMinMax:new j,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}const Hte=new f,bat=new f,Cat=new f,Tat=new J,Eat=new B,xat=new B,wat=B.fromRotationTranslation(J.fromUniformScale(2,new J),new f(-1,-1,-1),new B);Fo.prototype.update=function(e,t,n,i,o){i=A(i,Fo.DefaultMinBounds),o=A(o,Fo.DefaultMaxBounds),T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n);const r=Fo.DefaultMinBounds.x,s=Fo.DefaultMaxBounds.x,a=Fo.DefaultMinBounds.y,c=Fo.DefaultMaxBounds.y,u=Fo.DefaultMinBounds.z,d=Fo.DefaultMaxBounds.z,h=d-u,m=.5*h,g=M.EPSILON10,p=M.EPSILON3,y=M.EPSILON10,b=M.clamp(t.x,r,s),C=M.clamp(n.x,r,s),E=M.clamp(i.x,r,s),w=M.clamp(o.x,r,s),S=Math.max(b,E),P=Math.min(C,w),L=M.clamp(t.y,a,c),z=M.clamp(n.y,a,c),R=M.clamp(i.y,a,c),F=M.clamp(o.y,a,c),U=Math.max(L,R),D=Math.min(z,F),I=M.negativePiToPi(t.z),_=M.negativePiToPi(n.z),v=M.negativePiToPi(i.z),O=M.negativePiToPi(o.z),N=Math.max(I,v),V=Math.min(_,O),k=B.getScale(e,Hte);if(P===0||S>P||U>D||M.equalsEpsilon(k.x,0,void 0,g)||M.equalsEpsilon(k.y,0,void 0,g)||M.equalsEpsilon(k.z,0,void 0,g))return!1;this._minimumRadius=b,this._maximumRadius=C,this._minimumHeight=L,this._maximumHeight=z,this._minimumAngle=I,this._maximumAngle=_,this.shapeTransform=B.clone(e,this.shapeTransform),this.orientedBoundingBox=LF(S,P,U,D,N,V,this.shapeTransform,this.orientedBoundingBox),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=fe.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const K=b===r&&C===s,q=L===a&&z===c,te=_<I,Y=_-I+te*h,X=Y>m+y&&Y<h-y,$=Y>y&&Y<m-y,se=Y>=m-y&&Y<=m+y,ue=Y<=y,re=X||$||se||ue,he=M.equalsEpsilon(I,u,void 0,p),ce=M.equalsEpsilon(_,d,void 0,p),Q=P===s,ne=S===r,de=U===a&&D===c,_e=V<N,Se=V-N+_e*h,ve=Se>m+y&&Se<h-y,Le=Se>y&&Se<m-y,Ee=Se>=m-y&&Se<=m+y,Be=Se<=y,Pe=ve||Le||Ee||Be,Ae=this.shaderUniforms,xe=this.shaderDefines;for(const Ve in xe)xe.hasOwnProperty(Ve)&&(xe[Ve]=void 0);let Oe=0;if(xe.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=Oe,Oe+=1,ne||(xe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,xe.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=Oe,Oe+=1,Ae.cylinderUvToRenderRadiusMin=P/S),Q||(xe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX=!0),S===P&&(xe.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),de||(xe.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT=!0),U===D&&(xe.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),L===z&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0),b===C&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT=!0),!K){xe.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const Ve=1/(C-b),Re=b/(b-C);Ae.cylinderUvToShapeUvRadius=j.fromElements(Ve,Re,Ae.cylinderUvToShapeUvRadius)}if(!q){xe.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const Ve=2/(z-L),Re=(L+1)/(L-z);Ae.cylinderUvToShapeUvHeight=j.fromElements(Ve,Re,Ae.cylinderUvToShapeUvHeight)}if(!Q||!de){const Ve=.5*(D-U),Re=f.fromElements(1/P,1/P,1/(Ve===0?1:Ve),Cat),At=f.fromElements(0,0,-Re.z*.5*(U+D),bat),xt=B.fromRotationTranslation(J.fromScale(Re,Tat),At,Eat),Nt=B.multiplyTransformation(xt,wat,xat);Ae.cylinderUvToRenderBoundsScale=B.getScale(Nt,Ae.cylinderUvToRenderBoundsScale),Ae.cylinderUvToRenderBoundsTranslate=B.getTranslation(Nt,Ae.cylinderUvToRenderBoundsTranslate)}if(te&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),Pe&&(xe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,xe.CYLINDER_INTERSECTION_INDEX_ANGLE=Oe,ve?(xe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,Oe+=1):Le?(xe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,Oe+=2):Ee?(xe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF=!0,Oe+=1):Be&&(xe.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,Oe+=2),Ae.cylinderRenderAngleMinMax=j.fromElements(N,V,Ae.cylinderAngleMinMax)),re){xe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,ue&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0),he&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),ce&&(xe.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const Ve=(I-u)/h,Re=(_-u)/h,At=1-Y/h;Ae.cylinderShapeUvAngleMinMax=j.fromElements(Ve,Re,Ae.cylinderShapeUvAngleMinMax),Ae.cylinderShapeUvAngleRangeZeroMid=(Re+.5*At)%1;const xt=h/Y,Nt=-(I-u)/Y;Ae.cylinderUvToShapeUvAngle=j.fromElements(xt,Nt,Ae.cylinderUvToShapeUvAngle)}return this.shaderMaximumIntersectionsLength=Oe,!0};Fo.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,c=this._maximumHeight,u=this._minimumAngle,d=this._maximumAngle,h=1/Math.pow(2,e),m=M.lerp(r,s,t*h),g=M.lerp(r,s,(t+1)*h),p=M.lerp(a,c,n*h),y=M.lerp(a,c,(n+1)*h),b=M.lerp(u,d,i*h),C=M.lerp(u,d,(i+1)*h);return LF(m,g,p,y,b,C,this.shapeTransform,o)};const Sat=new zt,vat=new f,Dat=new f,Iat=new f;Fo.prototype.computeApproximateStepSize=function(e){T.typeOf.object("dimensions",e);const 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,u=1-1/e.y,d=1-1/e.z,h=M.lerp(n,i,c),m=M.lerp(o,r,u),g=M.lerp(s,a,d),C=LF(h,i,m,r,g,a,t,Sat),E=J.getScale(C.halfAxes,vat),w=B.getScale(t,Dat),S=f.divideComponents(E,w,Iat);return f.minimumComponent(S)};Fo.DefaultMinBounds=Object.freeze(new f(0,-1,-M.PI));Fo.DefaultMaxBounds=Object.freeze(new f(1,1,+M.PI));const Pat=5,Oat=new Array(Pat),Lat=new f,Bat=new J,Rat=new B,Nat=new B,Mat=new B,lL=new B,Fat=new f,zat=new f,Uat=new f,Vte=new Array(8);for(let e=0;e<8;e++)Vte[e]=new f;function j8(e,t,n){return Math.abs(oe.dot(e,t))<n}function Hat(e){const t=B.getColumn(e,0,Fat),n=B.getColumn(e,1,zat),i=B.getColumn(e,2,Uat),o=M.EPSILON4;return j8(t,n,o)&&j8(n,i,o)}function Vat(e,t){const n=Vte;f.fromElements(-.5,-.5,-.5,n[0]),f.fromElements(-.5,-.5,.5,n[1]),f.fromElements(-.5,.5,-.5,n[2]),f.fromElements(-.5,.5,.5,n[3]),f.fromElements(.5,-.5,-.5,n[4]),f.fromElements(.5,-.5,.5,n[5]),f.fromElements(.5,.5,-.5,n[6]),f.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)B.multiplyByPoint(e,n[i],n[i]);return zt.fromPoints(n,t)}function LF(e,t,n,i,o,r,s,a){const c=Fo.DefaultMinBounds,u=Fo.DefaultMaxBounds,d=c.x,h=u.x,m=c.y,g=u.y,p=c.z,y=u.z;if(e===d&&t===h&&n===m&&i===g&&o===p&&r===y)return a.center=B.getTranslation(s,a.center),a.halfAxes=B.getMatrix3(s,a.halfAxes),a;r<o&&(r+=M.TWO_PI);const C=r-o,E=o+C*.5,w=Oat;let S=0;w[S++]=o,w[S++]=r,w[S++]=E,C>M.PI&&(w[S++]=E-M.PI_OVER_TWO,w[S++]=E+M.PI_OVER_TWO);let P=1,L=1,z=-1,R=-1;for(let te=0;te<S;++te){const Y=w[te]-E,X=Math.cos(Y),$=Math.sin(Y),se=X*e,ue=$*e,re=X*t,he=$*t;P=Math.min(P,se),L=Math.min(L,ue),P=Math.min(P,re),L=Math.min(L,he),z=Math.max(z,se),R=Math.max(R,ue),z=Math.max(z,re),R=Math.max(R,he)}const F=z-P,U=R-L,D=i-n,I=(P+z)*.5,_=(L+R)*.5,v=(n+i)*.5,O=f.fromElements(I,_,v,Lat),N=J.fromRotationZ(E,Bat),V=f.fromElements(F,U,D,Hte),k=B.fromScale(V,Mat),G=B.fromRotation(N,Nat),W=B.fromTranslation(O,Rat),K=B.multiplyTransformation(G,B.multiplyTransformation(W,k,lL),lL),q=B.multiplyTransformation(s,K,lL);return Hat(q)?zt.fromTransformation(q,a):Vat(q,a)}function Ks(){this.orientedBoundingBox=new zt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._rectangle=new ge,this._minimumHeight=Ks.DefaultMinBounds.z,this._maximumHeight=Ks.DefaultMaxBounds.z,this._ellipsoid=new me,this._translation=new f,this._rotation=new J,this.shaderUniforms={ellipsoidRadiiUv:new f,ellipsoidInverseRadiiSquaredUv:new f,ellipsoidRenderLongitudeMinMax:new j,ellipsoidShapeUvLongitudeMinMaxMid:new f,ellipsoidUvToShapeUvLongitude:new j,ellipsoidUvToShapeUvLatitude:new j,ellipsoidRenderLatitudeCosSqrHalfMinMax:new j,ellipsoidInverseHeightDifferenceUv:0,ellipseInnerRadiiUv:new j,ellipsoidInverseInnerScaleUv: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_MIN: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}const kat=new f,Gat=new J,q8=new f,$8=new f,Y8=new f,X8=new f,Wat=new ge;Ks.prototype.update=function(e,t,n,i,o){i=A(i,Ks.DefaultMinBounds),o=A(o,Ks.DefaultMaxBounds),T.typeOf.object("modelMatrix",e),T.typeOf.object("minBounds",t),T.typeOf.object("maxBounds",n);const r=Ks.DefaultMinBounds.x,s=Ks.DefaultMaxBounds.x,a=s-r,c=.5*a,u=Ks.DefaultMinBounds.y,d=Ks.DefaultMaxBounds.y,h=d-u,m=M.EPSILON10,g=M.EPSILON3,p=M.EPSILON10,y=M.EPSILON10,b=M.EPSILON3,C=M.clamp(t.x,r,s),E=M.clamp(n.x,r,s),w=M.clamp(i.x,r,s),S=M.clamp(o.x,r,s),P=Math.max(C,w),L=Math.min(E,S),z=M.clamp(t.y,u,d),R=M.clamp(n.y,u,d),F=M.clamp(i.y,u,d),U=M.clamp(o.y,u,d),D=Math.max(z,F),I=Math.min(R,U),_=B.getScale(e,kat),v=_.x===_.y&&_.y===_.z,O=f.minimumComponent(_),N=Math.max(t.z,-O),V=Math.max(n.z,-O),k=Math.max(i.z,-O),G=Math.max(o.z,-O),W=Math.max(N,k),K=Math.min(V,G),q=f.add(_,f.fromElements(N,N,N,$8),$8),te=f.add(_,f.fromElements(V,V,V,q8),q8),Y=f.maximumComponent(te),X=f.add(_,f.fromElements(W,W,W,X8),X8),$=f.add(_,f.fromElements(K,K,K,Y8),Y8),se=f.maximumComponent($);if(D>I||D===d||I===u||W>K||M.equalsEpsilon($,f.ZERO,void 0,m))return!1;this._rectangle=ge.fromRadians(C,z,E,R),this._translation=B.getTranslation(e,this._translation),this._rotation=B.getRotation(e,this._rotation),this._ellipsoid=me.fromCartesian3(_,this._ellipsoid),this._minimumHeight=N,this._maximumHeight=V;const ue=ge.fromRadians(P,D,L,I,Wat);this.orientedBoundingBox=kte(ue,W,K,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=B.fromRotationTranslation(J.setScale(this._rotation,$,Gat),this._translation,this.shapeTransform),this.boundTransform=B.fromRotationTranslation(this.orientedBoundingBox.halfAxes,this.orientedBoundingBox.center,this.boundTransform),this.boundingSphere=fe.fromOrientedBoundingBox(this.orientedBoundingBox,this.boundingSphere);const re=L<P,he=L-P+re*a,ce=he<=p,Q=he>c+p&&he<a-p,ne=he>=c-p&&he<=c+p,de=he>p&&he<c-p,_e=ce||Q||ne||de,Se=L<P,ve=E-C+Se*a,Le=ve<=p,Ee=ve>c+p&&ve<a-p,Be=ve>=c-p&&ve<=c+p,Pe=ve>p&&ve<c-p,Ae=Le||Ee||Be||Pe,xe=I<-b,Oe=I>=-b&&I<=+b,Ve=I>+b&&I<d-y,Re=xe||Oe||Ve,At=D>u+y&&D<-b,xt=D>=-b&&D<=+b,Nt=D>+b,On=At||xt||Nt,Nn=Re||On,Sn=R-z,un=R<-b,Ht=R>=-b&&R<=+b,vn=R>+b&&R<d-y,Pn=un||Ht||vn,qt=z>u+y&&z<-b,tn=z>=-b&&z<=+b,jn=z>+b,sn=Pn||(qt||tn||jn),zi=!f.equals(X,f.ZERO),oo=!f.equals($,f.ZERO),Wi=zi||oo,li=K-W,mn=!f.equals(q,f.ZERO),Kn=!f.equals(te,f.ZERO),Hn=mn||Kn,dn=this.shaderUniforms,bt=this.shaderDefines;for(const Mn in bt)bt.hasOwnProperty(Mn)&&(bt[Mn]=void 0);dn.ellipsoidRadiiUv=f.divideByScalar(te,Y,dn.ellipsoidRadiiUv),dn.ellipsoidInverseRadiiSquaredUv=f.divideComponents(f.ONE,f.multiplyComponents(dn.ellipsoidRadiiUv,dn.ellipsoidRadiiUv,dn.ellipsoidInverseRadiiSquaredUv),dn.ellipsoidInverseRadiiSquaredUv);let Ge=0;if(bt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=Ge,Ge+=1,Wi&&(li===0&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),zi&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN=!0,bt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=Ge,Ge+=1,dn.ellipsoidInverseInnerScaleUv=se/(se-li))),Hn){if(mn){bt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN=!0;const Mn=(V-N)/Y;dn.ellipsoidInverseHeightDifferenceUv=1/Mn,dn.ellipseInnerRadiiUv=j.fromElements(dn.ellipsoidRadiiUv.x*(1-Mn),dn.ellipsoidRadiiUv.z*(1-Mn),dn.ellipseInnerRadiiUv)}N===V&&(bt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0)}if(_e&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,bt.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=Ge,Q?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,Ge+=1):de?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,Ge+=2):ne?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF=!0,Ge+=1):ce&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,Ge+=2),dn.ellipsoidRenderLongitudeMinMax=j.fromElements(P,L,dn.ellipsoidRenderLongitudeMinMax)),Ae){bt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,E<C&&(bt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0);const Tn=a/ve,Qi=-(C-r)/ve;dn.ellipsoidUvToShapeUvLongitude=j.fromElements(Tn,Qi,dn.ellipsoidUvToShapeUvLongitude)}if(_e){const Mn=M.equalsEpsilon(P,r,void 0,g),Tn=M.equalsEpsilon(L,s,void 0,g);Mn&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),Tn&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const Qi=(C-r)/a,Fn=(E-r)/a,ji=(L-r)/a,Lo=1-he/a,po=(ji+.5*Lo)%1;dn.ellipsoidShapeUvLongitudeMinMaxMid=f.fromElements(Qi,Fn,po,dn.ellipsoidShapeUvLongitudeMinMaxMid)}if(Nn){bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE=!0,On&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,bt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=Ge,At?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,Ge+=1):xt?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,Ge+=1):Nt&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,Ge+=2)),Re&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,bt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=Ge,xe?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,Ge+=2):Oe?(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,Ge+=1):Ve&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,Ge+=1)),D===I&&(bt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const Mn=Math.pow(Math.cos(M.PI_OVER_TWO-Math.abs(D)),2),Tn=Math.pow(Math.cos(M.PI_OVER_TWO-Math.abs(I)),2);dn.ellipsoidRenderLatitudeCosSqrHalfMinMax=j.fromElements(Mn,Tn,dn.ellipsoidRenderLatitudeCosSqrHalfMinMax)}if(sn){bt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,z===R&&(bt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const Mn=h/Sn,Tn=(u-z)/Sn;dn.ellipsoidUvToShapeUvLatitude=j.fromElements(Mn,Tn,dn.ellipsoidUvToShapeUvLatitude)}return v&&(bt.ELLIPSOID_IS_SPHERE=!0),this.shaderMaximumIntersectionsLength=Ge,!0};const jat=new ge;Ks.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){T.typeOf.number("tileLevel",e),T.typeOf.number("tileX",t),T.typeOf.number("tileY",n),T.typeOf.number("tileZ",i),T.typeOf.object("result",o);const r=1/Math.pow(2,e),s=t*r,a=(t+1)*r,c=n*r,u=(n+1)*r,d=i*r,h=(i+1)*r,m=ge.subsection(this._rectangle,s,c,a,u,jat),g=M.lerp(this._minimumHeight,this._maximumHeight,d),p=M.lerp(this._minimumHeight,this._maximumHeight,h);return kte(m,g,p,this._ellipsoid,this._translation,this._rotation,o)};Ks.prototype.computeApproximateStepSize=function(e){T.typeOf.object("dimensions",e);const n=this._ellipsoid.maximumRadius,i=this._minimumHeight,o=this._maximumHeight;return .5*((o-i)/(n+o))/e.z};function kte(e,t,n,i,o,r,s){return s=zt.fromRectangle(e,t,n,i,s),s.center=f.add(s.center,o,s.center),s.halfAxes=J.multiply(s.halfAxes,r,s.halfAxes),s}Ks.DefaultMinBounds=Object.freeze(new f(-M.PI,-M.PI_OVER_TWO,-Number.MAX_VALUE));Ks.DefaultMaxBounds=Object.freeze(new f(+M.PI,+M.PI_OVER_TWO,+Number.MAX_VALUE));const dc={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};dc.getMinBounds=function(e){switch(e){case dc.BOX:return na.DefaultMinBounds;case dc.ELLIPSOID:return Ks.DefaultMinBounds;case dc.CYLINDER:return Fo.DefaultMinBounds;default:throw new x(`Invalid shape type ${e}`)}};dc.getMaxBounds=function(e){switch(e){case dc.BOX:return na.DefaultMaxBounds;case dc.ELLIPSOID:return Ks.DefaultMaxBounds;case dc.CYLINDER:return Fo.DefaultMaxBounds;default:throw new x(`Invalid shape type ${e}`)}};dc.getShapeConstructor=function(e){switch(e){case dc.BOX:return na;case dc.ELLIPSOID:return Ks;case dc.CYLINDER:return Fo;default:throw new x(`Invalid shape type ${e}`)}};const yy=Object.freeze(dc),Gte=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function Li(e,t){this.spatialNode=e,this.keyframe=t,this.state=Gte.UNLOADED,this.metadatas=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}Li.priorityComparator=function(e,t){return e.priority-t.priority};Li.searchComparator=function(e,t){return e.keyframe-t.keyframe};Li.LoadState=Gte;function ch(e,t,n,i,o){i===$t.UNSIGNED_SHORT&&(i=$t.FLOAT32);const r=e.floatingPointTexture;if(i===$t.FLOAT32&&!r)throw new Ie("Floating point texture not supported");let s;i===$t.FLOAT32||i===$t.FLOAT64?s=Qe.FLOAT:i===$t.UINT8&&(s=Qe.UNSIGNED_BYTE);let a;n===1?a=rt.LUMINANCE:n===2?a=rt.LUMINANCE_ALPHA:n===3?a=rt.RGB:n===4&&(a=rt.RGBA);const c=512*1024*1024,u=128*1024*1024;o=Math.min(A(o,u),c);const d=It.maximumTextureSize,h=$t.getSizeInBytes(i),m=Math.floor(o/(n*h)),g=Math.min(d,M.previousPowerOfTwo(Math.floor(Math.sqrt(m)))),p=Math.ceil(Math.sqrt(t.x)),y=Math.ceil(t.z/p),b=p*t.x,C=y*t.y,E=Math.floor(g/b),w=Math.floor(g/C);if(E===0||w===0)throw new Ie("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=f.clone(t,new f),this.maximumTileCount=E*w,this.regionCountPerMegatexture=new j(E,w),this.voxelCountPerRegion=new j(b,C),this.sliceCountPerRegion=new j(p,y),this.voxelSizeUv=new j(1/g,1/g),this.sliceSizeUv=new j(t.x/g,t.y/g),this.regionSizeUv=new j(b/g,C/g),this.texture=new Wt({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new ii({wrapS:Fi.CLAMP_TO_EDGE,wrapT:Fi.CLAMP_TO_EDGE,minificationFilter:In.LINEAR,magnificationFilter:Kr.LINEAR})});const S=$t.toComponentDatatype(i);this.tileVoxelDataTemp=ee.createTypedArray(S,b*C*n),this.nodes=new Array(this.maximumTileCount);for(let P=0;P<this.maximumTileCount;P++)this.nodes[P]=new qat(P);for(let P=0;P<this.maximumTileCount;P++){const L=this.nodes[P];L.previousNode=P>0?this.nodes[P-1]:void 0,L.nextNode=P<this.maximumTileCount-1?this.nodes[P+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function qat(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}ch.prototype.add=function(e){if(this.isFull())throw new x("Trying to add when there are no empty spots");const t=this.emptyList;this.emptyList=this.emptyList.nextNode,l(this.emptyList)&&(this.emptyList.previousNode=void 0),t.nextNode=this.occupiedList,l(t.nextNode)&&(t.nextNode.previousNode=t),this.occupiedList=t;const n=t.index;return this.writeDataToTexture(n,e),this.occupiedCount++,n};ch.prototype.remove=function(e){if(e<0||e>=this.maximumTileCount)throw new x("Megatexture index out of bounds");const t=this.nodes[e];l(t.previousNode)&&(t.previousNode.nextNode=t.nextNode),l(t.nextNode)&&(t.nextNode.previousNode=t.previousNode),t.nextNode=this.emptyList,l(t.nextNode)&&(t.nextNode.previousNode=t),t.previousNode=void 0,this.emptyList=t,this.occupiedCount--};ch.prototype.isFull=function(){return this.emptyList===void 0};ch.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===$t.UNSIGNED_SHORT&&(i=$t.FLOAT32);const o=$t.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,u=a*t.y;let d=M.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){const m=Math.floor(d/c),g=Math.floor(d/u);if(m*g>=e)break;d*=2}return d*d*n*o};ch.prototype.writeDataToTexture=function(e,t){const 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 y=0;y<i.z;y++){const b=y%o.x*i.x,C=Math.floor(y/o.x)*i.y;for(let E=0;E<i.y;E++)for(let w=0;w<i.x;w++){const S=y*i.y*i.x+E*i.x+w,P=(C+E)*r.x+(b+w);for(let L=0;L<s;L++)a[P*s+L]=n[S*s+L]}}const c=this.regionCountPerMegatexture,u=r.x,d=r.y,h=e%c.x*r.x,m=Math.floor(e/c.x)*r.y,p={source:{arrayBufferView:a,width:u,height:d},xOffset:h,yOffset:m};this.texture.copyFrom(p)};ch.prototype.isDestroyed=function(){return!1};ch.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),He(this)};const $at=new ai("MapQuest, Open Street Map and contributors, CC-BY-SA");function Jy(e){e=A(e,A.EMPTY_OBJECT);const t=Me.createIfNeeded(A(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}.${A(e.fileExtension,"png")}`;const n=new ga({ellipsoid:e.ellipsoid}),i=256,o=256,r=A(e.minimumLevel,0),s=e.maximumLevel,a=A(e.rectangle,n.rectangle),c=n.positionToTileXY(ge.southwest(a),r),u=n.positionToTileXY(ge.northeast(a),r),d=(Math.abs(u.x-c.x)+1)*(Math.abs(u.y-c.y)+1);if(d>4)throw new x(`The rectangle and minimumLevel indicate that there are ${d} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let h=A(e.credit,$at);typeof h=="string"&&(h=new ai(h)),$a.call(this,{url:t,credit:h,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}l(Object.create)&&(Jy.prototype=Object.create($a.prototype),Jy.prototype.constructor=Jy);function Yat(e,t,n){return T.typeOf.string("samplerUniformName",e),T.typeOf.string("matrixUniformName",t),T.typeOf.string("styleUniformName",n),` float clipDistance = clip(gl_FragCoord, ${e}, ${t});
|
||
vec4 clippingPlanesEdgeColor = vec4(1.0);
|
||
clippingPlanesEdgeColor.rgb = ${n}.rgb;
|
||
float clippingPlanesEdgeWidth = ${n}.a;
|
||
if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
|
||
{
|
||
gl_FragColor = clippingPlanesEdgeColor;
|
||
}
|
||
`}const Xat={modifyFragmentShader:function(t){return t=We.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}}},Wte=Xat,Jm={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function JT(e){T.typeOf.object("options",e),T.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=H.clone(H.DARKGRAY),this._highlightColor=H.clone(H.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=Jm.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=A(e.opaquePass,Ne.OPAQUE),this._cull=A(e.cull,!0),this.style=void 0,this._style=void 0,this.styleDirty=!1,this.modelMatrix=B.clone(B.IDENTITY),this._modelMatrix=B.clone(B.IDENTITY),this.time=0,this.shadows=Po.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=A(e.splitDirection,Z_.NONE),this._splittingEnabled=!1,this._resolveReadyPromise=void 0,this._rejectReadyPromise=void 0,this._readyPromise=Kat(this,e)}Object.defineProperties(JT.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 H.clone(this._highlightColor)},set:function(e){this._highlightColor=H.clone(e,this._highlightColor)}},boundingSphere:{get:function(){if(l(this._drawCommand))return this._drawCommand.boundingVolume},set:function(e){this._boundingSphere=fe.clone(e,this._boundingSphere)}}});function Kat(e,t){const n=bQ.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&&l(n.batchTableBinary)&&(n.styleableProperties=Pi.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),l(n.draco)){const a=n.draco;e._decodingState=Jm.NEEDS_DECODE,a.dequantizeInShader=e._dequantizeInShader}const i=n.positions;l(i)&&(e._isQuantized=i.isQuantized,e._quantizedVolumeScale=i.quantizedVolumeScale,e._quantizedVolumeOffset=i.quantizedVolumeOffset,e._quantizedRange=i.quantizedRange);const o=n.normals;l(o)&&(e._isOctEncoded16P=o.octEncoded);const r=n.colors;l(r)&&(l(r.constantColor)&&(e._constantColor=H.clone(r.constantColor,e._constantColor),e._hasColors=!1),e._isRGB565=r.isRGB565);const s=n.batchIds;return l(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})}const Jat=new f,Qat=new f,Zat=new f;let K8,gw;function ect(e){if(!l(gw)){K8=new nD(0),gw=new Array(e);for(let t=0;t<e;++t)gw[t]=K8.random()}return gw}function tct(e){const n=e.length/3,i=Math.min(n,20),o=ect(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=f.fromElements(r,r,r,Jat),c=f.fromElements(s,s,s,Qat);for(let d=0;d<i;++d){const h=Math.floor(o[d]*n),m=f.unpack(e,h*3,Zat);f.minimumByComponent(a,m,a),f.maximumByComponent(c,m,c)}const u=fe.fromCornerPoints(a,c);return u.radius+=M.EPSILON2,u}function J8(e,t){const n=ee.fromTypedArray(e);return n===ee.INT||n===ee.UNSIGNED_INT||n===ee.DOUBLE?(ki("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}const nct=new oe,ict=new oe,oct=new H,jte=0,Pv=1,JR=2,qte=3,rct=4,uL=new B,sct=new B;function act(e,t){const n=t.context,i=e._parsedContent,o=e._pointsLength,r=i.positions,s=i.colors,a=i.normals,c=i.batchIds,u=i.styleableProperties,d=l(u),h=e._isQuantized,m=e._isQuantizedDraco,g=e._isOctEncoded16P,p=e._isOctEncodedDraco,y=e._quantizedRange,b=e._octEncodedRange,C=e._isRGB565,E=e._isTranslucent,w=e._hasColors,S=e._hasNormals,P=e._hasBatchIds;let L,z;const R=[],F={};if(e._styleableShaderAttributes=F,d){let k=rct;for(const G in u)if(u.hasOwnProperty(G)){const W=u[G],K=J8(W.typedArray,G);L=W.componentCount,z=ee.fromTypedArray(K);const q=Tt.createVertexBuffer({context:n,typedArray:K,usage:nt.STATIC_DRAW});e._geometryByteLength+=q.sizeInBytes;const te={index:k,vertexBuffer:q,componentsPerAttribute:L,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0};R.push(te),F[G]={location:k,componentCount:L},++k}}const U=Tt.createVertexBuffer({context:n,typedArray:r.typedArray,usage:nt.STATIC_DRAW});e._geometryByteLength+=U.sizeInBytes;let D;w&&(D=Tt.createVertexBuffer({context:n,typedArray:s.typedArray,usage:nt.STATIC_DRAW}),e._geometryByteLength+=D.sizeInBytes);let I;S&&(I=Tt.createVertexBuffer({context:n,typedArray:a.typedArray,usage:nt.STATIC_DRAW}),e._geometryByteLength+=I.sizeInBytes);let _;P&&(c.typedArray=J8(c.typedArray,"batchIds"),_=Tt.createVertexBuffer({context:n,typedArray:c.typedArray,usage:nt.STATIC_DRAW}),e._geometryByteLength+=_.sizeInBytes);let v=[];if(h?z=ee.UNSIGNED_SHORT:m?z=y<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT:z=ee.FLOAT,v.push({index:jte,vertexBuffer:U,componentsPerAttribute:3,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(h||m?e._boundingSphere=fe.fromCornerPoints(f.ZERO,e._quantizedVolumeScale):e._boundingSphere=tct(r.typedArray)),w)if(C)v.push({index:Pv,vertexBuffer:D,componentsPerAttribute:1,componentDatatype:ee.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const k=E?4:3;v.push({index:Pv,vertexBuffer:D,componentsPerAttribute:k,componentDatatype:ee.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}S&&(g?(L=2,z=ee.UNSIGNED_BYTE):p?(L=2,z=b<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT):(L=3,z=ee.FLOAT),v.push({index:JR,vertexBuffer:I,componentsPerAttribute:L,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0})),P&&v.push({index:qte,vertexBuffer:_,componentsPerAttribute:1,componentDatatype:ee.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),d&&(v=v.concat(R));const O=new ho({context:n,attributes:v}),N={depthTest:{enabled:!0}},V={depthTest:{enabled:!0},depthMask:!1,blending:Gi.ALPHA_BLEND};e._opaquePass===Ne.CESIUM_3D_TILE&&(N.stencilTest=Rt.setCesium3DTileBit(),N.stencilMask=Rt.CESIUM_3D_TILE_MASK,V.stencilTest=Rt.setCesium3DTileBit(),V.stencilMask=Rt.CESIUM_3D_TILE_MASK),e._opaqueRenderState=et.fromCache(N),e._translucentRenderState=et.fromCache(V),e._drawCommand=new mt({boundingVolume:new fe,cull:e._cull,modelMatrix:new B,primitiveType:Ze.POINTS,vertexArray:O,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:E?e._translucentRenderState:e._opaqueRenderState,pass:E?Ne.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function cct(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const a=nct;if(a.x=e._attenuation?e.maximumAttenuation:e._pointSize,a.x*=t.pixelRatio,a.y=e.time,e._attenuation){const c=t.camera.frustum;let u;t.mode===le.SCENE2D||c instanceof Gt?u=Number.POSITIVE_INFINITY:u=n.drawingBufferHeight/t.camera.frustum.sseDenominator,a.z=e.geometricError*e.geometricErrorScale,a.w=u}return a},u_highlightColor:function(){return e._highlightColor},u_constantColor:function(){return e._constantColor},u_clippingPlanes:function(){const a=e.clippingPlanes;return e.isClipped?a.texture:n.defaultTexture},u_clippingPlanesEdgeStyle:function(){const a=e.clippingPlanes;if(!l(a))return H.TRANSPARENT;const c=H.clone(a.edgeColor,oct);return c.alpha=a.edgeWidth,c},u_clippingPlanesMatrix:function(){const a=e.clippingPlanes;if(!l(a))return B.IDENTITY;const c=A(e.clippingPlanesOriginMatrix,e._modelMatrix);B.multiply(n.uniformState.view3D,c,uL);const u=B.multiply(uL,a.modelMatrix,uL);return B.inverseTranspose(u,sct)}};Wte.addUniforms(e,s),(i||o||r)&&(s=hn(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const a=ict;if(l(e._quantizedVolumeScale)){const c=f.clone(e._quantizedVolumeScale,a);f.divideByScalar(c,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),l(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function dL(e,t){const n=/czm_3dtiles_property_(\d+)/g;let i=n.exec(e);for(;i!==null;){const o=parseInt(i[1]);t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function fL(e,t){e=e.slice(e.indexOf(`
|
||
`));const n=/czm_3dtiles_builtin_property_(\w+)/g;let i=n.exec(e);for(;i!==null;){const o=i[1];t.indexOf(o)===-1&&t.push(o),i=n.exec(e)}}function hL(e,t){const n=e.numberOfAttributes;for(let i=0;i<n;++i){const o=e.getAttribute(i);if(o.index===t)return o}}const lct={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 uct(e,t,n){let i,o,r;const s=t.context,a=l(n),c=e._isQuantized,u=e._isQuantizedDraco,d=e._isOctEncoded16P,h=e._isOctEncodedDraco,m=e._isRGB565,g=e._isTranslucent,p=e._hasColors,y=e._hasNormals,b=e._hasBatchIds,C=e._backFaceCulling,E=e._normalShading,w=e._drawCommand.vertexArray,S=e.clippingPlanes,P=e._attenuation;let L,z,R,F=g;const U=ht(lct),D={},I=e._styleableShaderAttributes;for(o in I)I.hasOwnProperty(o)&&(r=I[o],U[o]=`czm_3dtiles_property_${r.location}`,D[r.location]=r);if(a){const re={translucent:!1},he="(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)";L=n.getColorShaderFunction(`getColorFromStyle${he}`,U,re),z=n.getShowShaderFunction(`getShowFromStyle${he}`,U,re),R=n.getPointSizeShaderFunction(`getPointSizeFromStyle${he}`,U,re),l(L)&&re.translucent&&(F=!0)}e._styleTranslucent=F;const _=l(L),v=l(z),O=l(R),N=e.isClipped,V=[],k=[];_&&(dL(L,V),fL(L,k)),v&&(dL(z,V),fL(z,k)),O&&(dL(R,V),fL(R,k));const G=k.indexOf("COLOR")>=0,W=k.indexOf("NORMAL")>=0;if(W&&!y)throw new Ie("Style references the NORMAL semantic but the point cloud does not have normals");for(o in I)if(I.hasOwnProperty(o)){r=I[o];const re=V.indexOf(r.location)>=0,he=hL(w,r.location);he.enabled=re}const K=p&&(!_||G);if(p){const re=hL(w,Pv);re.enabled=K}const q=y&&(E||C||W);if(y){const re=hL(w,JR);re.enabled=q}const te={a_position:jte};K&&(te.a_color=Pv),q&&(te.a_normal=JR),b&&(te.a_batchId=qte);let Y="";const X=V.length;for(i=0;i<X;++i){const re=V[i];r=D[re];const he=r.componentCount,ce=`czm_3dtiles_property_${re}`;let Q;he===1?Q="float":Q=`vec${he}`,Y+=`attribute ${Q} ${ce};
|
||
`,te[ce]=r.location}cct(e,t);let $=`attribute vec3 a_position;
|
||
varying vec4 v_color;
|
||
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
|
||
uniform vec4 u_constantColor;
|
||
uniform vec4 u_highlightColor;
|
||
`;$+=`float u_pointSize;
|
||
float tiles3d_tileset_time;
|
||
`,P&&($+=`float u_geometricError;
|
||
float u_depthMultiplier;
|
||
`),$+=Y,K&&(g?$+=`attribute vec4 a_color;
|
||
`:m?$+=`attribute 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;
|
||
`:$+=`attribute vec3 a_color;
|
||
`),q&&(d||h?$+=`attribute vec2 a_normal;
|
||
`:$+=`attribute vec3 a_normal;
|
||
`),b&&($+=`attribute float a_batchId;
|
||
`),(c||u||h)&&($+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
|
||
`),_&&($+=L),v&&($+=z),O&&($+=R),$+=`void main()
|
||
{
|
||
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
|
||
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
|
||
`,P&&($+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
|
||
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
|
||
`),K?g?$+=` vec4 color = a_color;
|
||
`:m?$+=` 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);
|
||
`:$+=` vec4 color = vec4(a_color, 1.0);
|
||
`:$+=` vec4 color = u_constantColor;
|
||
`,c||u?$+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
|
||
`:$+=` vec3 position = a_position;
|
||
`,$+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
|
||
`,q?(d?$+=` vec3 normal = czm_octDecode(a_normal);
|
||
`:h?$+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
|
||
`:$+=` vec3 normal = a_normal;
|
||
`,$+=` vec3 normalEC = czm_normal * normal;
|
||
`):$+=` vec3 normal = vec3(1.0);
|
||
`,_&&($+=` color = getColorFromStyle(position, position_absolute, color, normal);
|
||
`),v&&($+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
|
||
`),O?$+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
|
||
`:P?$+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
||
float depth = -positionEC.z;
|
||
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
|
||
`:$+=` gl_PointSize = u_pointSize;
|
||
`,$+=` color = color * u_highlightColor;
|
||
`,q&&E&&($+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
|
||
diffuseStrength = max(diffuseStrength, 0.4);
|
||
color.xyz *= diffuseStrength * czm_lightColor;
|
||
`),$+=` v_color = color;
|
||
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
|
||
`,q&&C&&($+=` float visible = step(-normalEC.z, 0.0);
|
||
gl_Position *= visible;
|
||
gl_PointSize *= visible;
|
||
`),v&&($+=` gl_Position.w *= float(show);
|
||
gl_PointSize *= float(show);
|
||
`),$+=`}
|
||
`;let se=`varying vec4 v_color;
|
||
`;N&&(se+=`uniform highp sampler2D u_clippingPlanes;
|
||
uniform mat4 u_clippingPlanesMatrix;
|
||
uniform vec4 u_clippingPlanesEdgeStyle;
|
||
`,se+=`
|
||
`,se+=UM(S,s),se+=`
|
||
`),se+=`void main()
|
||
{
|
||
gl_FragColor = czm_gammaCorrect(v_color);
|
||
`,N&&(se+=Yat("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),se+=`}
|
||
`,e.splitDirection!==Z_.NONE&&(se=Wte.modifyFragmentShader(se)),l(e._vertexShaderLoaded)&&($=e._vertexShaderLoaded($)),l(e._fragmentShaderLoaded)&&(se=e._fragmentShaderLoaded(se));const ue=e._drawCommand;l(ue.shaderProgram)&&ue.shaderProgram.destroy(),ue.shaderProgram=Cn.fromCache({context:s,vertexShaderSource:$,fragmentShaderSource:se,attributeLocations:te});try{ue.shaderProgram._bind()}catch{throw new Ie("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function dct(e,t){if(e._decodingState===Jm.READY)return!1;if(e._decodingState===Jm.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,o=ls.decodePointCloud(i,t);l(o)&&(e._decodingState=Jm.DECODING,o.then(function(r){e._decodingState=Jm.READY;const s=l(r.POSITION)?r.POSITION.array:void 0,a=l(r.RGB)?r.RGB.array:void 0,c=l(r.RGBA)?r.RGBA.array:void 0,u=l(r.NORMAL)?r.NORMAL.array:void 0,d=l(r.BATCH_ID)?r.BATCH_ID.array:void 0,h=l(s)&&l(r.POSITION.data.quantization),m=l(u)&&l(r.NORMAL.data.quantization);if(h){const b=r.POSITION.data.quantization,C=b.range;e._quantizedVolumeScale=f.fromElements(C,C,C),e._quantizedVolumeOffset=f.unpack(b.minValues),e._quantizedRange=(1<<b.quantizationBits)-1,e._isQuantizedDraco=!0}m&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties;const p=i.batchTableProperties;for(const b in p)if(p.hasOwnProperty(b)){const C=r[b];l(g)||(g={}),g[b]={typedArray:C.array,componentCount:C.data.componentsPerAttribute}}l(s)&&(n.positions={typedArray:s});const y=A(c,a);l(y)&&(n.colors={typedArray:y}),l(u)&&(n.normals={typedArray:u}),l(d)&&(n.batchIds={typedArray:d}),n.styleableProperties=g}).catch(function(r){e._decodingState=Jm.FAILED,e._rejectReadyPromise(r)}))}return!0}const fct=new oe,hct=new f;JT.prototype.update=function(e){const t=e.context;if(dct(this,t))return;let i=!1,o=!B.equals(this._modelMatrix,this.modelMatrix);if(this._mode!==e.mode&&(this._mode=e.mode,o=!0),l(this._drawCommand)||(act(this,e),o=!0,i=!0,this._resolveReadyPromise(),this._parsedContent=void 0),o){B.clone(this.modelMatrix,this._modelMatrix);const u=this._drawCommand.modelMatrix;if(B.clone(this._modelMatrix,u),l(this._rtcCenter)&&B.multiplyByTranslation(u,this._rtcCenter,u),l(this._quantizedVolumeOffset)&&B.multiplyByTranslation(u,this._quantizedVolumeOffset,u),e.mode!==le.SCENE3D){const h=e.mapProjection,m=B.getColumn(u,3,fct);oe.equals(m,oe.UNIT_W)||cn.basisTo2D(h,u,u)}const d=this._drawCommand.boundingVolume;if(fe.clone(this._boundingSphere,d),this._cull){const h=d.center;B.multiplyByPoint(u,h,h);const m=B.getScale(u,hct);d.radius*=f.maximumComponent(m)}}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);const r=this.splitDirection!==Z_.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&uct(this,e,this._style),this._drawCommand.castShadows=Po.castShadows(this.shadows),this._drawCommand.receiveShadows=Po.receiveShadows(this.shadows);const s=this._highlightColor.alpha<1||this._constantColor.alpha<1||this._styleTranslucent;this._drawCommand.renderState=s?this._translucentRenderState:this._opaqueRenderState,this._drawCommand.pass=s?Ne.TRANSLUCENT:this._opaquePass;const a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)};JT.prototype.isDestroyed=function(){return!1};JT.prototype.destroy=function(){const e=this._drawCommand;return l(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),He(this)};function Il(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 zt,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r,s)}Il.spatialComparator=function(e,t){return t.screenSpaceError-e.screenSpaceError};const pct=new f;Il.prototype.computeBoundingVolumes=function(e,t){this.orientedBoundingBox=e.computeOrientedBoundingBoxForTile(this.level,this.x,this.y,this.z,this.orientedBoundingBox);const n=J.getScale(this.orientedBoundingBox.halfAxes,pct),i=2*f.maximumComponent(n);this.approximateVoxelSize=i/f.minimumComponent(t)};Il.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};Il.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,M.EPSILON7);const o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};const Q8={keyframe:0};function tT(e,t){return Q8.keyframe=e,Bs(t,Q8,Li.searchComparator)}Il.prototype.computeSurroundingRenderableKeyframeNodes=function(e){let t=this;const n=t.level,i=Math.floor(e),o=Math.ceil(e);let r,s,a=+Number.MAX_VALUE,c=+Number.MAX_VALUE;for(;l(t);){const u=t.renderableKeyframeNodes;if(u.length>=1){let d=tT(i,u);d<0&&(d=M.clamp(~d-1,0,u.length-1));const h=u[d],m=h.keyframe;let g;if(o===i||i<m)g=h;else{const z=Math.min(d+1,u.length-1);g=u[z]}const p=g.keyframe,y=i-m,b=p-o,C=n-t.level,E=Math.exp(C*4),w=1,S=200,P=C*E+(y>=0?y*w:-y*S),L=C*E+(b>=0?b*w:-b*S);if(P<a&&(a=P,r=h),L<c&&(c=L,s=g),y===0&&b===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,l(r)&&l(s)){const u=r.keyframe,d=s.keyframe;this.renderableKeyframeNodeLerp=u===d?0:M.clamp((e-u)/(d-u),0,1)}};Il.prototype.isVisited=function(e){return this.visitedFrameNumber===e};Il.prototype.createKeyframeNode=function(e){let t=tT(e,this.keyframeNodes);if(t<0){t=~t;const n=new Li(this,e);this.keyframeNodes.splice(t,0,n)}};Il.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=tT(n,this.keyframeNodes);if(i<0)throw new x("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);const o=tT(n,this.renderableKeyframeNodes);if(o<0)throw new x("Renderable keyframe node does not exist.");this.renderableKeyframeNodes.splice(o,1)}e.spatialNode=void 0,e.state=Li.LoadState.UNLOADED,e.metadatas={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};Il.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==Li.LoadState.RECEIVED||e.megatextureIndex!==-1||e.metadatas.length!==t.length)throw new x("Keyframe node cannot be added to megatexture");for(let o=0;o<t.length;o++){const r=t[o];e.megatextureIndex=r.add(e.metadatas[o]),e.metadatas[o]=void 0}e.state=Li.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=tT(e.keyframe,n);if(i>=0)throw new x("Keyframe already renderable");i=~i,n.splice(i,0,e)};Il.prototype.isRenderable=function(e){const t=this.renderableKeyframeNodePrevious,n=this.renderableKeyframeNodeNext,i=this.level;return l(t)&&l(n)&&(t.spatialNode.level===i||n.spatialNode.level===i)&&this.visitedFrameNumber===e};function am(e){e=A(e,A.EMPTY_OBJECT),T.typeOf.object("options.clock",e.clock),T.typeOf.object("options.intervals",e.intervals),this.show=A(e.show,!0),this.modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this.shadows=A(e.shadows,Po.ENABLED),this.maximumMemoryUsage=A(e.maximumMemoryUsage,256),this.shading=new zT(e.shading),this.style=e.style,this.frameFailed=new Ke,this.frameChanged=new Ke,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new im,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;const 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(am.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Io.setOwner(e,this,"_clippingPlanes")}},totalMemoryUsageInBytes:{get:function(){return this._totalMemoryUsageInBytes}},boundingSphere:{get:function(){if(l(this._lastRenderedFrame))return this._lastRenderedFrame.pointCloud.boundingSphere}},readyPromise:{get:function(){return this._readyPromise}}});function mct(e){return`uniform vec4 czm_pickColor;
|
||
${e}`}function _ct(e){return function(t){return hn(t,{czm_pickColor:function(){return e._pickId.color}})}}function gct(){return"czm_pickColor"}am.prototype.makeStyleDirty=function(){this._styleDirty=!0};am.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};const yct=new ie;function BF(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function V_(e,t){return e._intervals.indexOf(t.start)}function Act(e,t){const n=e._intervals,i=e._clock,o=BF(e);if(o===0)return;const r=e._getAverageLoadTime(),s=ie.addSeconds(i.currentTime,r*o,yct);let a=n.indexOf(s);const c=V_(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function bct(e){const t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function Cct(e,t,n){const i=BF(e),o=V_(e,t),r=V_(e,n);return i>=0?o>=r:o<=r}function Tct(e,t){return function(n){const i=l(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 Ect(e,t,n){const i=V_(e,t),o=e._frames;let r=o[i];if(!l(r)){const s=t.data.transform,a=l(s)?B.fromArray(s):void 0,c=t.data.uri;r={pointCloud:void 0,transform:a,timestamp:fr(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,Me.fetchArrayBuffer({url:c}).then(function(u){return r.pointCloud=new JT({arrayBuffer:u,cull:!0,fragmentShaderLoaded:mct,uniformMapLoaded:_ct(e),pickIdLoaded:gct}),r.pointCloud.readyPromise}).catch(Tct(e,c))}return r}function xct(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 wct(e,t,n,i){t.touchedFrameNumber<i.frameNumber-1&&(t.sequential=!1);const o=t.pointCloud;if(l(o)&&!t.ready){const r=i.commandList,s=r.length;if($te(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){const a=(fr()-t.timestamp)/1e3;xct(e,a)}}t.touchedFrameNumber=i.frameNumber}const Sct=new B;function vct(e,t){const n=e.shading;return l(n)&&l(n.baseResolution)?n.baseResolution:l(t.boundingSphere)?M.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function Dct(e){const t=e.shading;return l(t)&&l(t.maximumAttenuation)?t.maximumAttenuation:10}const Ict=new zT;function $te(e,t,n,i){const o=A(e.shading,Ict),r=t.pointCloud,s=A(t.transform,B.IDENTITY);r.modelMatrix=B.multiplyTransformation(e.modelMatrix,s,Sct),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=vct(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=Dct(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function QR(e,t,n,i){const o=Ect(e,t,i);wct(e,o,n,i)}function Pct(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function Yte(e,t){const n=e._frames,i=n.length;for(let o=0;o<i;++o){const r=n[o];if(l(r)&&(!l(t)||t(r))){const s=r.pointCloud;r.ready&&(e._totalMemoryUsageInBytes-=s.geometryByteLength),l(s)&&s.destroy(),r===e._lastRenderedFrame&&(e._lastRenderedFrame=void 0),n[o]=void 0}}}function Oct(e,t){const n=V_(e,t),i=e._frames[n];if(l(i)&&i.ready)return i}function Z8(e,t,n,i,o){return l(n)?n.ready?!0:(QR(e,t,i,o),n.ready):!1}function Lct(e,t,n,i,o){let r,s,a;const c=e._intervals,u=e._frames,d=V_(e,n),h=V_(e,t);if(d>=h){for(r=d;r>=h;--r)if(s=c.get(r),a=u[r],Z8(e,s,a,i,o))return s}else for(r=d;r<=h;++r)if(s=c.get(r),a=u[r],Z8(e,s,a,i,o))return s;return t}function Bct(e,t,n){const i=e._frames,o=i.length;for(let r=0;r<o;++r){const s=i[r];l(s)&&l(s.pointCloud)&&(s.pointCloud.clippingPlanesDirty=t,s.pointCloud.styleDirty=n)}}const ny={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};am.prototype.update=function(e){if(e.mode===le.MORPHING||!this.show)return;l(this._pickId)||(this._pickId=e.context.createPickId({primitive:this})),l(this._loadTimestamp)||(this._loadTimestamp=ie.clone(e.time));const t=Math.max(ie.secondsDifference(e.time,this._loadTimestamp)*1e3,0),n=this._clippingPlanes;let i=0,o=!1;const r=l(n)&&n.enabled;r&&(n.update(e),i=n.clippingPlanesState),this._clippingPlanesState!==i&&(this._clippingPlanesState=i,o=!0);const s=this._styleDirty;this._styleDirty=!1,(o||s)&&Bct(this,o,s),ny.timeSinceLoad=t,ny.isClipped=r;const a=this.shading,c=this._pointCloudEyeDomeLighting,u=e.commandList,d=u.length;let h=this._previousInterval,m=this._nextInterval;const g=bct(this);if(!l(g))return;let p=!1;const y=BF(this),b=y===0;y!==this._clockMultiplier&&(p=!0,this._clockMultiplier=y),(!l(h)||b)&&(h=g),(!l(m)||p||Cct(this,g,m))&&(m=Act(this,g)),h=Lct(this,h,g,ny,e);let C=Oct(this,h);l(C)||(QR(this,h,ny,e),C=this._lastRenderedFrame),l(C)&&$te(this,C,ny,e),l(m)&&QR(this,m,ny,e);const E=this;l(C)&&!l(this._lastRenderedFrame)&&e.afterRender.push(function(){return E._resolveReadyPromise(E),!0}),l(C)&&C!==this._lastRenderedFrame&&E.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return E.frameChanged.raiseEvent(E),!0}),this._previousInterval=h,this._nextInterval=m,this._lastRenderedFrame=C;const w=this._totalMemoryUsageInBytes,S=this.maximumMemoryUsage*1024*1024;w>S&&Yte(this,Pct(e));const L=u.length-d;l(a)&&a.attenuation&&a.eyeDomeLighting&&L>0&&c.update(e,d,a,this.boundingSphere)};am.prototype.isDestroyed=function(){return!1};am.prototype.destroy=function(){return Yte(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),He(this)};const Rct=`// 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;
|
||
}
|
||
gl_FragColor = u_pickColor;
|
||
#else
|
||
gl_FragColor = colorAccum;
|
||
#endif
|
||
}
|
||
`,Nct=`attribute 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);
|
||
}
|
||
`,Mct=`/* 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 };
|
||
`,Fct=`// 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(texture2D(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));
|
||
}
|
||
}
|
||
`,zct=`// 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
|
||
}
|
||
`,Uct=`// 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);
|
||
}
|
||
`,Hct=`// 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
|
||
}
|
||
`,Vct=`// 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_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_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;
|
||
|
||
// Outer ellipsoid
|
||
vec2 outerIntersect = intersectUnitSphereUnnormalizedDirection(ray);
|
||
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 = ray;
|
||
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
|
||
}
|
||
`,pL=`// 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;
|
||
}
|
||
`,kct=`/* 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
|
||
}
|
||
`,Gct=`/* Cylinder defines (set in Scene/VoxelCylinderShape.js)
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT
|
||
#define CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#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
|
||
*/
|
||
|
||
#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) || defined(CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT)
|
||
float radius = length(positionLocal.xy); // [0,1]
|
||
#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) || defined(CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT)
|
||
float height = positionUv.z; // [0,1]
|
||
#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) || defined(CYLINDER_HAS_RENDER_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);
|
||
}
|
||
`,Wct=`/* Ellipsoid defines (set in Scene/VoxelEllipsoidShape.js)
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO
|
||
#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_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE
|
||
#define ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO
|
||
#define ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT
|
||
#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) || defined(ELLIPSOID_HAS_RENDER_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) || defined(ELLIPSOID_HAS_RENDER_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) || defined(ELLIPSOID_HAS_RENDER_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);
|
||
}
|
||
`,jct=`// 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 = texture2D(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 = texture2D(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 = texture2D(u_octreeLeafNodeTexture, leafUv0);
|
||
vec4 leafData1 = texture2D(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);
|
||
}
|
||
}
|
||
`,qct=`// 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 $ct(e){const t=new _a;this.shaderBuilder=t;const n=e._customShader,i=hn(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const m in o)if(o.hasOwnProperty(m)){const g=o[m];t.addUniform(g.type,m,De.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",De.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=l(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([Nct]),t.addFragmentLines([n.fragmentShaderText,"#line 0",Mct]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,De.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,De.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,De.FRAGMENT),t.addFragmentLines([zct])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,De.FRAGMENT),t.addFragmentLines([Fct]));const a=e._provider.shape;a==="BOX"?t.addFragmentLines([Uct,pL,kct]):a==="CYLINDER"?t.addFragmentLines([Hct,pL,Gct]):a==="ELLIPSOID"&&t.addFragmentLines([Vct,pL,Wct]),t.addFragmentLines([jct,qct,Rct]);const c=e._shape,u=c.shaderDefines;for(const m in u)if(u.hasOwnProperty(m)){let g=u[m];l(g)&&(g=g===!0?void 0:g,t.addDefine(m,g,De.FRAGMENT))}let d=c.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",d,De.FRAGMENT),s===1?d+=1:r.unionClippingRegions?d+=2:d+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",d,De.FRAGMENT),d+=1),t.addDefine("INTERSECTION_COUNT",d,De.FRAGMENT),(!f.equals(e.paddingBefore,f.ZERO)||!f.equals(e.paddingAfter,f.ZERO))&&t.addDefine("PADDING",void 0,De.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,De.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,De.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,De.FRAGMENT);const h=e._traversal;t.addDefine("SAMPLE_COUNT",`${h._sampleCount}`,De.FRAGMENT)}function Yct(e,t){const{shaderBuilder:n}=e,{names:i,types:o,componentTypes:r,minimumValues:s,maximumValues:a}=t._provider,c=o.length,u=l(s)&&l(a);n.addDefine("METADATA_COUNT",c,De.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,De.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],U=o[R],D=`PropertyStatistics_${F}`,I=`PropertyStatistics_${F}`;n.addStruct(D,I,De.FRAGMENT);const _=yw(U);n.addStructField(D,_,"min"),n.addStructField(D,_,"max")}const d="Statistics",h="Statistics",m="statistics";n.addStruct(d,h,De.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],U=`PropertyStatistics_${F}`,D=F;n.addStructField(d,U,D)}const g="Metadata",p="Metadata",y="metadata";n.addStruct(g,p,De.FRAGMENT),n.addStructField(g,h,m);for(let R=0;R<c;R++){const F=i[R],U=o[R],D=yw(U);n.addStructField(g,D,F)}for(let R=0;R<c;R++){const F=i[R],U=o[R],D=Kct(U),I=`VoxelProperty_${F}`,_=`VoxelProperty_${F}`;n.addStruct(I,_,De.FRAGMENT),n.addStructField(I,D,"partialDerivativeLocal"),n.addStructField(I,D,"partialDerivativeWorld"),n.addStructField(I,D,"partialDerivativeView"),n.addStructField(I,D,"partialDerivativeValid")}const b="Voxel",C="Voxel",E="voxel";n.addStruct(b,C,De.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],U=`VoxelProperty_${F}`;n.addStructField(b,U,F)}n.addStructField(b,"vec3","positionEC"),n.addStructField(b,"vec3","positionUv"),n.addStructField(b,"vec3","positionShapeUv"),n.addStructField(b,"vec3","positionUvLocal"),n.addStructField(b,"vec3","viewDirUv"),n.addStructField(b,"vec3","viewDirWorld"),n.addStructField(b,"float","travelDistance");const w="FragmentInput",S="FragmentInput";n.addStruct(w,S,De.FRAGMENT),n.addStructField(w,p,y),n.addStructField(w,C,E);const P="Properties",L="Properties",z="properties";n.addStruct(P,L,De.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],U=o[R],D=yw(U);n.addStructField(P,D,F)}{const R="clearProperties";n.addFunction(R,`${L} clearProperties()`,De.FRAGMENT),n.addFunctionLines(R,[`${L} ${z};`]);for(let F=0;F<c;F++){const U=i[F],D=o[F];r[F];const I=yw(D);n.addFunctionLines(R,[`${z}.${U} = ${I}(0.0);`])}n.addFunctionLines(R,[`return ${z};`])}{const R="sumProperties";n.addFunction(R,`${L} sumProperties(${L} propertiesA, ${L} propertiesB)`,De.FRAGMENT),n.addFunctionLines(R,[`${L} ${z};`]);for(let F=0;F<c;F++){const U=i[F];n.addFunctionLines(R,[`${z}.${U} = propertiesA.${U} + propertiesB.${U};`])}n.addFunctionLines(R,[`return ${z};`])}{const R="scaleProperties";n.addFunction(R,`${L} scaleProperties(${L} ${z}, float scale)`,De.FRAGMENT),n.addFunctionLines(R,[`${L} scaledProperties = ${z};`]);for(let F=0;F<c;F++){const U=i[F];n.addFunctionLines(R,[`scaledProperties.${U} *= scale;`])}n.addFunctionLines(R,["return scaledProperties;"])}{const R="mixProperties";n.addFunction(R,`${L} mixProperties(${L} propertiesA, ${L} propertiesB, float mixFactor)`,De.FRAGMENT),n.addFunctionLines(R,[`${L} ${z};`]);for(let F=0;F<c;F++){const U=i[F];n.addFunctionLines(R,[`${z}.${U} = mix(propertiesA.${U}, propertiesB.${U}, mixFactor);`])}n.addFunctionLines(R,[`return ${z};`])}{const R="copyPropertiesToMetadata";n.addFunction(R,`void copyPropertiesToMetadata(in ${L} ${z}, inout ${p} ${y})`,De.FRAGMENT);for(let F=0;F<c;F++){const U=i[F];n.addFunctionLines(R,[`${y}.${U} = ${z}.${U};`])}}if(u){const R="setStatistics";n.addFunction(R,`void setStatistics(inout ${h} ${m})`,De.FRAGMENT);for(let F=0;F<c;F++){const U=i[F],D=o[F],I=Bt.getComponentCount(D);for(let _=0;_<I;_++){const v=Jct(D,_),O=s[F][_],N=a[F][_];n.addFunctionLines(R,[`${m}.${U}.min${v} = ${e6(O)};`,`${m}.${U}.max${v} = ${e6(N)};`])}}}{const R="getPropertiesFromMegatextureAtUv";n.addFunction(R,`${L} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,De.FRAGMENT),n.addFunctionLines(R,[`${L} ${z};`]);for(let F=0;F<c;F++){const U=i[F],D=o[F];r[F];const I=Xct(D);n.addFunctionLines(R,[`properties.${U} = texture2D(u_megatextureTextures[${F}], texcoord)${I};`])}n.addFunctionLines(R,[`return ${z};`])}}function yw(e){if(e===Bt.SCALAR)return"float";if(e===Bt.VEC2)return"vec2";if(e===Bt.VEC3)return"vec3";if(e===Bt.VEC4)return"vec4"}function Xct(e){if(e===Bt.SCALAR)return".r";if(e===Bt.VEC2)return".ra";if(e===Bt.VEC3)return".rgb";if(e===Bt.VEC4)return""}function Kct(e){if(e===Bt.SCALAR)return"vec3";if(e===Bt.VEC2)return"mat2";if(e===Bt.VEC3)return"mat3";if(e===Bt.VEC4)return"mat4"}function e6(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function Jct(e,t){return e===Bt.SCALAR?"":`[${t}]`}function Qct(e,t){const n=new $ct(e);Yct(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const p="getClippingPlane",y=UM(o,t),b=0,C=y.indexOf(")")+1,E=y.indexOf("{",C)+1,w=y.indexOf("}",E),S=y.slice(b,C),P=y.slice(E,w);i.addFunction(p,S,De.FRAGMENT),i.addFunctionLines(p,[P])}const s=i.clone();s.addDefine("PICKING",void 0,De.FRAGMENT);const a=i.buildShaderProgram(t),c=s.buildShaderProgram(t),u=et.fromCache({cull:{enabled:!0,face:Ho.BACK},depthTest:{enabled:!1},depthMask:!1,blending:Gi.PRE_MULTIPLIED_ALPHA_BLEND}),d=t.getViewportQuadVertexArray(),h=e._depthTest,m=new mt({vertexArray:d,primitiveType:Ze.TRIANGLES,renderState:u,shaderProgram:a,uniformMap:n.uniformMap,pass:Ne.VOXELS,executeInClosestFrustum:!0,owner:this,cull:h,occlude:h}),g=mt.shallowClone(m,new mt);if(g.shaderProgram=c,g.pickOnly=!0,l(e._drawCommand)){const p=e._drawCommand;p.shaderProgram=p.shaderProgram&&p.shaderProgram.destroy()}if(l(e._drawCommandPick)){const p=e._drawCommandPick;p.shaderProgram=p.shaderProgram&&p.shaderProgram.destroy()}e._drawCommand=m,e._drawCommandPick=g}function zf(e,t,n,i,o,r,s){this._primitive=e;const a=i.length;this.megatextures=new Array(a);for(let P=0;P<a;P++){const L=i[P],z=Bt.getComponentCount(L),R=o[P];this.megatextures[P]=new ch(t,n,z,R,s)}const c=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const u=e._shape,d=0,h=0,m=0,g=0,p=void 0;this.rootNode=new Il(d,h,m,g,p,u,n),this._priorityQueue=new yu({maximumLength:c,comparator:Li.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 y(P,L,z,R){if(L>z)return;const F=Math.floor((L+z)/2);P[F]=R,y(P,L,F-1,R+1),y(P,F+1,z,R+1)}const b=this._binaryTreeKeyframeWeighting;b[0]=0,b[r-1]=0,y(b,1,r-2,0);const C=9,E=2048,w=Math.floor(E/C),S=Math.ceil(c/w);this.internalNodeTexture=new Wt({context:t,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,flipY:!1,width:E,height:S,sampler:new ii({minificationFilter:In.NEAREST,magnificationFilter:Kr.NEAREST})}),this.internalNodeTilesPerRow=w,this.internalNodeTexelSizeUv=new j(1/E,1/S),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new j}zf.simultaneousRequestCountMaximum=50;zf.prototype.update=function(e,t,n,i){const o=this._primitive,r=e.context,s=this.megatextures[0].maximumTileCount,a=this._keyframeCount,c=o._levelBlendFactor,u=c>0,d=a>1,h=(u?2:1)*(d?2:1);this._sampleCount=h;const m=h>=2;if(m&&!l(this.leafNodeTexture)){const E=Math.floor(512),w=Math.ceil(s/E);this.leafNodeTexture=new Wt({context:r,pixelFormat:rt.RGBA,pixelDatatype:Qe.UNSIGNED_BYTE,flipY:!1,width:1024,height:w,sampler:new ii({minificationFilter:In.NEAREST,magnificationFilter:Kr.NEAREST})}),this.leafNodeTexelSizeUv=j.fromElements(1/1024,1/w,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=E}else!m&&l(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=M.clamp(t,0,a-1),n&&Xte(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const g=fr();tlt(this,e);const p=fr();olt(this,h,c);const y=fr();if(this._debugPrint){const b=p-g,C=y-p,E=y-g;ilt(this,b,C,E)}};zf.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};zf.prototype.isDestroyed=function(){return!1};zf.prototype.destroy=function(){const 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(),He(this)};function Xte(e,t){const n=e._primitive,i=n._shape,o=n._provider.dimensions;if(t.computeBoundingVolumes(i,o),l(t.children))for(let r=0;r<8;r++){const s=t.children[r];Xte(e,s)}}function Zct(e,t){if(e._simultaneousRequestCount>=zf.simultaneousRequestCountMaximum)return;const n=e._primitive,i=n._provider,o=t.keyframe,r=t.spatialNode,s=r.level,a=r.x,c=r.y,u=r.z;function d(g){e._simultaneousRequestCount--;const p=n._provider.types.length;if(!l(g))t.state=Li.LoadState.UNAVAILABLE;else if(g===Li.LoadState.FAILED)t.state=Li.LoadState.FAILED;else if(!Array.isArray(g)||g.length!==p)t.state=Li.LoadState.FAILED;else{const y=e.megatextures;for(let b=0;b<p;b++){const{voxelCountPerTile:C,channelCount:E}=y[b],{x:w,y:S,z:P}=C,L=w*S*P,z=g[b],R=L*E;if(z.length===R)t.metadatas[b]=z,t.state=Li.LoadState.RECEIVED;else{t.state=Li.LoadState.FAILED;break}}}}function h(){e._simultaneousRequestCount--,t.state=Li.LoadState.FAILED}const m=i.requestData({tileLevel:s,tileX:a,tileY:c,tileZ:u,keyframe:o});l(m)?(e._simultaneousRequestCount++,t.state=Li.LoadState.RECEIVING,m.then(d).catch(h)):t.state=Li.LoadState.FAILED}function elt(e){return e/(1+e)}function tlt(e,t){const n=e._frameNumber,i=e._primitive,o=i._shape,r=i._provider.dimensions,s=i._screenSpaceError,a=e._priorityQueue,c=e._keyframeLocation,u=e._keyframeCount,d=e.rootNode,h=t.camera.positionWC,m=t.camera.frustum.sseDenominator,p=t.context.drawingBufferHeight/t.pixelRatio/m;function y(R,F){if(R.computeScreenSpaceError(h,p),F=R.visibility(t,F),F===ar.MASK_OUTSIDE)return;R.visitedFrameNumber=n;const U=M.clamp(Math.floor(c),0,u-2),D=U+1;if(u===1)R.createKeyframeNode(0);else if(R.keyframeNodes.length!==u)for(let N=0;N<u;N++)R.createKeyframeNode(N);const I=elt(R.screenSpaceError);let _=!1;const v=R.keyframeNodes;for(let N=0;N<v.length;N++){const V=v[N],k=V.keyframe,G=Math.min(Math.abs(k-U),Math.abs(k-D)),W=Math.max(U,u-D-1,1),K=Math.pow(1-G/W,4),q=Math.exp(-e._binaryTreeKeyframeWeighting[k]);V.priority=10*I,V.priority+=M.lerp(q,K,.15+.85*K),V.state!==Li.LoadState.UNAVAILABLE&&V.state!==Li.LoadState.FAILED&&V.priority!==-Number.MAX_VALUE&&a.insert(V),V.state===Li.LoadState.LOADED&&(_=!0)}if(R.screenSpaceError<s||!_){R.children=void 0;return}if(!l(R.children)){const N=nlt(R),V=R.level+1;R.children=N.map(([k,G,W])=>new Il(V,k,G,W,R,o,r))}for(let N=0;N<8;N++){const V=R.children[N];y(V,F)}}a.reset(),y(d,ar.MASK_INDETERMINATE);const b=e._highPriorityKeyframeNodes;let C=0,E;for(;a.length>0;)E=a.removeMaximum(),E.highPriorityFrameNumber=n,b[C]=E,C++;const w=e._keyframeNodesInMegatexture,S=e.megatextures[0],P=S.occupiedCount;w.length=P,w.sort(function(R,F){return R.highPriorityFrameNumber===F.highPriorityFrameNumber?F.priority-R.priority:F.highPriorityFrameNumber-R.highPriorityFrameNumber});let L=0,z=0;for(let R=0;R<C;R++)if(E=b[R],!(E.state===Li.LoadState.LOADED||E.spatialNode===void 0)&&(E.state===Li.LoadState.UNLOADED&&Zct(e,E),E.state===Li.LoadState.RECEIVED)){let F=0;if(S.isFull()){F=P-1-L,L++;const U=w[F];U.spatialNode.destroyKeyframeNode(U,e.megatextures)}else F=P+z,z++;E.spatialNode.addKeyframeNodeToMegatextures(E,e.megatextures),w[F]=E}}function nlt(e){const{x:t,y:n,z:i}=e,o=t*2,r=n*2,s=i*2,a=r+1,c=o+1,u=s+1;return[[o,r,s],[c,r,s],[o,a,s],[c,a,s],[o,r,u],[c,r,u],[o,a,u],[c,a,u]]}function ilt(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(Li.LoadState).length,a=new Array(s),c=new Array(s);let u=0;for(let C=0;C<s;C++){const E=new Array(o);a[C]=E;for(let w=0;w<o;w++)E[w]=0;c[C]=0}function d(C){const E=C.keyframeNodes;for(let w=0;w<E.length;w++){const S=E[w],P=S.keyframe,L=S.state;a[L][P]+=1,c[L]+=1,u++}if(l(C.children))for(let w=0;w<8;w++){const S=C.children[w];d(S)}}d(r);const h=`KEYFRAMES: ${a[Li.LoadState.LOADED]}`,m=`UNLOADED: ${c[Li.LoadState.UNLOADED]} | RECEIVING: ${c[Li.LoadState.RECEIVING]} | RECEIVED: ${c[Li.LoadState.RECEIVED]} | LOADED: ${c[Li.LoadState.LOADED]} | FAILED: ${c[Li.LoadState.FAILED]} | UNAVAILABLE: ${c[Li.LoadState.UNAVAILABLE]} | TOTAL: ${u}`,g=Math.round(t*100)/100,p=Math.round(n*100)/100,y=Math.round(i*100)/100,b=`LOAD: ${g} | OCT: ${p} | ALL: ${y}`;console.log(`${h} || ${m} || ${b}`)}const Aw={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function olt(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,c=0;const u=[],d=[];function h(g,p,y,b,C){let E=!1;if(l(g.children))for(let w=0;w<8;w++){const S=g.children[w];S.computeSurroundingRenderableKeyframeNodes(o),S.isRenderable(r)&&(E=!0)}if(E){u[C]=Aw.INTERNAL<<16|p,u[y]=b,a++,b=p,C=b*9+1;for(let w=0;w<8;w++){const S=g.children[w];p=a,y=p*9+0,h(S,p,y,b,C+w)}}else{if(s){const w=c*5,S=g.renderableKeyframeNodePrevious,P=g.level-S.spatialNode.level,L=S.spatialNode.parent,z=l(L)?L.renderableKeyframeNodePrevious:S,R=rlt(g,i,n),F=P,U=1,D=S.megatextureIndex,I=z.megatextureIndex;d[w+0]=R,d[w+1]=F,d[w+2]=U,d[w+3]=D,d[w+4]=I,u[C]=Aw.LEAF<<16|c}else{const w=g.renderableKeyframeNodePrevious,P=g.level-w.spatialNode.level===0?Aw.LEAF:Aw.PACKED_LEAF_FROM_PARENT;u[C]=P<<16|w.megatextureIndex}c++}}const m=e.rootNode;m.computeSurroundingRenderableKeyframeNodes(o),m.isRenderable(r)&&h(m,0,0,0,0),slt(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&alt(d,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function rlt(e,t,n){if(e.parent===void 0)return 0;const i=e.screenSpaceError,o=e.parent.screenSpaceError,s=((t-i)/(o-i)+n-1)/n;return M.clamp(s,0,1)}function slt(e,t,n,i){const 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 h=0;h<e.length;h++){const m=e[h],g=h*o;for(let p=0;p<o;p++)c[g+p]=m>>>p*8&255}const d={source:{arrayBufferView:c,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(d)}function alt(e,t,n,i){const 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)),u=new Uint8Array(a*c*o);for(let m=0;m<s;m++){const g=e[m*r+0],p=e[m*r+1],y=e[m*r+2],b=e[m*r+3],C=e[m*r+4],E=M.clamp(Math.floor(65536*g),0,65535);u[m*8+0]=E>>>0&255,u[m*8+1]=E>>>8&255,u[m*8+2]=p&255,u[m*8+3]=y&255,u[m*8+4]=b>>>0&255,u[m*8+5]=b>>>8&255,u[m*8+6]=C>>>0&255,u[m*8+7]=C>>>8&255}const h={source:{arrayBufferView:u,width:a,height:c},xOffset:0,yOffset:0};i.copyFrom(h)}zf.getApproximateTextureMemoryByteLength=function(e,t,n,i){let o=0;const r=n.length;for(let s=0;s<r;s++){const a=n[s],c=i[s],u=Bt.getComponentCount(a);o+=ch.getApproximateTextureMemoryByteLength(e,t,u,c)}return o};const clt={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"},ZR=Object.freeze(clt);function X0(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}X0.prototype.getTexture=function(e){return this._textures[e]};function llt(e,t,n){n.resource.fetchImage().then(function(i){e._loadedImages.push({id:t,image:i,textureUniform:n})}).catch(function(){const i=e._textures[t];l(i)&&i!==e._defaultTexture&&i.destroy(),e._textures[t]=e._defaultTexture})}X0.prototype.loadTexture2D=function(e,t){l(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):llt(this,e,t)};function ult(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?mS(o,r,n):dlt(o,r,n),a=e._textures[i];l(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function mS(e,t,n){const{typedArray:i,sampler:o}=e,r=l(i)?Jte(e,n):new Wt({context:n,source:t,sampler:o});return Kte(o)&&r.generateMipmap(),r}function dlt(e,t,n){const{typedArray:i,sampler:o}=e,r=Kte(o),s=o.wrapS===Fi.REPEAT||o.wrapS===Fi.MIRRORED_REPEAT||o.wrapT===Fi.REPEAT||o.wrapT===Fi.MIRRORED_REPEAT,{width:a,height:c}=l(i)?e:t,u=[a,c].every(M.isPowerOfTwo);if((r||s)&&!u)if(l(i)){if(e.pixelDatatype===Qe.UNSIGNED_BYTE){const h=oat(i,a,c),m=_R(h);return mS({sampler:o},m,n)}}else{const h=_R(t);return mS(e,h,n)}else return mS(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."),Jte(e,n)}function Kte(e){return[In.NEAREST_MIPMAP_NEAREST,In.NEAREST_MIPMAP_LINEAR,In.LINEAR_MIPMAP_NEAREST,In.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function Jte(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new Wt({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}X0.prototype.update=function(e){if(e.frameNumber===this._lastUpdatedFrame)return;this._lastUpdatedFrame=e.frameNumber;const t=e.context;this._defaultTexture=t.defaultTexture;const n=this._loadedImages;for(let i=0;i<n.length;i++){const o=n[i];ult(this,o,t)}n.length=0};X0.prototype.isDestroyed=function(){return!1};X0.prototype.destroy=function(){const e=this._textures;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];n!==this._defaultTexture&&n.destroy()}return He(this)};function QT(e){e=A(e,A.EMPTY_OBJECT),this.mode=A(e.mode,X2.MODIFY_MATERIAL),this.lightingModel=e.lightingModel,this.uniforms=A(e.uniforms,A.EMPTY_OBJECT),this.varyings=A(e.varyings,A.EMPTY_OBJECT),this.vertexShaderText=e.vertexShaderText,this.fragmentShaderText=e.fragmentShaderText,this.translucencyMode=A(e.translucencyMode,wR.INHERIT),this._textureManager=new X0,this._defaultTexture=void 0,this.uniformMap=flt(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},mlt(this),_lt(this)}function flt(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===ZR.SAMPLER_CUBE)throw new x("CustomShader does not support samplerCube uniforms");r===ZR.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=hlt(e,i)):n[i]=plt(e,i)}return n}function hlt(e,t){return function(){return A(e._textureManager.getTexture(t),e._defaultTexture)}}function plt(e,t){return function(){return e.uniforms[t].value}}function zm(e,t,n){let i;for(;(i=t.exec(e))!==null;){const o=i[1];n[o]=!0}}function mlt(e){const t=/[vf]sInput\.attributes\.(\w+)/g,n=/[vf]sInput\.featureIds\.(\w+)/g,i=/[vf]sInput\.metadata.(\w+)/g;let o;const r=e.vertexShaderText;l(r)&&(o=e.usedVariablesVertex.attributeSet,zm(r,t,o),o=e.usedVariablesVertex.featureIdSet,zm(r,n,o),o=e.usedVariablesVertex.metadataSet,zm(r,i,o));const s=e.fragmentShaderText;if(l(s)){o=e.usedVariablesFragment.attributeSet,zm(s,t,o),o=e.usedVariablesFragment.featureIdSet,zm(s,n,o),o=e.usedVariablesFragment.metadataSet,zm(s,i,o);const a=/material\.(\w+)/g,c=e.usedVariablesFragment.materialSet;zm(s,a,c)}}function t6(e){const 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 Ws(e,t,n,i){if(e.hasOwnProperty(t)){const o=`${t6(t)} is not available in the ${i} shader. Did you mean ${t6(n)} instead?`;throw new x(o)}}function _lt(e){const t=e.usedVariablesVertex.attributeSet;Ws(t,"position","positionMC","vertex"),Ws(t,"normal","normalMC","vertex"),Ws(t,"tangent","tangentMC","vertex"),Ws(t,"bitangent","bitangentMC","vertex"),Ws(t,"positionWC","positionMC","vertex"),Ws(t,"positionEC","positionMC","vertex"),Ws(t,"normalEC","normalMC","vertex"),Ws(t,"tangentEC","tangentMC","vertex"),Ws(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;Ws(n,"position","positionEC","fragment"),Ws(n,"normal","normalEC","fragment"),Ws(n,"tangent","tangentEC","fragment"),Ws(n,"bitangent","bitangentEC","fragment"),Ws(n,"normalMC","normalEC","fragment"),Ws(n,"tangentMC","tangentEC","fragment"),Ws(n,"bitangentMC","bitangentEC","fragment")}QT.prototype.setUniform=function(e,t){if(T.typeOf.string("uniformName",e),T.defined("value",t),!l(this.uniforms[e]))throw new x(`Uniform ${e} must be declared in the CustomShader constructor.`);const n=this.uniforms[e];n.type===ZR.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):l(t.clone)?n.value=t.clone(n.value):n.value=t};QT.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};QT.prototype.isDestroyed=function(){return!1};QT.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),He(this)};function Au(e){e=A(e,A.EMPTY_OBJECT),this._ready=!1,this._provider=A(e.provider,Au.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new f,this._paddingAfter=new f,this._minBounds=new f,this._minBoundsOld=new f,this._maxBounds=new f,this._maxBoundsOld=new f,this._minClippingBounds=new f,this._minClippingBoundsOld=new f,this._maxClippingBounds=new f,this._maxClippingBoundsOld=new f,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._compoundModelMatrix=new B,this._compoundModelMatrixOld=new B,this._customShader=A(e.customShader,Au.DefaultCustomShader),this._customShaderCompilationEvent=new Ke,this._shaderDirty=!0,this._drawCommand=void 0,this._drawCommandPick=void 0,this._pickId=void 0,this._clock=e.clock,this._transformPositionWorldToUv=new B,this._transformPositionUvToWorld=new B,this._transformDirectionWorldToLocal=new J,this._transformNormalLocalToWorld=new J,this._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 Qa,this._debugDraw=!1,this._disableRender=!1,this._disableUpdate=!1,this._uniforms={octreeInternalNodeTexture:void 0,octreeInternalNodeTilesPerRow:0,octreeInternalNodeTexelSizeUv:new j,octreeLeafNodeTexture:void 0,octreeLeafNodeTilesPerRow:0,octreeLeafNodeTexelSizeUv:new j,megatextureTextures:[],megatextureSliceDimensions:new j,megatextureTileDimensions:new j,megatextureVoxelSizeUv:new j,megatextureSliceSizeUv:new j,megatextureTileSizeUv:new j,dimensions:new f,paddingBefore:new f,paddingAfter:new f,transformPositionViewToUv:new B,transformPositionUvToView:new B,transformDirectionViewToLocal:new J,transformNormalLocalToWorld:new J,cameraPositionUv:new f,ndcSpaceAxisAlignedBoundingBox:new oe,clippingPlanesTexture:void 0,clippingPlanesMatrix:new B,stepSize:0,pickColor:new H},this._shapeDefinesOld={},this._uniformMap={};const t=this._uniforms,n=this._uniformMap;for(const o in t)if(t.hasOwnProperty(o)){const r=`u_${o}`;n[r]=function(){return t[o]}}const i=this._provider;this._completeLoad=function(o,r){},this._readyPromise=glt(this,i)}function glt(e,t){const 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(Au.prototype,{ready:{get:function(){return this._ready}},readyPromise:{get:function(){return this._readyPromise}},provider:{get:function(){return this._provider}},boundingSphere:{get:function(){if(!this._ready)throw new x("boundingSphere must not be called before the primitive is ready.");return this._shape.boundingSphere}},orientedBoundingBox:{get:function(){if(!this._ready)throw new x("orientedBoundingBox must not be called before the primitive is ready.");return this._shape.orientedBoundingBox}},modelMatrix:{get:function(){return this._modelMatrix},set:function(e){T.typeOf.object("modelMatrix",e),this._modelMatrix=B.clone(e,this._modelMatrix)}},shape:{get:function(){if(!this._ready)throw new x("shape must not be called before the primitive is ready.");return this._provider.shape}},dimensions:{get:function(){if(!this._ready)throw new x("dimensions must not be called before the primitive is ready.");return this._provider.dimensions}},minimumValues:{get:function(){if(!this._ready)throw new x("minimumValues must not be called before the primitive is ready.");return this._provider.minimumValues}},maximumValues:{get:function(){if(!this._ready)throw new x("maximumValues must not be called before the primitive is ready.");return this._provider.maximumValues}},show:{get:function(){return!this._disableRender},set:function(e){T.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){T.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){T.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){T.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){T.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){T.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){T.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=M.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){T.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){T.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){T.defined("minBounds",e),this._minBounds=f.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){T.defined("maxBounds",e),this._maxBounds=f.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){T.defined("minClippingBounds",e),this._minClippingBounds=f.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){T.defined("maxClippingBounds",e),this._maxClippingBounds=f.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Io.setOwner(e,this,"_clippingPlanes")}},customShader:{get:function(){return this._customShader},set:function(e){if(this._customShader!==e){const t=this._uniformMap,i=this._customShader.uniformMap;for(const o in i)i.hasOwnProperty(o)&&delete t[o];l(e)?this._customShader=e:this._customShader=Au.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const ylt=new f,Alt=new oe,blt=new oe,Clt=new f,Tlt=new f,Elt=new J,xlt=new J,wlt=new B,Slt=new B,vlt=new B,Dlt=B.fromRotationTranslation(J.fromUniformScale(.5,new J),new f(.5,.5,.5),new B),Ilt=B.fromRotationTranslation(J.fromUniformScale(2,new J),new f(-1,-1,-1),new B);Au.prototype.update=function(e){const t=this._provider;if(this._customShader.update(e),!this._ready&&!t.ready)return;const n=e.context;if(!this._ready){Plt(this,t,n),this._completeLoad(this,e);return}const i=Qte(this,t),o=this._shape;if(i&&(this._shapeVisible=Zte(this,o,t),Blt(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=Rlt(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&&klt(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),Nlt(this,e)&&(this._shaderDirty=!0);const u=s.leafNodeTexture,d=this._uniforms;l(u)&&(d.octreeLeafNodeTexture=s.leafNodeTexture,d.octreeLeafNodeTexelSizeUv=j.clone(s.leafNodeTexelSizeUv,d.octreeLeafNodeTexelSizeUv),d.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(Qct(this,n),this._shaderDirty=!1);const h=n.uniformState.viewProjection,m=o.orientedBoundingBox,g=zlt(m,h,blt);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;d.ndcSpaceAxisAlignedBoundingBox=oe.clone(g,d.ndcSpaceAxisAlignedBoundingBox);const y=n.uniformState.inverseView;d.transformPositionViewToUv=B.multiply(this._transformPositionWorldToUv,y,d.transformPositionViewToUv);const b=n.uniformState.view;d.transformPositionUvToView=B.multiply(b,this._transformPositionUvToWorld,d.transformPositionUvToView);const C=n.uniformState.inverseViewRotation;d.transformDirectionViewToLocal=J.multiply(this._transformDirectionWorldToLocal,C,d.transformDirectionViewToLocal),d.transformNormalLocalToWorld=J.clone(this._transformNormalLocalToWorld,d.transformNormalLocalToWorld);const E=e.camera.positionWC;d.cameraPositionUv=B.multiplyByPoint(this._transformPositionWorldToUv,E,d.cameraPositionUv),d.stepSize=this._stepSizeUv*this._stepSizeMultiplier;const w=e.passes.pick?this._drawCommandPick:this._drawCommand;w.boundingVolume=o.boundingSphere,e.commandList.push(w)};function Plt(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=H.clone(e._pickId.color,i.pickColor);const{shape:o,minBounds:r=yy.getMinBounds(o),maxBounds:s=yy.getMaxBounds(o)}=t;e.minBounds=r,e.maxBounds=s,e.minClippingBounds=yy.getMinBounds(o),e.maxClippingBounds=yy.getMaxBounds(o),Qte(e,t);const a=yy.getShapeConstructor(o);e._shape=new a,e._shapeVisible=Zte(e,e._shape,t);const{shaderDefines:c,shaderUniforms:u}=e._shape;e._shapeDefinesOld=ht(c,!0);const d=e._uniformMap;for(const h in u)if(u.hasOwnProperty(h)){const m=`u_${h}`;l(d[m])&&ki(`VoxelPrimitive: Uniform name "${m}" is already defined`),d[m]=function(){return u[h]}}i.dimensions=f.clone(t.dimensions,i.dimensions),e._paddingBefore=f.clone(A(t.paddingBefore,f.ZERO),e._paddingBefore),i.paddingBefore=f.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=f.clone(A(t.paddingAfter,f.ZERO),e._paddingBefore),i.paddingAfter=f.clone(e._paddingAfter,i.paddingAfter),e._traversal=Olt(e,t,n),Llt(e._traversal,i)}function Qte(e,t){const n=A(t.shapeTransform,B.IDENTITY),i=A(t.globalTransform,B.IDENTITY);return B.multiplyTransformation(i,e._modelMatrix,e._compoundModelMatrix),B.multiplyTransformation(e._compoundModelMatrix,n,e._compoundModelMatrix),eb(e,"_compoundModelMatrix","_compoundModelMatrixOld")+eb(e,"_minBounds","_minBoundsOld")+eb(e,"_maxBounds","_maxBoundsOld")+eb(e,"_minClippingBounds","_minClippingBoundsOld")+eb(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function eb(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function Zte(e,t,n){if(!t.update(e._compoundModelMatrix,e.minBounds,e.maxBounds,e.minClippingBounds,e.maxClippingBounds))return!1;const o=t.shapeTransform,r=B.inverse(o,wlt),s=B.getRotation(o,Elt),a=B.getScale(o,Clt),c=f.maximumComponent(a),u=f.divideByScalar(a,c,Tlt),d=J.multiplyByScale(s,u,xlt),h=n.dimensions;return e._stepSizeUv=t.computeApproximateStepSize(h),e._transformPositionWorldToUv=B.multiply(Dlt,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=B.multiply(o,Ilt,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=B.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=J.inverseTranspose(d,e._transformNormalLocalToWorld),!0}function Olt(e,t,n){const i=f.clone(t.dimensions,ylt);f.add(i,e._paddingBefore,i),f.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=l(o)?zf.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=A(t.keyframeCount,1);return new zf(e,n,i,t.types,t.componentTypes,s,r)}function Llt(e,t){t.octreeInternalNodeTexture=e.internalNodeTexture,t.octreeInternalNodeTexelSizeUv=j.clone(e.internalNodeTexelSizeUv,t.octreeInternalNodeTexelSizeUv),t.octreeInternalNodeTilesPerRow=e.internalNodeTilesPerRow;const 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=j.clone(i.sliceCountPerRegion,t.megatextureSliceDimensions),t.megatextureTileDimensions=j.clone(i.regionCountPerMegatexture,t.megatextureTileDimensions),t.megatextureVoxelSizeUv=j.clone(i.voxelSizeUv,t.megatextureVoxelSizeUv),t.megatextureSliceSizeUv=j.clone(i.sliceSizeUv,t.megatextureSliceSizeUv),t.megatextureTileSizeUv=j.clone(i.regionSizeUv,t.megatextureTileSizeUv)}function Blt(e,t){const n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=ht(n,!0)),i}function Rlt(e,t){if(!l(e)||!l(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));const r=ie.secondsDifference(i.stop,i.start),a=ie.secondsDifference(n,i.start)/r;return o+a}function Nlt(e,t){const n=e.clippingPlanes;if(!l(n))return!1;n.update(t);const{clippingPlanesState:i,enabled:o}=n;if(o){const r=e._uniforms;r.clippingPlanesTexture=n.texture,r.clippingPlanesMatrix=B.transpose(B.multiplyTransformation(B.inverse(n.modelMatrix,r.clippingPlanesMatrix),e._transformPositionUvToWorld,r.clippingPlanesMatrix),r.clippingPlanesMatrix)}return e._clippingPlanesState===i&&e._clippingPlanesEnabled===o?!1:(e._clippingPlanesState=i,e._clippingPlanesEnabled=o,!0)}Au.prototype.isDestroyed=function(){return!1};Au.prototype.destroy=function(){const e=this._drawCommand;l(e)&&(e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy());const t=this._drawCommandPick;return l(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(),He(this)};const n6=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)),Mlt=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),Flt=new Array(new oe,new oe,new oe,new oe,new oe,new oe,new oe,new oe);function zlt(e,t,n){const i=B.fromRotationTranslation(e.halfAxes,e.center,Slt),o=B.multiply(t,i,vlt);let r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,c=-Number.MAX_VALUE,u;const d=Flt,h=n6.length;for(u=0;u<h;u++)B.multiplyByVector(o,n6[u],d[u]);for(u=0;u<h;u++){const m=d[u];if(m.z>=-m.w){const g=m.x/m.w,p=m.y/m.w;r=Math.min(r,g),s=Math.max(s,g),a=Math.min(a,p),c=Math.max(c,p)}else for(let g=0;g<3;g++){const p=Mlt[u*3+g],y=d[p];if(y.z>=-y.w){const b=m.z+m.w,C=y.z+y.w,E=b/(b-C),w=oe.lerp(m,y,E,Alt),S=w.x/w.w,P=w.y/w.w;r=Math.min(r,S),s=Math.max(s,S),a=Math.min(a,P),c=Math.max(c,P)}}}return r=M.clamp(r,-1,1),a=M.clamp(a,-1,1),s=M.clamp(s,-1,1),c=M.clamp(c,-1,1),n=oe.fromElements(r,a,s,c,n),n}const RF=3e7,Ult=new f(RF,0,0),Hlt=new f(0,RF,0),Vlt=new f(0,0,RF);function klt(e,t){const n=e._traversal,i=e._debugPolylines;i.removeAll();function o(c,u,d,h){i.add({positions:[c,u],width:h,material:ze.fromType("Color",{color:d})})}function r(c,u,d){const h=c.computeCorners();o(h[0],h[1],u,d),o(h[2],h[3],u,d),o(h[4],h[5],u,d),o(h[6],h[7],u,d),o(h[0],h[2],u,d),o(h[4],h[6],u,d),o(h[1],h[3],u,d),o(h[5],h[7],u,d),o(h[0],h[4],u,d),o(h[2],h[6],u,d),o(h[1],h[5],u,d),o(h[3],h[7],u,d)}function s(c){if(!n.isRenderable(c))return;const u=c.level,h=Math.max(1,5/Math.pow(2,u)),g=[H.RED,H.LIME,H.BLUE][u%3];if(r(c.orientedBoundingBox,g,h),l(c.children))for(let p=0;p<8;p++)s(c.children[p])}r(e._shape.orientedBoundingBox,H.WHITE,5),s(n.rootNode);const a=10;o(f.ZERO,Ult,H.RED,a),o(f.ZERO,Hlt,H.LIME,a),o(f.ZERO,Vlt,H.BLUE,a),i.update(t)}Au.DefaultCustomShader=new QT({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
|
||
{
|
||
material.diffuse = vec3(1.0);
|
||
material.alpha = 1.0;
|
||
}`});function ene(){this.ready=!0,this.readyPromise=Promise.resolve(this),this.shape=yy.BOX,this.dimensions=new f(1,1,1),this.names=["data"],this.types=[Bt.SCALAR],this.componentTypes=[$t.FLOAT32],this.maximumTileCount=1}ene.prototype.requestData=function(e){if(!((l(e)?A(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};Au.DefaultProvider=new ene;function iI(e,t){const n=t.terrainProvider,i=t.mapProjection,o=i.ellipsoid;let r;const s=t.camera.getRectangleCameraCoordinates(e);return t.mode===le.SCENE3D?r=o.cartesianToCartographic(s):r=i.unproject(s),l(n)?n.readyPromise.then(function(){const a=n.availability;if(!l(a)||t.mode===le.SCENE2D)return r;const c=[ge.center(e),ge.southeast(e),ge.southwest(e),ge.northeast(e),ge.northwest(e)];return iI._sampleTerrainMostDetailed(n,c).then(function(u){const d=u.reduce(function(m,g){return Math.max(g.height,m)},-Number.MAX_VALUE),h=r;return h.height+=d,h})}):Promise.resolve(r)}iI._sampleTerrainMostDetailed=tI;var Tb;typeof ko<"u"&&(Tb=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(D,I){return D===null||typeof D in y?D===I:!1}function u(D,I){var _;return function(){_||(_=p.a.setTimeout(function(){_=e,D()},I))}}function d(D,I){var _;return function(){clearTimeout(_),_=p.a.setTimeout(D,I)}}function h(D,I){I&&I!=="change"?I==="beforeChange"?this.pc(D):this.gb(D,I):this.qc(D)}function m(D,I){I!==null&&I.s&&I.s()}function g(D,I){var _=this.qd,v=_[S];v.ra||(this.Qb&&this.mb[I]?(_.uc(I,D,this.mb[I]),this.mb[I]=null,--this.Qb):v.I[I]||_.uc(I,D,v.J?{da:D}:_.$c(D)),D.Ja&&D.gd())}var p=typeof s<"u"?s:{};p.b=function(D,I){for(var _=D.split("."),v=p,O=0;O<_.length-1;O++)v=v[_[O]];v[_[_.length-1]]=I},p.L=function(D,I,_){D[I]=_},p.version="3.5.1",p.b("version",p.version),p.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},p.a=function(){function D(Y,X){for(var $ in Y)O.call(Y,$)&&X($,Y[$])}function I(Y,X){if(X)for(var $ in X)O.call(X,$)&&(Y[$]=X[$]);return Y}function _(Y,X){return Y.__proto__=X,Y}function v(Y,X,$,se){var ue=Y[X].match(q)||[];p.a.D($.match(q),function(re){p.a.Na(ue,re,se)}),Y[X]=ue.join(" ")}var O=Object.prototype.hasOwnProperty,N={__proto__:[]}instanceof Array,V=typeof Symbol=="function",k={},G={};k[i&&/Firefox\/2/i.test(i.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"],k.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "),D(k,function(Y,X){if(X.length)for(var $=0,se=X.length;$<se;$++)G[X[$]]=Y});var W={propertychange:!0},K=n&&function(){for(var Y=3,X=n.createElement("div"),$=X.getElementsByTagName("i");X.innerHTML="<!--[if gt IE "+ ++Y+"]><i></i><![endif]-->",$[0];);return 4<Y?Y:e}(),q=/\S+/g,te;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function(Y,X,$){for(var se=0,ue=Y.length;se<ue;se++)X.call($,Y[se],se,Y)},A:typeof Array.prototype.indexOf=="function"?function(Y,X){return Array.prototype.indexOf.call(Y,X)}:function(Y,X){for(var $=0,se=Y.length;$<se;$++)if(Y[$]===X)return $;return-1},Lb:function(Y,X,$){for(var se=0,ue=Y.length;se<ue;se++)if(X.call($,Y[se],se,Y))return Y[se];return e},Pa:function(Y,X){var $=p.a.A(Y,X);0<$?Y.splice($,1):$===0&&Y.shift()},wc:function(Y){var X=[];return Y&&p.a.D(Y,function($){0>p.a.A(X,$)&&X.push($)}),X},Mb:function(Y,X,$){var se=[];if(Y)for(var ue=0,re=Y.length;ue<re;ue++)se.push(X.call($,Y[ue],ue));return se},jb:function(Y,X,$){var se=[];if(Y)for(var ue=0,re=Y.length;ue<re;ue++)X.call($,Y[ue],ue)&&se.push(Y[ue]);return se},Nb:function(Y,X){if(X instanceof Array)Y.push.apply(Y,X);else for(var $=0,se=X.length;$<se;$++)Y.push(X[$]);return Y},Na:function(Y,X,$){var se=p.a.A(p.a.bc(Y),X);0>se?$&&Y.push(X):$||Y.splice(se,1)},Ba:N,extend:I,setPrototypeOf:_,Ab:N?_:I,P:D,Ga:function(Y,X,$){if(!Y)return Y;var se={},ue;for(ue in Y)O.call(Y,ue)&&(se[ue]=X.call($,Y[ue],ue,Y));return se},Tb:function(Y){for(;Y.firstChild;)p.removeNode(Y.firstChild)},Yb:function(Y){Y=p.a.la(Y);for(var X=(Y[0]&&Y[0].ownerDocument||n).createElement("div"),$=0,se=Y.length;$<se;$++)X.appendChild(p.oa(Y[$]));return X},Ca:function(Y,X){for(var $=0,se=Y.length,ue=[];$<se;$++){var re=Y[$].cloneNode(!0);ue.push(X?p.oa(re):re)}return ue},va:function(Y,X){if(p.a.Tb(Y),X)for(var $=0,se=X.length;$<se;$++)Y.appendChild(X[$])},Xc:function(Y,X){var $=Y.nodeType?[Y]:Y;if(0<$.length){for(var se=$[0],ue=se.parentNode,re=0,he=X.length;re<he;re++)ue.insertBefore(X[re],se);for(re=0,he=$.length;re<he;re++)p.removeNode($[re])}},Ua:function(Y,X){if(Y.length){for(X=X.nodeType===8&&X.parentNode||X;Y.length&&Y[0].parentNode!==X;)Y.splice(0,1);for(;1<Y.length&&Y[Y.length-1].parentNode!==X;)Y.length--;if(1<Y.length){var $=Y[0],se=Y[Y.length-1];for(Y.length=0;$!==se;)Y.push($),$=$.nextSibling;Y.push(se)}}return Y},Zc:function(Y,X){7>K?Y.setAttribute("selected",X):Y.selected=X},Db:function(Y){return Y===null||Y===e?"":Y.trim?Y.trim():Y.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(Y,X){return Y=Y||"",X.length>Y.length?!1:Y.substring(0,X.length)===X},vd:function(Y,X){if(Y===X)return!0;if(Y.nodeType===11)return!1;if(X.contains)return X.contains(Y.nodeType!==1?Y.parentNode:Y);if(X.compareDocumentPosition)return(X.compareDocumentPosition(Y)&16)==16;for(;Y&&Y!=X;)Y=Y.parentNode;return!!Y},Sb:function(Y){return p.a.vd(Y,Y.ownerDocument.documentElement)},kd:function(Y){return!!p.a.Lb(Y,p.a.Sb)},R:function(Y){return Y&&Y.tagName&&Y.tagName.toLowerCase()},Ac:function(Y){return p.onError?function(){try{return Y.apply(this,arguments)}catch(X){throw p.onError&&p.onError(X),X}}:Y},setTimeout:function(Y,X){return setTimeout(p.a.Ac(Y),X)},Gc:function(Y){setTimeout(function(){throw p.onError&&p.onError(Y),Y},0)},B:function(Y,X,$){var se=p.a.Ac($);if($=W[X],p.options.useOnlyNativeEvents||$||!o)if($||typeof Y.addEventListener!="function")if(typeof Y.attachEvent<"u"){var ue=function(he){se.call(Y,he)},re="on"+X;Y.attachEvent(re,ue),p.a.K.za(Y,function(){Y.detachEvent(re,ue)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else Y.addEventListener(X,se,!1);else te||(te=typeof o(Y).on=="function"?"on":"bind"),o(Y)[te](X,se)},Fb:function(Y,X){if(!Y||!Y.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var $;if(p.a.R(Y)==="input"&&Y.type&&X.toLowerCase()=="click"?($=Y.type,$=$=="checkbox"||$=="radio"):$=!1,p.options.useOnlyNativeEvents||!o||$)if(typeof n.createEvent=="function")if(typeof Y.dispatchEvent=="function")$=n.createEvent(G[X]||"HTMLEvents"),$.initEvent(X,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,Y),Y.dispatchEvent($);else throw Error("The supplied element doesn't support dispatchEvent");else if($&&Y.click)Y.click();else if(typeof Y.fireEvent<"u")Y.fireEvent("on"+X);else throw Error("Browser doesn't support triggering events");else o(Y).trigger(X)},f:function(Y){return p.O(Y)?Y():Y},bc:function(Y){return p.O(Y)?Y.v():Y},Eb:function(Y,X,$){var se;X&&(typeof Y.classList=="object"?(se=Y.classList[$?"add":"remove"],p.a.D(X.match(q),function(ue){se.call(Y.classList,ue)})):typeof Y.className.baseVal=="string"?v(Y.className,"baseVal",X,$):v(Y,"className",X,$))},Bb:function(Y,X){var $=p.a.f(X);($===null||$===e)&&($="");var se=p.h.firstChild(Y);!se||se.nodeType!=3||p.h.nextSibling(se)?p.h.va(Y,[Y.ownerDocument.createTextNode($)]):se.data=$,p.a.Ad(Y)},Yc:function(Y,X){if(Y.name=X,7>=K)try{var $=Y.name.replace(/[&<>'"]/g,function(se){return"&#"+se.charCodeAt(0)+";"});Y.mergeAttributes(n.createElement("<input name='"+$+"'/>"),!1)}catch{}},Ad:function(Y){9<=K&&(Y=Y.nodeType==1?Y:Y.parentNode,Y.style&&(Y.style.zoom=Y.style.zoom))},wd:function(Y){if(K){var X=Y.style.width;Y.style.width=0,Y.style.width=X}},Pd:function(Y,X){Y=p.a.f(Y),X=p.a.f(X);for(var $=[],se=Y;se<=X;se++)$.push(se);return $},la:function(Y){for(var X=[],$=0,se=Y.length;$<se;$++)X.push(Y[$]);return X},Da:function(Y){return V?Symbol(Y):Y},Zd:K===6,$d:K===7,W:K,Lc:function(Y,X){for(var $=p.a.la(Y.getElementsByTagName("input")).concat(p.a.la(Y.getElementsByTagName("textarea"))),se=typeof X=="string"?function(he){return he.name===X}:function(he){return X.test(he.name)},ue=[],re=$.length-1;0<=re;re--)se($[re])&&ue.push($[re]);return ue},Nd:function(Y){return typeof Y=="string"&&(Y=p.a.Db(Y))?r&&r.parse?r.parse(Y):new Function("return "+Y)():null},hc:function(Y,X,$){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(p.a.f(Y),X,$)},Od:function(Y,X,$){$=$||{};var se=$.params||{},ue=$.includeFields||this.Jc,re=Y;if(typeof Y=="object"&&p.a.R(Y)==="form")for(var re=Y.action,he=ue.length-1;0<=he;he--)for(var ce=p.a.Lc(Y,ue[he]),Q=ce.length-1;0<=Q;Q--)se[ce[Q].name]=ce[Q].value;X=p.a.f(X);var ne=n.createElement("form");ne.style.display="none",ne.action=re,ne.method="post";for(var de in X)Y=n.createElement("input"),Y.type="hidden",Y.name=de,Y.value=p.a.hc(p.a.f(X[de])),ne.appendChild(Y);D(se,function(_e,Se){var ve=n.createElement("input");ve.type="hidden",ve.name=_e,ve.value=Se,ne.appendChild(ve)}),n.body.appendChild(ne),$.submitter?$.submitter(ne):ne.submit(),setTimeout(function(){ne.parentNode.removeChild(ne)},0)}}}(),p.b("utils",p.a),p.b("utils.arrayForEach",p.a.D),p.b("utils.arrayFirst",p.a.Lb),p.b("utils.arrayFilter",p.a.jb),p.b("utils.arrayGetDistinctValues",p.a.wc),p.b("utils.arrayIndexOf",p.a.A),p.b("utils.arrayMap",p.a.Mb),p.b("utils.arrayPushAll",p.a.Nb),p.b("utils.arrayRemoveItem",p.a.Pa),p.b("utils.cloneNodes",p.a.Ca),p.b("utils.createSymbolOrString",p.a.Da),p.b("utils.extend",p.a.extend),p.b("utils.fieldsIncludedWithJsonPost",p.a.Jc),p.b("utils.getFormFields",p.a.Lc),p.b("utils.objectMap",p.a.Ga),p.b("utils.peekObservable",p.a.bc),p.b("utils.postJson",p.a.Od),p.b("utils.parseJson",p.a.Nd),p.b("utils.registerEventHandler",p.a.B),p.b("utils.stringifyJson",p.a.hc),p.b("utils.range",p.a.Pd),p.b("utils.toggleDomNodeCssClass",p.a.Eb),p.b("utils.triggerEvent",p.a.Fb),p.b("utils.unwrapObservable",p.a.f),p.b("utils.objectForEach",p.a.P),p.b("utils.addOrRemoveItem",p.a.Na),p.b("utils.setTextContent",p.a.Bb),p.b("unwrap",p.a.f),Function.prototype.bind||(Function.prototype.bind=function(D){var I=this;if(arguments.length===1)return function(){return I.apply(D,arguments)};var _=Array.prototype.slice.call(arguments,1);return function(){var v=_.slice(0);return v.push.apply(v,arguments),I.apply(D,v)}}),p.a.g=new function(){var D=0,I="__ko__"+new Date().getTime(),_={},v,O;return p.a.W?(v=function(N,V){var k=N[I];if(!k||k==="null"||!_[k]){if(!V)return e;k=N[I]="ko"+D++,_[k]={}}return _[k]},O=function(N){var V=N[I];return V?(delete _[V],N[I]=null,!0):!1}):(v=function(N,V){var k=N[I];return!k&&V&&(k=N[I]={}),k},O=function(N){return N[I]?(delete N[I],!0):!1}),{get:function(N,V){var k=v(N,!1);return k&&k[V]},set:function(N,V,k){(N=v(N,k!==e))&&(N[V]=k)},Ub:function(N,V,k){return N=v(N,!0),N[V]||(N[V]=k)},clear:O,Z:function(){return D+++I}}},p.b("utils.domData",p.a.g),p.b("utils.domData.clear",p.a.g.clear),p.a.K=new function(){function D(V,k){var G=p.a.g.get(V,v);return G===e&&k&&(G=[],p.a.g.set(V,v,G)),G}function I(V){var k=D(V,!1);if(k)for(var k=k.slice(0),G=0;G<k.length;G++)k[G](V);p.a.g.clear(V),p.a.K.cleanExternalData(V),N[V.nodeType]&&_(V.childNodes,!0)}function _(V,k){for(var G=[],W,K=0;K<V.length;K++)if((!k||V[K].nodeType===8)&&(I(G[G.length]=W=V[K]),V[K]!==W))for(;K--&&p.a.A(G,V[K])==-1;);}var v=p.a.g.Z(),O={1:!0,8:!0,9:!0},N={1:!0,9:!0};return{za:function(V,k){if(typeof k!="function")throw Error("Callback must be a function");D(V,!0).push(k)},yb:function(V,k){var G=D(V,!1);G&&(p.a.Pa(G,k),G.length==0&&p.a.g.set(V,v,e))},oa:function(V){return p.u.G(function(){O[V.nodeType]&&(I(V),N[V.nodeType]&&_(V.getElementsByTagName("*")))}),V},removeNode:function(V){p.oa(V),V.parentNode&&V.parentNode.removeChild(V)},cleanExternalData:function(V){o&&typeof o.cleanData=="function"&&o.cleanData([V])}}},p.oa=p.a.K.oa,p.removeNode=p.a.K.removeNode,p.b("cleanNode",p.oa),p.b("removeNode",p.removeNode),p.b("utils.domNodeDisposal",p.a.K),p.b("utils.domNodeDisposal.addDisposeCallback",p.a.K.za),p.b("utils.domNodeDisposal.removeDisposeCallback",p.a.K.yb),function(){var D=[0,"",""],I=[1,"<table>","</table>"],_=[3,"<table><tbody><tr>","</tr></tbody></table>"],v=[1,"<select multiple='multiple'>","</select>"],O={thead:I,tbody:I,tfoot:I,tr:[2,"<table><tbody>","</tbody></table>"],td:_,th:_,option:v,optgroup:v},N=8>=p.a.W;p.a.ua=function(V,k){var G;if(o){if(o.parseHTML)G=o.parseHTML(V,k)||[];else if((G=o.clean([V],k))&&G[0]){for(var W=G[0];W.parentNode&&W.parentNode.nodeType!==11;)W=W.parentNode;W.parentNode&&W.parentNode.removeChild(W)}}else{(G=k)||(G=n);var W=G.parentWindow||G.defaultView||t,K=p.a.Db(V).toLowerCase(),q=G.createElement("div"),te;for(te=(K=K.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&O[K[1]]||D,K=te[0],te="ignored<div>"+te[1]+V+te[2]+"</div>",typeof W.innerShiv=="function"?q.appendChild(W.innerShiv(te)):(N&&G.body.appendChild(q),q.innerHTML=te,N&&q.parentNode.removeChild(q));K--;)q=q.lastChild;G=p.a.la(q.lastChild.childNodes)}return G},p.a.Md=function(V,k){var G=p.a.ua(V,k);return G.length&&G[0].parentElement||p.a.Yb(G)},p.a.fc=function(V,k){if(p.a.Tb(V),k=p.a.f(k),k!==null&&k!==e)if(typeof k!="string"&&(k=k.toString()),o)o(V).html(k);else for(var G=p.a.ua(k,V.ownerDocument),W=0;W<G.length;W++)V.appendChild(G[W])}}(),p.b("utils.parseHtmlFragment",p.a.ua),p.b("utils.setHtml",p.a.fc),p.aa=function(){function D(_,v){if(_){if(_.nodeType==8){var O=p.aa.Uc(_.nodeValue);O!=null&&v.push({ud:_,Kd:O})}else if(_.nodeType==1)for(var O=0,N=_.childNodes,V=N.length;O<V;O++)D(N[O],v)}}var I={};return{Xb:function(_){if(typeof _!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var v=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return I[v]=_,"<!--[ko_memo:"+v+"]-->"},bd:function(_,v){var O=I[_];if(O===e)throw Error("Couldn't find any memo with ID "+_+". Perhaps it's already been unmemoized.");try{return O.apply(null,v||[]),!0}finally{delete I[_]}},cd:function(_,v){var O=[];D(_,O);for(var N=0,V=O.length;N<V;N++){var k=O[N].ud,G=[k];v&&p.a.Nb(G,v),p.aa.bd(O[N].Kd,G),k.nodeValue="",k.parentNode&&k.parentNode.removeChild(k)}},Uc:function(_){return(_=_.match(/^\[ko_memo\:(.*?)\]$/))?_[1]:null}}}(),p.b("memoization",p.aa),p.b("memoization.memoize",p.aa.Xb),p.b("memoization.unmemoize",p.aa.bd),p.b("memoization.parseMemoText",p.aa.Uc),p.b("memoization.unmemoizeDomNodeAndDescendants",p.aa.cd),p.na=function(){function D(){if(O){for(var k=O,G=0,W;V<O;)if(W=v[V++]){if(V>k){if(5e3<=++G){V=O,p.a.Gc(Error("'Too much recursion' after processing "+G+" task groups."));break}k=O}try{W()}catch(K){p.a.Gc(K)}}}}function I(){D(),V=O=v.length=0}var _,v=[],O=0,N=1,V=0;return t.MutationObserver?_=function(k){var G=n.createElement("div");return new MutationObserver(k).observe(G,{attributes:!0}),function(){G.classList.toggle("foo")}}(I):_=n&&"onreadystatechange"in n.createElement("script")?function(k){var G=n.createElement("script");G.onreadystatechange=function(){G.onreadystatechange=null,n.documentElement.removeChild(G),G=null,k()},n.documentElement.appendChild(G)}:function(k){setTimeout(k,0)},{scheduler:_,zb:function(k){return O||p.na.scheduler(I),v[O++]=k,N++},cancel:function(k){k=k-(N-O),k>=V&&k<O&&(v[k]=null)},resetForTesting:function(){var k=O-V;return V=O=v.length=0,k},Sd:D}}(),p.b("tasks",p.na),p.b("tasks.schedule",p.na.zb),p.b("tasks.runEarly",p.na.Sd),p.Ta={throttle:function(D,I){D.throttleEvaluation=I;var _=null;return p.$({read:D,write:function(v){clearTimeout(_),_=p.a.setTimeout(function(){D(v)},I)}})},rateLimit:function(D,I){var _,v,O;typeof I=="number"?_=I:(_=I.timeout,v=I.method),D.Hb=!1,O=typeof v=="function"?v:v=="notifyWhenChangesStop"?d:u,D.ub(function(N){return O(N,_,I)})},deferred:function(D,I){if(I!==!0)throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");D.Hb||(D.Hb=!0,D.ub(function(_){var v,O=!1;return function(){if(!O){p.na.cancel(v),v=p.na.zb(_);try{O=!0,D.notifySubscribers(e,"dirty")}finally{O=!1}}}}))},notify:function(D,I){D.equalityComparer=I=="always"?null:c}};var y={undefined:1,boolean:1,number:1,string:1};p.b("extenders",p.Ta),p.ic=function(D,I,_){this.da=D,this.lc=I,this.mc=_,this.Ib=!1,this.fb=this.Jb=null,p.L(this,"dispose",this.s),p.L(this,"disposeWhenNodeIsRemoved",this.l)},p.ic.prototype.s=function(){this.Ib||(this.fb&&p.a.K.yb(this.Jb,this.fb),this.Ib=!0,this.mc(),this.da=this.lc=this.mc=this.Jb=this.fb=null)},p.ic.prototype.l=function(D){this.Jb=D,p.a.K.za(D,this.fb=this.s.bind(this))},p.T=function(){p.a.Ab(this,b),b.qb(this)};var b={qb:function(D){D.U={change:[]},D.sc=1},subscribe:function(D,I,_){var v=this;_=_||"change";var O=new p.ic(v,I?D.bind(I):D,function(){p.a.Pa(v.U[_],O),v.hb&&v.hb(_)});return v.Qa&&v.Qa(_),v.U[_]||(v.U[_]=[]),v.U[_].push(O),O},notifySubscribers:function(D,I){if(I=I||"change",I==="change"&&this.Gb(),this.Wa(I)){var _=I==="change"&&this.ed||this.U[I].slice(0);try{p.u.xc();for(var v=0,O;O=_[v];++v)O.Ib||O.lc(D)}finally{p.u.end()}}},ob:function(){return this.sc},Dd:function(D){return this.ob()!==D},Gb:function(){++this.sc},ub:function(D){var I=this,_=p.O(I),v,O,N,V,k;I.gb||(I.gb=I.notifySubscribers,I.notifySubscribers=h);var G=D(function(){I.Ja=!1,_&&V===I&&(V=I.nc?I.nc():I());var W=O||k&&I.sb(N,V);k=O=v=!1,W&&I.gb(N=V)});I.qc=function(W,K){K&&I.Ja||(k=!K),I.ed=I.U.change.slice(0),I.Ja=v=!0,V=W,G()},I.pc=function(W){v||(N=W,I.gb(W,"beforeChange"))},I.rc=function(){k=!0},I.gd=function(){I.sb(N,I.v(!0))&&(O=!0)}},Wa:function(D){return this.U[D]&&this.U[D].length},Bd:function(D){if(D)return this.U[D]&&this.U[D].length||0;var I=0;return p.a.P(this.U,function(_,v){_!=="dirty"&&(I+=v.length)}),I},sb:function(D,I){return!this.equalityComparer||!this.equalityComparer(D,I)},toString:function(){return"[object Object]"},extend:function(D){var I=this;return D&&p.a.P(D,function(_,v){var O=p.Ta[_];typeof O=="function"&&(I=O(I,v)||I)}),I}};p.L(b,"init",b.qb),p.L(b,"subscribe",b.subscribe),p.L(b,"extend",b.extend),p.L(b,"getSubscriptionsCount",b.Bd),p.a.Ba&&p.a.setPrototypeOf(b,Function.prototype),p.T.fn=b,p.Qc=function(D){return D!=null&&typeof D.subscribe=="function"&&typeof D.notifySubscribers=="function"},p.b("subscribable",p.T),p.b("isSubscribable",p.Qc),p.S=p.u=function(){function D(N){_.push(v),v=N}function I(){v=_.pop()}var _=[],v,O=0;return{xc:D,end:I,cc:function(N){if(v){if(!p.Qc(N))throw Error("Only subscribable things can act as dependencies");v.od.call(v.pd,N,N.fd||(N.fd=++O))}},G:function(N,V,k){try{return D(),N.apply(V,k||[])}finally{I()}},qa:function(){if(v)return v.o.qa()},Va:function(){if(v)return v.o.Va()},Ya:function(){if(v)return v.Ya},o:function(){if(v)return v.o}}}(),p.b("computedContext",p.S),p.b("computedContext.getDependenciesCount",p.S.qa),p.b("computedContext.getDependencies",p.S.Va),p.b("computedContext.isInitial",p.S.Ya),p.b("computedContext.registerDependency",p.S.cc),p.b("ignoreDependencies",p.Yd=p.u.G);var C=p.a.Da("_latestValue");p.ta=function(D){function I(){return 0<arguments.length?(I.sb(I[C],arguments[0])&&(I.ya(),I[C]=arguments[0],I.xa()),this):(p.u.cc(I),I[C])}return I[C]=D,p.a.Ba||p.a.extend(I,p.T.fn),p.T.fn.qb(I),p.a.Ab(I,E),p.options.deferUpdates&&p.Ta.deferred(I,!0),I};var E={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")}};p.a.Ba&&p.a.setPrototypeOf(E,p.T.fn);var w=p.ta.Ma="__ko_proto__";E[w]=p.ta,p.O=function(D){if((D=typeof D=="function"&&D[w])&&D!==E[w]&&D!==p.o.fn[w])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!D},p.Za=function(D){return typeof D=="function"&&(D[w]===E[w]||D[w]===p.o.fn[w]&&D.Nc)},p.b("observable",p.ta),p.b("isObservable",p.O),p.b("isWriteableObservable",p.Za),p.b("isWritableObservable",p.Za),p.b("observable.fn",E),p.L(E,"peek",E.v),p.L(E,"valueHasMutated",E.xa),p.L(E,"valueWillMutate",E.ya),p.Ha=function(D){if(D=D||[],typeof D!="object"||!("length"in D))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return D=p.ta(D),p.a.Ab(D,p.Ha.fn),D.extend({trackArrayChanges:!0})},p.Ha.fn={remove:function(D){for(var I=this.v(),_=[],v=typeof D!="function"||p.O(D)?function(V){return V===D}:D,O=0;O<I.length;O++){var N=I[O];if(v(N)){if(_.length===0&&this.ya(),I[O]!==N)throw Error("Array modified during remove; cannot remove item");_.push(N),I.splice(O,1),O--}}return _.length&&this.xa(),_},removeAll:function(D){if(D===e){var I=this.v(),_=I.slice(0);return this.ya(),I.splice(0,I.length),this.xa(),_}return D?this.remove(function(v){return 0<=p.a.A(D,v)}):[]},destroy:function(D){var I=this.v(),_=typeof D!="function"||p.O(D)?function(N){return N===D}:D;this.ya();for(var v=I.length-1;0<=v;v--){var O=I[v];_(O)&&(O._destroy=!0)}this.xa()},destroyAll:function(D){return D===e?this.destroy(function(){return!0}):D?this.destroy(function(I){return 0<=p.a.A(D,I)}):[]},indexOf:function(D){var I=this();return p.a.A(I,D)},replace:function(D,I){var _=this.indexOf(D);0<=_&&(this.ya(),this.v()[_]=I,this.xa())},sorted:function(D){var I=this().slice(0);return D?I.sort(D):I.sort()},reversed:function(){return this().slice(0).reverse()}},p.a.Ba&&p.a.setPrototypeOf(p.Ha.fn,p.ta.fn),p.a.D("pop push reverse shift sort splice unshift".split(" "),function(D){p.Ha.fn[D]=function(){var I=this.v();this.ya(),this.zc(I,D,arguments);var _=I[D].apply(I,arguments);return this.xa(),_===I?this:_}}),p.a.D(["slice"],function(D){p.Ha.fn[D]=function(){var I=this();return I[D].apply(I,arguments)}}),p.Pc=function(D){return p.O(D)&&typeof D.remove=="function"&&typeof D.push=="function"},p.b("observableArray",p.Ha),p.b("isObservableArray",p.Pc),p.Ta.trackArrayChanges=function(D,I){function _(){function q(){if(k){var te=[].concat(D.v()||[]),Y;D.Wa("arrayChange")&&((!O||1<k)&&(O=p.a.Pb(G,te,D.Ob)),Y=O),G=te,O=null,k=0,Y&&Y.length&&D.notifySubscribers(Y,"arrayChange")}}v?q():(v=!0,V=D.subscribe(function(){++k},null,"spectate"),G=[].concat(D.v()||[]),O=null,N=D.subscribe(q))}if(D.Ob={},I&&typeof I=="object"&&p.a.extend(D.Ob,I),D.Ob.sparse=!0,!D.zc){var v=!1,O=null,N,V,k=0,G,W=D.Qa,K=D.hb;D.Qa=function(q){W&&W.call(D,q),q==="arrayChange"&&_()},D.hb=function(q){K&&K.call(D,q),q!=="arrayChange"||D.Wa("arrayChange")||(N&&N.s(),V&&V.s(),V=N=null,v=!1,G=e)},D.zc=function(q,te,Y){function X(ne,de,_e){return $[$.length]={status:ne,value:de,index:_e}}if(v&&!k){var $=[],se=q.length,ue=Y.length,re=0;switch(te){case"push":re=se;case"unshift":for(te=0;te<ue;te++)X("added",Y[te],re+te);break;case"pop":re=se-1;case"shift":se&&X("deleted",q[re],re);break;case"splice":te=Math.min(Math.max(0,0>Y[0]?se+Y[0]:Y[0]),se);for(var se=ue===1?se:Math.min(te+(Y[1]||0),se),ue=te+ue-2,re=Math.max(se,ue),he=[],ce=[],Q=2;te<re;++te,++Q)te<se&&ce.push(X("deleted",q[te],te)),te<ue&&he.push(X("added",Y[Q],te));p.a.Kc(ce,he);break;default:return}O=$}}}};var S=p.a.Da("_state");p.o=p.$=function(D,I,_){function v(){if(0<arguments.length){if(typeof O=="function")O.apply(N.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 N.ra||p.u.cc(v),(N.ka||N.J&&v.Xa())&&v.ha(),N.X}if(typeof D=="object"?_=D:(_=_||{},D&&(_.read=D)),typeof _.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var O=_.write,N={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:_.read,nb:I||_.owner,l:_.disposeWhenNodeIsRemoved||_.l||null,Sa:_.disposeWhen||_.Sa,Rb:null,I:{},V:0,Ic:null};return v[S]=N,v.Nc=typeof O=="function",p.a.Ba||p.a.extend(v,p.T.fn),p.T.fn.qb(v),p.a.Ab(v,P),_.pure?(N.wb=!0,N.J=!0,p.a.extend(v,L)):_.deferEvaluation&&p.a.extend(v,z),p.options.deferUpdates&&p.Ta.deferred(v,!0),N.l&&(N.jc=!0,N.l.nodeType||(N.l=null)),N.J||_.deferEvaluation||v.ha(),N.l&&v.ja()&&p.a.K.za(N.l,N.Rb=function(){v.s()}),v};var P={equalityComparer:c,qa:function(){return this[S].V},Va:function(){var D=[];return p.a.P(this[S].I,function(I,_){D[_.Ka]=_.da}),D},Vb:function(D){if(!this[S].V)return!1;var I=this.Va();return p.a.A(I,D)!==-1?!0:!!p.a.Lb(I,function(_){return _.Vb&&_.Vb(D)})},uc:function(D,I,_){if(this[S].wb&&I===this)throw Error("A 'pure' computed must not be called recursively");this[S].I[D]=_,_.Ka=this[S].V++,_.La=I.ob()},Xa:function(){var D,I,_=this[S].I;for(D in _)if(Object.prototype.hasOwnProperty.call(_,D)&&(I=_[D],this.Ia&&I.da.Ja||I.da.Dd(I.La)))return!0},Jd:function(){this.Ia&&!this[S].rb&&this.Ia(!1)},ja:function(){var D=this[S];return D.ka||0<D.V},Rd:function(){this.Ja?this[S].ka&&(this[S].sa=!0):this.Hc()},$c:function(D){if(D.Hb){var I=D.subscribe(this.Jd,this,"dirty"),_=D.subscribe(this.Rd,this);return{da:D,s:function(){I.s(),_.s()}}}return D.subscribe(this.Hc,this)},Hc:function(){var D=this,I=D.throttleEvaluation;I&&0<=I?(clearTimeout(this[S].Ic),this[S].Ic=p.a.setTimeout(function(){D.ha(!0)},I)):D.Ia?D.Ia(!0):D.ha(!0)},ha:function(D){var I=this[S],_=I.Sa,v=!1;if(!I.rb&&!I.ra){if(I.l&&!p.a.Sb(I.l)||_&&_()){if(!I.jc){this.s();return}}else I.jc=!1;I.rb=!0;try{v=this.zd(D)}finally{I.rb=!1}return v}},zd:function(D){var I=this[S],v=!1,_=I.wb?e:!I.V,v={qd:this,mb:I.I,Qb:I.V};p.u.xc({pd:v,od:g,o:this,Ya:_}),I.I={},I.V=0;var O=this.yd(I,v);return I.V?v=this.sb(I.X,O):(this.s(),v=!0),v&&(I.J?this.Gb():this.notifySubscribers(I.X,"beforeChange"),I.X=O,this.notifySubscribers(I.X,"spectate"),!I.J&&D&&this.notifySubscribers(I.X),this.rc&&this.rc()),_&&this.notifySubscribers(I.X,"awake"),v},yd:function(D,I){try{var _=D.Wc;return D.nb?_.call(D.nb):_()}finally{p.u.end(),I.Qb&&!D.J&&p.a.P(I.mb,m),D.sa=D.ka=!1}},v:function(D){var I=this[S];return(I.ka&&(D||!I.V)||I.J&&this.Xa())&&this.ha(),I.X},ub:function(D){p.T.fn.ub.call(this,D),this.nc=function(){return this[S].J||(this[S].sa?this.ha():this[S].ka=!1),this[S].X},this.Ia=function(I){this.pc(this[S].X),this[S].ka=!0,I&&(this[S].sa=!0),this.qc(this,!I)}},s:function(){var D=this[S];!D.J&&D.I&&p.a.P(D.I,function(I,_){_.s&&_.s()}),D.l&&D.Rb&&p.a.K.yb(D.l,D.Rb),D.I=e,D.V=0,D.ra=!0,D.sa=!1,D.ka=!1,D.J=!1,D.l=e,D.Sa=e,D.Wc=e,this.Nc||(D.nb=e)}},L={Qa:function(D){var I=this,_=I[S];if(!_.ra&&_.J&&D=="change"){if(_.J=!1,_.sa||I.Xa())_.I=null,_.V=0,I.ha()&&I.Gb();else{var v=[];p.a.P(_.I,function(O,N){v[N.Ka]=O}),p.a.D(v,function(O,N){var V=_.I[O],k=I.$c(V.da);k.Ka=N,k.La=V.La,_.I[O]=k}),I.Xa()&&I.ha()&&I.Gb()}_.ra||I.notifySubscribers(_.X,"awake")}},hb:function(D){var I=this[S];I.ra||D!="change"||this.Wa("change")||(p.a.P(I.I,function(_,v){v.s&&(I.I[_]={da:v.da,Ka:v.Ka,La:v.La},v.s())}),I.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var D=this[S];return D.J&&(D.sa||this.Xa())&&this.ha(),p.T.fn.ob.call(this)}},z={Qa:function(D){D!="change"&&D!="beforeChange"||this.v()}};p.a.Ba&&p.a.setPrototypeOf(P,p.T.fn);var R=p.ta.Ma;P[R]=p.o,p.Oc=function(D){return typeof D=="function"&&D[R]===P[R]},p.Fd=function(D){return p.Oc(D)&&D[S]&&D[S].wb},p.b("computed",p.o),p.b("dependentObservable",p.o),p.b("isComputed",p.Oc),p.b("isPureComputed",p.Fd),p.b("computed.fn",P),p.L(P,"peek",P.v),p.L(P,"dispose",P.s),p.L(P,"isActive",P.ja),p.L(P,"getDependenciesCount",P.qa),p.L(P,"getDependencies",P.Va),p.xb=function(D,I){return typeof D=="function"?p.o(D,I,{pure:!0}):(D=p.a.extend({},D),D.pure=!0,p.o(D,I))},p.b("pureComputed",p.xb),function(){function D(v,O,N){if(N=N||new _,v=O(v),typeof v!="object"||v===null||v===e||v instanceof RegExp||v instanceof Date||v instanceof String||v instanceof Number||v instanceof Boolean)return v;var V=v instanceof Array?[]:{};return N.save(v,V),I(v,function(k){var G=O(v[k]);switch(typeof G){case"boolean":case"number":case"string":case"function":V[k]=G;break;case"object":case"undefined":var W=N.get(G);V[k]=W!==e?W:D(G,O,N)}}),V}function I(v,O){if(v instanceof Array){for(var N=0;N<v.length;N++)O(N);typeof v.toJSON=="function"&&O("toJSON")}else for(N in v)O(N)}function _(){this.keys=[],this.values=[]}p.ad=function(v){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return D(v,function(O){for(var N=0;p.O(O)&&10>N;N++)O=O();return O})},p.toJSON=function(v,O,N){return v=p.ad(v),p.a.hc(v,O,N)},_.prototype={constructor:_,save:function(v,O){var N=p.a.A(this.keys,v);0<=N?this.values[N]=O:(this.keys.push(v),this.values.push(O))},get:function(v){return v=p.a.A(this.keys,v),0<=v?this.values[v]:e}}}(),p.b("toJS",p.ad),p.b("toJSON",p.toJSON),p.Wd=function(D,I,_){function v(O){var N=p.xb(D,_).extend({ma:"always"}),V=N.subscribe(function(k){k&&(V.s(),O(k))});return N.notifySubscribers(N.v()),V}return typeof Promise!="function"||I?v(I.bind(_)):new Promise(v)},p.b("when",p.Wd),function(){p.w={M:function(D){switch(p.a.R(D)){case"option":return D.__ko__hasDomDataOptionValue__===!0?p.a.g.get(D,p.c.options.$b):7>=p.a.W?D.getAttributeNode("value")&&D.getAttributeNode("value").specified?D.value:D.text:D.value;case"select":return 0<=D.selectedIndex?p.w.M(D.options[D.selectedIndex]):e;default:return D.value}},cb:function(D,I,_){switch(p.a.R(D)){case"option":typeof I=="string"?(p.a.g.set(D,p.c.options.$b,e),"__ko__hasDomDataOptionValue__"in D&&delete D.__ko__hasDomDataOptionValue__,D.value=I):(p.a.g.set(D,p.c.options.$b,I),D.__ko__hasDomDataOptionValue__=!0,D.value=typeof I=="number"?I:"");break;case"select":(I===""||I===null)&&(I=e);for(var v=-1,O=0,N=D.options.length,V;O<N;++O)if(V=p.w.M(D.options[O]),V==I||V===""&&I===e){v=O;break}(_||0<=v||I===e&&1<D.size)&&(D.selectedIndex=v,p.a.W===6&&p.a.setTimeout(function(){D.selectedIndex=v},0));break;default:(I===null||I===e)&&(I=""),D.value=I}}}}(),p.b("selectExtensions",p.w),p.b("selectExtensions.readValue",p.w.M),p.b("selectExtensions.writeValue",p.w.cb),p.m=function(){function D(k){k=p.a.Db(k),k.charCodeAt(0)===123&&(k=k.slice(1,-1)),k+=`
|
||
,`;var G=[],W=k.match(v),K,q=[],te=0;if(1<W.length){for(var Y=0,X;X=W[Y];++Y){var $=X.charCodeAt(0);if($===44){if(0>=te){G.push(K&&q.length?{key:K,value:q.join("")}:{unknown:K||q.join("")}),K=te=0,q=[];continue}}else if($===58){if(!te&&!K&&q.length===1){K=q.pop();continue}}else{if($===47&&1<X.length&&(X.charCodeAt(1)===47||X.charCodeAt(1)===42))continue;$===47&&Y&&1<X.length?($=W[Y-1].match(O))&&!N[$[0]]&&(k=k.substr(k.indexOf(X)+1),W=k.match(v),Y=-1,X="/"):$===40||$===123||$===91?++te:$===41||$===125||$===93?--te:K||q.length||$!==34&&$!==39||(X=X.slice(1,-1))}q.push(X)}if(0<te)throw Error("Unbalanced parentheses, braces, or brackets")}return G}var I=["true","false","null","undefined"],_=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,v=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|
||
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),O=/[\])"'A-Za-z0-9_$]+$/,N={in:1,return:1,typeof:1},V={};return{Ra:[],wa:V,ac:D,vb:function(k,G){function W($,se){var ue;if(!Y){var re=p.getBindingHandler($);if(re&&re.preprocess&&!(se=re.preprocess(se,$,W)))return;(re=V[$])&&(ue=se,0<=p.a.A(I,ue)?ue=!1:(re=ue.match(_),ue=re===null?!1:re[1]?"Object("+re[1]+")"+re[2]:ue),re=ue),re&&q.push("'"+(typeof V[$]=="string"?V[$]:$)+"':function(_z){"+ue+"=_z}")}te&&(se="function(){return "+se+" }"),K.push("'"+$+"':"+se)}G=G||{};var K=[],q=[],te=G.valueAccessors,Y=G.bindingParams,X=typeof k=="string"?D(k):k;return p.a.D(X,function($){W($.key||$.unknown,$.value)}),q.length&&W("_ko_property_writers","{"+q.join(",")+" }"),K.join(",")},Id:function(k,G){for(var W=0;W<k.length;W++)if(k[W].key==G)return!0;return!1},eb:function(k,G,W,K,q){k&&p.O(k)?!p.Za(k)||q&&k.v()===K||k(K):(k=G.get("_ko_property_writers"))&&k[W]&&k[W](K)}}}(),p.b("expressionRewriting",p.m),p.b("expressionRewriting.bindingRewriteValidators",p.m.Ra),p.b("expressionRewriting.parseObjectLiteral",p.m.ac),p.b("expressionRewriting.preProcessBindings",p.m.vb),p.b("expressionRewriting._twoWayBindings",p.m.wa),p.b("jsonExpressionRewriting",p.m),p.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",p.m.vb),function(){function D(W){return W.nodeType==8&&N.test(O?W.text:W.nodeValue)}function I(W){return W.nodeType==8&&V.test(O?W.text:W.nodeValue)}function _(W,K){for(var q=W,te=1,Y=[];q=q.nextSibling;){if(I(q)&&(p.a.g.set(q,G,!0),te--,te===0))return Y;Y.push(q),D(q)&&te++}if(!K)throw Error("Cannot find closing comment tag to match: "+W.nodeValue);return null}function v(W,K){var q=_(W,K);return q?0<q.length?q[q.length-1].nextSibling:W.nextSibling:null}var O=n&&n.createComment("test").text==="<!--test-->",N=O?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,V=O?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,k={ul:!0,ol:!0},G="__ko_matchedEndComment__";p.h={ea:{},childNodes:function(W){return D(W)?_(W):W.childNodes},Ea:function(W){if(D(W)){W=p.h.childNodes(W);for(var K=0,q=W.length;K<q;K++)p.removeNode(W[K])}else p.a.Tb(W)},va:function(W,K){if(D(W)){p.h.Ea(W);for(var q=W.nextSibling,te=0,Y=K.length;te<Y;te++)q.parentNode.insertBefore(K[te],q)}else p.a.va(W,K)},Vc:function(W,K){var q;D(W)?(q=W.nextSibling,W=W.parentNode):q=W.firstChild,q?K!==q&&W.insertBefore(K,q):W.appendChild(K)},Wb:function(W,K,q){q?(q=q.nextSibling,D(W)&&(W=W.parentNode),q?K!==q&&W.insertBefore(K,q):W.appendChild(K)):p.h.Vc(W,K)},firstChild:function(W){if(D(W))return!W.nextSibling||I(W.nextSibling)?null:W.nextSibling;if(W.firstChild&&I(W.firstChild))throw Error("Found invalid end comment, as the first child of "+W);return W.firstChild},nextSibling:function(W){if(D(W)&&(W=v(W)),W.nextSibling&&I(W.nextSibling)){var K=W.nextSibling;if(I(K)&&!p.a.g.get(K,G))throw Error("Found end comment without a matching opening comment, as child of "+W);return null}return W.nextSibling},Cd:D,Vd:function(W){return(W=(O?W.text:W.nodeValue).match(N))?W[1]:null},Sc:function(W){if(k[p.a.R(W)]){var K=W.firstChild;if(K)do if(K.nodeType===1){var q;q=K.firstChild;var te=null;if(q)do if(te)te.push(q);else if(D(q)){var Y=v(q,!0);Y?q=Y:te=[q]}else I(q)&&(te=[q]);while(q=q.nextSibling);if(q=te)for(te=K.nextSibling,Y=0;Y<q.length;Y++)te?W.insertBefore(q[Y],te):W.appendChild(q[Y])}while(K=K.nextSibling)}}}}(),p.b("virtualElements",p.h),p.b("virtualElements.allowedBindings",p.h.ea),p.b("virtualElements.emptyNode",p.h.Ea),p.b("virtualElements.insertAfter",p.h.Wb),p.b("virtualElements.prepend",p.h.Vc),p.b("virtualElements.setDomNodeChildren",p.h.va),function(){p.ga=function(){this.nd={}},p.a.extend(p.ga.prototype,{nodeHasBindings:function(D){switch(D.nodeType){case 1:return D.getAttribute("data-bind")!=null||p.j.getComponentNameForNode(D);case 8:return p.h.Cd(D);default:return!1}},getBindings:function(D,I){var _=this.getBindingsString(D,I),_=_?this.parseBindingsString(_,I,D):null;return p.j.tc(_,D,I,!1)},getBindingAccessors:function(D,I){var _=this.getBindingsString(D,I),_=_?this.parseBindingsString(_,I,D,{valueAccessors:!0}):null;return p.j.tc(_,D,I,!0)},getBindingsString:function(D){switch(D.nodeType){case 1:return D.getAttribute("data-bind");case 8:return p.h.Vd(D);default:return null}},parseBindingsString:function(D,I,_,v){try{var O=this.nd,N=D+(v&&v.valueAccessors||""),V;if(!(V=O[N])){var k,G="with($context){with($data||{}){return{"+p.m.vb(D,v)+"}}}";k=new Function("$context","$element",G),V=O[N]=k}return V(I,_)}catch(W){throw W.message=`Unable to parse bindings.
|
||
Bindings value: `+D+`
|
||
Message: `+W.message,W}}}),p.ga.instance=new p.ga}(),p.b("bindingProvider",p.ga),function(){function D(re){var he=(re=p.a.g.get(re,ue))&&re.N;he&&(re.N=null,he.Tc())}function I(re,he,ce){this.node=re,this.yc=he,this.kb=[],this.H=!1,he.N||p.a.K.za(re,D),ce&&ce.N&&(ce.N.kb.push(re),this.Kb=ce)}function _(re){return function(){return re}}function v(re){return re()}function O(re){return p.a.Ga(p.u.G(re),function(he,ce){return function(){return re()[ce]}})}function N(re,he,ce){return typeof re=="function"?O(re.bind(null,he,ce)):p.a.Ga(re,_)}function V(re,he){return O(this.getBindings.bind(this,re,he))}function k(re,he){var ce=p.h.firstChild(he);if(ce){var Q,ne=p.ga.instance,de=ne.preprocessNode;if(de){for(;Q=ce;)ce=p.h.nextSibling(Q),de.call(ne,Q);ce=p.h.firstChild(he)}for(;Q=ce;)ce=p.h.nextSibling(Q),G(re,Q)}p.i.ma(he,p.i.H)}function G(re,he){var ce=re,Q=he.nodeType===1;Q&&p.h.Sc(he),(Q||p.ga.instance.nodeHasBindings(he))&&(ce=K(he,null,re).bindingContextForDescendants),ce&&!$[p.a.R(he)]&&k(ce,he)}function W(re){var he=[],ce={},Q=[];return p.a.P(re,function ne(de){if(!ce[de]){var _e=p.getBindingHandler(de);_e&&(_e.after&&(Q.push(de),p.a.D(_e.after,function(Se){if(re[Se]){if(p.a.A(Q,Se)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Q.join(", "));ne(Se)}}),Q.length--),he.push({key:de,Mc:_e})),ce[de]=!0}}),he}function K(re,he,ce){var Q=p.a.g.Ub(re,ue,{}),ne=Q.hd;if(!he){if(ne)throw Error("You cannot apply bindings multiple times to the same element.");Q.hd=!0}ne||(Q.context=ce),Q.Zb||(Q.Zb={});var de;if(he&&typeof he!="function")de=he;else{var _e=p.ga.instance,Se=_e.getBindingAccessors||V,ve=p.$(function(){return(de=he?he(ce,re):Se.call(_e,re,ce))&&(ce[te]&&ce[te](),ce[X]&&ce[X]()),de},null,{l:re});de&&ve.ja()||(ve=null)}var Le=ce,Ee;if(de){var Be=function(){return p.a.Ga(ve?ve():de,v)},Pe=ve?function(Ae){return function(){return v(ve()[Ae])}}:function(Ae){return de[Ae]};Be.get=function(Ae){return de[Ae]&&v(Pe(Ae))},Be.has=function(Ae){return Ae in de},p.i.H in de&&p.i.subscribe(re,p.i.H,function(){var Ae=(0,de[p.i.H])();if(Ae){var xe=p.h.childNodes(re);xe.length&&Ae(xe,p.Ec(xe[0]))}}),p.i.pa in de&&(Le=p.i.Cb(re,ce),p.i.subscribe(re,p.i.pa,function(){var Ae=(0,de[p.i.pa])();Ae&&p.h.firstChild(re)&&Ae(re)})),Q=W(de),p.a.D(Q,function(Ae){var xe=Ae.Mc.init,Oe=Ae.Mc.update,Ve=Ae.key;if(re.nodeType===8&&!p.h.ea[Ve])throw Error("The binding '"+Ve+"' cannot be used with virtual elements");try{typeof xe=="function"&&p.u.G(function(){var Re=xe(re,Pe(Ve),Be,Le.$data,Le);if(Re&&Re.controlsDescendantBindings){if(Ee!==e)throw Error("Multiple bindings ("+Ee+" and "+Ve+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Ee=Ve}}),typeof Oe=="function"&&p.$(function(){Oe(re,Pe(Ve),Be,Le.$data,Le)},null,{l:re})}catch(Re){throw Re.message='Unable to process binding "'+Ve+": "+de[Ve]+`"
|
||
Message: `+Re.message,Re}})}return Q=Ee===e,{shouldBindDescendants:Q,bindingContextForDescendants:Q&&Le}}function q(re,he){return re&&re instanceof p.fa?re:new p.fa(re,e,e,he)}var te=p.a.Da("_subscribable"),Y=p.a.Da("_ancestorBindingInfo"),X=p.a.Da("_dataDependency");p.c={};var $={script:!0,textarea:!0,template:!0};p.getBindingHandler=function(re){return p.c[re]};var se={};p.fa=function(re,he,ce,Q,ne){function de(){var Pe=Le?ve():ve,Ae=p.a.f(Pe);return he?(p.a.extend(_e,he),Y in he&&(_e[Y]=he[Y])):(_e.$parents=[],_e.$root=Ae,_e.ko=p),_e[te]=Ee,Se?Ae=_e.$data:(_e.$rawData=Pe,_e.$data=Ae),ce&&(_e[ce]=Ae),Q&&Q(_e,he,Ae),he&&he[te]&&!p.S.o().Vb(he[te])&&he[te](),Be&&(_e[X]=Be),_e.$data}var _e=this,Se=re===se,ve=Se?e:re,Le=typeof ve=="function"&&!p.O(ve),Ee,Be=ne&&ne.dataDependency;ne&&ne.exportDependencies?de():(Ee=p.xb(de),Ee.v(),Ee.ja()?Ee.equalityComparer=null:_e[te]=e)},p.fa.prototype.createChildContext=function(re,he,ce,Q){if(!Q&&he&&typeof he=="object"&&(Q=he,he=Q.as,ce=Q.extend),he&&Q&&Q.noChildContext){var ne=typeof re=="function"&&!p.O(re);return new p.fa(se,this,null,function(de){ce&&ce(de),de[he]=ne?re():re},Q)}return new p.fa(re,this,he,function(de,_e){de.$parentContext=_e,de.$parent=_e.$data,de.$parents=(_e.$parents||[]).slice(0),de.$parents.unshift(de.$parent),ce&&ce(de)},Q)},p.fa.prototype.extend=function(re,he){return new p.fa(se,this,null,function(ce){p.a.extend(ce,typeof re=="function"?re(ce):re)},he)};var ue=p.a.g.Z();I.prototype.Tc=function(){this.Kb&&this.Kb.N&&this.Kb.N.sd(this.node)},I.prototype.sd=function(re){p.a.Pa(this.kb,re),!this.kb.length&&this.H&&this.Cc()},I.prototype.Cc=function(){this.H=!0,this.yc.N&&!this.kb.length&&(this.yc.N=null,p.a.K.yb(this.node,D),p.i.ma(this.node,p.i.pa),this.Tc())},p.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(re,he,ce,Q,ne){var de=p.a.g.Ub(re,ue,{});return de.Fa||(de.Fa=new p.T),ne&&ne.notifyImmediately&&de.Zb[he]&&p.u.G(ce,Q,[re]),de.Fa.subscribe(ce,Q,he)},ma:function(re,he){var ce=p.a.g.get(re,ue);if(ce&&(ce.Zb[he]=!0,ce.Fa&&ce.Fa.notifySubscribers(re,he),he==p.i.H)){if(ce.N)ce.N.Cc();else if(ce.N===e&&ce.Fa&&ce.Fa.Wa(p.i.pa))throw Error("descendantsComplete event not supported for bindings on this node")}},Cb:function(re,he){var ce=p.a.g.Ub(re,ue,{});return ce.N||(ce.N=new I(re,ce,he[Y])),he[Y]==ce?he:he.extend(function(Q){Q[Y]=ce})}},p.Td=function(re){return(re=p.a.g.get(re,ue))&&re.context},p.ib=function(re,he,ce){return re.nodeType===1&&p.h.Sc(re),K(re,he,q(ce))},p.ld=function(re,he,ce){return ce=q(ce),p.ib(re,N(he,ce,re),ce)},p.Oa=function(re,he){he.nodeType!==1&&he.nodeType!==8||k(q(re),he)},p.vc=function(re,he,ce){if(!o&&t.jQuery&&(o=t.jQuery),2>arguments.length){if(he=n.body,!he)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?")}else if(!he||he.nodeType!==1&&he.nodeType!==8)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");G(q(re,ce),he)},p.Dc=function(re){return!re||re.nodeType!==1&&re.nodeType!==8?e:p.Td(re)},p.Ec=function(re){return(re=p.Dc(re))?re.$data:e},p.b("bindingHandlers",p.c),p.b("bindingEvent",p.i),p.b("bindingEvent.subscribe",p.i.subscribe),p.b("bindingEvent.startPossiblyAsyncContentBinding",p.i.Cb),p.b("applyBindings",p.vc),p.b("applyBindingsToDescendants",p.Oa),p.b("applyBindingAccessorsToNode",p.ib),p.b("applyBindingsToNode",p.ld),p.b("contextFor",p.Dc),p.b("dataFor",p.Ec)}(),function(D){function I(V,k){var G=Object.prototype.hasOwnProperty.call(O,V)?O[V]:D,W;G?G.subscribe(k):(G=O[V]=new p.T,G.subscribe(k),_(V,function(K,q){var te=!(!q||!q.synchronous);N[V]={definition:K,Gd:te},delete O[V],W||te?G.notifySubscribers(K):p.na.zb(function(){G.notifySubscribers(K)})}),W=!0)}function _(V,k){v("getConfig",[V],function(G){G?v("loadComponent",[V,G],function(W){k(W,G)}):k(null,null)})}function v(V,k,G,W){W||(W=p.j.loaders.slice(0));var K=W.shift();if(K){var q=K[V];if(q){var te=!1;if(q.apply(K,k.concat(function(Y){te?G(null):Y!==null?G(Y):v(V,k,G,W)}))!==D&&(te=!0,!K.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else v(V,k,G,W)}else G(null)}var O={},N={};p.j={get:function(V,k){var G=Object.prototype.hasOwnProperty.call(N,V)?N[V]:D;G?G.Gd?p.u.G(function(){k(G.definition)}):p.na.zb(function(){k(G.definition)}):I(V,k)},Bc:function(V){delete N[V]},oc:v},p.j.loaders=[],p.b("components",p.j),p.b("components.get",p.j.get),p.b("components.clearCachedDefinition",p.j.Bc)}(),function(){function D(G,W,K,q){function te(){--X===0&&q(Y)}var Y={},X=2,$=K.template;K=K.viewModel,$?O(W,$,function(se){p.j.oc("loadTemplate",[G,se],function(ue){Y.template=ue,te()})}):te(),K?O(W,K,function(se){p.j.oc("loadViewModel",[G,se],function(ue){Y[k]=ue,te()})}):te()}function I(G,W,K){if(typeof W=="function")K(function(te){return new W(te)});else if(typeof W[k]=="function")K(W[k]);else if("instance"in W){var q=W.instance;K(function(){return q})}else"viewModel"in W?I(G,W.viewModel,K):G("Unknown viewModel value: "+W)}function _(G){switch(p.a.R(G)){case"script":return p.a.ua(G.text);case"textarea":return p.a.ua(G.value);case"template":if(v(G.content))return p.a.Ca(G.content.childNodes)}return p.a.Ca(G.childNodes)}function v(G){return t.DocumentFragment?G instanceof DocumentFragment:G&&G.nodeType===11}function O(G,W,K){typeof W.require=="string"?a||t.require?(a||t.require)([W.require],function(q){q&&typeof q=="object"&&q.Xd&&q.default&&(q=q.default),K(q)}):G("Uses require, but no AMD loader is present"):K(W)}function N(G){return function(W){throw Error("Component '"+G+"': "+W)}}var V={};p.j.register=function(G,W){if(!W)throw Error("Invalid configuration for "+G);if(p.j.tb(G))throw Error("Component "+G+" is already registered");V[G]=W},p.j.tb=function(G){return Object.prototype.hasOwnProperty.call(V,G)},p.j.unregister=function(G){delete V[G],p.j.Bc(G)},p.j.Fc={getConfig:function(G,W){W(p.j.tb(G)?V[G]:null)},loadComponent:function(G,W,K){var q=N(G);O(q,W,function(te){D(G,q,te,K)})},loadTemplate:function(G,W,K){if(G=N(G),typeof W=="string")K(p.a.ua(W));else if(W instanceof Array)K(W);else if(v(W))K(p.a.la(W.childNodes));else if(W.element)if(W=W.element,t.HTMLElement?W instanceof HTMLElement:W&&W.tagName&&W.nodeType===1)K(_(W));else if(typeof W=="string"){var q=n.getElementById(W);q?K(_(q)):G("Cannot find element with ID "+W)}else G("Unknown element type: "+W);else G("Unknown template value: "+W)},loadViewModel:function(G,W,K){I(N(G),W,K)}};var k="createViewModel";p.b("components.register",p.j.register),p.b("components.isRegistered",p.j.tb),p.b("components.unregister",p.j.unregister),p.b("components.defaultLoader",p.j.Fc),p.j.loaders.push(p.j.Fc),p.j.dd=V}(),function(){function D(_,v){var O=_.getAttribute("params");if(O){var O=I.parseBindingsString(O,v,_,{valueAccessors:!0,bindingParams:!0}),O=p.a.Ga(O,function(k){return p.o(k,null,{l:_})}),N=p.a.Ga(O,function(k){var G=k.v();return k.ja()?p.o({read:function(){return p.a.f(k())},write:p.Za(G)&&function(W){k()(W)},l:_}):G});return Object.prototype.hasOwnProperty.call(N,"$raw")||(N.$raw=O),N}return{$raw:{}}}p.j.getComponentNameForNode=function(_){var v=p.a.R(_);if(p.j.tb(v)&&(v.indexOf("-")!=-1||""+_=="[object HTMLUnknownElement]"||8>=p.a.W&&_.tagName===v))return v},p.j.tc=function(_,v,O,N){if(v.nodeType===1){var V=p.j.getComponentNameForNode(v);if(V){if(_=_||{},_.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var k={name:V,params:D(v,O)};_.component=N?function(){return k}:k}}return _};var I=new p.ga;9>p.a.W&&(p.j.register=function(_){return function(v){return _.apply(this,arguments)}}(p.j.register),n.createDocumentFragment=function(_){return function(){var v=_();return p.j.dd,v}}(n.createDocumentFragment))}(),function(){function D(v,O,N){if(O=O.template,!O)throw Error("Component '"+v+"' has no template");v=p.a.Ca(O),p.h.va(N,v)}function I(v,O,N){var V=v.createViewModel;return V?V.call(v,O,N):O}var _=0;p.c.component={init:function(v,O,N,V,k){function G(){var Y=W&&W.dispose;typeof Y=="function"&&Y.call(W),q&&q.s(),K=W=q=null}var W,K,q,te=p.a.la(p.h.childNodes(v));return p.h.Ea(v),p.a.K.za(v,G),p.o(function(){var Y=p.a.f(O()),X,$;if(typeof Y=="string"?X=Y:(X=p.a.f(Y.name),$=p.a.f(Y.params)),!X)throw Error("No component name specified");var se=p.i.Cb(v,k),ue=K=++_;p.j.get(X,function(re){if(K===ue){if(G(),!re)throw Error("Unknown component '"+X+"'");D(X,re,v);var he=I(re,$,{element:v,templateNodes:te});re=se.createChildContext(he,{extend:function(ce){ce.$component=he,ce.$componentTemplateNodes=te}}),he&&he.koDescendantsComplete&&(q=p.i.subscribe(v,p.i.pa,he.koDescendantsComplete,he)),W=he,p.Oa(re,v)}})},null,{l:v}),{controlsDescendantBindings:!0}}},p.h.ea.component=!0}();var F={class:"className",for:"htmlFor"};p.c.attr={update:function(D,I){var _=p.a.f(I())||{};p.a.P(_,function(v,O){O=p.a.f(O);var N=v.indexOf(":"),N="lookupNamespaceURI"in D&&0<N&&D.lookupNamespaceURI(v.substr(0,N)),V=O===!1||O===null||O===e;V?N?D.removeAttributeNS(N,v):D.removeAttribute(v):O=O.toString(),8>=p.a.W&&v in F?(v=F[v],V?D.removeAttribute(v):D[v]=O):V||(N?D.setAttributeNS(N,v,O):D.setAttribute(v,O)),v==="name"&&p.a.Yc(D,V?"":O)})}},function(){p.c.checked={after:["value","attr"],init:function(D,I,_){function v(){var Y=D.checked,X=N();if(!p.S.Ya()&&(Y||!k&&!p.S.qa())){var $=p.u.G(I);if(W){var se=K?$.v():$,ue=te;te=X,ue!==X?Y&&(p.a.Na(se,X,!0),p.a.Na(se,ue,!1)):p.a.Na(se,X,Y),K&&p.Za($)&&$(se)}else V&&(X===e?X=Y:Y||(X=e)),p.m.eb($,_,"checked",X,!0)}}function O(){var Y=p.a.f(I()),X=N();W?(D.checked=0<=p.a.A(Y,X),te=X):D.checked=V&&X===e?!!Y:N()===Y}var N=p.xb(function(){if(_.has("checkedValue"))return p.a.f(_.get("checkedValue"));if(q)return _.has("value")?p.a.f(_.get("value")):D.value}),V=D.type=="checkbox",k=D.type=="radio";if(V||k){var G=I(),W=V&&p.a.f(G)instanceof Array,K=!(W&&G.push&&G.splice),q=k||W,te=W?N():e;k&&!D.name&&p.c.uniqueName.init(D,function(){return!0}),p.o(v,null,{l:D}),p.a.B(D,"click",v),p.o(O,null,{l:D}),G=e}}},p.m.wa.checked=!0,p.c.checkedValue={update:function(D,I){D.value=p.a.f(I())}}}(),p.c.class={update:function(D,I){var _=p.a.Db(p.a.f(I()));p.a.Eb(D,D.__ko__cssValue,!1),D.__ko__cssValue=_,p.a.Eb(D,_,!0)}},p.c.css={update:function(D,I){var _=p.a.f(I());_!==null&&typeof _=="object"?p.a.P(_,function(v,O){O=p.a.f(O),p.a.Eb(D,v,O)}):p.c.class.update(D,I)}},p.c.enable={update:function(D,I){var _=p.a.f(I());_&&D.disabled?D.removeAttribute("disabled"):_||D.disabled||(D.disabled=!0)}},p.c.disable={update:function(D,I){p.c.enable.update(D,function(){return!p.a.f(I())})}},p.c.event={init:function(D,I,_,v,O){var N=I()||{};p.a.P(N,function(V){typeof V=="string"&&p.a.B(D,V,function(k){var G,W=I()[V];if(W){try{var K=p.a.la(arguments);v=O.$data,K.unshift(v),G=W.apply(v,K)}finally{G!==!0&&(k.preventDefault?k.preventDefault():k.returnValue=!1)}_.get(V+"Bubble")===!1&&(k.cancelBubble=!0,k.stopPropagation&&k.stopPropagation())}})})}},p.c.foreach={Rc:function(D){return function(){var I=D(),_=p.a.bc(I);return!_||typeof _.length=="number"?{foreach:I,templateEngine:p.ba.Ma}:(p.a.f(I),{foreach:_.data,as:_.as,noChildContext:_.noChildContext,includeDestroyed:_.includeDestroyed,afterAdd:_.afterAdd,beforeRemove:_.beforeRemove,afterRender:_.afterRender,beforeMove:_.beforeMove,afterMove:_.afterMove,templateEngine:p.ba.Ma})}},init:function(D,I){return p.c.template.init(D,p.c.foreach.Rc(I))},update:function(D,I,_,v,O){return p.c.template.update(D,p.c.foreach.Rc(I),_,v,O)}},p.m.Ra.foreach=!1,p.h.ea.foreach=!0,p.c.hasfocus={init:function(D,I,_){function v(V){D.__ko_hasfocusUpdating=!0;var k=D.ownerDocument;if("activeElement"in k){var G;try{G=k.activeElement}catch{G=k.body}V=G===D}k=I(),p.m.eb(k,_,"hasfocus",V,!0),D.__ko_hasfocusLastValue=V,D.__ko_hasfocusUpdating=!1}var O=v.bind(null,!0),N=v.bind(null,!1);p.a.B(D,"focus",O),p.a.B(D,"focusin",O),p.a.B(D,"blur",N),p.a.B(D,"focusout",N),D.__ko_hasfocusLastValue=!1},update:function(D,I){var _=!!p.a.f(I());D.__ko_hasfocusUpdating||D.__ko_hasfocusLastValue===_||(_?D.focus():D.blur(),!_&&D.__ko_hasfocusLastValue&&D.ownerDocument.body.focus(),p.u.G(p.a.Fb,null,[D,_?"focusin":"focusout"]))}},p.m.wa.hasfocus=!0,p.c.hasFocus=p.c.hasfocus,p.m.wa.hasFocus="hasfocus",p.c.html={init:function(){return{controlsDescendantBindings:!0}},update:function(D,I){p.a.fc(D,I())}},function(){function D(I,_,v){p.c[I]={init:function(O,N,V,k,G){var W,K,q={},te,Y,X;if(_){k=V.get("as");var $=V.get("noChildContext");X=!(k&&$),q={as:k,noChildContext:$,exportDependencies:X}}return Y=(te=V.get("completeOn")=="render")||V.has(p.i.pa),p.o(function(){var se=p.a.f(N()),ue=!v!=!se,re=!K,he;(X||ue!==W)&&(Y&&(G=p.i.Cb(O,G)),ue&&((!_||X)&&(q.dataDependency=p.S.o()),he=_?G.createChildContext(typeof se=="function"?se:N,q):p.S.qa()?G.extend(null,q):G),re&&p.S.qa()&&(K=p.a.Ca(p.h.childNodes(O),!0)),ue?(re||p.h.va(O,p.a.Ca(K)),p.Oa(he,O)):(p.h.Ea(O),te||p.i.ma(O,p.i.H)),W=ue)},null,{l:O}),{controlsDescendantBindings:!0}}},p.m.Ra[I]=!1,p.h.ea[I]=!0}D("if"),D("ifnot",!1,!0),D("with",!0)}(),p.c.let={init:function(D,I,_,v,O){return I=O.extend(I),p.Oa(I,D),{controlsDescendantBindings:!0}}},p.h.ea.let=!0;var U={};p.c.options={init:function(D){if(p.a.R(D)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<D.length;)D.remove(0);return{controlsDescendantBindings:!0}},update:function(D,I,_){function v(){return p.a.jb(D.options,function($){return $.selected})}function O($,se,ue){var re=typeof se;return re=="function"?se($):re=="string"?$[se]:ue}function N($,se){if(Y&&W)p.i.ma(D,p.i.H);else if(te.length){var ue=0<=p.a.A(te,p.w.M(se[0]));p.a.Zc(se[0],ue),Y&&!ue&&p.u.G(p.a.Fb,null,[D,"change"])}}var V=D.multiple,k=D.length!=0&&V?D.scrollTop:null,G=p.a.f(I()),W=_.get("valueAllowUnset")&&_.has("value"),K=_.get("optionsIncludeDestroyed");I={};var q,te=[];W||(V?te=p.a.Mb(v(),p.w.M):0<=D.selectedIndex&&te.push(p.w.M(D.options[D.selectedIndex]))),G&&(typeof G.length>"u"&&(G=[G]),q=p.a.jb(G,function($){return K||$===e||$===null||!p.a.f($._destroy)}),_.has("optionsCaption")&&(G=p.a.f(_.get("optionsCaption")),G!==null&&G!==e&&q.unshift(U)));var Y=!1;if(I.beforeRemove=function($){D.removeChild($)},G=N,_.has("optionsAfterRender")&&typeof _.get("optionsAfterRender")=="function"&&(G=function($,se){N(0,se),p.u.G(_.get("optionsAfterRender"),null,[se[0],$!==U?$:e])}),p.a.ec(D,q,function($,se,ue){return ue.length&&(te=!W&&ue[0].selected?[p.w.M(ue[0])]:[],Y=!0),se=D.ownerDocument.createElement("option"),$===U?(p.a.Bb(se,_.get("optionsCaption")),p.w.cb(se,e)):(ue=O($,_.get("optionsValue"),$),p.w.cb(se,p.a.f(ue)),$=O($,_.get("optionsText"),ue),p.a.Bb(se,$)),[se]},I,G),!W){var X;V?X=te.length&&v().length<te.length:X=te.length&&0<=D.selectedIndex?p.w.M(D.options[D.selectedIndex])!==te[0]:te.length||0<=D.selectedIndex,X&&p.u.G(p.a.Fb,null,[D,"change"])}(W||p.S.Ya())&&p.i.ma(D,p.i.H),p.a.wd(D),k&&20<Math.abs(k-D.scrollTop)&&(D.scrollTop=k)}},p.c.options.$b=p.a.g.Z(),p.c.selectedOptions={init:function(D,I,_){function v(){var V=I(),k=[];p.a.D(D.getElementsByTagName("option"),function(G){G.selected&&k.push(p.w.M(G))}),p.m.eb(V,_,"selectedOptions",k)}function O(){var V=p.a.f(I()),k=D.scrollTop;V&&typeof V.length=="number"&&p.a.D(D.getElementsByTagName("option"),function(G){var W=0<=p.a.A(V,p.w.M(G));G.selected!=W&&p.a.Zc(G,W)}),D.scrollTop=k}if(p.a.R(D)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var N;p.i.subscribe(D,p.i.H,function(){N?v():(p.a.B(D,"change",v),N=p.o(O,null,{l:D}))},null,{notifyImmediately:!0})},update:function(){}},p.m.wa.selectedOptions=!0,p.c.style={update:function(D,I){var _=p.a.f(I()||{});p.a.P(_,function(v,O){if(O=p.a.f(O),(O===null||O===e||O===!1)&&(O=""),o)o(D).css(v,O);else if(/^--/.test(v))D.style.setProperty(v,O);else{v=v.replace(/-(\w)/g,function(V,k){return k.toUpperCase()});var N=D.style[v];D.style[v]=O,O===N||D.style[v]!=N||isNaN(O)||(D.style[v]=O+"px")}})}},p.c.submit={init:function(D,I,_,v,O){if(typeof I()!="function")throw Error("The value for a submit binding must be a function");p.a.B(D,"submit",function(N){var V,k=I();try{V=k.call(O.$data,D)}finally{V!==!0&&(N.preventDefault?N.preventDefault():N.returnValue=!1)}})}},p.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(D,I){p.a.Bb(D,I())}},p.h.ea.text=!0,function(){if(t&&t.navigator){var D=function(q){if(q)return parseFloat(q[1])},I=t.navigator.userAgent,_,v,O,N,V;(_=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(V=D(I.match(/Edge\/([^ ]+)$/)))||D(I.match(/Chrome\/([^ ]+)/))||(v=D(I.match(/Version\/([^ ]+) Safari/)))||(O=D(I.match(/Firefox\/([^ ]+)/)))||(N=p.a.W||D(I.match(/MSIE ([^ ]+)/)))||(N=D(I.match(/rv:([^ )]+)/)))}if(8<=N&&10>N)var k=p.a.g.Z(),G=p.a.g.Z(),W=function(q){var te=this.activeElement;(te=te&&p.a.g.get(te,G))&&te(q)},K=function(q,te){var Y=q.ownerDocument;p.a.g.get(Y,k)||(p.a.g.set(Y,k,!0),p.a.B(Y,"selectionchange",W)),p.a.g.set(q,G,te)};p.c.textInput={init:function(q,te,Y){function X(de,_e){p.a.B(q,de,_e)}function $(){var de=p.a.f(te());(de===null||de===e)&&(de=""),ce!==e&&de===ce?p.a.setTimeout($,4):q.value!==de&&(ne=!0,q.value=de,ne=!1,re=q.value)}function se(){he||(ce=q.value,he=p.a.setTimeout(ue,4))}function ue(){clearTimeout(he),ce=he=e;var de=q.value;re!==de&&(re=de,p.m.eb(te(),Y,"textInput",de))}var re=q.value,he,ce,Q=p.a.W==9?se:ue,ne=!1;N&&X("keypress",ue),11>N&&X("propertychange",function(de){ne||de.propertyName!=="value"||Q()}),N==8&&(X("keyup",ue),X("keydown",ue)),K&&(K(q,Q),X("dragend",se)),(!N||9<=N)&&X("input",Q),5>v&&p.a.R(q)==="textarea"?(X("keydown",se),X("paste",se),X("cut",se)):11>_?X("keydown",se):4>O?(X("DOMAutoComplete",ue),X("dragdrop",ue),X("drop",ue)):V&&q.type==="number"&&X("keydown",se),X("change",ue),X("blur",ue),p.o($,null,{l:q})}},p.m.wa.textInput=!0,p.c.textinput={preprocess:function(q,te,Y){Y("textInput",q)}}}(),p.c.uniqueName={init:function(D,I){if(I()){var _="ko_unique_"+ ++p.c.uniqueName.rd;p.a.Yc(D,_)}}},p.c.uniqueName.rd=0,p.c.using={init:function(D,I,_,v,O){var N;return _.has("as")&&(N={as:_.get("as"),noChildContext:_.get("noChildContext")}),I=O.createChildContext(I,N),p.Oa(I,D),{controlsDescendantBindings:!0}}},p.h.ea.using=!0,p.c.value={init:function(D,I,_){var v=p.a.R(D),O=v=="input";if(!O||D.type!="checkbox"&&D.type!="radio"){var N=[],V=_.get("valueUpdate"),k=!1,G=null;V&&(typeof V=="string"?N=[V]:N=p.a.wc(V),p.a.Pa(N,"change"));var W=function(){G=null,k=!1;var te=I(),Y=p.w.M(D);p.m.eb(te,_,"value",Y)};!p.a.W||!O||D.type!="text"||D.autocomplete=="off"||D.form&&D.form.autocomplete=="off"||p.a.A(N,"propertychange")!=-1||(p.a.B(D,"propertychange",function(){k=!0}),p.a.B(D,"focus",function(){k=!1}),p.a.B(D,"blur",function(){k&&W()})),p.a.D(N,function(te){var Y=W;p.a.Ud(te,"after")&&(Y=function(){G=p.w.M(D),p.a.setTimeout(W,0)},te=te.substring(5)),p.a.B(D,te,Y)});var K;if(K=O&&D.type=="file"?function(){var te=p.a.f(I());te===null||te===e||te===""?D.value="":p.u.G(W)}:function(){var te=p.a.f(I()),Y=p.w.M(D);G!==null&&te===G?p.a.setTimeout(K,0):(te!==Y||Y===e)&&(v==="select"?(Y=_.get("valueAllowUnset"),p.w.cb(D,te,Y),Y||te===p.w.M(D)||p.u.G(W)):p.w.cb(D,te))},v==="select"){var q;p.i.subscribe(D,p.i.H,function(){q?_.get("valueAllowUnset")?K():W():(p.a.B(D,"change",W),q=p.o(K,null,{l:D}))},null,{notifyImmediately:!0})}else p.a.B(D,"change",W),p.o(K,null,{l:D})}else p.ib(D,{checkedValue:I})},update:function(){}},p.m.wa.value=!0,p.c.visible={update:function(D,I){var _=p.a.f(I()),v=D.style.display!="none";_&&!v?D.style.display="":!_&&v&&(D.style.display="none")}},p.c.hidden={update:function(D,I){p.c.visible.update(D,function(){return!p.a.f(I())})}},function(D){p.c[D]={init:function(I,_,v,O,N){return p.c.event.init.call(this,I,function(){var V={};return V[D]=_(),V},v,O,N)}}}("click"),p.ca=function(){},p.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource")},p.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock")},p.ca.prototype.makeTemplateSource=function(D,I){if(typeof D=="string"){I=I||n;var _=I.getElementById(D);if(!_)throw Error("Cannot find template with ID "+D);return new p.C.F(_)}if(D.nodeType==1||D.nodeType==8)return new p.C.ia(D);throw Error("Unknown template type: "+D)},p.ca.prototype.renderTemplate=function(D,I,_,v){return D=this.makeTemplateSource(D,v),this.renderTemplateSource(D,I,_,v)},p.ca.prototype.isTemplateRewritten=function(D,I){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(D,I).data("isRewritten")},p.ca.prototype.rewriteTemplate=function(D,I,_){D=this.makeTemplateSource(D,_),I=I(D.text()),D.text(I),D.data("isRewritten",!0)},p.b("templateEngine",p.ca),p.kc=function(){function D(v,O,N,V){v=p.m.ac(v);for(var k=p.m.Ra,G=0;G<v.length;G++){var W=v[G].key;if(Object.prototype.hasOwnProperty.call(k,W)){var K=k[W];if(typeof K=="function"){if(W=K(v[G].value))throw Error(W)}else if(!K)throw Error("This template engine does not support the '"+W+"' binding within its templates")}}return N="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+p.m.vb(v,{valueAccessors:!0})+" } })()},'"+N.toLowerCase()+"')",V.createJavaScriptEvaluatorBlock(N)+O}var I=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,_=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(v,O,N){O.isTemplateRewritten(v,N)||O.rewriteTemplate(v,function(V){return p.kc.Ld(V,O)},N)},Ld:function(v,O){return v.replace(I,function(N,V,k,G,W){return D(W,V,k,O)}).replace(_,function(N,V){return D(V,"<!-- ko -->","#comment",O)})},md:function(v,O){return p.aa.Xb(function(N,V){var k=N.nextSibling;k&&k.nodeName.toLowerCase()===O&&p.ib(k,v,V)})}}}(),p.b("__tr_ambtns",p.kc.md),function(){p.C={},p.C.F=function(_){if(this.F=_){var v=p.a.R(_);this.ab=v==="script"?1:v==="textarea"?2:v=="template"&&_.content&&_.content.nodeType===11?3:4}},p.C.F.prototype.text=function(){var _=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[_];var v=arguments[0];_==="innerHTML"?p.a.fc(this.F,v):this.F[_]=v};var D=p.a.g.Z()+"_";p.C.F.prototype.data=function(_){if(arguments.length===1)return p.a.g.get(this.F,D+_);p.a.g.set(this.F,D+_,arguments[1])};var I=p.a.g.Z();p.C.F.prototype.nodes=function(){var _=this.F;if(arguments.length==0){var v=p.a.g.get(_,I)||{},O=v.lb||(this.ab===3?_.content:this.ab===4?_:e);if(!O||v.jd){var N=this.text();N&&N!==v.bb&&(O=p.a.Md(N,_.ownerDocument),p.a.g.set(_,I,{lb:O,bb:N,jd:!0}))}return O}v=arguments[0],this.ab!==e&&this.text(""),p.a.g.set(_,I,{lb:v})},p.C.ia=function(_){this.F=_},p.C.ia.prototype=new p.C.F,p.C.ia.prototype.constructor=p.C.ia,p.C.ia.prototype.text=function(){if(arguments.length==0){var _=p.a.g.get(this.F,I)||{};return _.bb===e&&_.lb&&(_.bb=_.lb.innerHTML),_.bb}p.a.g.set(this.F,I,{bb:arguments[0]})},p.b("templateSources",p.C),p.b("templateSources.domElement",p.C.F),p.b("templateSources.anonymousTemplate",p.C.ia)}(),function(){function D(G,W,K){var q;for(W=p.h.nextSibling(W);G&&(q=G)!==W;)G=p.h.nextSibling(q),K(q,G)}function I(G,W){if(G.length){var K=G[0],q=G[G.length-1],te=K.parentNode,Y=p.ga.instance,X=Y.preprocessNode;if(X){if(D(K,q,function($,se){var ue=$.previousSibling,re=X.call(Y,$);re&&($===K&&(K=re[0]||se),$===q&&(q=re[re.length-1]||ue))}),G.length=0,!K)return;K===q?G.push(K):(G.push(K,q),p.a.Ua(G,te))}D(K,q,function($){$.nodeType!==1&&$.nodeType!==8||p.vc(W,$)}),D(K,q,function($){$.nodeType!==1&&$.nodeType!==8||p.aa.cd($,[W])}),p.a.Ua(G,te)}}function _(G){return G.nodeType?G:0<G.length?G[0]:null}function v(G,W,K,q,te){te=te||{};var Y=(G&&_(G)||K||{}).ownerDocument,X=te.templateEngine||N;if(p.kc.xd(K,X,Y),K=X.renderTemplate(K,q,te,Y),typeof K.length!="number"||0<K.length&&typeof K[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch(Y=!1,W){case"replaceChildren":p.h.va(G,K),Y=!0;break;case"replaceNode":p.a.Xc(G,K),Y=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+W)}return Y&&(I(K,q),te.afterRender&&p.u.G(te.afterRender,null,[K,q[te.as||"$data"]]),W=="replaceChildren"&&p.i.ma(G,p.i.H)),K}function O(G,W,K){return p.O(G)?G():typeof G=="function"?G(W,K):G}var N;p.gc=function(G){if(G!=e&&!(G instanceof p.ca))throw Error("templateEngine must inherit from ko.templateEngine");N=G},p.dc=function(G,W,K,q,te){if(K=K||{},(K.templateEngine||N)==e)throw Error("Set a template engine before calling renderTemplate");if(te=te||"replaceChildren",q){var Y=_(q);return p.$(function(){var $=W&&W instanceof p.fa?W:new p.fa(W,null,null,null,{exportDependencies:!0}),X=O(G,$.$data,$),$=v(q,te,X,$,K);te=="replaceNode"&&(q=$,Y=_(q))},null,{Sa:function(){return!Y||!p.a.Sb(Y)},l:Y&&te=="replaceNode"?Y.parentNode:Y})}return p.aa.Xb(function(X){p.dc(G,W,K,X,"replaceNode")})},p.Qd=function(G,W,K,q,te){function Y(ce,Q){p.u.G(p.a.ec,null,[q,ce,$,K,X,Q]),p.i.ma(q,p.i.H)}function X(ce,Q){I(Q,se),K.afterRender&&K.afterRender(Q,ce),se=null}function $(ce,Q){se=te.createChildContext(ce,{as:ue,noChildContext:K.noChildContext,extend:function(de){de.$index=Q,ue&&(de[ue+"Index"]=Q)}});var ne=O(G,ce,se);return v(q,"ignoreTargetNode",ne,se,K)}var se,ue=K.as,re=K.includeDestroyed===!1||p.options.foreachHidesDestroyed&&!K.includeDestroyed;if(re||K.beforeRemove||!p.Pc(W))return p.$(function(){var ce=p.a.f(W)||[];typeof ce.length>"u"&&(ce=[ce]),re&&(ce=p.a.jb(ce,function(Q){return Q===e||Q===null||!p.a.f(Q._destroy)})),Y(ce)},null,{l:q});Y(W.v());var he=W.subscribe(function(ce){Y(W(),ce)},null,"arrayChange");return he.l(q),he};var V=p.a.g.Z(),k=p.a.g.Z();p.c.template={init:function(G,W){var K=p.a.f(W());if(typeof K=="string"||"name"in K)p.h.Ea(G);else if("nodes"in K){if(K=K.nodes||[],p.O(K))throw Error('The "nodes" option must be a plain, non-observable array.');var q=K[0]&&K[0].parentNode;q&&p.a.g.get(q,k)||(q=p.a.Yb(K),p.a.g.set(q,k,!0)),new p.C.ia(G).nodes(q)}else if(K=p.h.childNodes(G),0<K.length)q=p.a.Yb(K),new p.C.ia(G).nodes(q);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(G,W,K,q,te){var Y=W();W=p.a.f(Y),K=!0,q=null,typeof W=="string"?W={}:(Y="name"in W?W.name:G,"if"in W&&(K=p.a.f(W.if)),K&&"ifnot"in W&&(K=!p.a.f(W.ifnot)),K&&!Y&&(K=!1)),"foreach"in W?q=p.Qd(Y,K&&W.foreach||[],W,G,te):K?(K=te,"data"in W&&(K=te.createChildContext(W.data,{as:W.as,noChildContext:W.noChildContext,exportDependencies:!0})),q=p.dc(Y,K,W,G)):p.h.Ea(G),te=q,(W=p.a.g.get(G,V))&&typeof W.s=="function"&&W.s(),p.a.g.set(G,V,!te||te.ja&&!te.ja()?e:te)}},p.m.Ra.template=function(G){return G=p.m.ac(G),G.length==1&&G[0].unknown||p.m.Id(G,"name")?null:"This template engine does not support anonymous templates nested within its templates"},p.h.ea.template=!0}(),p.b("setTemplateEngine",p.gc),p.b("renderTemplate",p.dc),p.a.Kc=function(D,I,_){if(D.length&&I.length){var v,O,N,V,k;for(v=O=0;(!_||v<_)&&(V=D[O]);++O){for(N=0;k=I[N];++N)if(V.value===k.value){V.moved=k.index,k.moved=V.index,I.splice(N,1),v=N=0;break}v+=N}}},p.a.Pb=function(){function D(I,_,v,O,N){var V=Math.min,k=Math.max,G=[],W,K=I.length,q,te=_.length,Y=te-K||1,X=K+te+1,$,se,ue;for(W=0;W<=K;W++)for(se=$,G.push($=[]),ue=V(te,W+Y),q=k(0,W-1);q<=ue;q++)$[q]=q?W?I[W-1]===_[q-1]?se[q-1]:V(se[q]||X,$[q-1]||X)+1:q+1:W+1;for(V=[],k=[],Y=[],W=K,q=te;W||q;)te=G[W][q]-1,q&&te===G[W][q-1]?k.push(V[V.length]={status:v,value:_[--q],index:q}):W&&te===G[W-1][q]?Y.push(V[V.length]={status:O,value:I[--W],index:W}):(--q,--W,N.sparse||V.push({status:"retained",value:_[q]}));return p.a.Kc(Y,k,!N.dontLimitMoves&&10*K),V.reverse()}return function(I,_,v){return v=typeof v=="boolean"?{dontLimitMoves:v}:v||{},I=I||[],_=_||[],I.length<_.length?D(I,_,"added","deleted",v):D(_,I,"deleted","added",v)}}(),p.b("utils.compareArrays",p.a.Pb),function(){function D(v,O,N,V,k){var G=[],W=p.$(function(){var K=O(N,k,p.a.Ua(G,v))||[];0<G.length&&(p.a.Xc(G,K),V&&p.u.G(V,null,[N,K,k])),G.length=0,p.a.Nb(G,K)},null,{l:v,Sa:function(){return!p.a.kd(G)}});return{Y:G,$:W.ja()?W:e}}var I=p.a.g.Z(),_=p.a.g.Z();p.a.ec=function(v,O,N,V,k,G){function W(Ae){ne={Aa:Ae,pb:p.ta(se++)},X.push(ne),Y||Q.push(ne)}function K(Ae){ne=te[Ae],se!==ne.pb.v()&&ce.push(ne),ne.pb(se++),p.a.Ua(ne.Y,v),X.push(ne)}function q(Ae,xe){if(Ae)for(var Oe=0,Ve=xe.length;Oe<Ve;Oe++)p.a.D(xe[Oe].Y,function(Re){Ae(Re,Oe,xe[Oe].Aa)})}O=O||[],typeof O.length>"u"&&(O=[O]),V=V||{};var te=p.a.g.get(v,I),Y=!te,X=[],$=0,se=0,ue=[],re=[],he=[],ce=[],Q=[],ne,de=0;if(Y)p.a.D(O,W);else{if(!G||te&&te._countWaitingForRemove){var _e=p.a.Mb(te,function(Ae){return Ae.Aa});G=p.a.Pb(_e,O,{dontLimitMoves:V.dontLimitMoves,sparse:!0})}for(var _e=0,Se,ve,Le;Se=G[_e];_e++)switch(ve=Se.moved,Le=Se.index,Se.status){case"deleted":for(;$<Le;)K($++);ve===e&&(ne=te[$],ne.$&&(ne.$.s(),ne.$=e),p.a.Ua(ne.Y,v).length&&(V.beforeRemove&&(X.push(ne),de++,ne.Aa===_?ne=null:he.push(ne)),ne&&ue.push.apply(ue,ne.Y))),$++;break;case"added":for(;se<Le;)K($++);ve!==e?(re.push(X.length),K(ve)):W(Se.value)}for(;se<O.length;)K($++);X._countWaitingForRemove=de}p.a.g.set(v,I,X),q(V.beforeMove,ce),p.a.D(ue,V.beforeRemove?p.oa:p.removeNode);var Ee,Be,Pe;try{Pe=v.ownerDocument.activeElement}catch{}if(re.length)for(;(_e=re.shift())!=e;){for(ne=X[_e],Ee=e;_e;)if((Be=X[--_e].Y)&&Be.length){Ee=Be[Be.length-1];break}for(O=0;$=ne.Y[O];Ee=$,O++)p.h.Wb(v,$,Ee)}for(_e=0;ne=X[_e];_e++){for(ne.Y||p.a.extend(ne,D(v,N,ne.Aa,k,ne.pb)),O=0;$=ne.Y[O];Ee=$,O++)p.h.Wb(v,$,Ee);!ne.Ed&&k&&(k(ne.Aa,ne.Y,ne.pb),ne.Ed=!0,Ee=ne.Y[ne.Y.length-1])}for(Pe&&v.ownerDocument.activeElement!=Pe&&Pe.focus(),q(V.beforeRemove,he),_e=0;_e<he.length;++_e)he[_e].Aa=_;q(V.afterMove,ce),q(V.afterAdd,Q)}}(),p.b("utils.setDomNodeChildrenFromArrayMapping",p.a.ec),p.ba=function(){this.allowTemplateRewriting=!1},p.ba.prototype=new p.ca,p.ba.prototype.constructor=p.ba,p.ba.prototype.renderTemplateSource=function(D,I,_,v){return(I=!(9>p.a.W)&&D.nodes?D.nodes():null)?p.a.la(I.cloneNode(!0).childNodes):(D=D.text(),p.a.ua(D,v))},p.ba.Ma=new p.ba,p.gc(p.ba.Ma),p.b("nativeTemplateEngine",p.ba),function(){p.$a=function(){var I=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,O,N){if(N=N||n,O=O||{},2>I)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var V=_.data("precompiled");return V||(V=_.text()||"",V=o.template(null,"{{ko_with $item.koBindingContext}}"+V+"{{/ko_with}}"),_.data("precompiled",V)),_=[v.$data],v=o.extend({koBindingContext:v},O.templateOptions),v=o.tmpl(V,_,v),v.appendTo(N.createElement("div")),o.fragments={},v},this.createJavaScriptEvaluatorBlock=function(_){return"{{ko_code ((function() { return "+_+" })()) }}"},this.addTemplate=function(_,v){n.write("<script type='text/html' id='"+_+"'>"+v+"<\/script>")},0<I&&(o.tmpl.tag.ko_code={open:"__.push($1 || '');"},o.tmpl.tag.ko_with={open:"with($1) {",close:"} "})},p.$a.prototype=new p.ca,p.$a.prototype.constructor=p.$a;var D=new p.$a;0<D.Hd&&p.gc(D),p.b("jqueryTmplTemplateEngine",p.$a)}()})})()})()})();var Glt=ko;typeof window<"u"?(ko=window.ko,typeof Tb<"u"?window.ko=Tb:delete window.ko):(ko=global.ko,typeof Tb<"u"?global.ko=Tb:delete global.ko);const it=Glt;/**
|
||
* @license
|
||
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
|
||
* Copyright (c) Steve Sanderson
|
||
* MIT license
|
||
*/var eN="__knockoutObservables",tN="__knockoutSubscribable";function tne(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=nne(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===eN||o===tN)&&!(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&&jlt(n,a)}}),e}function nne(e,t){var n=e[eN];return!n&&t&&(n={},Object.defineProperty(e,eN,{value:n})),n}function Wlt(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),tne.call(i,e,[t]),e}function jlt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=qlt(e,t,i))})}function qlt(e,t,n){var i=$lt(e,n);return i.subscribe(t)}function $lt(e,t){var n=t[tN];if(!n){n=new e.subscribable,Object.defineProperty(t,tN,{value:n});var i={};Ylt(t,n,i),Xlt(e,t,n,i)}return n}function Ylt(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 Xlt(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 ine(e,t){if(!e)return null;var n=nne(e,!1);return n&&n[t]||null}function Klt(e,t){var n=ine(e,t);n&&n.valueHasMutated()}function Jlt(e){e.track=tne,e.getObservable=ine,e.valueHasMutated=Klt,e.defineProperty=Wlt}const Qlt={attachToKo:Jlt},i6="http://www.w3.org/2000/svg",o6="cesium-svgPath-svg",Zlt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(i6,"svg:svg");i.setAttribute("class",o6);const o=document.createElementNS(i6,"path");return i.appendChild(o),e.virtualElements.setDomNodeChildren(t,[i]),e.computed({read:function(){const r=e.unwrap(n());o.setAttribute("d",e.unwrap(r.path));const 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",`${o6} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},eut=Zlt;Qlt.attachToKo(it);eut.register(it);function ZT(e){l(e)||(e=new gT),this._clock=e,this._eventHelper=new Nd,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=it.observable(ie.now()),this.systemTime.equalityComparer=ie.equals,this.startTime=it.observable(e.startTime),this.startTime.equalityComparer=ie.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=it.observable(e.stopTime),this.stopTime.equalityComparer=ie.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=it.observable(e.currentTime),this.currentTime.equalityComparer=ie.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=it.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=it.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=it.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=it.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=it.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),it.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(ZT.prototype,{clock:{get:function(){return this._clock}}});ZT.prototype.synchronize=function(){const e=this._clock;this.systemTime=ie.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};ZT.prototype.isDestroyed=function(){return!1};ZT.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)};function Eb(e,t){if(!l(e))throw new x("command is required.");this._command=e,t=A(t,A.EMPTY_OBJECT),this.toggled=A(t.toggled,!1),this.tooltip=A(t.tooltip,""),it.track(this,["toggled","tooltip"])}Object.defineProperties(Eb.prototype,{command:{get:function(){return this._command}}});function sr(e,t){if(!l(e))throw new x("func is required.");t=A(t,!0);const n=new Ke,i=new Ke;function o(){if(!o.canExecute)throw new x("Cannot execute command, canExecute is false.");const r={args:arguments,cancel:!1};let s;return n.raiseEvent(r),r.cancel||(s=e.apply(null,arguments),i.raiseEvent(s)),s}return o.canExecute=t,it.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function il(e,t,n,i,o){return n.call(i,e[t]),it.getObservable(e,t).subscribe(n,i,o)}const o_="http://www.w3.org/2000/svg",one="http://www.w3.org/1999/xlink";let bw;const tb=H.fromCssColorString("rgba(247,250,255,0.384)"),Cw=H.fromCssColorString("rgba(143,191,255,0.216)"),mL=H.fromCssColorString("rgba(153,197,255,0.098)"),Tw=H.fromCssColorString("rgba(255,255,255,0.086)"),tut=H.fromCssColorString("rgba(255,255,255,0.267)"),nut=H.fromCssColorString("rgba(255,255,255,0)"),r6=H.fromCssColorString("rgba(66,67,68,0.3)"),s6=H.fromCssColorString("rgba(0,0,0,0.5)");function Bh(e){return H.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const nT={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 jl(e){const t=document.createElementNS(o_,e.tagName);for(const n in e)if(e.hasOwnProperty(n)&&n!=="tagName")if(n==="children"){const i=e.children.length;for(let o=0;o<i;++o)t.appendChild(jl(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(one,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function _L(e,t,n){const i=document.createElementNS(o_,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS(o_,"tspan");return o.textContent=n,i.appendChild(o),i}function iut(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}const Ew=new H;function rr(e,t){const n=t.alpha,i=1-n;return Ew.red=e.red*i+t.red*n,Ew.green=e.green*i+t.green*n,Ew.blue=e.blue*i+t.blue*n,Ew.toCssColorString()}function gL(e,t,n){const i=nT[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 jl(o)}function out(e,t,n){const i=nT[n],o=nT.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 jl(r)}function rut(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&bw!==e))if(t.type==="mousedown"||i&&t.type==="mousemove"||t.type==="touchstart"&&t.touches.length===1||i&&t.type==="touchmove"&&t.touches.length===1){const o=e._centerX,r=e._centerY,a=e._svgNode.getBoundingClientRect();let c,u;if(t.type==="touchstart"||t.type==="touchmove"?(c=t.touches[0].clientX,u=t.touches[0].clientY):(c=t.clientX,u=t.clientY),!i&&(c>a.right||c<a.left||u<a.top||u>a.bottom))return;const d=e._shuttleRingPointer.getBoundingClientRect(),h=c-o-a.left,m=u-r-a.top;let g=Math.atan2(m,h)*180/Math.PI+90;g>180&&(g-=360);const p=n.shuttleRingAngle;i||c<d.right&&c>d.left&&u>d.top&&u<d.bottom?(bw=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<p?n.slower():g>p&&n.faster(),t.preventDefault()}else e===bw&&(bw=void 0),n.shuttleRingDragging=!1}function uf(e,t){this._viewModel=t,this.svgElement=e,this._enabled=void 0,this._toggled=void 0;const n=this;this._clickFunction=function(){const i=n._viewModel.command;i.canExecute&&i()},e.addEventListener("click",this._clickFunction,!0),this._subscriptions=[il(t,"toggled",this.setToggled,this),il(t,"tooltip",this.setTooltip,this),il(t.command,"canExecute",this.setEnabled,this)]}uf.prototype.destroy=function(){this.svgElement.removeEventListener("click",this._clickFunction,!0);const e=this._subscriptions;for(let t=0,n=e.length;t<n;t++)e[t].dispose();He(this)};uf.prototype.isDestroyed=function(){return!1};uf.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")}};uf.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")))};uf.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function K0(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("viewModel is required.");e=Ar(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;const 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]);const 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];const r=document.createElementNS(o_,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",one);const s=document.createElementNS(o_,"g");this._topG=s,this._realtimeSVG=new uf(out(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new uf(gL(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new uf(gL(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new uf(gL(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS(o_,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const c=jl({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;const u=nT.animation_pathSwooshFX,d=nT.animation_pathPointer,h=jl({tagName:"g",class:"cesium-animation-shuttleRingSwoosh",children:[{tagName:u.tagName,transform:"translate(100,97) scale(-1,1)",id:"animation_pathSwooshFX",d:u.d},{tagName:u.tagName,transform:"translate(100,97)",id:"animation_pathSwooshFX",d:u.d},{tagName:"line",x1:100,y1:8,x2:100,y2:22}]});this._shuttleRingSwooshG=h,this._shuttleRingPointer=jl({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:d.tagName,d:d.d});const m=jl({tagName:"g",transform:"translate(100,100)"});this._knobOuter=jl({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const g=61,p=jl({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=_L(0,-24,""),this._knobTime=_L(0,-7,""),this._knobStatus=_L(0,-41,"");const y=jl({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),b=document.createElementNS(o_,"g");b.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(b),s.appendChild(m),s.appendChild(a),b.appendChild(c),b.appendChild(h),b.appendChild(this._shuttleRingPointer),m.appendChild(this._knobOuter),m.appendChild(p),m.appendChild(this._knobDate),m.appendChild(this._knobTime),m.appendChild(this._knobStatus),m.appendChild(y),r.appendChild(s),e.appendChild(r);const C=this;function E(z){rut(C,z)}this._mouseCallback=E,c.addEventListener("mousedown",E,!0),c.addEventListener("touchstart",E,!0),h.addEventListener("mousedown",E,!0),h.addEventListener("touchstart",E,!0),n.addEventListener("mousemove",E,!0),n.addEventListener("touchmove",E,!0),n.addEventListener("mouseup",E,!0),n.addEventListener("touchend",E,!0),n.addEventListener("touchcancel",E,!0),this._shuttleRingPointer.addEventListener("mousedown",E,!0),this._shuttleRingPointer.addEventListener("touchstart",E,!0),this._knobOuter.addEventListener("mousedown",E,!0),this._knobOuter.addEventListener("touchstart",E,!0);const w=this._knobTime.childNodes[0],S=this._knobDate.childNodes[0],P=this._knobStatus.childNodes[0];let L;this._subscriptions=[il(t.pauseViewModel,"toggled",function(z){L!==z&&(L=z,L?C._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):C._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),il(t,"shuttleRingAngle",function(z){iut(C._shuttleRingPointer,C._knobOuter,z)}),il(t,"dateLabel",function(z){S.textContent!==z&&(S.textContent=z)}),il(t,"timeLabel",function(z){w.textContent!==z&&(w.textContent=z)}),il(t,"multiplierLabel",function(z){P.textContent!==z&&(P.textContent=z)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(K0.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});K0.prototype.isDestroyed=function(){return!1};K0.prototype.destroy=function(){l(this._observer)&&(this._observer.disconnect(),this._observer=void 0);const 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();const n=this._subscriptions;for(let i=0,o=n.length;i<o;i++)n[i].dispose();return He(this)};K0.prototype.resize=function(){const e=this._container.clientWidth,t=this._container.clientHeight;if(e===this._lastWidth&&t===this._lastHeight)return;const n=this._svgNode,i=200,o=132;let 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));const 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};K0.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(l(this._observer))return;const d=this;d._observer=new MutationObserver(function(){e.body.contains(d._container)&&(d._observer.disconnect(),d._observer=void 0,d.applyThemeChanges())}),d._observer.observe(e,{childList:!0,subtree:!0});return}const t=Bh(this._themeNormal),n=Bh(this._themeHover),i=Bh(this._themeSelect),o=Bh(this._themeDisabled),r=Bh(this._themeKnob),s=Bh(this._themePointer),a=Bh(this._themeSwoosh),c=Bh(this._themeSwooshHover),u=jl({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":rr(t,tb)},{tagName:"stop",offset:"12%","stop-color":rr(t,Cw)},{tagName:"stop",offset:"46%","stop-color":rr(t,mL)},{tagName:"stop",offset:"81%","stop-color":rr(t,Tw)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":rr(n,tb)},{tagName:"stop",offset:"12%","stop-color":rr(n,Cw)},{tagName:"stop",offset:"46%","stop-color":rr(n,mL)},{tagName:"stop",offset:"81%","stop-color":rr(n,Tw)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":rr(i,tb)},{tagName:"stop",offset:"12%","stop-color":rr(i,Cw)},{tagName:"stop",offset:"46%","stop-color":rr(i,mL)},{tagName:"stop",offset:"81%","stop-color":rr(i,Tw)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":rr(o,tut)},{tagName:"stop",offset:"75%","stop-color":rr(o,nut)}]},{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":rr(s,s6)},{tagName:"stop",offset:"100%","stop-color":rr(s,s6)}]},{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":rr(r,tb)},{tagName:"stop",offset:"60%","stop-color":rr(r,r6)},{tagName:"stop",offset:"85%","stop-color":rr(r,Cw)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":rr(r,r6)},{tagName:"stop",offset:"60%","stop-color":rr(r,tb)},{tagName:"stop",offset:"85%","stop-color":rr(r,Tw)}]}]});l(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};const sut=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Cp=15,Qy=105;function rne(e,t){return e-t}function yL(e,t){const n=Bs(t,e,rne);return n<0?~n:n}function aut(e,t){if(Math.abs(e)<=Cp)return e/Cp;const n=Cp,i=Qy;let o;const r=0;let 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 cut(e,t,n){if(n.clockStep===Xs.SYSTEM_CLOCK)return Cp;if(Math.abs(e)<=1)return e*Cp;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const o=Cp,r=Qy;let s;const a=0;let 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 pl(e){if(!l(e))throw new x("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=pl.defaultDateFormatter,this._timeFormatter=pl.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,it.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(pl.defaultTicks),this.timeLabel=void 0,it.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,it.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,it.defineProperty(this,"multiplierLabel",function(){const s=t._clockViewModel;if(s.clockStep===Xs.SYSTEM_CLOCK)return"Today";const a=s.multiplier;return a%1===0?`${a.toFixed(0)}x`:`${a.toFixed(3).replace(/0{0,3}$/,"")}x`}),this.shuttleRingAngle=void 0,it.defineProperty(this,"shuttleRingAngle",{get:function(){return cut(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,Qy),-Qy);const a=t._allShuttleRingTicks,c=t._clockViewModel;if(c.clockStep=Xs.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===Qy){c.multiplier=s>0?a[a.length-1]:a[0];return}let u=aut(s,a);if(t.snapToTicks)u=a[yL(u,a)];else if(u!==0){const d=Math.abs(u);if(d>100){const h=d.toFixed(0).length-2,m=Math.pow(10,h);u=Math.round(u/m)*m|0}else d>Cp?u=Math.round(u):d>1?u=+u.toFixed(1):d>0&&(u=+u.toFixed(2))}c.multiplier=u}}),this._canAnimate=void 0,it.defineProperty(this,"_canAnimate",function(){const s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===dp.UNBOUNDED)return!0;const c=s.multiplier,u=s.currentTime,d=s.startTime;let h=!1;if(a===dp.LOOP_STOP)h=ie.greaterThan(u,d)||u.equals(d)&&c>0;else{const m=s.stopTime;h=ie.greaterThan(u,d)&&ie.lessThan(u,m)||u.equals(d)&&c>0||u.equals(m)&&c<0}return h||(s.shouldAnimate=!1),h}),this._isSystemTimeAvailable=void 0,it.defineProperty(this,"_isSystemTimeAvailable",function(){const s=t._clockViewModel;if(s.clockRange===dp.UNBOUNDED)return!0;const c=s.systemTime;return ie.greaterThanOrEquals(c,s.startTime)&&ie.lessThanOrEquals(c,s.stopTime)}),this._isAnimating=void 0,it.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});const n=sr(function(){const s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new Eb(n,{toggled:it.computed(function(){return!t._isAnimating}),tooltip:"Pause"});const i=sr(function(){const s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new Eb(i,{toggled:it.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});const o=sr(function(){const s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new Eb(o,{toggled:it.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==Xs.SYSTEM_CLOCK}),tooltip:"Play Forward"});const r=sr(function(){t._clockViewModel.clockStep=Xs.SYSTEM_CLOCK},it.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new Eb(r,{toggled:it.computed(function(){return e.clockStep===Xs.SYSTEM_CLOCK}),tooltip:it.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=sr(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=yL(c,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=sr(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=yL(c,a)+1;u<a.length&&(s.multiplier=a[u])})}pl.defaultDateFormatter=function(e,t){const n=ie.toGregorianDate(e);return`${sut[n.month-1]} ${n.day} ${n.year}`};pl.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];pl.defaultTimeFormatter=function(e,t){const n=ie.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`};pl.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};pl.prototype.setShuttleRingTicks=function(e){if(!l(e))throw new x("positiveTicks is required.");let t,n,i;const 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(rne);const 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(pl.prototype,{slower:{get:function(){return this._slower}},faster:{get:function(){return this._faster}},clockViewModel:{get:function(){return this._clockViewModel}},pauseViewModel:{get:function(){return this._pauseViewModel}},playReverseViewModel:{get:function(){return this._playReverseViewModel}},playForwardViewModel:{get:function(){return this._playForwardViewModel}},playRealtimeViewModel:{get:function(){return this._playRealtimeViewModel}},dateFormatter:{get:function(){return this._dateFormatter},set:function(e){if(typeof e!="function")throw new x("dateFormatter must be a function");this._dateFormatter=e}},timeFormatter:{get:function(){return this._timeFormatter},set:function(e){if(typeof e!="function")throw new x("timeFormatter must be a function");this._timeFormatter=e}}});pl._maxShuttleRingAngle=Qy;pl._realtimeShuttleRingAngle=Cp;function sne(e){e=A(e,A.EMPTY_OBJECT);const t=e.globe,n=A(e.imageryProviderViewModels,[]),i=A(e.terrainProviderViewModels,[]);if(!l(t))throw new x("globe is required");this._globe=t,this.imageryProviderViewModels=n.slice(0),this.terrainProviderViewModels=i.slice(0),this.dropDownVisible=!1,it.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=it.getObservable(this,"imageryProviderViewModels"),r=it.pureComputed(function(){const h=o(),m={};let g;for(g=0;g<h.length;g++){const b=h[g],C=b.category;l(m[C])?m[C].push(b):m[C]=[b]}const p=Object.keys(m),y=[];for(g=0;g<p.length;g++){const b=p[g];y.push({name:b,providers:m[b]})}return y});this._imageryProviders=r;const s=it.getObservable(this,"terrainProviderViewModels"),a=it.pureComputed(function(){const h=s(),m={};let g;for(g=0;g<h.length;g++){const b=h[g],C=b.category;l(m[C])?m[C].push(b):m[C]=[b]}const p=Object.keys(m),y=[];for(g=0;g<p.length;g++){const b=p[g];y.push({name:b,providers:m[b]})}return y});this._terrainProviders=a,this.buttonTooltip=void 0,it.defineProperty(this,"buttonTooltip",function(){const h=this.selectedImagery,m=this.selectedTerrain,g=l(h)?h.name:void 0,p=l(m)?m.name:void 0;return l(g)&&l(p)?`${g}
|
||
${p}`:l(g)?g:p}),this.buttonImageUrl=void 0,it.defineProperty(this,"buttonImageUrl",function(){const h=this.selectedImagery;if(l(h))return h.iconUrl}),this.selectedImagery=void 0;const c=it.observable();this._currentImageryProviders=[],it.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(h){if(c()===h){this.dropDownVisible=!1;return}let m;const g=this._currentImageryProviders,p=g.length,y=this._globe.imageryLayers;let b=!1;for(m=0;m<p;m++){const C=y.length;for(let E=0;E<C;E++){const w=y.get(E);if(w.imageryProvider===g[m]){y.remove(w),b=!0;break}}}if(l(h)){const C=h.creationCommand();if(Array.isArray(C)){const E=C.length;for(m=E-1;m>=0;m--)y.addImageryProvider(C[m],0);this._currentImageryProviders=C.slice(0)}else if(this._currentImageryProviders=[C],b)y.addImageryProvider(C,0);else{const E=y.get(0);l(E)&&y.remove(E),y.addImageryProvider(C,0)}}c(h),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const u=it.observable();it.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(h){if(u()===h){this.dropDownVisible=!1;return}let m;l(h)&&(m=h.creationCommand()),this._globe.depthTestAgainstTerrain=!(m instanceof Jp),this._globe.terrainProvider=m,u(h),this.dropDownVisible=!1}});const d=this;this._toggleDropDown=sr(function(){d.dropDownVisible=!d.dropDownVisible}),this.selectedImagery=A(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=A(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(sne.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});function oI(e,t){if(!l(e))throw new x("container is required.");e=Ar(e);const n=new sne(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);const 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);const r=document.createElement("div");r.className="cesium-baseLayerPicker-dropDown",r.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'),e.appendChild(r);const s=document.createElement("div");s.className="cesium-baseLayerPicker-sectionTitle",s.setAttribute("data-bind","visible: imageryProviderViewModels.length > 0"),s.innerHTML="Imagery",r.appendChild(s);const a=document.createElement("div");a.className="cesium-baseLayerPicker-section",a.setAttribute("data-bind","foreach: _imageryProviders"),r.appendChild(a);const c=document.createElement("div");c.className="cesium-baseLayerPicker-category",a.appendChild(c);const u=document.createElement("div");u.className="cesium-baseLayerPicker-categoryTitle",u.setAttribute("data-bind","text: name"),c.appendChild(u);const d=document.createElement("div");d.className="cesium-baseLayerPicker-choices",d.setAttribute("data-bind","foreach: providers"),c.appendChild(d);const h=document.createElement("div");h.className="cesium-baseLayerPicker-item",h.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'),d.appendChild(h);const m=document.createElement("img");m.className="cesium-baseLayerPicker-itemIcon",m.setAttribute("data-bind","attr: { src: iconUrl }"),m.setAttribute("draggable","false"),h.appendChild(m);const g=document.createElement("div");g.className="cesium-baseLayerPicker-itemLabel",g.setAttribute("data-bind","text: name"),h.appendChild(g);const p=document.createElement("div");p.className="cesium-baseLayerPicker-sectionTitle",p.setAttribute("data-bind","visible: terrainProviderViewModels.length > 0"),p.innerHTML="Terrain",r.appendChild(p);const y=document.createElement("div");y.className="cesium-baseLayerPicker-section",y.setAttribute("data-bind","foreach: _terrainProviders"),r.appendChild(y);const b=document.createElement("div");b.className="cesium-baseLayerPicker-category",y.appendChild(b);const C=document.createElement("div");C.className="cesium-baseLayerPicker-categoryTitle",C.setAttribute("data-bind","text: name"),b.appendChild(C);const E=document.createElement("div");E.className="cesium-baseLayerPicker-choices",E.setAttribute("data-bind","foreach: providers"),b.appendChild(E);const w=document.createElement("div");w.className="cesium-baseLayerPicker-item",w.setAttribute("data-bind",'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'),E.appendChild(w);const S=document.createElement("img");S.className="cesium-baseLayerPicker-itemIcon",S.setAttribute("data-bind","attr: { src: iconUrl }"),S.setAttribute("draggable","false"),w.appendChild(S);const P=document.createElement("div");P.className="cesium-baseLayerPicker-itemLabel",P.setAttribute("data-bind","text: name"),w.appendChild(P),it.applyBindings(n,i),it.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(L){i.contains(L.target)||r.contains(L.target)||(n.dropDownVisible=!1)},gn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(oI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});oI.prototype.isDestroyed=function(){return!1};oI.prototype.destroy=function(){return gn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),it.cleanNode(this._element),it.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),He(this)};function js(e){if(!l(e.name))throw new x("options.name is required.");if(!l(e.tooltip))throw new x("options.tooltip is required.");if(!l(e.iconUrl))throw new x("options.iconUrl is required.");if(typeof e.creationFunction!="function")throw new x("options.creationFunction is required.");let t=e.creationFunction;l(t.canExecute)||(t=sr(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=A(e.category,""),it.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(js.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});function lut(){const e=[];return e.push(new js({name:"Bing Maps Aerial",iconUrl:An("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return Hw({style:Uw.AERIAL})}})),e.push(new js({name:"Bing Maps Aerial with Labels",iconUrl:An("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return Hw({style:Uw.AERIAL_WITH_LABELS})}})),e.push(new js({name:"Bing Maps Roads",iconUrl:An("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return Hw({style:Uw.ROAD})}})),e.push(new js({name:"ESRI World Imagery",iconUrl:An("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 up({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new js({name:"ESRI World Street Map",iconUrl:An("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 up({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new js({name:"ESRI National Geographic",iconUrl:An("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 up({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new js({name:"OpenStreetMap",iconUrl:An("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 Jy({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new js({name:"Stamen Watercolor",iconUrl:An("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 Jy({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 js({name:"Stamen Toner",iconUrl:An("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`A high contrast black and white map.
|
||
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new Jy({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 js({name:"Sentinel-2",iconUrl:An("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 nu({assetId:3954})}})),e.push(new js({name:"Blue Marble",iconUrl:An("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new nu({assetId:3845})}})),e.push(new js({name:"Earth at night",iconUrl:An("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 nu({assetId:3812})}})),e.push(new js({name:"Natural Earth II",iconUrl:An("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
|
||
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return new mf({url:An("Assets/Textures/NaturalEarthII")})}})),e}function uut(){const e=[];return e.push(new js({name:"WGS84 Ellipsoid",iconUrl:An("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new Jp}})),e.push(new js({name:"Cesium World Terrain",iconUrl:An("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 iat({requestWaterMask:!0,requestVertexNormals:!0})}})),e}function rI(e,t){l(t)||(t=document.body),t=Ar(t);const n=this,i=it.observable(os.fullscreen),o=it.observable(os.enabled),r=t.ownerDocument;this.isFullscreen=void 0,it.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,it.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&os.enabled)}}),this.tooltip=void 0,it.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=sr(function(){os.fullscreen?os.exitFullscreen():os.requestFullscreen(n._fullscreenElement)},it.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=A(Ar(e),r.body),this._callback=function(){i(os.fullscreen)},r.addEventListener(os.changeEventName,this._callback)}Object.defineProperties(rI.prototype,{fullscreenElement:{get:function(){return this._fullscreenElement},set:function(e){if(!(e instanceof Element))throw new x("value must be a valid Element.");this._fullscreenElement=e}},command:{get:function(){return this._command}}});rI.prototype.isDestroyed=function(){return!1};rI.prototype.destroy=function(){document.removeEventListener(os.changeEventName,this._callback),He(this)};const dut="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",fut="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 sI(e,t){if(!l(e))throw new x("container is required.");e=Ar(e);const n=new rI(t,e);n._exitFullScreenPath=fut,n._enterFullScreenPath=dut;const 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),it.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(sI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});sI.prototype.isDestroyed=function(){return!1};sI.prototype.destroy=function(){return this._viewModel.destroy(),it.cleanNode(this._element),this._container.removeChild(this._element),He(this)};const a6=1e3;function Ad(e){if(!l(e)||!l(e.scene))throw new x("options.scene is required.");l(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new Ite,new zte({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 Ke,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=l6,this._handleArrowUp=c6;const t=this;this._suggestionsVisible=it.pureComputed(function(){const o=it.getObservable(t,"_suggestions")().length>0,r=it.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=sr(function(i){if(i=A(i,PF.SEARCH),t._focusTextbox=!1,l(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;t.hideSuggestions(),t.isSearchInProgress?yut(t):_ut(t,t._geocoderServices,i)}),this.deselectSuggestion=function(){t._selectedSuggestion=void 0},this.handleKeyDown=function(i,o){const 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){const 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?c6(t):r?l6(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;const o=i.destination;cne(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=A(e.autocomplete,!0),this.destinationFound=A(e.destinationFound,Ad.flyToDestination),this._focusTextbox=!1,it.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=it.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){Ad._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,it.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,it.defineProperty(this,"searchText",{get:function(){return this.isSearchInProgress?"Searching...":this._searchText},set:function(i){if(typeof i!="string")throw new x("value must be a valid string.");this._searchText=i}}),this.flightDuration=void 0,it.defineProperty(this,"flightDuration",{get:function(){return this._flightDuration},set:function(i){if(l(i)&&i<0)throw new x("value must be positive.");this._flightDuration=i}})}Object.defineProperties(Ad.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}}});Ad.prototype.destroy=function(){this._suggestionSubscription.dispose()};function c6(e){if(e._suggestions.length===0)return;const t=e._suggestions.indexOf(e._selectedSuggestion);if(t===-1||t===0){e._selectedSuggestion=void 0;return}const n=t-1;e._selectedSuggestion=e._suggestions[n],Ad._adjustSuggestionsScroll(e,n)}function l6(e){if(e._suggestions.length===0)return;const t=e._suggestions.length,i=(e._suggestions.indexOf(e._selectedSuggestion)+1)%t;e._selectedSuggestion=e._suggestions[i],Ad._adjustSuggestionsScroll(e,i)}function hut(e,t){const n=l(t)?t.availability:void 0;return l(n)?tI(t,[e]).then(function(i){return e=i[0],e.height+=a6,e}):(e.height+=a6,Promise.resolve(e))}function put(e,t){const n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider;let a=t,c;return t instanceof ge?M.equalsEpsilon(t.south,t.north,M.EPSILON7)&&M.equalsEpsilon(t.east,t.west,M.EPSILON7)?t=ge.center(t):c=iI(t,n):t=o.cartesianToCartographic(t),l(c)||(c=hut(t,s)),c.then(function(u){a=o.cartographicToCartesian(u)}).finally(function(){r.flyTo({destination:a,complete:function(){e._complete.raiseEvent()},duration:e._flightDuration,endTransform:B.IDENTITY})})}function mut(e,t,n,i){return e.then(function(o){return l(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 _ut(e,t,n){const i=e._searchText;if(ane(i)){e.showSuggestions();return}e._isSearchInProgress=!0;let o=Promise.resolve();for(let r=0;r<t.length;r++)o=mut(o,t[r],i,n);e._geocodePromise=o,o.then(function(r){if(o.cancel)return;e._isSearchInProgress=!1;const s=r.value;if(r.state==="fulfilled"&&l(s)&&s.length>0){e._searchText=s[0].displayName,e.destinationFound(e,s[0].destination);return}e._searchText=`${i} (not found)`})}function gut(e,t){const n=Ar(e._viewContainer),i=n.getElementsByClassName("search-results")[0],r=n.getElementsByTagName("li")[t];if(t===0){i.scrollTop=0;return}const s=r.offsetTop;s+r.clientHeight>i.clientHeight?i.scrollTop=s+r.clientHeight:s<i.scrollTop&&(i.scrollTop=s)}function yut(e){e._isSearchInProgress=!1,l(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function ane(e){return/^\s*$/.test(e)}function cne(e){it.getObservable(e,"_suggestions").removeAll()}function Aut(e){if(!e.autoComplete)return;const t=e._searchText;if(cne(e),ane(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,PF.AUTOCOMPLETE).then(function(r){return o=o.concat(r),o})})}),n.then(function(i){const o=e._suggestions;for(let r=0;r<i.length;r++)o.push(i[r])})}Ad.flyToDestination=put;Ad._updateSearchSuggestions=Aut;Ad._adjustSuggestionsScroll=gut;const but="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",Cut="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 aI(e){if(!l(e)||!l(e.container))throw new x("options.container is required.");if(!l(e.scene))throw new x("options.scene is required.");const t=Ar(e.container),n=new Ad(e);n._startSearchPath=but,n._stopSearchPath=Cut;const i=document.createElement("form");i.setAttribute("data-bind","submit: search");const 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;const 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);const s=document.createElement("div");s.className="search-results",s.setAttribute("data-bind","visible: _suggestionsVisible");const a=document.createElement("ul");a.setAttribute("data-bind","foreach: _suggestions");const 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),it.applyBindings(n,i),it.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let d=u.target;typeof u.composedPath=="function"&&(d=u.composedPath()[0]),t.contains(d)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},gn.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(aI.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});aI.prototype.isDestroyed=function(){return!1};aI.prototype.destroy=function(){const e=this._container;return gn.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(),it.cleanNode(this._form),it.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),He(this)};function lne(e,t){if(!l(e))throw new x("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=sr(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",it.track(this,["tooltip"])}Object.defineProperties(lne.prototype,{scene:{get:function(){return this._scene}},command:{get:function(){return this._command}},duration:{get:function(){return this._duration},set:function(e){if(l(e)&&e<0)throw new x("value must be positive.");this._duration=e}}});function cI(e,t,n){if(!l(e))throw new x("container is required.");e=Ar(e);const i=new lne(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";const 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),it.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(cI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});cI.prototype.isDestroyed=function(){return!1};cI.prototype.destroy=function(){return it.cleanNode(this._element),this._container.removeChild(this._element),He(this)};const Tut="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",Eut="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 NF(){this._cameraClicked=new Ke,this._closeClicked=new Ke,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",it.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,it.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?Eut:Tut}}),it.defineProperty(this,"_bodyless",{get:function(){return!l(this.description)||this.description.length===0}})}NF.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(NF.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});function lI(e){T.defined("container",e),e=Ar(e);const t=document.createElement("div");t.className="cesium-infoBox",t.setAttribute("data-bind",'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'),e.appendChild(t);const n=document.createElement("div");n.className="cesium-infoBox-title",n.setAttribute("data-bind","text: titleText"),t.appendChild(n);const 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);const o=document.createElement("button");o.type="button",o.className="cesium-infoBox-close",o.setAttribute("data-bind","click: function () { closeClicked.raiseEvent(this); }"),o.innerHTML="×",t.appendChild(o);const 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);const s=new NF;it.applyBindings(s,t),this._container=e,this._element=t,this._frame=r,this._viewModel=s,this._descriptionSubscription=void 0;const a=this;r.addEventListener("load",function(){const c=r.contentDocument,u=c.createElement("link");u.href=An("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";const d=c.createElement("div");d.className="cesium-infoBox-description",c.head.appendChild(u),c.body.appendChild(d),a._descriptionSubscription=il(s,"description",function(h){r.style.height="5px",d.innerHTML=h;let m=null;const g=d.firstElementChild;if(g!==null&&d.childNodes.length===1){const y=window.getComputedStyle(g);if(y!==null){const b=y["background-color"],C=H.fromCssColorString(b);l(C)&&C.alpha!==0&&(m=y["background-color"])}}t.style["background-color"]=m;const p=d.getBoundingClientRect().height;r.style.height=`${p}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(lI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});lI.prototype.isDestroyed=function(){return!1};lI.prototype.destroy=function(){const e=this._container;return it.cleanNode(this._element),e.removeChild(this._element),l(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),He(this)};function une(){this.showInstructions=!1;const e=this;this._command=sr(function(){e.showInstructions=!e.showInstructions}),this._showClick=sr(function(){e._touch=!1}),this._showTouch=sr(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",it.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(une.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});function uI(e){if(!l(e)||!l(e.container))throw new x("options.container is required.");const t=Ar(e.container),n=new une,i=A(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";const o=document.createElement("span");o.className="cesium-navigationHelpButton-wrapper",t.appendChild(o);const 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);const s=document.createElement("div");s.className="cesium-navigation-help",s.setAttribute("data-bind",'css: { "cesium-navigation-help-visible" : showInstructions}'),o.appendChild(s);const 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}');const c=document.createElement("img");c.src=An("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"));const u=document.createElement("button");u.type="button",u.className="cesium-navigation-button cesium-navigation-button-right",u.setAttribute("data-bind",'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}');const d=document.createElement("img");d.src=An("Widgets/Images/NavigationHelp/Touch.svg"),d.className="cesium-navigation-button-icon",d.style.width="25px",d.style.height="25px",u.appendChild(d),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);const h=document.createElement("div");h.className="cesium-click-navigation-help cesium-navigation-help-instructions",h.setAttribute("data-bind",'css: { "cesium-click-navigation-help-visible" : !_touch}'),h.innerHTML=` <table> <tr> <td><img src="${An("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="${An("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="${An("Widgets/Images/NavigationHelp/MouseMiddle.svg")}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>`,s.appendChild(h);const m=document.createElement("div");m.className="cesium-touch-navigation-help cesium-navigation-help-instructions",m.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),m.innerHTML=` <table> <tr> <td><img src="${An("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="${An("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="${An("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="${An("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(m),it.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},gn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(uI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});uI.prototype.isDestroyed=function(){return!1};uI.prototype.destroy=function(){return gn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),it.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)};function dI(e){if(!l(e))throw new x("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof Gt,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,it.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;it.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=sr(function(){t.sceneMode===le.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new Nd,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===le.SCENE2D||t._scene.camera.frustum instanceof Gt}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=l(e.camera._currentFlight)}),this._switchToPerspective=sr(function(){t.sceneMode!==le.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=sr(function(){t.sceneMode!==le.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=le}Object.defineProperties(dI.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}}});dI.prototype.isDestroyed=function(){return!1};dI.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)};const xut="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",wut="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 fI(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=Ar(e);const n=new dI(t);n._perspectivePath=xut,n._orthographicPath=wut;const i=document.createElement("span");i.className="cesium-projectionPicker-wrapper cesium-toolbar-button",e.appendChild(i);const 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);const 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);const 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),it.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},gn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(fI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});fI.prototype.isDestroyed=function(){return!1};fI.prototype.destroy=function(){return this._viewModel.destroy(),gn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),it.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)};function hI(e,t){if(!l(e))throw new x("scene is required.");this._scene=e;const n=this,i=function(o,r,s,a){n.sceneMode=s,n.dropDownVisible=!1};this._eventHelper=new Nd,this._eventHelper.add(e.morphStart,i),this._duration=A(t,2),this.sceneMode=e.mode,this.dropDownVisible=!1,this.tooltip2D="2D",this.tooltip3D="3D",this.tooltipColumbusView="Columbus View",it.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,it.defineProperty(this,"selectedTooltip",function(){const o=n.sceneMode;return o===le.SCENE2D?n.tooltip2D:o===le.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=sr(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=sr(function(){e.morphTo2D(n._duration)}),this._morphTo3D=sr(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=sr(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=le}Object.defineProperties(hI.prototype,{scene:{get:function(){return this._scene}},duration:{get:function(){return this._duration},set:function(e){if(e<0)throw new x("duration value must be positive.");this._duration=e}},toggleDropDown:{get:function(){return this._toggleDropDown}},morphTo2D:{get:function(){return this._morphTo2D}},morphTo3D:{get:function(){return this._morphTo3D}},morphToColumbusView:{get:function(){return this._morphToColumbusView}}});hI.prototype.isDestroyed=function(){return!1};hI.prototype.destroy=function(){this._eventHelper.removeAll(),He(this)};const Sut="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",vut="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",Dut="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 pI(e,t,n){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=Ar(e);const i=new hI(t,n);i._globePath=Sut,i._flatMapPath=vut,i._columbusViewPath=Dut;const o=document.createElement("span");o.className="cesium-sceneModePicker-wrapper cesium-toolbar-button",e.appendChild(o);const 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);const 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);const 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);const 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),it.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},gn.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(pI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});pI.prototype.isDestroyed=function(){return!1};pI.prototype.destroy=function(){return this._viewModel.destroy(),gn.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),it.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),He(this)};const Iut=new j,Ov="-1000px";function eE(e,t,n){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("selectionIndicatorElement is required.");if(!l(n))throw new x("container is required.");this._scene=e,this._screenPositionX=Ov,this._screenPositionY=Ov,this._tweens=e.tweens,this._container=A(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,it.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,it.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&l(this.position)}}),it.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return br.wgs84ToWindowCoordinates(e,i,o)}}eE.prototype.update=function(){if(this.showSelection&&l(this.position)){const e=this.computeScreenSpacePosition(this.position,Iut);if(!l(e))this._screenPositionX=Ov,this._screenPositionY=Ov;else{const 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`}}};eE.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:xc.EXPONENTIAL_OUT})};eE.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:xc.EXPONENTIAL_OUT})};Object.defineProperties(eE.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});function mI(e,t){if(!l(e))throw new x("container is required.");e=Ar(e),this._container=e;const 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;const 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");const s=document.createElementNS(i,"g");s.setAttribute("transform","translate(80,80)"),r.appendChild(s);const a=document.createElementNS(i,"path");a.setAttribute("data-bind","attr: { transform: _transform }"),a.setAttribute("d",o),s.appendChild(a),n.appendChild(r);const c=new eE(t,this._element,this._container);this._viewModel=c,it.applyBindings(this._viewModel,this._element)}Object.defineProperties(mI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});mI.prototype.isDestroyed=function(){return!1};mI.prototype.destroy=function(){const e=this._container;return it.cleanNode(this._element),e.removeChild(this._element),He(this)};function yg(e,t,n){this._color=e,this._height=t,this._base=A(n,0)}yg.prototype.getHeight=function(){return this._height};yg.prototype.getBase=function(){return this._base};yg.prototype.getStartTime=function(){return this._start};yg.prototype.getStopTime=function(){return this._stop};yg.prototype.setRange=function(e,t){this._start=e,this._stop=t};yg.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=ie.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=ie.secondsDifference(this._stop,e.epochJulian);let 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};function dne(e,t,n,i){this.interval=e,this.height=t,this.color=n||new H(.5,.5,.5,1),this.backgroundColor=i||new H(0,0,0,0)}dne.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=ie.addSeconds(t.startJulian,t.duration,new ie);if(ie.lessThan(n,o)&&ie.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(ie.lessThanOrEquals(n,r)&&ie.greaterThanOrEquals(i,o)){let s,a,c;for(s=0;s<t.timeBarWidth;++s){const u=ie.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new ie);!l(a)&&ie.greaterThanOrEquals(u,n)?a=s:!l(c)&&ie.greaterThanOrEquals(u,i)&&(c=s)}e.fillStyle=this.backgroundColor.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height),l(a)&&(l(c)||(c=t.timeBarWidth),e.fillStyle=this.color.toCssColorString(),e.fillRect(a,t.y,Math.max(c-a,1),this.height))}};let AL=1e12;const al={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},Sa={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},Rh=[.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],Put=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Aa(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("clock is required.");e=Ar(e);const n=e.ownerDocument;this.container=e;const 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=al.none,this._touchMode=Sa.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=Out(this),this._onMouseUp=Lut(this),this._onMouseMove=But(this),this._onMouseWheel=Rut(this),this._onTouchStart=Nut(this),this._onTouchMove=Fut(this),this._onTouchEnd=Mut(this);const 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()}Aa.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};Aa.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};Aa.prototype.isDestroyed=function(){return!1};Aa.prototype.destroy=function(){this._clock.onTick.removeEventListener(this.updateFromClock,this);const e=this.container.ownerDocument;e.removeEventListener("mouseup",this._onMouseUp,!1),e.removeEventListener("mousemove",this._onMouseMove,!1);const 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),He(this)};Aa.prototype.addHighlightRange=function(e,t,n){const i=new yg(e,t,n);return this._highlightRanges.push(i),this.resize(),i};Aa.prototype.addTrack=function(e,t,n,i){const o=new dne(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};Aa.prototype.zoomTo=function(e,t){if(!l(e))throw new x("startTime is required.");if(!l(t))throw new x("stopTime is required");if(ie.lessThanOrEquals(t,e))throw new x("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=ie.secondsDifference(t,e),this._clock&&this._clock.clockRange!==dp.UNBOUNDED){const i=this._clock.startTime,o=this._clock.stopTime,r=ie.secondsDifference(o,i),s=ie.secondsDifference(i,this._startJulian),a=ie.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=ie.addSeconds(this._endJulian,s,new ie),this._startJulian=i,this._timeBarSecondsSpan=ie.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=ie.addSeconds(this._startJulian,a,new ie),this._endJulian=o,this._timeBarSecondsSpan=ie.secondsDifference(this._endJulian,this._startJulian))}this._makeTics();const 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)};Aa.prototype.zoomFrom=function(e){let t=ie.secondsDifference(this._scrubJulian,this._startJulian);e>1||t<0||t>this._timeBarSecondsSpan?t=this._timeBarSecondsSpan*.5:t+=t-this._timeBarSecondsSpan*.5;const n=this._timeBarSecondsSpan-t;this.zoomTo(ie.addSeconds(this._startJulian,t-t*e,new ie),ie.addSeconds(this._endJulian,n*e-n,new ie))};function bL(e){return e<10?`0${e.toString()}`:e.toString()}Aa.prototype.makeLabel=function(e){const t=ie.toGregorianDate(e),n=t.millisecond;let i=" UTC";if(n>0&&this._timeBarSecondsSpan<3600){for(i=Math.floor(n).toString();i.length<3;)i=`0${i}`;i=`.${i}`}return`${Put[t.month-1]} ${t.day} ${t.year} ${bL(t.hour)}:${bL(t.minute)}:${bL(t.second)}${i}`};Aa.prototype.smallestTicInPixels=7;Aa.prototype._makeTics=function(){const e=this._timeBarEle,t=ie.secondsDifference(this._scrubJulian,this._startJulian),n=Math.round(t*this._topDiv.clientWidth/this._timeBarSecondsSpan),i=n-8;let o;const r=this;this._needleEle.style.left=`${n.toString()}px`;let s="";const a=.01,c=31536e6,u=1e-10;let d=0,h=this._timeBarSecondsSpan;h<a?(h=a,this._timeBarSecondsSpan=a,this._endJulian=ie.addSeconds(this._startJulian,a,new ie)):h>c&&(h=c,this._timeBarSecondsSpan=c,this._endJulian=ie.addSeconds(this._startJulian,c,new ie));let m=this._timeBarEle.clientWidth;m<10&&(m=10);const g=this._startJulian,p=Math.min(h/m*1e-5,.4);let y;const b=ie.toGregorianDate(g);h>31536e4?y=ie.fromDate(new Date(Date.UTC(Math.floor(b.year/100)*100,0))):h>31536e3?y=ie.fromDate(new Date(Date.UTC(Math.floor(b.year/10)*10,0))):h>86400?y=ie.fromDate(new Date(Date.UTC(b.year,0))):y=ie.fromDate(new Date(Date.UTC(b.year,b.month,b.day)));const C=ie.secondsDifference(this._startJulian,ie.addSeconds(y,p,new ie));let E=C+h;this._epochJulian=y;function w(W){return Math.floor(C/W)*W}function S(W,K){return Math.ceil(W/K+.5)*K}function P(W){return(W-C)/h}function L(W,K){return W-K*Math.round(W/K)}this._rulerEle.innerHTML=this.makeLabel(ie.addSeconds(this._endJulian,-a,new ie));let z=this._rulerEle.offsetWidth+20;z<30&&(z=180);const R=d;d-=u;const F={startTime:C,startJulian:g,epochJulian:y,duration:h,timeBarWidth:m,getAlpha:P};this._highlightRanges.forEach(function(W){s+=W.render(F)});let U=0,D=0,I=0,_=z/m;_>1&&(_=1),_*=this._timeBarSecondsSpan;let v=-1,O=-1;const N=Rh.length;let V;for(V=0;V<N;++V){const W=Rh[V];if(++v,U=W,W>_&&W>d)break;O<0&&m*(W/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(O=v)}if(v>0){for(;v>0;)if(--v,Math.abs(L(U,Rh[v]))<1e-5){Rh[v]>=d&&(D=Rh[v]);break}if(O>=0)for(;O<v;){if(Math.abs(L(D,Rh[O]))<1e-5&&Rh[O]>=d){I=Rh[O];break}++O}}d=R,d>u&&I<1e-5&&Math.abs(d-U)>u&&(I=d,d<=U+u&&(D=0));let k=-999999,G;if(m*(I/this._timeBarSecondsSpan)>=3)for(o=w(I);o<=E;o=S(o,I))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(m*P(o)).toString()}px;"></span>`;if(m*(D/this._timeBarSecondsSpan)>=3)for(o=w(D);o<=E;o=S(o,D))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(m*P(o)).toString()}px;"></span>`;if(m*(U/this._timeBarSecondsSpan)>=2){this._mainTicSpan=U,E+=U,o=w(U);const W=ie.computeTaiMinusUtc(y);for(;o<=E;){let K=ie.addSeconds(g,o-C,new ie);if(U>2.1){const X=ie.computeTaiMinusUtc(K);Math.abs(X-W)>.1&&(o+=X-W,K=ie.addSeconds(g,o-C,new ie))}const q=Math.round(m*P(o)),te=this.makeLabel(K);this._rulerEle.innerHTML=te,G=this._rulerEle.offsetWidth,G<10&&(G=z);const Y=q-(G/2-1);Y>k?(k=Y+G+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${q.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${Y.toString()}px;">${te}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${q.toString()}px;"></span>`,o=S(o,U)}}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),F.y=0,this._trackList.forEach(function(W){W.render(r._context,F),F.y+=W.height})};Aa.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(l(this._scrubElement)){const t=ie.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`)}l(this._timelineDragLocation)&&(this._setTimeBarTime(this._timelineDragLocation,this._timelineDragLocation*this._timeBarSecondsSpan/this._topDiv.clientWidth),this.zoomTo(ie.addSeconds(this._startJulian,this._timelineDrag,new ie),ie.addSeconds(this._endJulian,this._timelineDrag,new ie)))};Aa.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=ie.addSeconds(this._startJulian,t,new ie),this._scrubElement){const i=e-8;this._scrubElement.style.left=`${i.toString()}px`,this._needleEle.style.left=`${e.toString()}px`}const 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 Out(e){return function(t){e._mouseMode!==al.touchOnly&&(t.button===0?(e._mouseMode=al.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=al.zoom:e._mouseMode=al.slide)),t.preventDefault()}}function Lut(e){return function(t){e._mouseMode=al.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function But(e){return function(t){let n;if(e._mouseMode===al.scrub){t.preventDefault();const 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===al.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){const i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(ie.addSeconds(e._startJulian,i,new ie),ie.addSeconds(e._endJulian,i,new ie))}}else e._mouseMode===al.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function Rut(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;AL=Math.max(Math.min(Math.abs(n),AL),1),n/=AL,e.zoomFrom(Math.pow(1.05,-n))}}function Nut(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=al.touchOnly,n===1?(i=ie.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=Sa.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=Sa.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=Sa.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=Sa.ignore}}function Mut(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===Sa.singleTap?(e._touchMode=Sa.scrub,e._onTouchMove(t)):e._touchMode===Sa.scrub&&e._onTouchMove(t),e._mouseMode=al.touchOnly,n!==1?e._touchMode=n>0?Sa.ignore:Sa.none:e._touchMode===Sa.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function Fut(e){return function(t){let n,i,o,r,s,a,c=1;const u=e._topDiv.getBoundingClientRect().left;e._touchMode===Sa.singleTap&&(e._touchMode=Sa.slideZoom),e._mouseMode=al.touchOnly,e._touchMode===Sa.scrub?(t.preventDefault(),t.changedTouches.length===1&&(i=t.changedTouches[0].clientX-u,i>=0&&i<=e._topDiv.clientWidth&&e._setTimeBarTime(i,i*e._timeBarSecondsSpan/e._topDiv.clientWidth))):e._touchMode===Sa.slideZoom&&(o=t.touches.length,o===2?(r=(t.touches[0].clientX+t.touches[1].clientX)*.5-u,s=Math.abs(t.touches[0].clientX-t.touches[1].clientX)):o===1&&(r=t.touches[0].clientX-u,s=0),l(r)&&(s>0&&e._touchState.spanX>0?(c=e._touchState.spanX/s,a=ie.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new ie)):(n=e._touchState.centerX-r,a=ie.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new ie)),e.zoomTo(a,ie.addSeconds(a,e._timeBarSecondsSpan*c,new ie)),e._touchState.centerX=r,e._touchState.spanX=s))}}Aa.prototype.resize=function(){const 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 zut={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK",mp4:"data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"};const{webm:Uut,mp4:Hut}=zut,CL=()=>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,TL=()=>"wakeLock"in navigator;class Vut{constructor(){if(this.enabled=!1,TL()){this._wakeLock=null;const t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else CL()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",Uut),this._addSourceToVideo(this.noSleepVideo,"mp4",Hut),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 TL()?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}):CL()?(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(){TL()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):CL()?this.noSleepTimer&&(console.warn(`
|
||
NoSleep now disabled for older iOS devices.
|
||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var kut=Vut;function Gut(e){let t=!1;const n=window.screen;return l(n)&&(l(n.lockOrientation)?t=n.lockOrientation(e):l(n.mozLockOrientation)?t=n.mozLockOrientation(e):l(n.msLockOrientation)?t=n.msLockOrientation(e):l(n.orientation&&n.orientation.lock)&&(t=n.orientation.lock(e))),t}function fne(){const e=window.screen;l(e)&&(l(e.unlockOrientation)?e.unlockOrientation():l(e.mozUnlockOrientation)?e.mozUnlockOrientation():l(e.msUnlockOrientation)?e.msUnlockOrientation():l(e.orientation&&e.orientation.unlock)&&e.orientation.unlock())}function Wut(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(fne(),e._locked=!1),e._noSleep.disable(),os.exitFullscreen(),n(!1)):(os.fullscreen||os.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=Gut("landscape")),t.useWebVR=!0,n(!0)))}function _I(e,t){if(!l(e))throw new x("scene is required.");const n=this,i=it.observable(os.enabled),o=it.observable(!1);this.isVRMode=void 0,it.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,it.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&os.enabled)}}),this.tooltip=void 0,it.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});const r=it.observable(!1);this._isOrthographic=void 0,it.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new Nd,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof Gt)}),this._locked=!1,this._noSleep=new kut,this._command=sr(function(){Wut(n,e,o,r)},it.getObservable(this,"isVREnabled")),this._vrElement=A(Ar(t),document.body),this._callback=function(){!os.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(fne(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener(os.changeEventName,this._callback)}Object.defineProperties(_I.prototype,{vrElement:{get:function(){return this._vrElement},set:function(e){if(!(e instanceof Element))throw new x("value must be a valid Element.");this._vrElement=e}},command:{get:function(){return this._command}}});_I.prototype.isDestroyed=function(){return!1};_I.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener(os.changeEventName,this._callback),He(this)};const jut="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",qut="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 gI(e,t,n){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=Ar(e);const i=new _I(t,n);i._exitVRPath=qut,i._enterVRPath=jut;const 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),it.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(gI.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});gI.prototype.isDestroyed=function(){return!1};gI.prototype.destroy=function(){return this._viewModel.destroy(),it.cleanNode(this._element),this._container.removeChild(this._element),He(this)};const rp=new fe;function hne(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function $ut(e){const t=e.getPropertyIds();let n="";return t.forEach(function(i){const o=e.getProperty(i);l(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 Yut(e){let t;const n=[],i=e.getPropertyIds();for(t=0;t<i.length;t++){const 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))}const o=n.length;for(t=0;t<o;t++){const r=n[t];if(l(r)&&r!=="")return r}return"Unnamed Feature"}function u6(e,t){const n=e.scene.pick(t.position);if(l(n)){const i=A(n.id,n.primitive.id);if(i instanceof Nr)return i;if(n instanceof As)return new Nr({name:Yut(n),description:$ut(n),feature:n})}if(l(e.scene.globe))return Jut(e,t.position)}const Xut=new ie;function pne(e,t,n){if(l(n)){const i=n.clock;if(l(i)&&(i.getValue(t),l(e))){const o=i.startTime;let r=i.stopTime;ie.equals(o,r)&&(r=ie.addSeconds(o,M.EPSILON2,Xut)),e.updateFromClock(),e.zoomTo(o,r)}}}const Kut=new f;function Jut(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!l(o))return;const r=new Nr({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!l(s)||s.length===0){e.selectedEntity=d6();return}const a=s[0],c=new Nr({id:a.name,description:a.description});if(l(a.position)){const u=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,Kut);c.position=new Nf(u)}e.selectedEntity=c},function(){e.selectedEntity===r&&(e.selectedEntity=d6())}),r}function d6(){return new Nr({id:"None",description:"No features found."})}function Qut(e,t){const n=e._geocoder,i=e._homeButton,o=e._sceneModePicker,r=e._projectionPicker,s=e._baseLayerPicker,a=e._animation,c=e._timeline,u=e._fullscreenButton,d=e._infoBox,h=e._selectionIndicator,m=t?"hidden":"visible";if(l(n)&&(n.container.style.visibility=m),l(i)&&(i.container.style.visibility=m),l(o)&&(o.container.style.visibility=m),l(r)&&(r.container.style.visibility=m),l(s)&&(s.container.style.visibility=m),l(a)&&(a.container.style.visibility=m),l(c)&&(c.container.style.visibility=m),l(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=m),l(d)&&(d.container.style.visibility=m),l(h)&&(h.container.style.visibility=m),e._container){const g=t||!l(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function ri(e,t){if(!l(e))throw new x("container is required.");e=Ar(e),t=A(t,A.EMPTY_OBJECT);const n=(!l(t.globe)||t.globe!==!1)&&(!l(t.baseLayerPicker)||t.baseLayerPicker!==!1);if(!n&&l(t.selectedImageryProviderViewModel))throw new x("options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.imageryProvider instead or set options.baseLayerPicker to true.");if(!n&&l(t.selectedTerrainProviderViewModel))throw new x("options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true.");const i=this,o=document.createElement("div");o.className="cesium-viewer",e.appendChild(o);const r=document.createElement("div");r.className="cesium-viewer-cesiumWidgetContainer",o.appendChild(r);const s=document.createElement("div");s.className="cesium-viewer-bottom",o.appendChild(s);const a=A(t.scene3DOnly,!1);let c,u,d=!1;l(t.clockViewModel)?(u=t.clockViewModel,c=u.clock):(c=new gT,u=new ZT(c),d=!0),l(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);const h=new ug(r,{imageryProvider:n||l(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:l(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});let m=t.dataSources,g=!1;l(m)||(m=new Fa,g=!0);const p=h.scene,y=new Dl({scene:p,dataSourceCollection:m}),b=new Nd;b.add(c.onTick,ri.prototype._onTick,this),b.add(p.morphStart,ri.prototype._clearTrackedObject,this);let C;if(!l(t.selectionIndicator)||t.selectionIndicator!==!1){const q=document.createElement("div");q.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(q),C=new mI(q,p)}let E;if(!l(t.infoBox)||t.infoBox!==!1){const q=document.createElement("div");q.className="cesium-viewer-infoBoxContainer",o.appendChild(q),E=new lI(q);const te=E.viewModel;b.add(te.cameraClicked,ri.prototype._onInfoBoxCameraClicked,this),b.add(te.closeClicked,ri.prototype._onInfoBoxClockClicked,this)}const w=document.createElement("div");w.className="cesium-viewer-toolbar",o.appendChild(w);let S;if(!l(t.geocoder)||t.geocoder!==!1){const q=document.createElement("div");q.className="cesium-viewer-geocoderContainer",w.appendChild(q);let te;l(t.geocoder)&&typeof t.geocoder!="boolean"&&(te=Array.isArray(t.geocoder)?t.geocoder:[t.geocoder]),S=new aI({container:q,geocoderServices:te,scene:p}),b.add(S.viewModel.search.beforeExecute,ri.prototype._clearObjects,this)}let P;if((!l(t.homeButton)||t.homeButton!==!1)&&(P=new cI(w,p),l(S)&&b.add(P.viewModel.command.afterExecute,function(){const q=S.viewModel;q.searchText="",q.isSearchInProgress&&q.search()}),b.add(P.viewModel.command.beforeExecute,ri.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new x("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let L;!a&&(!l(t.sceneModePicker)||t.sceneModePicker!==!1)&&(L=new pI(w,p));let z;t.projectionPicker&&(z=new fI(w,p));let R,F;if(n){const q=A(t.imageryProviderViewModels,lut()),te=A(t.terrainProviderViewModels,uut());R=new oI(w,{globe:p.globe,imageryProviderViewModels:q,selectedImageryProviderViewModel:t.selectedImageryProviderViewModel,terrainProviderViewModels:te,selectedTerrainProviderViewModel:t.selectedTerrainProviderViewModel}),F=w.getElementsByClassName("cesium-baseLayerPicker-dropDown")[0]}l(t.imageryProvider)&&t.imageryProvider!==!1&&(n&&(R.viewModel.selectedImagery=void 0),p.imageryLayers.removeAll(),p.imageryLayers.addImageryProvider(t.imageryProvider)),l(t.terrainProvider)&&(n&&(R.viewModel.selectedTerrain=void 0),p.terrainProvider=t.terrainProvider);let U;if(!l(t.navigationHelpButton)||t.navigationHelpButton!==!1){let q=!0;try{if(l(window.localStorage)){const te=window.localStorage.getItem("cesium-hasSeenNavHelp");l(te)&&Boolean(te)?q=!1:window.localStorage.setItem("cesium-hasSeenNavHelp","true")}}catch{}U=new uI({container:w,instructionsInitiallyVisible:A(t.navigationInstructionsInitiallyVisible,q)})}let D;if(!l(t.animation)||t.animation!==!1){const q=document.createElement("div");q.className="cesium-viewer-animationContainer",o.appendChild(q),D=new K0(q,new pl(u))}let I;if(!l(t.timeline)||t.timeline!==!1){const q=document.createElement("div");q.className="cesium-viewer-timelineContainer",o.appendChild(q),I=new Aa(q,c),I.addEventListener("settime",hne,!1),I.zoomTo(c.startTime,c.stopTime)}let _,v,O;(!l(t.fullscreenButton)||t.fullscreenButton!==!1)&&(O=document.createElement("div"),O.className="cesium-viewer-fullscreenContainer",o.appendChild(O),_=new sI(O,t.fullscreenElement),v=il(_.viewModel,"isFullscreenEnabled",function(q){O.style.display=q?"block":"none",l(I)&&(I.container.style.right=`${O.clientWidth}px`,I.resize())}));let N,V,k;if(t.vrButton){const q=document.createElement("div");q.className="cesium-viewer-vrContainer",o.appendChild(q),N=new gI(q,p,t.fullScreenElement),V=il(N.viewModel,"isVREnabled",function(te){q.style.display=te?"block":"none",l(_)&&(q.style.right=`${O.clientWidth}px`),l(I)&&(I.container.style.right=`${q.clientWidth}px`,I.resize())}),k=il(N.viewModel,"isVRMode",function(te){Qut(i,te)})}this._baseLayerPickerDropDown=F,this._fullscreenSubscription=v,this._vrSubscription=V,this._vrModeSubscription=k,this._dataSourceChangedListeners={},this._automaticallyTrackDataSourceClocks=A(t.automaticallyTrackDataSourceClocks,!0),this._container=e,this._bottomContainer=s,this._element=o,this._cesiumWidget=h,this._selectionIndicator=C,this._infoBox=E,this._dataSourceCollection=m,this._destroyDataSourceCollection=g,this._dataSourceDisplay=y,this._clockViewModel=u,this._destroyClockViewModel=d,this._toolbar=w,this._homeButton=P,this._sceneModePicker=L,this._projectionPicker=z,this._baseLayerPicker=R,this._navigationHelpButton=U,this._animation=D,this._timeline=I,this._fullscreenButton=_,this._vrButton=N,this._geocoder=S,this._eventHelper=b,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=l(E)||l(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 Ke,this._trackedEntityChanged=new Ke,it.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),b.add(m.dataSourceAdded,ri.prototype._onDataSourceAdded,this),b.add(m.dataSourceRemoved,ri.prototype._onDataSourceRemoved,this),b.add(p.postUpdate,ri.prototype.resize,this),b.add(p.postRender,ri.prototype._postRender,this);const G=m.length;for(let q=0;q<G;q++)this._dataSourceAdded(m,m.get(q));this._dataSourceAdded(void 0,y.defaultDataSource),b.add(m.dataSourceAdded,ri.prototype._dataSourceAdded,this),b.add(m.dataSourceRemoved,ri.prototype._dataSourceRemoved,this);function W(q){const te=u6(i,q);l(te)?Z.getValueOrUndefined(te.position,i.clock.currentTime)?i.trackedEntity=te:i.zoomTo(te):l(i.trackedEntity)&&(i.trackedEntity=void 0)}function K(q){i.selectedEntity=u6(i,q)}h.screenSpaceEventHandler.setInputAction(K,kn.LEFT_CLICK),h.screenSpaceEventHandler.setInputAction(W,kn.LEFT_DOUBLE_CLICK)}Object.defineProperties(ri.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,Lv(this);const t=this.scene,n=t.mode;!l(e)||!l(e.position)?(this._needTrackedEntityUpdate=!1,(n===le.COLUMBUS_VIEW||n===le.SCENE2D)&&(t.screenSpaceCameraController.enableTranslate=!0),(n===le.COLUMBUS_VIEW||n===le.SCENE3D)&&(t.screenSpaceCameraController.enableTilt=!0),this._entityView=void 0,this.camera.lookAtTransform(B.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;const t=l(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;l(e)?l(t)&&t.animateAppear():l(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,pne(this._timeline,this.clock,e))}}});ri.prototype.extend=function(e,t){if(!l(e))throw new x("mixin is required.");e(this,t)};ri.prototype.resize=function(){const e=this._cesiumWidget,t=this._container,n=t.clientWidth,i=t.clientHeight,o=l(this._animation),r=l(this._timeline);if(e.resize(),n===this._lastWidth&&i===this._lastHeight)return;const s=i-125,a=this._baseLayerPickerDropDown;if(l(a)&&(a.style.maxHeight=`${s}px`),l(this._geocoder)){const g=this._geocoder.searchSuggestionsContainer;g.style.maxHeight=`${s}px`}l(this._infoBox)&&(this._infoBox.viewModel.maxHeight=s);const c=this._timeline;let u,d=0,h=0,m=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){const g=this._lastWidth;u=this._animation.container,n>900?(d=169,g<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(d=136,(g<600||g>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(d=106,(g>600||g===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),h=d+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){const g=this._fullscreenButton,p=this._vrButton,y=c.container,b=y.style;m=y.clientHeight+3,b.left=`${d}px`;let C=0;l(g)&&(C+=g.container.clientWidth),l(p)&&(C+=p.container.clientWidth),b.right=`${C}px`,c.resize()}this._bottomContainer.style.left=`${h}px`,this._bottomContainer.style.bottom=`${m}px`,this._lastWidth=n,this._lastHeight=i};ri.prototype.forceResize=function(){this._lastWidth=0,this.resize()};ri.prototype.render=function(){this._cesiumWidget.render()};ri.prototype.isDestroyed=function(){return!1};ri.prototype.destroy=function(){let e;this.screenSpaceEventHandler.removeInputAction(kn.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(kn.LEFT_DOUBLE_CLICK);const 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(),l(this._geocoder)&&(this._geocoder=this._geocoder.destroy()),l(this._homeButton)&&(this._homeButton=this._homeButton.destroy()),l(this._sceneModePicker)&&(this._sceneModePicker=this._sceneModePicker.destroy()),l(this._projectionPicker)&&(this._projectionPicker=this._projectionPicker.destroy()),l(this._baseLayerPicker)&&(this._baseLayerPicker=this._baseLayerPicker.destroy()),l(this._animation)&&(this._element.removeChild(this._animation.container),this._animation=this._animation.destroy()),l(this._timeline)&&(this._timeline.removeEventListener("settime",hne,!1),this._element.removeChild(this._timeline.container),this._timeline=this._timeline.destroy()),l(this._fullscreenButton)&&(this._fullscreenSubscription.dispose(),this._element.removeChild(this._fullscreenButton.container),this._fullscreenButton=this._fullscreenButton.destroy()),l(this._vrButton)&&(this._vrSubscription.dispose(),this._vrModeSubscription.dispose(),this._element.removeChild(this._vrButton.container),this._vrButton=this._vrButton.destroy()),l(this._infoBox)&&(this._element.removeChild(this._infoBox.container),this._infoBox=this._infoBox.destroy()),l(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()),He(this)};ri.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener(ri.prototype._onEntityCollectionChanged,this)};ri.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener(ri.prototype._onEntityCollectionChanged,this),l(this.trackedEntity)&&n.getById(this.trackedEntity.id)===this.trackedEntity&&(this.trackedEntity=void 0),l(this.selectedEntity)&&n.getById(this.selectedEntity.id)===this.selectedEntity&&(this.selectedEntity=void 0)};ri.prototype._onTick=function(e){const t=e.currentTime,n=this._dataSourceDisplay.update(t);this._allowDataSourcesToSuspendAnimation&&(this._clockViewModel.canAnimate=n);const i=this._entityView;if(l(i)){const d=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(d,!1,rp)===gt.DONE&&i.update(t,rp)}let o,r=!1;const s=this.selectedEntity,a=l(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,rp)!==gt.FAILED?o=rp.center:l(s.position)&&(o=s.position.getValue(t,o)),r=l(o));const c=l(this._selectionIndicator)?this._selectionIndicator.viewModel:void 0;l(c)&&(c.position=f.clone(o,c.position),c.showSelection=a&&r,c.update());const u=l(this._infoBox)?this._infoBox.viewModel:void 0;l(u)&&(u.showInfo=a,u.enableCamera=r,u.isCameraTracking=this.trackedEntity===this.selectedEntity,a?(u.titleText=A(s.name,s.id),u.description=Z.getValueOrDefault(s.description,t,"")):(u.titleText="",u.description=""))};ri.prototype._onEntityCollectionChanged=function(e,t,n){const i=n.length;for(let o=0;o<i;o++){const r=n[o];this.trackedEntity===r&&(this.trackedEntity=void 0),this.selectedEntity===r&&(this.selectedEntity=void 0)}};ri.prototype._onInfoBoxCameraClicked=function(e){if(e.isCameraTracking&&this.trackedEntity===this.selectedEntity)this.trackedEntity=void 0;else{const n=this.selectedEntity.position;l(n)?this.trackedEntity=this.selectedEntity:this.zoomTo(this.selectedEntity)}};ri.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};ri.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};ri.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};ri.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&pne(this.timeline,this.clock,e)};ri.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,ri.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};ri.prototype._onDataSourceRemoved=function(e,t){const n=this.clockTrackedDataSource===t,i=t.entities.id;if(this._dataSourceChangedListeners[i](),this._dataSourceChangedListeners[i]=void 0,n){const o=e.length;this._automaticallyTrackDataSourceClocks&&o>0?this.clockTrackedDataSource=e.get(o-1):this.clockTrackedDataSource=void 0}};ri.prototype.zoomTo=function(e,t){return mne(this,e,{offset:t},!1)};ri.prototype.flyTo=function(e,t){return mne(this,e,t,!0)};function mne(e,t,n,i){if(!l(t))throw new x("zoomTarget is required.");Lv(e);const 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 Vn){r.getViewableRectangle().then(function(s){return iI(s,e.scene)}).then(function(s){e._zoomPromise===o&&(e._zoomTarget=s)});return}if(r instanceof Mr||r instanceof am||r instanceof Au){e._zoomTarget=r;return}if(r.isLoading&&l(r.loadingEvent)){const 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=A(r.values,r),l(r.entities)&&(r=r.entities.values),Array.isArray(r)?e._zoomTarget=r.slice(0):e._zoomTarget=[r]}}),e.scene.requestRender(),o}function Ay(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function Lv(e){const t=e._zoomPromise;l(t)&&(Ay(e),e._completeZoom(!1))}ri.prototype._postRender=function(){Zut(this),edt(this)};function Zut(e){const t=e._zoomTarget;if(!l(t)||e.scene.mode===le.MORPHING)return;const n=e.scene,i=n.camera,o=A(e._zoomOptions,{});let r;if(t instanceof Mr||t instanceof Au)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new D_(0,-.5,u.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(u,o.offset),i.lookAtTransform(B.IDENTITY),e._completeZoom(!0)),Ay(e)}).catch(()=>{Lv(e)});if(t instanceof am)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new D_(0,-.5,u.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(u,r):(i.viewBoundingSphere(u,o.offset),i.lookAtTransform(B.IDENTITY),e._completeZoom(!0)),Ay(e)});if(t instanceof Ce){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)),Ay(e);return}const s=t,a=[];for(let u=0,d=s.length;u<d;u++){const h=e._dataSourceDisplay.getBoundingSphere(s[u],!1,rp);if(h===gt.PENDING)return;h!==gt.FAILED&&a.push(fe.clone(rp))}if(a.length===0){Lv(e);return}e.trackedEntity=void 0;const c=fe.fromBoundingSpheres(a);e._zoomIsFlight?(Ay(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(B.IDENTITY),Ay(e),e._completeZoom(!0))}function edt(e){if(!e._needTrackedEntityUpdate)return;const t=e._trackedEntity,n=e.clock.currentTime,i=Z.getValueOrUndefined(t.position,n);if(!l(i))return;const o=e.scene,r=e._dataSourceDisplay.getBoundingSphere(t,!1,rp);if(r===gt.PENDING)return;const s=o.mode;(s===le.COLUMBUS_VIEW||s===le.SCENE2D)&&(o.screenSpaceCameraController.enableTranslate=!1),(s===le.COLUMBUS_VIEW||s===le.SCENE3D)&&(o.screenSpaceCameraController.enableTilt=!1);const a=r!==gt.FAILED?rp:void 0;e._entityView=new eT(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}function _ne(e,t){return function(){return e.apply(t,arguments)}}const{toString:gne}=Object.prototype,{getPrototypeOf:MF}=Object,FF=(e=>t=>{const n=gne.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),lh=e=>(e=e.toLowerCase(),t=>FF(t)===e),yI=e=>t=>typeof t===e,{isArray:J0}=Array,iT=yI("undefined");function tdt(e){return e!==null&&!iT(e)&&e.constructor!==null&&!iT(e.constructor)&&k_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const yne=lh("ArrayBuffer");function ndt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&yne(e.buffer),t}const idt=yI("string"),k_=yI("function"),Ane=yI("number"),zF=e=>e!==null&&typeof e=="object",odt=e=>e===!0||e===!1,_S=e=>{if(FF(e)!=="object")return!1;const t=MF(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},rdt=lh("Date"),sdt=lh("File"),adt=lh("Blob"),cdt=lh("FileList"),ldt=e=>zF(e)&&k_(e.pipe),udt=e=>{const t="[object FormData]";return e&&(typeof FormData=="function"&&e instanceof FormData||gne.call(e)===t||k_(e.toString)&&e.toString()===t)},ddt=lh("URLSearchParams"),fdt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tE(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),J0(e))for(i=0,o=e.length;i<o;i++)t.call(null,e[i],i,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),s=r.length;let a;for(i=0;i<s;i++)a=r[i],t.call(null,e[a],a,e)}}function bne(e,t){t=t.toLowerCase();const n=Object.keys(e);let i=n.length,o;for(;i-- >0;)if(o=n[i],t===o.toLowerCase())return o;return null}const Cne=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Tne=e=>!iT(e)&&e!==Cne;function nN(){const{caseless:e}=Tne(this)&&this||{},t={},n=(i,o)=>{const r=e&&bne(t,o)||o;_S(t[r])&&_S(i)?t[r]=nN(t[r],i):_S(i)?t[r]=nN({},i):J0(i)?t[r]=i.slice():t[r]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&tE(arguments[i],n);return t}const hdt=(e,t,n,{allOwnKeys:i}={})=>(tE(t,(o,r)=>{n&&k_(o)?e[r]=_ne(o,n):e[r]=o},{allOwnKeys:i}),e),pdt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),mdt=(e,t,n,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},_dt=(e,t,n,i)=>{let o,r,s;const a={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),r=o.length;r-- >0;)s=o[r],(!i||i(s,e,t))&&!a[s]&&(t[s]=e[s],a[s]=!0);e=n!==!1&&MF(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},gdt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const i=e.indexOf(t,n);return i!==-1&&i===n},ydt=e=>{if(!e)return null;if(J0(e))return e;let t=e.length;if(!Ane(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Adt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&MF(Uint8Array)),bdt=(e,t)=>{const i=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=i.next())&&!o.done;){const r=o.value;t.call(e,r[0],r[1])}},Cdt=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},Tdt=lh("HTMLFormElement"),Edt=e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),f6=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),xdt=lh("RegExp"),Ene=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};tE(n,(o,r)=>{t(o,r,e)!==!1&&(i[r]=o)}),Object.defineProperties(e,i)},wdt=e=>{Ene(e,(t,n)=>{if(k_(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=e[n];if(k_(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Sdt=(e,t)=>{const n={},i=o=>{o.forEach(r=>{n[r]=!0})};return J0(e)?i(e):i(String(e).split(t)),n},vdt=()=>{},Ddt=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Idt=e=>{const t=new Array(10),n=(i,o)=>{if(zF(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;const r=J0(i)?[]:{};return tE(i,(s,a)=>{const c=n(s,o+1);!iT(c)&&(r[a]=c)}),t[o]=void 0,r}}return i};return n(e,0)},je={isArray:J0,isArrayBuffer:yne,isBuffer:tdt,isFormData:udt,isArrayBufferView:ndt,isString:idt,isNumber:Ane,isBoolean:odt,isObject:zF,isPlainObject:_S,isUndefined:iT,isDate:rdt,isFile:sdt,isBlob:adt,isRegExp:xdt,isFunction:k_,isStream:ldt,isURLSearchParams:ddt,isTypedArray:Adt,isFileList:cdt,forEach:tE,merge:nN,extend:hdt,trim:fdt,stripBOM:pdt,inherits:mdt,toFlatObject:_dt,kindOf:FF,kindOfTest:lh,endsWith:gdt,toArray:ydt,forEachEntry:bdt,matchAll:Cdt,isHTMLForm:Tdt,hasOwnProperty:f6,hasOwnProp:f6,reduceDescriptors:Ene,freezeMethods:wdt,toObjectSet:Sdt,toCamelCase:Edt,noop:vdt,toFiniteNumber:Ddt,findKey:bne,global:Cne,isContextDefined:Tne,toJSONObject:Idt};function Si(e,t,n,i,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o)}je.inherits(Si,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:je.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const xne=Si.prototype,wne={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{wne[e]={value:e}});Object.defineProperties(Si,wne);Object.defineProperty(xne,"isAxiosError",{value:!0});Si.from=(e,t,n,i,o,r)=>{const s=Object.create(xne);return je.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),Si.call(s,e.message,t,n,i,o),s.cause=e,s.name=e.name,r&&Object.assign(s,r),s};var Pdt=typeof self=="object"?self.FormData:window.FormData;const Odt=Pdt;function iN(e){return je.isPlainObject(e)||je.isArray(e)}function Sne(e){return je.endsWith(e,"[]")?e.slice(0,-2):e}function h6(e,t,n){return e?e.concat(t).map(function(o,r){return o=Sne(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function Ldt(e){return je.isArray(e)&&!e.some(iN)}const Bdt=je.toFlatObject(je,{},null,function(t){return/^is[A-Z]/.test(t)});function Rdt(e){return e&&je.isFunction(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator]}function AI(e,t,n){if(!je.isObject(e))throw new TypeError("target must be an object");t=t||new(Odt||FormData),n=je.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,b){return!je.isUndefined(b[y])});const i=n.metaTokens,o=n.visitor||d,r=n.dots,s=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Rdt(t);if(!je.isFunction(o))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(je.isDate(p))return p.toISOString();if(!c&&je.isBlob(p))throw new Si("Blob is not supported. Use a Buffer instead.");return je.isArrayBuffer(p)||je.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function d(p,y,b){let C=p;if(p&&!b&&typeof p=="object"){if(je.endsWith(y,"{}"))y=i?y:y.slice(0,-2),p=JSON.stringify(p);else if(je.isArray(p)&&Ldt(p)||je.isFileList(p)||je.endsWith(y,"[]")&&(C=je.toArray(p)))return y=Sne(y),C.forEach(function(w,S){!(je.isUndefined(w)||w===null)&&t.append(s===!0?h6([y],S,r):s===null?y:y+"[]",u(w))}),!1}return iN(p)?!0:(t.append(h6(b,y,r),u(p)),!1)}const h=[],m=Object.assign(Bdt,{defaultVisitor:d,convertValue:u,isVisitable:iN});function g(p,y){if(!je.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(p),je.forEach(p,function(C,E){(!(je.isUndefined(C)||C===null)&&o.call(t,C,je.isString(E)?E.trim():E,y,m))===!0&&g(C,y?y.concat(E):[E])}),h.pop()}}if(!je.isObject(e))throw new TypeError("data must be an object");return g(e),t}function p6(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function UF(e,t){this._pairs=[],e&&AI(e,this,t)}const vne=UF.prototype;vne.append=function(t,n){this._pairs.push([t,n])};vne.toString=function(t){const n=t?function(i){return t.call(this,i,p6)}:p6;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function Ndt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Dne(e,t,n){if(!t)return e;const i=n&&n.encode||Ndt,o=n&&n.serialize;let r;if(o?r=o(t,n):r=je.isURLSearchParams(t)?t.toString():new UF(t,n).toString(i),r){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Mdt{constructor(){this.handlers=[]}use(t,n,i){return this.handlers.push({fulfilled:t,rejected:n,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){je.forEach(this.handlers,function(i){i!==null&&t(i)})}}const m6=Mdt,Ine={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Fdt=typeof URLSearchParams<"u"?URLSearchParams:UF,zdt=FormData,Udt=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Hdt=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),td={isBrowser:!0,classes:{URLSearchParams:Fdt,FormData:zdt,Blob},isStandardBrowserEnv:Udt,isStandardBrowserWebWorkerEnv:Hdt,protocols:["http","https","file","blob","url","data"]};function Vdt(e,t){return AI(e,new td.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,r){return td.isNode&&je.isBuffer(n)?(this.append(i,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function kdt(e){return je.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Gdt(e){const t={},n=Object.keys(e);let i;const o=n.length;let r;for(i=0;i<o;i++)r=n[i],t[r]=e[r];return t}function Pne(e){function t(n,i,o,r){let s=n[r++];const a=Number.isFinite(+s),c=r>=n.length;return s=!s&&je.isArray(o)?o.length:s,c?(je.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!a):((!o[s]||!je.isObject(o[s]))&&(o[s]=[]),t(n,i,o[s],r)&&je.isArray(o[s])&&(o[s]=Gdt(o[s])),!a)}if(je.isFormData(e)&&je.isFunction(e.entries)){const n={};return je.forEachEntry(e,(i,o)=>{t(kdt(i),o,n,0)}),n}return null}const Wdt={"Content-Type":void 0};function jdt(e,t,n){if(je.isString(e))try{return(t||JSON.parse)(e),je.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const bI={transitional:Ine,adapter:["xhr","http"],transformRequest:[function(t,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,r=je.isObject(t);if(r&&je.isHTMLForm(t)&&(t=new FormData(t)),je.isFormData(t))return o&&o?JSON.stringify(Pne(t)):t;if(je.isArrayBuffer(t)||je.isBuffer(t)||je.isStream(t)||je.isFile(t)||je.isBlob(t))return t;if(je.isArrayBufferView(t))return t.buffer;if(je.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(r){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Vdt(t,this.formSerializer).toString();if((a=je.isFileList(t))||i.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return AI(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return r||o?(n.setContentType("application/json",!1),jdt(t)):t}],transformResponse:[function(t){const n=this.transitional||bI.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(t&&je.isString(t)&&(i&&!this.responseType||o)){const s=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?Si.from(a,Si.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:td.classes.FormData,Blob:td.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};je.forEach(["delete","get","head"],function(t){bI.headers[t]={}});je.forEach(["post","put","patch"],function(t){bI.headers[t]=je.merge(Wdt)});const HF=bI,qdt=je.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),$dt=e=>{const t={};let n,i,o;return e&&e.split(`
|
||
`).forEach(function(s){o=s.indexOf(":"),n=s.substring(0,o).trim().toLowerCase(),i=s.substring(o+1).trim(),!(!n||t[n]&&qdt[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t},_6=Symbol("internals");function nb(e){return e&&String(e).trim().toLowerCase()}function gS(e){return e===!1||e==null?e:je.isArray(e)?e.map(gS):String(e)}function Ydt(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(e);)t[i[1]]=i[2];return t}function Xdt(e){return/^[-_a-zA-Z]+$/.test(e.trim())}function g6(e,t,n,i){if(je.isFunction(i))return i.call(this,t,n);if(je.isString(t)){if(je.isString(i))return t.indexOf(i)!==-1;if(je.isRegExp(i))return i.test(t)}}function Kdt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function Jdt(e,t){const n=je.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+n,{value:function(o,r,s){return this[i].call(this,t,o,r,s)},configurable:!0})})}class CI{constructor(t){t&&this.set(t)}set(t,n,i){const o=this;function r(a,c,u){const d=nb(c);if(!d)throw new Error("header name must be a non-empty string");const h=je.findKey(o,d);(!h||o[h]===void 0||u===!0||u===void 0&&o[h]!==!1)&&(o[h||c]=gS(a))}const s=(a,c)=>je.forEach(a,(u,d)=>r(u,d,c));return je.isPlainObject(t)||t instanceof this.constructor?s(t,n):je.isString(t)&&(t=t.trim())&&!Xdt(t)?s($dt(t),n):t!=null&&r(n,t,i),this}get(t,n){if(t=nb(t),t){const i=je.findKey(this,t);if(i){const o=this[i];if(!n)return o;if(n===!0)return Ydt(o);if(je.isFunction(n))return n.call(this,o,i);if(je.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=nb(t),t){const i=je.findKey(this,t);return!!(i&&(!n||g6(this,this[i],i,n)))}return!1}delete(t,n){const i=this;let o=!1;function r(s){if(s=nb(s),s){const a=je.findKey(i,s);a&&(!n||g6(i,i[a],a,n))&&(delete i[a],o=!0)}}return je.isArray(t)?t.forEach(r):r(t),o}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(t){const n=this,i={};return je.forEach(this,(o,r)=>{const s=je.findKey(i,r);if(s){n[s]=gS(o),delete n[r];return}const a=t?Kdt(r):String(r).trim();a!==r&&delete n[r],n[a]=gS(o),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return je.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&je.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const i=new this(t);return n.forEach(o=>i.set(o)),i}static accessor(t){const i=(this[_6]=this[_6]={accessors:{}}).accessors,o=this.prototype;function r(s){const a=nb(s);i[a]||(Jdt(o,s),i[a]=!0)}return je.isArray(t)?t.forEach(r):r(t),this}}CI.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]);je.freezeMethods(CI.prototype);je.freezeMethods(CI);const Sf=CI;function EL(e,t){const n=this||HF,i=t||n,o=Sf.from(i.headers);let r=i.data;return je.forEach(e,function(a){r=a.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function One(e){return!!(e&&e.__CANCEL__)}function nE(e,t,n){Si.call(this,e??"canceled",Si.ERR_CANCELED,t,n),this.name="CanceledError"}je.inherits(nE,Si,{__CANCEL__:!0});const Qdt=null;function Zdt(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new Si("Request failed with status code "+n.status,[Si.ERR_BAD_REQUEST,Si.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const eft=td.isStandardBrowserEnv?function(){return{write:function(n,i,o,r,s,a){const c=[];c.push(n+"="+encodeURIComponent(i)),je.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),je.isString(r)&&c.push("path="+r),je.isString(s)&&c.push("domain="+s),a===!0&&c.push("secure"),document.cookie=c.join("; ")},read:function(n){const i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function tft(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function nft(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Lne(e,t){return e&&!tft(t)?nft(e,t):t}const ift=td.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let i;function o(r){let s=r;return t&&(n.setAttribute("href",s),s=n.href),n.setAttribute("href",s),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=o(window.location.href),function(s){const a=je.isString(s)?o(s):s;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function oft(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function rft(e,t){e=e||10;const n=new Array(e),i=new Array(e);let o=0,r=0,s;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=i[r];s||(s=u),n[o]=c,i[o]=u;let h=r,m=0;for(;h!==o;)m+=n[h++],h=h%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),u-s<t)return;const g=d&&u-d;return g?Math.round(m*1e3/g):void 0}}function y6(e,t){let n=0;const i=rft(50,250);return o=>{const r=o.loaded,s=o.lengthComputable?o.total:void 0,a=r-n,c=i(a),u=r<=s;n=r;const d={loaded:r,total:s,progress:s?r/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&u?(s-r)/c:void 0,event:o};d[t?"download":"upload"]=!0,e(d)}}const sft=typeof XMLHttpRequest<"u",aft=sft&&function(e){return new Promise(function(n,i){let o=e.data;const r=Sf.from(e.headers).normalize(),s=e.responseType;let a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}je.isFormData(o)&&(td.isStandardBrowserEnv||td.isStandardBrowserWebWorkerEnv)&&r.setContentType(!1);let u=new XMLHttpRequest;if(e.auth){const g=e.auth.username||"",p=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";r.set("Authorization","Basic "+btoa(g+":"+p))}const d=Lne(e.baseURL,e.url);u.open(e.method.toUpperCase(),Dne(d,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function h(){if(!u)return;const g=Sf.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),y={data:!s||s==="text"||s==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:g,config:e,request:u};Zdt(function(C){n(C),c()},function(C){i(C),c()},y),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(i(new Si("Request aborted",Si.ECONNABORTED,e,u)),u=null)},u.onerror=function(){i(new Si("Network Error",Si.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let p=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const y=e.transitional||Ine;e.timeoutErrorMessage&&(p=e.timeoutErrorMessage),i(new Si(p,y.clarifyTimeoutError?Si.ETIMEDOUT:Si.ECONNABORTED,e,u)),u=null},td.isStandardBrowserEnv){const g=(e.withCredentials||ift(d))&&e.xsrfCookieName&&eft.read(e.xsrfCookieName);g&&r.set(e.xsrfHeaderName,g)}o===void 0&&r.setContentType(null),"setRequestHeader"in u&&je.forEach(r.toJSON(),function(p,y){u.setRequestHeader(y,p)}),je.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&s!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",y6(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",y6(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=g=>{u&&(i(!g||g.type?new nE(null,e,u):g),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(a),e.signal&&(e.signal.aborted?a():e.signal.addEventListener("abort",a)));const m=oft(d);if(m&&td.protocols.indexOf(m)===-1){i(new Si("Unsupported protocol "+m+":",Si.ERR_BAD_REQUEST,e));return}u.send(o||null)})},yS={http:Qdt,xhr:aft};je.forEach(yS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const cft={getAdapter:e=>{e=je.isArray(e)?e:[e];const{length:t}=e;let n,i;for(let o=0;o<t&&(n=e[o],!(i=je.isString(n)?yS[n.toLowerCase()]:n));o++);if(!i)throw i===!1?new Si(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(je.hasOwnProp(yS,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`);if(!je.isFunction(i))throw new TypeError("adapter is not a function");return i},adapters:yS};function xL(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nE(null,e)}function A6(e){return xL(e),e.headers=Sf.from(e.headers),e.data=EL.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),cft.getAdapter(e.adapter||HF.adapter)(e).then(function(i){return xL(e),i.data=EL.call(e,e.transformResponse,i),i.headers=Sf.from(i.headers),i},function(i){return One(i)||(xL(e),i&&i.response&&(i.response.data=EL.call(e,e.transformResponse,i.response),i.response.headers=Sf.from(i.response.headers))),Promise.reject(i)})}const b6=e=>e instanceof Sf?e.toJSON():e;function E0(e,t){t=t||{};const n={};function i(u,d,h){return je.isPlainObject(u)&&je.isPlainObject(d)?je.merge.call({caseless:h},u,d):je.isPlainObject(d)?je.merge({},d):je.isArray(d)?d.slice():d}function o(u,d,h){if(je.isUndefined(d)){if(!je.isUndefined(u))return i(void 0,u,h)}else return i(u,d,h)}function r(u,d){if(!je.isUndefined(d))return i(void 0,d)}function s(u,d){if(je.isUndefined(d)){if(!je.isUndefined(u))return i(void 0,u)}else return i(void 0,d)}function a(u,d,h){if(h in t)return i(u,d);if(h in e)return i(void 0,u)}const c={url:r,method:r,data:r,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(u,d)=>o(b6(u),b6(d),!0)};return je.forEach(Object.keys(e).concat(Object.keys(t)),function(d){const h=c[d]||o,m=h(e[d],t[d],d);je.isUndefined(m)&&h!==a||(n[d]=m)}),n}const Bne="1.2.2",VF={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{VF[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});const C6={};VF.transitional=function(t,n,i){function o(r,s){return"[Axios v"+Bne+"] Transitional option '"+r+"'"+s+(i?". "+i:"")}return(r,s,a)=>{if(t===!1)throw new Si(o(s," has been removed"+(n?" in "+n:"")),Si.ERR_DEPRECATED);return n&&!C6[s]&&(C6[s]=!0,console.warn(o(s," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(r,s,a):!0}};function lft(e,t,n){if(typeof e!="object")throw new Si("options must be an object",Si.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let o=i.length;for(;o-- >0;){const r=i[o],s=t[r];if(s){const a=e[r],c=a===void 0||s(a,r,e);if(c!==!0)throw new Si("option "+r+" must be "+c,Si.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Si("Unknown option "+r,Si.ERR_BAD_OPTION)}}const oN={assertOptions:lft,validators:VF},Nh=oN.validators;class Bv{constructor(t){this.defaults=t,this.interceptors={request:new m6,response:new m6}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=E0(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:r}=n;i!==void 0&&oN.assertOptions(i,{silentJSONParsing:Nh.transitional(Nh.boolean),forcedJSONParsing:Nh.transitional(Nh.boolean),clarifyTimeoutError:Nh.transitional(Nh.boolean)},!1),o!==void 0&&oN.assertOptions(o,{encode:Nh.function,serialize:Nh.function},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s;s=r&&je.merge(r.common,r[n.method]),s&&je.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),n.headers=Sf.concat(s,r);const a=[];let c=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(c=c&&y.synchronous,a.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let d,h=0,m;if(!c){const p=[A6.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,u),m=p.length,d=Promise.resolve(n);h<m;)d=d.then(p[h++],p[h++]);return d}m=a.length;let g=n;for(h=0;h<m;){const p=a[h++],y=a[h++];try{g=p(g)}catch(b){y.call(this,b);break}}try{d=A6.call(this,g)}catch(p){return Promise.reject(p)}for(h=0,m=u.length;h<m;)d=d.then(u[h++],u[h++]);return d}getUri(t){t=E0(this.defaults,t);const n=Lne(t.baseURL,t.url);return Dne(n,t.params,t.paramsSerializer)}}je.forEach(["delete","get","head","options"],function(t){Bv.prototype[t]=function(n,i){return this.request(E0(i||{},{method:t,url:n,data:(i||{}).data}))}});je.forEach(["post","put","patch"],function(t){function n(i){return function(r,s,a){return this.request(E0(a||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}Bv.prototype[t]=n(),Bv.prototype[t+"Form"]=n(!0)});const AS=Bv;class kF{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const i=this;this.promise.then(o=>{if(!i._listeners)return;let r=i._listeners.length;for(;r-- >0;)i._listeners[r](o);i._listeners=null}),this.promise.then=o=>{let r;const s=new Promise(a=>{i.subscribe(a),r=a}).then(o);return s.cancel=function(){i.unsubscribe(r)},s},t(function(r,s,a){i.reason||(i.reason=new nE(r,s,a),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new kF(function(o){t=o}),cancel:t}}}const uft=kF;function dft(e){return function(n){return e.apply(null,n)}}function fft(e){return je.isObject(e)&&e.isAxiosError===!0}const rN={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(rN).forEach(([e,t])=>{rN[t]=e});const hft=rN;function Rne(e){const t=new AS(e),n=_ne(AS.prototype.request,t);return je.extend(n,AS.prototype,t,{allOwnKeys:!0}),je.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return Rne(E0(e,o))},n}const Qr=Rne(HF);Qr.Axios=AS;Qr.CanceledError=nE;Qr.CancelToken=uft;Qr.isCancel=One;Qr.VERSION=Bne;Qr.toFormData=AI;Qr.AxiosError=Si;Qr.Cancel=Qr.CanceledError;Qr.all=function(t){return Promise.all(t)};Qr.spread=dft;Qr.isAxiosError=fft;Qr.mergeConfig=E0;Qr.AxiosHeaders=Sf;Qr.formToJSON=e=>Pne(je.isHTMLForm(e)?new FormData(e):e);Qr.HttpStatusCode=hft;Qr.default=Qr;const pft=Qr,mft="https://celestrak.org";function _ft(e=""){let t=`${mft}/NORAD/elements/gp.php?GROUP=${e}&FORMAT=tle`;return pft.get(t).then(n=>n.status===200?(Lb.success("获取TLE成功"),localStorage.setItem(e,n.data),Promise.resolve(n.data)):(Lb.error("获取TLE失败"),Promise.reject(n.statusText)))}/*!
|
||
* satellite-js v4.1.4
|
||
* (c) 2013 Shashwat Kandadai and UCSC
|
||
* https://github.com/shashwatak/satellite-js
|
||
* License: MIT
|
||
*/var Uf=Math.PI,lr=Uf*2,xb=Uf/180,gft=1440,yft=398600.5,sc=6378.137,df=60/Math.sqrt(sc*sc*sc/yft),wL=sc*df/60,Aft=1/df,r_=.00108262998905,bft=-253215306e-14,Cft=-161098761e-14,s_=bft/r_,oT=2/3;function Tft(e,t){for(var n=[31,e%4===0?29:28,31,30,31,30,31,31,30,31,30,31],i=Math.floor(t),o=1,r=0;i>r+n[o-1]&&o<12;)r+=n[o-1],o+=1;var s=o,a=i-r,c=(t-i)*24,u=Math.floor(c);c=(c-u)*60;var d=Math.floor(c),h=(c-d)*60;return{mon:s,day:a,hr:u,minute:d,sec:h}}function T6(e,t,n,i,o,r){var s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:0;return 367*e-Math.floor(7*(e+Math.floor((t+9)/12))*.25)+Math.floor(275*t/9)+n+17210135e-1+((s/6e4+r/60+o)/60+i)/24}function GF(e,t,n,i,o,r,s){if(e instanceof Date){var a=e;return T6(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())}return T6(e,t,n,i,o,r,s)}function Nne(e,t){var n=e.e3,i=e.ee2,o=e.peo,r=e.pgho,s=e.pho,a=e.pinco,c=e.plo,u=e.se2,d=e.se3,h=e.sgh2,m=e.sgh3,g=e.sgh4,p=e.sh2,y=e.sh3,b=e.si2,C=e.si3,E=e.sl2,w=e.sl3,S=e.sl4,P=e.t,L=e.xgh2,z=e.xgh3,R=e.xgh4,F=e.xh2,U=e.xh3,D=e.xi2,I=e.xi3,_=e.xl2,v=e.xl3,O=e.xl4,N=e.zmol,V=e.zmos,k=t.init,G=t.opsmode,W=t.ep,K=t.inclp,q=t.nodep,te=t.argpp,Y=t.mp,X,$,se,ue,re,he,ce,Q,ne,de,_e,Se,ve,Le,Ee,Be,Pe,Ae,xe,Oe,Ve,Re=119459e-10,At=.01675,xt=.00015835218,Nt=.0549;Ve=V+Re*P,k==="y"&&(Ve=V),Oe=Ve+2*At*Math.sin(Ve),Pe=Math.sin(Oe),de=.5*Pe*Pe-.25,_e=-.5*Pe*Math.cos(Oe);var On=u*de+d*_e,Nn=b*de+C*_e,Sn=E*de+w*_e+S*Pe,un=h*de+m*_e+g*Pe,Ht=p*de+y*_e;Ve=N+xt*P,k==="y"&&(Ve=N),Oe=Ve+2*Nt*Math.sin(Ve),Pe=Math.sin(Oe),de=.5*Pe*Pe-.25,_e=-.5*Pe*Math.cos(Oe);var vn=i*de+n*_e,Pn=D*de+I*_e,qt=_*de+v*_e+O*Pe,tn=L*de+z*_e+R*Pe,jn=F*de+U*_e;return Se=On+vn,Ee=Nn+Pn,Be=Sn+qt,ve=un+tn,Le=Ht+jn,k==="n"&&(Se-=o,Ee-=a,Be-=c,ve-=r,Le-=s,K+=Ee,W+=Se,ue=Math.sin(K),se=Math.cos(K),K>=.2?(Le/=ue,ve-=se*Le,te+=ve,q+=Le,Y+=Be):(he=Math.sin(q),re=Math.cos(q),X=ue*he,$=ue*re,ce=Le*re+Ee*se*he,Q=-Le*he+Ee*se*re,X+=ce,$+=Q,q%=lr,q<0&&G==="a"&&(q+=lr),Ae=Y+te+se*q,ne=Be+ve-Ee*q*ue,Ae+=ne,xe=q,q=Math.atan2(X,$),q<0&&G==="a"&&(q+=lr),Math.abs(xe-q)>Uf&&(q<xe?q+=lr:q-=lr),Y+=Be,te=Ae-Y-se*q)),{ep:W,inclp:K,nodep:q,argpp:te,mp:Y}}function Eft(e){var t=e.epoch,n=e.ep,i=e.argpp,o=e.tc,r=e.inclp,s=e.nodep,a=e.np,c,u,d,h,m,g,p,y,b,C,E,w,S,P,L,z,R,F,U,D,I,_,v,O,N,V,k,G,W,K,q,te,Y,X,$,se,ue,re,he,ce,Q,ne,de,_e,Se,ve,Le,Ee,Be,Pe,Ae,xe,Oe,Ve,Re,At,xt,Nt,On,Nn,Sn,un,Ht,vn=.01675,Pn=.0549,qt=29864797e-13,tn=47968065e-14,jn=.39785416,hi=.91744867,sn=.1945905,zi=-.98088458,oo=a,Wi=n,li=Math.sin(s),mn=Math.cos(s),Kn=Math.sin(i),Hn=Math.cos(i),dn=Math.sin(r),bt=Math.cos(r),Ge=Wi*Wi,Mn=1-Ge,Tn=Math.sqrt(Mn),Qi=0,Fn=0,ji=0,Lo=0,po=0,Ur=t+18261.5+o/1440,Zi=(4.523602-.00092422029*Ur)%lr,qi=Math.sin(Zi),Hr=Math.cos(Zi),ba=.91375164-.03568096*Hr,Ct=Math.sqrt(1-ba*ba),we=.089683511*qi/Ct,$e=Math.sqrt(1-we*we),ot=5.8351514+.001944368*Ur,Jn=.39785416*qi/Ct,Zr=$e*Hr+.91744867*we*qi;Jn=Math.atan2(Jn,Zr),Jn+=ot-Zi;var xr=Math.cos(Jn),_r=Math.sin(Jn);D=sn,I=zi,O=hi,N=jn,_=mn,v=li,E=qt;for(var uh=1/oo,Bo=0;Bo<2;)Bo+=1,c=D*_+I*O*v,d=-I*_+D*O*v,p=-D*v+I*O*_,y=I*N,b=I*v+D*O*_,C=D*N,u=bt*p+dn*y,h=bt*b+dn*C,m=-dn*p+bt*y,g=-dn*b+bt*C,w=c*Hn+u*Kn,S=d*Hn+h*Kn,P=-c*Kn+u*Hn,L=-d*Kn+h*Hn,z=m*Kn,R=g*Kn,F=m*Hn,U=g*Hn,Sn=12*w*w-3*P*P,un=24*w*S-6*P*L,Ht=12*S*S-3*L*L,xe=3*(c*c+u*u)+Sn*Ge,Oe=6*(c*d+u*h)+un*Ge,Ve=3*(d*d+h*h)+Ht*Ge,Re=-6*c*m+Ge*(-24*w*F-6*P*z),At=-6*(c*g+d*m)+Ge*(-24*(S*F+w*U)+-6*(P*R+L*z)),xt=-6*d*g+Ge*(-24*S*U-6*L*R),Nt=6*u*m+Ge*(24*w*z-6*P*F),On=6*(h*m+u*g)+Ge*(24*(S*z+w*R)-6*(L*F+P*U)),Nn=6*h*g+Ge*(24*S*R-6*L*U),xe=xe+xe+Mn*Sn,Oe=Oe+Oe+Mn*un,Ve=Ve+Ve+Mn*Ht,Le=E*uh,ve=-.5*Le/Tn,Ee=Le*Tn,Se=-15*Wi*Ee,Be=w*P+S*L,Pe=S*P+w*L,Ae=S*L-w*P,Bo===1&&(V=Se,k=ve,G=Le,W=Ee,K=Be,q=Pe,te=Ae,Y=xe,X=Oe,$=Ve,se=Re,ue=At,re=xt,he=Nt,ce=On,Q=Nn,ne=Sn,de=un,_e=Ht,D=xr,I=_r,O=ba,N=Ct,_=$e*mn+we*li,v=li*$e-mn*we,E=tn);var Fd=(4.7199672+(.2299715*Ur-ot))%lr,Ag=(6.2565837+.017201977*Ur)%lr,iE=2*V*q,cm=2*V*te,lm=2*k*ue,TI=2*k*(re-se),EI=-2*G*X,xI=-2*G*($-Y),wI=-2*G*(-21-9*Ge)*vn,bg=2*W*de,SI=2*W*(_e-ne),vI=-18*W*vn,Q0=-2*k*ce,oE=-2*k*(Q-he),Z0=2*Se*Pe,DI=2*Se*Ae,II=2*ve*At,Fne=2*ve*(xt-Re),zne=-2*Le*Oe,Une=-2*Le*(Ve-xe),Hne=-2*Le*(-21-9*Ge)*Pn,Vne=2*Ee*un,kne=2*Ee*(Ht-Sn),Gne=-18*Ee*Pn,Wne=-2*ve*On,jne=-2*ve*(Nn-Nt);return{snodm:li,cnodm:mn,sinim:dn,cosim:bt,sinomm:Kn,cosomm:Hn,day:Ur,e3:DI,ee2:Z0,em:Wi,emsq:Ge,gam:ot,peo:Qi,pgho:Lo,pho:po,pinco:Fn,plo:ji,rtemsq:Tn,se2:iE,se3:cm,sgh2:bg,sgh3:SI,sgh4:vI,sh2:Q0,sh3:oE,si2:lm,si3:TI,sl2:EI,sl3:xI,sl4:wI,s1:Se,s2:ve,s3:Le,s4:Ee,s5:Be,s6:Pe,s7:Ae,ss1:V,ss2:k,ss3:G,ss4:W,ss5:K,ss6:q,ss7:te,sz1:Y,sz2:X,sz3:$,sz11:se,sz12:ue,sz13:re,sz21:he,sz22:ce,sz23:Q,sz31:ne,sz32:de,sz33:_e,xgh2:Vne,xgh3:kne,xgh4:Gne,xh2:Wne,xh3:jne,xi2:II,xi3:Fne,xl2:zne,xl3:Une,xl4:Hne,nm:oo,z1:xe,z2:Oe,z3:Ve,z11:Re,z12:At,z13:xt,z21:Nt,z22:On,z23:Nn,z31:Sn,z32:un,z33:Ht,zmol:Fd,zmos:Ag}}function xft(e){var t=e.cosim,n=e.argpo,i=e.s1,o=e.s2,r=e.s3,s=e.s4,a=e.s5,c=e.sinim,u=e.ss1,d=e.ss2,h=e.ss3,m=e.ss4,g=e.ss5,p=e.sz1,y=e.sz3,b=e.sz11,C=e.sz13,E=e.sz21,w=e.sz23,S=e.sz31,P=e.sz33,L=e.t,z=e.tc,R=e.gsto,F=e.mo,U=e.mdot,D=e.no,I=e.nodeo,_=e.nodedot,v=e.xpidot,O=e.z1,N=e.z3,V=e.z11,k=e.z13,G=e.z21,W=e.z23,K=e.z31,q=e.z33,te=e.ecco,Y=e.eccsq,X=e.emsq,$=e.em,se=e.argpm,ue=e.inclm,re=e.mm,he=e.nm,ce=e.nodem,Q=e.irez,ne=e.atime,de=e.d2201,_e=e.d2211,Se=e.d3210,ve=e.d3222,Le=e.d4410,Ee=e.d4422,Be=e.d5220,Pe=e.d5232,Ae=e.d5421,xe=e.d5433,Oe=e.dedt,Ve=e.didt,Re=e.dmdt,At=e.dnodt,xt=e.domdt,Nt=e.del1,On=e.del2,Nn=e.del3,Sn=e.xfact,un=e.xlamo,Ht=e.xli,vn=e.xni,Pn,qt,tn,jn,hi,sn,zi,oo,Wi,li,mn,Kn,Hn,dn,bt,Ge,Mn,Tn,Qi,Fn,ji,Lo,po,Ur,Zi,qi,Hr,ba,Ct,we,$e,ot,Jn=17891679e-13,Zr=21460748e-13,xr=22123015e-14,_r=17891679e-13,uh=73636953e-16,Bo=21765803e-16,Fd=.0043752690880113,Ag=37393792e-14,iE=11428639e-14,cm=.00015835218,lm=119459e-10;Q=0,he<.0052359877&&he>.0034906585&&(Q=1),he>=.00826&&he<=.00924&&$>=.5&&(Q=2);var TI=u*lm*g,EI=d*lm*(b+C),xI=-lm*h*(p+y-14-6*X),wI=m*lm*(S+P-6),bg=-lm*d*(E+w);(ue<.052359877||ue>Uf-.052359877)&&(bg=0),c!==0&&(bg/=c);var SI=wI-t*bg;Oe=TI+i*cm*a,Ve=EI+o*cm*(V+k),Re=xI-cm*r*(O+N-14-6*X);var vI=s*cm*(K+q-6),Q0=-cm*o*(G+W);(ue<.052359877||ue>Uf-.052359877)&&(Q0=0),xt=SI+vI,At=bg,c!==0&&(xt-=t/c*Q0,At+=Q0/c);var oE=0,Z0=(R+z*Fd)%lr;if($+=Oe*L,ue+=Ve*L,se+=xt*L,ce+=At*L,re+=Re*L,Q!==0){if(we=Math.pow(he/df,oT),Q===2){$e=t*t;var DI=$;$=te;var II=X;X=Y,ot=$*X,dn=-.306-($-.64)*.44,$<=.65?(bt=3.616-13.247*$+16.29*X,Mn=-19.302+117.39*$-228.419*X+156.591*ot,Tn=-18.9068+109.7927*$-214.6334*X+146.5816*ot,Qi=-41.122+242.694*$-471.094*X+313.953*ot,Fn=-146.407+841.88*$-1629.014*X+1083.435*ot,ji=-532.114+3017.977*$-5740.032*X+3708.276*ot):(bt=-72.099+331.819*$-508.738*X+266.724*ot,Mn=-346.844+1582.851*$-2415.925*X+1246.113*ot,Tn=-342.585+1554.908*$-2366.899*X+1215.972*ot,Qi=-1052.797+4758.686*$-7193.992*X+3651.957*ot,Fn=-3581.69+16178.11*$-24462.77*X+12422.52*ot,$>.715?ji=-5149.66+29936.92*$-54087.36*X+31324.56*ot:ji=1464.74-4664.75*$+3763.64*X),$<.7?(Ur=-919.2277+4988.61*$-9064.77*X+5542.21*ot,Lo=-822.71072+4568.6173*$-8491.4146*X+5337.524*ot,po=-853.666+4690.25*$-8624.77*X+5341.4*ot):(Ur=-37995.78+161616.52*$-229838.2*X+109377.94*ot,Lo=-51752.104+218913.95*$-309468.16*X+146349.42*ot,po=-40023.88+170470.89*$-242699.48*X+115605.82*ot),Zi=c*c,Pn=.75*(1+2*t+$e),qt=1.5*Zi,jn=1.875*c*(1-2*t-3*$e),hi=-1.875*c*(1+2*t-3*$e),zi=35*Zi*Pn,oo=39.375*Zi*Zi,Wi=9.84375*c*(Zi*(1-2*t-5*$e)+.33333333*(-2+4*t+6*$e)),li=c*(4.92187512*Zi*(-2-4*t+10*$e)+6.56250012*(1+2*t-3*$e)),mn=29.53125*c*(2-8*t+$e*(-12+8*t+10*$e)),Kn=29.53125*c*(-2-8*t+$e*(12+8*t-10*$e)),ba=he*he,Ct=we*we,Hr=3*ba*Ct,qi=Hr*_r,de=qi*Pn*dn,_e=qi*qt*bt,Hr*=we,qi=Hr*Ag,Se=qi*jn*Mn,ve=qi*hi*Tn,Hr*=we,qi=2*Hr*uh,Le=qi*zi*Qi,Ee=qi*oo*Fn,Hr*=we,qi=Hr*iE,Be=qi*Wi*ji,Pe=qi*li*po,qi=2*Hr*Bo,Ae=qi*mn*Lo,xe=qi*Kn*Ur,un=(F+I+I-(Z0+Z0))%lr,Sn=U+Re+2*(_+At-Fd)-D,$=DI,X=II}Q===1&&(Hn=1+X*(-2.5+.8125*X),Mn=1+2*X,Ge=1+X*(-6+6.60937*X),Pn=.75*(1+t)*(1+t),tn=.9375*c*c*(1+3*t)-.75*(1+t),sn=1+t,sn*=1.875*sn*sn,Nt=3*he*he*we*we,On=2*Nt*Pn*Hn*Jn,Nn=3*Nt*sn*Ge*xr*we,Nt=Nt*tn*Mn*Zr*we,un=(F+I+n-Z0)%lr,Sn=U+v+Re+xt+At-(D+Fd)),Ht=un,vn=D,ne=0,he=D+oE}return{em:$,argpm:se,inclm:ue,mm:re,nm:he,nodem:ce,irez:Q,atime:ne,d2201:de,d2211:_e,d3210:Se,d3222:ve,d4410:Le,d4422:Ee,d5220:Be,d5232:Pe,d5421:Ae,d5433:xe,dedt:Oe,didt:Ve,dmdt:Re,dndt:oE,dnodt:At,domdt:xt,del1:Nt,del2:On,del3:Nn,xfact:Sn,xlamo:un,xli:Ht,xni:vn}}function E6(e){var t=(e-2451545)/36525,n=-62e-7*t*t*t+.093104*t*t+(876600*3600+8640184812866e-6)*t+67310.54841;return n=n*xb/240%lr,n<0&&(n+=lr),n}function wft(){return(arguments.length<=0?void 0:arguments[0])instanceof Date||arguments.length>1?E6(GF.apply(void 0,arguments)):E6.apply(void 0,arguments)}function Sft(e){var t=e.ecco,n=e.epoch,i=e.inclo,o=e.opsmode,r=e.no,s=t*t,a=1-s,c=Math.sqrt(a),u=Math.cos(i),d=u*u,h=Math.pow(df/r,oT),m=.75*r_*(3*d-1)/(c*a),g=m/(h*h),p=h*(1-g*g-g*(1/3+134*g*g/81));g=m/(p*p),r/=1+g;var y=Math.pow(df/r,oT),b=Math.sin(i),C=y*a,E=1-5*d,w=-E-d-d,S=1/y,P=C*C,L=y*(1-t),z="n",R;if(o==="a"){var F=n-7305,U=Math.floor(F+1e-8),D=F-U,I=.017202791694070362,_=1.7321343856509375,v=5075514194322695e-30,O=I+lr;R=(_+I*U+O*D+F*F*v)%lr,R<0&&(R+=lr)}else R=wft(n+24332815e-1);return{no:r,method:z,ainv:S,ao:y,con41:w,con42:E,cosio:u,cosio2:d,eccsq:s,omeosq:a,posq:P,rp:L,rteosq:c,sinio:b,gsto:R}}function vft(e){var t=e.irez,n=e.d2201,i=e.d2211,o=e.d3210,r=e.d3222,s=e.d4410,a=e.d4422,c=e.d5220,u=e.d5232,d=e.d5421,h=e.d5433,m=e.dedt,g=e.del1,p=e.del2,y=e.del3,b=e.didt,C=e.dmdt,E=e.dnodt,w=e.domdt,S=e.argpo,P=e.argpdot,L=e.t,z=e.tc,R=e.gsto,F=e.xfact,U=e.xlamo,D=e.no,I=e.atime,_=e.em,v=e.argpm,O=e.inclm,N=e.xli,V=e.mm,k=e.xni,G=e.nodem,W=e.nm,K=.13130908,q=2.8843198,te=.37448087,Y=5.7686396,X=.95240898,$=1.8014998,se=1.050833,ue=4.4108898,re=.0043752690880113,he=720,ce=-720,Q=259200,ne,de,_e,Se,ve,Le,Ee,Be,Pe=0,Ae=0,xe=(R+z*re)%lr;if(_+=m*L,O+=b*L,v+=w*L,G+=E*L,V+=C*L,t!==0){(I===0||L*I<=0||Math.abs(L)<Math.abs(I))&&(I=0,k=D,N=U),L>0?ne=he:ne=ce;for(var Oe=381;Oe===381;)t!==2?(Ee=g*Math.sin(N-K)+p*Math.sin(2*(N-q))+y*Math.sin(3*(N-te)),ve=k+F,Le=g*Math.cos(N-K)+2*p*Math.cos(2*(N-q))+3*y*Math.cos(3*(N-te)),Le*=ve):(Be=S+P*I,_e=Be+Be,de=N+N,Ee=n*Math.sin(_e+N-Y)+i*Math.sin(N-Y)+o*Math.sin(Be+N-X)+r*Math.sin(-Be+N-X)+s*Math.sin(_e+de-$)+a*Math.sin(de-$)+c*Math.sin(Be+N-se)+u*Math.sin(-Be+N-se)+d*Math.sin(Be+de-ue)+h*Math.sin(-Be+de-ue),ve=k+F,Le=n*Math.cos(_e+N-Y)+i*Math.cos(N-Y)+o*Math.cos(Be+N-X)+r*Math.cos(-Be+N-X)+c*Math.cos(Be+N-se)+u*Math.cos(-Be+N-se)+2*s*Math.cos(_e+de-$)+a*Math.cos(de-$)+d*Math.cos(Be+de-ue)+h*Math.cos(-Be+de-ue),Le*=ve),Math.abs(L-I)>=he?Oe=381:(Ae=L-I,Oe=0),Oe===381&&(N+=ve*ne+Ee*Q,k+=Ee*ne+Le*Q,I+=ne);W=k+Ee*Ae+Le*Ae*Ae*.5,Se=N+ve*Ae+Ee*Ae*Ae*.5,t!==1?(V=Se-2*G+2*xe,Pe=W-D):(V=Se-G-v+xe,Pe=W-D),W=D+Pe}return{atime:I,em:_,argpm:v,inclm:O,xli:N,mm:V,xni:k,nodem:G,dndt:Pe,nm:W}}function Mne(e,t){var n,i,o,r,s,a,c,u,d,h,m,g,p,y,b,C,E,w,S,P,L,z,R,F,U,D,I,_=15e-13;e.t=t,e.error=0;var v=e.mo+e.mdot*e.t,O=e.argpo+e.argpdot*e.t,N=e.nodeo+e.nodedot*e.t;d=O,L=v;var V=e.t*e.t;if(R=N+e.nodecf*V,E=1-e.cc1*e.t,w=e.bstar*e.cc4*e.t,S=e.t2cof*V,e.isimp!==1){c=e.omgcof*e.t;var k=1+e.eta*Math.cos(v);a=e.xmcof*(k*k*k-e.delmo),C=c+a,L=v+C,d=O-C,g=V*e.t,p=g*e.t,E=E-e.d2*V-e.d3*g-e.d4*p,w+=e.bstar*e.cc5*(Math.sin(L)-e.sinmao),S=S+e.t3cof*g+p*(e.t4cof+e.t*e.t5cof)}z=e.no;var G=e.ecco;if(P=e.inclo,e.method==="d"){y=e.t;var W={irez:e.irez,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,del1:e.del1,del2:e.del2,del3:e.del3,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,argpo:e.argpo,argpdot:e.argpdot,t:e.t,tc:y,gsto:e.gsto,xfact:e.xfact,xlamo:e.xlamo,no:e.no,atime:e.atime,em:G,argpm:d,inclm:P,xli:e.xli,mm:L,xni:e.xni,nodem:R,nm:z},K=vft(W);G=K.em,d=K.argpm,P=K.inclm,L=K.mm,R=K.nodem,z=K.nm}if(z<=0)return e.error=2,[!1,!1];var q=Math.pow(df/z,oT)*E*E;if(z=df/Math.pow(q,1.5),G-=w,G>=1||G<-.001)return e.error=1,[!1,!1];G<1e-6&&(G=1e-6),L+=e.no*S,U=L+d+R,R%=lr,d%=lr,U%=lr,L=(U-d-R)%lr;var te=Math.sin(P),Y=Math.cos(P),X=G;if(F=P,h=d,I=R,D=L,r=te,o=Y,e.method==="d"){var $={inclo:e.inclo,init:"n",ep:X,inclp:F,nodep:I,argpp:h,mp:D,opsmode:e.operationmode},se=Nne(e,$);if(X=se.ep,I=se.nodep,h=se.argpp,D=se.mp,F=se.inclp,F<0&&(F=-F,I+=Uf,h-=Uf),X<0||X>1)return e.error=3,[!1,!1]}e.method==="d"&&(r=Math.sin(F),o=Math.cos(F),e.aycof=-.5*s_*r,Math.abs(o+1)>15e-13?e.xlcof=-.25*s_*r*(3+5*o)/(1+o):e.xlcof=-.25*s_*r*(3+5*o)/_);var ue=X*Math.cos(h);C=1/(q*(1-X*X));var re=X*Math.sin(h)+C*e.aycof,he=D+h+I+C*e.xlcof*ue,ce=(he-I)%lr;u=ce,b=9999.9;for(var Q=1;Math.abs(b)>=1e-12&&Q<=10;)i=Math.sin(u),n=Math.cos(u),b=1-n*ue-i*re,b=(ce-re*n+ue*i-u)/b,Math.abs(b)>=.95&&(b>0?b=.95:b=-.95),u+=b,Q+=1;var ne=ue*n+re*i,de=ue*i-re*n,_e=ue*ue+re*re,Se=q*(1-_e);if(Se<0)return e.error=4,[!1,!1];var ve=q*(1-ne),Le=Math.sqrt(q)*de/ve,Ee=Math.sqrt(Se)/ve,Be=Math.sqrt(1-_e);C=de/(1+Be);var Pe=q/ve*(i-re-ue*C),Ae=q/ve*(n-ue+re*C);m=Math.atan2(Pe,Ae);var xe=(Ae+Ae)*Pe,Oe=1-2*Pe*Pe;C=1/Se;var Ve=.5*r_*C,Re=Ve*C;e.method==="d"&&(s=o*o,e.con41=3*s-1,e.x1mth2=1-s,e.x7thm1=7*s-1);var At=ve*(1-1.5*Re*Be*e.con41)+.5*Ve*e.x1mth2*Oe;if(At<1)return e.error=6,{position:!1,velocity:!1};m-=.25*Re*e.x7thm1*xe;var xt=I+1.5*Re*o*xe,Nt=F+1.5*Re*o*r*Oe,On=Le-z*Ve*e.x1mth2*xe/df,Nn=Ee+z*Ve*(e.x1mth2*Oe+1.5*e.con41)/df,Sn=Math.sin(m),un=Math.cos(m),Ht=Math.sin(xt),vn=Math.cos(xt),Pn=Math.sin(Nt),qt=Math.cos(Nt),tn=-Ht*qt,jn=vn*qt,hi=tn*Sn+vn*un,sn=jn*Sn+Ht*un,zi=Pn*Sn,oo=tn*un-vn*Sn,Wi=jn*un-Ht*Sn,li=Pn*un,mn={x:At*hi*sc,y:At*sn*sc,z:At*zi*sc},Kn={x:(On*hi+Nn*oo)*wL,y:(On*sn+Nn*Wi)*wL,z:(On*zi+Nn*li)*wL};return{position:mn,velocity:Kn}}function Dft(e,t){var n=t.opsmode,i=t.satn,o=t.epoch,r=t.xbstar,s=t.xecco,a=t.xargpo,c=t.xinclo,u=t.xmo,d=t.xno,h=t.xnodeo,m,g,p,y,b,C,E,w,S,P,L,z,R,F,U,D,I,_,v,O,N,V,k,G,W,K,q,te,Y,X,$,se,ue,re,he,ce,Q,ne,de,_e,Se,ve,Le,Ee,Be,Pe,Ae,xe,Oe,Ve,Re,At,xt,Nt,On,Nn,Sn=15e-13;e.isimp=0,e.method="n",e.aycof=0,e.con41=0,e.cc1=0,e.cc4=0,e.cc5=0,e.d2=0,e.d3=0,e.d4=0,e.delmo=0,e.eta=0,e.argpdot=0,e.omgcof=0,e.sinmao=0,e.t=0,e.t2cof=0,e.t3cof=0,e.t4cof=0,e.t5cof=0,e.x1mth2=0,e.x7thm1=0,e.mdot=0,e.nodedot=0,e.xlcof=0,e.xmcof=0,e.nodecf=0,e.irez=0,e.d2201=0,e.d2211=0,e.d3210=0,e.d3222=0,e.d4410=0,e.d4422=0,e.d5220=0,e.d5232=0,e.d5421=0,e.d5433=0,e.dedt=0,e.del1=0,e.del2=0,e.del3=0,e.didt=0,e.dmdt=0,e.dnodt=0,e.domdt=0,e.e3=0,e.ee2=0,e.peo=0,e.pgho=0,e.pho=0,e.pinco=0,e.plo=0,e.se2=0,e.se3=0,e.sgh2=0,e.sgh3=0,e.sgh4=0,e.sh2=0,e.sh3=0,e.si2=0,e.si3=0,e.sl2=0,e.sl3=0,e.sl4=0,e.gsto=0,e.xfact=0,e.xgh2=0,e.xgh3=0,e.xgh4=0,e.xh2=0,e.xh3=0,e.xi2=0,e.xi3=0,e.xl2=0,e.xl3=0,e.xl4=0,e.xlamo=0,e.zmol=0,e.zmos=0,e.atime=0,e.xli=0,e.xni=0,e.bstar=r,e.ecco=s,e.argpo=a,e.inclo=c,e.mo=u,e.no=d,e.nodeo=h,e.operationmode=n;var un=78/sc+1,Ht=(120-78)/sc,vn=Ht*Ht*Ht*Ht;e.init="y",e.t=0;var Pn={satn:i,ecco:e.ecco,epoch:o,inclo:e.inclo,no:e.no,method:e.method,opsmode:e.operationmode},qt=Sft(Pn),tn=qt.ao,jn=qt.con42,hi=qt.cosio,sn=qt.cosio2,zi=qt.eccsq,oo=qt.omeosq,Wi=qt.posq,li=qt.rp,mn=qt.rteosq,Kn=qt.sinio;if(e.no=qt.no,e.con41=qt.con41,e.gsto=qt.gsto,e.error=0,oo>=0||e.no>=0){if(e.isimp=0,li<220/sc+1&&(e.isimp=1),q=un,N=vn,_=(li-1)*sc,_<156){q=_-78,_<98&&(q=20);var Hn=(120-q)/sc;N=Hn*Hn*Hn*Hn,q=q/sc+1}v=1/Wi,Pe=1/(tn-q),e.eta=tn*e.ecco*Pe,z=e.eta*e.eta,L=e.ecco*e.eta,O=Math.abs(1-z),C=N*Math.pow(Pe,4),E=C/Math.pow(O,3.5),y=E*e.no*(tn*(1+1.5*z+L*(4+z))+.375*r_*Pe/O*e.con41*(8+3*z*(8+z))),e.cc1=e.bstar*y,b=0,e.ecco>1e-4&&(b=-2*C*Pe*s_*e.no*Kn/e.ecco),e.x1mth2=1-sn,e.cc4=2*e.no*E*tn*oo*(e.eta*(2+.5*z)+e.ecco*(.5+2*z)-r_*Pe/(tn*O)*(-3*e.con41*(1-2*L+z*(1.5-.5*L))+.75*e.x1mth2*(2*z-L*(1+z))*Math.cos(2*e.argpo))),e.cc5=2*E*tn*oo*(1+2.75*(z+L)+L*z),w=sn*sn,Le=1.5*r_*v*e.no,Ee=.5*Le*r_*v,Be=-.46875*Cft*v*v*e.no,e.mdot=e.no+.5*Le*mn*e.con41+.0625*Ee*mn*(13-78*sn+137*w),e.argpdot=-.5*Le*jn+.0625*Ee*(7-114*sn+395*w)+Be*(3-36*sn+49*w),xe=-Le*hi,e.nodedot=xe+(.5*Ee*(4-19*sn)+2*Be*(3-7*sn))*hi,Ae=e.argpdot+e.nodedot,e.omgcof=e.bstar*b*Math.cos(e.argpo),e.xmcof=0,e.ecco>1e-4&&(e.xmcof=-oT*C*e.bstar/L),e.nodecf=3.5*oo*xe*e.cc1,e.t2cof=1.5*e.cc1,Math.abs(hi+1)>15e-13?e.xlcof=-.25*s_*Kn*(3+5*hi)/(1+hi):e.xlcof=-.25*s_*Kn*(3+5*hi)/Sn,e.aycof=-.5*s_*Kn;var dn=1+e.eta*Math.cos(e.mo);if(e.delmo=dn*dn*dn,e.sinmao=Math.sin(e.mo),e.x7thm1=7*sn-1,2*Uf/e.no>=225){e.method="d",e.isimp=1,Se=0,U=e.inclo;var bt={epoch:o,ep:e.ecco,argpp:e.argpo,tc:Se,inclp:e.inclo,nodep:e.nodeo,np:e.no,e3:e.e3,ee2:e.ee2,peo:e.peo,pgho:e.pgho,pho:e.pho,pinco:e.pinco,plo:e.plo,se2:e.se2,se3:e.se3,sgh2:e.sgh2,sgh3:e.sgh3,sgh4:e.sgh4,sh2:e.sh2,sh3:e.sh3,si2:e.si2,si3:e.si3,sl2:e.sl2,sl3:e.sl3,sl4:e.sl4,xgh2:e.xgh2,xgh3:e.xgh3,xgh4:e.xgh4,xh2:e.xh2,xh3:e.xh3,xi2:e.xi2,xi3:e.xi3,xl2:e.xl2,xl3:e.xl3,xl4:e.xl4,zmol:e.zmol,zmos:e.zmos},Ge=Eft(bt);e.e3=Ge.e3,e.ee2=Ge.ee2,e.peo=Ge.peo,e.pgho=Ge.pgho,e.pho=Ge.pho,e.pinco=Ge.pinco,e.plo=Ge.plo,e.se2=Ge.se2,e.se3=Ge.se3,e.sgh2=Ge.sgh2,e.sgh3=Ge.sgh3,e.sgh4=Ge.sgh4,e.sh2=Ge.sh2,e.sh3=Ge.sh3,e.si2=Ge.si2,e.si3=Ge.si3,e.sl2=Ge.sl2,e.sl3=Ge.sl3,e.sl4=Ge.sl4,g=Ge.sinim,m=Ge.cosim,S=Ge.em,P=Ge.emsq,V=Ge.s1,k=Ge.s2,G=Ge.s3,W=Ge.s4,K=Ge.s5,te=Ge.ss1,Y=Ge.ss2,X=Ge.ss3,$=Ge.ss4,se=Ge.ss5,ue=Ge.sz1,re=Ge.sz3,he=Ge.sz11,ce=Ge.sz13,Q=Ge.sz21,ne=Ge.sz23,de=Ge.sz31,_e=Ge.sz33,e.xgh2=Ge.xgh2,e.xgh3=Ge.xgh3,e.xgh4=Ge.xgh4,e.xh2=Ge.xh2,e.xh3=Ge.xh3,e.xi2=Ge.xi2,e.xi3=Ge.xi3,e.xl2=Ge.xl2,e.xl3=Ge.xl3,e.xl4=Ge.xl4,e.zmol=Ge.zmol,e.zmos=Ge.zmos,I=Ge.nm,Oe=Ge.z1,Ve=Ge.z3,Re=Ge.z11,At=Ge.z13,xt=Ge.z21,Nt=Ge.z23,On=Ge.z31,Nn=Ge.z33;var Mn={inclo:U,init:e.init,ep:e.ecco,inclp:e.inclo,nodep:e.nodeo,argpp:e.argpo,mp:e.mo,opsmode:e.operationmode},Tn=Nne(e,Mn);e.ecco=Tn.ep,e.inclo=Tn.inclp,e.nodeo=Tn.nodep,e.argpo=Tn.argpp,e.mo=Tn.mp,R=0,F=0,D=0;var Qi={cosim:m,emsq:P,argpo:e.argpo,s1:V,s2:k,s3:G,s4:W,s5:K,sinim:g,ss1:te,ss2:Y,ss3:X,ss4:$,ss5:se,sz1:ue,sz3:re,sz11:he,sz13:ce,sz21:Q,sz23:ne,sz31:de,sz33:_e,t:e.t,tc:Se,gsto:e.gsto,mo:e.mo,mdot:e.mdot,no:e.no,nodeo:e.nodeo,nodedot:e.nodedot,xpidot:Ae,z1:Oe,z3:Ve,z11:Re,z13:At,z21:xt,z23:Nt,z31:On,z33:Nn,ecco:e.ecco,eccsq:zi,em:S,argpm:R,inclm:U,mm:D,nm:I,nodem:F,irez:e.irez,atime:e.atime,d2201:e.d2201,d2211:e.d2211,d3210:e.d3210,d3222:e.d3222,d4410:e.d4410,d4422:e.d4422,d5220:e.d5220,d5232:e.d5232,d5421:e.d5421,d5433:e.d5433,dedt:e.dedt,didt:e.didt,dmdt:e.dmdt,dnodt:e.dnodt,domdt:e.domdt,del1:e.del1,del2:e.del2,del3:e.del3,xfact:e.xfact,xlamo:e.xlamo,xli:e.xli,xni:e.xni},Fn=xft(Qi);e.irez=Fn.irez,e.atime=Fn.atime,e.d2201=Fn.d2201,e.d2211=Fn.d2211,e.d3210=Fn.d3210,e.d3222=Fn.d3222,e.d4410=Fn.d4410,e.d4422=Fn.d4422,e.d5220=Fn.d5220,e.d5232=Fn.d5232,e.d5421=Fn.d5421,e.d5433=Fn.d5433,e.dedt=Fn.dedt,e.didt=Fn.didt,e.dmdt=Fn.dmdt,e.dnodt=Fn.dnodt,e.domdt=Fn.domdt,e.del1=Fn.del1,e.del2=Fn.del2,e.del3=Fn.del3,e.xfact=Fn.xfact,e.xlamo=Fn.xlamo,e.xli=Fn.xli,e.xni=Fn.xni}e.isimp!==1&&(p=e.cc1*e.cc1,e.d2=4*tn*Pe*p,ve=e.d2*Pe*e.cc1/3,e.d3=(17*tn+q)*ve,e.d4=.5*ve*tn*Pe*(221*tn+31*q)*e.cc1,e.t3cof=e.d2+2*p,e.t4cof=.25*(3*e.d3+e.cc1*(12*e.d2+10*p)),e.t5cof=.2*(3*e.d4+12*e.cc1*e.d3+6*e.d2*e.d2+15*p*(2*e.d2+p)))}Mne(e,0),e.init="n"}function Ift(e,t){var n="i",i=1440/(2*Uf),o=0,r={};r.error=0,r.satnum=e.substring(2,7),r.epochyr=parseInt(e.substring(18,20),10),r.epochdays=parseFloat(e.substring(20,32)),r.ndot=parseFloat(e.substring(33,43)),r.nddot=parseFloat(".".concat(parseInt(e.substring(44,50),10),"E").concat(e.substring(50,52))),r.bstar=parseFloat("".concat(e.substring(53,54),".").concat(parseInt(e.substring(54,59),10),"E").concat(e.substring(59,61))),r.inclo=parseFloat(t.substring(8,16)),r.nodeo=parseFloat(t.substring(17,25)),r.ecco=parseFloat(".".concat(t.substring(26,33))),r.argpo=parseFloat(t.substring(34,42)),r.mo=parseFloat(t.substring(43,51)),r.no=parseFloat(t.substring(52,63)),r.no/=i,r.a=Math.pow(r.no*Aft,-2/3),r.ndot/=i*1440,r.nddot/=i*1440*1440,r.inclo*=xb,r.nodeo*=xb,r.argpo*=xb,r.mo*=xb,r.alta=r.a*(1+r.ecco)-1,r.altp=r.a*(1-r.ecco)-1,r.epochyr<57?o=r.epochyr+2e3:o=r.epochyr+1900;var s=Tft(o,r.epochdays),a=s.mon,c=s.day,u=s.hr,d=s.minute,h=s.sec;return r.jdsatepoch=GF(o,a,c,u,d,h),Dft(r,{opsmode:n,satn:r.satnum,epoch:r.jdsatepoch-24332815e-1,xbstar:r.bstar,xecco:r.ecco,xargpo:r.argpo,xinclo:r.inclo,xmo:r.mo,xno:r.no,xnodeo:r.nodeo}),r}function Pft(e){return Oft(e)||Lft(e)||Bft(e)||Rft()}function Oft(e){if(Array.isArray(e))return sN(e)}function Lft(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Bft(e,t){if(e){if(typeof e=="string")return sN(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sN(e,t)}}function sN(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function Rft(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nft(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var i=t[0],o=Array.prototype.slice.call(t,1),r=GF.apply(void 0,Pft(o)),s=(r-i.jdsatepoch)*gft;return Mne(i,s)}class x6{constructor(t="",n={}){const[i,o,r]=this._checkTle(t);let s=r.slice(52,64);this.name=i.trim(),this.tleLine1=o.trim(),this.tleLine2=r.trim(),this.satrec=Ift(this.tleLine1,this.tleLine2),this.totalSeconds=86400,this.stepSeconds=100,this.leadTime=parseInt(24*3600/s),this.trailTime=0}_checkTle(t){let n=t.split(`
|
||
`);if(n.length!==3)throw new Error("tle data error");return n}getPositionEci(t){return Nft(this.satrec,t).position}_getPositionProperty(){const t=ie.fromIso8601(new Date().toISOString()),n=new Ic(fa.INERTIAL);let i=Date.now();for(let o=0;o<this.totalSeconds/this.stepSeconds;o++){let r=new Date(i+o*this.stepSeconds*1e3),s=this.getPositionEci(r);if(!s)continue;const a=ie.addSeconds(t,o*this.stepSeconds,new ie),c={x:s.x*1e3,y:s.y*1e3,z:s.z*1e3};n.addSample(a,c)}return n}createSatelliteEntity(){const t=ie.fromIso8601(new Date().toISOString()),n=ie.addSeconds(t,this.totalSeconds,new ie);return{name:this.name,description:this.name,availability:new Oo([new rn({start:t,stop:n})]),position:this._getPositionProperty(),point:{pixelSize:8,color:H.fromRandom({alpha:1})},path:new g0({width:1,show:!1,leadTime:this.leadTime,trailTime:this.trailTime,material:H.LIME}),label:{text:this.name,font:"12px sans-serif",showBackground:!0,backgroundColor:new H(.165,.165,.165,.5),backgroundPadding:new j(4,4),outlineWidth:1,verticalOrigin:Hi.TOP,horizontalOrigin:Hi.LEFT,pixelOffset:new j(0,5),fillColor:H.WHITE,distanceDisplayCondition:new jt(10,5e6)}}}}let Mft=[{label:"卫星集合",value:null,group:null,type:"title"},{label:"Last 30 Days' Launches",value:1,group:"last-30-days"},{label:"Space Stations",value:2,group:"stations"},{label:"100 (or so) Brightest",value:3,group:"visual"},{label:"Active Satellites",value:4,group:"active"},{label:"Analyst Satellites ",value:5,group:"analyst"}],Fft=[{label:"气象和地球资源卫星",value:null,group:null,type:"title"},{label:"Weather",value:6,group:"weather"},{label:"NOAA",value:7,group:"noaa"},{label:"GOES",value:8,group:"goes"},{label:"Earth Resources",value:9,group:"resource"},{label:"Search & Rescue (SARSAT) ",value:10,group:"sarsat"},{label:"Disaster Monitoring",value:11,group:"dmc"},{label:"TDRSS",value:12,group:"tdrss"},{label:"ARGOS Data Collection System",value:13,group:"argos"},{label:"Planet",value:14,group:"planet"},{label:"Spire",value:15,group:"spire"}],zft=[{label:"通讯卫星",value:null,group:null,type:"title"},{label:"Active Geosynchronous",value:16,group:"geo"},{label:"GEO Protected Zone",value:17,group:"gpz"},{label:"GEO Protected Zone Plus",value:18,group:"gpz-plus"},{label:"Intelsat",value:19,group:"intelsat"},{label:"SES",value:20,group:"ses"},{label:"Iridium",value:21,group:"iridium"},{label:"Iridium NEXT",value:22,group:"iridium-NEXT"},{label:"Starlink",value:23,group:"starlink"},{label:"OneWeb",value:24,group:"oneweb"},{label:"Orbcomm",value:25,group:"orbcomm"},{label:"Globalstar",value:26,group:"globalstar"},{label:"Swarm",value:27,group:"swarm"},{label:"Amateur Radio",value:28,group:"amateur"},{label:"Experimental Comm",value:29,group:"x-comm"},{label:"Other Comm",value:30,group:"other-comm"},{label:"SatNOGS",value:31,group:"satnogs"},{label:"Gorizont",value:32,group:"gorizont"},{label:"Raduga",value:33,group:"raduga"},{label:"Molniya",value:34,group:"molniya"}],Uft=[{label:"导航卫星",value:null,group:null,type:"title"},{label:"GNSS",value:35,group:"gnss"},{label:"GPS Operational",value:36,group:"gps-ops"},{label:"GLONASS Operational",value:37,group:"glo-ops"},{label:"Galileo",value:38,group:"galileo"},{label:"Beidou",value:39,group:"beidou"},{label:"Satellite-Based Augmentation System",value:40,group:"sbas"},{label:"Navy Navigation Satellite System (NNSS)",value:41,group:"nnss"},{label:"Russian LEO Navigation",value:42,group:"musson"}],Hft=[{label:"科学卫星",value:null,group:null,type:"title"},{label:"Space & Earth Science",value:43,group:"science"},{label:"Geodetic",value:44,group:"geodetic"},{label:"Engineering",value:45,group:"engineering"},{label:"Education",value:46,group:"education"}],Vft=[{label:"其他卫星",value:null,group:null,type:"title"},{label:"Miscellaneous Military",value:47,group:"military"},{label:"Radar Calibration",value:48,group:"radar"},{label:"CubeSats",value:49,group:"cubesat"},{label:"Other Satellites",value:50,group:"other"}];const kft=Vt("div",{id:"cesiumContainer"},null,-1),Gft={class:"operate_container"},Wft=Vt("img",{src:n_e,width:"28",height:"28",alt:"卫星星座选择"},null,-1),jft=[Wft],qft=Vt("img",{src:i_e,width:"28",height:"28",alt:"自定义导入TLE数据"},null,-1),$ft=[qft],Yft=Vt("img",{src:o_e,width:"24",height:"24",alt:"清除TLE缓存"},null,-1),Xft=[Yft],Kft=Vt("img",{src:r_e,width:"24",height:"24",alt:"清除轨道"},null,-1),Jft=[Kft],Qft={__name:"SatelliteTrack",setup(e){let t=[...Mft,...Fft,...zft,...Uft,...Hft,...Vft];window.CESIUM_BASE_URL="/cesium";let n;const i=86400,o=new Map,r=new Map,s=bn(!1),a=bn(!1),c=bn([1]),u=[],d=bn(null);let h=bn(`BEIDOU-3 G2
|
||
1 45344U 20017A 23037.82027362 -.00000136 00000+0 00000+0 0 9994
|
||
2 45344 1.9879 4.6761 0000950 328.7503 178.5761 1.00272999 10962
|
||
BEIDOU-3 G3
|
||
1 45807U 20040A 23037.85365455 -.00000347 00000+0 00000+0 0 9999
|
||
2 45807 0.9369 314.6571 0008244 342.4957 257.2704 1.00264764 9772`);h_.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYjZmMWM4Ny01YzQ4LTQ3MzUtYTI5Mi1hNTgyNjdhMmFiMmMiLCJpZCI6NjIwMjgsImlhdCI6MTYyNjY3MTMxNX0.5SelYUyzXWRoMyjjFvmFIAoPtWlJPQMjsVl2e_jQe-c";function m(){Aa.prototype.makeLabel=function(v){let O=0-new Date().getTimezoneOffset(),N=ie.addMinutes(v,O,new ie);return ie.toIso8601(N).slice(0,19)},new $a({url:"https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",minimumLevel:3,maximumLevel:18}),new $a({url:"http://webst02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8",minimumLevel:3,maximumLevel:18}),n=new ri("cesiumContainer",{baseLayerPicker:!0,geocoder:!1,navigationHelpButton:!1,infoBox:!1});let _=0-new Date().getTimezoneOffset();n.animation.viewModel.timeFormatter=function(v,O){let N=ie.addMinutes(v,_,new ie);return ie.toIso8601(N).slice(11,19)},n.animation.viewModel.dateFormatter=function(v,O){let N=ie.addMinutes(v,_,new ie);return ie.toIso8601(N).slice(0,10)},ct.DEFAULT_VIEW_RECTANGLE=ge.fromDegrees(75,10,140,60)}function g(){const _=ie.fromIso8601(new Date().toISOString()),v=ie.addSeconds(_,i,new ie);n.clock.startTime=_.clone(),n.clock.stopTime=v.clone(),n.clock.currentTime=_.clone(),n.timeline.zoomTo(_,v),n.clock.multiplier=1,n.clock.shouldAnimate=!0,n.clock.clockRange=dp.LOOP_STOP}function p(_=""){if(_.length===0)return;let v=_.split(`\r
|
||
`),O=[],N=0,V=[];return v.forEach(k=>{N++,V.push(k),N===3&&(O.push(V.join(`\r
|
||
`)),V=[],N=0)}),O}function y(_=""){if(_.length===0)return;let v=_.split(`
|
||
`);console.log(v);let O=[],N=0,V=[];return v.forEach(k=>{N++,V.push(k),N===3&&(O.push(V.join(`\r
|
||
`)),V=[],N=0)}),O}function b(){let _=n.screenSpaceEventHandler.getInputAction(kn.LEFT_CLICK);n.screenSpaceEventHandler.setInputAction(function(O){_(O);const N=n.scene.pick(O.position);console.log(N),N&&(N.id.path.show=new $o(!0),N.id.label.distanceDisplayCondition=void 0,u.push(N))},kn.LEFT_CLICK)}function C(_){}function E(){t_e.confirm("清空TLE缓存后手动刷新页面将重新下载TLE数据,是否继续?","提示",{distinguishCancelAndClose:!0,confirmButtonText:"确定",cancelButtonText:"取消"}).then(()=>{w()}).catch(()=>{console.log("取消")})}function w(){localStorage.clear(),Lb.success("清除成功")}function S(){u.length&&u.forEach(_=>{_.id&&(_.id.path.show=!1)})}function P(_){try{if(!_.length)return!1;let v=_.split(`
|
||
`);return v.length%3!==0?!1:(v.forEach((O,N)=>{if(N%3===0&&!O)throw new Error(!1);if(N%3===1&&O.length<69)throw new Error(!1);if(N%3===2&&O.length<69)throw new Error(!1)}),!0)}catch(v){return console.log(v),!1}}function L(){if(!P(h.value)){Lb.error("wrong TLE data");return}F(),y(h.value).forEach(v=>{let O=new x6(v),N=O.createSatelliteEntity(),V=n.entities.add(N);r.set(O.name,V)}),n.zoomTo(n.entities)}async function z(_){if(d.value.clearFiles(),_.raw.type!=="text/plain"){Lb.warning("请上传TXT格式的TLE数据");return}let v=await _.raw.text();h.value=v}function R(){F(),h.value="",d.value.clearFiles()}function F(){r.forEach(_=>n.entities.remove(_)),r.clear()}async function U(_){let v=localStorage.getItem(_);return v?(console.log(`%c 命中缓存,key值为${_}`,"color:#0f0;"),v):(console.warn("未命中缓存,开始下载TLE数据"),await _ft(_))}async function D(_){if(o.has(_))o.get(_).forEach(O=>n.entities.add(O));else{let v=await U(_),O=p(v),N=new Set;O.forEach(V=>{let G=new x6(V).createSatelliteEntity(),W=n.entities.add(G);N.add(W)}),o.set(_,N)}}function I(_){o.has(_)&&o.get(_).forEach(O=>n.entities.remove(O))}return to(c,(_,v)=>{let O=_.concat(v).filter((V,k,G)=>G.indexOf(V)===G.lastIndexOf(V)),N=t.find(V=>V.value===O[0]);_.length>v.length?D(N.group):I(N.group)}),Oc(async()=>{m(),g(),b(),D("last-30-days")}),(_,v)=>{const O=Kpe,N=ppe,V=mpe,k=Bpe,G=OW,W=MW,K=Dme;return qe(),Dt(Jo,null,[kft,Vt("div",Gft,[Vt("div",{class:"menu_button",onClick:v[0]||(v[0]=q=>s.value=!s.value),title:"卫星星座选择"},jft),Vt("div",{class:"menu_button",onClick:v[1]||(v[1]=q=>a.value=!a.value),title:"自定义导入TLE数据"},$ft),Vt("div",{class:"menu_button",onClick:E,title:"清除TLE缓存"},Xft),Vt("div",{class:"menu_button",onClick:S,title:"清除轨道"},Jft)]),fn(k,{modelValue:s.value,"onUpdate:modelValue":v[3]||(v[3]=q=>s.value=q),title:"卫星星座选择",direction:"ltr"},{default:an(()=>[fn(V,{modelValue:c.value,"onUpdate:modelValue":v[2]||(v[2]=q=>c.value=q),onChange:C,max:5},{default:an(()=>[(qe(!0),Dt(Jo,null,h9(pe(t),(q,te)=>(qe(),Dt(Jo,{key:te},[q.type==="title"?(qe(),Dn(O,{key:0,class:"satellite_type"},{default:an(()=>[$l(Pr(q.label),1)]),_:2},1024)):Mt("",!0),q.type?Mt("",!0):(qe(),Dn(N,{key:1,label:q.value},{default:an(()=>[$l(Pr(q.label),1)]),_:2},1032,["label"]))],64))),128))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"]),fn(k,{modelValue:a.value,"onUpdate:modelValue":v[5]||(v[5]=q=>a.value=q),title:"自定义卫星数据",direction:"ltr"},{default:an(()=>[fn(G,{modelValue:pe(h),"onUpdate:modelValue":v[4]||(v[4]=q=>So(h)?h.value=q:h=q),type:"textarea",placeholder:"Please input tle data",rows:20},null,8,["modelValue"]),fn(O,{class:"add_satellite"},{default:an(()=>[fn(W,{type:"primary",onClick:L},{default:an(()=>[$l(" 添加 ")]),_:1}),fn(K,{class:"upload_button","on-change":z,"show-file-list":!1,accept:"txt",limit:1,"auto-upload":!1,ref_key:"upload",ref:d},{trigger:an(()=>[fn(W,{type:"default"},{default:an(()=>[$l("导入")]),_:1})]),_:1},512),fn(W,{type:"danger",onClick:R},{default:an(()=>[$l(" 清空 ")]),_:1})]),_:1})]),_:1},8,["modelValue"])],64)}}},Zft=Sse({history:Gre("/"),routes:[{path:"/",name:"home",component:Qft}]}),WF=Cre(Pse);WF.use(wre());WF.use(Zft);WF.mount("#app")});export default eht();
|