satellite-track/docs/assets/index-6f382a78.js
2024-09-29 15:53:01 +08:00

13911 lines
3.4 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var Ste=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Hct=Ste(($f,Xf)=>{(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 gR(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 Xy(e){if(jt(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=qi(i)?Pte(i):Xy(i);if(o)for(const r in o)t[r]=o[r]}return t}else{if(qi(e))return e;if(zi(e))return e}}const vte=/;(?![^(]*\))/g,Dte=/:([^]+)/,Ite=/\/\*.*?\*\//gs;function Pte(e){const t={};return e.replace(Ite,"").split(vte).forEach(n=>{if(n){const i=n.split(Dte);i.length>1&&(t[i[0].trim()]=i[1].trim())}}),t}function Mi(e){let t="";if(qi(e))t=e;else if(jt(e))for(let n=0;n<e.length;n++){const i=Mi(e[n]);i&&(t+=i+" ")}else if(zi(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const Ote="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Lte=gR(Ote);function E8(e){return!!e||e===""}function Bte(e,t){if(e.length!==t.length)return!1;let n=!0;for(let i=0;n&&i<e.length;i++)n=JS(e[i],t[i]);return n}function JS(e,t){if(e===t)return!0;let n=QF(e),i=QF(t);if(n||i)return n&&i?e.getTime()===t.getTime():!1;if(n=wC(e),i=wC(t),n||i)return e===t;if(n=jt(e),i=jt(t),n||i)return n&&i?Bte(e,t):!1;if(n=zi(e),i=zi(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||!JS(e[s],t[s]))return!1}}return String(e)===String(t)}function x8(e,t){return e.findIndex(n=>JS(n,t))}const qm=e=>qi(e)?e:e==null?"":jt(e)||zi(e)&&(e.toString===v8||!bn(e.toString))?JSON.stringify(e,w8,2):String(e),w8=(e,t)=>t&&t.__v_isRef?w8(e,t.value):ty(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[i,o])=>(n[`${i} =>`]=o,n),{})}:ZS(t)?{[`Set(${t.size})`]:[...t.values()]}:zi(t)&&!jt(t)&&!D8(t)?String(t):t,fo={},ey=[],ya=()=>{},Rte=()=>!1,Nte=/^on[^a-z]/,QS=e=>Nte.test(e),yR=e=>e.startsWith("onUpdate:"),As=Object.assign,AR=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Mte=Object.prototype.hasOwnProperty,ii=(e,t)=>Mte.call(e,t),jt=Array.isArray,ty=e=>ET(e)==="[object Map]",ZS=e=>ET(e)==="[object Set]",QF=e=>ET(e)==="[object Date]",bn=e=>typeof e=="function",qi=e=>typeof e=="string",wC=e=>typeof e=="symbol",zi=e=>e!==null&&typeof e=="object",S8=e=>zi(e)&&bn(e.then)&&bn(e.catch),v8=Object.prototype.toString,ET=e=>v8.call(e),Fte=e=>ET(e).slice(8,-1),D8=e=>ET(e)==="[object Object]",CR=e=>qi(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,kx=gR(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ev=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},zte=/-(\w)/g,Wl=ev(e=>e.replace(zte,(t,n)=>n?n.toUpperCase():"")),Ute=/\B([A-Z])/g,Ky=ev(e=>e.replace(Ute,"-$1").toLowerCase()),tv=ev(e=>e.charAt(0).toUpperCase()+e.slice(1)),jD=ev(e=>e?`on${tv(e)}`:""),SC=(e,t)=>!Object.is(e,t),Gx=(e,t)=>{for(let n=0;n<e.length;n++)e[n](t)},zw=(e,t,n)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},TR=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let ZF;const Hte=()=>ZF||(ZF=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});let ka;class I8{constructor(t=!1){this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=ka,!t&&ka&&(this.index=(ka.scopes||(ka.scopes=[])).push(this)-1)}run(t){if(this.active){const n=ka;try{return ka=this,t()}finally{ka=n}}}on(){ka=this}off(){ka=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 Vte(e){return new I8(e)}function kte(e,t=ka){t&&t.active&&t.effects.push(e)}function Gte(){return ka}function P8(e){ka&&ka.cleanups.push(e)}const bR=e=>{const t=new Set(e);return t.w=0,t.n=0,t},O8=e=>(e.w&ep)>0,L8=e=>(e.n&ep)>0,Wte=({deps:e})=>{if(e.length)for(let t=0;t<e.length;t++)e[t].w|=ep},jte=e=>{const{deps:t}=e;if(t.length){let n=0;for(let i=0;i<t.length;i++){const o=t[i];O8(o)&&!L8(o)?o.delete(e):t[n++]=o,o.w&=~ep,o.n&=~ep}t.length=n}},z1=new WeakMap;let IA=0,ep=1;const U1=30;let Il;const Rm=Symbol(""),H1=Symbol("");class ER{constructor(t,n=null,i){this.fn=t,this.scheduler=n,this.active=!0,this.deps=[],this.parent=void 0,kte(this,i)}run(){if(!this.active)return this.fn();let t=Il,n=zh;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=Il,Il=this,zh=!0,ep=1<<++IA,IA<=U1?Wte(this):e2(this),this.fn()}finally{IA<=U1&&jte(this),ep=1<<--IA,Il=this.parent,zh=n,this.parent=void 0,this.deferStop&&this.stop()}}stop(){Il===this?this.deferStop=!0:this.active&&(e2(this),this.onStop&&this.onStop(),this.active=!1)}}function e2(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}let zh=!0;const B8=[];function Jy(){B8.push(zh),zh=!1}function Qy(){const e=B8.pop();zh=e===void 0?!0:e}function sc(e,t,n){if(zh&&Il){let i=z1.get(e);i||z1.set(e,i=new Map);let o=i.get(n);o||i.set(n,o=bR()),R8(o)}}function R8(e,t){let n=!1;IA<=U1?L8(e)||(e.n|=ep,n=!O8(e)):n=!e.has(Il),n&&(e.add(Il),Il.deps.push(e))}function ld(e,t,n,i,o,r){const s=z1.get(e);if(!s)return;let a=[];if(t==="clear")a=[...s.values()];else if(n==="length"&&jt(e)){const c=TR(i);s.forEach((u,f)=>{(f==="length"||f>=c)&&a.push(u)})}else switch(n!==void 0&&a.push(s.get(n)),t){case"add":jt(e)?CR(n)&&a.push(s.get("length")):(a.push(s.get(Rm)),ty(e)&&a.push(s.get(H1)));break;case"delete":jt(e)||(a.push(s.get(Rm)),ty(e)&&a.push(s.get(H1)));break;case"set":ty(e)&&a.push(s.get(Rm));break}if(a.length===1)a[0]&&V1(a[0]);else{const c=[];for(const u of a)u&&c.push(...u);V1(bR(c))}}function V1(e,t){const n=jt(e)?e:[...e];for(const i of n)i.computed&&t2(i);for(const i of n)i.computed||t2(i)}function t2(e,t){(e!==Il||e.allowRecurse)&&(e.scheduler?e.scheduler():e.run())}const qte=gR("__proto__,__v_isRef,__isVue"),N8=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(wC)),Yte=xR(),$te=xR(!1,!0),Xte=xR(!0),n2=Kte();function Kte(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const i=mi(this);for(let r=0,s=this.length;r<s;r++)sc(i,"get",r+"");const o=i[t](...n);return o===-1||o===!1?i[t](...n.map(mi)):o}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...n){Jy();const i=mi(this)[t].apply(this,n);return Qy(),i}}),e}function xR(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?dne:H8:t?U8:z8).get(i))return i;const s=jt(i);if(!e&&s&&ii(n2,o))return Reflect.get(n2,o,r);const a=Reflect.get(i,o,r);return(wC(o)?N8.has(o):qte(o))||(e||sc(i,"get",o),t)?a:Vo(a)?s&&CR(o)?a:a.value:zi(a)?e?k8(a):xT(a):a}}const Jte=M8(),Qte=M8(!0);function M8(e=!1){return function(n,i,o,r){let s=n[i];if(xy(s)&&Vo(s)&&!Vo(o))return!1;if(!e&&(!Uw(o)&&!xy(o)&&(s=mi(s),o=mi(o)),!jt(n)&&Vo(s)&&!Vo(o)))return s.value=o,!0;const a=jt(n)&&CR(i)?Number(i)<n.length:ii(n,i),c=Reflect.set(n,i,o,r);return n===mi(r)&&(a?SC(o,s)&&ld(n,"set",i,o):ld(n,"add",i,o)),c}}function Zte(e,t){const n=ii(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&n&&ld(e,"delete",t,void 0),i}function ene(e,t){const n=Reflect.has(e,t);return(!wC(t)||!N8.has(t))&&sc(e,"has",t),n}function tne(e){return sc(e,"iterate",jt(e)?"length":Rm),Reflect.ownKeys(e)}const F8={get:Yte,set:Jte,deleteProperty:Zte,has:ene,ownKeys:tne},nne={get:Xte,set(e,t){return!0},deleteProperty(e,t){return!0}},ine=As({},F8,{get:$te,set:Qte}),wR=e=>e,nv=e=>Reflect.getPrototypeOf(e);function xb(e,t,n=!1,i=!1){e=e.__v_raw;const o=mi(e),r=mi(t);n||(t!==r&&sc(o,"get",t),sc(o,"get",r));const{has:s}=nv(o),a=i?wR:n?IR:vC;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 wb(e,t=!1){const n=this.__v_raw,i=mi(n),o=mi(e);return t||(e!==o&&sc(i,"has",e),sc(i,"has",o)),e===o?n.has(e):n.has(e)||n.has(o)}function Sb(e,t=!1){return e=e.__v_raw,!t&&sc(mi(e),"iterate",Rm),Reflect.get(e,"size",e)}function i2(e){e=mi(e);const t=mi(this);return nv(t).has.call(t,e)||(t.add(e),ld(t,"add",e,e)),this}function o2(e,t){t=mi(t);const n=mi(this),{has:i,get:o}=nv(n);let r=i.call(n,e);r||(e=mi(e),r=i.call(n,e));const s=o.call(n,e);return n.set(e,t),r?SC(t,s)&&ld(n,"set",e,t):ld(n,"add",e,t),this}function r2(e){const t=mi(this),{has:n,get:i}=nv(t);let o=n.call(t,e);o||(e=mi(e),o=n.call(t,e)),i&&i.call(t,e);const r=t.delete(e);return o&&ld(t,"delete",e,void 0),r}function s2(){const e=mi(this),t=e.size!==0,n=e.clear();return t&&ld(e,"clear",void 0,void 0),n}function vb(e,t){return function(i,o){const r=this,s=r.__v_raw,a=mi(s),c=t?wR:e?IR:vC;return!e&&sc(a,"iterate",Rm),s.forEach((u,f)=>i.call(o,c(u),c(f),r))}}function Db(e,t,n){return function(...i){const o=this.__v_raw,r=mi(o),s=ty(r),a=e==="entries"||e===Symbol.iterator&&s,c=e==="keys"&&s,u=o[e](...i),f=n?wR:t?IR:vC;return!t&&sc(r,"iterate",c?H1:Rm),{next(){const{value:h,done:_}=u.next();return _?{value:h,done:_}:{value:a?[f(h[0]),f(h[1])]:f(h),done:_}},[Symbol.iterator](){return this}}}}function qd(e){return function(...t){return e==="delete"?!1:this}}function one(){const e={get(r){return xb(this,r)},get size(){return Sb(this)},has:wb,add:i2,set:o2,delete:r2,clear:s2,forEach:vb(!1,!1)},t={get(r){return xb(this,r,!1,!0)},get size(){return Sb(this)},has:wb,add:i2,set:o2,delete:r2,clear:s2,forEach:vb(!1,!0)},n={get(r){return xb(this,r,!0)},get size(){return Sb(this,!0)},has(r){return wb.call(this,r,!0)},add:qd("add"),set:qd("set"),delete:qd("delete"),clear:qd("clear"),forEach:vb(!0,!1)},i={get(r){return xb(this,r,!0,!0)},get size(){return Sb(this,!0)},has(r){return wb.call(this,r,!0)},add:qd("add"),set:qd("set"),delete:qd("delete"),clear:qd("clear"),forEach:vb(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=Db(r,!1,!1),n[r]=Db(r,!0,!1),t[r]=Db(r,!1,!0),i[r]=Db(r,!0,!0)}),[e,n,t,i]}const[rne,sne,ane,cne]=one();function SR(e,t){const n=t?e?cne:ane:e?sne:rne;return(i,o,r)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?i:Reflect.get(ii(n,o)&&o in i?n:i,o,r)}const lne={get:SR(!1,!1)},une={get:SR(!1,!0)},fne={get:SR(!0,!1)},z8=new WeakMap,U8=new WeakMap,H8=new WeakMap,dne=new WeakMap;function hne(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function pne(e){return e.__v_skip||!Object.isExtensible(e)?0:hne(Fte(e))}function xT(e){return xy(e)?e:vR(e,!1,F8,lne,z8)}function V8(e){return vR(e,!1,ine,une,U8)}function k8(e){return vR(e,!0,nne,fne,H8)}function vR(e,t,n,i,o){if(!zi(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const r=o.get(e);if(r)return r;const s=pne(e);if(s===0)return e;const a=new Proxy(e,s===2?i:n);return o.set(e,a),a}function ny(e){return xy(e)?ny(e.__v_raw):!!(e&&e.__v_isReactive)}function xy(e){return!!(e&&e.__v_isReadonly)}function Uw(e){return!!(e&&e.__v_isShallow)}function G8(e){return ny(e)||xy(e)}function mi(e){const t=e&&e.__v_raw;return t?mi(t):e}function DR(e){return zw(e,"__v_skip",!0),e}const vC=e=>zi(e)?xT(e):e,IR=e=>zi(e)?k8(e):e;function W8(e){zh&&Il&&(e=mi(e),R8(e.dep||(e.dep=bR())))}function j8(e,t){e=mi(e),e.dep&&V1(e.dep)}function Vo(e){return!!(e&&e.__v_isRef===!0)}function Gi(e){return q8(e,!1)}function mne(e){return q8(e,!0)}function q8(e,t){return Vo(e)?e:new _ne(e,t)}class _ne{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:mi(t),this._value=n?t:vC(t)}get value(){return W8(this),this._value}set value(t){const n=this.__v_isShallow||Uw(t)||xy(t);t=n?t:mi(t),SC(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:vC(t),j8(this))}}function ct(e){return Vo(e)?e.value:e}const gne={get:(e,t,n)=>ct(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return Vo(o)&&!Vo(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function Y8(e){return ny(e)?e:new Proxy(e,gne)}function yne(e){const t=jt(e)?new Array(e.length):{};for(const n in e)t[n]=$8(e,n);return t}class Ane{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 $8(e,t,n){const i=e[t];return Vo(i)?i:new Ane(e,t,n)}var X8;class Cne{constructor(t,n,i,o){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[X8]=!1,this._dirty=!0,this.effect=new ER(t,()=>{this._dirty||(this._dirty=!0,j8(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!o,this.__v_isReadonly=i}get value(){const t=mi(this);return W8(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}X8="__v_isReadonly";function K8(e,t,n=!1){let i,o;const r=bn(e);return r?(i=e,o=ya):(i=e.get,o=e.set),new Cne(i,o,r||!o,n)}function Tne(e,...t){}function Uh(e,t,n,i){let o;try{o=i?e(...i):e()}catch(r){iv(r,t,n)}return o}function Yc(e,t,n,i){if(bn(e)){const r=Uh(e,t,n,i);return r&&S8(r)&&r.catch(s=>{iv(s,t,n)}),r}const o=[];for(let r=0;r<e.length;r++)o.push(Yc(e[r],t,n,i));return o}function iv(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 f=0;f<u.length;f++)if(u[f](e,s,a)===!1)return}r=r.parent}const c=t.appContext.config.errorHandler;if(c){Uh(c,null,10,[e,s,a]);return}}bne(e,n,o,i)}function bne(e,t,n,i=!0){console.error(e)}let DC=!1,k1=!1;const Us=[];let Ou=0;const iy=[];let Bf=null,ym=0;const J8=Promise.resolve();let PR=null;function tp(e){const t=PR||J8;return e?t.then(this?e.bind(this):e):t}function Ene(e){let t=Ou+1,n=Us.length;for(;t<n;){const i=t+n>>>1;IC(Us[i])<e?t=i+1:n=i}return t}function OR(e){(!Us.length||!Us.includes(e,DC&&e.allowRecurse?Ou+1:Ou))&&(e.id==null?Us.push(e):Us.splice(Ene(e.id),0,e),Q8())}function Q8(){!DC&&!k1&&(k1=!0,PR=J8.then(e6))}function xne(e){const t=Us.indexOf(e);t>Ou&&Us.splice(t,1)}function wne(e){jt(e)?iy.push(...e):(!Bf||!Bf.includes(e,e.allowRecurse?ym+1:ym))&&iy.push(e),Q8()}function a2(e,t=DC?Ou+1:0){for(;t<Us.length;t++){const n=Us[t];n&&n.pre&&(Us.splice(t,1),t--,n())}}function Z8(e){if(iy.length){const t=[...new Set(iy)];if(iy.length=0,Bf){Bf.push(...t);return}for(Bf=t,Bf.sort((n,i)=>IC(n)-IC(i)),ym=0;ym<Bf.length;ym++)Bf[ym]();Bf=null,ym=0}}const IC=e=>e.id==null?1/0:e.id,Sne=(e,t)=>{const n=IC(e)-IC(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function e6(e){k1=!1,DC=!0,Us.sort(Sne);const t=ya;try{for(Ou=0;Ou<Us.length;Ou++){const n=Us[Ou];n&&n.active!==!1&&Uh(n,null,14)}}finally{Ou=0,Us.length=0,Z8(),DC=!1,PR=null,(Us.length||iy.length)&&e6()}}function vne(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||fo;let o=n;const r=t.startsWith("update:"),s=r&&t.slice(7);if(s&&s in i){const f=`${s==="modelValue"?"model":s}Modifiers`,{number:h,trim:_}=i[f]||fo;_&&(o=n.map(g=>qi(g)?g.trim():g)),h&&(o=n.map(TR))}let a,c=i[a=jD(t)]||i[a=jD(Wl(t))];!c&&r&&(c=i[a=jD(Ky(t))]),c&&Yc(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,Yc(u,e,6,o)}}function t6(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(!bn(e)){const c=u=>{const f=t6(u,t,!0);f&&(a=!0,As(s,f))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!r&&!a?(zi(e)&&i.set(e,null),null):(jt(r)?r.forEach(c=>s[c]=null):As(s,r),zi(e)&&i.set(e,s),s)}function ov(e,t){return!e||!QS(t)?!1:(t=t.slice(2).replace(/Once$/,""),ii(e,t[0].toLowerCase()+t.slice(1))||ii(e,Ky(t))||ii(e,t))}let ys=null,n6=null;function Hw(e){const t=ys;return ys=e,n6=e&&e.type.__scopeId||null,t}function Ws(e,t=ys,n){if(!t||e._n)return e;const i=(...o)=>{i._d&&y2(-1);const r=Hw(t);let s;try{s=e(...o)}finally{Hw(r),i._d&&y2(1)}return s};return i._n=!0,i._c=!0,i._d=!0,i}function qD(e){const{type:t,vnode:n,proxy:i,withProxy:o,props:r,propsOptions:[s],slots:a,attrs:c,emit:u,render:f,renderCache:h,data:_,setupState:g,ctx:p,inheritAttrs:y}=e;let C,T;const E=Hw(e);try{if(n.shapeFlag&4){const S=o||i;C=Su(f.call(S,S,h,r,g,_,p)),T=c}else{const S=t;C=Su(S.length>1?S(r,{attrs:c,slots:a,emit:u}):S(r,null)),T=t.props?c:Dne(c)}}catch(S){eC.length=0,iv(S,e,1),C=_o($c)}let w=C;if(T&&y!==!1){const S=Object.keys(T),{shapeFlag:P}=w;S.length&&P&7&&(s&&S.some(yR)&&(T=Ine(T,s)),w=np(w,T))}return n.dirs&&(w=np(w),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&(w.transition=n.transition),C=w,Hw(E),C}const Dne=e=>{let t;for(const n in e)(n==="class"||n==="style"||QS(n))&&((t||(t={}))[n]=e[n]);return t},Ine=(e,t)=>{const n={};for(const i in e)(!yR(i)||!(i.slice(9)in t))&&(n[i]=e[i]);return n};function Pne(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?c2(i,s,u):!!s;if(c&8){const f=t.dynamicProps;for(let h=0;h<f.length;h++){const _=f[h];if(s[_]!==i[_]&&!ov(u,_))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:i===s?!1:i?s?c2(i,s,u):!0:!!s;return!1}function c2(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]&&!ov(n,r))return!0}return!1}function One({vnode:e,parent:t},n){for(;t&&t.subTree===e;)(e=t.vnode).el=n,t=t.parent}const Lne=e=>e.__isSuspense;function Bne(e,t){t&&t.pendingBranch?jt(e)?t.effects.push(...e):t.effects.push(e):wne(e)}function Hh(e,t){if(Zr){let n=Zr.provides;const i=Zr.parent&&Zr.parent.provides;i===n&&(n=Zr.provides=Object.create(i)),n[e]=t}}function ar(e,t,n=!1){const i=Zr||ys;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&&bn(t)?t.call(i.proxy):t}}const Ib={};function Nr(e,t,n){return i6(e,t,n)}function i6(e,t,{immediate:n,deep:i,flush:o,onTrack:r,onTrigger:s}=fo){const a=Zr;let c,u=!1,f=!1;if(Vo(e)?(c=()=>e.value,u=Uw(e)):ny(e)?(c=()=>e,i=!0):jt(e)?(f=!0,u=e.some(w=>ny(w)||Uw(w)),c=()=>e.map(w=>{if(Vo(w))return w.value;if(ny(w))return vm(w);if(bn(w))return Uh(w,a,2)})):bn(e)?t?c=()=>Uh(e,a,2):c=()=>{if(!(a&&a.isUnmounted))return h&&h(),Yc(e,a,3,[_])}:c=ya,t&&i){const w=c;c=()=>vm(w())}let h,_=w=>{h=T.onStop=()=>{Uh(w,a,4)}},g;if(LC)if(_=ya,t?n&&Yc(t,a,3,[c(),f?[]:void 0,_]):c(),o==="sync"){const w=vie();g=w.__watcherHandles||(w.__watcherHandles=[])}else return ya;let p=f?new Array(e.length).fill(Ib):Ib;const y=()=>{if(T.active)if(t){const w=T.run();(i||u||(f?w.some((S,P)=>SC(S,p[P])):SC(w,p)))&&(h&&h(),Yc(t,a,3,[w,p===Ib?void 0:f&&p[0]===Ib?[]:p,_]),p=w)}else T.run()};y.allowRecurse=!!t;let C;o==="sync"?C=y:o==="post"?C=()=>Ba(y,a&&a.suspense):(y.pre=!0,a&&(y.id=a.uid),C=()=>OR(y));const T=new ER(c,C);t?n?y():p=T.run():o==="post"?Ba(T.run.bind(T),a&&a.suspense):T.run();const E=()=>{T.stop(),a&&a.scope&&AR(a.scope.effects,T)};return g&&g.push(E),E}function Rne(e,t,n){const i=this.proxy,o=qi(e)?e.includes(".")?o6(i,e):()=>i[e]:e.bind(i,i);let r;bn(t)?r=t:(r=t.handler,n=t);const s=Zr;Sy(this);const a=i6(o,r.bind(i),n);return s?Sy(s):Nm(),a}function o6(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 vm(e,t){if(!zi(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),Vo(e))vm(e.value,t);else if(jt(e))for(let n=0;n<e.length;n++)vm(e[n],t);else if(ZS(e)||ty(e))e.forEach(n=>{vm(n,t)});else if(D8(e))for(const n in e)vm(e[n],t);return e}function Nne(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ef(()=>{e.isMounted=!0}),wT(()=>{e.isUnmounting=!0}),e}const bc=[Function,Array],Mne={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:bc,onEnter:bc,onAfterEnter:bc,onEnterCancelled:bc,onBeforeLeave:bc,onLeave:bc,onAfterLeave:bc,onLeaveCancelled:bc,onBeforeAppear:bc,onAppear:bc,onAfterAppear:bc,onAppearCancelled:bc},setup(e,{slots:t}){const n=tf(),i=Nne();let o;return()=>{const r=t.default&&a6(t.default(),!0);if(!r||!r.length)return;let s=r[0];if(r.length>1){for(const y of r)if(y.type!==$c){s=y;break}}const a=mi(e),{mode:c}=a;if(i.isLeaving)return YD(s);const u=l2(s);if(!u)return YD(s);const f=G1(u,a,i,n);W1(u,f);const h=n.subTree,_=h&&l2(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(_&&_.type!==$c&&(!Am(u,_)||g)){const y=G1(_,a,i,n);if(W1(_,y),c==="out-in")return i.isLeaving=!0,y.afterLeave=()=>{i.isLeaving=!1,n.update.active!==!1&&n.update()},YD(s);c==="in-out"&&u.type!==$c&&(y.delayLeave=(C,T,E)=>{const w=s6(i,_);w[String(_.key)]=_,C._leaveCb=()=>{T(),C._leaveCb=void 0,delete f.delayedLeave},f.delayedLeave=E})}return s}}},r6=Mne;function s6(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 G1(e,t,n,i){const{appear:o,mode:r,persisted:s=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:h,onLeave:_,onAfterLeave:g,onLeaveCancelled:p,onBeforeAppear:y,onAppear:C,onAfterAppear:T,onAppearCancelled:E}=t,w=String(e.key),S=s6(n,e),P=(R,F)=>{R&&Yc(R,i,9,F)},O=(R,F)=>{const H=F[1];P(R,F),jt(R)?R.every(v=>v.length<=1)&&H():R.length<=1&&H()},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 H=S[w];H&&Am(e,H)&&H.el._leaveCb&&H.el._leaveCb(),P(F,[R])},enter(R){let F=c,H=u,v=f;if(!n.isMounted)if(o)F=C||c,H=T||u,v=E||f;else return;let I=!1;const m=R._enterCb=D=>{I||(I=!0,D?P(v,[R]):P(H,[R]),z.delayedLeave&&z.delayedLeave(),R._enterCb=void 0)};F?O(F,[R,m]):m()},leave(R,F){const H=String(e.key);if(R._enterCb&&R._enterCb(!0),n.isUnmounting)return F();P(h,[R]);let v=!1;const I=R._leaveCb=m=>{v||(v=!0,F(),m?P(p,[R]):P(g,[R]),R._leaveCb=void 0,S[H]===e&&delete S[H])};S[H]=e,_?O(_,[R,I]):I()},clone(R){return G1(R,t,n,i)}};return z}function YD(e){if(rv(e))return e=np(e),e.children=null,e}function l2(e){return rv(e)?e.children?e.children[0]:void 0:e}function W1(e,t){e.shapeFlag&6&&e.component?W1(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 a6(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===ms?(s.patchFlag&128&&o++,i=i.concat(a6(s.children,t,a))):(t||s.type!==$c)&&i.push(a!=null?np(s,{key:a}):s)}if(o>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function wr(e){return bn(e)?{setup:e,name:e.name}:e}const JA=e=>!!e.type.__asyncLoader,rv=e=>e.type.__isKeepAlive;function Fne(e,t){c6(e,"a",t)}function zne(e,t){c6(e,"da",t)}function c6(e,t,n=Zr){const i=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(sv(t,i,n),n){let o=n.parent;for(;o&&o.parent;)rv(o.parent.vnode)&&Une(i,t,n,o),o=o.parent}}function Une(e,t,n,i){const o=sv(t,e,i,!0);LR(()=>{AR(i[t],o)},n)}function sv(e,t,n=Zr,i=!1){if(n){const o=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...s)=>{if(n.isUnmounted)return;Jy(),Sy(n);const a=Yc(t,n,e,s);return Nm(),Qy(),a});return i?o.unshift(r):o.push(r),r}}const Td=e=>(t,n=Zr)=>(!LC||e==="sp")&&sv(e,(...i)=>t(...i),n),Hne=Td("bm"),ef=Td("m"),Vne=Td("bu"),kne=Td("u"),wT=Td("bum"),LR=Td("um"),Gne=Td("sp"),Wne=Td("rtg"),jne=Td("rtc");function qne(e,t=Zr){sv("ec",e,t)}function Ym(e,t){const n=ys;if(n===null)return e;const i=uv(n)||n.proxy,o=e.dirs||(e.dirs=[]);for(let r=0;r<t.length;r++){let[s,a,c,u=fo]=t[r];s&&(bn(s)&&(s={mounted:s,updated:s}),s.deep&&vm(a),o.push({dir:s,instance:i,value:a,oldValue:void 0,arg:c,modifiers:u}))}return e}function zp(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&&(Jy(),Yc(c,n,8,[e.el,a,e,t]),Qy())}}const BR="components";function Pb(e,t){return u6(BR,e,!0,t)||e}const l6=Symbol();function av(e){return qi(e)?u6(BR,e,!1)||e:e||l6}function u6(e,t,n=!0,i=!1){const o=ys||Zr;if(o){const r=o.type;if(e===BR){const a=Eie(r,!1);if(a&&(a===t||a===Wl(t)||a===tv(Wl(t))))return r}const s=u2(o[e]||r[e],t)||u2(o.appContext[e],t);return!s&&i?r:s}}function u2(e,t){return e&&(e[t]||e[Wl(t)]||e[tv(Wl(t))])}function Yne(e,t,n,i){let o;const r=n&&n[i];if(jt(e)||qi(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(zi(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 ga(e,t,n={},i,o){if(ys.isCE||ys.parent&&JA(ys.parent)&&ys.parent.isCE)return t!=="default"&&(n.name=t),_o("slot",n,i&&i());let r=e[t];r&&r._c&&(r._d=!1),Gn();const s=r&&f6(r(n)),a=Ma(ms,{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 f6(e){return e.some(t=>wy(t)?!(t.type===$c||t.type===ms&&!f6(t.children)):!0)?e:null}const j1=e=>e?b6(e)?uv(e)||e.proxy:j1(e.parent):null,QA=As(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=>j1(e.parent),$root:e=>j1(e.root),$emit:e=>e.emit,$options:e=>RR(e),$forceUpdate:e=>e.f||(e.f=()=>OR(e.update)),$nextTick:e=>e.n||(e.n=tp.bind(e.proxy)),$watch:e=>Rne.bind(e)}),$D=(e,t)=>e!==fo&&!e.__isScriptSetup&&ii(e,t),$ne={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($D(i,t))return s[t]=1,i[t];if(o!==fo&&ii(o,t))return s[t]=2,o[t];if((u=e.propsOptions[0])&&ii(u,t))return s[t]=3,r[t];if(n!==fo&&ii(n,t))return s[t]=4,n[t];q1&&(s[t]=0)}}const f=QA[t];let h,_;if(f)return t==="$attrs"&&sc(e,"get",t),f(e);if((h=a.__cssModules)&&(h=h[t]))return h;if(n!==fo&&ii(n,t))return s[t]=4,n[t];if(_=c.config.globalProperties,ii(_,t))return _[t]},set({_:e},t,n){const{data:i,setupState:o,ctx:r}=e;return $D(o,t)?(o[t]=n,!0):i!==fo&&ii(i,t)?(i[t]=n,!0):ii(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!==fo&&ii(e,s)||$D(t,s)||(a=r[0])&&ii(a,s)||ii(i,s)||ii(QA,s)||ii(o.config.globalProperties,s)},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:ii(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};let q1=!0;function Xne(e){const t=RR(e),n=e.proxy,i=e.ctx;q1=!1,t.beforeCreate&&f2(t.beforeCreate,e,"bc");const{data:o,computed:r,methods:s,watch:a,provide:c,inject:u,created:f,beforeMount:h,mounted:_,beforeUpdate:g,updated:p,activated:y,deactivated:C,beforeDestroy:T,beforeUnmount:E,destroyed:w,unmounted:S,render:P,renderTracked:O,renderTriggered:z,errorCaptured:R,serverPrefetch:F,expose:H,inheritAttrs:v,components:I,directives:m,filters:D}=t;if(u&&Kne(u,i,null,e.appContext.config.unwrapInjectedRef),s)for(const V in s){const k=s[V];bn(k)&&(i[V]=k.bind(n))}if(o){const V=o.call(n,n);zi(V)&&(e.data=xT(V))}if(q1=!0,r)for(const V in r){const k=r[V],W=bn(k)?k.bind(n,n):bn(k.get)?k.get.bind(n,n):ya,G=!bn(k)&&bn(k.set)?k.set.bind(n):ya,K=Kt({get:W,set:G});Object.defineProperty(i,V,{enumerable:!0,configurable:!0,get:()=>K.value,set:q=>K.value=q})}if(a)for(const V in a)d6(a[V],i,n,V);if(c){const V=bn(c)?c.call(n):c;Reflect.ownKeys(V).forEach(k=>{Hh(k,V[k])})}f&&f2(f,e,"c");function M(V,k){jt(k)?k.forEach(W=>V(W.bind(n))):k&&V(k.bind(n))}if(M(Hne,h),M(ef,_),M(Vne,g),M(kne,p),M(Fne,y),M(zne,C),M(qne,R),M(jne,O),M(Wne,z),M(wT,E),M(LR,S),M(Gne,F),jt(H))if(H.length){const V=e.exposed||(e.exposed={});H.forEach(k=>{Object.defineProperty(V,k,{get:()=>n[k],set:W=>n[k]=W})})}else e.exposed||(e.exposed={});P&&e.render===ya&&(e.render=P),v!=null&&(e.inheritAttrs=v),I&&(e.components=I),m&&(e.directives=m)}function Kne(e,t,n=ya,i=!1){jt(e)&&(e=Y1(e));for(const o in e){const r=e[o];let s;zi(r)?"default"in r?s=ar(r.from||o,r.default,!0):s=ar(r.from||o):s=ar(r),Vo(s)&&i?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>s.value,set:a=>s.value=a}):t[o]=s}}function f2(e,t,n){Yc(jt(e)?e.map(i=>i.bind(t.proxy)):e.bind(t.proxy),t,n)}function d6(e,t,n,i){const o=i.includes(".")?o6(n,i):()=>n[i];if(qi(e)){const r=t[e];bn(r)&&Nr(o,r)}else if(bn(e))Nr(o,e.bind(n));else if(zi(e))if(jt(e))e.forEach(r=>d6(r,t,n,i));else{const r=bn(e.handler)?e.handler.bind(n):t[e.handler];bn(r)&&Nr(o,r,e)}}function RR(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=>Vw(c,u,s,!0)),Vw(c,t,s)),zi(t)&&r.set(t,c),c}function Vw(e,t,n,i=!1){const{mixins:o,extends:r}=t;r&&Vw(e,r,n,!0),o&&o.forEach(s=>Vw(e,s,n,!0));for(const s in t)if(!(i&&s==="expose")){const a=Jne[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}const Jne={data:d2,props:pm,emits:pm,methods:pm,computed:pm,beforeCreate:ua,created:ua,beforeMount:ua,mounted:ua,beforeUpdate:ua,updated:ua,beforeDestroy:ua,beforeUnmount:ua,destroyed:ua,unmounted:ua,activated:ua,deactivated:ua,errorCaptured:ua,serverPrefetch:ua,components:pm,directives:pm,watch:Zne,provide:d2,inject:Qne};function d2(e,t){return t?e?function(){return As(bn(e)?e.call(this,this):e,bn(t)?t.call(this,this):t)}:t:e}function Qne(e,t){return pm(Y1(e),Y1(t))}function Y1(e){if(jt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function ua(e,t){return e?[...new Set([].concat(e,t))]:t}function pm(e,t){return e?As(As(Object.create(null),e),t):t}function Zne(e,t){if(!e)return t;if(!t)return e;const n=As(Object.create(null),e);for(const i in t)n[i]=ua(e[i],t[i]);return n}function eie(e,t,n,i=!1){const o={},r={};zw(r,lv,1),e.propsDefaults=Object.create(null),h6(e,t,o,r);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=i?o:V8(o):e.type.props?e.props=o:e.props=r,e.attrs=r}function tie(e,t,n,i){const{props:o,attrs:r,vnode:{patchFlag:s}}=e,a=mi(o),[c]=e.propsOptions;let u=!1;if((i||s>0)&&!(s&16)){if(s&8){const f=e.vnode.dynamicProps;for(let h=0;h<f.length;h++){let _=f[h];if(ov(e.emitsOptions,_))continue;const g=t[_];if(c)if(ii(r,_))g!==r[_]&&(r[_]=g,u=!0);else{const p=Wl(_);o[p]=$1(c,a,p,g,e,!1)}else g!==r[_]&&(r[_]=g,u=!0)}}}else{h6(e,t,o,r)&&(u=!0);let f;for(const h in a)(!t||!ii(t,h)&&((f=Ky(h))===h||!ii(t,f)))&&(c?n&&(n[h]!==void 0||n[f]!==void 0)&&(o[h]=$1(c,a,h,void 0,e,!0)):delete o[h]);if(r!==a)for(const h in r)(!t||!ii(t,h))&&(delete r[h],u=!0)}u&&ld(e,"set","$attrs")}function h6(e,t,n,i){const[o,r]=e.propsOptions;let s=!1,a;if(t)for(let c in t){if(kx(c))continue;const u=t[c];let f;o&&ii(o,f=Wl(c))?!r||!r.includes(f)?n[f]=u:(a||(a={}))[f]=u:ov(e.emitsOptions,c)||(!(c in i)||u!==i[c])&&(i[c]=u,s=!0)}if(r){const c=mi(n),u=a||fo;for(let f=0;f<r.length;f++){const h=r[f];n[h]=$1(o,c,h,u[h],e,!ii(u,h))}}return s}function $1(e,t,n,i,o,r){const s=e[n];if(s!=null){const a=ii(s,"default");if(a&&i===void 0){const c=s.default;if(s.type!==Function&&bn(c)){const{propsDefaults:u}=o;n in u?i=u[n]:(Sy(o),i=u[n]=c.call(null,t),Nm())}else i=c}s[0]&&(r&&!a?i=!1:s[1]&&(i===""||i===Ky(n))&&(i=!0))}return i}function p6(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(!bn(e)){const f=h=>{c=!0;const[_,g]=p6(h,t,!0);As(s,_),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(f),e.extends&&f(e.extends),e.mixins&&e.mixins.forEach(f)}if(!r&&!c)return zi(e)&&i.set(e,ey),ey;if(jt(r))for(let f=0;f<r.length;f++){const h=Wl(r[f]);h2(h)&&(s[h]=fo)}else if(r)for(const f in r){const h=Wl(f);if(h2(h)){const _=r[f],g=s[h]=jt(_)||bn(_)?{type:_}:Object.assign({},_);if(g){const p=_2(Boolean,g.type),y=_2(String,g.type);g[0]=p>-1,g[1]=y<0||p<y,(p>-1||ii(g,"default"))&&a.push(h)}}}const u=[s,a];return zi(e)&&i.set(e,u),u}function h2(e){return e[0]!=="$"}function p2(e){const t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:e===null?"null":""}function m2(e,t){return p2(e)===p2(t)}function _2(e,t){return jt(t)?t.findIndex(n=>m2(n,e)):bn(t)&&m2(t,e)?0:-1}const m6=e=>e[0]==="_"||e==="$stable",NR=e=>jt(e)?e.map(Su):[Su(e)],nie=(e,t,n)=>{if(t._n)return t;const i=Ws((...o)=>NR(t(...o)),n);return i._c=!1,i},_6=(e,t,n)=>{const i=e._ctx;for(const o in e){if(m6(o))continue;const r=e[o];if(bn(r))t[o]=nie(o,r,i);else if(r!=null){const s=NR(r);t[o]=()=>s}}},g6=(e,t)=>{const n=NR(t);e.slots.default=()=>n},iie=(e,t)=>{if(e.vnode.shapeFlag&32){const n=t._;n?(e.slots=mi(t),zw(t,"_",n)):_6(t,e.slots={})}else e.slots={},t&&g6(e,t);zw(e.slots,lv,1)},oie=(e,t,n)=>{const{vnode:i,slots:o}=e;let r=!0,s=fo;if(i.shapeFlag&32){const a=t._;a?n&&a===1?r=!1:(As(o,t),!n&&a===1&&delete o._):(r=!t.$stable,_6(t,o)),s=t}else t&&(g6(e,t),s={default:1});if(r)for(const a in o)!m6(a)&&!(a in s)&&delete o[a]};function y6(){return{app:null,config:{isNativeTag:Rte,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 rie=0;function sie(e,t){return function(i,o=null){bn(i)||(i=Object.assign({},i)),o!=null&&!zi(o)&&(o=null);const r=y6(),s=new Set;let a=!1;const c=r.app={_uid:rie++,_component:i,_props:o,_container:null,_context:r,_instance:null,version:Die,get config(){return r.config},set config(u){},use(u,...f){return s.has(u)||(u&&bn(u.install)?(s.add(u),u.install(c,...f)):bn(u)&&(s.add(u),u(c,...f))),c},mixin(u){return r.mixins.includes(u)||r.mixins.push(u),c},component(u,f){return f?(r.components[u]=f,c):r.components[u]},directive(u,f){return f?(r.directives[u]=f,c):r.directives[u]},mount(u,f,h){if(!a){const _=_o(i,o);return _.appContext=r,f&&t?t(_,u):e(_,u,h),a=!0,c._container=u,u.__vue_app__=c,uv(_.component)||_.component.proxy}},unmount(){a&&(e(null,c._container),delete c._container.__vue_app__)},provide(u,f){return r.provides[u]=f,c}};return c}}function X1(e,t,n,i,o=!1){if(jt(e)){e.forEach((_,g)=>X1(_,t&&(jt(t)?t[g]:t),n,i,o));return}if(JA(i)&&!o)return;const r=i.shapeFlag&4?uv(i.component)||i.component.proxy:i.el,s=o?null:r,{i:a,r:c}=e,u=t&&t.r,f=a.refs===fo?a.refs={}:a.refs,h=a.setupState;if(u!=null&&u!==c&&(qi(u)?(f[u]=null,ii(h,u)&&(h[u]=null)):Vo(u)&&(u.value=null)),bn(c))Uh(c,a,12,[s,f]);else{const _=qi(c),g=Vo(c);if(_||g){const p=()=>{if(e.f){const y=_?ii(h,c)?h[c]:f[c]:c.value;o?jt(y)&&AR(y,r):jt(y)?y.includes(r)||y.push(r):_?(f[c]=[r],ii(h,c)&&(h[c]=f[c])):(c.value=[r],e.k&&(f[e.k]=c.value))}else _?(f[c]=s,ii(h,c)&&(h[c]=s)):g&&(c.value=s,e.k&&(f[e.k]=s))};s?(p.id=-1,Ba(p,n)):p()}}}const Ba=Bne;function aie(e){return cie(e)}function cie(e,t){const n=Hte();n.__VUE__=!0;const{insert:i,remove:o,patchProp:r,createElement:s,createText:a,createComment:c,setText:u,setElementText:f,parentNode:h,nextSibling:_,setScopeId:g=ya,insertStaticContent:p}=e,y=(Q,ie,de,me=null,Ee=null,xe=null,Pe=!1,Te=null,Oe=!!ie.dynamicChildren)=>{if(Q===ie)return;Q&&!Am(Q,ie)&&(me=ae(Q),q(Q,Ee,xe,!0),Q=null),ie.patchFlag===-2&&(Oe=!1,ie.dynamicChildren=null);const{type:De,ref:Me,shapeFlag:ve}=ie;switch(De){case cv:C(Q,ie,de,me);break;case $c:T(Q,ie,de,me);break;case XD:Q==null&&E(ie,de,me,Pe);break;case ms:I(Q,ie,de,me,Ee,xe,Pe,Te,Oe);break;default:ve&1?P(Q,ie,de,me,Ee,xe,Pe,Te,Oe):ve&6?m(Q,ie,de,me,Ee,xe,Pe,Te,Oe):(ve&64||ve&128)&&De.process(Q,ie,de,me,Ee,xe,Pe,Te,Oe,re)}Me!=null&&Ee&&X1(Me,Q&&Q.ref,xe,ie||Q,!ie)},C=(Q,ie,de,me)=>{if(Q==null)i(ie.el=a(ie.children),de,me);else{const Ee=ie.el=Q.el;ie.children!==Q.children&&u(Ee,ie.children)}},T=(Q,ie,de,me)=>{Q==null?i(ie.el=c(ie.children||""),de,me):ie.el=Q.el},E=(Q,ie,de,me)=>{[Q.el,Q.anchor]=p(Q.children,ie,de,me,Q.el,Q.anchor)},w=({el:Q,anchor:ie},de,me)=>{let Ee;for(;Q&&Q!==ie;)Ee=_(Q),i(Q,de,me),Q=Ee;i(ie,de,me)},S=({el:Q,anchor:ie})=>{let de;for(;Q&&Q!==ie;)de=_(Q),o(Q),Q=de;o(ie)},P=(Q,ie,de,me,Ee,xe,Pe,Te,Oe)=>{Pe=Pe||ie.type==="svg",Q==null?O(ie,de,me,Ee,xe,Pe,Te,Oe):F(Q,ie,Ee,xe,Pe,Te,Oe)},O=(Q,ie,de,me,Ee,xe,Pe,Te)=>{let Oe,De;const{type:Me,props:ve,shapeFlag:Ie,transition:Ve,dirs:Le}=Q;if(Oe=Q.el=s(Q.type,xe,ve&&ve.is,ve),Ie&8?f(Oe,Q.children):Ie&16&&R(Q.children,Oe,null,me,Ee,xe&&Me!=="foreignObject",Pe,Te),Le&&zp(Q,null,me,"created"),ve){for(const Tt in ve)Tt!=="value"&&!kx(Tt)&&r(Oe,Tt,null,ve[Tt],xe,Q.children,me,Ee,Y);"value"in ve&&r(Oe,"value",null,ve.value),(De=ve.onVnodeBeforeMount)&&gu(De,me,Q)}z(Oe,Q,Q.scopeId,Pe,me),Le&&zp(Q,null,me,"beforeMount");const _t=(!Ee||Ee&&!Ee.pendingBranch)&&Ve&&!Ve.persisted;_t&&Ve.beforeEnter(Oe),i(Oe,ie,de),((De=ve&&ve.onVnodeMounted)||_t||Le)&&Ba(()=>{De&&gu(De,me,Q),_t&&Ve.enter(Oe),Le&&zp(Q,null,me,"mounted")},Ee)},z=(Q,ie,de,me,Ee)=>{if(de&&g(Q,de),me)for(let xe=0;xe<me.length;xe++)g(Q,me[xe]);if(Ee){let xe=Ee.subTree;if(ie===xe){const Pe=Ee.vnode;z(Q,Pe,Pe.scopeId,Pe.slotScopeIds,Ee.parent)}}},R=(Q,ie,de,me,Ee,xe,Pe,Te,Oe=0)=>{for(let De=Oe;De<Q.length;De++){const Me=Q[De]=Te?bh(Q[De]):Su(Q[De]);y(null,Me,ie,de,me,Ee,xe,Pe,Te)}},F=(Q,ie,de,me,Ee,xe,Pe)=>{const Te=ie.el=Q.el;let{patchFlag:Oe,dynamicChildren:De,dirs:Me}=ie;Oe|=Q.patchFlag&16;const ve=Q.props||fo,Ie=ie.props||fo;let Ve;de&&Up(de,!1),(Ve=Ie.onVnodeBeforeUpdate)&&gu(Ve,de,ie,Q),Me&&zp(ie,Q,de,"beforeUpdate"),de&&Up(de,!0);const Le=Ee&&ie.type!=="foreignObject";if(De?H(Q.dynamicChildren,De,Te,de,me,Le,xe):Pe||k(Q,ie,Te,null,de,me,Le,xe,!1),Oe>0){if(Oe&16)v(Te,ie,ve,Ie,de,me,Ee);else if(Oe&2&&ve.class!==Ie.class&&r(Te,"class",null,Ie.class,Ee),Oe&4&&r(Te,"style",ve.style,Ie.style,Ee),Oe&8){const _t=ie.dynamicProps;for(let Tt=0;Tt<_t.length;Tt++){const Ot=_t[Tt],Tn=ve[Ot],Sn=Ie[Ot];(Sn!==Tn||Ot==="value")&&r(Te,Ot,Tn,Sn,Ee,Q.children,de,me,Y)}}Oe&1&&Q.children!==ie.children&&f(Te,ie.children)}else!Pe&&De==null&&v(Te,ie,ve,Ie,de,me,Ee);((Ve=Ie.onVnodeUpdated)||Me)&&Ba(()=>{Ve&&gu(Ve,de,ie,Q),Me&&zp(ie,Q,de,"updated")},me)},H=(Q,ie,de,me,Ee,xe,Pe)=>{for(let Te=0;Te<ie.length;Te++){const Oe=Q[Te],De=ie[Te],Me=Oe.el&&(Oe.type===ms||!Am(Oe,De)||Oe.shapeFlag&70)?h(Oe.el):de;y(Oe,De,Me,null,me,Ee,xe,Pe,!0)}},v=(Q,ie,de,me,Ee,xe,Pe)=>{if(de!==me){if(de!==fo)for(const Te in de)!kx(Te)&&!(Te in me)&&r(Q,Te,de[Te],null,Pe,ie.children,Ee,xe,Y);for(const Te in me){if(kx(Te))continue;const Oe=me[Te],De=de[Te];Oe!==De&&Te!=="value"&&r(Q,Te,De,Oe,Pe,ie.children,Ee,xe,Y)}"value"in me&&r(Q,"value",de.value,me.value)}},I=(Q,ie,de,me,Ee,xe,Pe,Te,Oe)=>{const De=ie.el=Q?Q.el:a(""),Me=ie.anchor=Q?Q.anchor:a("");let{patchFlag:ve,dynamicChildren:Ie,slotScopeIds:Ve}=ie;Ve&&(Te=Te?Te.concat(Ve):Ve),Q==null?(i(De,de,me),i(Me,de,me),R(ie.children,de,Me,Ee,xe,Pe,Te,Oe)):ve>0&&ve&64&&Ie&&Q.dynamicChildren?(H(Q.dynamicChildren,Ie,de,Ee,xe,Pe,Te),(ie.key!=null||Ee&&ie===Ee.subTree)&&MR(Q,ie,!0)):k(Q,ie,de,Me,Ee,xe,Pe,Te,Oe)},m=(Q,ie,de,me,Ee,xe,Pe,Te,Oe)=>{ie.slotScopeIds=Te,Q==null?ie.shapeFlag&512?Ee.ctx.activate(ie,de,me,Pe,Oe):D(ie,de,me,Ee,xe,Pe,Oe):L(Q,ie,Oe)},D=(Q,ie,de,me,Ee,xe,Pe)=>{const Te=Q.component=Aie(Q,me,Ee);if(rv(Q)&&(Te.ctx.renderer=re),Cie(Te),Te.asyncDep){if(Ee&&Ee.registerDep(Te,M),!Q.el){const Oe=Te.subTree=_o($c);T(null,Oe,ie,de)}return}M(Te,Q,ie,de,Ee,xe,Pe)},L=(Q,ie,de)=>{const me=ie.component=Q.component;if(Pne(Q,ie,de))if(me.asyncDep&&!me.asyncResolved){V(me,ie,de);return}else me.next=ie,xne(me.update),me.update();else ie.el=Q.el,me.vnode=ie},M=(Q,ie,de,me,Ee,xe,Pe)=>{const Te=()=>{if(Q.isMounted){let{next:Me,bu:ve,u:Ie,parent:Ve,vnode:Le}=Q,_t=Me,Tt;Up(Q,!1),Me?(Me.el=Le.el,V(Q,Me,Pe)):Me=Le,ve&&Gx(ve),(Tt=Me.props&&Me.props.onVnodeBeforeUpdate)&&gu(Tt,Ve,Me,Le),Up(Q,!0);const Ot=qD(Q),Tn=Q.subTree;Q.subTree=Ot,y(Tn,Ot,h(Tn.el),ae(Tn),Q,Ee,xe),Me.el=Ot.el,_t===null&&One(Q,Ot.el),Ie&&Ba(Ie,Ee),(Tt=Me.props&&Me.props.onVnodeUpdated)&&Ba(()=>gu(Tt,Ve,Me,Le),Ee)}else{let Me;const{el:ve,props:Ie}=ie,{bm:Ve,m:Le,parent:_t}=Q,Tt=JA(ie);if(Up(Q,!1),Ve&&Gx(Ve),!Tt&&(Me=Ie&&Ie.onVnodeBeforeMount)&&gu(Me,_t,ie),Up(Q,!0),ve&&ce){const Ot=()=>{Q.subTree=qD(Q),ce(ve,Q.subTree,Q,Ee,null)};Tt?ie.type.__asyncLoader().then(()=>!Q.isUnmounted&&Ot()):Ot()}else{const Ot=Q.subTree=qD(Q);y(null,Ot,de,me,Q,Ee,xe),ie.el=Ot.el}if(Le&&Ba(Le,Ee),!Tt&&(Me=Ie&&Ie.onVnodeMounted)){const Ot=ie;Ba(()=>gu(Me,_t,Ot),Ee)}(ie.shapeFlag&256||_t&&JA(_t.vnode)&&_t.vnode.shapeFlag&256)&&Q.a&&Ba(Q.a,Ee),Q.isMounted=!0,ie=de=me=null}},Oe=Q.effect=new ER(Te,()=>OR(De),Q.scope),De=Q.update=()=>Oe.run();De.id=Q.uid,Up(Q,!0),De()},V=(Q,ie,de)=>{ie.component=Q;const me=Q.vnode.props;Q.vnode=ie,Q.next=null,tie(Q,ie.props,me,de),oie(Q,ie.children,de),Jy(),a2(),Qy()},k=(Q,ie,de,me,Ee,xe,Pe,Te,Oe=!1)=>{const De=Q&&Q.children,Me=Q?Q.shapeFlag:0,ve=ie.children,{patchFlag:Ie,shapeFlag:Ve}=ie;if(Ie>0){if(Ie&128){G(De,ve,de,me,Ee,xe,Pe,Te,Oe);return}else if(Ie&256){W(De,ve,de,me,Ee,xe,Pe,Te,Oe);return}}Ve&8?(Me&16&&Y(De,Ee,xe),ve!==De&&f(de,ve)):Me&16?Ve&16?G(De,ve,de,me,Ee,xe,Pe,Te,Oe):Y(De,Ee,xe,!0):(Me&8&&f(de,""),Ve&16&&R(ve,de,me,Ee,xe,Pe,Te,Oe))},W=(Q,ie,de,me,Ee,xe,Pe,Te,Oe)=>{Q=Q||ey,ie=ie||ey;const De=Q.length,Me=ie.length,ve=Math.min(De,Me);let Ie;for(Ie=0;Ie<ve;Ie++){const Ve=ie[Ie]=Oe?bh(ie[Ie]):Su(ie[Ie]);y(Q[Ie],Ve,de,null,Ee,xe,Pe,Te,Oe)}De>Me?Y(Q,Ee,xe,!0,!1,ve):R(ie,de,me,Ee,xe,Pe,Te,Oe,ve)},G=(Q,ie,de,me,Ee,xe,Pe,Te,Oe)=>{let De=0;const Me=ie.length;let ve=Q.length-1,Ie=Me-1;for(;De<=ve&&De<=Ie;){const Ve=Q[De],Le=ie[De]=Oe?bh(ie[De]):Su(ie[De]);if(Am(Ve,Le))y(Ve,Le,de,null,Ee,xe,Pe,Te,Oe);else break;De++}for(;De<=ve&&De<=Ie;){const Ve=Q[ve],Le=ie[Ie]=Oe?bh(ie[Ie]):Su(ie[Ie]);if(Am(Ve,Le))y(Ve,Le,de,null,Ee,xe,Pe,Te,Oe);else break;ve--,Ie--}if(De>ve){if(De<=Ie){const Ve=Ie+1,Le=Ve<Me?ie[Ve].el:me;for(;De<=Ie;)y(null,ie[De]=Oe?bh(ie[De]):Su(ie[De]),de,Le,Ee,xe,Pe,Te,Oe),De++}}else if(De>Ie)for(;De<=ve;)q(Q[De],Ee,xe,!0),De++;else{const Ve=De,Le=De,_t=new Map;for(De=Le;De<=Ie;De++){const yn=ie[De]=Oe?bh(ie[De]):Su(ie[De]);yn.key!=null&&_t.set(yn.key,De)}let Tt,Ot=0;const Tn=Ie-Le+1;let Sn=!1,gn=0;const on=new Array(Tn);for(De=0;De<Tn;De++)on[De]=0;for(De=Ve;De<=ve;De++){const yn=Q[De];if(Ot>=Tn){q(yn,Ee,xe,!0);continue}let Cn;if(yn.key!=null)Cn=_t.get(yn.key);else for(Tt=Le;Tt<=Ie;Tt++)if(on[Tt-Le]===0&&Am(yn,ie[Tt])){Cn=Tt;break}Cn===void 0?q(yn,Ee,xe,!0):(on[Cn-Le]=De+1,Cn>=gn?gn=Cn:Sn=!0,y(yn,ie[Cn],de,null,Ee,xe,Pe,Te,Oe),Ot++)}const Nt=Sn?lie(on):ey;for(Tt=Nt.length-1,De=Tn-1;De>=0;De--){const yn=Le+De,Cn=ie[yn],Ht=yn+1<Me?ie[yn+1].el:me;on[De]===0?y(null,Cn,de,Ht,Ee,xe,Pe,Te,Oe):Sn&&(Tt<0||De!==Nt[Tt]?K(Cn,de,Ht,2):Tt--)}}},K=(Q,ie,de,me,Ee=null)=>{const{el:xe,type:Pe,transition:Te,children:Oe,shapeFlag:De}=Q;if(De&6){K(Q.component.subTree,ie,de,me);return}if(De&128){Q.suspense.move(ie,de,me);return}if(De&64){Pe.move(Q,ie,de,re);return}if(Pe===ms){i(xe,ie,de);for(let ve=0;ve<Oe.length;ve++)K(Oe[ve],ie,de,me);i(Q.anchor,ie,de);return}if(Pe===XD){w(Q,ie,de);return}if(me!==2&&De&1&&Te)if(me===0)Te.beforeEnter(xe),i(xe,ie,de),Ba(()=>Te.enter(xe),Ee);else{const{leave:ve,delayLeave:Ie,afterLeave:Ve}=Te,Le=()=>i(xe,ie,de),_t=()=>{ve(xe,()=>{Le(),Ve&&Ve()})};Ie?Ie(xe,Le,_t):_t()}else i(xe,ie,de)},q=(Q,ie,de,me=!1,Ee=!1)=>{const{type:xe,props:Pe,ref:Te,children:Oe,dynamicChildren:De,shapeFlag:Me,patchFlag:ve,dirs:Ie}=Q;if(Te!=null&&X1(Te,null,de,Q,!0),Me&256){ie.ctx.deactivate(Q);return}const Ve=Me&1&&Ie,Le=!JA(Q);let _t;if(Le&&(_t=Pe&&Pe.onVnodeBeforeUnmount)&&gu(_t,ie,Q),Me&6)X(Q.component,de,me);else{if(Me&128){Q.suspense.unmount(de,me);return}Ve&&zp(Q,null,ie,"beforeUnmount"),Me&64?Q.type.remove(Q,ie,de,Ee,re,me):De&&(xe!==ms||ve>0&&ve&64)?Y(De,ie,de,!1,!0):(xe===ms&&ve&384||!Ee&&Me&16)&&Y(Oe,ie,de),me&&te(Q)}(Le&&(_t=Pe&&Pe.onVnodeUnmounted)||Ve)&&Ba(()=>{_t&&gu(_t,ie,Q),Ve&&zp(Q,null,ie,"unmounted")},de)},te=Q=>{const{type:ie,el:de,anchor:me,transition:Ee}=Q;if(ie===ms){$(de,me);return}if(ie===XD){S(Q);return}const xe=()=>{o(de),Ee&&!Ee.persisted&&Ee.afterLeave&&Ee.afterLeave()};if(Q.shapeFlag&1&&Ee&&!Ee.persisted){const{leave:Pe,delayLeave:Te}=Ee,Oe=()=>Pe(de,xe);Te?Te(Q.el,xe,Oe):Oe()}else xe()},$=(Q,ie)=>{let de;for(;Q!==ie;)de=_(Q),o(Q),Q=de;o(ie)},X=(Q,ie,de)=>{const{bum:me,scope:Ee,update:xe,subTree:Pe,um:Te}=Q;me&&Gx(me),Ee.stop(),xe&&(xe.active=!1,q(Pe,Q,ie,de)),Te&&Ba(Te,ie),Ba(()=>{Q.isUnmounted=!0},ie),ie&&ie.pendingBranch&&!ie.isUnmounted&&Q.asyncDep&&!Q.asyncResolved&&Q.suspenseId===ie.pendingId&&(ie.deps--,ie.deps===0&&ie.resolve())},Y=(Q,ie,de,me=!1,Ee=!1,xe=0)=>{for(let Pe=xe;Pe<Q.length;Pe++)q(Q[Pe],ie,de,me,Ee)},ae=Q=>Q.shapeFlag&6?ae(Q.component.subTree):Q.shapeFlag&128?Q.suspense.next():_(Q.anchor||Q.el),ue=(Q,ie,de)=>{Q==null?ie._vnode&&q(ie._vnode,null,null,!0):y(ie._vnode||null,Q,ie,null,null,null,de),a2(),Z8(),ie._vnode=Q},re={p:y,um:q,m:K,r:te,mt:D,mc:R,pc:k,pbc:H,n:ae,o:e};let he,ce;return t&&([he,ce]=t(re)),{render:ue,hydrate:he,createApp:sie(ue,he)}}function Up({effect:e,update:t},n){e.allowRecurse=t.allowRecurse=n}function MR(e,t,n=!1){const i=e.children,o=t.children;if(jt(i)&&jt(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]=bh(o[r]),a.el=s.el),n||MR(s,a)),a.type===cv&&(a.el=s.el)}}function lie(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 uie=e=>e.__isTeleport,ZA=e=>e&&(e.disabled||e.disabled===""),g2=e=>typeof SVGElement<"u"&&e instanceof SVGElement,K1=(e,t)=>{const n=e&&e.to;return qi(n)?t?t(n):null:n},fie={__isTeleport:!0,process(e,t,n,i,o,r,s,a,c,u){const{mc:f,pc:h,pbc:_,o:{insert:g,querySelector:p,createText:y,createComment:C}}=u,T=ZA(t.props);let{shapeFlag:E,children:w,dynamicChildren:S}=t;if(e==null){const P=t.el=y(""),O=t.anchor=y("");g(P,n,i),g(O,n,i);const z=t.target=K1(t.props,p),R=t.targetAnchor=y("");z&&(g(R,z),s=s||g2(z));const F=(H,v)=>{E&16&&f(w,H,v,o,r,s,a,c)};T?F(n,O):z&&F(z,R)}else{t.el=e.el;const P=t.anchor=e.anchor,O=t.target=e.target,z=t.targetAnchor=e.targetAnchor,R=ZA(e.props),F=R?n:O,H=R?P:z;if(s=s||g2(O),S?(_(e.dynamicChildren,S,F,o,r,s,a),MR(e,t,!0)):c||h(e,t,F,H,o,r,s,a,!1),T)R||Ob(t,n,P,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const v=t.target=K1(t.props,p);v&&Ob(t,v,null,u,0)}else R&&Ob(t,O,z,u,1)}A6(t)},remove(e,t,n,i,{um:o,o:{remove:r}},s){const{shapeFlag:a,children:c,anchor:u,targetAnchor:f,target:h,props:_}=e;if(h&&r(f),(s||!ZA(_))&&(r(u),a&16))for(let g=0;g<c.length;g++){const p=c[g];o(p,t,n,!0,!!p.dynamicChildren)}},move:Ob,hydrate:die};function Ob(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:f}=e,h=r===2;if(h&&i(s,t,n),(!h||ZA(f))&&c&16)for(let _=0;_<u.length;_++)o(u[_],t,n,2);h&&i(a,t,n)}function die(e,t,n,i,o,r,{o:{nextSibling:s,parentNode:a,querySelector:c}},u){const f=t.target=K1(t.props,c);if(f){const h=f._lpa||f.firstChild;if(t.shapeFlag&16)if(ZA(t.props))t.anchor=u(s(e),t,a(e),n,i,o,r),t.targetAnchor=h;else{t.anchor=s(e);let _=h;for(;_;)if(_=s(_),_&&_.nodeType===8&&_.data==="teleport anchor"){t.targetAnchor=_,f._lpa=t.targetAnchor&&s(t.targetAnchor);break}u(h,t,f,n,i,o,r)}A6(t)}return t.anchor&&s(t.anchor)}const hie=fie;function A6(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 ms=Symbol(void 0),cv=Symbol(void 0),$c=Symbol(void 0),XD=Symbol(void 0),eC=[];let Pl=null;function Gn(e=!1){eC.push(Pl=e?null:[])}function pie(){eC.pop(),Pl=eC[eC.length-1]||null}let PC=1;function y2(e){PC+=e}function C6(e){return e.dynamicChildren=PC>0?Pl||ey:null,pie(),PC>0&&Pl&&Pl.push(e),e}function mo(e,t,n,i,o,r){return C6(rs(e,t,n,i,o,r,!0))}function Ma(e,t,n,i,o){return C6(_o(e,t,n,i,o,!0))}function wy(e){return e?e.__v_isVNode===!0:!1}function Am(e,t){return e.type===t.type&&e.key===t.key}const lv="__vInternal",T6=({key:e})=>e??null,Wx=({ref:e,ref_key:t,ref_for:n})=>e!=null?qi(e)||Vo(e)||bn(e)?{i:ys,r:e,k:t,f:!!n}:e:null;function rs(e,t=null,n=null,i=0,o=null,r=e===ms?0:1,s=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&T6(t),ref:t&&Wx(t),scopeId:n6,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:ys};return a?(FR(c,n),r&128&&e.normalize(c)):n&&(c.shapeFlag|=qi(n)?8:16),PC>0&&!s&&Pl&&(c.patchFlag>0||r&6)&&c.patchFlag!==32&&Pl.push(c),c}const _o=mie;function mie(e,t=null,n=null,i=0,o=null,r=!1){if((!e||e===l6)&&(e=$c),wy(e)){const a=np(e,t,!0);return n&&FR(a,n),PC>0&&!r&&Pl&&(a.shapeFlag&6?Pl[Pl.indexOf(e)]=a:Pl.push(a)),a.patchFlag|=-2,a}if(xie(e)&&(e=e.__vccOpts),t){t=_ie(t);let{class:a,style:c}=t;a&&!qi(a)&&(t.class=Mi(a)),zi(c)&&(G8(c)&&!jt(c)&&(c=As({},c)),t.style=Xy(c))}const s=qi(e)?1:Lne(e)?128:uie(e)?64:zi(e)?4:bn(e)?2:0;return rs(e,t,n,i,o,s,r,!0)}function _ie(e){return e?G8(e)||lv in e?As({},e):e:null}function np(e,t,n=!1){const{props:i,ref:o,patchFlag:r,children:s}=e,a=t?zR(i||{},t):i;return{__v_isVNode:!0,__v_skip:!0,type:e.type,props:a,key:a&&T6(a),ref:t&&t.ref?n&&o?jt(o)?o.concat(Wx(t)):[o,Wx(t)]:Wx(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!==ms?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&&np(e.ssContent),ssFallback:e.ssFallback&&np(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx}}function OC(e=" ",t=0){return _o(cv,null,e,t)}function da(e="",t=!1){return t?(Gn(),Ma($c,null,e)):_o($c,null,e)}function Su(e){return e==null||typeof e=="boolean"?_o($c):jt(e)?_o(ms,null,e.slice()):typeof e=="object"?bh(e):_o(cv,null,String(e))}function bh(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:np(e)}function FR(e,t){let n=0;const{shapeFlag:i}=e;if(t==null)t=null;else if(jt(t))n=16;else if(typeof t=="object")if(i&65){const o=t.default;o&&(o._c&&(o._d=!1),FR(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!(lv in t)?t._ctx=ys:o===3&&ys&&(ys.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else bn(t)?(t={default:t,_ctx:ys},n=32):(t=String(t),i&64?(n=16,t=[OC(t)]):n=8);e.children=t,e.shapeFlag|=n}function zR(...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=Mi([t.class,i.class]));else if(o==="style")t.style=Xy([t.style,i.style]);else if(QS(o)){const r=t[o],s=i[o];s&&r!==s&&!(jt(r)&&r.includes(s))&&(t[o]=r?[].concat(r,s):s)}else o!==""&&(t[o]=i[o])}return t}function gu(e,t,n,i=null){Yc(e,t,7,[n,i])}const gie=y6();let yie=0;function Aie(e,t,n){const i=e.type,o=(t?t.appContext:e.appContext)||gie,r={uid:yie++,vnode:e,type:i,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,scope:new I8(!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:p6(i,o),emitsOptions:t6(i,o),emit:null,emitted:null,propsDefaults:fo,inheritAttrs:i.inheritAttrs,ctx:fo,data:fo,props:fo,attrs:fo,slots:fo,refs:fo,setupState:fo,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=vne.bind(null,r),e.ce&&e.ce(r),r}let Zr=null;const tf=()=>Zr||ys,Sy=e=>{Zr=e,e.scope.on()},Nm=()=>{Zr&&Zr.scope.off(),Zr=null};function b6(e){return e.vnode.shapeFlag&4}let LC=!1;function Cie(e,t=!1){LC=t;const{props:n,children:i}=e.vnode,o=b6(e);eie(e,n,o,t),iie(e,i);const r=o?Tie(e,t):void 0;return LC=!1,r}function Tie(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=DR(new Proxy(e.ctx,$ne));const{setup:i}=n;if(i){const o=e.setupContext=i.length>1?x6(e):null;Sy(e),Jy();const r=Uh(i,e,0,[e.props,o]);if(Qy(),Nm(),S8(r)){if(r.then(Nm,Nm),t)return r.then(s=>{A2(e,s,t)}).catch(s=>{iv(s,e,0)});e.asyncDep=r}else A2(e,r,t)}else E6(e,t)}function A2(e,t,n){bn(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:zi(t)&&(e.setupState=Y8(t)),E6(e,n)}let C2;function E6(e,t,n){const i=e.type;if(!e.render){if(!t&&C2&&!i.render){const o=i.template||RR(e).template;if(o){const{isCustomElement:r,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:c}=i,u=As(As({isCustomElement:r,delimiters:a},s),c);i.render=C2(o,u)}}e.render=i.render||ya}Sy(e),Jy(),Xne(e),Qy(),Nm()}function bie(e){return new Proxy(e.attrs,{get(t,n){return sc(e,"get","$attrs"),t[n]}})}function x6(e){const t=i=>{e.exposed=i||{}};let n;return{get attrs(){return n||(n=bie(e))},slots:e.slots,emit:e.emit,expose:t}}function uv(e){if(e.exposed)return e.exposeProxy||(e.exposeProxy=new Proxy(Y8(DR(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in QA)return QA[n](e)},has(t,n){return n in t||n in QA}}))}function Eie(e,t=!0){return bn(e)?e.displayName||e.name:e.name||t&&e.__name}function xie(e){return bn(e)&&"__vccOpts"in e}const Kt=(e,t)=>K8(e,t,LC);function w6(){return wie().slots}function wie(){const e=tf();return e.setupContext||(e.setupContext=x6(e))}function fv(e,t,n){const i=arguments.length;return i===2?zi(t)&&!jt(t)?wy(t)?_o(e,null,[t]):_o(e,t):_o(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&wy(n)&&(n=[n]),_o(e,t,n))}const Sie=Symbol(""),vie=()=>ar(Sie),Die="3.2.45",Iie="http://www.w3.org/2000/svg",Cm=typeof document<"u"?document:null,T2=Cm&&Cm.createElement("template"),Pie={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?Cm.createElementNS(Iie,e):Cm.createElement(e,n?{is:n}:void 0);return e==="select"&&i&&i.multiple!=null&&o.setAttribute("multiple",i.multiple),o},createText:e=>Cm.createTextNode(e),createComment:e=>Cm.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Cm.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{T2.innerHTML=i?`<svg>${e}</svg>`:e;const a=T2.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 Oie(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 Lie(e,t,n){const i=e.style,o=qi(n);if(n&&!o){for(const r in n)J1(i,r,n[r]);if(t&&!qi(t))for(const r in t)n[r]==null&&J1(i,r,"")}else{const r=i.display;o?t!==n&&(i.cssText=n):t&&e.removeAttribute("style"),"_vod"in e&&(i.display=r)}}const b2=/\s*!important$/;function J1(e,t,n){if(jt(n))n.forEach(i=>J1(e,t,i));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=Bie(e,t);b2.test(n)?e.setProperty(Ky(i),n.replace(b2,""),"important"):e[i]=n}}const E2=["Webkit","Moz","ms"],KD={};function Bie(e,t){const n=KD[t];if(n)return n;let i=Wl(t);if(i!=="filter"&&i in e)return KD[t]=i;i=tv(i);for(let o=0;o<E2.length;o++){const r=E2[o]+i;if(r in e)return KD[t]=r}return t}const x2="http://www.w3.org/1999/xlink";function Rie(e,t,n,i,o){if(i&&t.startsWith("xlink:"))n==null?e.removeAttributeNS(x2,t.slice(6,t.length)):e.setAttributeNS(x2,t,n);else{const r=Lte(t);n==null||r&&!E8(n)?e.removeAttribute(t):e.setAttribute(t,r?"":n)}}function Nie(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=E8(n):n==null&&c==="string"?(n="",a=!0):c==="number"&&(n=0,a=!0)}try{e[t]=n}catch{}a&&e.removeAttribute(t)}function S6(e,t,n,i){e.addEventListener(t,n,i)}function Mie(e,t,n,i){e.removeEventListener(t,n,i)}function Fie(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]=zie(t);if(i){const u=r[t]=Vie(i,o);S6(e,a,u,c)}else s&&(Mie(e,a,s,c),r[t]=void 0)}}const w2=/(?:Once|Passive|Capture)$/;function zie(e){let t;if(w2.test(e)){t={};let i;for(;i=e.match(w2);)e=e.slice(0,e.length-i[0].length),t[i[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Ky(e.slice(2)),t]}let JD=0;const Uie=Promise.resolve(),Hie=()=>JD||(Uie.then(()=>JD=0),JD=Date.now());function Vie(e,t){const n=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=n.attached)return;Yc(kie(i,n.value),t,5,[i])};return n.value=e,n.attached=Hie(),n}function kie(e,t){if(jt(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 S2=/^on[a-z]/,Gie=(e,t,n,i,o=!1,r,s,a,c)=>{t==="class"?Oie(e,i,o):t==="style"?Lie(e,n,i):QS(t)?yR(t)||Fie(e,t,n,i,s):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Wie(e,t,i,o))?Nie(e,t,i,r,s,a,c):(t==="true-value"?e._trueValue=i:t==="false-value"&&(e._falseValue=i),Rie(e,t,i,o))};function Wie(e,t,n,i){return i?!!(t==="innerHTML"||t==="textContent"||t in e&&S2.test(t)&&bn(n)):t==="spellcheck"||t==="draggable"||t==="translate"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA"||S2.test(t)&&qi(n)?!1:t in e}const Yd="transition",S0="animation",ST=(e,{slots:t})=>fv(r6,jie(e),t);ST.displayName="Transition";const v6={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};ST.props=As({},r6.props,v6);const Hp=(e,t=[])=>{jt(e)?e.forEach(n=>n(...t)):e&&e(...t)},v2=e=>e?jt(e)?e.some(t=>t.length>1):e.length>1:!1;function jie(e){const t={};for(const I in e)I in v6||(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:f=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,p=qie(o),y=p&&p[0],C=p&&p[1],{onBeforeEnter:T,onEnter:E,onEnterCancelled:w,onLeave:S,onLeaveCancelled:P,onBeforeAppear:O=T,onAppear:z=E,onAppearCancelled:R=w}=t,F=(I,m,D)=>{Vp(I,m?f:a),Vp(I,m?u:s),D&&D()},H=(I,m)=>{I._isLeaving=!1,Vp(I,h),Vp(I,g),Vp(I,_),m&&m()},v=I=>(m,D)=>{const L=I?z:E,M=()=>F(m,I,D);Hp(L,[m,M]),D2(()=>{Vp(m,I?c:r),$d(m,I?f:a),v2(L)||I2(m,i,y,M)})};return As(t,{onBeforeEnter(I){Hp(T,[I]),$d(I,r),$d(I,s)},onBeforeAppear(I){Hp(O,[I]),$d(I,c),$d(I,u)},onEnter:v(!1),onAppear:v(!0),onLeave(I,m){I._isLeaving=!0;const D=()=>H(I,m);$d(I,h),Xie(),$d(I,_),D2(()=>{I._isLeaving&&(Vp(I,h),$d(I,g),v2(S)||I2(I,i,C,D))}),Hp(S,[I,D])},onEnterCancelled(I){F(I,!1),Hp(w,[I])},onAppearCancelled(I){F(I,!0),Hp(R,[I])},onLeaveCancelled(I){H(I),Hp(P,[I])}})}function qie(e){if(e==null)return null;if(zi(e))return[QD(e.enter),QD(e.leave)];{const t=QD(e);return[t,t]}}function QD(e){return TR(e)}function $d(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e._vtc||(e._vtc=new Set)).add(t)}function Vp(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 D2(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Yie=0;function I2(e,t,n,i){const o=e._endId=++Yie,r=()=>{o===e._endId&&i()};if(n)return setTimeout(r,n);const{type:s,timeout:a,propCount:c}=$ie(e,t);if(!s)return i();const u=s+"end";let f=0;const h=()=>{e.removeEventListener(u,_),r()},_=g=>{g.target===e&&++f>=c&&h()};setTimeout(()=>{f<c&&h()},a+1),e.addEventListener(u,_)}function $ie(e,t){const n=window.getComputedStyle(e),i=p=>(n[p]||"").split(", "),o=i(`${Yd}Delay`),r=i(`${Yd}Duration`),s=P2(o,r),a=i(`${S0}Delay`),c=i(`${S0}Duration`),u=P2(a,c);let f=null,h=0,_=0;t===Yd?s>0&&(f=Yd,h=s,_=r.length):t===S0?u>0&&(f=S0,h=u,_=c.length):(h=Math.max(s,u),f=h>0?s>u?Yd:S0:null,_=f?f===Yd?r.length:c.length:0);const g=f===Yd&&/\b(transform|all)(,|$)/.test(i(`${Yd}Property`).toString());return{type:f,timeout:h,propCount:_,hasTransform:g}}function P2(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,i)=>O2(n)+O2(e[i])))}function O2(e){return Number(e.slice(0,-1).replace(",","."))*1e3}function Xie(){return document.body.offsetHeight}const L2=e=>{const t=e.props["onUpdate:modelValue"]||!1;return jt(t)?n=>Gx(t,n):t},kw={deep:!0,created(e,t,n){e._assign=L2(n),S6(e,"change",()=>{const i=e._modelValue,o=Kie(e),r=e.checked,s=e._assign;if(jt(i)){const a=x8(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(ZS(i)){const a=new Set(i);r?a.add(o):a.delete(o),s(a)}else s(D6(e,r))})},mounted:B2,beforeUpdate(e,t,n){e._assign=L2(n),B2(e,t,n)}};function B2(e,{value:t,oldValue:n},i){e._modelValue=t,jt(t)?e.checked=x8(t,i.props.value)>-1:ZS(t)?e.checked=t.has(i.props.value):t!==n&&(e.checked=JS(t,D6(e,!0)))}function Kie(e){return"_value"in e?e._value:e.value}function D6(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Jie=["ctrl","shift","alt","meta"],Qie={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)=>Jie.some(n=>e[`${n}Key`]&&!t.includes(n))},I6=(e,t)=>(n,...i)=>{for(let o=0;o<t.length;o++){const r=Qie[t[o]];if(r&&r(n,t))return}return e(n,...i)},UR={beforeMount(e,{value:t},{transition:n}){e._vod=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):v0(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),v0(e,!0),i.enter(e)):i.leave(e,()=>{v0(e,!1)}):v0(e,t))},beforeUnmount(e,{value:t}){v0(e,t)}};function v0(e,t){e.style.display=t?e._vod:"none"}const Zie=As({patchProp:Gie},Pie);let R2;function P6(){return R2||(R2=aie(Zie))}const N2=(...e)=>{P6().render(...e)},eoe=(...e)=>{const t=P6().createApp(...e),{mount:n}=t;return t.mount=i=>{const o=toe(i);if(!o)return;const r=t._component;!bn(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 toe(e){return qi(e)?document.querySelector(e):e}var noe=!1;/*!
* pinia v2.0.28
* (c) 2022 Eduardo San Martin Morote
* @license MIT
*/const ioe=Symbol();var M2;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(M2||(M2={}));function ooe(){const e=Vte(!0),t=e.run(()=>Gi({}));let n=[],i=[];const o=DR({install(r){o._a=r,r.provide(ioe,o),r.config.globalProperties.$pinia=o,i.forEach(s=>n.push(s)),i=[]},use(r){return!this._a&&!noe?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 Ig=typeof window<"u";function roe(e){return e.__esModule||e[Symbol.toStringTag]==="Module"}const ki=Object.assign;function ZD(e,t){const n={};for(const i in t){const o=t[i];n[i]=jl(o)?o.map(e):e(o)}return n}const tC=()=>{},jl=Array.isArray,soe=/\/$/,aoe=e=>e.replace(soe,"");function eI(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=foe(i??t,n),{fullPath:i+(r&&"?")+r+s,path:i,query:o,hash:s}}function coe(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function F2(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function loe(e,t,n){const i=t.matched.length-1,o=n.matched.length-1;return i>-1&&i===o&&vy(t.matched[i],n.matched[o])&&O6(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function vy(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function O6(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(!uoe(e[n],t[n]))return!1;return!0}function uoe(e,t){return jl(e)?z2(e,t):jl(t)?z2(t,e):e===t}function z2(e,t){return jl(t)?e.length===t.length&&e.every((n,i)=>n===t[i]):e.length===1&&e[0]===t}function foe(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 BC;(function(e){e.pop="pop",e.push="push"})(BC||(BC={}));var nC;(function(e){e.back="back",e.forward="forward",e.unknown=""})(nC||(nC={}));function doe(e){if(!e)if(Ig){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),aoe(e)}const hoe=/^[^#]+#/;function poe(e,t){return e.replace(hoe,"#")+t}function moe(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 dv=()=>({left:window.pageXOffset,top:window.pageYOffset});function _oe(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=moe(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 U2(e,t){return(history.state?history.state.position-t:-1)+e}const Q1=new Map;function goe(e,t){Q1.set(e,t)}function yoe(e){const t=Q1.get(e);return Q1.delete(e),t}let Aoe=()=>location.protocol+"//"+location.host;function L6(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),F2(c,"")}return F2(n,e)+i+o}function Coe(e,t,n,i){let o=[],r=[],s=null;const a=({state:_})=>{const g=L6(e,location),p=n.value,y=t.value;let C=0;if(_){if(n.value=g,t.value=_,s&&s===p){s=null;return}C=y?_.position-y.position:0}else i(g);o.forEach(T=>{T(n.value,p,{delta:C,type:BC.pop,direction:C?C>0?nC.forward:nC.back:nC.unknown})})};function c(){s=n.value}function u(_){o.push(_);const g=()=>{const p=o.indexOf(_);p>-1&&o.splice(p,1)};return r.push(g),g}function f(){const{history:_}=window;_.state&&_.replaceState(ki({},_.state,{scroll:dv()}),"")}function h(){for(const _ of r)_();r=[],window.removeEventListener("popstate",a),window.removeEventListener("beforeunload",f)}return window.addEventListener("popstate",a),window.addEventListener("beforeunload",f),{pauseListeners:c,listen:u,destroy:h}}function H2(e,t,n,i=!1,o=!1){return{back:e,current:t,forward:n,replaced:i,position:window.history.length,scroll:o?dv():null}}function Toe(e){const{history:t,location:n}=window,i={value:L6(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,f){const h=e.indexOf("#"),_=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+c:Aoe()+e+c;try{t[f?"replaceState":"pushState"](u,"",_),o.value=u}catch(g){console.error(g),n[f?"replace":"assign"](_)}}function s(c,u){const f=ki({},t.state,H2(o.value.back,c,o.value.forward,!0),u,{position:o.value.position});r(c,f,!0),i.value=c}function a(c,u){const f=ki({},o.value,t.state,{forward:c,scroll:dv()});r(f.current,f,!0);const h=ki({},H2(i.value,c,null),{position:f.position+1},u);r(c,h,!1),i.value=c}return{location:i,state:o,push:a,replace:s}}function boe(e){e=doe(e);const t=Toe(e),n=Coe(e,t.state,t.location,t.replace);function i(r,s=!0){s||n.pauseListeners(),history.go(r)}const o=ki({location:"",base:e,go:i,createHref:poe.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 Eoe(e){return typeof e=="string"||e&&typeof e=="object"}function B6(e){return typeof e=="string"||typeof e=="symbol"}const Xd={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0},R6=Symbol("");var V2;(function(e){e[e.aborted=4]="aborted",e[e.cancelled=8]="cancelled",e[e.duplicated=16]="duplicated"})(V2||(V2={}));function Dy(e,t){return ki(new Error,{type:e,[R6]:!0},t)}function Ef(e,t){return e instanceof Error&&R6 in e&&(t==null||!!(e.type&t))}const k2="[^/]+?",xoe={sensitive:!1,strict:!1,start:!0,end:!0},woe=/[.+*?^${}()[\]/\\]/g;function Soe(e,t){const n=ki({},xoe,t),i=[];let o=n.start?"^":"";const r=[];for(const u of e){const f=u.length?[]:[90];n.strict&&!u.length&&(o+="/");for(let h=0;h<u.length;h++){const _=u[h];let g=40+(n.sensitive?.25:0);if(_.type===0)h||(o+="/"),o+=_.value.replace(woe,"\\$&"),g+=40;else if(_.type===1){const{value:p,repeatable:y,optional:C,regexp:T}=_;r.push({name:p,repeatable:y,optional:C});const E=T||k2;if(E!==k2){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=C&&u.length<2?`(?:/${w})`:"/"+w),C&&(w+="?"),o+=w,g+=20,C&&(g+=-8),y&&(g+=-20),E===".*"&&(g+=-50)}f.push(g)}i.push(f)}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 f=u.match(s),h={};if(!f)return null;for(let _=1;_<f.length;_++){const g=f[_]||"",p=r[_-1];h[p.name]=g&&p.repeatable?g.split("/"):g}return h}function c(u){let f="",h=!1;for(const _ of e){(!h||!f.endsWith("/"))&&(f+="/"),h=!1;for(const g of _)if(g.type===0)f+=g.value;else if(g.type===1){const{value:p,repeatable:y,optional:C}=g,T=p in u?u[p]:"";if(jl(T)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const E=jl(T)?T.join("/"):T;if(!E)if(C)_.length<2&&(f.endsWith("/")?f=f.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);f+=E}}return f||"/"}return{re:s,score:i,keys:r,parse:a,stringify:c}}function voe(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 Doe(e,t){let n=0;const i=e.score,o=t.score;for(;n<i.length&&n<o.length;){const r=voe(i[n],o[n]);if(r)return r;n++}if(Math.abs(o.length-i.length)===1){if(G2(i))return 1;if(G2(o))return-1}return o.length-i.length}function G2(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const Ioe={type:0,value:""},Poe=/[a-zA-Z0-9_]/;function Ooe(e){if(!e)return[[]];if(e==="/")return[[Ioe]];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="",f="";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:f,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function _(){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):_();break;case 4:_(),n=i;break;case 1:c==="("?n=2:Poe.test(c)?_():(h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--);break;case 2:c===")"?f[f.length-1]=="\\"?f=f.slice(0,-1)+c:n=3:f+=c;break;case 3:h(),n=0,c!=="*"&&c!=="?"&&c!=="+"&&a--,f="";break;default:t("Unknown state");break}}return n===2&&t(`Unfinished custom RegExp for param "${u}"`),h(),s(),o}function Loe(e,t,n){const i=Soe(Ooe(e.path),n),o=ki(i,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function Boe(e,t){const n=[],i=new Map;t=q2({strict:!1,end:!0,sensitive:!1},t);function o(f){return i.get(f)}function r(f,h,_){const g=!_,p=Roe(f);p.aliasOf=_&&_.record;const y=q2(t,f),C=[p];if("alias"in f){const w=typeof f.alias=="string"?[f.alias]:f.alias;for(const S of w)C.push(ki({},p,{components:_?_.record.components:p.components,path:S,aliasOf:_?_.record:p}))}let T,E;for(const w of C){const{path:S}=w;if(h&&S[0]!=="/"){const P=h.record.path,O=P[P.length-1]==="/"?"":"/";w.path=h.record.path+(S&&O+S)}if(T=Loe(w,h,y),_?_.alias.push(T):(E=E||T,E!==T&&E.alias.push(T),g&&f.name&&!j2(T)&&s(f.name)),p.children){const P=p.children;for(let O=0;O<P.length;O++)r(P[O],T,_&&_.children[O])}_=_||T,(T.record.components&&Object.keys(T.record.components).length||T.record.name||T.record.redirect)&&c(T)}return E?()=>{s(E)}:tC}function s(f){if(B6(f)){const h=i.get(f);h&&(i.delete(f),n.splice(n.indexOf(h),1),h.children.forEach(s),h.alias.forEach(s))}else{const h=n.indexOf(f);h>-1&&(n.splice(h,1),f.record.name&&i.delete(f.record.name),f.children.forEach(s),f.alias.forEach(s))}}function a(){return n}function c(f){let h=0;for(;h<n.length&&Doe(f,n[h])>=0&&(f.record.path!==n[h].record.path||!N6(f,n[h]));)h++;n.splice(h,0,f),f.record.name&&!j2(f)&&i.set(f.record.name,f)}function u(f,h){let _,g={},p,y;if("name"in f&&f.name){if(_=i.get(f.name),!_)throw Dy(1,{location:f});y=_.record.name,g=ki(W2(h.params,_.keys.filter(E=>!E.optional).map(E=>E.name)),f.params&&W2(f.params,_.keys.map(E=>E.name))),p=_.stringify(g)}else if("path"in f)p=f.path,_=n.find(E=>E.re.test(p)),_&&(g=_.parse(p),y=_.record.name);else{if(_=h.name?i.get(h.name):n.find(E=>E.re.test(h.path)),!_)throw Dy(1,{location:f,currentLocation:h});y=_.record.name,g=ki({},h.params,f.params),p=_.stringify(g)}const C=[];let T=_;for(;T;)C.unshift(T.record),T=T.parent;return{name:y,path:p,params:g,matched:C,meta:Moe(C)}}return e.forEach(f=>r(f)),{addRoute:r,resolve:u,removeRoute:s,getRoutes:a,getRecordMatcher:o}}function W2(e,t){const n={};for(const i of t)i in e&&(n[i]=e[i]);return n}function Roe(e){return{path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:void 0,beforeEnter:e.beforeEnter,props:Noe(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 Noe(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 j2(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Moe(e){return e.reduce((t,n)=>ki(t,n.meta),{})}function q2(e,t){const n={};for(const i in e)n[i]=i in t?t[i]:e[i];return n}function N6(e,t){return t.children.some(n=>n===e||N6(e,n))}const M6=/#/g,Foe=/&/g,zoe=/\//g,Uoe=/=/g,Hoe=/\?/g,F6=/\+/g,Voe=/%5B/g,koe=/%5D/g,z6=/%5E/g,Goe=/%60/g,U6=/%7B/g,Woe=/%7C/g,H6=/%7D/g,joe=/%20/g;function HR(e){return encodeURI(""+e).replace(Woe,"|").replace(Voe,"[").replace(koe,"]")}function qoe(e){return HR(e).replace(U6,"{").replace(H6,"}").replace(z6,"^")}function Z1(e){return HR(e).replace(F6,"%2B").replace(joe,"+").replace(M6,"%23").replace(Foe,"%26").replace(Goe,"`").replace(U6,"{").replace(H6,"}").replace(z6,"^")}function Yoe(e){return Z1(e).replace(Uoe,"%3D")}function $oe(e){return HR(e).replace(M6,"%23").replace(Hoe,"%3F")}function Xoe(e){return e==null?"":$oe(e).replace(zoe,"%2F")}function Gw(e){try{return decodeURIComponent(""+e)}catch{}return""+e}function Koe(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(F6," "),s=r.indexOf("="),a=Gw(s<0?r:r.slice(0,s)),c=s<0?null:Gw(r.slice(s+1));if(a in t){let u=t[a];jl(u)||(u=t[a]=[u]),u.push(c)}else t[a]=c}return t}function Y2(e){let t="";for(let n in e){const i=e[n];if(n=Yoe(n),i==null){i!==void 0&&(t+=(t.length?"&":"")+n);continue}(jl(i)?i.map(r=>r&&Z1(r)):[i&&Z1(i)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function Joe(e){const t={};for(const n in e){const i=e[n];i!==void 0&&(t[n]=jl(i)?i.map(o=>o==null?null:""+o):i==null?i:""+i)}return t}const Qoe=Symbol(""),$2=Symbol(""),VR=Symbol(""),V6=Symbol(""),eL=Symbol("");function D0(){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 Eh(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(Dy(4,{from:n,to:t})):h instanceof Error?a(h):Eoe(h)?a(Dy(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 f=Promise.resolve(u);e.length<3&&(f=f.then(c)),f.catch(h=>a(h))})}function tI(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(Zoe(a)){const u=(a.__vccOpts||a)[t];u&&o.push(Eh(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 f=roe(u)?u.default:u;r.components[s]=f;const _=(f.__vccOpts||f)[t];return _&&Eh(_,n,i,r,s)()}))}}return o}function Zoe(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function X2(e){const t=ar(VR),n=ar(V6),i=Kt(()=>t.resolve(ct(e.to))),o=Kt(()=>{const{matched:c}=i.value,{length:u}=c,f=c[u-1],h=n.matched;if(!f||!h.length)return-1;const _=h.findIndex(vy.bind(null,f));if(_>-1)return _;const g=K2(c[u-2]);return u>1&&K2(f)===g&&h[h.length-1].path!==g?h.findIndex(vy.bind(null,c[u-2])):_}),r=Kt(()=>o.value>-1&&ire(n.params,i.value.params)),s=Kt(()=>o.value>-1&&o.value===n.matched.length-1&&O6(n.params,i.value.params));function a(c={}){return nre(c)?t[ct(e.replace)?"replace":"push"](ct(e.to)).catch(tC):Promise.resolve()}return{route:i,href:Kt(()=>i.value.href),isActive:r,isExactActive:s,navigate:a}}const ere=wr({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:X2,setup(e,{slots:t}){const n=xT(X2(e)),{options:i}=ar(VR),o=Kt(()=>({[J2(e.activeClass,i.linkActiveClass,"router-link-active")]:n.isActive,[J2(e.exactActiveClass,i.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const r=t.default&&t.default(n);return e.custom?r:fv("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},r)}}}),tre=ere;function nre(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 ire(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(!jl(o)||o.length!==i.length||i.some((r,s)=>r!==o[s]))return!1}return!0}function K2(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const J2=(e,t,n)=>e??t??n,ore=wr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const i=ar(eL),o=Kt(()=>e.route||i.value),r=ar($2,0),s=Kt(()=>{let u=ct(r);const{matched:f}=o.value;let h;for(;(h=f[u])&&!h.components;)u++;return u}),a=Kt(()=>o.value.matched[s.value]);Hh($2,Kt(()=>s.value+1)),Hh(Qoe,a),Hh(eL,o);const c=Gi();return Nr(()=>[c.value,a.value,e.name],([u,f,h],[_,g,p])=>{f&&(f.instances[h]=u,g&&g!==f&&u&&u===_&&(f.leaveGuards.size||(f.leaveGuards=g.leaveGuards),f.updateGuards.size||(f.updateGuards=g.updateGuards))),u&&f&&(!g||!vy(f,g)||!_)&&(f.enterCallbacks[h]||[]).forEach(y=>y(u))},{flush:"post"}),()=>{const u=o.value,f=e.name,h=a.value,_=h&&h.components[f];if(!_)return Q2(n.default,{Component:_,route:u});const g=h.props[f],p=g?g===!0?u.params:typeof g=="function"?g(u):g:null,C=fv(_,ki({},p,t,{onVnodeUnmounted:T=>{T.component.isUnmounted&&(h.instances[f]=null)},ref:c}));return Q2(n.default,{Component:C,route:u})||C}}});function Q2(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const k6=ore;function rre(e){const t=Boe(e.routes,e),n=e.parseQuery||Koe,i=e.stringifyQuery||Y2,o=e.history,r=D0(),s=D0(),a=D0(),c=mne(Xd);let u=Xd;Ig&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const f=ZD.bind(null,X=>""+X),h=ZD.bind(null,Xoe),_=ZD.bind(null,Gw);function g(X,Y){let ae,ue;return B6(X)?(ae=t.getRecordMatcher(X),ue=Y):ue=X,t.addRoute(ue,ae)}function p(X){const Y=t.getRecordMatcher(X);Y&&t.removeRoute(Y)}function y(){return t.getRoutes().map(X=>X.record)}function C(X){return!!t.getRecordMatcher(X)}function T(X,Y){if(Y=ki({},Y||c.value),typeof X=="string"){const Q=eI(n,X,Y.path),ie=t.resolve({path:Q.path},Y),de=o.createHref(Q.fullPath);return ki(Q,ie,{params:_(ie.params),hash:Gw(Q.hash),redirectedFrom:void 0,href:de})}let ae;if("path"in X)ae=ki({},X,{path:eI(n,X.path,Y.path).path});else{const Q=ki({},X.params);for(const ie in Q)Q[ie]==null&&delete Q[ie];ae=ki({},X,{params:h(X.params)}),Y.params=h(Y.params)}const ue=t.resolve(ae,Y),re=X.hash||"";ue.params=f(_(ue.params));const he=coe(i,ki({},X,{hash:qoe(re),path:ue.path})),ce=o.createHref(he);return ki({fullPath:he,hash:re,query:i===Y2?Joe(X.query):X.query||{}},ue,{redirectedFrom:void 0,href:ce})}function E(X){return typeof X=="string"?eI(n,X,c.value.path):ki({},X)}function w(X,Y){if(u!==X)return Dy(8,{from:Y,to:X})}function S(X){return z(X)}function P(X){return S(ki(E(X),{replace:!0}))}function O(X){const Y=X.matched[X.matched.length-1];if(Y&&Y.redirect){const{redirect:ae}=Y;let ue=typeof ae=="function"?ae(X):ae;return typeof ue=="string"&&(ue=ue.includes("?")||ue.includes("#")?ue=E(ue):{path:ue},ue.params={}),ki({query:X.query,hash:X.hash,params:"path"in ue?{}:X.params},ue)}}function z(X,Y){const ae=u=T(X),ue=c.value,re=X.state,he=X.force,ce=X.replace===!0,Q=O(ae);if(Q)return z(ki(E(Q),{state:typeof Q=="object"?ki({},re,Q.state):re,force:he,replace:ce}),Y||ae);const ie=ae;ie.redirectedFrom=Y;let de;return!he&&loe(i,ue,ae)&&(de=Dy(16,{to:ie,from:ue}),G(ue,ue,!0,!1)),(de?Promise.resolve(de):F(ie,ue)).catch(me=>Ef(me)?Ef(me,2)?me:W(me):V(me,ie,ue)).then(me=>{if(me){if(Ef(me,2))return z(ki({replace:ce},E(me.to),{state:typeof me.to=="object"?ki({},re,me.to.state):re,force:he}),Y||ie)}else me=v(ie,ue,!0,ce,re);return H(ie,ue,me),me})}function R(X,Y){const ae=w(X,Y);return ae?Promise.reject(ae):Promise.resolve()}function F(X,Y){let ae;const[ue,re,he]=sre(X,Y);ae=tI(ue.reverse(),"beforeRouteLeave",X,Y);for(const Q of ue)Q.leaveGuards.forEach(ie=>{ae.push(Eh(ie,X,Y))});const ce=R.bind(null,X,Y);return ae.push(ce),Y_(ae).then(()=>{ae=[];for(const Q of r.list())ae.push(Eh(Q,X,Y));return ae.push(ce),Y_(ae)}).then(()=>{ae=tI(re,"beforeRouteUpdate",X,Y);for(const Q of re)Q.updateGuards.forEach(ie=>{ae.push(Eh(ie,X,Y))});return ae.push(ce),Y_(ae)}).then(()=>{ae=[];for(const Q of X.matched)if(Q.beforeEnter&&!Y.matched.includes(Q))if(jl(Q.beforeEnter))for(const ie of Q.beforeEnter)ae.push(Eh(ie,X,Y));else ae.push(Eh(Q.beforeEnter,X,Y));return ae.push(ce),Y_(ae)}).then(()=>(X.matched.forEach(Q=>Q.enterCallbacks={}),ae=tI(he,"beforeRouteEnter",X,Y),ae.push(ce),Y_(ae))).then(()=>{ae=[];for(const Q of s.list())ae.push(Eh(Q,X,Y));return ae.push(ce),Y_(ae)}).catch(Q=>Ef(Q,8)?Q:Promise.reject(Q))}function H(X,Y,ae){for(const ue of a.list())ue(X,Y,ae)}function v(X,Y,ae,ue,re){const he=w(X,Y);if(he)return he;const ce=Y===Xd,Q=Ig?history.state:{};ae&&(ue||ce?o.replace(X.fullPath,ki({scroll:ce&&Q&&Q.scroll},re)):o.push(X.fullPath,re)),c.value=X,G(X,Y,ae,ce),W()}let I;function m(){I||(I=o.listen((X,Y,ae)=>{if(!$.listening)return;const ue=T(X),re=O(ue);if(re){z(ki(re,{replace:!0}),ue).catch(tC);return}u=ue;const he=c.value;Ig&&goe(U2(he.fullPath,ae.delta),dv()),F(ue,he).catch(ce=>Ef(ce,12)?ce:Ef(ce,2)?(z(ce.to,ue).then(Q=>{Ef(Q,20)&&!ae.delta&&ae.type===BC.pop&&o.go(-1,!1)}).catch(tC),Promise.reject()):(ae.delta&&o.go(-ae.delta,!1),V(ce,ue,he))).then(ce=>{ce=ce||v(ue,he,!1),ce&&(ae.delta&&!Ef(ce,8)?o.go(-ae.delta,!1):ae.type===BC.pop&&Ef(ce,20)&&o.go(-1,!1)),H(ue,he,ce)}).catch(tC)}))}let D=D0(),L=D0(),M;function V(X,Y,ae){W(X);const ue=L.list();return ue.length?ue.forEach(re=>re(X,Y,ae)):console.error(X),Promise.reject(X)}function k(){return M&&c.value!==Xd?Promise.resolve():new Promise((X,Y)=>{D.add([X,Y])})}function W(X){return M||(M=!X,m(),D.list().forEach(([Y,ae])=>X?ae(X):Y()),D.reset()),X}function G(X,Y,ae,ue){const{scrollBehavior:re}=e;if(!Ig||!re)return Promise.resolve();const he=!ae&&yoe(U2(X.fullPath,0))||(ue||!ae)&&history.state&&history.state.scroll||null;return tp().then(()=>re(X,Y,he)).then(ce=>ce&&_oe(ce)).catch(ce=>V(ce,X,Y))}const K=X=>o.go(X);let q;const te=new Set,$={currentRoute:c,listening:!0,addRoute:g,removeRoute:p,hasRoute:C,getRoutes:y,resolve:T,options:e,push:S,replace:P,go:K,back:()=>K(-1),forward:()=>K(1),beforeEach:r.add,beforeResolve:s.add,afterEach:a.add,onError:L.add,isReady:k,install(X){const Y=this;X.component("RouterLink",tre),X.component("RouterView",k6),X.config.globalProperties.$router=Y,Object.defineProperty(X.config.globalProperties,"$route",{enumerable:!0,get:()=>ct(c)}),Ig&&!q&&c.value===Xd&&(q=!0,S(o.location).catch(re=>{}));const ae={};for(const re in Xd)ae[re]=Kt(()=>c.value[re]);X.provide(VR,Y),X.provide(V6,xT(ae)),X.provide(eL,c);const ue=X.unmount;te.add(X),X.unmount=function(){te.delete(X),te.size<1&&(u=Xd,I&&I(),I=null,c.value=Xd,q=!1,M=!1),ue()}}};return $}function Y_(e){return e.reduce((t,n)=>t.then(()=>n()),Promise.resolve())}function sre(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=>vy(u,a))?i.push(a):n.push(a));const c=e.matched[s];c&&(t.matched.find(u=>vy(u,c))||o.push(c))}return[n,i,o]}const are=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},cre={__name:"App",setup(e){return(t,n)=>(Gn(),Ma(ct(k6)))}},lre=are(cre,[["__scopeId","data-v-0969e94e"]]);var ure=typeof global=="object"&&global&&global.Object===Object&&global;const G6=ure;var fre=typeof self=="object"&&self&&self.Object===Object&&self,dre=G6||fre||Function("return this")();const bd=dre;var hre=bd.Symbol;const Gu=hre;var W6=Object.prototype,pre=W6.hasOwnProperty,mre=W6.toString,I0=Gu?Gu.toStringTag:void 0;function _re(e){var t=pre.call(e,I0),n=e[I0];try{e[I0]=void 0;var i=!0}catch{}var o=mre.call(e);return i&&(t?e[I0]=n:delete e[I0]),o}var gre=Object.prototype,yre=gre.toString;function Are(e){return yre.call(e)}var Cre="[object Null]",Tre="[object Undefined]",Z2=Gu?Gu.toStringTag:void 0;function Zy(e){return e==null?e===void 0?Tre:Cre:Z2&&Z2 in Object(e)?_re(e):Are(e)}function Iy(e){return e!=null&&typeof e=="object"}var bre="[object Symbol]";function kR(e){return typeof e=="symbol"||Iy(e)&&Zy(e)==bre}function Ere(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 xre=Array.isArray;const ud=xre;var wre=1/0,e3=Gu?Gu.prototype:void 0,t3=e3?e3.toString:void 0;function j6(e){if(typeof e=="string")return e;if(ud(e))return Ere(e,j6)+"";if(kR(e))return t3?t3.call(e):"";var t=e+"";return t=="0"&&1/e==-wre?"-0":t}function Ww(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Sre(e){return e}var vre="[object AsyncFunction]",Dre="[object Function]",Ire="[object GeneratorFunction]",Pre="[object Proxy]";function q6(e){if(!Ww(e))return!1;var t=Zy(e);return t==Dre||t==Ire||t==vre||t==Pre}var Ore=bd["__core-js_shared__"];const nI=Ore;var n3=function(){var e=/[^.]+$/.exec(nI&&nI.keys&&nI.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Lre(e){return!!n3&&n3 in e}var Bre=Function.prototype,Rre=Bre.toString;function __(e){if(e!=null){try{return Rre.call(e)}catch{}try{return e+""}catch{}}return""}var Nre=/[\\^$.*+?()[\]{}|]/g,Mre=/^\[object .+?Constructor\]$/,Fre=Function.prototype,zre=Object.prototype,Ure=Fre.toString,Hre=zre.hasOwnProperty,Vre=RegExp("^"+Ure.call(Hre).replace(Nre,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kre(e){if(!Ww(e)||Lre(e))return!1;var t=q6(e)?Vre:Mre;return t.test(__(e))}function Gre(e,t){return e==null?void 0:e[t]}function g_(e,t){var n=Gre(e,t);return kre(n)?n:void 0}var Wre=g_(bd,"WeakMap");const tL=Wre;function jre(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 qre=800,Yre=16,$re=Date.now;function Xre(e){var t=0,n=0;return function(){var i=$re(),o=Yre-(i-n);if(n=i,o>0){if(++t>=qre)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Kre(e){return function(){return e}}var Jre=function(){try{var e=g_(Object,"defineProperty");return e({},"",{}),e}catch{}}();const jw=Jre;var Qre=jw?function(e,t){return jw(e,"toString",{configurable:!0,enumerable:!1,value:Kre(t),writable:!0})}:Sre;const Zre=Qre;var ese=Xre(Zre);const tse=ese;var nse=9007199254740991,ise=/^(?:0|[1-9]\d*)$/;function GR(e,t){var n=typeof e;return t=t??nse,!!t&&(n=="number"||n!="symbol"&&ise.test(e))&&e>-1&&e%1==0&&e<t}function ose(e,t,n){t=="__proto__"&&jw?jw(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function WR(e,t){return e===t||e!==e&&t!==t}var rse=Object.prototype,sse=rse.hasOwnProperty;function ase(e,t,n){var i=e[t];(!(sse.call(e,t)&&WR(i,n))||n===void 0&&!(t in e))&&ose(e,t,n)}var i3=Math.max;function cse(e,t,n){return t=i3(t===void 0?e.length-1:t,0),function(){for(var i=arguments,o=-1,r=i3(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),jre(e,this,a)}}var lse=9007199254740991;function jR(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=lse}function use(e){return e!=null&&jR(e.length)&&!q6(e)}var fse=Object.prototype;function dse(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||fse;return e===n}function hse(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}var pse="[object Arguments]";function o3(e){return Iy(e)&&Zy(e)==pse}var Y6=Object.prototype,mse=Y6.hasOwnProperty,_se=Y6.propertyIsEnumerable,gse=o3(function(){return arguments}())?o3:function(e){return Iy(e)&&mse.call(e,"callee")&&!_se.call(e,"callee")};const qR=gse;function yse(){return!1}var $6=typeof $f=="object"&&$f&&!$f.nodeType&&$f,r3=$6&&typeof Xf=="object"&&Xf&&!Xf.nodeType&&Xf,Ase=r3&&r3.exports===$6,s3=Ase?bd.Buffer:void 0,Cse=s3?s3.isBuffer:void 0,Tse=Cse||yse;const nL=Tse;var bse="[object Arguments]",Ese="[object Array]",xse="[object Boolean]",wse="[object Date]",Sse="[object Error]",vse="[object Function]",Dse="[object Map]",Ise="[object Number]",Pse="[object Object]",Ose="[object RegExp]",Lse="[object Set]",Bse="[object String]",Rse="[object WeakMap]",Nse="[object ArrayBuffer]",Mse="[object DataView]",Fse="[object Float32Array]",zse="[object Float64Array]",Use="[object Int8Array]",Hse="[object Int16Array]",Vse="[object Int32Array]",kse="[object Uint8Array]",Gse="[object Uint8ClampedArray]",Wse="[object Uint16Array]",jse="[object Uint32Array]",lo={};lo[Fse]=lo[zse]=lo[Use]=lo[Hse]=lo[Vse]=lo[kse]=lo[Gse]=lo[Wse]=lo[jse]=!0;lo[bse]=lo[Ese]=lo[Nse]=lo[xse]=lo[Mse]=lo[wse]=lo[Sse]=lo[vse]=lo[Dse]=lo[Ise]=lo[Pse]=lo[Ose]=lo[Lse]=lo[Bse]=lo[Rse]=!1;function qse(e){return Iy(e)&&jR(e.length)&&!!lo[Zy(e)]}function Yse(e){return function(t){return e(t)}}var X6=typeof $f=="object"&&$f&&!$f.nodeType&&$f,iC=X6&&typeof Xf=="object"&&Xf&&!Xf.nodeType&&Xf,$se=iC&&iC.exports===X6,iI=$se&&G6.process,Xse=function(){try{var e=iC&&iC.require&&iC.require("util").types;return e||iI&&iI.binding&&iI.binding("util")}catch{}}();const a3=Xse;var c3=a3&&a3.isTypedArray,Kse=c3?Yse(c3):qse;const K6=Kse;var Jse=Object.prototype,Qse=Jse.hasOwnProperty;function Zse(e,t){var n=ud(e),i=!n&&qR(e),o=!n&&!i&&nL(e),r=!n&&!i&&!o&&K6(e),s=n||i||o||r,a=s?hse(e.length,String):[],c=a.length;for(var u in e)(t||Qse.call(e,u))&&!(s&&(u=="length"||o&&(u=="offset"||u=="parent")||r&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||GR(u,c)))&&a.push(u);return a}function eae(e,t){return function(n){return e(t(n))}}var tae=eae(Object.keys,Object);const nae=tae;var iae=Object.prototype,oae=iae.hasOwnProperty;function rae(e){if(!dse(e))return nae(e);var t=[];for(var n in Object(e))oae.call(e,n)&&n!="constructor"&&t.push(n);return t}function sae(e){return use(e)?Zse(e):rae(e)}var aae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cae=/^\w*$/;function lae(e,t){if(ud(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||kR(e)?!0:cae.test(e)||!aae.test(e)||t!=null&&e in Object(t)}var uae=g_(Object,"create");const RC=uae;function fae(){this.__data__=RC?RC(null):{},this.size=0}function dae(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var hae="__lodash_hash_undefined__",pae=Object.prototype,mae=pae.hasOwnProperty;function _ae(e){var t=this.__data__;if(RC){var n=t[e];return n===hae?void 0:n}return mae.call(t,e)?t[e]:void 0}var gae=Object.prototype,yae=gae.hasOwnProperty;function Aae(e){var t=this.__data__;return RC?t[e]!==void 0:yae.call(t,e)}var Cae="__lodash_hash_undefined__";function Tae(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=RC&&t===void 0?Cae:t,this}function $m(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])}}$m.prototype.clear=fae;$m.prototype.delete=dae;$m.prototype.get=_ae;$m.prototype.has=Aae;$m.prototype.set=Tae;function bae(){this.__data__=[],this.size=0}function hv(e,t){for(var n=e.length;n--;)if(WR(e[n][0],t))return n;return-1}var Eae=Array.prototype,xae=Eae.splice;function wae(e){var t=this.__data__,n=hv(t,e);if(n<0)return!1;var i=t.length-1;return n==i?t.pop():xae.call(t,n,1),--this.size,!0}function Sae(e){var t=this.__data__,n=hv(t,e);return n<0?void 0:t[n][1]}function vae(e){return hv(this.__data__,e)>-1}function Dae(e,t){var n=this.__data__,i=hv(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this}function Ed(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])}}Ed.prototype.clear=bae;Ed.prototype.delete=wae;Ed.prototype.get=Sae;Ed.prototype.has=vae;Ed.prototype.set=Dae;var Iae=g_(bd,"Map");const NC=Iae;function Pae(){this.size=0,this.__data__={hash:new $m,map:new(NC||Ed),string:new $m}}function Oae(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function pv(e,t){var n=e.__data__;return Oae(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Lae(e){var t=pv(this,e).delete(e);return this.size-=t?1:0,t}function Bae(e){return pv(this,e).get(e)}function Rae(e){return pv(this,e).has(e)}function Nae(e,t){var n=pv(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this}function xd(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])}}xd.prototype.clear=Pae;xd.prototype.delete=Lae;xd.prototype.get=Bae;xd.prototype.has=Rae;xd.prototype.set=Nae;var Mae="Expected a function";function YR(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Mae);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(YR.Cache||xd),n}YR.Cache=xd;var Fae=500;function zae(e){var t=YR(e,function(i){return n.size===Fae&&n.clear(),i}),n=t.cache;return t}var Uae=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Hae=/\\(\\)?/g,Vae=zae(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Uae,function(n,i,o,r){t.push(o?r.replace(Hae,"$1"):i||n)}),t});const kae=Vae;function Gae(e){return e==null?"":j6(e)}function mv(e,t){return ud(e)?e:lae(e,t)?[e]:kae(Gae(e))}var Wae=1/0;function $R(e){if(typeof e=="string"||kR(e))return e;var t=e+"";return t=="0"&&1/e==-Wae?"-0":t}function J6(e,t){t=mv(t,e);for(var n=0,i=t.length;e!=null&&n<i;)e=e[$R(t[n++])];return n&&n==i?e:void 0}function jae(e,t,n){var i=e==null?void 0:J6(e,t);return i===void 0?n:i}function Q6(e,t){for(var n=-1,i=t.length,o=e.length;++n<i;)e[o+n]=t[n];return e}var l3=Gu?Gu.isConcatSpreadable:void 0;function qae(e){return ud(e)||qR(e)||!!(l3&&e&&e[l3])}function Z6(e,t,n,i,o){var r=-1,s=e.length;for(n||(n=qae),o||(o=[]);++r<s;){var a=e[r];t>0&&n(a)?t>1?Z6(a,t-1,n,i,o):Q6(o,a):i||(o[o.length]=a)}return o}function Yae(e){var t=e==null?0:e.length;return t?Z6(e,1):[]}function $ae(e){return tse(cse(e,void 0,Yae),e+"")}function Xae(){this.__data__=new Ed,this.size=0}function Kae(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Jae(e){return this.__data__.get(e)}function Qae(e){return this.__data__.has(e)}var Zae=200;function ece(e,t){var n=this.__data__;if(n instanceof Ed){var i=n.__data__;if(!NC||i.length<Zae-1)return i.push([e,t]),this.size=++n.size,this;n=this.__data__=new xd(i)}return n.set(e,t),this.size=n.size,this}function Vh(e){var t=this.__data__=new Ed(e);this.size=t.size}Vh.prototype.clear=Xae;Vh.prototype.delete=Kae;Vh.prototype.get=Jae;Vh.prototype.has=Qae;Vh.prototype.set=ece;function tce(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 nce(){return[]}var ice=Object.prototype,oce=ice.propertyIsEnumerable,u3=Object.getOwnPropertySymbols,rce=u3?function(e){return e==null?[]:(e=Object(e),tce(u3(e),function(t){return oce.call(e,t)}))}:nce;const sce=rce;function ace(e,t,n){var i=t(e);return ud(e)?i:Q6(i,n(e))}function f3(e){return ace(e,sae,sce)}var cce=g_(bd,"DataView");const iL=cce;var lce=g_(bd,"Promise");const oL=lce;var uce=g_(bd,"Set");const rL=uce;var d3="[object Map]",fce="[object Object]",h3="[object Promise]",p3="[object Set]",m3="[object WeakMap]",_3="[object DataView]",dce=__(iL),hce=__(NC),pce=__(oL),mce=__(rL),_ce=__(tL),mm=Zy;(iL&&mm(new iL(new ArrayBuffer(1)))!=_3||NC&&mm(new NC)!=d3||oL&&mm(oL.resolve())!=h3||rL&&mm(new rL)!=p3||tL&&mm(new tL)!=m3)&&(mm=function(e){var t=Zy(e),n=t==fce?e.constructor:void 0,i=n?__(n):"";if(i)switch(i){case dce:return _3;case hce:return d3;case pce:return h3;case mce:return p3;case _ce:return m3}return t});const g3=mm;var gce=bd.Uint8Array;const y3=gce;var yce="__lodash_hash_undefined__";function Ace(e){return this.__data__.set(e,yce),this}function Cce(e){return this.__data__.has(e)}function qw(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new xd;++t<n;)this.add(e[t])}qw.prototype.add=qw.prototype.push=Ace;qw.prototype.has=Cce;function Tce(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 bce(e,t){return e.has(t)}var Ece=1,xce=2;function e9(e,t,n,i,o,r){var s=n&Ece,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var u=r.get(e),f=r.get(t);if(u&&f)return u==t&&f==e;var h=-1,_=!0,g=n&xce?new qw:void 0;for(r.set(e,t),r.set(t,e);++h<a;){var p=e[h],y=t[h];if(i)var C=s?i(y,p,h,t,e,r):i(p,y,h,e,t,r);if(C!==void 0){if(C)continue;_=!1;break}if(g){if(!Tce(t,function(T,E){if(!bce(g,E)&&(p===T||o(p,T,n,i,r)))return g.push(E)})){_=!1;break}}else if(!(p===y||o(p,y,n,i,r))){_=!1;break}}return r.delete(e),r.delete(t),_}function wce(e){var t=-1,n=Array(e.size);return e.forEach(function(i,o){n[++t]=[o,i]}),n}function Sce(e){var t=-1,n=Array(e.size);return e.forEach(function(i){n[++t]=i}),n}var vce=1,Dce=2,Ice="[object Boolean]",Pce="[object Date]",Oce="[object Error]",Lce="[object Map]",Bce="[object Number]",Rce="[object RegExp]",Nce="[object Set]",Mce="[object String]",Fce="[object Symbol]",zce="[object ArrayBuffer]",Uce="[object DataView]",A3=Gu?Gu.prototype:void 0,oI=A3?A3.valueOf:void 0;function Hce(e,t,n,i,o,r,s){switch(n){case Uce:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case zce:return!(e.byteLength!=t.byteLength||!r(new y3(e),new y3(t)));case Ice:case Pce:case Bce:return WR(+e,+t);case Oce:return e.name==t.name&&e.message==t.message;case Rce:case Mce:return e==t+"";case Lce:var a=wce;case Nce:var c=i&vce;if(a||(a=Sce),e.size!=t.size&&!c)return!1;var u=s.get(e);if(u)return u==t;i|=Dce,s.set(e,t);var f=e9(a(e),a(t),i,o,r,s);return s.delete(e),f;case Fce:if(oI)return oI.call(e)==oI.call(t)}return!1}var Vce=1,kce=Object.prototype,Gce=kce.hasOwnProperty;function Wce(e,t,n,i,o,r){var s=n&Vce,a=f3(e),c=a.length,u=f3(t),f=u.length;if(c!=f&&!s)return!1;for(var h=c;h--;){var _=a[h];if(!(s?_ in t:Gce.call(t,_)))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 C=s;++h<c;){_=a[h];var T=e[_],E=t[_];if(i)var w=s?i(E,T,_,t,e,r):i(T,E,_,e,t,r);if(!(w===void 0?T===E||o(T,E,n,i,r):w)){y=!1;break}C||(C=_=="constructor")}if(y&&!C){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 jce=1,C3="[object Arguments]",T3="[object Array]",Lb="[object Object]",qce=Object.prototype,b3=qce.hasOwnProperty;function Yce(e,t,n,i,o,r){var s=ud(e),a=ud(t),c=s?T3:g3(e),u=a?T3:g3(t);c=c==C3?Lb:c,u=u==C3?Lb:u;var f=c==Lb,h=u==Lb,_=c==u;if(_&&nL(e)){if(!nL(t))return!1;s=!0,f=!1}if(_&&!f)return r||(r=new Vh),s||K6(e)?e9(e,t,n,i,o,r):Hce(e,t,c,n,i,o,r);if(!(n&jce)){var g=f&&b3.call(e,"__wrapped__"),p=h&&b3.call(t,"__wrapped__");if(g||p){var y=g?e.value():e,C=p?t.value():t;return r||(r=new Vh),o(y,C,n,i,r)}}return _?(r||(r=new Vh),Wce(e,t,n,i,o,r)):!1}function t9(e,t,n,i,o){return e===t?!0:e==null||t==null||!Iy(e)&&!Iy(t)?e!==e&&t!==t:Yce(e,t,n,i,t9,o)}function $ce(e,t){return e!=null&&t in Object(e)}function Xce(e,t,n){t=mv(t,e);for(var i=-1,o=t.length,r=!1;++i<o;){var s=$R(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&&jR(o)&&GR(s,o)&&(ud(e)||qR(e)))}function Kce(e,t){return e!=null&&Xce(e,t,$ce)}function Jce(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 Qce(e,t){return t9(e,t)}function Zce(e){return e==null}function ele(e,t,n,i){if(!Ww(e))return e;t=mv(t,e);for(var o=-1,r=t.length,s=r-1,a=e;a!=null&&++o<r;){var c=$R(t[o]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return e;if(o!=s){var f=a[c];u=i?i(f,c,a):void 0,u===void 0&&(u=Ww(f)?f:GR(t[o+1])?[]:{})}ase(a,c,u),a=a[c]}return e}function tle(e,t,n){for(var i=-1,o=t.length,r={};++i<o;){var s=t[i],a=J6(e,s);n(a,s)&&ele(r,mv(s,e),a)}return r}function nle(e,t){return tle(e,t,function(n,i){return Kce(e,i)})}var ile=$ae(function(e,t){return e==null?{}:nle(e,t)});const ole=ile;var E3;const ql=typeof window<"u",Yw=e=>typeof e=="boolean",Py=e=>typeof e=="number",rle=e=>typeof e=="string",sle=()=>{};ql&&((E3=window==null?void 0:window.navigator)!=null&&E3.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function n9(e){return typeof e=="function"?e():ct(e)}function ale(e){return e}function XR(e){return Gte()?(P8(e),!0):!1}function cle(e,t=!0){tf()?ef(e):t?e():tp(e)}function sL(e,t,n={}){const{immediate:i=!0}=n,o=Gi(!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)},n9(t))}return i&&(o.value=!0,ql&&c()),XR(a),{isPending:o,start:c,stop:a}}function i9(e){var t;const n=n9(e);return(t=n==null?void 0:n.$el)!=null?t:n}const o9=ql?window:void 0;function lle(...e){let t,n,i,o;if(rle(e[0])||Array.isArray(e[0])?([n,i,o]=e,t=o9):[t,n,i,o]=e,!t)return sle;Array.isArray(n)||(n=[n]),Array.isArray(i)||(i=[i]);const r=[],s=()=>{r.forEach(f=>f()),r.length=0},a=(f,h,_)=>(f.addEventListener(h,_,o),()=>f.removeEventListener(h,_,o)),c=Nr(()=>i9(t),f=>{s(),f&&r.push(...n.flatMap(h=>i.map(_=>a(f,h,_))))},{immediate:!0,flush:"post"}),u=()=>{c(),s()};return XR(u),u}function ule(e,t=!1){const n=Gi(),i=()=>n.value=Boolean(e());return i(),cle(i,t),n}const aL=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},cL="__vueuse_ssr_handlers__";aL[cL]=aL[cL]||{};aL[cL];var x3=Object.getOwnPropertySymbols,fle=Object.prototype.hasOwnProperty,dle=Object.prototype.propertyIsEnumerable,hle=(e,t)=>{var n={};for(var i in e)fle.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&x3)for(var i of x3(e))t.indexOf(i)<0&&dle.call(e,i)&&(n[i]=e[i]);return n};function ple(e,t,n={}){const i=n,{window:o=o9}=i,r=hle(i,["window"]);let s;const a=ule(()=>o&&"ResizeObserver"in o),c=()=>{s&&(s.disconnect(),s=void 0)},u=Nr(()=>i9(e),h=>{c(),a.value&&o&&h&&(s=new ResizeObserver(t),s.observe(h,r))},{immediate:!0,flush:"post"}),f=()=>{c(),u()};return XR(f),{isSupported:a,stop:f}}var w3;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(w3||(w3={}));var mle=Object.defineProperty,S3=Object.getOwnPropertySymbols,_le=Object.prototype.hasOwnProperty,gle=Object.prototype.propertyIsEnumerable,v3=(e,t,n)=>t in e?mle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yle=(e,t)=>{for(var n in t||(t={}))_le.call(t,n)&&v3(e,n,t[n]);if(S3)for(var n of S3(t))gle.call(t,n)&&v3(e,n,t[n]);return e};const Ale={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]};yle({linear:ale},Ale);const $w=e=>e===void 0,Cle=e=>typeof Element>"u"?!1:e instanceof Element,Tle=e=>qi(e)?!Number.isNaN(Number(e)):!1,D3=e=>Object.keys(e);class ble extends Error{constructor(t){super(t),this.name="ElementPlusError"}}function Ele(e,t){throw new ble(`[${e}] ${t}`)}const r9=(e="")=>e.split(" ").filter(t=>!!t.trim()),I3=(e,t)=>{if(!e||!t)return!1;if(t.includes(" "))throw new Error("className should not contain space.");return e.classList.contains(t)},xle=(e,t)=>{!e||!t.trim()||e.classList.add(...r9(t))},wle=(e,t)=>{!e||!t.trim()||e.classList.remove(...r9(t))},Sle=(e,t)=>{var n;if(!ql||!e||!t)return"";let i=Wl(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 KR(e,t="px"){if(!e)return"";if(Py(e)||Tle(e))return`${e}${t}`;if(qi(e))return e}let Bb;const vle=e=>{var t;if(!ql)return 0;if(Bb!==void 0)return Bb;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),Bb=i-r,Bb};/*! Element Plus Icons Vue v2.0.10 */var vT=(e,t)=>{let n=e.__vccOpts||e;for(let[i,o]of t)n[i]=o;return n},Dle={name:"CircleCloseFilled"},Ile={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Ple=rs("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),Ole=[Ple];function Lle(e,t,n,i,o,r){return Gn(),mo("svg",Ile,Ole)}var s9=vT(Dle,[["render",Lle],["__file","circle-close-filled.vue"]]),Ble={name:"Close"},Rle={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Nle=rs("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),Mle=[Nle];function Fle(e,t,n,i,o,r){return Gn(),mo("svg",Rle,Mle)}var a9=vT(Ble,[["render",Fle],["__file","close.vue"]]),zle={name:"InfoFilled"},Ule={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Hle=rs("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),Vle=[Hle];function kle(e,t,n,i,o,r){return Gn(),mo("svg",Ule,Vle)}var c9=vT(zle,[["render",kle],["__file","info-filled.vue"]]),Gle={name:"SuccessFilled"},Wle={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},jle=rs("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),qle=[jle];function Yle(e,t,n,i,o,r){return Gn(),mo("svg",Wle,qle)}var l9=vT(Gle,[["render",Yle],["__file","success-filled.vue"]]),$le={name:"WarningFilled"},Xle={viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg"},Kle=rs("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),Jle=[Kle];function Qle(e,t,n,i,o,r){return Gn(),mo("svg",Xle,Jle)}var u9=vT($le,[["render",Qle],["__file","warning-filled.vue"]]);const f9="__epPropKey",kc=e=>e,Zle=e=>zi(e)&&!!e[f9],d9=(e,t)=>{if(!zi(e)||Zle(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 f=!1,h=[];if(n&&(h=Array.from(n),ii(e,"default")&&h.push(o),f||(f=h.includes(u))),s&&(f||(f=s(u))),!f&&h.length>0){const _=[...new Set(h)].map(g=>JSON.stringify(g)).join(", ");Tne(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${_}], got value ${JSON.stringify(u)}.`)}return f}:void 0,[f9]:!0};return ii(e,"default")&&(c.default=o),c},nf=e=>Jce(Object.entries(e).map(([t,n])=>[t,d9(n,t)])),h9=kc([String,Object,Function]),eue={Close:a9,SuccessFilled:l9,InfoFilled:c9,WarningFilled:u9,CircleCloseFilled:s9},P3={success:l9,warning:u9,error:s9,info:c9},DT=(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},tue=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),p9=e=>(e.install=ya,e),JR={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"},e0="update:modelValue",nue=["","default","small","large"];var jx=(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))(jx||{});const iue=e=>e,t0=Symbol("checkboxGroupContextKey"),m9=Symbol(),QR=Symbol("formContextKey"),_9=Symbol("formItemContextKey"),oue=Symbol("rowContextKey"),g9=e=>{const t=tf();return Kt(()=>{var n,i;return(i=((n=t.proxy)==null?void 0:n.$props)[e])!=null?i:void 0})},Xw=Gi();function y_(e,t=void 0){const n=tf()?ar(m9,Xw):Xw;return e?Kt(()=>{var i,o;return(o=(i=n.value)==null?void 0:i[e])!=null?o:t}):n}const rue=(e,t,n=!1)=>{var i;const o=!!tf(),r=o?y_():void 0,s=(i=t==null?void 0:t.provide)!=null?i:o?Hh:void 0;if(!s)return;const a=Kt(()=>{const c=ct(e);return r!=null&&r.value?sue(r.value,c):c});return s(m9,a),(n||!Xw.value)&&(Xw.value=a.value),a},sue=(e,t)=>{var n;const i=[...new Set([...D3(e),...D3(t)])],o={};for(const r of i)o[r]=(n=t[r])!=null?n:e[r];return o},ZR=d9({type:String,values:nue,required:!1}),O3=(e,t={})=>{const n=Gi(void 0),i=t.prop?n:g9("size"),o=t.global?n:y_("size"),r=t.form?{size:void 0}:ar(QR,void 0),s=t.formItem?{size:void 0}:ar(_9,void 0);return Kt(()=>i.value||ct(e)||(s==null?void 0:s.size)||(r==null?void 0:r.size)||o.value||"")},aue=e=>{const t=g9("disabled"),n=ar(QR,void 0);return Kt(()=>t.value||ct(e)||(n==null?void 0:n.disabled)||!1)},L3=({from:e,replacement:t,scope:n,version:i,ref:o,type:r="API"},s)=>{Nr(()=>ct(s),a=>{},{immediate:!0})},eN="el",cue="is-",kp=(e,t,n,i,o)=>{let r=`${e}-${t}`;return n&&(r+=`-${n}`),i&&(r+=`__${i}`),o&&(r+=`--${o}`),r},of=e=>{const t=y_("namespace",eN);return{namespace:t,b:(p="")=>kp(t.value,e,p,"",""),e:p=>p?kp(t.value,e,"",p,""):"",m:p=>p?kp(t.value,e,"","",p):"",be:(p,y)=>p&&y?kp(t.value,e,p,y,""):"",em:(p,y)=>p&&y?kp(t.value,e,"",p,y):"",bm:(p,y)=>p&&y?kp(t.value,e,p,"",y):"",bem:(p,y,C)=>p&&y&&C?kp(t.value,e,p,y,C):"",is:(p,...y)=>{const C=y.length>=1?y[0]:!0;return p&&C?`${cue}${p}`:""},cssVar:p=>{const y={};for(const C in p)p[C]&&(y[`--${t.value}-${C}`]=p[C]);return y},cssVarName:p=>`--${t.value}-${p}`,cssVarBlock:p=>{const y={};for(const C in p)p[C]&&(y[`--${t.value}-${e}-${C}`]=p[C]);return y},cssVarBlockName:p=>`--${t.value}-${e}-${p}`}},B3={prefix:Math.floor(Math.random()*1e4),current:0},lue=Symbol("elIdInjection"),uue=()=>tf()?ar(lue,B3):B3,lL=e=>{const t=uue(),n=y_("namespace",eN);return Kt(()=>ct(e)||`${n.value}-id-${t.prefix}-${t.current++}`)},tN=()=>{const e=ar(QR,void 0),t=ar(_9,void 0);return{form:e,formItem:t}},y9=(e,{formItemContext:t,disableIdGeneration:n,disableIdManagement:i})=>{n||(n=Gi(!1)),i||(i=Gi(!1));const o=Gi();let r;const s=Kt(()=>{var a;return!!(!e.label&&t&&t.inputIds&&((a=t.inputIds)==null?void 0:a.length)<=1)});return ef(()=>{r=Nr([$8(e,"id"),n],([a,c])=>{const u=a??(c?void 0:lL().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})}),LR(()=>{r&&r(),t!=null&&t.removeInputId&&o.value&&t.removeInputId(o.value)}),{isLabeledByFormItem:s,inputId:o}};var fue={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 due=e=>(t,n)=>hue(t,n,ct(e)),hue=(e,t,n)=>jae(n,e,e).replace(/\{(\w+)\}/g,(i,o)=>{var r;return`${(r=t==null?void 0:t[o])!=null?r:`{${o}}`}`}),pue=e=>{const t=Kt(()=>ct(e).name),n=Vo(e)?e:Gi(e);return{lang:t,locale:n,t:due(e)}},mue=()=>{const e=y_("locale");return pue(Kt(()=>e.value||fue))},_ue=e=>{Vo(e)||Ele("[useLockscreen]","You need to pass a ref param to this function");const t=of("popup"),n=K8(()=>t.bm("parent","hidden"));if(!ql||I3(document.body,n.value))return;let i=0,o=!1,r="0";const s=()=>{setTimeout(()=>{wle(document.body,n.value),o&&(document.body.style.width=r)},200)};Nr(e,a=>{if(!a){s();return}o=!I3(document.body,n.value),o&&(r=document.body.style.width),i=vle(t.namespace.value);const c=document.documentElement.clientHeight<document.body.scrollHeight,u=Sle(document.body,"overflowY");i>0&&(c||u==="scroll")&&o&&(document.body.style.width=`calc(100% - ${i}px)`),xle(document.body,n.value)}),P8(()=>s())},gue=e=>{if(!e)return{onClick:ya,onMousedown:ya,onMouseup:ya};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 Pg=[];const R3=e=>{const t=e;t.key===JR.esc&&Pg.forEach(n=>n(t))},yue=e=>{ef(()=>{Pg.length===0&&document.addEventListener("keydown",R3),ql&&Pg.push(e)}),wT(()=>{Pg=Pg.filter(t=>t!==e),Pg.length===0&&ql&&document.removeEventListener("keydown",R3)})},N3=Gi(0),A9=()=>{const e=y_("zIndex",2e3),t=Kt(()=>e.value+N3.value);return{initialZIndex:e,currentZIndex:t,nextZIndex:()=>(N3.value++,t.value)}};var wd=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n};const Aue=nf({size:{type:kc([Number,String])},color:{type:String}}),Cue=wr({name:"ElIcon",inheritAttrs:!1}),Tue=wr({...Cue,props:Aue,setup(e){const t=e,n=of("icon"),i=Kt(()=>{const{size:o,color:r}=t;return!o&&!r?{}:{fontSize:$w(o)?void 0:KR(o),"--color":r}});return(o,r)=>(Gn(),mo("i",zR({class:ct(n).b(),style:ct(i)},o.$attrs),[ga(o.$slots,"default")],16))}});var bue=wd(Tue,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const uL=DT(bue),rI="focus-trap.focus-after-trapped",sI="focus-trap.focus-after-released",Eue="focus-trap.focusout-prevented",M3={cancelable:!0,bubbles:!1},xue={cancelable:!0,bubbles:!1},F3="focusAfterTrapped",z3="focusAfterReleased",wue=Symbol("elFocusTrap"),nN=Gi(),_v=Gi(0),iN=Gi(0);let Rb=0;const C9=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},U3=(e,t)=>{for(const n of e)if(!Sue(n,t))return n},Sue=(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},vue=e=>{const t=C9(e),n=U3(t,e),i=U3(t.reverse(),e);return[n,i]},Due=e=>e instanceof HTMLInputElement&&"select"in e,gh=(e,t)=>{if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),iN.value=window.performance.now(),e!==n&&Due(e)&&t&&e.select()}};function H3(e,t){const n=[...e],i=e.indexOf(t);return i!==-1&&n.splice(i,1),n}const Iue=()=>{let e=[];return{push:i=>{const o=e[0];o&&i!==o&&o.pause(),e=H3(e,i),e.unshift(i)},remove:i=>{var o,r;e=H3(e,i),(r=(o=e[0])==null?void 0:o.resume)==null||r.call(o)}}},Pue=(e,t=!1)=>{const n=document.activeElement;for(const i of e)if(gh(i,t),document.activeElement!==n)return},V3=Iue(),Oue=()=>_v.value>iN.value,Nb=()=>{nN.value="pointer",_v.value=window.performance.now()},k3=()=>{nN.value="keyboard",_v.value=window.performance.now()},Lue=()=>(ef(()=>{Rb===0&&(document.addEventListener("mousedown",Nb),document.addEventListener("touchstart",Nb),document.addEventListener("keydown",k3)),Rb++}),wT(()=>{Rb--,Rb<=0&&(document.removeEventListener("mousedown",Nb),document.removeEventListener("touchstart",Nb),document.removeEventListener("keydown",k3))}),{focusReason:nN,lastUserFocusTimestamp:_v,lastAutomatedFocusTimestamp:iN}),Mb=e=>new CustomEvent(Eue,{...xue,detail:e}),Bue=wr({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[F3,z3,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const n=Gi();let i,o;const{focusReason:r}=Lue();yue(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:C,ctrlKey:T,metaKey:E,currentTarget:w,shiftKey:S}=p,{loop:P}=e,O=y===JR.tab&&!C&&!T&&!E,z=document.activeElement;if(O&&z){const R=w,[F,H]=vue(R);if(F&&H){if(!S&&z===H){const I=Mb({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||(p.preventDefault(),P&&gh(F,!0))}else if(S&&[F,R].includes(z)){const I=Mb({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||(p.preventDefault(),P&&gh(H,!0))}}else if(z===R){const I=Mb({focusReason:r.value});t("focusout-prevented",I),I.defaultPrevented||p.preventDefault()}}};Hh(wue,{focusTrapRef:n,onKeydown:a}),Nr(()=>e.focusTrapEl,p=>{p&&(n.value=p)},{immediate:!0}),Nr([n],([p],[y])=>{p&&(p.addEventListener("keydown",a),p.addEventListener("focusin",f),p.addEventListener("focusout",h)),y&&(y.removeEventListener("keydown",a),y.removeEventListener("focusin",f),y.removeEventListener("focusout",h))});const c=p=>{t(F3,p)},u=p=>t(z3,p),f=p=>{const y=ct(n);if(!y)return;const C=p.target,T=p.relatedTarget,E=C&&y.contains(C);e.trapped||T&&y.contains(T)||(i=T),E&&t("focusin",p),!s.paused&&e.trapped&&(E?o=C:gh(o,!0))},h=p=>{const y=ct(n);if(!(s.paused||!y))if(e.trapped){const C=p.relatedTarget;!Zce(C)&&!y.contains(C)&&setTimeout(()=>{if(!s.paused&&e.trapped){const T=Mb({focusReason:r.value});t("focusout-prevented",T),T.defaultPrevented||gh(o,!0)}},0)}else{const C=p.target;C&&y.contains(C)||t("focusout",p)}};async function _(){await tp();const p=ct(n);if(p){V3.push(s);const y=p.contains(document.activeElement)?i:document.activeElement;if(i=y,!p.contains(y)){const T=new Event(rI,M3);p.addEventListener(rI,c),p.dispatchEvent(T),T.defaultPrevented||tp(()=>{let E=e.focusStartEl;qi(E)||(gh(E),document.activeElement!==E&&(E="first")),E==="first"&&Pue(C9(p),!0),(document.activeElement===y||E==="container")&&gh(p)})}}}function g(){const p=ct(n);if(p){p.removeEventListener(rI,c);const y=new CustomEvent(sI,{...M3,detail:{focusReason:r.value}});p.addEventListener(sI,u),p.dispatchEvent(y),!y.defaultPrevented&&(r.value=="keyboard"||!Oue())&&gh(i??document.body),p.removeEventListener(sI,c),V3.remove(s)}}return ef(()=>{e.trapped&&_(),Nr(()=>e.trapped,p=>{p?_():g()})}),wT(()=>{e.trapped&&g()}),{onKeydown:a}}});function Rue(e,t,n,i,o,r){return ga(e.$slots,"default",{handleKeydown:e.onKeydown})}var Nue=wd(Bue,[["render",Rue],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const Mue=nf({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"}}),Fue=["textContent"],zue=wr({name:"ElBadge"}),Uue=wr({...zue,props:Mue,setup(e,{expose:t}){const n=e,i=of("badge"),o=Kt(()=>n.isDot?"":Py(n.value)&&Py(n.max)?n.max<n.value?`${n.max}+`:`${n.value}`:`${n.value}`);return t({content:o}),(r,s)=>(Gn(),mo("div",{class:Mi(ct(i).b())},[ga(r.$slots,"default"),_o(ST,{name:`${ct(i).namespace.value}-zoom-in-center`,persisted:""},{default:Ws(()=>[Ym(rs("sup",{class:Mi([ct(i).e("content"),ct(i).em("content",r.type),ct(i).is("fixed",!!r.$slots.default),ct(i).is("dot",r.isDot)]),textContent:qm(ct(o))},null,10,Fue),[[UR,!r.hidden&&(ct(o)||r.isDot)]])]),_:1},8,["name"])],2))}});var Hue=wd(Uue,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const Vue=DT(Hue);var oy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};const T9={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:ZR,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0}},b9={[e0]:e=>qi(e)||Py(e)||Yw(e),change:e=>qi(e)||Py(e)||Yw(e)},kue=({model:e,isChecked:t})=>{const n=ar(t0,void 0),i=Kt(()=>{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!$w(a)&&e.value.length>=a&&!t.value||!$w(c)&&e.value.length<=c&&t.value});return{isDisabled:aue(Kt(()=>(n==null?void 0:n.disabled.value)||i.value)),isLimitDisabled:i}},Gue=(e,{model:t,isLimitExceeded:n,hasOwnLabel:i,isDisabled:o,isLabeledByFormItem:r})=>{const s=ar(t0,void 0),{formItem:a}=tN(),{emit:c}=tf();function u(p){var y,C;return p===e.trueLabel||p===!0?(y=e.trueLabel)!=null?y:!0:(C=e.falseLabel)!=null?C:!1}function f(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 _(p){n.value||!i.value&&!o.value&&r.value&&(p.composedPath().some(T=>T.tagName==="LABEL")||(t.value=u([!1,e.falseLabel].includes(t.value)),await tp(),f(t.value,p)))}const g=Kt(()=>(s==null?void 0:s.validateEvent)||e.validateEvent);return Nr(()=>e.modelValue,()=>{g.value&&(a==null||a.validate("change").catch(p=>void 0))}),{handleChange:h,onClickRoot:_}},Wue=e=>{const t=Gi(!1),{emit:n}=tf(),i=ar(t0,void 0),o=Kt(()=>$w(i)===!1),r=Gi(!1);return{model:Kt({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&&jt(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(e0,a),t.value=a)}}),isGroup:o,isLimitExceeded:r}},jue=(e,t,{model:n})=>{const i=ar(t0,void 0),o=Gi(!1),r=Kt(()=>{const u=n.value;return Yw(u)?u:jt(u)?zi(e.label)?u.map(mi).some(f=>Qce(f,e.label)):u.map(mi).includes(e.label):u!=null?u===e.trueLabel:!!u}),s=O3(Kt(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value}),{prop:!0}),a=O3(Kt(()=>{var u;return(u=i==null?void 0:i.size)==null?void 0:u.value})),c=Kt(()=>!!(t.default||e.label));return{checkboxButtonSize:s,isChecked:r,isFocused:o,checkboxSize:a,hasOwnLabel:c}},que=(e,{model:t})=>{function n(){jt(t.value)&&!t.value.includes(e.label)?t.value.push(e.label):t.value=e.trueLabel||!0}e.checked&&n()},E9=(e,t)=>{const{formItem:n}=tN(),{model:i,isGroup:o,isLimitExceeded:r}=Wue(e),{isFocused:s,isChecked:a,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:f}=jue(e,t,{model:i}),{isDisabled:h}=kue({model:i,isChecked:a}),{inputId:_,isLabeledByFormItem:g}=y9(e,{formItemContext:n,disableIdGeneration:f,disableIdManagement:o}),{handleChange:p,onClickRoot:y}=Gue(e,{model:i,isLimitExceeded:r,hasOwnLabel:f,isDisabled:h,isLabeledByFormItem:g});return que(e,{model:i}),{inputId:_,isLabeledByFormItem:g,isChecked:a,isDisabled:h,isFocused:s,checkboxButtonSize:c,checkboxSize:u,hasOwnLabel:f,model:i,handleChange:p,onClickRoot:y}},Yue=["tabindex","role","aria-checked"],$ue=["id","aria-hidden","name","tabindex","disabled","true-value","false-value"],Xue=["id","aria-hidden","disabled","value","name","tabindex"],Kue=wr({name:"ElCheckbox"}),Jue=wr({...Kue,props:T9,emits:b9,setup(e){const t=e,n=w6(),{inputId:i,isLabeledByFormItem:o,isChecked:r,isDisabled:s,isFocused:a,checkboxSize:c,hasOwnLabel:u,model:f,handleChange:h,onClickRoot:_}=E9(t,n),g=of("checkbox"),p=Kt(()=>[g.b(),g.m(c.value),g.is("disabled",s.value),g.is("bordered",t.border),g.is("checked",r.value)]),y=Kt(()=>[g.e("input"),g.is("disabled",s.value),g.is("checked",r.value),g.is("indeterminate",t.indeterminate),g.is("focus",a.value)]);return(C,T)=>(Gn(),Ma(av(!ct(u)&&ct(o)?"span":"label"),{class:Mi(ct(p)),"aria-controls":C.indeterminate?C.controls:null,onClick:ct(_)},{default:Ws(()=>[rs("span",{class:Mi(ct(y)),tabindex:C.indeterminate?0:void 0,role:C.indeterminate?"checkbox":void 0,"aria-checked":C.indeterminate?"mixed":void 0},[C.trueLabel||C.falseLabel?Ym((Gn(),mo("input",{key:0,id:ct(i),"onUpdate:modelValue":T[0]||(T[0]=E=>Vo(f)?f.value=E:null),class:Mi(ct(g).e("original")),type:"checkbox","aria-hidden":C.indeterminate?"true":"false",name:C.name,tabindex:C.tabindex,disabled:ct(s),"true-value":C.trueLabel,"false-value":C.falseLabel,onChange:T[1]||(T[1]=(...E)=>ct(h)&&ct(h)(...E)),onFocus:T[2]||(T[2]=E=>a.value=!0),onBlur:T[3]||(T[3]=E=>a.value=!1)},null,42,$ue)),[[kw,ct(f)]]):Ym((Gn(),mo("input",{key:1,id:ct(i),"onUpdate:modelValue":T[4]||(T[4]=E=>Vo(f)?f.value=E:null),class:Mi(ct(g).e("original")),type:"checkbox","aria-hidden":C.indeterminate?"true":"false",disabled:ct(s),value:C.label,name:C.name,tabindex:C.tabindex,onChange:T[5]||(T[5]=(...E)=>ct(h)&&ct(h)(...E)),onFocus:T[6]||(T[6]=E=>a.value=!0),onBlur:T[7]||(T[7]=E=>a.value=!1)},null,42,Xue)),[[kw,ct(f)]]),rs("span",{class:Mi(ct(g).e("inner"))},null,2)],10,Yue),ct(u)?(Gn(),mo("span",{key:0,class:Mi(ct(g).e("label"))},[ga(C.$slots,"default"),C.$slots.default?da("v-if",!0):(Gn(),mo(ms,{key:0},[OC(qm(C.label),1)],64))],2)):da("v-if",!0)]),_:3},8,["class","aria-controls","onClick"]))}});var Que=wd(Jue,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);const Zue=["name","tabindex","disabled","true-value","false-value"],efe=["name","tabindex","disabled","value"],tfe=wr({name:"ElCheckboxButton"}),nfe=wr({...tfe,props:T9,emits:b9,setup(e){const t=e,n=w6(),{isFocused:i,isChecked:o,isDisabled:r,checkboxButtonSize:s,model:a,handleChange:c}=E9(t,n),u=ar(t0,void 0),f=of("checkbox"),h=Kt(()=>{var g,p,y,C;const T=(p=(g=u==null?void 0:u.fill)==null?void 0:g.value)!=null?p:"";return{backgroundColor:T,borderColor:T,color:(C=(y=u==null?void 0:u.textColor)==null?void 0:y.value)!=null?C:"",boxShadow:T?`-1px 0 0 0 ${T}`:void 0}}),_=Kt(()=>[f.b("button"),f.bm("button",s.value),f.is("disabled",r.value),f.is("checked",o.value),f.is("focus",i.value)]);return(g,p)=>(Gn(),mo("label",{class:Mi(ct(_))},[g.trueLabel||g.falseLabel?Ym((Gn(),mo("input",{key:0,"onUpdate:modelValue":p[0]||(p[0]=y=>Vo(a)?a.value=y:null),class:Mi(ct(f).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:ct(r),"true-value":g.trueLabel,"false-value":g.falseLabel,onChange:p[1]||(p[1]=(...y)=>ct(c)&&ct(c)(...y)),onFocus:p[2]||(p[2]=y=>i.value=!0),onBlur:p[3]||(p[3]=y=>i.value=!1)},null,42,Zue)),[[kw,ct(a)]]):Ym((Gn(),mo("input",{key:1,"onUpdate:modelValue":p[4]||(p[4]=y=>Vo(a)?a.value=y:null),class:Mi(ct(f).be("button","original")),type:"checkbox",name:g.name,tabindex:g.tabindex,disabled:ct(r),value:g.label,onChange:p[5]||(p[5]=(...y)=>ct(c)&&ct(c)(...y)),onFocus:p[6]||(p[6]=y=>i.value=!0),onBlur:p[7]||(p[7]=y=>i.value=!1)},null,42,efe)),[[kw,ct(a)]]),g.$slots.default||g.label?(Gn(),mo("span",{key:2,class:Mi(ct(f).be("button","inner")),style:Xy(ct(o)?ct(h):void 0)},[ga(g.$slots,"default",{},()=>[OC(qm(g.label),1)])],6)):da("v-if",!0)],2))}});var x9=wd(nfe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]);const ife=nf({modelValue:{type:kc(Array),default:()=>[]},disabled:Boolean,min:Number,max:Number,size:ZR,label:String,fill:String,textColor:String,tag:{type:String,default:"div"},validateEvent:{type:Boolean,default:!0}}),ofe={[e0]:e=>jt(e),change:e=>jt(e)},rfe=wr({name:"ElCheckboxGroup"}),sfe=wr({...rfe,props:ife,emits:ofe,setup(e,{emit:t}){const n=e,i=of("checkbox"),{formItem:o}=tN(),{inputId:r,isLabeledByFormItem:s}=y9(n,{formItemContext:o}),a=async u=>{t(e0,u),await tp(),t("change",u)},c=Kt({get(){return n.modelValue},set(u){a(u)}});return Hh(t0,{...ole(yne(n),["size","min","max","disabled","validateEvent","fill","textColor"]),modelValue:c,changeEvent:a}),Nr(()=>n.modelValue,()=>{n.validateEvent&&(o==null||o.validate("change").catch(u=>void 0))}),(u,f)=>{var h;return Gn(),Ma(av(u.tag),{id:ct(r),class:Mi(ct(i).b("group")),role:"group","aria-label":ct(s)?void 0:u.label||"checkbox-group","aria-labelledby":ct(s)?(h=ct(o))==null?void 0:h.labelId:void 0},{default:Ws(()=>[ga(u.$slots,"default")]),_:3},8,["id","class","aria-label","aria-labelledby"])}}});var w9=wd(sfe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);const afe=DT(Que,{CheckboxButton:x9,CheckboxGroup:w9});p9(x9);const cfe=p9(w9),fL={},lfe=nf({a11y:{type:Boolean,default:!0},locale:{type:kc(Object)},size:ZR,button:{type:kc(Object)},experimentalFeatures:{type:kc(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:kc(Object)},zIndex:Number,namespace:{type:String,default:"el"}});wr({name:"ElConfigProvider",props:lfe,setup(e,{slots:t}){Nr(()=>e.message,i=>{Object.assign(fL,i??{})},{immediate:!0,deep:!0});const n=rue(e);return()=>ga(t,"default",{config:n==null?void 0:n.value})}});const ufe=nf({mask:{type:Boolean,default:!0},customMaskEvent:{type:Boolean,default:!1},overlayClass:{type:kc([String,Array,Object])},zIndex:{type:kc([String,Number])}}),ffe={click:e=>e instanceof MouseEvent};var dfe=wr({name:"ElOverlay",props:ufe,emits:ffe,setup(e,{slots:t,emit:n}){const i=of("overlay"),o=c=>{n("click",c)},{onClick:r,onMousedown:s,onMouseup:a}=gue(e.customMaskEvent?void 0:o);return()=>e.mask?_o("div",{class:[i.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:r,onMousedown:s,onMouseup:a},[ga(t,"default")],jx.STYLE|jx.CLASS|jx.PROPS,["onClick","onMouseup","onMousedown"]):fv("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[ga(t,"default")])}});const hfe=dfe,pfe=nf({center:{type:Boolean,default:!1},alignCenter:{type:Boolean,default:!1},closeIcon:{type:h9},customClass:{type:String,default:""},draggable:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},title:{type:String,default:""}}),mfe=nf({...pfe,appendToBody:{type:Boolean,default:!1},beforeClose:{type:kc(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}}),_fe={open:()=>!0,opened:()=>!0,close:()=>!0,closed:()=>!0,[e0]:e=>Yw(e),openAutoFocus:()=>!0,closeAutoFocus:()=>!0},gfe=(e,t)=>{const i=tf().emit,{nextZIndex:o}=A9();let r="";const s=lL(),a=lL(),c=Gi(!1),u=Gi(!1),f=Gi(!1),h=Gi(e.zIndex||o());let _,g;const p=y_("namespace",eN),y=Kt(()=>{const D={},L=`--${p.value}-dialog`;return e.fullscreen||(e.top&&(D[`${L}-margin-top`]=e.top),e.width&&(D[`${L}-width`]=KR(e.width))),D}),C=Kt(()=>e.alignCenter?{display:"flex"}:{});function T(){i("opened")}function E(){i("closed"),i(e0,!1),e.destroyOnClose&&(f.value=!1)}function w(){i("close")}function S(){g==null||g(),_==null||_(),e.openDelay&&e.openDelay>0?{stop:_}=sL(()=>R(),e.openDelay):R()}function P(){_==null||_(),g==null||g(),e.closeDelay&&e.closeDelay>0?{stop:g}=sL(()=>F(),e.closeDelay):F()}function O(){function D(L){L||(u.value=!0,c.value=!1)}e.beforeClose?e.beforeClose(D):P()}function z(){e.closeOnClickModal&&O()}function R(){ql&&(c.value=!0)}function F(){c.value=!1}function H(){i("openAutoFocus")}function v(){i("closeAutoFocus")}function I(D){var L;((L=D.detail)==null?void 0:L.focusReason)==="pointer"&&D.preventDefault()}e.lockScroll&&_ue(c);function m(){e.closeOnPressEscape&&O()}return Nr(()=>e.modelValue,D=>{D?(u.value=!1,S(),f.value=!0,h.value=e.zIndex?h.value++:o(),tp(()=>{i("open"),t.value&&(t.value.scrollTop=0)})):c.value&&P()}),Nr(()=>e.fullscreen,D=>{t.value&&(D?(r=t.value.style.transform,t.value.style.transform=""):t.value.style.transform=r)}),ef(()=>{e.modelValue&&(c.value=!0,f.value=!0,S())}),{afterEnter:T,afterLeave:E,beforeLeave:w,handleClose:O,onModalClick:z,close:P,doClose:F,onOpenAutoFocus:H,onCloseAutoFocus:v,onCloseRequested:m,onFocusoutPrevented:I,titleId:s,bodyId:a,closed:u,style:y,overlayDialogStyle:C,rendered:f,visible:c,zIndex:h}},yfe=nf({...mfe,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}}),Afe=_fe,Cfe=wr({name:"ElDrawer",components:{ElOverlay:hfe,ElFocusTrap:Nue,ElIcon:uL,Close:a9},inheritAttrs:!1,props:yfe,emits:Afe,setup(e,{slots:t}){L3({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"},Kt(()=>!!t.title)),L3({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"},Kt(()=>!!e.customClass));const n=Gi(),i=Gi(),o=of("drawer"),{t:r}=mue(),s=Kt(()=>e.direction==="rtl"||e.direction==="ltr"),a=Kt(()=>KR(e.size));return{...gfe(e,n),drawerRef:n,focusStartRef:i,isHorizontal:s,drawerSize:a,ns:o,t:r}}}),Tfe=["aria-label","aria-labelledby","aria-describedby"],bfe=["id"],Efe=["aria-label"],xfe=["id"];function wfe(e,t,n,i,o,r){const s=Pb("close"),a=Pb("el-icon"),c=Pb("el-focus-trap"),u=Pb("el-overlay");return Gn(),Ma(hie,{to:"body",disabled:!e.appendToBody},[_o(ST,{name:e.ns.b("fade"),onAfterEnter:e.afterEnter,onAfterLeave:e.afterLeave,onBeforeLeave:e.beforeLeave,persisted:""},{default:Ws(()=>[Ym(_o(u,{mask:e.modal,"overlay-class":e.modalClass,"z-index":e.zIndex,onClick:e.onModalClick},{default:Ws(()=>[_o(c,{loop:"",trapped:e.visible,"focus-trap-el":e.drawerRef,"focus-start-el":e.focusStartRef,onReleaseRequested:e.onCloseRequested},{default:Ws(()=>[rs("div",zR({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]=I6(()=>{},["stop"]))}),[rs("span",{ref:"focusStartRef",class:Mi(e.ns.e("sr-focus")),tabindex:"-1"},null,2),e.withHeader?(Gn(),mo("header",{key:0,class:Mi(e.ns.e("header"))},[e.$slots.title?ga(e.$slots,"title",{key:1},()=>[da(" DEPRECATED SLOT ")]):ga(e.$slots,"header",{key:0,close:e.handleClose,titleId:e.titleId,titleClass:e.ns.e("title")},()=>[e.$slots.title?da("v-if",!0):(Gn(),mo("span",{key:0,id:e.titleId,role:"heading",class:Mi(e.ns.e("title"))},qm(e.title),11,bfe))]),e.showClose?(Gn(),mo("button",{key:2,"aria-label":e.t("el.drawer.close"),class:Mi(e.ns.e("close-btn")),type:"button",onClick:t[0]||(t[0]=(...f)=>e.handleClose&&e.handleClose(...f))},[_o(a,{class:Mi(e.ns.e("close"))},{default:Ws(()=>[_o(s)]),_:1},8,["class"])],10,Efe)):da("v-if",!0)],2)):da("v-if",!0),e.rendered?(Gn(),mo("div",{key:1,id:e.bodyId,class:Mi(e.ns.e("body"))},[ga(e.$slots,"default")],10,xfe)):da("v-if",!0),e.$slots.footer?(Gn(),mo("div",{key:2,class:Mi(e.ns.e("footer"))},[ga(e.$slots,"footer")],2)):da("v-if",!0)],16,Tfe)]),_:3},8,["trapped","focus-trap-el","focus-start-el","onReleaseRequested"])]),_:3},8,["mask","overlay-class","z-index","onClick"]),[[UR,e.visible]])]),_:3},8,["name","onAfterEnter","onAfterLeave","onBeforeLeave"])],8,["disabled"])}var Sfe=wd(Cfe,[["render",wfe],["__file","/home/runner/work/element-plus/element-plus/packages/components/drawer/src/drawer.vue"]]);const vfe=DT(Sfe),Dfe=["start","center","end","space-around","space-between","space-evenly"],Ife=["top","middle","bottom"],Pfe=nf({tag:{type:String,default:"div"},gutter:{type:Number,default:0},justify:{type:String,values:Dfe,default:"start"},align:{type:String,values:Ife,default:"top"}}),Ofe=wr({name:"ElRow"}),Lfe=wr({...Ofe,props:Pfe,setup(e){const t=e,n=of("row"),i=Kt(()=>t.gutter);Hh(oue,{gutter:i});const o=Kt(()=>{const s={};return t.gutter&&(s.marginRight=s.marginLeft=`-${t.gutter/2}px`),s}),r=Kt(()=>[n.b(),n.is(`justify-${t.justify}`,t.justify!=="start"),n.is(`align-${t.align}`,t.align!=="top")]);return(s,a)=>(Gn(),Ma(av(s.tag),{class:Mi(ct(r)),style:Xy(ct(o))},{default:Ws(()=>[ga(s.$slots,"default")]),_:3},8,["class","style"]))}});var Bfe=wd(Lfe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/row/src/row.vue"]]);const Rfe=DT(Bfe),S9=["success","info","warning","error"],Pa=iue({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:ql?document.body:void 0}),Nfe=nf({customClass:{type:String,default:Pa.customClass},center:{type:Boolean,default:Pa.center},dangerouslyUseHTMLString:{type:Boolean,default:Pa.dangerouslyUseHTMLString},duration:{type:Number,default:Pa.duration},icon:{type:h9,default:Pa.icon},id:{type:String,default:Pa.id},message:{type:kc([String,Object,Function]),default:Pa.message},onClose:{type:kc(Function),required:!1},showClose:{type:Boolean,default:Pa.showClose},type:{type:String,values:S9,default:Pa.type},offset:{type:Number,default:Pa.offset},zIndex:{type:Number,default:Pa.zIndex},grouping:{type:Boolean,default:Pa.grouping},repeatNum:{type:Number,default:Pa.repeatNum}}),Mfe={destroy:()=>!0},Bu=V8([]),Ffe=e=>{const t=Bu.findIndex(o=>o.id===e),n=Bu[t];let i;return t>0&&(i=Bu[t-1]),{current:n,prev:i}},zfe=e=>{const{prev:t}=Ffe(e);return t?t.vm.exposed.bottom.value:0},Ufe=["id"],Hfe=["innerHTML"],Vfe=wr({name:"ElMessage"}),kfe=wr({...Vfe,props:Nfe,emits:Mfe,setup(e,{expose:t}){const n=e,{Close:i}=eue,o=of("message"),r=Gi(),s=Gi(!1),a=Gi(0);let c;const u=Kt(()=>n.type?n.type==="error"?"danger":n.type:"info"),f=Kt(()=>{const S=n.type;return{[o.bm("icon",S)]:S&&P3[S]}}),h=Kt(()=>n.icon||P3[n.type]||""),_=Kt(()=>zfe(n.id)),g=Kt(()=>n.offset+_.value),p=Kt(()=>a.value+g.value),y=Kt(()=>({top:`${g.value}px`,zIndex:n.zIndex}));function C(){n.duration!==0&&({stop:c}=sL(()=>{E()},n.duration))}function T(){c==null||c()}function E(){s.value=!1}function w({code:S}){S===JR.esc&&E()}return ef(()=>{C(),s.value=!0}),Nr(()=>n.repeatNum,()=>{T(),C()}),lle(document,"keydown",w),ple(r,()=>{a.value=r.value.getBoundingClientRect().height}),t({visible:s,bottom:p,close:E}),(S,P)=>(Gn(),Ma(ST,{name:ct(o).b("fade"),onBeforeLeave:S.onClose,onAfterLeave:P[0]||(P[0]=O=>S.$emit("destroy")),persisted:""},{default:Ws(()=>[Ym(rs("div",{id:S.id,ref_key:"messageRef",ref:r,class:Mi([ct(o).b(),{[ct(o).m(S.type)]:S.type&&!S.icon},ct(o).is("center",S.center),ct(o).is("closable",S.showClose),S.customClass]),style:Xy(ct(y)),role:"alert",onMouseenter:T,onMouseleave:C},[S.repeatNum>1?(Gn(),Ma(ct(Vue),{key:0,value:S.repeatNum,type:ct(u),class:Mi(ct(o).e("badge"))},null,8,["value","type","class"])):da("v-if",!0),ct(h)?(Gn(),Ma(ct(uL),{key:1,class:Mi([ct(o).e("icon"),ct(f)])},{default:Ws(()=>[(Gn(),Ma(av(ct(h))))]),_:1},8,["class"])):da("v-if",!0),ga(S.$slots,"default",{},()=>[S.dangerouslyUseHTMLString?(Gn(),mo(ms,{key:1},[da(" Caution here, message could've been compromised, never use user's input as message "),rs("p",{class:Mi(ct(o).e("content")),innerHTML:S.message},null,10,Hfe)],2112)):(Gn(),mo("p",{key:0,class:Mi(ct(o).e("content"))},qm(S.message),3))]),S.showClose?(Gn(),Ma(ct(uL),{key:2,class:Mi(ct(o).e("closeBtn")),onClick:I6(E,["stop"])},{default:Ws(()=>[_o(ct(i))]),_:1},8,["class","onClick"])):da("v-if",!0)],46,Ufe),[[UR,s.value]])]),_:3},8,["name","onBeforeLeave"]))}});var Gfe=wd(kfe,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let Wfe=1;const v9=e=>{const t=!e||qi(e)||wy(e)||bn(e)?{message:e}:e,n={...Pa,...t};if(!n.appendTo)n.appendTo=document.body;else if(qi(n.appendTo)){let i=document.querySelector(n.appendTo);Cle(i)||(i=document.body),n.appendTo=i}return n},jfe=e=>{const t=Bu.indexOf(e);if(t===-1)return;Bu.splice(t,1);const{handler:n}=e;n.close()},qfe=({appendTo:e,...t},n)=>{const{nextZIndex:i}=A9(),o=`message_${Wfe++}`,r=t.onClose,s=document.createElement("div"),a={...t,zIndex:i()+t.zIndex,id:o,onClose:()=>{r==null||r(),jfe(h)},onDestroy:()=>{N2(null,s)}},c=_o(Gfe,a,bn(a.message)||wy(a.message)?{default:bn(a.message)?a.message:()=>a.message}:null);c.appContext=n||Oy._context,N2(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},Oy=(e={},t)=>{if(!ql)return{close:()=>{}};if(Py(fL.max)&&Bu.length>=fL.max)return{close:()=>{}};const n=v9(e);if(n.grouping&&Bu.length){const o=Bu.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=qfe(n,t);return Bu.push(i),i.handler};S9.forEach(e=>{Oy[e]=(t={},n)=>{const i=v9(t);return Oy({...i,type:e},n)}});function Yfe(e){for(const t of Bu)(!e||e===t.props.type)&&t.handler.close()}Oy.closeAll=Yfe;Oy._context=null;const $fe=tue(Oy,"$message"),Xfe="/satellite-track/assets/menu-a8f9cd83.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 Tr={};Tr.typeOf={};function Kfe(e){return`${e} is required, actual value was undefined`}function n0(e,t,n){return`Expected ${n} to be typeof ${t}, actual typeof was ${e}`}Tr.defined=function(e,t){if(!l(t))throw new x(Kfe(e))};Tr.typeOf.func=function(e,t){if(typeof t!="function")throw new x(n0(typeof t,"function",e))};Tr.typeOf.string=function(e,t){if(typeof t!="string")throw new x(n0(typeof t,"string",e))};Tr.typeOf.number=function(e,t){if(typeof t!="number")throw new x(n0(typeof t,"number",e))};Tr.typeOf.number.lessThan=function(e,t,n){if(Tr.typeOf.number(e,t),t>=n)throw new x(`Expected ${e} to be less than ${n}, actual value was ${t}`)};Tr.typeOf.number.lessThanOrEquals=function(e,t,n){if(Tr.typeOf.number(e,t),t>n)throw new x(`Expected ${e} to be less than or equal to ${n}, actual value was ${t}`)};Tr.typeOf.number.greaterThan=function(e,t,n){if(Tr.typeOf.number(e,t),t<=n)throw new x(`Expected ${e} to be greater than ${n}, actual value was ${t}`)};Tr.typeOf.number.greaterThanOrEquals=function(e,t,n){if(Tr.typeOf.number(e,t),t<n)throw new x(`Expected ${e} to be greater than or equal to ${n}, actual value was ${t}`)};Tr.typeOf.object=function(e,t){if(typeof t!="object")throw new x(n0(typeof t,"object",e))};Tr.typeOf.bool=function(e,t){if(typeof t!="boolean")throw new x(n0(typeof t,"boolean",e))};Tr.typeOf.bigint=function(e,t){if(typeof t!="bigint")throw new x(n0(typeof t,"bigint",e))};Tr.typeOf.number.equals=function(e,t,n,i){if(Tr.typeOf.number(e,n),Tr.typeOf.number(t,i),n!==i)throw new x(`${e} must be equal to ${t}, the actual values are ${n} and ${i}`)};const b=Tr;function A(e,t){return e??t}A.EMPTY_OBJECT=Object.freeze({});var Sd=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)};Sd.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}};Sd.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};Sd.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};Sd.prototype.random_int31=function(){return this.random_int()>>>1};Sd.prototype.random_incl=function(){return this.random_int()*(1/4294967295)};Sd.prototype.random=function(){return this.random_int()*(1/4294967296)};Sd.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)};Sd.prototype.random_long=function(){var e=this.random_int()>>>5,t=this.random_int()>>>6;return(e*67108864+t)*(1/9007199254740992)};var gv=Sd;const Ye={};Ye.EPSILON1=.1;Ye.EPSILON2=.01;Ye.EPSILON3=.001;Ye.EPSILON4=1e-4;Ye.EPSILON5=1e-5;Ye.EPSILON6=1e-6;Ye.EPSILON7=1e-7;Ye.EPSILON8=1e-8;Ye.EPSILON9=1e-9;Ye.EPSILON10=1e-10;Ye.EPSILON11=1e-11;Ye.EPSILON12=1e-12;Ye.EPSILON13=1e-13;Ye.EPSILON14=1e-14;Ye.EPSILON15=1e-15;Ye.EPSILON16=1e-16;Ye.EPSILON17=1e-17;Ye.EPSILON18=1e-18;Ye.EPSILON19=1e-19;Ye.EPSILON20=1e-20;Ye.EPSILON21=1e-21;Ye.GRAVITATIONALPARAMETER=3986004418e5;Ye.SOLAR_RADIUS=6955e5;Ye.LUNAR_RADIUS=1737400;Ye.SIXTY_FOUR_KILOBYTES=64*1024;Ye.FOUR_GIGABYTES=4*1024*1024*1024;Ye.sign=A(Math.sign,function(t){return t=+t,t===0||t!==t?t:t>0?1:-1});Ye.signNotZero=function(e){return e<0?-1:1};Ye.toSNorm=function(e,t){return t=A(t,255),Math.round((Ye.clamp(e,-1,1)*.5+.5)*t)};Ye.fromSNorm=function(e,t){return t=A(t,255),Ye.clamp(e,0,t)/t*2-1};Ye.normalize=function(e,t,n){return n=Math.max(n-t,0),n===0?0:Ye.clamp((e-t)/n,0,1)};Ye.sinh=A(Math.sinh,function(t){return(Math.exp(t)-Math.exp(-t))/2});Ye.cosh=A(Math.cosh,function(t){return(Math.exp(t)+Math.exp(-t))/2});Ye.lerp=function(e,t,n){return(1-n)*e+n*t};Ye.PI=Math.PI;Ye.ONE_OVER_PI=1/Math.PI;Ye.PI_OVER_TWO=Math.PI/2;Ye.PI_OVER_THREE=Math.PI/3;Ye.PI_OVER_FOUR=Math.PI/4;Ye.PI_OVER_SIX=Math.PI/6;Ye.THREE_PI_OVER_TWO=3*Math.PI/2;Ye.TWO_PI=2*Math.PI;Ye.ONE_OVER_TWO_PI=1/(2*Math.PI);Ye.RADIANS_PER_DEGREE=Math.PI/180;Ye.DEGREES_PER_RADIAN=180/Math.PI;Ye.RADIANS_PER_ARCSECOND=Ye.RADIANS_PER_DEGREE/3600;Ye.toRadians=function(e){if(!l(e))throw new x("degrees is required.");return e*Ye.RADIANS_PER_DEGREE};Ye.toDegrees=function(e){if(!l(e))throw new x("radians is required.");return e*Ye.DEGREES_PER_RADIAN};Ye.convertLongitudeRange=function(e){if(!l(e))throw new x("angle is required.");const t=Ye.TWO_PI,n=e-Math.floor(e/t)*t;return n<-Math.PI?n+t:n>=Math.PI?n-t:n};Ye.clampToLatitudeRange=function(e){if(!l(e))throw new x("angle is required.");return Ye.clamp(e,-1*Ye.PI_OVER_TWO,Ye.PI_OVER_TWO)};Ye.negativePiToPi=function(e){if(!l(e))throw new x("angle is required.");return e>=-Ye.PI&&e<=Ye.PI?e:Ye.zeroToTwoPi(e+Ye.PI)-Ye.PI};Ye.zeroToTwoPi=function(e){if(!l(e))throw new x("angle is required.");if(e>=0&&e<=Ye.TWO_PI)return e;const t=Ye.mod(e,Ye.TWO_PI);return Math.abs(t)<Ye.EPSILON14&&Math.abs(e)>Ye.EPSILON14?Ye.TWO_PI:t};Ye.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 Ye.sign(e)===Ye.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t};Ye.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))};Ye.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};Ye.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};Ye.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};Ye.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 Fb=[1];Ye.factorial=function(e){if(typeof e!="number"||e<0)throw new x("A number greater than or equal to 0 is required.");const t=Fb.length;if(e>=t){let n=Fb[t-1];for(let i=t;i<=e;i++){const o=n*i;Fb.push(o),n=o}}return Fb[e]};Ye.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};Ye.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};Ye.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};Ye.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};Ye.clamp=function(e,t,n){return b.typeOf.number("value",e),b.typeOf.number("min",t),b.typeOf.number("max",n),e<t?t:e>n?n:e};let D9=new gv;Ye.setRandomNumberSeed=function(e){if(!l(e))throw new x("seed is required.");D9=new gv(e)};Ye.nextRandomNumber=function(){return D9.random()};Ye.randomBetween=function(e,t){return Ye.nextRandomNumber()*(t-e)+e};Ye.acosClamped=function(e){if(!l(e))throw new x("value is required.");return Math.acos(Ye.clamp(e,-1,1))};Ye.asinClamped=function(e){if(!l(e))throw new x("value is required.");return Math.asin(Ye.clamp(e,-1,1))};Ye.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)};Ye.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)};Ye.cbrt=A(Math.cbrt,function(t){const n=Math.pow(Math.abs(t),.3333333333333333);return t<0?-n:n});Ye.log2=A(Math.log2,function(t){return Math.log(t)*Math.LOG2E});Ye.fog=function(e,t){const n=e*t;return 1-Math.exp(-(n*n))};Ye.fastApproximateAtan=function(e){return b.typeOf.number("x",e),e*(-.1784*Math.abs(e)-.0663*e*e+1.0301)};Ye.fastApproximateAtan2=function(e,t){b.typeOf.number("x",e),b.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=Ye.fastApproximateAtan(r),i=Math.abs(t)>Math.abs(e)?Ye.PI_OVER_TWO-i:i,i=e<0?Ye.PI-i:i,i=t<0?-i:i,i};const N=Ye;function d(e,t,n){this.x=A(e,0),this.y=A(t,0),this.z=A(n,0)}d.fromSpherical=function(e,t){b.typeOf.object("spherical",e),l(t)||(t=new d);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};d.fromElements=function(e,t,n,i){return l(i)?(i.x=e,i.y=t,i.z=n,i):new d(e,t,n)};d.clone=function(e,t){if(l(e))return l(t)?(t.x=e.x,t.y=e.y,t.z=e.z,t):new d(e.x,e.y,e.z)};d.fromCartesian4=d.clone;d.packedLength=3;d.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n]=e.z,t};d.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new d),n.x=e[t++],n.y=e[t++],n.z=e[t],n};d.packArray=function(e,t){b.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)d.pack(e[o],t,o*3);return t};d.unpackArray=function(e,t){if(b.defined("array",e),b.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]=d.unpack(e,i,t[o])}return t};d.fromArray=d.unpack;d.maximumComponent=function(e){return b.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z)};d.minimumComponent=function(e){return b.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z)};d.minimumByComponent=function(e,t,n){return b.typeOf.object("first",e),b.typeOf.object("second",t),b.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};d.maximumByComponent=function(e,t,n){return b.typeOf.object("first",e),b.typeOf.object("second",t),b.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};d.clamp=function(e,t,n,i){b.typeOf.object("value",e),b.typeOf.object("min",t),b.typeOf.object("max",n),b.typeOf.object("result",i);const o=N.clamp(e.x,t.x,n.x),r=N.clamp(e.y,t.y,n.y),s=N.clamp(e.z,t.z,n.z);return i.x=o,i.y=r,i.z=s,i};d.magnitudeSquared=function(e){return b.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y+e.z*e.z};d.magnitude=function(e){return Math.sqrt(d.magnitudeSquared(e))};const Kw=new d;d.distance=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),d.subtract(e,t,Kw),d.magnitude(Kw)};d.distanceSquared=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),d.subtract(e,t,Kw),d.magnitudeSquared(Kw)};d.normalize=function(e,t){b.typeOf.object("cartesian",e),b.typeOf.object("result",t);const n=d.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};d.dot=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z};d.multiplyComponents=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n.z=e.z*t.z,n};d.divideComponents=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n.z=e.z/t.z,n};d.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n.z=e.z+t.z,n};d.subtract=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n.z=e.z-t.z,n};d.multiplyByScalar=function(e,t,n){return b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n.z=e.z*t,n};d.divideByScalar=function(e,t,n){return b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n.z=e.z/t,n};d.negate=function(e,t){return b.typeOf.object("cartesian",e),b.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t};d.abs=function(e,t){return b.typeOf.object("cartesian",e),b.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t.z=Math.abs(e.z),t};const G3=new d;d.lerp=function(e,t,n,i){return b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i),d.multiplyByScalar(t,n,G3),i=d.multiplyByScalar(e,1-n,i),d.add(G3,i,i)};const zb=new d,aI=new d;d.angleBetween=function(e,t){b.typeOf.object("left",e),b.typeOf.object("right",t),d.normalize(e,zb),d.normalize(t,aI);const n=d.dot(zb,aI),i=d.magnitude(d.cross(zb,aI,zb));return Math.atan2(i,n)};const Jfe=new d;d.mostOrthogonalAxis=function(e,t){b.typeOf.object("cartesian",e),b.typeOf.object("result",t);const n=d.normalize(e,Jfe);return d.abs(n,n),n.x<=n.y?n.x<=n.z?t=d.clone(d.UNIT_X,t):t=d.clone(d.UNIT_Z,t):n.y<=n.z?t=d.clone(d.UNIT_Y,t):t=d.clone(d.UNIT_Z,t),t};d.projectVector=function(e,t,n){b.defined("a",e),b.defined("b",t),b.defined("result",n);const i=d.dot(e,t)/d.dot(t,t);return d.multiplyByScalar(t,i,n)};d.equals=function(e,t){return e===t||l(e)&&l(t)&&e.x===t.x&&e.y===t.y&&e.z===t.z};d.equalsArray=function(e,t,n){return e.x===t[n]&&e.y===t[n+1]&&e.z===t[n+2]};d.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&N.equalsEpsilon(e.x,t.x,n,i)&&N.equalsEpsilon(e.y,t.y,n,i)&&N.equalsEpsilon(e.z,t.z,n,i)};d.cross=function(e,t,n){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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,f=r*s-i*c,h=i*a-o*s;return n.x=u,n.y=f,n.z=h,n};d.midpoint=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};d.fromDegrees=function(e,t,n,i,o){return b.typeOf.number("longitude",e),b.typeOf.number("latitude",t),e=N.toRadians(e),t=N.toRadians(t),d.fromRadians(e,t,n,i,o)};let Ec=new d,$_=new d;const Qfe=new d(6378137*6378137,6378137*6378137,6356752314245179e-9*6356752314245179e-9);d.fromRadians=function(e,t,n,i,o){b.typeOf.number("longitude",e),b.typeOf.number("latitude",t),n=A(n,0);const r=l(i)?i.radiiSquared:Qfe,s=Math.cos(t);Ec.x=s*Math.cos(e),Ec.y=s*Math.sin(e),Ec.z=Math.sin(t),Ec=d.normalize(Ec,Ec),d.multiplyComponents(r,Ec,$_);const a=Math.sqrt(d.dot(Ec,$_));return $_=d.divideByScalar($_,a,$_),Ec=d.multiplyByScalar(Ec,n,Ec),l(o)||(o=new d),d.add($_,Ec,o)};d.fromDegreesArray=function(e,t,n){if(b.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]=d.fromDegrees(r,s,0,t,n[a])}return n};d.fromRadiansArray=function(e,t,n){if(b.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]=d.fromRadians(r,s,0,t,n[a])}return n};d.fromDegreesArrayHeights=function(e,t,n){if(b.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]=d.fromDegrees(r,s,a,t,n[c])}return n};d.fromRadiansArrayHeights=function(e,t,n){if(b.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]=d.fromRadians(r,s,a,t,n[c])}return n};d.ZERO=Object.freeze(new d(0,0,0));d.ONE=Object.freeze(new d(1,1,1));d.UNIT_X=Object.freeze(new d(1,0,0));d.UNIT_Y=Object.freeze(new d(0,1,0));d.UNIT_Z=Object.freeze(new d(0,0,1));d.prototype.clone=function(e){return d.clone(this,e)};d.prototype.equals=function(e){return d.equals(this,e)};d.prototype.equalsEpsilon=function(e,t,n){return d.equalsEpsilon(this,e,t,n)};d.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 b.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 b.typeOf.object("value",e),b.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 b.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){b.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(b.defined("array",e),b.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 b.typeOf.object("cartesian",e),Math.max(e.x,e.y,e.z,e.w)};oe.minimumComponent=function(e){return b.typeOf.object("cartesian",e),Math.min(e.x,e.y,e.z,e.w)};oe.minimumByComponent=function(e,t,n){return b.typeOf.object("first",e),b.typeOf.object("second",t),b.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 b.typeOf.object("first",e),b.typeOf.object("second",t),b.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){b.typeOf.object("value",e),b.typeOf.object("min",t),b.typeOf.object("max",n),b.typeOf.object("result",i);const o=N.clamp(e.x,t.x,n.x),r=N.clamp(e.y,t.y,n.y),s=N.clamp(e.z,t.z,n.z),a=N.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 b.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 Jw=new oe;oe.distance=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),oe.subtract(e,t,Jw),oe.magnitude(Jw)};oe.distanceSquared=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),oe.subtract(e,t,Jw),oe.magnitudeSquared(Jw)};oe.normalize=function(e,t){b.typeOf.object("cartesian",e),b.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 b.typeOf.object("left",e),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.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 b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.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 b.typeOf.object("cartesian",e),b.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 b.typeOf.object("cartesian",e),b.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 W3=new oe;oe.lerp=function(e,t,n,i){return b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i),oe.multiplyByScalar(t,n,W3),i=oe.multiplyByScalar(e,1-n,i),oe.add(W3,i,i)};const Zfe=new oe;oe.mostOrthogonalAxis=function(e,t){b.typeOf.object("cartesian",e),b.typeOf.object("result",t);const n=oe.normalize(e,Zfe);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)&&N.equalsEpsilon(e.x,t.x,n,i)&&N.equalsEpsilon(e.y,t.y,n,i)&&N.equalsEpsilon(e.z,t.z,n,i)&&N.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 oN=new Float32Array(1),Rs=new Uint8Array(oN.buffer),ede=new Uint32Array([287454020]),tde=new Uint8Array(ede.buffer),I9=tde[0]===68;oe.packFloat=function(e,t){return b.typeOf.number("value",e),l(t)||(t=new oe),oN[0]=e,I9?(t.x=Rs[0],t.y=Rs[1],t.z=Rs[2],t.w=Rs[3]):(t.x=Rs[3],t.y=Rs[2],t.z=Rs[1],t.w=Rs[0]),t};oe.unpackFloat=function(e){return b.typeOf.object("packedFloat",e),I9?(Rs[0]=e.x,Rs[1]=e.y,Rs[2]=e.z,Rs[3]=e.w):(Rs[0]=e.w,Rs[1]=e.z,Rs[2]=e.y,Rs[3]=e.x),oN[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 b.typeOf.object("value",e),b.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 b.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){b.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(b.defined("array",e),b.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 b.defined("values",e),J.clone(e,t)};J.fromRowMajorArray=function(e,t){return b.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){b.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,f=e.z*e.w,h=e.w*e.w,_=n-s-u+h,g=2*(i-f),p=2*(o+c),y=2*(i+f),C=-n+s-u+h,T=2*(a-r),E=2*(o-c),w=2*(a+r),S=-n-s+u+h;return l(t)?(t[0]=_,t[1]=y,t[2]=E,t[3]=g,t[4]=C,t[5]=w,t[6]=p,t[7]=T,t[8]=S,t):new J(_,g,p,y,C,T,E,w,S)};J.fromHeadingPitchRoll=function(e,t){b.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,f=a*s+o*r*i,h=n*s,_=o*i+a*r*s,g=-a*i+o*r*s,p=-r,y=a*n,C=o*n;return l(t)?(t[0]=c,t[1]=h,t[2]=p,t[3]=u,t[4]=_,t[5]=y,t[6]=f,t[7]=g,t[8]=C,t):new J(c,u,f,h,_,g,p,y,C)};J.fromScale=function(e,t){return b.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 b.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 b.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){b.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){b.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){b.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 b.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 b.typeOf.number.greaterThanOrEquals("row",t,0),b.typeOf.number.lessThanOrEquals("row",t,2),b.typeOf.number.greaterThanOrEquals("column",e,0),b.typeOf.number.lessThanOrEquals("column",e,2),e*3+t};J.getColumn=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,2),b.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){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,2),b.typeOf.object("cartesian",n),b.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){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,2),b.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 b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,2),b.typeOf.object("cartesian",n),b.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 nde=new d;J.setScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.typeOf.object("result",n);const i=J.getScale(e,nde),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 ide=new d;J.setUniformScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.typeOf.object("result",n);const i=J.getScale(e,ide),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 cI=new d;J.getScale=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],cI)),t.y=d.magnitude(d.fromElements(e[3],e[4],e[5],cI)),t.z=d.magnitude(d.fromElements(e[6],e[7],e[8],cI)),t};const j3=new d;J.getMaximumScale=function(e){return J.getScale(e,j3),d.maximumComponent(j3)};const ode=new d;J.setRotation=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("result",n);const i=J.getScale(e,ode);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 rde=new d;J.getRotation=function(e,t){b.typeOf.object("matrix",e),b.typeOf.object("result",t);const n=J.getScale(e,rde);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){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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],f=e[1]*t[6]+e[4]*t[7]+e[7]*t[8],h=e[2]*t[6]+e[5]*t[7]+e[8]*t[8];return n[0]=i,n[1]=o,n[2]=r,n[3]=s,n[4]=a,n[5]=c,n[6]=u,n[7]=f,n[8]=h,n};J.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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){b.typeOf.object("matrix",e),b.typeOf.object("cartesian",t),b.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 b.typeOf.object("matrix",e),b.typeOf.number("scalar",t),b.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 b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.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 b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.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 b.typeOf.object("matrix",e),b.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){b.typeOf.object("matrix",e),b.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],f=e[8];return t[0]=n,t[1]=i,t[2]=o,t[3]=r,t[4]=s,t[5]=a,t[6]=c,t[7]=u,t[8]=f,t};function sde(e){let t=0;for(let n=0;n<9;++n){const i=e[n];t+=i*i}return Math.sqrt(t)}const dL=[1,0,0],hL=[2,2,1];function ade(e){let t=0;for(let n=0;n<3;++n){const i=e[J.getElementIndex(hL[n],dL[n])];t+=2*i*i}return Math.sqrt(t)}function cde(e,t){const n=N.EPSILON15;let i=0,o=1;for(let u=0;u<3;++u){const f=Math.abs(e[J.getElementIndex(hL[u],dL[u])]);f>i&&(o=u,i=f)}let r=1,s=0;const a=dL[o],c=hL[o];if(Math.abs(e[J.getElementIndex(c,a)])>n){const u=e[J.getElementIndex(c,c)],f=e[J.getElementIndex(a,a)],h=e[J.getElementIndex(c,a)],_=(u-f)/2/h;let g;_<0?g=-1/(-_+Math.sqrt(1+_*_)):g=1/(_+Math.sqrt(1+_*_)),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 Ub=new J,q3=new J;J.computeEigenDecomposition=function(e,t){b.typeOf.object("matrix",e);const n=N.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*sde(a);for(;r<i&&ade(a)>c;)cde(a,Ub),J.transpose(Ub,q3),J.multiply(a,Ub,a),J.multiply(q3,a,a),J.multiply(s,Ub,s),++o>2&&(++r,o=0);return t};J.abs=function(e,t){return b.typeOf.object("matrix",e),b.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){b.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){b.typeOf.object("matrix",e),b.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],f=e[8],h=J.determinant(e);if(Math.abs(h)<=N.EPSILON15)throw new x("matrix is not invertible");t[0]=s*f-u*a,t[1]=u*o-i*f,t[2]=i*a-s*o,t[3]=c*a-r*f,t[4]=n*f-c*o,t[5]=r*o-n*a,t[6]=r*u-c*s,t[7]=c*i-n*u,t[8]=n*s-r*i;const _=1/h;return J.multiplyByScalar(t,_,t)};const lde=new J;J.inverseTranspose=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),J.inverse(J.transpose(e,lde),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 Se(e){this.name="RuntimeError",this.message=e;let t;try{throw new Error}catch(n){t=n.stack}this.stack=t}l(Object.create)&&(Se.prototype=Object.create(Error.prototype),Se.prototype.constructor=Se);Se.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,f,h,_,g,p,y){this[0]=A(e,0),this[1]=A(o,0),this[2]=A(c,0),this[3]=A(_,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(f,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 b.typeOf.object("value",e),b.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 b.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){b.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(b.defined("array",e),b.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 b.defined("values",e),B.clone(e,t)};B.fromRowMajorArray=function(e,t){return b.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 b.typeOf.object("rotation",e),t=A(t,d.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){b.typeOf.object("translation",e),b.typeOf.object("rotation",t),b.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,f=t.x*t.w,h=t.y*t.y,_=t.y*t.z,g=t.y*t.w,p=t.z*t.z,y=t.z*t.w,C=t.w*t.w,T=a-h-p+C,E=2*(c-y),w=2*(u+g),S=2*(c+y),P=-a+h-p+C,O=2*(_-f),z=2*(u-g),R=2*(_+f),F=-a-h+p+C;return i[0]=T*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]=O*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 b.typeOf.object("translationRotationScale",e),B.fromTranslationQuaternionRotationScale(e.translation,e.rotation,e.scale,t)};B.fromTranslation=function(e,t){return b.typeOf.object("translation",e),B.fromRotationTranslation(J.IDENTITY,e,t)};B.fromScale=function(e,t){return b.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 b.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 b.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 X_=new d,K_=new d,P0=new d;B.fromCamera=function(e,t){b.typeOf.object("camera",e);const n=e.position,i=e.direction,o=e.up;b.typeOf.object("camera.position",n),b.typeOf.object("camera.direction",i),b.typeOf.object("camera.up",o),d.normalize(i,X_),d.normalize(d.cross(X_,o,K_),K_),d.normalize(d.cross(K_,X_,P0),P0);const r=K_.x,s=K_.y,a=K_.z,c=X_.x,u=X_.y,f=X_.z,h=P0.x,_=P0.y,g=P0.z,p=n.x,y=n.y,C=n.z,T=r*-p+s*-y+a*-C,E=h*-p+_*-y+g*-C,w=c*p+u*y+f*C;return l(t)?(t[0]=r,t[1]=h,t[2]=-c,t[3]=0,t[4]=s,t[5]=_,t[6]=-u,t[7]=0,t[8]=a,t[9]=g,t[10]=-f,t[11]=0,t[12]=T,t[13]=E,t[14]=w,t[15]=1,t):new B(r,s,a,T,h,_,g,E,-c,-u,-f,w,0,0,0,1)};B.computePerspectiveFieldOfView=function(e,t,n,i,o){b.typeOf.number.greaterThan("fovY",e,0),b.typeOf.number.lessThan("fovY",e,Math.PI),b.typeOf.number.greaterThan("near",n,0),b.typeOf.number.greaterThan("far",i,0),b.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){b.typeOf.number("left",e),b.typeOf.number("right",t),b.typeOf.number("bottom",n),b.typeOf.number("top",i),b.typeOf.number("near",o),b.typeOf.number("far",r),b.typeOf.object("result",s);let a=1/(t-e),c=1/(i-n),u=1/(r-o);const f=-(t+e)*a,h=-(i+n)*c,_=-(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]=f,s[13]=h,s[14]=_,s[15]=1,s};B.computePerspectiveOffCenter=function(e,t,n,i,o,r,s){b.typeOf.number("left",e),b.typeOf.number("right",t),b.typeOf.number("bottom",n),b.typeOf.number("top",i),b.typeOf.number("near",o),b.typeOf.number("far",r),b.typeOf.object("result",s);const a=2*o/(t-e),c=2*o/(i-n),u=(t+e)/(t-e),f=(i+n)/(i-n),h=-(r+o)/(r-o),_=-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]=f,s[10]=h,s[11]=_,s[12]=0,s[13]=0,s[14]=g,s[15]=0,s};B.computeInfinitePerspectiveOffCenter=function(e,t,n,i,o,r){b.typeOf.number("left",e),b.typeOf.number("right",t),b.typeOf.number("bottom",n),b.typeOf.number("top",i),b.typeOf.number("near",o),b.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),f=-1,h=-1,_=-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]=f,r[11]=h,r[12]=0,r[13]=0,r[14]=_,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,f=(n-t)*.5,h=c,_=u,g=f,p=o+c,y=r+u,C=t+f,T=1;return i[0]=h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=_,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]=C,i[15]=T,i};B.computeView=function(e,t,n,i,o){return b.typeOf.object("position",e),b.typeOf.object("direction",t),b.typeOf.object("up",n),b.typeOf.object("right",i),b.typeOf.object("result",o),o[0]=i.x,o[1]=n.x,o[2]=-t.x,o[3]=0,o[4]=i.y,o[5]=n.y,o[6]=-t.y,o[7]=0,o[8]=i.z,o[9]=n.z,o[10]=-t.z,o[11]=0,o[12]=-d.dot(i,e),o[13]=-d.dot(n,e),o[14]=d.dot(t,e),o[15]=1,o};B.toArray=function(e,t){return b.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 b.typeOf.number.greaterThanOrEquals("row",t,0),b.typeOf.number.lessThanOrEquals("row",t,3),b.typeOf.number.greaterThanOrEquals("column",e,0),b.typeOf.number.lessThanOrEquals("column",e,3),e*4+t};B.getColumn=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,3),b.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){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,3),b.typeOf.object("cartesian",n),b.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){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,3),b.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 b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,3),b.typeOf.object("cartesian",n),b.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 b.typeOf.object("matrix",e),b.typeOf.object("translation",t),b.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 ude=new d;B.setScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.typeOf.object("result",n);const i=B.getScale(e,ude),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 fde=new d;B.setUniformScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.typeOf.object("result",n);const i=B.getScale(e,fde),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 lI=new d;B.getScale=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),t.x=d.magnitude(d.fromElements(e[0],e[1],e[2],lI)),t.y=d.magnitude(d.fromElements(e[4],e[5],e[6],lI)),t.z=d.magnitude(d.fromElements(e[8],e[9],e[10],lI)),t};const Y3=new d;B.getMaximumScale=function(e){return B.getScale(e,Y3),d.maximumComponent(Y3)};const dde=new d;B.setRotation=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("result",n);const i=B.getScale(e,dde);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 hde=new d;B.getRotation=function(e,t){b.typeOf.object("matrix",e),b.typeOf.object("result",t);const n=B.getScale(e,hde);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){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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],f=e[7],h=e[8],_=e[9],g=e[10],p=e[11],y=e[12],C=e[13],T=e[14],E=e[15],w=t[0],S=t[1],P=t[2],O=t[3],z=t[4],R=t[5],F=t[6],H=t[7],v=t[8],I=t[9],m=t[10],D=t[11],L=t[12],M=t[13],V=t[14],k=t[15],W=i*w+a*S+h*P+y*O,G=o*w+c*S+_*P+C*O,K=r*w+u*S+g*P+T*O,q=s*w+f*S+p*P+E*O,te=i*z+a*R+h*F+y*H,$=o*z+c*R+_*F+C*H,X=r*z+u*R+g*F+T*H,Y=s*z+f*R+p*F+E*H,ae=i*v+a*I+h*m+y*D,ue=o*v+c*I+_*m+C*D,re=r*v+u*I+g*m+T*D,he=s*v+f*I+p*m+E*D,ce=i*L+a*M+h*V+y*k,Q=o*L+c*M+_*V+C*k,ie=r*L+u*M+g*V+T*k,de=s*L+f*M+p*V+E*k;return n[0]=W,n[1]=G,n[2]=K,n[3]=q,n[4]=te,n[5]=$,n[6]=X,n[7]=Y,n[8]=ae,n[9]=ue,n[10]=re,n[11]=he,n[12]=ce,n[13]=Q,n[14]=ie,n[15]=de,n};B.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),b.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){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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],f=e[9],h=e[10],_=e[12],g=e[13],p=e[14],y=t[0],C=t[1],T=t[2],E=t[4],w=t[5],S=t[6],P=t[8],O=t[9],z=t[10],R=t[12],F=t[13],H=t[14],v=i*y+s*C+u*T,I=o*y+a*C+f*T,m=r*y+c*C+h*T,D=i*E+s*w+u*S,L=o*E+a*w+f*S,M=r*E+c*w+h*S,V=i*P+s*O+u*z,k=o*P+a*O+f*z,W=r*P+c*O+h*z,G=i*R+s*F+u*H+_,K=o*R+a*F+f*H+g,q=r*R+c*F+h*H+p;return n[0]=v,n[1]=I,n[2]=m,n[3]=0,n[4]=D,n[5]=L,n[6]=M,n[7]=0,n[8]=V,n[9]=k,n[10]=W,n[11]=0,n[12]=G,n[13]=K,n[14]=q,n[15]=1,n};B.multiplyByMatrix3=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("rotation",t),b.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],f=e[9],h=e[10],_=t[0],g=t[1],p=t[2],y=t[3],C=t[4],T=t[5],E=t[6],w=t[7],S=t[8],P=i*_+s*g+u*p,O=o*_+a*g+f*p,z=r*_+c*g+h*p,R=i*y+s*C+u*T,F=o*y+a*C+f*T,H=r*y+c*C+h*T,v=i*E+s*w+u*S,I=o*E+a*w+f*S,m=r*E+c*w+h*S;return n[0]=P,n[1]=O,n[2]=z,n[3]=0,n[4]=R,n[5]=F,n[6]=H,n[7]=0,n[8]=v,n[9]=I,n[10]=m,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){b.typeOf.object("matrix",e),b.typeOf.object("translation",t),b.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){b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.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 b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.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){b.typeOf.object("matrix",e),b.typeOf.object("cartesian",t),b.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,f=e[3]*i+e[7]*o+e[11]*r+e[15]*s;return n.x=a,n.y=c,n.z=u,n.w=f,n};B.multiplyByPointAsVector=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("cartesian",t),b.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){b.typeOf.object("matrix",e),b.typeOf.object("cartesian",t),b.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 b.typeOf.object("matrix",e),b.typeOf.number("scalar",t),b.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 b.typeOf.object("matrix",e),b.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){b.typeOf.object("matrix",e),b.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 b.typeOf.object("matrix",e),b.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 b.typeOf.object("matrix",e),b.typeOf.object("result",t),t.x=e[12],t.y=e[13],t.z=e[14],t};B.getMatrix3=function(e,t){return b.typeOf.object("matrix",e),b.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 pde=new J,mde=new J,_de=new oe,gde=new oe(0,0,0,1);B.inverse=function(e,t){b.typeOf.object("matrix",e),b.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],f=e[2],h=e[6],_=e[10],g=e[14],p=e[3],y=e[7],C=e[11],T=e[15];let E=_*T,w=g*C,S=h*T,P=g*y,O=h*C,z=_*y,R=f*T,F=g*p,H=f*C,v=_*p,I=f*y,m=h*p;const D=E*a+P*c+O*u-(w*a+S*c+z*u),L=w*s+R*c+v*u-(E*s+F*c+H*u),M=S*s+F*a+I*u-(P*s+R*a+m*u),V=z*s+H*a+m*c-(O*s+v*a+I*c),k=w*i+S*o+z*r-(E*i+P*o+O*r),W=E*n+F*o+H*r-(w*n+R*o+v*r),G=P*n+R*i+m*r-(S*n+F*i+I*r),K=O*n+v*i+I*o-(z*n+H*i+m*o);E=o*u,w=r*c,S=i*u,P=r*a,O=i*c,z=o*a,R=n*u,F=r*s,H=n*c,v=o*s,I=n*a,m=i*s;const q=E*y+P*C+O*T-(w*y+S*C+z*T),te=w*p+R*C+v*T-(E*p+F*C+H*T),$=S*p+F*y+I*T-(P*p+R*y+m*T),X=z*p+H*y+m*C-(O*p+v*y+I*C),Y=S*_+z*g+w*h-(O*g+E*h+P*_),ae=H*g+E*f+F*_-(R*_+v*g+w*f),ue=R*h+m*g+P*f-(I*g+S*f+F*h),re=I*_+O*f+v*h-(H*h+m*_+z*f);let he=n*D+i*L+o*M+r*V;if(Math.abs(he)<N.EPSILON21){if(J.equalsEpsilon(B.getMatrix3(e,pde),mde,N.EPSILON7)&&oe.equals(B.getRow(e,3,_de),gde))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 Se("matrix is not invertible because its determinate is zero.")}return he=1/he,t[0]=D*he,t[1]=L*he,t[2]=M*he,t[3]=V*he,t[4]=k*he,t[5]=W*he,t[6]=G*he,t[7]=K*he,t[8]=q*he,t[9]=te*he,t[10]=$*he,t[11]=X*he,t[12]=Y*he,t[13]=ae*he,t[14]=ue*he,t[15]=re*he,t};B.inverseTransformation=function(e,t){b.typeOf.object("matrix",e),b.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],f=e[10],h=e[12],_=e[13],g=e[14],p=-n*h-i*_-o*g,y=-r*h-s*_-a*g,C=-c*h-u*_-f*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]=f,t[11]=0,t[12]=p,t[13]=y,t[14]=C,t[15]=1,t};const yde=new B;B.inverseTranspose=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),B.inverse(B.transpose(e,yde),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 Ade={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},se=Object.freeze(Ade),Cde=new d;function Ct(e){this._size=e.size,this._datatype=e.datatype,this.getValue=e.getValue}const cs={};cs[se.FLOAT]="float";cs[se.FLOAT_VEC2]="vec2";cs[se.FLOAT_VEC3]="vec3";cs[se.FLOAT_VEC4]="vec4";cs[se.INT]="int";cs[se.INT_VEC2]="ivec2";cs[se.INT_VEC3]="ivec3";cs[se.INT_VEC4]="ivec4";cs[se.BOOL]="bool";cs[se.BOOL_VEC2]="bvec2";cs[se.BOOL_VEC3]="bvec3";cs[se.BOOL_VEC4]="bvec4";cs[se.FLOAT_MAT2]="mat2";cs[se.FLOAT_MAT3]="mat3";cs[se.FLOAT_MAT4]="mat4";cs[se.SAMPLER_2D]="sampler2D";cs[se.SAMPLER_CUBE]="samplerCube";Ct.prototype.getDeclaration=function(e){let t=`uniform ${cs[this._datatype]} ${e}`;const n=this._size;return n===1?t+=";":t+=`[${n.toString()}];`,t};const Tde={czm_viewport:new Ct({size:1,datatype:se.FLOAT_VEC4,getValue:function(e){return e.viewportCartesian4}}),czm_viewportOrthographic:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.viewportOrthographic}}),czm_viewportTransformation:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.viewportTransformation}}),czm_globeDepthTexture:new Ct({size:1,datatype:se.SAMPLER_2D,getValue:function(e){return e.globeDepthTexture}}),czm_model:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.model}}),czm_inverseModel:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseModel}}),czm_view:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.view}}),czm_view3D:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.view3D}}),czm_viewRotation:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.viewRotation}}),czm_viewRotation3D:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.viewRotation3D}}),czm_inverseView:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseView}}),czm_inverseView3D:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseView3D}}),czm_inverseViewRotation:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation}}),czm_inverseViewRotation3D:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.inverseViewRotation3D}}),czm_projection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.projection}}),czm_inverseProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseProjection}}),czm_infiniteProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.infiniteProjection}}),czm_modelView:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelView}}),czm_modelView3D:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelView3D}}),czm_modelViewRelativeToEye:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelViewRelativeToEye}}),czm_inverseModelView:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseModelView}}),czm_inverseModelView3D:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseModelView3D}}),czm_viewProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.viewProjection}}),czm_inverseViewProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseViewProjection}}),czm_modelViewProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelViewProjection}}),czm_inverseModelViewProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.inverseModelViewProjection}}),czm_modelViewProjectionRelativeToEye:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelViewProjectionRelativeToEye}}),czm_modelViewInfiniteProjection:new Ct({size:1,datatype:se.FLOAT_MAT4,getValue:function(e){return e.modelViewInfiniteProjection}}),czm_orthographicIn3D:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.orthographicIn3D?1:0}}),czm_normal:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.normal}}),czm_normal3D:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.normal3D}}),czm_inverseNormal:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.inverseNormal}}),czm_inverseNormal3D:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.inverseNormal3D}}),czm_eyeHeight:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.eyeHeight}}),czm_eyeHeight2D:new Ct({size:1,datatype:se.FLOAT_VEC2,getValue:function(e){return e.eyeHeight2D}}),czm_entireFrustum:new Ct({size:1,datatype:se.FLOAT_VEC2,getValue:function(e){return e.entireFrustum}}),czm_currentFrustum:new Ct({size:1,datatype:se.FLOAT_VEC2,getValue:function(e){return e.currentFrustum}}),czm_frustumPlanes:new Ct({size:1,datatype:se.FLOAT_VEC4,getValue:function(e){return e.frustumPlanes}}),czm_farDepthFromNearPlusOne:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.farDepthFromNearPlusOne}}),czm_log2FarDepthFromNearPlusOne:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.log2FarDepthFromNearPlusOne}}),czm_oneOverLog2FarDepthFromNearPlusOne:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.oneOverLog2FarDepthFromNearPlusOne}}),czm_sunPositionWC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.sunPositionWC}}),czm_sunPositionColumbusView:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.sunPositionColumbusView}}),czm_sunDirectionEC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.sunDirectionEC}}),czm_sunDirectionWC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.sunDirectionWC}}),czm_moonDirectionEC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.moonDirectionEC}}),czm_lightDirectionEC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.lightDirectionEC}}),czm_lightDirectionWC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.lightDirectionWC}}),czm_lightColor:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.lightColor}}),czm_lightColorHdr:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.lightColorHdr}}),czm_encodedCameraPositionMCHigh:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCHigh}}),czm_encodedCameraPositionMCLow:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.encodedCameraPositionMCLow}}),czm_viewerPositionWC:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return B.getTranslation(e.inverseView,Cde)}}),czm_frameNumber:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.frameState.frameNumber}}),czm_morphTime:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.frameState.morphTime}}),czm_sceneMode:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.frameState.mode}}),czm_pass:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.pass}}),czm_backgroundColor:new Ct({size:1,datatype:se.FLOAT_VEC4,getValue:function(e){return e.backgroundColor}}),czm_brdfLut:new Ct({size:1,datatype:se.SAMPLER_2D,getValue:function(e){return e.brdfLut}}),czm_environmentMap:new Ct({size:1,datatype:se.SAMPLER_CUBE,getValue:function(e){return e.environmentMap}}),czm_specularEnvironmentMaps:new Ct({size:1,datatype:se.SAMPLER_2D,getValue:function(e){return e.specularEnvironmentMaps}}),czm_specularEnvironmentMapSize:new Ct({size:1,datatype:se.FLOAT_VEC2,getValue:function(e){return e.specularEnvironmentMapsDimensions}}),czm_specularEnvironmentMapsMaximumLOD:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.specularEnvironmentMapsMaximumLOD}}),czm_sphericalHarmonicCoefficients:new Ct({size:9,datatype:se.FLOAT_VEC3,getValue:function(e){return e.sphericalHarmonicCoefficients}}),czm_temeToPseudoFixed:new Ct({size:1,datatype:se.FLOAT_MAT3,getValue:function(e){return e.temeToPseudoFixedMatrix}}),czm_pixelRatio:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.pixelRatio}}),czm_fogDensity:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.fogDensity}}),czm_splitPosition:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.splitPosition}}),czm_geometricToleranceOverMeter:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.geometricToleranceOverMeter}}),czm_minimumDisableDepthTestDistance:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.minimumDisableDepthTestDistance}}),czm_invertClassificationColor:new Ct({size:1,datatype:se.FLOAT_VEC4,getValue:function(e){return e.invertClassificationColor}}),czm_gamma:new Ct({size:1,datatype:se.FLOAT,getValue:function(e){return e.gamma}}),czm_ellipsoidRadii:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.radii}}),czm_ellipsoidInverseRadii:new Ct({size:1,datatype:se.FLOAT_VEC3,getValue:function(e){return e.ellipsoid.oneOverRadii}})},qx=Tde;function Es(){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 bde(){return!0}function Ue(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=bde}const Rr={UNSIGNED_BYTE:se.UNSIGNED_BYTE,UNSIGNED_SHORT:se.UNSIGNED_SHORT,UNSIGNED_INT:se.UNSIGNED_INT};Rr.getSizeInBytes=function(e){switch(e){case Rr.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Rr.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Rr.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT}throw new x("indexDatatype is required and must be a valid IndexDatatype constant.")};Rr.fromSizeInBytes=function(e){switch(e){case 2:return Rr.UNSIGNED_SHORT;case 4:return Rr.UNSIGNED_INT;case 1:return Rr.UNSIGNED_BYTE;default:throw new x("Size in bytes cannot be mapped to an IndexDatatype")}};Rr.validate=function(e){return l(e)&&(e===Rr.UNSIGNED_BYTE||e===Rr.UNSIGNED_SHORT||e===Rr.UNSIGNED_INT)};Rr.createTypedArray=function(e,t){if(!l(e))throw new x("numberOfVertices is required.");return e>=N.SIXTY_FOUR_KILOBYTES?new Uint32Array(t):new Uint16Array(t)};Rr.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>=N.SIXTY_FOUR_KILOBYTES?new Uint32Array(t,n,i):new Uint16Array(t,n,i)};Rr.fromTypedArray=function(e){if(e instanceof Uint8Array)return Rr.UNSIGNED_BYTE;if(e instanceof Uint16Array)return Rr.UNSIGNED_SHORT;if(e instanceof Uint32Array)return Rr.UNSIGNED_INT;throw new x("array must be a Uint8Array, Uint16Array, or Uint32Array.")};const it=Object.freeze(Rr),Yx={STREAM_DRAW:se.STREAM_DRAW,STATIC_DRAW:se.STATIC_DRAW,DYNAMIC_DRAW:se.DYNAMIC_DRAW,validate:function(e){return e===Yx.STREAM_DRAW||e===Yx.STATIC_DRAW||e===Yx.DYNAMIC_DRAW}},Ze=Object.freeze(Yx);function At(e){if(e=A(e,A.EMPTY_OBJECT),b.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)&&(b.typeOf.object("options.typedArray",e.typedArray),b.typeOf.number("options.typedArray.byteLength",e.typedArray.byteLength)),!Ze.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),b.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=Es(),this._gl=t,this._webgl2=e.context._webgl2,this._bufferTarget=n,this._sizeInBytes=o,this._usage=r,this._buffer=a,this.vertexArrayDestroyable=!0}At.createVertexBuffer=function(e){return b.defined("options.context",e.context),new At({context:e.context,bufferTarget:se.ARRAY_BUFFER,typedArray:e.typedArray,sizeInBytes:e.sizeInBytes,usage:e.usage})};At.createIndexBuffer=function(e){if(b.defined("options.context",e.context),!it.validate(e.indexDatatype))throw new x("Invalid indexDatatype.");if(e.indexDatatype===it.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=it.getSizeInBytes(n),o=new At({context:t,bufferTarget:se.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(At.prototype,{sizeInBytes:{get:function(){return this._sizeInBytes}},usage:{get:function(){return this._usage}}});At.prototype._getBuffer=function(){return this._buffer};At.prototype.copyFromArrayView=function(e,t){t=A(t,0),b.defined("arrayView",e),b.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)};At.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===se.ELEMENT_ARRAY_BUFFER&&e._bufferTarget!==se.ELEMENT_ARRAY_BUFFER||this._bufferTarget!==se.ELEMENT_ARRAY_BUFFER&&e._bufferTarget===se.ELEMENT_ARRAY_BUFFER)throw new x("Can not copy an index buffer into another buffer type.");const o=se.COPY_READ_BUFFER,r=se.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)};At.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=se.COPY_READ_BUFFER;a.bindBuffer(c,this._buffer),a.getBufferSubData(c,t,e,n,i),a.bindBuffer(c,null)};At.prototype.isDestroyed=function(){return!1};At.prototype.destroy=function(){return this._gl.deleteBuffer(this._buffer),Ue(this)};let Kd;const Fo={requestFullscreen:void 0,exitFullscreen:void 0,fullscreenEnabled:void 0,fullscreenElement:void 0,fullscreenchange:void 0,fullscreenerror:void 0},Ra={};Object.defineProperties(Ra,{element:{get:function(){if(Ra.supportsFullscreen())return document[Fo.fullscreenElement]}},changeEventName:{get:function(){if(Ra.supportsFullscreen())return Fo.fullscreenchange}},errorEventName:{get:function(){if(Ra.supportsFullscreen())return Fo.fullscreenerror}},enabled:{get:function(){if(Ra.supportsFullscreen())return document[Fo.fullscreenEnabled]}},fullscreen:{get:function(){if(Ra.supportsFullscreen())return Ra.element!==null}}});Ra.supportsFullscreen=function(){if(l(Kd))return Kd;Kd=!1;const e=document.body;if(typeof e.requestFullscreen=="function")return Fo.requestFullscreen="requestFullscreen",Fo.exitFullscreen="exitFullscreen",Fo.fullscreenEnabled="fullscreenEnabled",Fo.fullscreenElement="fullscreenElement",Fo.fullscreenchange="fullscreenchange",Fo.fullscreenerror="fullscreenerror",Kd=!0,Kd;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"?(Fo.requestFullscreen=n,Kd=!0):(n=`${r}RequestFullScreen`,typeof e[n]=="function"&&(Fo.requestFullscreen=n,Kd=!0)),n=`${r}ExitFullscreen`,typeof document[n]=="function"?Fo.exitFullscreen=n:(n=`${r}CancelFullScreen`,typeof document[n]=="function"&&(Fo.exitFullscreen=n)),n=`${r}FullscreenEnabled`,document[n]!==void 0?Fo.fullscreenEnabled=n:(n=`${r}FullScreenEnabled`,document[n]!==void 0&&(Fo.fullscreenEnabled=n)),n=`${r}FullscreenElement`,document[n]!==void 0?Fo.fullscreenElement=n:(n=`${r}FullScreenElement`,document[n]!==void 0&&(Fo.fullscreenElement=n)),n=`${r}fullscreenchange`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenChange"),Fo.fullscreenchange=n),n=`${r}fullscreenerror`,document[`on${n}`]!==void 0&&(r==="ms"&&(n="MSFullscreenError"),Fo.fullscreenerror=n)}return Kd};Ra.requestFullscreen=function(e,t){Ra.supportsFullscreen()&&e[Fo.requestFullscreen]({vrDisplay:t})};Ra.exitFullscreen=function(){Ra.supportsFullscreen()&&document[Fo.exitFullscreen]()};Ra._names=Fo;const $r=Ra;let js;typeof navigator<"u"?js=navigator:js={};function Xm(e){const t=e.split(".");for(let n=0,i=t.length;n<i;++n)t[n]=parseInt(t[n],10);return t}let Hb,P9;function rN(){if(!l(Hb)&&(Hb=!1,!yv())){const e=/ Chrome\/([\.0-9]+)/.exec(js.userAgent);e!==null&&(Hb=!0,P9=Xm(e[1]))}return Hb}function Ede(){return rN()&&P9}let Vb,O9;function L9(){if(!l(Vb)&&(Vb=!1,!rN()&&!yv()&&/ Safari\/[\.0-9]+/.test(js.userAgent))){const e=/ Version\/([\.0-9]+)/.exec(js.userAgent);e!==null&&(Vb=!0,O9=Xm(e[1]))}return Vb}function xde(){return L9()&&O9}let kb,pL;function B9(){if(!l(kb)){kb=!1;const e=/ AppleWebKit\/([\.0-9]+)(\+?)/.exec(js.userAgent);e!==null&&(kb=!0,pL=Xm(e[1]),pL.isNightly=!!e[2])}return kb}function wde(){return B9()&&pL}let O0,mL;function R9(){if(!l(O0)){O0=!1;let e;js.appName==="Microsoft Internet Explorer"?(e=/MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(js.userAgent),e!==null&&(O0=!0,mL=Xm(e[1]))):js.appName==="Netscape"&&(e=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(js.userAgent),e!==null&&(O0=!0,mL=Xm(e[1])))}return O0}function Sde(){return R9()&&mL}let Gb,N9;function yv(){if(!l(Gb)){Gb=!1;const e=/ Edg\/([\.0-9]+)/.exec(js.userAgent);e!==null&&(Gb=!0,N9=Xm(e[1]))}return Gb}function vde(){return yv()&&N9}let Wb,M9;function sN(){if(!l(Wb)){Wb=!1;const e=/Firefox\/([\.0-9]+)/.exec(js.userAgent);e!==null&&(Wb=!0,M9=Xm(e[1]))}return Wb}let uI;function Dde(){return l(uI)||(uI=/Windows/i.test(js.appVersion)),uI}let fI;function Ide(){return l(fI)||(fI=navigator.platform==="iPhone"||navigator.platform==="iPod"||navigator.platform==="iPad"),fI}function Pde(){return sN()&&M9}let dI;function Ode(){return l(dI)||(dI=!sN()&&typeof PointerEvent<"u"&&(!l(js.pointerEnabled)||js.pointerEnabled)),dI}let F9,jb;function z9(){if(!l(jb)){const e=document.createElement("canvas");e.setAttribute("style","image-rendering: -moz-crisp-edges;image-rendering: pixelated;");const t=e.style.imageRendering;jb=l(t)&&t!=="",jb&&(F9=t)}return jb}function Lde(){return z9()?F9:void 0}function Bs(){if(!Bs.initialized)throw new x("You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP");return Bs._result}Bs._promise=void 0;Bs._result=void 0;Bs.initialize=function(){return l(Bs._promise)||(Bs._promise=new Promise(e=>{const t=new Image;t.onload=function(){Bs._result=t.width>0&&t.height>0,e(Bs._result)},t.onerror=function(){Bs._result=!1,e(Bs._result)},t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA"})),Bs._promise};Object.defineProperties(Bs,{initialized:{get:function(){return l(Bs._result)}}});const Og=[];typeof ArrayBuffer<"u"&&(Og.push(Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array),typeof Uint8ClampedArray<"u"&&Og.push(Uint8ClampedArray),typeof Uint8ClampedArray<"u"&&Og.push(Uint8ClampedArray),typeof BigInt64Array<"u"&&Og.push(BigInt64Array),typeof BigUint64Array<"u"&&Og.push(BigUint64Array));const Wu={isChrome:rN,chromeVersion:Ede,isSafari:L9,safariVersion:xde,isWebkit:B9,webkitVersion:wde,isInternetExplorer:R9,internetExplorerVersion:Sde,isEdge:yv,edgeVersion:vde,isFirefox:sN,firefoxVersion:Pde,isWindows:Dde,isIPadOrIOS:Ide,hardwareConcurrency:A(js.hardwareConcurrency,3),supportsPointerEvents:Ode,supportsImageRenderingPixelated:z9,supportsWebP:Bs,imageRenderingValue:Lde,typedArrayTypes:Og};Wu.supportsBasis=function(e){return Wu.supportsWebAssembly()&&e.context.supportsBasis};Wu.supportsFullscreen=function(){return $r.supportsFullscreen()};Wu.supportsTypedArrays=function(){return typeof ArrayBuffer<"u"};Wu.supportsBigInt64Array=function(){return typeof BigInt64Array<"u"};Wu.supportsBigUint64Array=function(){return typeof BigUint64Array<"u"};Wu.supportsBigInt=function(){return typeof BigInt<"u"};Wu.supportsWebWorkers=function(){return typeof Worker<"u"};Wu.supportsWebAssembly=function(){return typeof WebAssembly<"u"};const un=Wu;function hI(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 U(e,t,n,i){this.red=A(e,1),this.green=A(t,1),this.blue=A(n,1),this.alpha=A(i,1)}U.fromCartesian4=function(e,t){return b.typeOf.object("cartesian",e),l(t)?(t.red=e.x,t.green=e.y,t.blue=e.z,t.alpha=e.w,t):new U(e.x,e.y,e.z,e.w)};U.fromBytes=function(e,t,n,i,o){return e=U.byteToFloat(A(e,255)),t=U.byteToFloat(A(t,255)),n=U.byteToFloat(A(n,255)),i=U.byteToFloat(A(i,255)),l(o)?(o.red=e,o.green=t,o.blue=n,o.alpha=i,o):new U(e,t,n,i)};U.fromAlpha=function(e,t,n){return b.typeOf.object("color",e),b.typeOf.number("alpha",t),l(n)?(n.red=e.red,n.green=e.green,n.blue=e.blue,n.alpha=t,n):new U(e.red,e.green,e.blue,t)};let pI,aN,kf;un.supportsTypedArrays()&&(pI=new ArrayBuffer(4),aN=new Uint32Array(pI),kf=new Uint8Array(pI));U.fromRgba=function(e,t){return aN[0]=e,U.fromBytes(kf[0],kf[1],kf[2],kf[3],t)};U.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=hI(u,c,e+1/3),s=hI(u,c,e),a=hI(u,c,e-1/3)}return l(o)?(o.red=r,o.green=s,o.blue=a,o.alpha=i,o):new U(r,s,a,i)};U.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);b.typeOf.number.lessThanOrEquals("minimumRed",s,a),n=s+N.nextRandomNumber()*(a-s)}let i=e.green;if(!l(i)){const s=A(e.minimumGreen,0),a=A(e.maximumGreen,1);b.typeOf.number.lessThanOrEquals("minimumGreen",s,a),i=s+N.nextRandomNumber()*(a-s)}let o=e.blue;if(!l(o)){const s=A(e.minimumBlue,0),a=A(e.maximumBlue,1);b.typeOf.number.lessThanOrEquals("minimumBlue",s,a),o=s+N.nextRandomNumber()*(a-s)}let r=e.alpha;if(!l(r)){const s=A(e.minimumAlpha,0),a=A(e.maximumAlpha,1);b.typeOf.number.lessThanOrEquals("minumumAlpha",s,a),r=s+N.nextRandomNumber()*(a-s)}return l(t)?(t.red=n,t.green=i,t.blue=o,t.alpha=r,t):new U(n,i,o,r)};const Bde=/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i,Rde=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i,Nde=/^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i,Mde=/^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;U.fromCssColorString=function(e,t){b.typeOf.string("color",e),l(t)||(t=new U),e=e.replace(/\s/g,"");const n=U[e.toUpperCase()];if(l(n))return U.clone(n,t),t;let i=Bde.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=Rde.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=Nde.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=Mde.exec(e),i!==null?U.fromHsl(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,parseFloat(A(i[4],"1.0")),t):(t=void 0,t))))};U.packedLength=4;U.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.red,t[n++]=e.green,t[n++]=e.blue,t[n]=e.alpha,t};U.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new U),n.red=e[t++],n.green=e[t++],n.blue=e[t++],n.alpha=e[t],n};U.byteToFloat=function(e){return e/255};U.floatToByte=function(e){return e===1?255:e*256|0};U.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 U(e.red,e.green,e.blue,e.alpha)};U.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};U.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]};U.prototype.clone=function(e){return U.clone(this,e)};U.prototype.equals=function(e){return U.equals(this,e)};U.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};U.prototype.toString=function(){return`(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`};U.prototype.toCssColorString=function(){const e=U.floatToByte(this.red),t=U.floatToByte(this.green),n=U.floatToByte(this.blue);return this.alpha===1?`rgb(${e},${t},${n})`:`rgba(${e},${t},${n},${this.alpha})`};U.prototype.toCssHexString=function(){let e=U.floatToByte(this.red).toString(16);e.length<2&&(e=`0${e}`);let t=U.floatToByte(this.green).toString(16);t.length<2&&(t=`0${t}`);let n=U.floatToByte(this.blue).toString(16);if(n.length<2&&(n=`0${n}`),this.alpha<1){let i=U.floatToByte(this.alpha).toString(16);return i.length<2&&(i=`0${i}`),`#${e}${t}${n}${i}`}return`#${e}${t}${n}`};U.prototype.toBytes=function(e){const t=U.floatToByte(this.red),n=U.floatToByte(this.green),i=U.floatToByte(this.blue),o=U.floatToByte(this.alpha);return l(e)?(e[0]=t,e[1]=n,e[2]=i,e[3]=o,e):[t,n,i,o]};U.prototype.toRgba=function(){return kf[0]=U.floatToByte(this.red),kf[1]=U.floatToByte(this.green),kf[2]=U.floatToByte(this.blue),kf[3]=U.floatToByte(this.alpha),aN[0]};U.prototype.brighten=function(e,t){return b.typeOf.number("magnitude",e),b.typeOf.number.greaterThanOrEquals("magnitude",e,0),b.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};U.prototype.darken=function(e,t){return b.typeOf.number("magnitude",e),b.typeOf.number.greaterThanOrEquals("magnitude",e,0),b.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};U.prototype.withAlpha=function(e,t){return U.fromAlpha(this,e,t)};U.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};U.subtract=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};U.multiply=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};U.divide=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};U.mod=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};U.lerp=function(e,t,n,i){return b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i),i.red=N.lerp(e.red,t.red,n),i.green=N.lerp(e.green,t.green,n),i.blue=N.lerp(e.blue,t.blue,n),i.alpha=N.lerp(e.alpha,t.alpha,n),i};U.multiplyByScalar=function(e,t,n){return b.typeOf.object("color",e),b.typeOf.number("scalar",t),b.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};U.divideByScalar=function(e,t,n){return b.typeOf.object("color",e),b.typeOf.number("scalar",t),b.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};U.ALICEBLUE=Object.freeze(U.fromCssColorString("#F0F8FF"));U.ANTIQUEWHITE=Object.freeze(U.fromCssColorString("#FAEBD7"));U.AQUA=Object.freeze(U.fromCssColorString("#00FFFF"));U.AQUAMARINE=Object.freeze(U.fromCssColorString("#7FFFD4"));U.AZURE=Object.freeze(U.fromCssColorString("#F0FFFF"));U.BEIGE=Object.freeze(U.fromCssColorString("#F5F5DC"));U.BISQUE=Object.freeze(U.fromCssColorString("#FFE4C4"));U.BLACK=Object.freeze(U.fromCssColorString("#000000"));U.BLANCHEDALMOND=Object.freeze(U.fromCssColorString("#FFEBCD"));U.BLUE=Object.freeze(U.fromCssColorString("#0000FF"));U.BLUEVIOLET=Object.freeze(U.fromCssColorString("#8A2BE2"));U.BROWN=Object.freeze(U.fromCssColorString("#A52A2A"));U.BURLYWOOD=Object.freeze(U.fromCssColorString("#DEB887"));U.CADETBLUE=Object.freeze(U.fromCssColorString("#5F9EA0"));U.CHARTREUSE=Object.freeze(U.fromCssColorString("#7FFF00"));U.CHOCOLATE=Object.freeze(U.fromCssColorString("#D2691E"));U.CORAL=Object.freeze(U.fromCssColorString("#FF7F50"));U.CORNFLOWERBLUE=Object.freeze(U.fromCssColorString("#6495ED"));U.CORNSILK=Object.freeze(U.fromCssColorString("#FFF8DC"));U.CRIMSON=Object.freeze(U.fromCssColorString("#DC143C"));U.CYAN=Object.freeze(U.fromCssColorString("#00FFFF"));U.DARKBLUE=Object.freeze(U.fromCssColorString("#00008B"));U.DARKCYAN=Object.freeze(U.fromCssColorString("#008B8B"));U.DARKGOLDENROD=Object.freeze(U.fromCssColorString("#B8860B"));U.DARKGRAY=Object.freeze(U.fromCssColorString("#A9A9A9"));U.DARKGREEN=Object.freeze(U.fromCssColorString("#006400"));U.DARKGREY=U.DARKGRAY;U.DARKKHAKI=Object.freeze(U.fromCssColorString("#BDB76B"));U.DARKMAGENTA=Object.freeze(U.fromCssColorString("#8B008B"));U.DARKOLIVEGREEN=Object.freeze(U.fromCssColorString("#556B2F"));U.DARKORANGE=Object.freeze(U.fromCssColorString("#FF8C00"));U.DARKORCHID=Object.freeze(U.fromCssColorString("#9932CC"));U.DARKRED=Object.freeze(U.fromCssColorString("#8B0000"));U.DARKSALMON=Object.freeze(U.fromCssColorString("#E9967A"));U.DARKSEAGREEN=Object.freeze(U.fromCssColorString("#8FBC8F"));U.DARKSLATEBLUE=Object.freeze(U.fromCssColorString("#483D8B"));U.DARKSLATEGRAY=Object.freeze(U.fromCssColorString("#2F4F4F"));U.DARKSLATEGREY=U.DARKSLATEGRAY;U.DARKTURQUOISE=Object.freeze(U.fromCssColorString("#00CED1"));U.DARKVIOLET=Object.freeze(U.fromCssColorString("#9400D3"));U.DEEPPINK=Object.freeze(U.fromCssColorString("#FF1493"));U.DEEPSKYBLUE=Object.freeze(U.fromCssColorString("#00BFFF"));U.DIMGRAY=Object.freeze(U.fromCssColorString("#696969"));U.DIMGREY=U.DIMGRAY;U.DODGERBLUE=Object.freeze(U.fromCssColorString("#1E90FF"));U.FIREBRICK=Object.freeze(U.fromCssColorString("#B22222"));U.FLORALWHITE=Object.freeze(U.fromCssColorString("#FFFAF0"));U.FORESTGREEN=Object.freeze(U.fromCssColorString("#228B22"));U.FUCHSIA=Object.freeze(U.fromCssColorString("#FF00FF"));U.GAINSBORO=Object.freeze(U.fromCssColorString("#DCDCDC"));U.GHOSTWHITE=Object.freeze(U.fromCssColorString("#F8F8FF"));U.GOLD=Object.freeze(U.fromCssColorString("#FFD700"));U.GOLDENROD=Object.freeze(U.fromCssColorString("#DAA520"));U.GRAY=Object.freeze(U.fromCssColorString("#808080"));U.GREEN=Object.freeze(U.fromCssColorString("#008000"));U.GREENYELLOW=Object.freeze(U.fromCssColorString("#ADFF2F"));U.GREY=U.GRAY;U.HONEYDEW=Object.freeze(U.fromCssColorString("#F0FFF0"));U.HOTPINK=Object.freeze(U.fromCssColorString("#FF69B4"));U.INDIANRED=Object.freeze(U.fromCssColorString("#CD5C5C"));U.INDIGO=Object.freeze(U.fromCssColorString("#4B0082"));U.IVORY=Object.freeze(U.fromCssColorString("#FFFFF0"));U.KHAKI=Object.freeze(U.fromCssColorString("#F0E68C"));U.LAVENDER=Object.freeze(U.fromCssColorString("#E6E6FA"));U.LAVENDAR_BLUSH=Object.freeze(U.fromCssColorString("#FFF0F5"));U.LAWNGREEN=Object.freeze(U.fromCssColorString("#7CFC00"));U.LEMONCHIFFON=Object.freeze(U.fromCssColorString("#FFFACD"));U.LIGHTBLUE=Object.freeze(U.fromCssColorString("#ADD8E6"));U.LIGHTCORAL=Object.freeze(U.fromCssColorString("#F08080"));U.LIGHTCYAN=Object.freeze(U.fromCssColorString("#E0FFFF"));U.LIGHTGOLDENRODYELLOW=Object.freeze(U.fromCssColorString("#FAFAD2"));U.LIGHTGRAY=Object.freeze(U.fromCssColorString("#D3D3D3"));U.LIGHTGREEN=Object.freeze(U.fromCssColorString("#90EE90"));U.LIGHTGREY=U.LIGHTGRAY;U.LIGHTPINK=Object.freeze(U.fromCssColorString("#FFB6C1"));U.LIGHTSEAGREEN=Object.freeze(U.fromCssColorString("#20B2AA"));U.LIGHTSKYBLUE=Object.freeze(U.fromCssColorString("#87CEFA"));U.LIGHTSLATEGRAY=Object.freeze(U.fromCssColorString("#778899"));U.LIGHTSLATEGREY=U.LIGHTSLATEGRAY;U.LIGHTSTEELBLUE=Object.freeze(U.fromCssColorString("#B0C4DE"));U.LIGHTYELLOW=Object.freeze(U.fromCssColorString("#FFFFE0"));U.LIME=Object.freeze(U.fromCssColorString("#00FF00"));U.LIMEGREEN=Object.freeze(U.fromCssColorString("#32CD32"));U.LINEN=Object.freeze(U.fromCssColorString("#FAF0E6"));U.MAGENTA=Object.freeze(U.fromCssColorString("#FF00FF"));U.MAROON=Object.freeze(U.fromCssColorString("#800000"));U.MEDIUMAQUAMARINE=Object.freeze(U.fromCssColorString("#66CDAA"));U.MEDIUMBLUE=Object.freeze(U.fromCssColorString("#0000CD"));U.MEDIUMORCHID=Object.freeze(U.fromCssColorString("#BA55D3"));U.MEDIUMPURPLE=Object.freeze(U.fromCssColorString("#9370DB"));U.MEDIUMSEAGREEN=Object.freeze(U.fromCssColorString("#3CB371"));U.MEDIUMSLATEBLUE=Object.freeze(U.fromCssColorString("#7B68EE"));U.MEDIUMSPRINGGREEN=Object.freeze(U.fromCssColorString("#00FA9A"));U.MEDIUMTURQUOISE=Object.freeze(U.fromCssColorString("#48D1CC"));U.MEDIUMVIOLETRED=Object.freeze(U.fromCssColorString("#C71585"));U.MIDNIGHTBLUE=Object.freeze(U.fromCssColorString("#191970"));U.MINTCREAM=Object.freeze(U.fromCssColorString("#F5FFFA"));U.MISTYROSE=Object.freeze(U.fromCssColorString("#FFE4E1"));U.MOCCASIN=Object.freeze(U.fromCssColorString("#FFE4B5"));U.NAVAJOWHITE=Object.freeze(U.fromCssColorString("#FFDEAD"));U.NAVY=Object.freeze(U.fromCssColorString("#000080"));U.OLDLACE=Object.freeze(U.fromCssColorString("#FDF5E6"));U.OLIVE=Object.freeze(U.fromCssColorString("#808000"));U.OLIVEDRAB=Object.freeze(U.fromCssColorString("#6B8E23"));U.ORANGE=Object.freeze(U.fromCssColorString("#FFA500"));U.ORANGERED=Object.freeze(U.fromCssColorString("#FF4500"));U.ORCHID=Object.freeze(U.fromCssColorString("#DA70D6"));U.PALEGOLDENROD=Object.freeze(U.fromCssColorString("#EEE8AA"));U.PALEGREEN=Object.freeze(U.fromCssColorString("#98FB98"));U.PALETURQUOISE=Object.freeze(U.fromCssColorString("#AFEEEE"));U.PALEVIOLETRED=Object.freeze(U.fromCssColorString("#DB7093"));U.PAPAYAWHIP=Object.freeze(U.fromCssColorString("#FFEFD5"));U.PEACHPUFF=Object.freeze(U.fromCssColorString("#FFDAB9"));U.PERU=Object.freeze(U.fromCssColorString("#CD853F"));U.PINK=Object.freeze(U.fromCssColorString("#FFC0CB"));U.PLUM=Object.freeze(U.fromCssColorString("#DDA0DD"));U.POWDERBLUE=Object.freeze(U.fromCssColorString("#B0E0E6"));U.PURPLE=Object.freeze(U.fromCssColorString("#800080"));U.RED=Object.freeze(U.fromCssColorString("#FF0000"));U.ROSYBROWN=Object.freeze(U.fromCssColorString("#BC8F8F"));U.ROYALBLUE=Object.freeze(U.fromCssColorString("#4169E1"));U.SADDLEBROWN=Object.freeze(U.fromCssColorString("#8B4513"));U.SALMON=Object.freeze(U.fromCssColorString("#FA8072"));U.SANDYBROWN=Object.freeze(U.fromCssColorString("#F4A460"));U.SEAGREEN=Object.freeze(U.fromCssColorString("#2E8B57"));U.SEASHELL=Object.freeze(U.fromCssColorString("#FFF5EE"));U.SIENNA=Object.freeze(U.fromCssColorString("#A0522D"));U.SILVER=Object.freeze(U.fromCssColorString("#C0C0C0"));U.SKYBLUE=Object.freeze(U.fromCssColorString("#87CEEB"));U.SLATEBLUE=Object.freeze(U.fromCssColorString("#6A5ACD"));U.SLATEGRAY=Object.freeze(U.fromCssColorString("#708090"));U.SLATEGREY=U.SLATEGRAY;U.SNOW=Object.freeze(U.fromCssColorString("#FFFAFA"));U.SPRINGGREEN=Object.freeze(U.fromCssColorString("#00FF7F"));U.STEELBLUE=Object.freeze(U.fromCssColorString("#4682B4"));U.TAN=Object.freeze(U.fromCssColorString("#D2B48C"));U.TEAL=Object.freeze(U.fromCssColorString("#008080"));U.THISTLE=Object.freeze(U.fromCssColorString("#D8BFD8"));U.TOMATO=Object.freeze(U.fromCssColorString("#FF6347"));U.TURQUOISE=Object.freeze(U.fromCssColorString("#40E0D0"));U.VIOLET=Object.freeze(U.fromCssColorString("#EE82EE"));U.WHEAT=Object.freeze(U.fromCssColorString("#F5DEB3"));U.WHITE=Object.freeze(U.fromCssColorString("#FFFFFF"));U.WHITESMOKE=Object.freeze(U.fromCssColorString("#F5F5F5"));U.YELLOW=Object.freeze(U.fromCssColorString("#FFFF00"));U.YELLOWGREEN=Object.freeze(U.fromCssColorString("#9ACD32"));U.TRANSPARENT=Object.freeze(new U(0,0,0,0));function Ji(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}Ji.ALL=Object.freeze(new Ji({color:new U(0,0,0,0),depth:1,stencil:0}));Ji.prototype.execute=function(e,t){e.clear(this,t)};const Fde={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},Be=Object.freeze(Fde);function MC(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=Be.COMPUTE,this.owner=e.owner}MC.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 b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.x,t[n]=e.y,t};j.unpack=function(e,t,n){return b.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){b.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(b.defined("array",e),b.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 b.typeOf.object("cartesian",e),Math.max(e.x,e.y)};j.minimumComponent=function(e){return b.typeOf.object("cartesian",e),Math.min(e.x,e.y)};j.minimumByComponent=function(e,t,n){return b.typeOf.object("first",e),b.typeOf.object("second",t),b.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 b.typeOf.object("first",e),b.typeOf.object("second",t),b.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){b.typeOf.object("value",e),b.typeOf.object("min",t),b.typeOf.object("max",n),b.typeOf.object("result",i);const o=N.clamp(e.x,t.x,n.x),r=N.clamp(e.y,t.y,n.y);return i.x=o,i.y=r,i};j.magnitudeSquared=function(e){return b.typeOf.object("cartesian",e),e.x*e.x+e.y*e.y};j.magnitude=function(e){return Math.sqrt(j.magnitudeSquared(e))};const Qw=new j;j.distance=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),j.subtract(e,t,Qw),j.magnitude(Qw)};j.distanceSquared=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),j.subtract(e,t,Qw),j.magnitudeSquared(Qw)};j.normalize=function(e,t){b.typeOf.object("cartesian",e),b.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 b.typeOf.object("left",e),b.typeOf.object("right",t),e.x*t.x+e.y*t.y};j.cross=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),e.x*t.y-e.y*t.x};j.multiplyComponents=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x*t.x,n.y=e.y*t.y,n};j.divideComponents=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x/t.x,n.y=e.y/t.y,n};j.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x+t.x,n.y=e.y+t.y,n};j.subtract=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.typeOf.object("result",n),n.x=e.x-t.x,n.y=e.y-t.y,n};j.multiplyByScalar=function(e,t,n){return b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.typeOf.object("result",n),n.x=e.x*t,n.y=e.y*t,n};j.divideByScalar=function(e,t,n){return b.typeOf.object("cartesian",e),b.typeOf.number("scalar",t),b.typeOf.object("result",n),n.x=e.x/t,n.y=e.y/t,n};j.negate=function(e,t){return b.typeOf.object("cartesian",e),b.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t};j.abs=function(e,t){return b.typeOf.object("cartesian",e),b.typeOf.object("result",t),t.x=Math.abs(e.x),t.y=Math.abs(e.y),t};const $3=new j;j.lerp=function(e,t,n,i){return b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i),j.multiplyByScalar(t,n,$3),i=j.multiplyByScalar(e,1-n,i),j.add($3,i,i)};const X3=new j,K3=new j;j.angleBetween=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),j.normalize(e,X3),j.normalize(t,K3),N.acosClamped(j.dot(X3,K3))};const zde=new j;j.mostOrthogonalAxis=function(e,t){b.typeOf.object("cartesian",e),b.typeOf.object("result",t);const n=j.normalize(e,zde);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)&&N.equalsEpsilon(e.x,t.x,n,i)&&N.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 Ude=new d,Hde=new d;function U9(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,f=t.z,h=r*r*c*c,_=s*s*u*u,g=a*a*f*f,p=h+_+g,y=Math.sqrt(1/p),C=d.multiplyByScalar(e,y,Ude);if(p<i)return isFinite(y)?d.clone(C,o):void 0;const T=n.x,E=n.y,w=n.z,S=Hde;S.x=C.x*T*2,S.y=C.y*E*2,S.z=C.z*w*2;let P=(1-y)*d.magnitude(e)/(.5*d.magnitude(S)),O=0,z,R,F,H,v,I,m,D,L,M,V;do{P-=O,F=1/(1+P*T),H=1/(1+P*E),v=1/(1+P*w),I=F*F,m=H*H,D=v*v,L=I*F,M=m*H,V=D*v,z=h*I+_*m+g*D-1,R=h*L*T+_*M*E+g*V*w;const k=-2*R;O=z/k}while(Math.abs(z)>N.EPSILON12);return l(o)?(o.x=r*F,o.y=s*H,o.z=a*v,o):new d(r*F,s*H,a*v)}function Ae(e,t,n){this.longitude=A(e,0),this.latitude=A(t,0),this.height=A(n,0)}Ae.fromRadians=function(e,t,n,i){return b.typeOf.number("longitude",e),b.typeOf.number("latitude",t),n=A(n,0),l(i)?(i.longitude=e,i.latitude=t,i.height=n,i):new Ae(e,t,n)};Ae.fromDegrees=function(e,t,n,i){return b.typeOf.number("longitude",e),b.typeOf.number("latitude",t),e=N.toRadians(e),t=N.toRadians(t),Ae.fromRadians(e,t,n,i)};const Vde=new d,kde=new d,Gde=new d,Wde=new d(1/6378137,1/6378137,1/6356752314245179e-9),jde=new d(1/(6378137*6378137),1/(6378137*6378137),1/(6356752314245179e-9*6356752314245179e-9)),qde=N.EPSILON1;Ae.fromCartesian=function(e,t,n){const i=l(t)?t.oneOverRadii:Wde,o=l(t)?t.oneOverRadiiSquared:jde,r=l(t)?t._centerToleranceSquared:qde,s=U9(e,i,o,r,kde);if(!l(s))return;let a=d.multiplyComponents(s,o,Vde);a=d.normalize(a,a);const c=d.subtract(e,s,Gde),u=Math.atan2(a.y,a.x),f=Math.asin(a.z),h=N.sign(d.dot(c,e))*d.magnitude(c);return l(n)?(n.longitude=u,n.latitude=f,n.height=h,n):new Ae(u,f,h)};Ae.toCartesian=function(e,t,n){return b.defined("cartographic",e),d.fromRadians(e.longitude,e.latitude,e.height,t,n)};Ae.clone=function(e,t){if(l(e))return l(t)?(t.longitude=e.longitude,t.latitude=e.latitude,t.height=e.height,t):new Ae(e.longitude,e.latitude,e.height)};Ae.equals=function(e,t){return e===t||l(e)&&l(t)&&e.longitude===t.longitude&&e.latitude===t.latitude&&e.height===t.height};Ae.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};Ae.ZERO=Object.freeze(new Ae(0,0,0));Ae.prototype.clone=function(e){return Ae.clone(this,e)};Ae.prototype.equals=function(e){return Ae.equals(this,e)};Ae.prototype.equalsEpsilon=function(e,t){return Ae.equalsEpsilon(this,e,t)};Ae.prototype.toString=function(){return`(${this.longitude}, ${this.latitude}, ${this.height})`};function H9(e,t,n,i){t=A(t,0),n=A(n,0),i=A(i,0),b.typeOf.number.greaterThanOrEquals("x",t,0),b.typeOf.number.greaterThanOrEquals("y",n,0),b.typeOf.number.greaterThanOrEquals("z",i,0),e._radii=new d(t,n,i),e._radiiSquared=new d(t*t,n*n,i*i),e._radiiToTheFourth=new d(t*t*t*t,n*n*n*n,i*i*i*i),e._oneOverRadii=new d(t===0?0:1/t,n===0?0:1/n,i===0?0:1/i),e._oneOverRadiiSquared=new d(t===0?0:1/(t*t),n===0?0:1/(n*n),i===0?0:1/(i*i)),e._minimumRadius=Math.min(t,n,i),e._maximumRadius=Math.max(t,n,i),e._centerToleranceSquared=N.EPSILON1,e._radiiSquared.z!==0&&(e._squaredXOverSquaredZ=e._radiiSquared.x/e._radiiSquared.z)}function pe(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,H9(this,e,t,n)}Object.defineProperties(pe.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}}});pe.clone=function(e,t){if(!l(e))return;const n=e._radii;return l(t)?(d.clone(n,t._radii),d.clone(e._radiiSquared,t._radiiSquared),d.clone(e._radiiToTheFourth,t._radiiToTheFourth),d.clone(e._oneOverRadii,t._oneOverRadii),d.clone(e._oneOverRadiiSquared,t._oneOverRadiiSquared),t._minimumRadius=e._minimumRadius,t._maximumRadius=e._maximumRadius,t._centerToleranceSquared=e._centerToleranceSquared,t):new pe(n.x,n.y,n.z)};pe.fromCartesian3=function(e,t){return l(t)||(t=new pe),l(e)&&H9(t,e.x,e.y,e.z),t};pe.WGS84=Object.freeze(new pe(6378137,6378137,6356752314245179e-9));pe.UNIT_SPHERE=Object.freeze(new pe(1,1,1));pe.MOON=Object.freeze(new pe(N.LUNAR_RADIUS,N.LUNAR_RADIUS,N.LUNAR_RADIUS));pe.prototype.clone=function(e){return pe.clone(this,e)};pe.packedLength=d.packedLength;pe.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),d.pack(e._radii,t,n),t};pe.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=d.unpack(e,t);return pe.fromCartesian3(i,n)};pe.prototype.geocentricSurfaceNormal=d.normalize;pe.prototype.geodeticSurfaceNormalCartographic=function(e,t){b.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 d),t.x=r,t.y=s,t.z=a,d.normalize(t,t)};pe.prototype.geodeticSurfaceNormal=function(e,t){if(!d.equalsEpsilon(e,d.ZERO,N.EPSILON14))return l(t)||(t=new d),t=d.multiplyComponents(e,this._oneOverRadiiSquared,t),d.normalize(t,t)};const Yde=new d,$de=new d;pe.prototype.cartographicToCartesian=function(e,t){const n=Yde,i=$de;this.geodeticSurfaceNormalCartographic(e,n),d.multiplyComponents(this._radiiSquared,n,i);const o=Math.sqrt(d.dot(n,i));return d.divideByScalar(i,o,i),d.multiplyByScalar(n,e.height,n),l(t)||(t=new d),d.add(i,n,t)};pe.prototype.cartographicArrayToCartesianArray=function(e,t){b.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 Xde=new d,Kde=new d,Jde=new d;pe.prototype.cartesianToCartographic=function(e,t){const n=this.scaleToGeodeticSurface(e,Kde);if(!l(n))return;const i=this.geodeticSurfaceNormal(n,Xde),o=d.subtract(e,n,Jde),r=Math.atan2(i.y,i.x),s=Math.asin(i.z),a=N.sign(d.dot(o,e))*d.magnitude(o);return l(t)?(t.longitude=r,t.latitude=s,t.height=a,t):new Ae(r,s,a)};pe.prototype.cartesianArrayToCartographicArray=function(e,t){b.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};pe.prototype.scaleToGeodeticSurface=function(e,t){return U9(e,this._oneOverRadii,this._oneOverRadiiSquared,this._centerToleranceSquared,t)};pe.prototype.scaleToGeocentricSurface=function(e,t){b.typeOf.object("cartesian",e),l(t)||(t=new d);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 d.multiplyByScalar(e,s,t)};pe.prototype.transformPositionToScaledSpace=function(e,t){return l(t)||(t=new d),d.multiplyComponents(e,this._oneOverRadii,t)};pe.prototype.transformPositionFromScaledSpace=function(e,t){return l(t)||(t=new d),d.multiplyComponents(e,this._radii,t)};pe.prototype.equals=function(e){return this===e||l(e)&&d.equals(this._radii,e._radii)};pe.prototype.toString=function(){return this._radii.toString()};pe.prototype.getSurfaceNormalIntersectionWithZAxis=function(e,t,n){if(b.typeOf.object("position",e),!N.equalsEpsilon(this._radii.x,this._radii.y,N.EPSILON15))throw new x("Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)");b.typeOf.number.greaterThan("Ellipsoid.radii.z",this._radii.z,0),t=A(t,0);const i=this._squaredXOverSquaredZ;if(l(n)||(n=new d),n.x=0,n.y=0,n.z=e.z*(1-i),!(Math.abs(n.z)>=this._radii.z-t))return n};const Qde=[.14887433898163,.43339539412925,.67940956829902,.86506336668898,.97390652851717,0],Zde=[.29552422471475,.26926671930999,.21908636251598,.14945134915058,.066671344308684,0];function J3(e,t,n){b.typeOf.number("a",e),b.typeOf.number("b",t),b.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*Qde[s];r+=Zde[s]*(n(i+a)+n(i-a))}return r*=o,r}pe.prototype.surfaceArea=function(e){b.typeOf.object("rectangle",e);const t=e.west;let n=e.east;const i=e.south,o=e.north;for(;n<t;)n+=N.TWO_PI;const r=this._radiiSquared,s=r.x,a=r.y,c=r.z,u=s*a;return J3(i,o,function(f){const h=Math.cos(f),_=Math.sin(f);return Math.cos(f)*J3(t,n,function(g){const p=Math.cos(g),y=Math.sin(g);return Math.sqrt(u*_*_+c*(a*p*p+s*y*y)*h*h)})})};function jo(e){this._ellipsoid=A(e,pe.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(jo.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});jo.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 d(i,o,r)};jo.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 Ae(i,o,r)};const ehe={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},mn=Object.freeze(ehe);function _e(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(_e.prototype,{width:{get:function(){return _e.computeWidth(this)}},height:{get:function(){return _e.computeHeight(this)}}});_e.packedLength=4;_e.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.west,t[n++]=e.south,t[n++]=e.east,t[n]=e.north,t};_e.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new _e),n.west=e[t++],n.south=e[t++],n.east=e[t++],n.north=e[t],n};_e.computeWidth=function(e){b.typeOf.object("rectangle",e);let t=e.east;const n=e.west;return t<n&&(t+=N.TWO_PI),t-n};_e.computeHeight=function(e){return b.typeOf.object("rectangle",e),e.north-e.south};_e.fromDegrees=function(e,t,n,i,o){return e=N.toRadians(A(e,0)),t=N.toRadians(A(t,0)),n=N.toRadians(A(n,0)),i=N.toRadians(A(i,0)),l(o)?(o.west=e,o.south=t,o.east=n,o.north=i,o):new _e(e,t,n,i)};_e.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 _e(e,t,n,i)};_e.fromCartographicArray=function(e,t){b.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 f=e[c];n=Math.min(n,f.longitude),i=Math.max(i,f.longitude),s=Math.min(s,f.latitude),a=Math.max(a,f.latitude);const h=f.longitude>=0?f.longitude:f.longitude+N.TWO_PI;o=Math.min(o,h),r=Math.max(r,h)}return i-n>r-o&&(n=o,i=r,i>N.PI&&(i=i-N.TWO_PI),n>N.PI&&(n=n-N.TWO_PI)),l(t)?(t.west=n,t.south=s,t.east=i,t.north=a,t):new _e(n,s,i,a)};_e.fromCartesianArray=function(e,t,n){b.defined("cartesians",e),t=A(t,pe.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,f=e.length;u<f;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 _=h.longitude>=0?h.longitude:h.longitude+N.TWO_PI;r=Math.min(r,_),s=Math.max(s,_)}return o-i>s-r&&(i=r,o=s,o>N.PI&&(o=o-N.TWO_PI),i>N.PI&&(i=i-N.TWO_PI)),l(n)?(n.west=i,n.south=a,n.east=o,n.north=c,n):new _e(i,a,o,c)};_e.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 _e(e.west,e.south,e.east,e.north)};_e.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};_e.prototype.clone=function(e){return _e.clone(this,e)};_e.prototype.equals=function(e){return _e.equals(this,e)};_e.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};_e.prototype.equalsEpsilon=function(e,t){return _e.equalsEpsilon(this,e,t)};_e.validate=function(e){b.typeOf.object("rectangle",e);const t=e.north;b.typeOf.number.greaterThanOrEquals("north",t,-N.PI_OVER_TWO),b.typeOf.number.lessThanOrEquals("north",t,N.PI_OVER_TWO);const n=e.south;b.typeOf.number.greaterThanOrEquals("south",n,-N.PI_OVER_TWO),b.typeOf.number.lessThanOrEquals("south",n,N.PI_OVER_TWO);const i=e.west;b.typeOf.number.greaterThanOrEquals("west",i,-Math.PI),b.typeOf.number.lessThanOrEquals("west",i,Math.PI);const o=e.east;b.typeOf.number.greaterThanOrEquals("east",o,-Math.PI),b.typeOf.number.lessThanOrEquals("east",o,Math.PI)};_e.southwest=function(e,t){return b.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.south,t.height=0,t):new Ae(e.west,e.south)};_e.northwest=function(e,t){return b.typeOf.object("rectangle",e),l(t)?(t.longitude=e.west,t.latitude=e.north,t.height=0,t):new Ae(e.west,e.north)};_e.northeast=function(e,t){return b.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.north,t.height=0,t):new Ae(e.east,e.north)};_e.southeast=function(e,t){return b.typeOf.object("rectangle",e),l(t)?(t.longitude=e.east,t.latitude=e.south,t.height=0,t):new Ae(e.east,e.south)};_e.center=function(e,t){b.typeOf.object("rectangle",e);let n=e.east;const i=e.west;n<i&&(n+=N.TWO_PI);const o=N.negativePiToPi((i+n)*.5),r=(e.south+e.north)*.5;return l(t)?(t.longitude=o,t.latitude=r,t.height=0,t):new Ae(o,r)};_e.intersection=function(e,t,n){b.typeOf.object("rectangle",e),b.typeOf.object("otherRectangle",t);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=N.TWO_PI:r<s&&i>0&&(r+=N.TWO_PI),i<o&&s<0?s+=N.TWO_PI:r<s&&o<0&&(o+=N.TWO_PI);const a=N.negativePiToPi(Math.max(o,s)),c=N.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),f=Math.min(e.north,t.north);if(!(u>=f))return l(n)?(n.west=a,n.south=u,n.east=c,n.north=f,n):new _e(a,u,c,f)};_e.simpleIntersection=function(e,t,n){b.typeOf.object("rectangle",e),b.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 _e(i,o,r,s)};_e.union=function(e,t,n){b.typeOf.object("rectangle",e),b.typeOf.object("otherRectangle",t),l(n)||(n=new _e);let i=e.east,o=e.west,r=t.east,s=t.west;i<o&&r>0?i+=N.TWO_PI:r<s&&i>0&&(r+=N.TWO_PI),i<o&&s<0?s+=N.TWO_PI:r<s&&o<0&&(o+=N.TWO_PI);const a=N.negativePiToPi(Math.min(o,s)),c=N.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};_e.expand=function(e,t,n){return b.typeOf.object("rectangle",e),b.typeOf.object("cartographic",t),l(n)||(n=new _e),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};_e.contains=function(e,t){b.typeOf.object("rectangle",e),b.typeOf.object("cartographic",t);let n=t.longitude;const i=t.latitude,o=e.west;let r=e.east;return r<o&&(r+=N.TWO_PI,n<0&&(n+=N.TWO_PI)),(n>o||N.equalsEpsilon(n,o,N.EPSILON14))&&(n<r||N.equalsEpsilon(n,r,N.EPSILON14))&&i>=e.south&&i<=e.north};const the=new Ae;_e.subsample=function(e,t,n,i){b.typeOf.object("rectangle",e),t=A(t,pe.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=the;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 f=1;f<8;++f)u.longitude=-Math.PI+f*N.PI_OVER_TWO,_e.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};_e.subsection=function(e,t,n,i,o,r){if(b.typeOf.object("rectangle",e),b.typeOf.number.greaterThanOrEquals("westLerp",t,0),b.typeOf.number.lessThanOrEquals("westLerp",t,1),b.typeOf.number.greaterThanOrEquals("southLerp",n,0),b.typeOf.number.lessThanOrEquals("southLerp",n,1),b.typeOf.number.greaterThanOrEquals("eastLerp",i,0),b.typeOf.number.lessThanOrEquals("eastLerp",i,1),b.typeOf.number.greaterThanOrEquals("northLerp",o,0),b.typeOf.number.lessThanOrEquals("northLerp",o,1),b.typeOf.number.lessThanOrEquals("westLerp",t,i),b.typeOf.number.lessThanOrEquals("southLerp",n,o),l(r)||(r=new _e),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=N.TWO_PI+e.east-e.west;r.west=N.negativePiToPi(e.west+t*a),r.east=N.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};_e.MAX_VALUE=Object.freeze(new _e(-Math.PI,-N.PI_OVER_TWO,Math.PI,N.PI_OVER_TWO));function qe(e,t,n,i){this.x=A(e,0),this.y=A(t,0),this.width=A(n,0),this.height=A(i,0)}qe.packedLength=4;qe.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.width,t[n]=e.height,t};qe.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new qe),n.x=e[t++],n.y=e[t++],n.width=e[t++],n.height=e[t],n};qe.fromPoints=function(e,t){if(l(t)||(t=new qe),!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,f=c.y;i=Math.min(u,i),r=Math.max(u,r),o=Math.min(f,o),s=Math.max(f,s)}return t.x=i,t.y=o,t.width=r-i,t.height=s-o,t};const nhe=new jo,ihe=new Ae,ohe=new Ae;qe.fromRectangle=function(e,t,n){if(l(n)||(n=new qe),!l(e))return n.x=0,n.y=0,n.width=0,n.height=0,n;t=A(t,nhe);const i=t.project(_e.southwest(e,ihe)),o=t.project(_e.northeast(e,ohe));return j.subtract(o,i,o),n.x=i.x,n.y=i.y,n.width=o.x,n.height=o.y,n};qe.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 qe(e.x,e.y,e.width,e.height)};qe.union=function(e,t,n){b.typeOf.object("left",e),b.typeOf.object("right",t),l(n)||(n=new qe);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};qe.expand=function(e,t,n){b.typeOf.object("rectangle",e),b.typeOf.object("point",t),n=qe.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};qe.intersect=function(e,t){b.typeOf.object("left",e),b.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?mn.OUTSIDE:mn.INTERSECTING};qe.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};qe.prototype.clone=function(e){return qe.clone(this,e)};qe.prototype.intersect=function(e){return qe.intersect(this,e)};qe.prototype.equals=function(e){return qe.equals(this,e)};const hs={POINTS:se.POINTS,LINES:se.LINES,LINE_LOOP:se.LINE_LOOP,LINE_STRIP:se.LINE_STRIP,TRIANGLES:se.TRIANGLES,TRIANGLE_STRIP:se.TRIANGLE_STRIP,TRIANGLE_FAN:se.TRIANGLE_FAN};hs.isLines=function(e){return e===hs.LINES||e===hs.LINE_LOOP||e===hs.LINE_STRIP};hs.isTriangles=function(e){return e===hs.TRIANGLES||e===hs.TRIANGLE_STRIP||e===hs.TRIANGLE_FAN};hs.validate=function(e){return e===hs.POINTS||e===hs.LINES||e===hs.LINE_LOOP||e===hs.LINE_STRIP||e===hs.TRIANGLES||e===hs.TRIANGLE_STRIP||e===hs.TRIANGLE_FAN};const Je=Object.freeze(hs),V9=`attribute vec4 position;
attribute vec2 textureCoordinates;
varying vec2 v_textureCoordinates;
void main()
{
gl_Position = position;
v_textureCoordinates = textureCoordinates;
}
`,xo={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 dt(e){e=A(e,A.EMPTY_OBJECT),this._boundingVolume=e.boundingVolume,this._orientedBoundingBox=e.orientedBoundingBox,this._modelMatrix=e.modelMatrix,this._primitiveType=A(e.primitiveType,Je.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 vs(e,t){return(e._flags&t)===t}function Jd(e,t,n){n?e._flags|=t:e._flags&=~t}Object.defineProperties(dt.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 vs(this,xo.CULL)},set:function(e){vs(this,xo.CULL)!==e&&(Jd(this,xo.CULL,e),this.dirty=!0)}},occlude:{get:function(){return vs(this,xo.OCCLUDE)},set:function(e){vs(this,xo.OCCLUDE)!==e&&(Jd(this,xo.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 vs(this,xo.CAST_SHADOWS)},set:function(e){vs(this,xo.CAST_SHADOWS)!==e&&(Jd(this,xo.CAST_SHADOWS,e),this.dirty=!0)}},receiveShadows:{get:function(){return vs(this,xo.RECEIVE_SHADOWS)},set:function(e){vs(this,xo.RECEIVE_SHADOWS)!==e&&(Jd(this,xo.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 vs(this,xo.EXECUTE_IN_CLOSEST_FRUSTUM)},set:function(e){vs(this,xo.EXECUTE_IN_CLOSEST_FRUSTUM)!==e&&(Jd(this,xo.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 vs(this,xo.DEBUG_SHOW_BOUNDING_VOLUME)},set:function(e){vs(this,xo.DEBUG_SHOW_BOUNDING_VOLUME)!==e&&(Jd(this,xo.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 vs(this,xo.PICK_ONLY)},set:function(e){vs(this,xo.PICK_ONLY)!==e&&(Jd(this,xo.PICK_ONLY,e),this.dirty=!0)}},depthForTranslucentClassification:{get:function(){return vs(this,xo.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)},set:function(e){vs(this,xo.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION)!==e&&(Jd(this,xo.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION,e),this.dirty=!0)}}});dt.shallowClone=function(e,t){if(l(e))return l(t)||(t=new dt),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};dt.prototype.execute=function(e,t){e.draw(this,t)};const Xn={UNSIGNED_BYTE:se.UNSIGNED_BYTE,UNSIGNED_SHORT:se.UNSIGNED_SHORT,UNSIGNED_INT:se.UNSIGNED_INT,FLOAT:se.FLOAT,HALF_FLOAT:se.HALF_FLOAT_OES,UNSIGNED_INT_24_8:se.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:se.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:se.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:se.UNSIGNED_SHORT_5_6_5};Xn.toWebGLConstant=function(e,t){switch(e){case Xn.UNSIGNED_BYTE:return se.UNSIGNED_BYTE;case Xn.UNSIGNED_SHORT:return se.UNSIGNED_SHORT;case Xn.UNSIGNED_INT:return se.UNSIGNED_INT;case Xn.FLOAT:return se.FLOAT;case Xn.HALF_FLOAT:return t.webgl2?se.HALF_FLOAT:se.HALF_FLOAT_OES;case Xn.UNSIGNED_INT_24_8:return se.UNSIGNED_INT_24_8;case Xn.UNSIGNED_SHORT_4_4_4_4:return se.UNSIGNED_SHORT_4_4_4_4;case Xn.UNSIGNED_SHORT_5_5_5_1:return se.UNSIGNED_SHORT_5_5_5_1;case Xn.UNSIGNED_SHORT_5_6_5:return Xn.UNSIGNED_SHORT_5_6_5}};Xn.isPacked=function(e){return e===Xn.UNSIGNED_INT_24_8||e===Xn.UNSIGNED_SHORT_4_4_4_4||e===Xn.UNSIGNED_SHORT_5_5_5_1||e===Xn.UNSIGNED_SHORT_5_6_5};Xn.sizeInBytes=function(e){switch(e){case Xn.UNSIGNED_BYTE:return 1;case Xn.UNSIGNED_SHORT:case Xn.UNSIGNED_SHORT_4_4_4_4:case Xn.UNSIGNED_SHORT_5_5_5_1:case Xn.UNSIGNED_SHORT_5_6_5:case Xn.HALF_FLOAT:return 2;case Xn.UNSIGNED_INT:case Xn.FLOAT:case Xn.UNSIGNED_INT_24_8:return 4}};Xn.validate=function(e){return e===Xn.UNSIGNED_BYTE||e===Xn.UNSIGNED_SHORT||e===Xn.UNSIGNED_INT||e===Xn.FLOAT||e===Xn.HALF_FLOAT||e===Xn.UNSIGNED_INT_24_8||e===Xn.UNSIGNED_SHORT_4_4_4_4||e===Xn.UNSIGNED_SHORT_5_5_5_1||e===Xn.UNSIGNED_SHORT_5_6_5};const Ke=Object.freeze(Xn),Xe={DEPTH_COMPONENT:se.DEPTH_COMPONENT,DEPTH_STENCIL:se.DEPTH_STENCIL,ALPHA:se.ALPHA,RGB:se.RGB,RGBA:se.RGBA,LUMINANCE:se.LUMINANCE,LUMINANCE_ALPHA:se.LUMINANCE_ALPHA,RGB_DXT1:se.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:se.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:se.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:se.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:se.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:se.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:se.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:se.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:se.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:se.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:se.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:se.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:se.COMPRESSED_RGBA_BPTC_UNORM};Xe.componentsLength=function(e){switch(e){case Xe.RGB:return 3;case Xe.RGBA:return 4;case Xe.LUMINANCE_ALPHA:return 2;case Xe.ALPHA:case Xe.LUMINANCE:return 1;default:return 1}};Xe.validate=function(e){return e===Xe.DEPTH_COMPONENT||e===Xe.DEPTH_STENCIL||e===Xe.ALPHA||e===Xe.RGB||e===Xe.RGBA||e===Xe.LUMINANCE||e===Xe.LUMINANCE_ALPHA||e===Xe.RGB_DXT1||e===Xe.RGBA_DXT1||e===Xe.RGBA_DXT3||e===Xe.RGBA_DXT5||e===Xe.RGB_PVRTC_4BPPV1||e===Xe.RGB_PVRTC_2BPPV1||e===Xe.RGBA_PVRTC_4BPPV1||e===Xe.RGBA_PVRTC_2BPPV1||e===Xe.RGBA_ASTC||e===Xe.RGB_ETC1||e===Xe.RGB8_ETC2||e===Xe.RGBA8_ETC2_EAC||e===Xe.RGBA_BC7};Xe.isColorFormat=function(e){return e===Xe.ALPHA||e===Xe.RGB||e===Xe.RGBA||e===Xe.LUMINANCE||e===Xe.LUMINANCE_ALPHA};Xe.isDepthFormat=function(e){return e===Xe.DEPTH_COMPONENT||e===Xe.DEPTH_STENCIL};Xe.isCompressedFormat=function(e){return e===Xe.RGB_DXT1||e===Xe.RGBA_DXT1||e===Xe.RGBA_DXT3||e===Xe.RGBA_DXT5||e===Xe.RGB_PVRTC_4BPPV1||e===Xe.RGB_PVRTC_2BPPV1||e===Xe.RGBA_PVRTC_4BPPV1||e===Xe.RGBA_PVRTC_2BPPV1||e===Xe.RGBA_ASTC||e===Xe.RGB_ETC1||e===Xe.RGB8_ETC2||e===Xe.RGBA8_ETC2_EAC||e===Xe.RGBA_BC7};Xe.isDXTFormat=function(e){return e===Xe.RGB_DXT1||e===Xe.RGBA_DXT1||e===Xe.RGBA_DXT3||e===Xe.RGBA_DXT5};Xe.isPVRTCFormat=function(e){return e===Xe.RGB_PVRTC_4BPPV1||e===Xe.RGB_PVRTC_2BPPV1||e===Xe.RGBA_PVRTC_4BPPV1||e===Xe.RGBA_PVRTC_2BPPV1};Xe.isASTCFormat=function(e){return e===Xe.RGBA_ASTC};Xe.isETC1Format=function(e){return e===Xe.RGB_ETC1};Xe.isETC2Format=function(e){return e===Xe.RGB8_ETC2||e===Xe.RGBA8_ETC2_EAC};Xe.isBC7Format=function(e){return e===Xe.RGBA_BC7};Xe.compressedTextureSizeInBytes=function(e,t,n){switch(e){case Xe.RGB_DXT1:case Xe.RGBA_DXT1:case Xe.RGB_ETC1:case Xe.RGB8_ETC2:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*8;case Xe.RGBA_DXT3:case Xe.RGBA_DXT5:case Xe.RGBA_ASTC:case Xe.RGBA8_ETC2_EAC:return Math.floor((t+3)/4)*Math.floor((n+3)/4)*16;case Xe.RGB_PVRTC_4BPPV1:case Xe.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(n,8)*4+7)/8);case Xe.RGB_PVRTC_2BPPV1:case Xe.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(n,8)*2+7)/8);case Xe.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(n/4)*16;default:return 0}};Xe.textureSizeInBytes=function(e,t,n,i){let o=Xe.componentsLength(e);return Ke.isPacked(t)&&(o=1),o*Ke.sizeInBytes(t)*n*i};Xe.alignmentInBytes=function(e,t,n){const i=Xe.textureSizeInBytes(e,t,n,1)%4;return i===0?4:i===2?2:1};Xe.createTypedArray=function(e,t,n,i){let o;const r=Ke.sizeInBytes(t);r===Uint8Array.BYTES_PER_ELEMENT?o=Uint8Array:r===Uint16Array.BYTES_PER_ELEMENT?o=Uint16Array:r===Float32Array.BYTES_PER_ELEMENT&&t===Ke.FLOAT?o=Float32Array:o=Uint32Array;const s=Xe.componentsLength(e)*n*i;return new o(s)};Xe.flipY=function(e,t,n,i,o){if(o===1)return e;const r=Xe.createTypedArray(t,n,i,o),s=Xe.componentsLength(t),a=i*s;for(let c=0;c<o;++c){const u=c*i*s,f=(o-c-1)*i*s;for(let h=0;h<a;++h)r[f+h]=e[u+h]}return r};Xe.toInternalFormat=function(e,t,n){if(!n.webgl2)return e;if(e===Xe.DEPTH_STENCIL)return se.DEPTH24_STENCIL8;if(e===Xe.DEPTH_COMPONENT){if(t===Ke.UNSIGNED_SHORT)return se.DEPTH_COMPONENT16;if(t===Ke.UNSIGNED_INT)return se.DEPTH_COMPONENT24}if(t===Ke.FLOAT)switch(e){case Xe.RGBA:return se.RGBA32F;case Xe.RGB:return se.RGB32F;case Xe.RG:return se.RG32F;case Xe.R:return se.R32F}if(t===Ke.HALF_FLOAT)switch(e){case Xe.RGBA:return se.RGBA16F;case Xe.RGB:return se.RGB16F;case Xe.RG:return se.RG16F;case Xe.R:return se.R16F}return e};const nt=Object.freeze(Xe),wo={_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(wo,{maximumCombinedTextureImageUnits:{get:function(){return wo._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return wo._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return wo._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return wo._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return wo._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return wo._maximumTextureSize}},maximumVaryingVectors:{get:function(){return wo._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return wo._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return wo._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return wo._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return wo._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return wo._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return wo._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return wo._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return wo._maximumViewportWidth}},maximumViewportHeight:{get:function(){return wo._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return wo._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return wo._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return wo._maximumColorAttachments}},maximumSamples:{get:function(){return wo._maximumSamples}},highpFloatSupported:{get:function(){return wo._highpFloatSupported}},highpIntSupported:{get:function(){return wo._highpIntSupported}}});const wt=wo;function mI(e,t,n){const i=e._gl;i.framebufferTexture2D(i.FRAMEBUFFER,t,n._target,n._texture,0)}function qb(e,t,n){const i=e._gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,n._getRenderbuffer())}function zr(e){e=A(e,A.EMPTY_OBJECT);const t=e.context;b.defined("options.context",t);const n=t._gl,i=wt.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,f;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],!nt.isColorFormat(s.pixelFormat))throw new x("The color-texture pixel-format must be a color format.");if(s.pixelDatatype===Ke.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===Ke.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.");f=this._gl.COLOR_ATTACHMENT0+c,mI(this,f,s),this._activeColorAttachments[c]=f,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],f=this._gl.COLOR_ATTACHMENT0+c,qb(this,f,a),this._activeColorAttachments[c]=f,this._colorRenderbuffers[c]=a}if(l(e.depthTexture)){if(s=e.depthTexture,s.pixelFormat!==nt.DEPTH_COMPONENT)throw new x("The depth-texture pixel-format must be DEPTH_COMPONENT.");mI(this,this._gl.DEPTH_ATTACHMENT,s),this._depthTexture=s}if(l(e.depthRenderbuffer)&&(a=e.depthRenderbuffer,qb(this,this._gl.DEPTH_ATTACHMENT,a),this._depthRenderbuffer=a),l(e.stencilRenderbuffer)&&(a=e.stencilRenderbuffer,qb(this,this._gl.STENCIL_ATTACHMENT,a),this._stencilRenderbuffer=a),l(e.depthStencilTexture)){if(s=e.depthStencilTexture,s.pixelFormat!==nt.DEPTH_STENCIL)throw new x("The depth-stencil pixel-format must be DEPTH_STENCIL.");mI(this,this._gl.DEPTH_STENCIL_ATTACHMENT,s),this._depthStencilTexture=s}l(e.depthStencilRenderbuffer)&&(a=e.depthStencilRenderbuffer,qb(this,this._gl.DEPTH_STENCIL_ATTACHMENT,a),this._depthStencilRenderbuffer=a),this._unBind()}Object.defineProperties(zr.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)}}});zr.prototype._bind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebuffer)};zr.prototype._unBind=function(){const e=this._gl;e.bindFramebuffer(e.FRAMEBUFFER,null)};zr.prototype.bindDraw=function(){const e=this._gl;e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this._framebuffer)};zr.prototype.bindRead=function(){const e=this._gl;e.bindFramebuffer(e.READ_FRAMEBUFFER,this._framebuffer)};zr.prototype._getActiveColorAttachments=function(){return this._activeColorAttachments};zr.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]};zr.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]};zr.prototype.isDestroyed=function(){return!1};zr.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),Ue(this)};const $x={CLOCKWISE:se.CW,COUNTER_CLOCKWISE:se.CCW};$x.validate=function(e){return e===$x.CLOCKWISE||e===$x.COUNTER_CLOCKWISE};const el=Object.freeze($x);function k9(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]=k9(e[t]));return Object.freeze(e)}function Q3(e){return e===se.FUNC_ADD||e===se.FUNC_SUBTRACT||e===se.FUNC_REVERSE_SUBTRACT||e===se.MIN||e===se.MAX}function Yb(e){return e===se.ZERO||e===se.ONE||e===se.SRC_COLOR||e===se.ONE_MINUS_SRC_COLOR||e===se.DST_COLOR||e===se.ONE_MINUS_DST_COLOR||e===se.SRC_ALPHA||e===se.ONE_MINUS_SRC_ALPHA||e===se.DST_ALPHA||e===se.ONE_MINUS_DST_ALPHA||e===se.CONSTANT_COLOR||e===se.ONE_MINUS_CONSTANT_COLOR||e===se.CONSTANT_ALPHA||e===se.ONE_MINUS_CONSTANT_ALPHA||e===se.SRC_ALPHA_SATURATE}function rhe(e){return e===se.FRONT||e===se.BACK||e===se.FRONT_AND_BACK}function she(e){return e===se.NEVER||e===se.LESS||e===se.EQUAL||e===se.LEQUAL||e===se.GREATER||e===se.NOTEQUAL||e===se.GEQUAL||e===se.ALWAYS}function Z3(e){return e===se.NEVER||e===se.LESS||e===se.EQUAL||e===se.LEQUAL||e===se.GREATER||e===se.NOTEQUAL||e===se.GEQUAL||e===se.ALWAYS}function J_(e){return e===se.ZERO||e===se.KEEP||e===se.REPLACE||e===se.INCR||e===se.DECR||e===se.INVERT||e===se.INCR_WRAP||e===se.DECR_WRAP}function Qe(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),f=A(u.color,A.EMPTY_OBJECT),h=A(t.stencilTest,A.EMPTY_OBJECT),_=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,el.COUNTER_CLOCKWISE),this.cull={enabled:A(n.enabled,!1),face:A(n.face,se.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:qe.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,se.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 U(A(f.red,0),A(f.green,0),A(f.blue,0),A(f.alpha,0)),equationRgb:A(u.equationRgb,se.FUNC_ADD),equationAlpha:A(u.equationAlpha,se.FUNC_ADD),functionSourceRgb:A(u.functionSourceRgb,se.ONE),functionSourceAlpha:A(u.functionSourceAlpha,se.ONE),functionDestinationRgb:A(u.functionDestinationRgb,se.ZERO),functionDestinationAlpha:A(u.functionDestinationAlpha,se.ZERO)},this.stencilTest={enabled:A(h.enabled,!1),frontFunction:A(h.frontFunction,se.ALWAYS),backFunction:A(h.backFunction,se.ALWAYS),reference:A(h.reference,0),mask:A(h.mask,-1),frontOperation:{fail:A(_.fail,se.KEEP),zFail:A(_.zFail,se.KEEP),zPass:A(_.zPass,se.KEEP)},backOperation:{fail:A(g.fail,se.KEEP),zFail:A(g.zFail,se.KEEP),zPass:A(g.zPass,se.KEEP)}},this.sampleCoverage={enabled:A(p.enabled,!1),value:A(p.value,1),invert:A(p.invert,!1)},this.viewport=l(y)?new qe(y.x,y.y,y.width,y.height):void 0,this.lineWidth<wt.minimumAliasedLineWidth||this.lineWidth>wt.maximumAliasedLineWidth)throw new x("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!el.validate(this.frontFace))throw new x("Invalid renderState.frontFace.");if(!rhe(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(!she(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(!Q3(this.blending.equationRgb))throw new x("Invalid renderState.blending.equationRgb.");if(!Q3(this.blending.equationAlpha))throw new x("Invalid renderState.blending.equationAlpha.");if(!Yb(this.blending.functionSourceRgb))throw new x("Invalid renderState.blending.functionSourceRgb.");if(!Yb(this.blending.functionSourceAlpha))throw new x("Invalid renderState.blending.functionSourceAlpha.");if(!Yb(this.blending.functionDestinationRgb))throw new x("Invalid renderState.blending.functionDestinationRgb.");if(!Yb(this.blending.functionDestinationAlpha))throw new x("Invalid renderState.blending.functionDestinationAlpha.");if(!Z3(this.stencilTest.frontFunction))throw new x("Invalid renderState.stencilTest.frontFunction.");if(!Z3(this.stencilTest.backFunction))throw new x("Invalid renderState.stencilTest.backFunction.");if(!J_(this.stencilTest.frontOperation.fail))throw new x("Invalid renderState.stencilTest.frontOperation.fail.");if(!J_(this.stencilTest.frontOperation.zFail))throw new x("Invalid renderState.stencilTest.frontOperation.zFail.");if(!J_(this.stencilTest.frontOperation.zPass))throw new x("Invalid renderState.stencilTest.frontOperation.zPass.");if(!J_(this.stencilTest.backOperation.fail))throw new x("Invalid renderState.stencilTest.backOperation.fail.");if(!J_(this.stencilTest.backOperation.zFail))throw new x("Invalid renderState.stencilTest.backOperation.zFail.");if(!J_(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>wt.maximumViewportWidth)throw new x(`renderState.viewport.width must be less than or equal to the maximum viewport width (${wt.maximumViewportWidth.toString()}). Check maximumViewportWidth.`);if(this.viewport.height>wt.maximumViewportHeight)throw new x(`renderState.viewport.height must be less than or equal to the maximum viewport height (${wt.maximumViewportHeight.toString()}). Check maximumViewportHeight.`)}this.id=0,this._applyFunctions=[]}let ahe=0,Ru={};Qe.fromCache=function(e){const t=JSON.stringify(e);let n=Ru[t];if(l(n))return++n.referenceCount,n.state;let i=new Qe(e);const o=JSON.stringify(i);return n=Ru[o],l(n)||(i.id=ahe++,i=k9(i),n={referenceCount:0,state:i},Ru[o]=n),++n.referenceCount,Ru[t]={referenceCount:1,state:n.state},n.state};Qe.removeFromCache=function(e){const t=new Qe(e),n=JSON.stringify(t),i=Ru[n],o=JSON.stringify(e),r=Ru[o];l(r)&&(--r.referenceCount,r.referenceCount===0&&(delete Ru[o],l(i)&&--i.referenceCount)),l(i)&&i.referenceCount===0&&delete Ru[n]};Qe.getCache=function(){return Ru};Qe.clearCache=function(){Ru={}};function A_(e,t,n){n?e.enable(t):e.disable(t)}function G9(e,t){e.frontFace(t.frontFace)}function W9(e,t){const n=t.cull,i=n.enabled;A_(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function j9(e,t){e.lineWidth(t.lineWidth)}function q9(e,t){const n=t.polygonOffset,i=n.enabled;A_(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function Y9(e,t,n){const i=t.scissorTest,o=l(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(A_(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 $9(e,t){const n=t.depthRange;e.depthRange(n.near,n.far)}function X9(e,t){const n=t.depthTest,i=n.enabled;A_(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function K9(e,t){const n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function J9(e,t){e.depthMask(t.depthMask)}function Q9(e,t){e.stencilMask(t.stencilMask)}function che(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}function Z9(e,t,n){const i=t.blending,o=l(n.blendingEnabled)?n.blendingEnabled:i.enabled;A_(e,e.BLEND,o),o&&(che(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function eW(e,t){const n=t.stencilTest,i=n.enabled;if(A_(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,f=c.zFail,h=c.zPass;e.stencilOpSeparate(e.FRONT,u,f,h);const _=n.backOperation,g=_.fail,p=_.zFail,y=_.zPass;e.stencilOpSeparate(e.BACK,g,p,y)}}function tW(e,t){const n=t.sampleCoverage,i=n.enabled;A_(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}const lhe=new qe;function nW(e,t,n){let i=A(t.viewport,n.viewport);l(i)||(i=lhe,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)}Qe.apply=function(e,t,n){G9(e,t),W9(e,t),j9(e,t),q9(e,t),$9(e,t),X9(e,t),K9(e,t),J9(e,t),Q9(e,t),eW(e,t),tW(e,t),Y9(e,t,n),Z9(e,t,n),nW(e,t,n)};function uhe(e,t){const n=[];return e.frontFace!==t.frontFace&&n.push(G9),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(W9),e.lineWidth!==t.lineWidth&&n.push(j9),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(q9),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push($9),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(X9),(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(K9),e.depthMask!==t.depthMask&&n.push(J9),e.stencilMask!==t.stencilMask&&n.push(Q9),(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(eW),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(tW),n}Qe.partialApply=function(e,t,n,i,o,r){if(t!==n){let f=n._applyFunctions[t.id];l(f)||(f=uhe(t,n),n._applyFunctions[t.id]=f);const h=f.length;for(let _=0;_<h;++_)f[_](e,n)}const s=l(i.scissorTest)?i.scissorTest:t.scissorTest,a=l(o.scissorTest)?o.scissorTest:n.scissorTest;(s!==a||r)&&Y9(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)&&Z9(e,n,o),(t!==n||i!==o||i.context!==o.context)&&nW(e,n,o)};Qe.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:qe.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:U.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)?qe.clone(e.viewport):void 0}};function at(e,t,n,i){this[0]=A(e,0),this[1]=A(n,0),this[2]=A(t,0),this[3]=A(i,0)}at.packedLength=4;at.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e[0],t[n++]=e[1],t[n++]=e[2],t[n++]=e[3],t};at.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new at),n[0]=e[t++],n[1]=e[t++],n[2]=e[t++],n[3]=e[t++],n};at.packArray=function(e,t){b.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)at.pack(e[o],t,o*4);return t};at.unpackArray=function(e,t){if(b.defined("array",e),b.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]=at.unpack(e,i,t[o])}return t};at.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 at(e[0],e[2],e[1],e[3])};at.fromArray=at.unpack;at.fromColumnMajorArray=function(e,t){return b.defined("values",e),at.clone(e,t)};at.fromRowMajorArray=function(e,t){return b.defined("values",e),l(t)?(t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3],t):new at(e[0],e[1],e[2],e[3])};at.fromScale=function(e,t){return b.typeOf.object("scale",e),l(t)?(t[0]=e.x,t[1]=0,t[2]=0,t[3]=e.y,t):new at(e.x,0,0,e.y)};at.fromUniformScale=function(e,t){return b.typeOf.number("scale",e),l(t)?(t[0]=e,t[1]=0,t[2]=0,t[3]=e,t):new at(e,0,0,e)};at.fromRotation=function(e,t){b.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 at(n,-i,i,n)};at.toArray=function(e,t){return b.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]]};at.getElementIndex=function(e,t){return b.typeOf.number.greaterThanOrEquals("row",t,0),b.typeOf.number.lessThanOrEquals("row",t,1),b.typeOf.number.greaterThanOrEquals("column",e,0),b.typeOf.number.lessThanOrEquals("column",e,1),e*2+t};at.getColumn=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,1),b.typeOf.object("result",n);const i=t*2,o=e[i],r=e[i+1];return n.x=o,n.y=r,n};at.setColumn=function(e,t,n,i){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,1),b.typeOf.object("cartesian",n),b.typeOf.object("result",i),i=at.clone(e,i);const o=t*2;return i[o]=n.x,i[o+1]=n.y,i};at.getRow=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,1),b.typeOf.object("result",n);const i=e[t],o=e[t+2];return n.x=i,n.y=o,n};at.setRow=function(e,t,n,i){return b.typeOf.object("matrix",e),b.typeOf.number.greaterThanOrEquals("index",t,0),b.typeOf.number.lessThanOrEquals("index",t,1),b.typeOf.object("cartesian",n),b.typeOf.object("result",i),i=at.clone(e,i),i[t]=n.x,i[t+2]=n.y,i};const fhe=new j;at.setScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.typeOf.object("result",n);const i=at.getScale(e,fhe),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 dhe=new j;at.setUniformScale=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.typeOf.object("result",n);const i=at.getScale(e,dhe),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 ez=new j;at.getScale=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),t.x=j.magnitude(j.fromElements(e[0],e[1],ez)),t.y=j.magnitude(j.fromElements(e[2],e[3],ez)),t};const tz=new j;at.getMaximumScale=function(e){return at.getScale(e,tz),j.maximumComponent(tz)};const hhe=new j;at.setRotation=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("result",n);const i=at.getScale(e,hhe);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 phe=new j;at.getRotation=function(e,t){b.typeOf.object("matrix",e),b.typeOf.object("result",t);const n=at.getScale(e,phe);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};at.multiply=function(e,t,n){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};at.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};at.subtract=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};at.multiplyByVector=function(e,t,n){b.typeOf.object("matrix",e),b.typeOf.object("cartesian",t),b.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};at.multiplyByScalar=function(e,t,n){return b.typeOf.object("matrix",e),b.typeOf.number("scalar",t),b.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};at.multiplyByScale=function(e,t,n){return b.typeOf.object("matrix",e),b.typeOf.object("scale",t),b.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};at.multiplyByUniformScale=function(e,t,n){return b.typeOf.object("matrix",e),b.typeOf.number("scale",t),b.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};at.negate=function(e,t){return b.typeOf.object("matrix",e),b.typeOf.object("result",t),t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t};at.transpose=function(e,t){b.typeOf.object("matrix",e),b.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};at.abs=function(e,t){return b.typeOf.object("matrix",e),b.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};at.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]};at.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]};at.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};at.IDENTITY=Object.freeze(new at(1,0,0,1));at.ZERO=Object.freeze(new at(0,0,0,0));at.COLUMN0ROW0=0;at.COLUMN0ROW1=1;at.COLUMN1ROW0=2;at.COLUMN1ROW1=3;Object.defineProperties(at.prototype,{length:{get:function(){return at.packedLength}}});at.prototype.clone=function(e){return at.clone(this,e)};at.prototype.equals=function(e){return at.equals(this,e)};at.prototype.equalsEpsilon=function(e,t){return at.equalsEpsilon(this,e,t)};at.prototype.toString=function(){return`(${this[0]}, ${this[2]})
(${this[1]}, ${this[3]})`};function mhe(e,t,n,i){switch(t.type){case e.FLOAT:return new iW(e,t,n,i);case e.FLOAT_VEC2:return new oW(e,t,n,i);case e.FLOAT_VEC3:return new rW(e,t,n,i);case e.FLOAT_VEC4:return new sW(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new cN(e,t,n,i);case e.INT:case e.BOOL:return new aW(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new cW(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new lW(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new uW(e,t,n,i);case e.FLOAT_MAT2:return new fW(e,t,n,i);case e.FLOAT_MAT3:return new dW(e,t,n,i);case e.FLOAT_MAT4:return new hW(e,t,n,i);default:throw new Se(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function iW(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}iW.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1f(this._location,this.value))};function oW(e,t,n,i){this.name=n,this.value=void 0,this._value=new j,this._gl=e,this._location=i}oW.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 rW(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}rW.prototype.set=function(){const e=this.value;if(l(e.red))U.equals(e,this._value)||(this._value=U.clone(e,this._value),this._gl.uniform3f(this._location,e.red,e.green,e.blue));else if(l(e.x))d.equals(e,this._value)||(this._value=d.clone(e,this._value),this._gl.uniform3f(this._location,e.x,e.y,e.z));else throw new x(`Invalid vec3 value for uniform "${this.name}".`)};function sW(e,t,n,i){this.name=n,this.value=void 0,this._value=void 0,this._gl=e,this._location=i}sW.prototype.set=function(){const e=this.value;if(l(e.red))U.equals(e,this._value)||(this._value=U.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 cN(e,t,n,i){this.name=n,this.value=void 0,this._gl=e,this._location=i,this.textureUnitIndex=void 0}cN.prototype.set=function(){const e=this._gl;e.activeTexture(e.TEXTURE0+this.textureUnitIndex);const t=this.value;e.bindTexture(t._target,t._texture)};cN.prototype._setSampler=function(e){return this.textureUnitIndex=e,this._gl.uniform1i(this._location,e),e+1};function aW(e,t,n,i){this.name=n,this.value=void 0,this._value=0,this._gl=e,this._location=i}aW.prototype.set=function(){this.value!==this._value&&(this._value=this.value,this._gl.uniform1i(this._location,this.value))};function cW(e,t,n,i){this.name=n,this.value=void 0,this._value=new j,this._gl=e,this._location=i}cW.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 lW(e,t,n,i){this.name=n,this.value=void 0,this._value=new d,this._gl=e,this._location=i}lW.prototype.set=function(){const e=this.value;d.equals(e,this._value)||(d.clone(e,this._value),this._gl.uniform3i(this._location,e.x,e.y,e.z))};function uW(e,t,n,i){this.name=n,this.value=void 0,this._value=new oe,this._gl=e,this._location=i}uW.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 _he=new Float32Array(4);function fW(e,t,n,i){this.name=n,this.value=void 0,this._value=new at,this._gl=e,this._location=i}fW.prototype.set=function(){if(!at.equalsArray(this.value,this._value,0)){at.clone(this.value,this._value);const e=at.toArray(this.value,_he);this._gl.uniformMatrix2fv(this._location,!1,e)}};const ghe=new Float32Array(9);function dW(e,t,n,i){this.name=n,this.value=void 0,this._value=new J,this._gl=e,this._location=i}dW.prototype.set=function(){if(!J.equalsArray(this.value,this._value,0)){J.clone(this.value,this._value);const e=J.toArray(this.value,ghe);this._gl.uniformMatrix3fv(this._location,!1,e)}};const yhe=new Float32Array(16);function hW(e,t,n,i){this.name=n,this.value=void 0,this._value=new B,this._gl=e,this._location=i}hW.prototype.set=function(){if(!B.equalsArray(this.value,this._value,0)){B.clone(this.value,this._value);const e=B.toArray(this.value,yhe);this._gl.uniformMatrix4fv(this._location,!1,e)}};function Ahe(e,t,n,i){switch(t.type){case e.FLOAT:return new pW(e,t,n,i);case e.FLOAT_VEC2:return new mW(e,t,n,i);case e.FLOAT_VEC3:return new _W(e,t,n,i);case e.FLOAT_VEC4:return new gW(e,t,n,i);case e.SAMPLER_2D:case e.SAMPLER_CUBE:return new lN(e,t,n,i);case e.INT:case e.BOOL:return new yW(e,t,n,i);case e.INT_VEC2:case e.BOOL_VEC2:return new AW(e,t,n,i);case e.INT_VEC3:case e.BOOL_VEC3:return new CW(e,t,n,i);case e.INT_VEC4:case e.BOOL_VEC4:return new TW(e,t,n,i);case e.FLOAT_MAT2:return new bW(e,t,n,i);case e.FLOAT_MAT3:return new EW(e,t,n,i);case e.FLOAT_MAT4:return new xW(e,t,n,i);default:throw new Se(`Unrecognized uniform type: ${t.type} for uniform "${n}".`)}}function pW(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]}pW.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 mW(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]}mW.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 _W(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]}_W.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))d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0);else throw new x("Invalid vec3 value.");o+=3}i&&this._gl.uniform3fv(this._location,n)};function gW(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]}gW.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))U.equalsArray(s,n,o)||(U.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 lN(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}lN.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)}};lN.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 yW(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]}yW.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 AW(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]}AW.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 CW(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]}CW.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];d.equalsArray(s,n,o)||(d.pack(s,n,o),i=!0),o+=3}i&&this._gl.uniform3iv(this._location,n)};function TW(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]}TW.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 bW(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]}bW.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];at.equalsArray(s,n,o)||(at.pack(s,n,o),i=!0),o+=4}i&&this._gl.uniformMatrix2fv(this._location,!1,n)};function EW(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]}EW.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 xW(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]}xW.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 Che=0;function hn(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=The(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=Che++}hn.fromCache=function(e){return e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context),e.context.shaderCache.getShaderProgram(e)};hn.replaceCache=function(e){return e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context),e.context.shaderCache.replaceShaderProgram(e)};Object.defineProperties(hn.prototype,{vertexShaderSource:{get:function(){return this._vertexShaderSource}},fragmentShaderSource:{get:function(){return this._fragmentShaderSource}},vertexAttributes:{get:function(){return Xx(this),this._vertexAttributes}},numberOfVertexAttributes:{get:function(){return Xx(this),this._numberOfVertexAttributes}},allUniforms:{get:function(){return Xx(this),this._uniformsByName}}});function nz(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 The(e,t){const n={};if(!wt.highpFloatSupported||!wt.highpIntSupported){let i,o,r,s;const a=nz(e),c=nz(t),u=a.length,f=c.length;for(i=0;i<u;i++)for(o=0;o<f;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 yu="[Cesium WebGL] ";function bhe(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 _ in a)a.hasOwnProperty(_)&&e.bindAttribLocation(s,a[_],_);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(`${yu}Vertex shader compile log: ${c}`),c=e.getShaderInfoLog(r),l(c)&&c.length>0&&console.log(`${yu}Fragment shader compile log: ${c}`),c=e.getProgramInfoLog(s),l(c)&&c.length>0&&console.log(`${yu}Shader program link log: ${c}`)),e.deleteShader(o),e.deleteShader(r),s;let u;const f=t._debugShaders;throw e.getShaderParameter(r,e.COMPILE_STATUS)?e.getShaderParameter(o,e.COMPILE_STATUS)?(c=e.getProgramInfoLog(s),console.error(`${yu}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(`${yu}Vertex shader compile log: ${c}`),console.error(`${yu} Vertex shader source:
${n}`),u=`Vertex shader failed to compile. Compile log: ${c}`):(c=e.getShaderInfoLog(r),console.error(`${yu}Fragment shader compile log: ${c}`),console.error(`${yu} Fragment shader source:
${i}`),u=`Fragment shader failed to compile. Compile log: ${c}`),e.deleteShader(o),e.deleteShader(r),e.deleteProgram(s),new Se(u);function h(_,g){if(!l(f))return;const p=f.getTranslatedShaderSource(_);if(p===""){console.error(`${yu}${g} shader translation failed.`);return}console.error(`${yu}Translated ${g} shaderSource:
${p}`)}}function Ehe(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 xhe(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 f=e.getUniformLocation(t,u);if(f!==null){const h=mhe(e,a,u,f);n[u]=h,i.push(h),h._setSampler&&o.push(h)}}else{let f,h,_,g;const p=u.indexOf("[");if(p>=0){if(f=n[u.slice(0,p)],!l(f))continue;h=f._locations,h.length<=1&&(_=f.value,g=e.getUniformLocation(t,u),g!==null&&(h.push(g),_.push(e.getUniform(t,g))))}else{h=[];for(let y=0;y<a.size;++y)g=e.getUniformLocation(t,`${u}[${y}]`),g!==null&&h.push(g);f=Ahe(e,a,u,h),n[u]=f,i.push(f),f._setSampler&&o.push(f)}}}return{uniformsByName:n,uniforms:i,samplerUniforms:o}}function whe(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=qx[s];l(c)?n.push({uniform:r,automaticUniform:c}):i.push(r)}return{automaticUniforms:n,manualUniforms:i}}function She(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 Xx(e){l(e._program)||wW(e)}function wW(e){const t=e._program,n=e._gl,i=bhe(n,e,e._debugShaders),o=n.getProgramParameter(i,n.ACTIVE_ATTRIBUTES),r=xhe(n,i),s=whe(e,r.uniformsByName);e._program=i,e._numberOfVertexAttributes=o,e._vertexAttributes=Ehe(n,i,o),e._uniformsByName=r.uniformsByName,e._uniforms=r.uniforms,e._automaticUniforms=s.automaticUniforms,e._manualUniforms=s.manualUniforms,e.maximumTextureUnitIndex=She(n,i,r.samplerUniforms),t&&e._gl.deleteProgram(t),typeof spector<"u"&&(e._program.__SPECTOR_rebuildProgram=function(a,c,u,f){const h=e._vertexShaderText,_=e._fragmentShaderText,g=/ ! = /g;e._vertexShaderText=a.replace(g," != "),e._fragmentShaderText=c.replace(g," != ");try{wW(e),u(e._program)}catch(p){e._vertexShaderText=h,e._fragmentShaderText=_;const C=/(?:Compile|Link) error: ([^]*)/.exec(p.message);f(C?C[1]:p.message)}})}hn.prototype._bind=function(){Xx(this),this._gl.useProgram(this._program)};hn.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)}`)}};hn.prototype.isDestroyed=function(){return!1};hn.prototype.destroy=function(){this._cachedShader.cache.releaseShaderProgram(this)};hn.prototype.finalDestroy=function(){return this._gl.deleteProgram(this._program),Ue(this)};function Av(e){this._context=e}let L0;const vhe=new dt({primitiveType:Je.TRIANGLES}),Dhe=new Ji({color:new U(0,0,0,0)});function Ihe(e,t){return new zr({context:e,colorTextures:[t],destroyAttachments:!1})}function Phe(e,t){return hn.fromCache({context:e,vertexShaderSource:V9,fragmentShaderSource:t,attributeLocations:{position:0,textureCoordinates:1}})}function Ohe(e,t){return(!l(L0)||L0.viewport.width!==e||L0.viewport.height!==t)&&(L0=Qe.fromCache({viewport:new qe(0,0,e,t)})),L0}Av.prototype.execute=function(e){if(b.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.");b.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:Phe(o,e.fragmentShaderSource),a=Ihe(o,t),c=Ohe(n,i),u=e.uniformMap,f=Dhe;f.framebuffer=a,f.renderState=c,f.execute(o);const h=vhe;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)};Av.prototype.isDestroyed=function(){return!1};Av.prototype.destroy=function(){return Ue(this)};const Gt={BYTE:se.BYTE,UNSIGNED_BYTE:se.UNSIGNED_BYTE,SHORT:se.SHORT,UNSIGNED_SHORT:se.UNSIGNED_SHORT,INT:se.INT,UNSIGNED_INT:se.UNSIGNED_INT,FLOAT:se.FLOAT,DOUBLE:se.DOUBLE};Gt.getSizeInBytes=function(e){if(!l(e))throw new x("value is required.");switch(e){case Gt.BYTE:return Int8Array.BYTES_PER_ELEMENT;case Gt.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case Gt.SHORT:return Int16Array.BYTES_PER_ELEMENT;case Gt.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case Gt.INT:return Int32Array.BYTES_PER_ELEMENT;case Gt.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case Gt.FLOAT:return Float32Array.BYTES_PER_ELEMENT;case Gt.DOUBLE:return Float64Array.BYTES_PER_ELEMENT;default:throw new x("componentDatatype is not a valid value.")}};Gt.fromTypedArray=function(e){if(e instanceof Int8Array)return Gt.BYTE;if(e instanceof Uint8Array)return Gt.UNSIGNED_BYTE;if(e instanceof Int16Array)return Gt.SHORT;if(e instanceof Uint16Array)return Gt.UNSIGNED_SHORT;if(e instanceof Int32Array)return Gt.INT;if(e instanceof Uint32Array)return Gt.UNSIGNED_INT;if(e instanceof Float32Array)return Gt.FLOAT;if(e instanceof Float64Array)return Gt.DOUBLE;throw new x("array must be an Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, or Float64Array.")};Gt.validate=function(e){return l(e)&&(e===Gt.BYTE||e===Gt.UNSIGNED_BYTE||e===Gt.SHORT||e===Gt.UNSIGNED_SHORT||e===Gt.INT||e===Gt.UNSIGNED_INT||e===Gt.FLOAT||e===Gt.DOUBLE)};Gt.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 Gt.BYTE:return new Int8Array(t);case Gt.UNSIGNED_BYTE:return new Uint8Array(t);case Gt.SHORT:return new Int16Array(t);case Gt.UNSIGNED_SHORT:return new Uint16Array(t);case Gt.INT:return new Int32Array(t);case Gt.UNSIGNED_INT:return new Uint32Array(t);case Gt.FLOAT:return new Float32Array(t);case Gt.DOUBLE:return new Float64Array(t);default:throw new x("componentDatatype is not a valid value.")}};Gt.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)/Gt.getSizeInBytes(e)),e){case Gt.BYTE:return new Int8Array(t,n,i);case Gt.UNSIGNED_BYTE:return new Uint8Array(t,n,i);case Gt.SHORT:return new Int16Array(t,n,i);case Gt.UNSIGNED_SHORT:return new Uint16Array(t,n,i);case Gt.INT:return new Int32Array(t,n,i);case Gt.UNSIGNED_INT:return new Uint32Array(t,n,i);case Gt.FLOAT:return new Float32Array(t,n,i);case Gt.DOUBLE:return new Float64Array(t,n,i);default:throw new x("componentDatatype is not a valid value.")}};Gt.fromName=function(e){switch(e){case"BYTE":return Gt.BYTE;case"UNSIGNED_BYTE":return Gt.UNSIGNED_BYTE;case"SHORT":return Gt.SHORT;case"UNSIGNED_SHORT":return Gt.UNSIGNED_SHORT;case"INT":return Gt.INT;case"UNSIGNED_INT":return Gt.UNSIGNED_INT;case"FLOAT":return Gt.FLOAT;case"DOUBLE":return Gt.DOUBLE;default:throw new x("name is not a valid value.")}};const ee=Object.freeze(Gt),iz={};function Di(e,t){if(!l(e))throw new x("identifier is required.");l(iz[e])||(iz[e]=!0,console.warn(A(t,e)))}Di.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.";Di.geometryZIndex="Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";Di.geometryHeightReference="Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";Di.geometryExtrudedHeightReference="Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";function Tp(e,t){if(!l(e)||!l(t))throw new x("identifier and message are required.");Di(e,t)}const Lhe={NONE:0,TRIANGLES:1,LINES:2,POLYLINES:3},qg=Object.freeze(Lhe);function Ce(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 B0=new d;Ce.fromAxisAngle=function(e,t,n){b.typeOf.object("axis",e),b.typeOf.number("angle",t);const i=t/2,o=Math.sin(i);B0=d.normalize(e,B0);const r=B0.x*o,s=B0.y*o,a=B0.z*o,c=Math.cos(i);return l(n)?(n.x=r,n.y=s,n.z=a,n.w=c,n):new Ce(r,s,a,c)};const Bhe=[1,2,0],Rhe=new Array(3);Ce.fromRotationMatrix=function(e,t){b.typeOf.object("matrix",e);let n,i,o,r,s;const a=e[J.COLUMN0ROW0],c=e[J.COLUMN1ROW1],u=e[J.COLUMN2ROW2],f=a+c+u;if(f>0)n=Math.sqrt(f+1),s=.5*n,n=.5/n,i=(e[J.COLUMN1ROW2]-e[J.COLUMN2ROW1])*n,o=(e[J.COLUMN2ROW0]-e[J.COLUMN0ROW2])*n,r=(e[J.COLUMN0ROW1]-e[J.COLUMN1ROW0])*n;else{const h=Bhe;let _=0;c>a&&(_=1),u>a&&u>c&&(_=2);const g=h[_],p=h[g];n=Math.sqrt(e[J.getElementIndex(_,_)]-e[J.getElementIndex(g,g)]-e[J.getElementIndex(p,p)]+1);const y=Rhe;y[_]=.5*n,n=.5/n,s=(e[J.getElementIndex(p,g)]-e[J.getElementIndex(g,p)])*n,y[g]=(e[J.getElementIndex(g,_)]+e[J.getElementIndex(_,g)])*n,y[p]=(e[J.getElementIndex(p,_)]+e[J.getElementIndex(_,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 Ce(i,o,r,s)};const oz=new Ce;let rz=new Ce,_I=new Ce,sz=new Ce;Ce.fromHeadingPitchRoll=function(e,t){return b.typeOf.object("headingPitchRoll",e),sz=Ce.fromAxisAngle(d.UNIT_X,e.roll,oz),_I=Ce.fromAxisAngle(d.UNIT_Y,-e.pitch,t),t=Ce.multiply(_I,sz,_I),rz=Ce.fromAxisAngle(d.UNIT_Z,-e.heading,oz),Ce.multiply(rz,t,t)};const $b=new d,gI=new d,wl=new Ce,az=new Ce,Xb=new Ce;Ce.packedLength=4;Ce.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.x,t[n++]=e.y,t[n++]=e.z,t[n]=e.w,t};Ce.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new Ce),n.x=e[t],n.y=e[t+1],n.z=e[t+2],n.w=e[t+3],n};Ce.packedInterpolationLength=3;Ce.convertPackedArrayForInterpolation=function(e,t,n,i){Ce.unpack(e,n*4,Xb),Ce.conjugate(Xb,Xb);for(let o=0,r=n-t+1;o<r;o++){const s=o*3;Ce.unpack(e,(t+o)*4,wl),Ce.multiply(wl,Xb,wl),wl.w<0&&Ce.negate(wl,wl),Ce.computeAxis(wl,$b);const a=Ce.computeAngle(wl);l(i)||(i=[]),i[s]=$b.x*a,i[s+1]=$b.y*a,i[s+2]=$b.z*a}};Ce.unpackInterpolationResult=function(e,t,n,i,o){l(o)||(o=new Ce),d.fromArray(e,0,gI);const r=d.magnitude(gI);return Ce.unpack(t,i*4,az),r===0?Ce.clone(Ce.IDENTITY,wl):Ce.fromAxisAngle(gI,r,wl),Ce.multiply(wl,az,o)};Ce.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 Ce(e.x,e.y,e.z,e.w)};Ce.conjugate=function(e,t){return b.typeOf.object("quaternion",e),b.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t};Ce.magnitudeSquared=function(e){return b.typeOf.object("quaternion",e),e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w};Ce.magnitude=function(e){return Math.sqrt(Ce.magnitudeSquared(e))};Ce.normalize=function(e,t){b.typeOf.object("result",t);const n=1/Ce.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};Ce.inverse=function(e,t){b.typeOf.object("result",t);const n=Ce.magnitudeSquared(e);return t=Ce.conjugate(e,t),Ce.multiplyByScalar(t,1/n,t)};Ce.add=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};Ce.subtract=function(e,t,n){return b.typeOf.object("left",e),b.typeOf.object("right",t),b.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};Ce.negate=function(e,t){return b.typeOf.object("quaternion",e),b.typeOf.object("result",t),t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t};Ce.dot=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w};Ce.multiply=function(e,t,n){b.typeOf.object("left",e),b.typeOf.object("right",t),b.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,f=t.w,h=s*a+i*f+o*u-r*c,_=s*c-i*u+o*f+r*a,g=s*u+i*c-o*a+r*f,p=s*f-i*a-o*c-r*u;return n.x=h,n.y=_,n.z=g,n.w=p,n};Ce.multiplyByScalar=function(e,t,n){return b.typeOf.object("quaternion",e),b.typeOf.number("scalar",t),b.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};Ce.divideByScalar=function(e,t,n){return b.typeOf.object("quaternion",e),b.typeOf.number("scalar",t),b.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};Ce.computeAxis=function(e,t){b.typeOf.object("quaternion",e),b.typeOf.object("result",t);const n=e.w;if(Math.abs(n-1)<N.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};Ce.computeAngle=function(e){return b.typeOf.object("quaternion",e),Math.abs(e.w-1)<N.EPSILON6?0:2*Math.acos(e.w)};let yI=new Ce;Ce.lerp=function(e,t,n,i){return b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i),yI=Ce.multiplyByScalar(t,n,yI),i=Ce.multiplyByScalar(e,1-n,i),Ce.add(yI,i,i)};let cz=new Ce,AI=new Ce,CI=new Ce;Ce.slerp=function(e,t,n,i){b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i);let o=Ce.dot(e,t),r=t;if(o<0&&(o=-o,r=cz=Ce.negate(t,cz)),1-o<N.EPSILON6)return Ce.lerp(e,r,n,i);const s=Math.acos(o);return AI=Ce.multiplyByScalar(e,Math.sin((1-n)*s),AI),CI=Ce.multiplyByScalar(r,Math.sin(n*s),CI),i=Ce.add(AI,CI,i),Ce.multiplyByScalar(i,1/Math.sin(s),i)};Ce.log=function(e,t){b.typeOf.object("quaternion",e),b.typeOf.object("result",t);const n=N.acosClamped(e.w);let i=0;return n!==0&&(i=n/Math.sin(n)),d.multiplyByScalar(e,i,t)};Ce.exp=function(e,t){b.typeOf.object("cartesian",e),b.typeOf.object("result",t);const n=d.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 Nhe=new d,Mhe=new d,oC=new Ce,Yg=new Ce;Ce.computeInnerQuadrangle=function(e,t,n,i){b.typeOf.object("q0",e),b.typeOf.object("q1",t),b.typeOf.object("q2",n),b.typeOf.object("result",i);const o=Ce.conjugate(t,oC);Ce.multiply(o,n,Yg);const r=Ce.log(Yg,Nhe);Ce.multiply(o,e,Yg);const s=Ce.log(Yg,Mhe);return d.add(r,s,r),d.multiplyByScalar(r,.25,r),d.negate(r,r),Ce.exp(r,oC),Ce.multiply(t,oC,i)};Ce.squad=function(e,t,n,i,o,r){b.typeOf.object("q0",e),b.typeOf.object("q1",t),b.typeOf.object("s0",n),b.typeOf.object("s1",i),b.typeOf.number("t",o),b.typeOf.object("result",r);const s=Ce.slerp(e,t,o,oC),a=Ce.slerp(n,i,o,Yg);return Ce.slerp(s,a,2*o*(1-o),r)};const Fhe=new Ce,SW=1.9011074535173003,Zw=un.supportsTypedArrays()?new Float32Array(8):[],eS=un.supportsTypedArrays()?new Float32Array(8):[],xf=un.supportsTypedArrays()?new Float32Array(8):[],wf=un.supportsTypedArrays()?new Float32Array(8):[];for(let e=0;e<7;++e){const t=e+1,n=2*t+1;Zw[e]=1/(t*n),eS[e]=t/n}Zw[7]=SW/(8*17);eS[7]=SW*8/17;Ce.fastSlerp=function(e,t,n,i){b.typeOf.object("start",e),b.typeOf.object("end",t),b.typeOf.number("t",n),b.typeOf.object("result",i);let o=Ce.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)xf[g]=(Zw[g]*c-eS[g])*s,wf[g]=(Zw[g]*u-eS[g])*s;const f=r*n*(1+xf[0]*(1+xf[1]*(1+xf[2]*(1+xf[3]*(1+xf[4]*(1+xf[5]*(1+xf[6]*(1+xf[7])))))))),h=a*(1+wf[0]*(1+wf[1]*(1+wf[2]*(1+wf[3]*(1+wf[4]*(1+wf[5]*(1+wf[6]*(1+wf[7])))))))),_=Ce.multiplyByScalar(e,h,Fhe);return Ce.multiplyByScalar(t,f,i),Ce.add(_,i,i)};Ce.fastSquad=function(e,t,n,i,o,r){b.typeOf.object("q0",e),b.typeOf.object("q1",t),b.typeOf.object("s0",n),b.typeOf.object("s1",i),b.typeOf.number("t",o),b.typeOf.object("result",r);const s=Ce.fastSlerp(e,t,o,oC),a=Ce.fastSlerp(n,i,o,Yg);return Ce.fastSlerp(s,a,2*o*(1-o),r)};Ce.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};Ce.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};Ce.ZERO=Object.freeze(new Ce(0,0,0,0));Ce.IDENTITY=Object.freeze(new Ce(0,0,0,1));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.x}, ${this.y}, ${this.z}, ${this.w})`};function Cs(e,t,n){b.defined("array",e),b.defined("itemToFind",t),b.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 uN(e,t,n,i,o){this.xPoleWander=e,this.yPoleWander=t,this.xPoleOffset=n,this.yPoleOffset=i,this.ut1MinusUtc=o}function IT(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 tS(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 Bi(e,t){this.julianDate=e,this.offset=t}const zhe={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},Ti=Object.freeze(zhe),Uhe={UTC:0,TAI:1},zn=Object.freeze(Uhe),vW=new IT,Kb=[31,28,31,30,31,30,31,31,30,31,30,31],Jb=29;function fN(e,t){return ne.compare(e.julianDate,t.julianDate)}const Ly=new Bi;function Cv(e){Ly.julianDate=e;const t=ne.leapSeconds;let n=Cs(t,Ly,fN);n<0&&(n=~n),n>=t.length&&(n=t.length-1);let i=t[n].offset;n>0&&ne.secondsDifference(t[n].julianDate,e)>i&&(n--,i=t[n].offset),ne.addSeconds(e,i,e)}function lz(e,t){Ly.julianDate=e;const n=ne.leapSeconds;let i=Cs(n,Ly,fN);if(i<0&&(i=~i),i===0)return ne.addSeconds(e,-n[0].offset,t);if(i>=n.length)return ne.addSeconds(e,-n[i-1].offset,t);const o=ne.secondsDifference(n[i].julianDate,e);if(o===0)return ne.addSeconds(e,-n[i].offset,t);if(!(o<=1))return ne.addSeconds(e,-n[--i].offset,t)}function bp(e,t,n){const i=t/Ti.SECONDS_PER_DAY|0;return e+=i,t-=Ti.SECONDS_PER_DAY*i,t<0&&(e--,t+=Ti.SECONDS_PER_DAY),n.dayNumber=e,n.secondsOfDay=t,n}function dN(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 f=r+(i*Ti.SECONDS_PER_HOUR+o*Ti.SECONDS_PER_MINUTE+s*Ti.SECONDS_PER_MILLISECOND);return f>=43200&&(u-=1),[u,f]}const Hhe=/^(\d{4})$/,Vhe=/^(\d{4})-(\d{2})$/,khe=/^(\d{4})-?(\d{3})$/,Ghe=/^(\d{4})-?W(\d{2})-?(\d{1})?$/,Whe=/^(\d{4})-?(\d{2})-?(\d{2})$/,hN=/([Z+\-])?(\d{2})?:?(\d{2})?$/,jhe=/^(\d{2})(\.\d+)?/.source+hN.source,qhe=/^(\d{2}):?(\d{2})(\.\d+)?/.source+hN.source,Yhe=/^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source+hN.source,ml="Invalid ISO 8601 date.";function ne(e,t,n){this.dayNumber=void 0,this.secondsOfDay=void 0,e=A(e,0),t=A(t,0),n=A(n,zn.UTC);const i=e|0;t=t+(e-i)*Ti.SECONDS_PER_DAY,bp(i,t,this),n===zn.UTC&&Cv(this)}ne.fromGregorianDate=function(e,t){if(!(e instanceof IT))throw new x("date must be a valid GregorianDate.");const n=dN(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond);return l(t)?(bp(n[0],n[1],t),Cv(t),t):new ne(n[0],n[1],zn.UTC)};ne.fromDate=function(e,t){if(!(e instanceof Date)||isNaN(e.getTime()))throw new x("date must be a valid JavaScript Date.");const n=dN(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds());return l(t)?(bp(n[0],n[1],t),Cv(t),t):new ne(n[0],n[1],zn.UTC)};ne.fromIso8601=function(e,t){if(typeof e!="string")throw new x(ml);e=e.replace(",",".");let n=e.split("T"),i,o=1,r=1,s=0,a=0,c=0,u=0;const f=n[0],h=n[1];let _,g;if(!l(f))throw new x(ml);let p;if(n=f.match(Whe),n!==null){if(p=f.split("-").length-1,p>0&&p!==2)throw new x(ml);i=+n[1],o=+n[2],r=+n[3]}else if(n=f.match(Vhe),n!==null)i=+n[1],o=+n[2];else if(n=f.match(Hhe),n!==null)i=+n[1];else{let E;if(n=f.match(khe),n!==null){if(i=+n[1],E=+n[2],g=tS(i),E<1||g&&E>366||!g&&E>365)throw new x(ml)}else if(n=f.match(Ghe),n!==null){i=+n[1];const w=+n[2],S=+n[3]||0;if(p=f.split("-").length-1,p>0&&(!l(n[3])&&p!==1||l(n[3])&&p!==2))throw new x(ml);const P=new Date(Date.UTC(i,0,4));E=w*7+S-P.getUTCDay()-3}else throw new x(ml);_=new Date(Date.UTC(i,0,1)),_.setUTCDate(E),o=_.getUTCMonth()+1,r=_.getUTCDate()}if(g=tS(i),o<1||o>12||r<1||(o!==2||!g)&&r>Kb[o-1]||g&&o===2&&r>Jb)throw new x(ml);let y;if(l(h)){if(n=h.match(Yhe),n!==null){if(p=h.split(":").length-1,p>0&&p!==2&&p!==3)throw new x(ml);s=+n[1],a=+n[2],c=+n[3],u=+(n[4]||0)*1e3,y=5}else if(n=h.match(qhe),n!==null){if(p=h.split(":").length-1,p>2)throw new x(ml);s=+n[1],a=+n[2],c=+(n[3]||0)*60,y=4}else if(n=h.match(jhe),n!==null)s=+n[1],a=+(n[2]||0)*60,y=3;else throw new x(ml);if(a>=60||c>=61||s>24||s===24&&(a>0||c>0||u>0))throw new x(ml);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 C=c===60;for(C&&c--;a>=60;)a-=60,s++;for(;s>=24;)s-=24,r++;for(_=g&&o===2?Jb:Kb[o-1];r>_;)r-=_,o++,o>12&&(o-=12,i++),_=g&&o===2?Jb:Kb[o-1];for(;a<0;)a+=60,s--;for(;s<0;)s+=24,r--;for(;r<1;)o--,o<1&&(o+=12,i--),_=g&&o===2?Jb:Kb[o-1],r+=_;const T=dN(i,o,r,s,a,c,u);return l(t)?(bp(T[0],T[1],t),Cv(t)):t=new ne(T[0],T[1],zn.UTC),C&&ne.addSeconds(t,1,t),t};ne.now=function(e){return ne.fromDate(new Date,e)};const Qb=new ne(0,0,zn.TAI);ne.toGregorianDate=function(e,t){if(!l(e))throw new x("julianDate is required.");let n=!1,i=lz(e,Qb);l(i)||(ne.addSeconds(e,-1,Qb),i=lz(Qb,Qb),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,f=s-(2447*u/80|0)|0;s=u/11|0;const h=u+2-12*s|0,_=100*(a-49)+c+s|0;let g=r/Ti.SECONDS_PER_HOUR|0,p=r-g*Ti.SECONDS_PER_HOUR;const y=p/Ti.SECONDS_PER_MINUTE|0;p=p-y*Ti.SECONDS_PER_MINUTE;let C=p|0;const T=(p-C)/Ti.SECONDS_PER_MILLISECOND;return g+=12,g>23&&(g-=24),n&&(C+=1),l(t)?(t.year=_,t.month=h,t.day=f,t.hour=g,t.minute=y,t.second=C,t.millisecond=T,t.isLeapSecond=n,t):new IT(_,h,f,g,y,C,T,n)};ne.toDate=function(e){if(!l(e))throw new x("julianDate is required.");const t=ne.toGregorianDate(e,vW);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))};ne.toIso8601=function(e,t){if(!l(e))throw new x("julianDate is required.");const n=ne.toGregorianDate(e,vW);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 f;return!l(t)&&u!==0?(f=(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")}.${f}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`:(f=(u*.01).toFixed(t).replace(".","").slice(0,t),`${i.toString().padStart(4,"0")}-${o.toString().padStart(2,"0")}-${r.toString().padStart(2,"0")}T${s.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${c.toString().padStart(2,"0")}.${f}Z`)};ne.clone=function(e,t){if(l(e))return l(t)?(t.dayNumber=e.dayNumber,t.secondsOfDay=e.secondsOfDay,t):new ne(e.dayNumber,e.secondsOfDay,zn.TAI)};ne.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};ne.equals=function(e,t){return e===t||l(e)&&l(t)&&e.dayNumber===t.dayNumber&&e.secondsOfDay===t.secondsOfDay};ne.equalsEpsilon=function(e,t,n){return n=A(n,0),e===t||l(e)&&l(t)&&Math.abs(ne.secondsDifference(e,t))<=n};ne.totalDays=function(e){if(!l(e))throw new x("julianDate is required.");return e.dayNumber+e.secondsOfDay/Ti.SECONDS_PER_DAY};ne.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)*Ti.SECONDS_PER_DAY+(e.secondsOfDay-t.secondsOfDay)};ne.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)/Ti.SECONDS_PER_DAY;return n+i};ne.computeTaiMinusUtc=function(e){Ly.julianDate=e;const t=ne.leapSeconds;let n=Cs(t,Ly,fN);return n<0&&(n=~n,--n,n<0&&(n=0)),t[n].offset};ne.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 bp(e.dayNumber,e.secondsOfDay+t,n)};ne.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*Ti.SECONDS_PER_MINUTE;return bp(e.dayNumber,i,n)};ne.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*Ti.SECONDS_PER_HOUR;return bp(e.dayNumber,i,n)};ne.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 bp(i,e.secondsOfDay,n)};ne.lessThan=function(e,t){return ne.compare(e,t)<0};ne.lessThanOrEquals=function(e,t){return ne.compare(e,t)<=0};ne.greaterThan=function(e,t){return ne.compare(e,t)>0};ne.greaterThanOrEquals=function(e,t){return ne.compare(e,t)>=0};ne.prototype.clone=function(e){return ne.clone(this,e)};ne.prototype.equals=function(e){return ne.equals(this,e)};ne.prototype.equalsEpsilon=function(e,t){return ne.equalsEpsilon(this,e,t)};ne.prototype.toString=function(){return ne.toIso8601(this)};ne.leapSeconds=[new Bi(new ne(2441317,43210,zn.TAI),10),new Bi(new ne(2441499,43211,zn.TAI),11),new Bi(new ne(2441683,43212,zn.TAI),12),new Bi(new ne(2442048,43213,zn.TAI),13),new Bi(new ne(2442413,43214,zn.TAI),14),new Bi(new ne(2442778,43215,zn.TAI),15),new Bi(new ne(2443144,43216,zn.TAI),16),new Bi(new ne(2443509,43217,zn.TAI),17),new Bi(new ne(2443874,43218,zn.TAI),18),new Bi(new ne(2444239,43219,zn.TAI),19),new Bi(new ne(2444786,43220,zn.TAI),20),new Bi(new ne(2445151,43221,zn.TAI),21),new Bi(new ne(2445516,43222,zn.TAI),22),new Bi(new ne(2446247,43223,zn.TAI),23),new Bi(new ne(2447161,43224,zn.TAI),24),new Bi(new ne(2447892,43225,zn.TAI),25),new Bi(new ne(2448257,43226,zn.TAI),26),new Bi(new ne(2448804,43227,zn.TAI),27),new Bi(new ne(2449169,43228,zn.TAI),28),new Bi(new ne(2449534,43229,zn.TAI),29),new Bi(new ne(2450083,43230,zn.TAI),30),new Bi(new ne(2450630,43231,zn.TAI),31),new Bi(new ne(2451179,43232,zn.TAI),32),new Bi(new ne(2453736,43233,zn.TAI),33),new Bi(new ne(2454832,43234,zn.TAI),34),new Bi(new ne(2456109,43235,zn.TAI),35),new Bi(new ne(2457204,43236,zn.TAI),36),new Bi(new ne(2457754,43237,zn.TAI),37)];const $he="modulepreload",Xhe=function(e){return"/satellite-track/"+e},uz={},Zb=function(t,n,i){if(!n||n.length===0)return t();const o=document.getElementsByTagName("link");return Promise.all(n.map(r=>{if(r=Xhe(r),r in uz)return;uz[r]=!0;const s=r.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!i)for(let f=o.length-1;f>=0;f--){const h=o[f];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":$he,s||(u.as="script",u.crossOrigin=""),u.href=r,document.head.appendChild(u),s)return new Promise((f,h)=>{u.addEventListener("load",f),u.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${r}`)))})})).then(()=>t())};var _L={},Khe={get exports(){return _L},set exports(e){_L=e}},rC={},Jhe={get exports(){return rC},set exports(e){rC=e}};/*! https://mths.be/punycode v1.4.0 by @mathias */var fz;function Qhe(){return fz||(fz=1,function(e,t){(function(n){var i=t&&!t.nodeType&&t,o=e&&!e.nodeType&&e,r=typeof oy=="object"&&oy;(r.global===r||r.window===r||r.self===r)&&(n=r);var s,a=2147483647,c=36,u=1,f=26,h=38,_=700,g=72,p=128,y="-",C=/^xn--/,T=/[^\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,O=String.fromCharCode,z;function R(G){throw new RangeError(w[G])}function F(G,K){for(var q=G.length,te=[];q--;)te[q]=K(G[q]);return te}function H(G,K){var q=G.split("@"),te="";q.length>1&&(te=q[0]+"@",G=q[1]),G=G.replace(E,".");var $=G.split("."),X=F($,K).join(".");return te+X}function v(G){for(var K=[],q=0,te=G.length,$,X;q<te;)$=G.charCodeAt(q++),$>=55296&&$<=56319&&q<te?(X=G.charCodeAt(q++),(X&64512)==56320?K.push((($&1023)<<10)+(X&1023)+65536):(K.push($),q--)):K.push($);return K}function I(G){return F(G,function(K){var q="";return K>65535&&(K-=65536,q+=O(K>>>10&1023|55296),K=56320|K&1023),q+=O(K),q}).join("")}function m(G){return G-48<10?G-22:G-65<26?G-65:G-97<26?G-97:c}function D(G,K){return G+22+75*(G<26)-((K!=0)<<5)}function L(G,K,q){var te=0;for(G=q?P(G/_):G>>1,G+=P(G/K);G>S*f>>1;te+=c)G=P(G/S);return P(te+(S+1)*G/(G+h))}function M(G){var K=[],q=G.length,te,$=0,X=p,Y=g,ae,ue,re,he,ce,Q,ie,de,me;for(ae=G.lastIndexOf(y),ae<0&&(ae=0),ue=0;ue<ae;++ue)G.charCodeAt(ue)>=128&&R("not-basic"),K.push(G.charCodeAt(ue));for(re=ae>0?ae+1:0;re<q;){for(he=$,ce=1,Q=c;re>=q&&R("invalid-input"),ie=m(G.charCodeAt(re++)),(ie>=c||ie>P((a-$)/ce))&&R("overflow"),$+=ie*ce,de=Q<=Y?u:Q>=Y+f?f:Q-Y,!(ie<de);Q+=c)me=c-de,ce>P(a/me)&&R("overflow"),ce*=me;te=K.length+1,Y=L($-he,te,he==0),P($/te)>a-X&&R("overflow"),X+=P($/te),$%=te,K.splice($++,0,X)}return I(K)}function V(G){var K,q,te,$,X,Y,ae,ue,re,he,ce,Q=[],ie,de,me,Ee;for(G=v(G),ie=G.length,K=p,q=0,X=g,Y=0;Y<ie;++Y)ce=G[Y],ce<128&&Q.push(O(ce));for(te=$=Q.length,$&&Q.push(y);te<ie;){for(ae=a,Y=0;Y<ie;++Y)ce=G[Y],ce>=K&&ce<ae&&(ae=ce);for(de=te+1,ae-K>P((a-q)/de)&&R("overflow"),q+=(ae-K)*de,K=ae,Y=0;Y<ie;++Y)if(ce=G[Y],ce<K&&++q>a&&R("overflow"),ce==K){for(ue=q,re=c;he=re<=X?u:re>=X+f?f:re-X,!(ue<he);re+=c)Ee=ue-he,me=c-he,Q.push(O(D(he+Ee%me,0))),ue=P(Ee/me);Q.push(O(D(ue,0))),X=L(q,de,te==$),q=0,++te}++q,++K}return Q.join("")}function k(G){return H(G,function(K){return C.test(K)?M(K.slice(4).toLowerCase()):K})}function W(G){return H(G,function(K){return T.test(K)?"xn--"+V(K):K})}if(s={version:"1.3.2",ucs2:{decode:v,encode:I},decode:M,encode:V,toASCII:W,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})(oy)}(Jhe,rC)),rC}var nS={},Zhe={get exports(){return nS},set exports(e){nS=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 dz;function epe(){return dz||(dz=1,function(e){(function(t,n){e.exports?e.exports=n():t.IPv6=n(t)})(oy,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 f;for(f=0;f<c&&a[f]!=="";f++);if(f<u)for(a.splice(f,1,"0000");a.length<u;)a.splice(f,0,"0000");for(var h,_=0;_<u;_++){h=a[_].split("");for(var g=0;g<3&&(h[0]==="0"&&h.length>1);g++)h.splice(0,1);a[_]=h.join("")}var p=-1,y=0,C=0,T=-1,E=!1;for(_=0;_<u;_++)E?a[_]==="0"?C+=1:(E=!1,C>y&&(p=T,y=C)):a[_]==="0"&&(E=!0,T=_,C=1);C>y&&(p=T,y=C),y>1&&a.splice(p,y,""),c=a.length;var w="";for(a[0]===""&&(w=":"),_=0;_<c&&(w+=a[_],_!==c-1);_++)w+=":";return a[c-1]===""&&(w+=":"),w}function o(){return t.IPv6===this&&(t.IPv6=n),this}return{best:i,noConflict:o}})}(Zhe)),nS}var iS={},tpe={get exports(){return iS},set exports(e){iS=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 hz;function npe(){return hz||(hz=1,function(e){(function(t,n){e.exports?e.exports=n():t.SecondLevelDomains=n(t)})(oy,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})}(tpe)),iS}/*!
* 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(Qhe(),epe(),npe()):t.URI=n(t.punycode,t.IPv6,t.SecondLevelDomains,t)})(oy,function(t,n,i,o){var r=o&&o.URI;function s(m,D){var L=arguments.length>=1,M=arguments.length>=2;if(!(this instanceof s))return L?M?new s(m,D):new s(m):new s;if(m===void 0){if(L)throw new TypeError("undefined is not a valid argument for URI");typeof location<"u"?m=location.href+"":m=""}if(m===null&&L)throw new TypeError("null is not a valid argument for URI");return this.href(m),D!==void 0?this.absoluteTo(D):this}function a(m){return/^[0-9]+$/.test(m)}s.version="1.19.11";var c=s.prototype,u=Object.prototype.hasOwnProperty;function f(m){return m.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function h(m){return m===void 0?"Undefined":String(Object.prototype.toString.call(m)).slice(8,-1)}function _(m){return h(m)==="Array"}function g(m,D){var L={},M,V;if(h(D)==="RegExp")L=null;else if(_(D))for(M=0,V=D.length;M<V;M++)L[D[M]]=!0;else L[D]=!0;for(M=0,V=m.length;M<V;M++){var k=L&&L[m[M]]!==void 0||!L&&D.test(m[M]);k&&(m.splice(M,1),V--,M--)}return m}function p(m,D){var L,M;if(_(D)){for(L=0,M=D.length;L<M;L++)if(!p(m,D[L]))return!1;return!0}var V=h(D);for(L=0,M=m.length;L<M;L++)if(V==="RegExp"){if(typeof m[L]=="string"&&m[L].match(D))return!0}else if(m[L]===D)return!0;return!1}function y(m,D){if(!_(m)||!_(D)||m.length!==D.length)return!1;m.sort(),D.sort();for(var L=0,M=m.length;L<M;L++)if(m[L]!==D[L])return!1;return!0}function C(m){var D=/^\/+|\/+$/g;return m.replace(D,"")}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(m){if(!(!m||!m.nodeName)){var D=m.nodeName.toLowerCase();if(!(D==="input"&&m.type!=="image"))return s.domAttributes[D]}};function T(m){return escape(m)}function E(m){return encodeURIComponent(m).replace(/[!'()*]/g,T).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(m,D){var L=s.encode(m+"");return D===void 0&&(D=s.escapeQuerySpace),D?L.replace(/%20/g,"+"):L},s.decodeQuery=function(m,D){m+="",D===void 0&&(D=s.escapeQuerySpace);try{return s.decode(D?m.replace(/\+/g,"%20"):m)}catch{return m}};var w={encode:"encode",decode:"decode"},S,P=function(m,D){return function(L){try{return s[D](L+"").replace(s.characters[m][D].expression,function(M){return s.characters[m][D].map[M]})}catch{return L}}};for(S in w)s[S+"PathSegment"]=P("pathname",w[S]),s[S+"UrnPathSegment"]=P("urnpath",w[S]);var O=function(m,D,L){return function(M){var V;L?V=function(K){return s[D](s[L](K))}:V=s[D];for(var k=(M+"").split(m),W=0,G=k.length;W<G;W++)k[W]=V(k[W]);return k.join(m)}};s.decodePath=O("/","decodePathSegment"),s.decodeUrnPath=O(":","decodeUrnPathSegment"),s.recodePath=O("/","encodePathSegment","decode"),s.recodeUrnPath=O(":","encodeUrnPathSegment","decode"),s.encodeReserved=P("reserved","encode"),s.parse=function(m,D){var L;return D||(D={preventInvalidHostname:s.preventInvalidHostname}),m=m.replace(s.leading_whitespace_expression,""),m=m.replace(s.ascii_tab_whitespace,""),L=m.indexOf("#"),L>-1&&(D.fragment=m.substring(L+1)||null,m=m.substring(0,L)),L=m.indexOf("?"),L>-1&&(D.query=m.substring(L+1)||null,m=m.substring(0,L)),m=m.replace(/^(https?|ftp|wss?)?:+[/\\]*/i,"$1://"),m=m.replace(/^[/\\]{2,}/i,"//"),m.substring(0,2)==="//"?(D.protocol=null,m=m.substring(2),m=s.parseAuthority(m,D)):(L=m.indexOf(":"),L>-1&&(D.protocol=m.substring(0,L)||null,D.protocol&&!D.protocol.match(s.protocol_expression)?D.protocol=void 0:m.substring(L+1,L+3).replace(/\\/g,"/")==="//"?(m=m.substring(L+3),m=s.parseAuthority(m,D)):(m=m.substring(L+1),D.urn=!0))),D.path=m,D},s.parseHost=function(m,D){m||(m=""),m=m.replace(/\\/g,"/");var L=m.indexOf("/"),M,V;if(L===-1&&(L=m.length),m.charAt(0)==="[")M=m.indexOf("]"),D.hostname=m.substring(1,M)||null,D.port=m.substring(M+2,L)||null,D.port==="/"&&(D.port=null);else{var k=m.indexOf(":"),W=m.indexOf("/"),G=m.indexOf(":",k+1);G!==-1&&(W===-1||G<W)?(D.hostname=m.substring(0,L)||null,D.port=null):(V=m.substring(0,L).split(":"),D.hostname=V[0]||null,D.port=V[1]||null)}return D.hostname&&m.substring(L).charAt(0)!=="/"&&(L++,m="/"+m),D.preventInvalidHostname&&s.ensureValidHostname(D.hostname,D.protocol),D.port&&s.ensureValidPort(D.port),m.substring(L)||"/"},s.parseAuthority=function(m,D){return m=s.parseUserinfo(m,D),s.parseHost(m,D)},s.parseUserinfo=function(m,D){var L=m,M=m.indexOf("\\");M!==-1&&(m=m.replace(/\\/g,"/"));var V=m.indexOf("/"),k=m.lastIndexOf("@",V>-1?V:m.length-1),W;return k>-1&&(V===-1||k<V)?(W=m.substring(0,k).split(":"),D.username=W[0]?s.decode(W[0]):null,W.shift(),D.password=W[0]?s.decode(W.join(":")):null,m=L.substring(k+1)):(D.username=null,D.password=null),m},s.parseQuery=function(m,D){if(!m)return{};if(m=m.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!m)return{};for(var L={},M=m.split("&"),V=M.length,k,W,G,K=0;K<V;K++)k=M[K].split("="),W=s.decodeQuery(k.shift(),D),G=k.length?s.decodeQuery(k.join("="),D):null,W!=="__proto__"&&(u.call(L,W)?((typeof L[W]=="string"||L[W]===null)&&(L[W]=[L[W]]),L[W].push(G)):L[W]=G);return L},s.build=function(m){var D="",L=!1;return m.protocol&&(D+=m.protocol+":"),!m.urn&&(D||m.hostname)&&(D+="//",L=!0),D+=s.buildAuthority(m)||"",typeof m.path=="string"&&(m.path.charAt(0)!=="/"&&L&&(D+="/"),D+=m.path),typeof m.query=="string"&&m.query&&(D+="?"+m.query),typeof m.fragment=="string"&&m.fragment&&(D+="#"+m.fragment),D},s.buildHost=function(m){var D="";if(m.hostname)s.ip6_expression.test(m.hostname)?D+="["+m.hostname+"]":D+=m.hostname;else return"";return m.port&&(D+=":"+m.port),D},s.buildAuthority=function(m){return s.buildUserinfo(m)+s.buildHost(m)},s.buildUserinfo=function(m){var D="";return m.username&&(D+=s.encode(m.username)),m.password&&(D+=":"+s.encode(m.password)),D&&(D+="@"),D},s.buildQuery=function(m,D,L){var M="",V,k,W,G;for(k in m)if(k!=="__proto__"&&u.call(m,k))if(_(m[k]))for(V={},W=0,G=m[k].length;W<G;W++)m[k][W]!==void 0&&V[m[k][W]+""]===void 0&&(M+="&"+s.buildQueryParameter(k,m[k][W],L),D!==!0&&(V[m[k][W]+""]=!0));else m[k]!==void 0&&(M+="&"+s.buildQueryParameter(k,m[k],L));return M.substring(1)},s.buildQueryParameter=function(m,D,L){return s.encodeQuery(m,L)+(D!==null?"="+s.encodeQuery(D,L):"")},s.addQuery=function(m,D,L){if(typeof D=="object")for(var M in D)u.call(D,M)&&s.addQuery(m,M,D[M]);else if(typeof D=="string"){if(m[D]===void 0){m[D]=L;return}else typeof m[D]=="string"&&(m[D]=[m[D]]);_(L)||(L=[L]),m[D]=(m[D]||[]).concat(L)}else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter")},s.setQuery=function(m,D,L){if(typeof D=="object")for(var M in D)u.call(D,M)&&s.setQuery(m,M,D[M]);else if(typeof D=="string")m[D]=L===void 0?null:L;else throw new TypeError("URI.setQuery() accepts an object, string as the name parameter")},s.removeQuery=function(m,D,L){var M,V,k;if(_(D))for(M=0,V=D.length;M<V;M++)m[D[M]]=void 0;else if(h(D)==="RegExp")for(k in m)D.test(k)&&(m[k]=void 0);else if(typeof D=="object")for(k in D)u.call(D,k)&&s.removeQuery(m,k,D[k]);else if(typeof D=="string")L!==void 0?h(L)==="RegExp"?!_(m[D])&&L.test(m[D])?m[D]=void 0:m[D]=g(m[D],L):m[D]===String(L)&&(!_(L)||L.length===1)?m[D]=void 0:_(m[D])&&(m[D]=g(m[D],L)):m[D]=void 0;else throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter")},s.hasQuery=function(m,D,L,M){switch(h(D)){case"String":break;case"RegExp":for(var V in m)if(u.call(m,V)&&D.test(V)&&(L===void 0||s.hasQuery(m,V,L)))return!0;return!1;case"Object":for(var k in D)if(u.call(D,k)&&!s.hasQuery(m,k,D[k]))return!1;return!0;default:throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter")}switch(h(L)){case"Undefined":return D in m;case"Boolean":var W=Boolean(_(m[D])?m[D].length:m[D]);return L===W;case"Function":return!!L(m[D],D,m);case"Array":if(!_(m[D]))return!1;var G=M?p:y;return G(m[D],L);case"RegExp":return _(m[D])?M?p(m[D],L):!1:Boolean(m[D]&&m[D].match(L));case"Number":L=String(L);case"String":return _(m[D])?M?p(m[D],L):!1:m[D]===L;default:throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},s.joinPaths=function(){for(var m=[],D=[],L=0,M=0;M<arguments.length;M++){var V=new s(arguments[M]);m.push(V);for(var k=V.segment(),W=0;W<k.length;W++)typeof k[W]=="string"&&D.push(k[W]),k[W]&&L++}if(!D.length||!L)return new s("");var G=new s("").segment(D);return(m[0].path()===""||m[0].path().slice(0,1)==="/")&&G.path("/"+G.path()),G.normalize()},s.commonPath=function(m,D){var L=Math.min(m.length,D.length),M;for(M=0;M<L;M++)if(m.charAt(M)!==D.charAt(M)){M--;break}return M<1?m.charAt(0)===D.charAt(0)&&m.charAt(0)==="/"?"/":"":((m.charAt(M)!=="/"||D.charAt(M)!=="/")&&(M=m.substring(0,M).lastIndexOf("/")),m.substring(0,M+1))},s.withinString=function(m,D,L){L||(L={});var M=L.start||s.findUri.start,V=L.end||s.findUri.end,k=L.trim||s.findUri.trim,W=L.parens||s.findUri.parens,G=/[a-z0-9-]=["']?$/i;for(M.lastIndex=0;;){var K=M.exec(m);if(!K)break;var q=K.index;if(L.ignoreHtml){var te=m.slice(Math.max(q-3,0),q);if(te&&G.test(te))continue}for(var $=q+m.slice(q).search(V),X=m.slice(q,$),Y=-1;;){var ae=W.exec(X);if(!ae)break;var ue=ae.index+ae[0].length;Y=Math.max(Y,ue)}if(Y>-1?X=X.slice(0,Y)+X.slice(Y).replace(k,""):X=X.replace(k,""),!(X.length<=K[0].length)&&!(L.ignore&&L.ignore.test(X))){$=q+X.length;var re=D(X,q,$,m);if(re===void 0){M.lastIndex=$;continue}re=String(re),m=m.slice(0,q)+re+m.slice($),M.lastIndex=q+re.length}}return M.lastIndex=0,m},s.ensureValidHostname=function(m,D){var L=!!m,M=!!D,V=!1;if(M&&(V=p(s.hostProtocols,D)),V&&!L)throw new TypeError("Hostname cannot be empty, if protocol is "+D);if(m&&m.match(s.invalid_hostname_characters)){if(!t)throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(t.toASCII(m).match(s.invalid_hostname_characters))throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(m){if(m){var D=Number(m);if(!(a(D)&&D>0&&D<65536))throw new TypeError('Port "'+m+'" is not a valid port')}},s.noConflict=function(m){if(m){var D={URI:this.noConflict()};return o.URITemplate&&typeof o.URITemplate.noConflict=="function"&&(D.URITemplate=o.URITemplate.noConflict()),o.IPv6&&typeof o.IPv6.noConflict=="function"&&(D.IPv6=o.IPv6.noConflict()),o.SecondLevelDomains&&typeof o.SecondLevelDomains.noConflict=="function"&&(D.SecondLevelDomains=o.SecondLevelDomains.noConflict()),D}else o.URI===this&&(o.URI=r);return this},c.build=function(m){return m===!0?this._deferred_build=!0:(m===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(m){return function(D,L){return D===void 0?this._parts[m]||"":(this._parts[m]=D||null,this.build(!L),this)}}function R(m,D){return function(L,M){return L===void 0?this._parts[m]||"":(L!==null&&(L=L+"",L.charAt(0)===D&&(L=L.substring(1))),this._parts[m]=L,this.build(!M),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(m,D){var L=this.query(m,D);return typeof L=="string"&&L.length?"?"+L:L},c.hash=function(m,D){var L=this.fragment(m,D);return typeof L=="string"&&L.length?"#"+L:L},c.pathname=function(m,D){if(m===void 0||m===!0){var L=this._parts.path||(this._parts.hostname?"/":"");return m?(this._parts.urn?s.decodeUrnPath:s.decodePath)(L):L}else return this._parts.urn?this._parts.path=m?s.recodeUrnPath(m):"":this._parts.path=m?s.recodePath(m):"/",this.build(!D),this},c.path=c.pathname,c.href=function(m,D){var L;if(m===void 0)return this.toString();this._string="",this._parts=s._parts();var M=m instanceof s,V=typeof m=="object"&&(m.hostname||m.path||m.pathname);if(m.nodeName){var k=s.getDomAttribute(m);m=m[k]||"",V=!1}if(!M&&V&&m.pathname!==void 0&&(m=m.toString()),typeof m=="string"||m instanceof String)this._parts=s.parse(String(m),this._parts);else if(M||V){var W=M?m._parts:m;for(L in W)L!=="query"&&u.call(this._parts,L)&&(this._parts[L]=W[L]);W.query&&this.query(W.query,!1)}else throw new TypeError("invalid input");return this.build(!D),this},c.is=function(m){var D=!1,L=!1,M=!1,V=!1,k=!1,W=!1,G=!1,K=!this._parts.urn;switch(this._parts.hostname&&(K=!1,L=s.ip4_expression.test(this._parts.hostname),M=s.ip6_expression.test(this._parts.hostname),D=L||M,V=!D,k=V&&i&&i.has(this._parts.hostname),W=V&&s.idn_expression.test(this._parts.hostname),G=V&&s.punycode_expression.test(this._parts.hostname)),m.toLowerCase()){case"relative":return K;case"absolute":return!K;case"domain":case"name":return V;case"sld":return k;case"ip":return D;case"ip4":case"ipv4":case"inet4":return L;case"ip6":case"ipv6":case"inet6":return M;case"idn":return W;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return G}return null};var F=c.protocol,H=c.port,v=c.hostname;c.protocol=function(m,D){if(m&&(m=m.replace(/:(\/\/)?$/,""),!m.match(s.protocol_expression)))throw new TypeError('Protocol "'+m+`" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);return F.call(this,m,D)},c.scheme=c.protocol,c.port=function(m,D){return this._parts.urn?m===void 0?"":this:(m!==void 0&&(m===0&&(m=null),m&&(m+="",m.charAt(0)===":"&&(m=m.substring(1)),s.ensureValidPort(m))),H.call(this,m,D))},c.hostname=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m!==void 0){var L={preventInvalidHostname:this._parts.preventInvalidHostname},M=s.parseHost(m,L);if(M!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');m=L.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(m,this._parts.protocol)}return v.call(this,m,D)},c.origin=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var L=this.protocol(),M=this.authority();return M?(L?L+"://":"")+this.authority():""}else{var V=s(m);return this.protocol(V.protocol()).authority(V.authority()).build(!D),this}},c.host=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?s.buildHost(this._parts):"";var L=s.parseHost(m,this._parts);if(L!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!D),this},c.authority=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0)return this._parts.hostname?s.buildAuthority(this._parts):"";var L=s.parseAuthority(m,this._parts);if(L!=="/")throw new TypeError('Hostname "'+m+'" contains characters other than [A-Z0-9.-]');return this.build(!D),this},c.userinfo=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){var L=s.buildUserinfo(this._parts);return L&&L.substring(0,L.length-1)}else return m[m.length-1]!=="@"&&(m+="@"),s.parseUserinfo(m,this._parts),this.build(!D),this},c.resource=function(m,D){var L;return m===void 0?this.path()+this.search()+this.hash():(L=s.parse(m),this._parts.path=L.path,this._parts.query=L.query,this._parts.fragment=L.fragment,this.build(!D),this)},c.subdomain=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var L=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,L)||""}else{var M=this._parts.hostname.length-this.domain().length,V=this._parts.hostname.substring(0,M),k=new RegExp("^"+f(V));if(m&&m.charAt(m.length-1)!=="."&&(m+="."),m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return m&&s.ensureValidHostname(m,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(k,m),this.build(!D),this}},c.domain=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(D=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var L=this._parts.hostname.match(/\./g);if(L&&L.length<2)return this._parts.hostname;var M=this._parts.hostname.length-this.tld(D).length-1;return M=this._parts.hostname.lastIndexOf(".",M-1)+1,this._parts.hostname.substring(M)||""}else{if(!m)throw new TypeError("cannot set domain empty");if(m.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");if(s.ensureValidHostname(m,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=m;else{var V=new RegExp(f(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(V,m)}return this.build(!D),this}},c.tld=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(typeof m=="boolean"&&(D=m,m=void 0),m===void 0){if(!this._parts.hostname||this.is("IP"))return"";var L=this._parts.hostname.lastIndexOf("."),M=this._parts.hostname.substring(L+1);return D!==!0&&i&&i.list[M.toLowerCase()]&&i.get(this._parts.hostname)||M}else{var V;if(m)if(m.match(/[^a-zA-Z0-9-]/))if(i&&i.is(m))V=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,m);else throw new TypeError('TLD "'+m+'" 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(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(V,m)}else throw new TypeError("cannot set TLD empty");return this.build(!D),this}},c.directory=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var L=this._parts.path.length-this.filename().length-1,M=this._parts.path.substring(0,L)||(this._parts.hostname?"/":"");return m?s.decodePath(M):M}else{var V=this._parts.path.length-this.filename().length,k=this._parts.path.substring(0,V),W=new RegExp("^"+f(k));return this.is("relative")||(m||(m="/"),m.charAt(0)!=="/"&&(m="/"+m)),m&&m.charAt(m.length-1)!=="/"&&(m+="/"),m=s.recodePath(m),this._parts.path=this._parts.path.replace(W,m),this.build(!D),this}},c.filename=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(typeof m!="string"){if(!this._parts.path||this._parts.path==="/")return"";var L=this._parts.path.lastIndexOf("/"),M=this._parts.path.substring(L+1);return m?s.decodePathSegment(M):M}else{var V=!1;m.charAt(0)==="/"&&(m=m.substring(1)),m.match(/\.?\//)&&(V=!0);var k=new RegExp(f(this.filename())+"$");return m=s.recodePath(m),this._parts.path=this._parts.path.replace(k,m),V?this.normalizePath(D):this.build(!D),this}},c.suffix=function(m,D){if(this._parts.urn)return m===void 0?"":this;if(m===void 0||m===!0){if(!this._parts.path||this._parts.path==="/")return"";var L=this.filename(),M=L.lastIndexOf("."),V,k;return M===-1?"":(V=L.substring(M+1),k=/^[a-z0-9%]+$/i.test(V)?V:"",m?s.decodePathSegment(k):k)}else{m.charAt(0)==="."&&(m=m.substring(1));var W=this.suffix(),G;if(W)m?G=new RegExp(f(W)+"$"):G=new RegExp(f("."+W)+"$");else{if(!m)return this;this._parts.path+="."+s.recodePath(m)}return G&&(m=s.recodePath(m),this._parts.path=this._parts.path.replace(G,m)),this.build(!D),this}},c.segment=function(m,D,L){var M=this._parts.urn?":":"/",V=this.path(),k=V.substring(0,1)==="/",W=V.split(M);if(m!==void 0&&typeof m!="number"&&(L=D,D=m,m=void 0),m!==void 0&&typeof m!="number")throw new Error('Bad segment "'+m+'", must be 0-based integer');if(k&&W.shift(),m<0&&(m=Math.max(W.length+m,0)),D===void 0)return m===void 0?W:W[m];if(m===null||W[m]===void 0)if(_(D)){W=[];for(var G=0,K=D.length;G<K;G++)!D[G].length&&(!W.length||!W[W.length-1].length)||(W.length&&!W[W.length-1].length&&W.pop(),W.push(C(D[G])))}else(D||typeof D=="string")&&(D=C(D),W[W.length-1]===""?W[W.length-1]=D:W.push(D));else D?W[m]=C(D):W.splice(m,1);return k&&W.unshift(""),this.path(W.join(M),L)},c.segmentCoded=function(m,D,L){var M,V,k;if(typeof m!="number"&&(L=D,D=m,m=void 0),D===void 0){if(M=this.segment(m,D,L),!_(M))M=M!==void 0?s.decode(M):void 0;else for(V=0,k=M.length;V<k;V++)M[V]=s.decode(M[V]);return M}if(!_(D))D=typeof D=="string"||D instanceof String?s.encode(D):D;else for(V=0,k=D.length;V<k;V++)D[V]=s.encode(D[V]);return this.segment(m,D,L)};var I=c.query;return c.query=function(m,D){if(m===!0)return s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="function"){var L=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace),M=m.call(this,L);return this._parts.query=s.buildQuery(M||L,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!D),this}else return m!==void 0&&typeof m!="string"?(this._parts.query=s.buildQuery(m,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!D),this):I.call(this,m,D)},c.setQuery=function(m,D,L){var M=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if(typeof m=="string"||m instanceof String)M[m]=D!==void 0?D:null;else if(typeof m=="object")for(var V in m)u.call(m,V)&&(M[V]=m[V]);else throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");return this._parts.query=s.buildQuery(M,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(L=D),this.build(!L),this},c.addQuery=function(m,D,L){var M=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.addQuery(M,m,D===void 0?null:D),this._parts.query=s.buildQuery(M,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(L=D),this.build(!L),this},c.removeQuery=function(m,D,L){var M=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.removeQuery(M,m,D),this._parts.query=s.buildQuery(M,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),typeof m!="string"&&(L=D),this.build(!L),this},c.hasQuery=function(m,D,L){var M=s.parseQuery(this._parts.query,this._parts.escapeQuerySpace);return s.hasQuery(M,m,D,L)},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(m){return typeof this._parts.protocol=="string"&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!m)),this},c.normalizeHostname=function(m){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(!m)),this},c.normalizePort=function(m){return typeof this._parts.protocol=="string"&&this._parts.port===s.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!m)),this},c.normalizePath=function(m){var D=this._parts.path;if(!D)return this;if(this._parts.urn)return this._parts.path=s.recodeUrnPath(this._parts.path),this.build(!m),this;if(this._parts.path==="/")return this;D=s.recodePath(D);var L,M="",V,k;for(D.charAt(0)!=="/"&&(L=!0,D="/"+D),(D.slice(-3)==="/.."||D.slice(-2)==="/.")&&(D+="/"),D=D.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),L&&(M=D.substring(1).match(/^(\.\.\/)+/)||"",M&&(M=M[0]));V=D.search(/\/\.\.(\/|$)/),V!==-1;){if(V===0){D=D.substring(3);continue}k=D.substring(0,V).lastIndexOf("/"),k===-1&&(k=V),D=D.substring(0,k)+D.substring(V+3)}return L&&this.is("relative")&&(D=M+D.substring(1)),this._parts.path=D,this.build(!m),this},c.normalizePathname=c.normalizePath,c.normalizeQuery=function(m){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(!m)),this},c.normalizeFragment=function(m){return this._parts.fragment||(this._parts.fragment=null,this.build(!m)),this},c.normalizeSearch=c.normalizeQuery,c.normalizeHash=c.normalizeFragment,c.iso8859=function(){var m=s.encode,D=s.decode;s.encode=escape,s.decode=decodeURIComponent;try{this.normalize()}finally{s.encode=m,s.decode=D}return this},c.unicode=function(){var m=s.encode,D=s.decode;s.encode=E,s.decode=unescape;try{this.normalize()}finally{s.encode=m,s.decode=D}return this},c.readable=function(){var m=this.clone();m.username("").password("").normalize();var D="";if(m._parts.protocol&&(D+=m._parts.protocol+"://"),m._parts.hostname&&(m.is("punycode")&&t?(D+=t.toUnicode(m._parts.hostname),m._parts.port&&(D+=":"+m._parts.port)):D+=m.host()),m._parts.hostname&&m._parts.path&&m._parts.path.charAt(0)!=="/"&&(D+="/"),D+=m.path(!0),m._parts.query){for(var L="",M=0,V=m._parts.query.split("&"),k=V.length;M<k;M++){var W=(V[M]||"").split("=");L+="&"+s.decodeQuery(W[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"),W[1]!==void 0&&(L+="="+s.decodeQuery(W[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}D+="?"+L.substring(1)}return D+=s.decodeQuery(m.hash(),!0),D},c.absoluteTo=function(m){var D=this.clone(),L=["protocol","username","password","hostname","port"],M,V,k;if(this._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m instanceof s||(m=new s(m)),D._parts.protocol||(D._parts.protocol=m._parts.protocol,this._parts.hostname))return D;for(V=0;k=L[V];V++)D._parts[k]=m._parts[k];return D._parts.path?(D._parts.path.substring(-2)===".."&&(D._parts.path+="/"),D.path().charAt(0)!=="/"&&(M=m.directory(),M=M||(m.path().indexOf("/")===0?"/":""),D._parts.path=(M?M+"/":"")+D._parts.path,D.normalizePath())):(D._parts.path=m._parts.path,D._parts.query||(D._parts.query=m._parts.query)),D.build(),D},c.relativeTo=function(m){var D=this.clone().normalize(),L,M,V,k,W;if(D._parts.urn)throw new Error("URNs do not have any generally defined hierarchical components");if(m=new s(m).normalize(),L=D._parts,M=m._parts,k=D.path(),W=m.path(),k.charAt(0)!=="/")throw new Error("URI is already relative");if(W.charAt(0)!=="/")throw new Error("Cannot calculate a URI relative to another relative URI");if(L.protocol===M.protocol&&(L.protocol=null),L.username!==M.username||L.password!==M.password||L.protocol!==null||L.username!==null||L.password!==null)return D.build();if(L.hostname===M.hostname&&L.port===M.port)L.hostname=null,L.port=null;else return D.build();if(k===W)return L.path="",D.build();if(V=s.commonPath(k,W),!V)return D.build();var G=M.path.substring(V.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../");return L.path=G+L.path.substring(V.length)||"./",D.build()},c.equals=function(m){var D=this.clone(),L=new s(m),M={},V={},k={},W,G,K;if(D.normalize(),L.normalize(),D.toString()===L.toString())return!0;if(W=D.query(),G=L.query(),D.query(""),L.query(""),D.toString()!==L.toString()||W.length!==G.length)return!1;M=s.parseQuery(W,this._parts.escapeQuerySpace),V=s.parseQuery(G,this._parts.escapeQuerySpace);for(K in M)if(u.call(M,K)){if(_(M[K])){if(!y(M[K],V[K]))return!1}else if(M[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(m){return this._parts.preventInvalidHostname=!!m,this},c.duplicateQueryParameters=function(m){return this._parts.duplicateQueryParameters=!!m,this},c.escapeQuerySpace=function(m){return this._parts.escapeQuerySpace=!!m,this},s})})(Khe);const Ts=_L;function ipe(e){return(e.length===0||e[e.length-1]!=="/")&&(e=`${e}/`),e}function ut(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=ut(o,t)),n[i]=o}return n}function sn(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]=sn(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 Ep(){let e,t;const n=new Promise(function(i,o){e=i,t=o});return{resolve:e,reject:t,promise:n}}function PT(e,t){let n;return typeof document<"u"&&(n=document),PT._implementation(e,t,n)}PT._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 Ts(e);return i.scheme()!==""?i.toString():i.absoluteTo(t).toString()};function ope(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 Ts(e),e.query().length!==0&&(n+=`?${e.query()}`),e.fragment().length!==0&&(n+=`#${e.fragment()}`)),n}function rpe(e){if(!l(e))throw new x("uri is required.");const t=new Ts(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 pz={};function oS(e,t,n){l(t)||(t=e.width),l(n)||(n=e.height);let i=pz[t];l(i)||(i={},pz[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 spe=/^blob:/i;function DW(e){return b.typeOf.string("uri",e),spe.test(e)}let Au;function IW(e){l(Au)||(Au=document.createElement("a")),Au.href=window.location.href;const t=Au.host,n=Au.protocol;return Au.href=e,Au.href=Au.href,n!==Au.protocol||t!==Au.host}const ape=/^data:/i;function pN(e){return b.typeOf.string("uri",e),ape.test(e)}function cpe(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 lpe(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 upe(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 fpe={UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5},yo=Object.freeze(fpe),dpe={TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3},C_=Object.freeze(dpe);function ju(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,C_.OTHER),this.serverKey=void 0,this.state=yo.UNISSUED,this.deferred=void 0,this.cancelled=!1}ju.prototype.cancel=function(){this.cancelled=!0};ju.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 ju(this)};function hpe(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 By(e,t,n){this.statusCode=e,this.response=t,this.responseHeaders=n,typeof this.responseHeaders=="string"&&(this.responseHeaders=hpe(this.responseHeaders))}By.prototype.toString=function(){let e="Request has failed.";return l(this.statusCode)&&(e+=` Status Code: ${this.statusCode}`),e};function $e(){this._listeners=[],this._scopes=[],this._toRemove=[],this._insideRaiseEvent=!1}Object.defineProperties($e.prototype,{numberOfListeners:{get:function(){return this._listeners.length-this._toRemove.length}}});$e.prototype.addEventListener=function(e,t){b.typeOf.func("listener",e),this._listeners.push(e),this._scopes.push(t);const n=this;return function(){n.removeEventListener(e,t)}};$e.prototype.removeEventListener=function(e,t){b.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 ppe(e,t){return t-e}$e.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(ppe),e=0;e<i;e++){const r=o[e];t.splice(r,1),n.splice(r,1)}o.length=0}this._insideRaiseEvent=!1};function T_(e){b.typeOf.object("options",e),b.defined("options.comparator",e.comparator),this._comparator=e.comparator,this._array=[],this._length=0,this._maximumLength=void 0}Object.defineProperties(T_.prototype,{length:{get:function(){return this._length}},internalArray:{get:function(){return this._array}},maximumLength:{get:function(){return this._maximumLength},set:function(e){b.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 mN(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}T_.prototype.reserve=function(e){e=A(e,this._length),this._array.length=e};T_.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?(mN(i,o,e),e=o):r=!1}};T_.prototype.resort=function(){const e=this._length;for(let t=Math.ceil(e/2);t>=0;--t)this.heapify(t)};T_.prototype.insert=function(e){b.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)mN(t,o,s),o=s;else break}let r;return l(i)&&this._length>i&&(r=t[i],this._length=i),r};T_.prototype.pop=function(e){if(e=A(e,0),this._length===0)return;b.typeOf.number.lessThan("index",e,this._length);const t=this._array,n=t[e];return mN(t,e,--this._length),this.heapify(e),t[this._length]=void 0,n};function mpe(e,t){return e.priority-t.priority}const di={numberOfAttemptedRequests:0,numberOfActiveRequests:0,numberOfCancelledRequests:0,numberOfCancelledActiveRequests:0,numberOfFailedRequests:0,numberOfActiveRequestsEver:0,lastNumberOfActiveRequests:0};let ry=20;const Hs=new T_({comparator:mpe});Hs.maximumLength=ry;Hs.reserve(ry);const Lu=[];let fd={};const _pe=typeof document<"u"?new Ts(document.location.href):new Ts,Tv=new $e;function ci(){}ci.maximumRequests=50;ci.maximumRequestsPerServer=6;ci.requestsByServer={"api.cesium.com:443":18,"assets.cesium.com:443":18};ci.throttleRequests=!0;ci.debugShowStatistics=!1;ci.requestCompletedEvent=Tv;Object.defineProperties(ci,{statistics:{get:function(){return di}},priorityHeapLength:{get:function(){return ry},set:function(e){if(e<ry)for(;Hs.length>e;){const t=Hs.pop();Mm(t)}ry=e,Hs.maximumLength=e,Hs.reserve(e)}}});function PW(e){l(e.priorityFunction)&&(e.priority=e.priorityFunction())}ci.serverHasOpenSlots=function(e,t){t=A(t,1);const n=A(ci.requestsByServer[e],ci.maximumRequestsPerServer);return fd[e]+t<=n};ci.heapHasOpenSlots=function(e){return Hs.length+e<=ry};function OW(e){return e.state===yo.UNISSUED&&(e.state=yo.ISSUED,e.deferred=Ep()),e.deferred.promise}function gpe(e){return function(t){if(e.state===yo.CANCELLED)return;const n=e.deferred;--di.numberOfActiveRequests,--fd[e.serverKey],Tv.raiseEvent(),e.state=yo.RECEIVED,e.deferred=void 0,n.resolve(t)}}function ype(e){return function(t){e.state!==yo.CANCELLED&&(++di.numberOfFailedRequests,--di.numberOfActiveRequests,--fd[e.serverKey],Tv.raiseEvent(t),e.state=yo.FAILED,e.deferred.reject(t))}}function LW(e){const t=OW(e);return e.state=yo.ACTIVE,Lu.push(e),++di.numberOfActiveRequests,++di.numberOfActiveRequestsEver,++fd[e.serverKey],e.requestFunction().then(gpe(e)).catch(ype(e)),t}function Mm(e){const t=e.state===yo.ACTIVE;if(e.state=yo.CANCELLED,++di.numberOfCancelledRequests,l(e.deferred)){const n=e.deferred;e.deferred=void 0,n.reject()}t&&(--di.numberOfActiveRequests,--fd[e.serverKey],++di.numberOfCancelledActiveRequests),l(e.cancelFunction)&&e.cancelFunction()}ci.update=function(){let e,t,n=0;const i=Lu.length;for(e=0;e<i;++e){if(t=Lu[e],t.cancelled&&Mm(t),t.state!==yo.ACTIVE){++n;continue}n>0&&(Lu[e-n]=t)}Lu.length-=n;const o=Hs.internalArray,r=Hs.length;for(e=0;e<r;++e)PW(o[e]);Hs.resort();const s=Math.max(ci.maximumRequests-Lu.length,0);let a=0;for(;a<s&&Hs.length>0;){if(t=Hs.pop(),t.cancelled){Mm(t);continue}if(t.throttleByServer&&!ci.serverHasOpenSlots(t.serverKey)){Mm(t);continue}LW(t),++a}Ape()};ci.getServerKey=function(e){b.typeOf.string("url",e);let t=new Ts(e);t.scheme()===""&&(t=new Ts(e).absoluteTo(_pe),t.normalize());let n=t.authority();/:/.test(n)||(n=`${n}:${t.scheme()==="https"?"443":"80"}`);const i=fd[n];return l(i)||(fd[n]=0),n};ci.request=function(e){if(b.typeOf.object("request",e),b.typeOf.string("request.url",e.url),b.typeOf.func("request.requestFunction",e.requestFunction),pN(e.url)||DW(e.url))return Tv.raiseEvent(),e.state=yo.RECEIVED,e.requestFunction();if(++di.numberOfAttemptedRequests,l(e.serverKey)||(e.serverKey=ci.getServerKey(e.url)),ci.throttleRequests&&e.throttleByServer&&!ci.serverHasOpenSlots(e.serverKey))return;if(!ci.throttleRequests||!e.throttle)return LW(e);if(Lu.length>=ci.maximumRequests)return;PW(e);const t=Hs.insert(e);if(l(t)){if(t===e)return;Mm(t)}return OW(e)};function Ape(){ci.debugShowStatistics&&(di.numberOfActiveRequests===0&&di.lastNumberOfActiveRequests>0&&(di.numberOfAttemptedRequests>0&&(console.log(`Number of attempted requests: ${di.numberOfAttemptedRequests}`),di.numberOfAttemptedRequests=0),di.numberOfCancelledRequests>0&&(console.log(`Number of cancelled requests: ${di.numberOfCancelledRequests}`),di.numberOfCancelledRequests=0),di.numberOfCancelledActiveRequests>0&&(console.log(`Number of cancelled active requests: ${di.numberOfCancelledActiveRequests}`),di.numberOfCancelledActiveRequests=0),di.numberOfFailedRequests>0&&(console.log(`Number of failed requests: ${di.numberOfFailedRequests}`),di.numberOfFailedRequests=0)),di.lastNumberOfActiveRequests=di.numberOfActiveRequests)}ci.clearForSpecs=function(){for(;Hs.length>0;){const t=Hs.pop();Mm(t)}const e=Lu.length;for(let t=0;t<e;++t)Mm(Lu[t]);Lu.length=0,fd={},di.numberOfAttemptedRequests=0,di.numberOfActiveRequests=0,di.numberOfCancelledRequests=0,di.numberOfCancelledActiveRequests=0,di.numberOfFailedRequests=0,di.numberOfActiveRequestsEver=0,di.lastNumberOfActiveRequests=0};ci.numberOfActiveRequestsByServer=function(e){return fd[e]};ci.requestHeap=Hs;const OT={};let Ry={};OT.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(Ry[n])||(Ry[n]=!0)};OT.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(Ry[n])&&delete Ry[n]};function Cpe(e){const t=new Ts(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}}OT.contains=function(e){if(!l(e))throw new x("url is required.");const t=Cpe(e);return!!(l(t)&&l(Ry[t]))};OT.clear=function(){Ry={}};const BW=OT,RW=function(){try{const e=new XMLHttpRequest;return e.open("GET","#",!0),e.responseType="blob",e.responseType==="blob"}catch{return!1}}();function _N(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=upe(o);n?t._queryParameters=rS(r,t._queryParameters,i):t._queryParameters=r,e.search("")}function Tpe(e,t){const n=t._queryParameters,i=Object.keys(n);i.length===1&&!l(n[i[0]])?e.search(i[0]):e.search(lpe(n))}function Fu(e,t){return l(e)?l(e.clone)?e.clone():ut(e):t}function gN(e){if(e.state===yo.ISSUED||e.state===yo.ACTIVE)throw new Se("The Resource is already being fetched.");e.state=yo.UNISSUED,e.deferred=void 0}function rS(e,t,n){if(!n)return sn(e,t);const i=ut(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 Re(e){e=A(e,A.EMPTY_OBJECT),typeof e=="string"&&(e={url:e}),b.typeOf.string("options.url",e.url),this._url=void 0,this._templateValues=Fu(e.templateValues,{}),this._queryParameters=Fu(e.queryParameters,{}),this.headers=Fu(e.headers,{}),this.request=A(e.request,new ju),this.proxy=e.proxy,this.retryCallback=e.retryCallback,this.retryAttempts=A(e.retryAttempts,0),this._retryCount=0;const t=new Ts(e.url);_N(t,this,!0,!0),t.fragment(""),this._url=t.toString()}Re.createIfNeeded=function(e){return e instanceof Re?e.getDerivedResource({request:e.request}):typeof e!="string"?e:new Re({url:e})};let Q_;Re.supportsImageBitmapOptions=function(){if(l(Q_))return Q_;if(typeof createImageBitmap!="function")return Q_=Promise.resolve(!1),Q_;const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";return Q_=Re.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=oS(t[0]),i=oS(t[1]);return n[1]!==i[1]}).catch(function(){return!1}),Q_};Object.defineProperties(Re,{isBlobSupported:{get:function(){return RW}}});Object.defineProperties(Re.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 Ts(e);_N(t,this,!1),t.fragment(""),this._url=t.toString()}},extension:{get:function(){return rpe(this._url)}},isDataUri:{get:function(){return pN(this._url)}},isBlobUri:{get:function(){return DW(this._url)}},isCrossOriginUrl:{get:function(){return IW(this._url)}},hasHeaders:{get:function(){return Object.keys(this.headers).length>0}}});Re.prototype.toString=function(){return this.getUrlComponent(!0,!0)};Re.prototype.getUrlComponent=function(e,t){if(this.isDataUri)return this._url;const n=new Ts(this._url);e&&Tpe(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};Re.prototype.setQueryParameters=function(e,t){t?this._queryParameters=rS(this._queryParameters,e,!1):this._queryParameters=rS(e,this._queryParameters,!1)};Re.prototype.appendQueryParameters=function(e){this._queryParameters=rS(e,this._queryParameters,!0)};Re.prototype.setTemplateValues=function(e,t){t?this._templateValues=sn(this._templateValues,e):this._templateValues=sn(e,this._templateValues)};Re.prototype.getDerivedResource=function(e){const t=this.clone();if(t._retryCount=0,l(e.url)){const n=new Ts(e.url),i=A(e.preserveQueryParameters,!1);_N(n,t,!0,i),n.fragment(""),n.scheme()!==""?t._url=n.toString():t._url=n.absoluteTo(new Ts(PT(this._url))).toString()}return l(e.queryParameters)&&(t._queryParameters=sn(e.queryParameters,t._queryParameters)),l(e.templateValues)&&(t._templateValues=sn(e.templateValues,t.templateValues)),l(e.headers)&&(t.headers=sn(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};Re.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})};Re.prototype.clone=function(e){return l(e)||(e=new Re({url:this._url})),e._url=this._url,e._queryParameters=ut(this._queryParameters),e._templateValues=ut(this._templateValues),e.headers=ut(this.headers),e.proxy=this.proxy,e.retryCallback=this.retryCallback,e.retryAttempts=this.retryAttempts,e._retryCount=0,e.request=this.request.clone(),e};Re.prototype.getBaseUri=function(e){return ope(this.getUrlComponent(e),e)};Re.prototype.appendForwardSlash=function(){this._url=ipe(this._url)};Re.prototype.fetchArrayBuffer=function(){return this.fetch({responseType:"arraybuffer"})};Re.fetchArrayBuffer=function(e){return new Re(e).fetchArrayBuffer()};Re.prototype.fetchBlob=function(){return this.fetch({responseType:"blob"})};Re.fetchBlob=function(e){return new Re(e).fetchBlob()};Re.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(gN(this.request),!RW||this.isDataUri||this.isBlobUri||!this.hasHeaders&&!n)return gL({resource:this,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:t});const r=this.fetchBlob();if(!l(r))return;let s,a,c,u;return Re.supportsImageBitmapOptions().then(function(f){return s=f,a=s&&t,r}).then(function(f){if(!l(f))return;if(u=f,a)return Re.createImageBitmapFromBlob(f,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o});const h=window.URL.createObjectURL(f);return c=new Re({url:h}),gL({resource:c,flipY:i,skipColorSpaceConversion:o,preferImageBitmap:!1})}).then(function(f){if(l(f))return f.blob=u,a||window.URL.revokeObjectURL(c.url),f}).catch(function(f){return l(c)&&window.URL.revokeObjectURL(c.url),f.blob=u,Promise.reject(f)})};function gL(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=Ep();return Re._Implementations.createImage(r,a,c,n,i,o),c.promise};const s=ci.request(r);if(l(s))return s.catch(function(a){return r.state!==yo.FAILED?Promise.reject(a):t.retryOnError(a).then(function(c){return c?(r.state=yo.UNISSUED,r.deferred=void 0,gL({resource:t,flipY:n,skipColorSpaceConversion:i,preferImageBitmap:o})):Promise.reject(a)})})}Re.fetchImage=function(e){return new Re(e).fetchImage({flipY:e.flipY,skipColorSpaceConversion:e.skipColorSpaceConversion,preferBlob:e.preferBlob,preferImageBitmap:e.preferImageBitmap})};Re.prototype.fetchText=function(){return this.fetch({responseType:"text"})};Re.fetchText=function(e){return new Re(e).fetchText()};Re.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)})};Re.fetchJson=function(e){return new Re(e).fetchJson()};Re.prototype.fetchXML=function(){return this.fetch({responseType:"document",overrideMimeType:"text/xml"})};Re.fetchXML=function(e){return new Re(e).fetchXML()};Re.prototype.fetchJsonp=function(e){e=A(e,"callback"),gN(this.request);let t;do t=`loadJsonp${N.nextRandomNumber().toString().substring(2,8)}`;while(l(window[t]));return NW(this,e,t)};function NW(e,t,n){const i={};i[t]=n,e.setQueryParameters(i);const o=e.request;o.url=e.url,o.requestFunction=function(){const s=Ep();return window[n]=function(a){s.resolve(a);try{delete window[n]}catch{window[n]=void 0}},Re._Implementations.loadAndExecuteScript(e.url,n,s),s.promise};const r=ci.request(o);if(l(r))return r.catch(function(s){return o.state!==yo.FAILED?Promise.reject(s):e.retryOnError(s).then(function(a){return a?(o.state=yo.UNISSUED,o.deferred=void 0,NW(e,t,n)):Promise.reject(s)})})}Re.fetchJsonp=function(e){return new Re(e).fetchJsonp(e.callbackParameterName)};Re.prototype._makeRequest=function(e){const t=this;gN(t.request);const n=t.request;n.url=t.url,n.requestFunction=function(){const o=e.responseType,r=sn(e.headers,t.headers),s=e.overrideMimeType,a=e.method,c=e.data,u=Ep(),f=Re._Implementations.loadWithXhr(t.url,o,a,c,r,u,s);return l(f)&&l(f.abort)&&(n.cancelFunction=function(){f.abort()}),u.promise};const i=ci.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!==yo.FAILED?Promise.reject(o):t.retryOnError(o).then(function(r){return r?(n.state=yo.UNISSUED,n.deferred=void 0,t.fetch(e)):Promise.reject(o)})})};const bpe=/^data:(.*?)(;base64)?,(.*)$/;function Kx(e,t){const n=decodeURIComponent(t);return e?atob(n):n}function mz(e,t){const n=Kx(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 Epe(e,t){t=A(t,"");const n=e[1],i=!!e[2],o=e[3];let r,s;switch(t){case"":case"text":return Kx(i,o);case"arraybuffer":return mz(i,o);case"blob":return r=mz(i,o),new Blob([r],{type:n});case"document":return s=new DOMParser,s.parseFromString(Kx(i,o),n);case"json":return JSON.parse(Kx(i,o));default:throw new x(`Unhandled responseType: ${t}`)}}Re.prototype.fetch=function(e){return e=Fu(e,{}),e.method="GET",this._makeRequest(e)};Re.fetch=function(e){return new Re(e).fetch({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re.prototype.delete=function(e){return e=Fu(e,{}),e.method="DELETE",this._makeRequest(e)};Re.delete=function(e){return new Re(e).delete({responseType:e.responseType,overrideMimeType:e.overrideMimeType,data:e.data})};Re.prototype.head=function(e){return e=Fu(e,{}),e.method="HEAD",this._makeRequest(e)};Re.head=function(e){return new Re(e).head({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re.prototype.options=function(e){return e=Fu(e,{}),e.method="OPTIONS",this._makeRequest(e)};Re.options=function(e){return new Re(e).options({responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re.prototype.post=function(e,t){return b.defined("data",e),t=Fu(t,{}),t.method="POST",t.data=e,this._makeRequest(t)};Re.post=function(e){return new Re(e).post(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re.prototype.put=function(e,t){return b.defined("data",e),t=Fu(t,{}),t.method="PUT",t.data=e,this._makeRequest(t)};Re.put=function(e){return new Re(e).put(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re.prototype.patch=function(e,t){return b.defined("data",e),t=Fu(t,{}),t.method="PATCH",t.data=e,this._makeRequest(t)};Re.patch=function(e){return new Re(e).patch(e.data,{responseType:e.responseType,overrideMimeType:e.overrideMimeType})};Re._Implementations={};Re._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&&(BW.contains(e)?i.crossOrigin="use-credentials":i.crossOrigin=""),i.src=e};Re._Implementations.createImage=function(e,t,n,i,o,r){const s=e.url;Re.supportsImageBitmapOptions().then(function(a){if(!(a&&r)){Re._Implementations.loadImageElement(s,t,n);return}const c="blob",u="GET",f=Ep(),h=Re._Implementations.loadWithXhr(s,c,u,void 0,void 0,f,void 0,void 0,void 0);return l(h)&&l(h.abort)&&(e.cancelFunction=function(){h.abort()}),f.promise.then(function(_){if(!l(_)){n.reject(new Se(`Successfully retrieved ${s} but it contained no content.`));return}return Re.createImageBitmapFromBlob(_,{flipY:i,premultiplyAlpha:!1,skipColorSpaceConversion:o})}).then(function(_){n.resolve(_)})}).catch(function(a){n.reject(a)})};Re.createImageBitmapFromBlob=function(e,t){return b.defined("options",t),b.typeOf.bool("options.flipY",t.flipY),b.typeOf.bool("options.premultiplyAlpha",t.premultiplyAlpha),b.typeOf.bool("options.skipColorSpaceConversion",t.skipColorSpaceConversion),createImageBitmap(e,{imageOrientation:t.flipY?"flipY":"none",premultiplyAlpha:t.premultiplyAlpha?"premultiply":"none",colorSpaceConversion:t.skipColorSpaceConversion?"none":"default"})};function _z(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 xpe(e,t,n,i,o,r,s){let a,c;Promise.all([Zb(()=>import("./__vite-browser-external-b25bb000.js"),[]),Zb(()=>import("./__vite-browser-external-b25bb000.js"),[])]).then(([u,f])=>(a=u.parse(e),c=f,a.protocol==="https:"?Zb(()=>import("./__vite-browser-external-b25bb000.js"),[]):Zb(()=>import("./__vite-browser-external-b25bb000.js"),[]))).then(u=>{const f={protocol:a.protocol,hostname:a.hostname,port:a.port,path:a.path,query:a.query,method:n,headers:o};u.request(f).on("response",function(h){if(h.statusCode<200||h.statusCode>=300){r.reject(new By(h.statusCode,h,h.headers));return}const _=[];h.on("data",function(g){_.push(g)}),h.on("end",function(){const g=Buffer.concat(_);h.headers["content-encoding"]==="gzip"?c.gunzip(g,function(p,y){p?r.reject(new Se("Error decompressing response.")):r.resolve(_z(y,t))}):r.resolve(_z(g,t))})}).on("error",function(h){r.reject(new By)}).end()})}const wpe=typeof XMLHttpRequest>"u";Re._Implementations.loadWithXhr=function(e,t,n,i,o,r,s){const a=bpe.exec(e);if(a!==null){r.resolve(Epe(a,t));return}if(wpe){xpe(e,t,n,i,o,r);return}const c=new XMLHttpRequest;if(BW.contains(e)&&(c.withCredentials=!0),c.open(n,e,!0),l(s)&&l(c.overrideMimeType)&&c.overrideMimeType(s),l(o))for(const f in o)o.hasOwnProperty(f)&&c.setRequestHeader(f,o[f]);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 By(c.status,c.response,c.getAllResponseHeaders()));return}const f=c.response,h=c.responseType;if(n==="HEAD"||n==="OPTIONS"){const g=c.getAllResponseHeaders().trim().split(/[\r\n]+/),p={};g.forEach(function(y){const C=y.split(": "),T=C.shift();p[T]=C.join(": ")}),r.resolve(p);return}if(c.status===204)r.resolve();else if(l(f)&&(!l(t)||h===t))r.resolve(f);else if(t==="json"&&typeof f=="string")try{r.resolve(JSON.parse(f))}catch(_){r.reject(_)}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 Se("Invalid XMLHttpRequest response type."))},c.onerror=function(f){r.reject(new By)},c.send(i),c};Re._Implementations.loadAndExecuteScript=function(e,t,n){return cpe(e).catch(function(i){n.reject(i)})};Re._DefaultImplementations={};Re._DefaultImplementations.createImage=Re._Implementations.createImage;Re._DefaultImplementations.loadWithXhr=Re._Implementations.loadWithXhr;Re._DefaultImplementations.loadAndExecuteScript=Re._Implementations.loadAndExecuteScript;Re.DEFAULT=Object.freeze(new Re({url:typeof document>"u"?"":document.location.href.split("?")[0]}));function FC(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)?gz(this,e.data):gz(this,{columnNames:["dateIso8601","modifiedJulianDateUtc","xPoleWanderRadians","yPoleWanderRadians","ut1MinusUtcSeconds","lengthOfDayCorrectionSeconds","xCelestialPoleOffsetRadians","yCelestialPoleOffsetRadians","taiMinusUtcSeconds"],samples:[]})}FC.fromUrl=async function(e,t){b.defined("url",e),t=A(t,A.EMPTY_OBJECT);const n=Re.createIfNeeded(e);let i;try{i=await n.fetchJson()}catch{throw new Se(`An error occurred while retrieving the EOP data from the URL ${n.url}.`)}return new FC({addNewLeapSeconds:t.addNewLeapSeconds,data:i})};FC.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 uN(0,0,0,0,0),t}});FC.prototype.compute=function(e,t){if(!l(this._samples))return;if(l(t)||(t=new uN(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=ne.lessThanOrEquals(a,e),f=!l(c),h=f||ne.greaterThanOrEquals(c,e);if(u&&h)return o=i,!f&&c.equals(e)&&++o,r=o+1,Az(this,n,this._samples,e,o,r,t),t}let s=Cs(n,e,ne.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,Az(this,n,this._samples,e,o,r,t),t};function Spe(e,t){return ne.compare(e.julianDate,t)}function gz(e,t){if(!l(t.columnNames))throw new Se("Error in loaded EOP data: The columnNames property is required.");if(!l(t.samples))throw new Se("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 Se("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,f=e._dates=[];e._dateColumn=n,e._xPoleWanderRadiansColumn=i,e._yPoleWanderRadiansColumn=o,e._ut1MinusUtcSecondsColumn=r,e._xCelestialPoleOffsetRadiansColumn=s,e._yCelestialPoleOffsetRadiansColumn=a,e._taiMinusUtcSecondsColumn=c,e._columnCount=t.columnNames.length,e._lastIndex=void 0;let h;const _=e._addNewLeapSeconds;for(let g=0,p=u.length;g<p;g+=e._columnCount){const y=u[g+n],C=u[g+c],T=y+Ti.MODIFIED_JULIAN_DATE_DIFFERENCE,E=new ne(T,C,zn.TAI);if(f.push(E),_){if(C!==h&&l(h)){const w=ne.leapSeconds,S=Cs(w,E,Spe);if(S<0){const P=new Bi(E,C);w.splice(~S,0,P)}}h=C}}}function yz(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 R0(e,t,n){return t+e*(n-t)}function Az(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 yz(e,n,o,a,s),s;if(i.equals(u))return yz(e,n,r,a,s),s;const f=ne.secondsDifference(i,c)/ne.secondsDifference(u,c),h=o*a,_=r*a;let g=n[h+e._ut1MinusUtcSecondsColumn],p=n[_+e._ut1MinusUtcSecondsColumn];const y=p-g;if(y>.5||y<-.5){const C=n[h+e._taiMinusUtcSecondsColumn],T=n[_+e._taiMinusUtcSecondsColumn];C!==T&&(u.equals(i)?g=p:p-=T-C)}return s.xPoleWander=R0(f,n[h+e._xPoleWanderRadiansColumn],n[_+e._xPoleWanderRadiansColumn]),s.yPoleWander=R0(f,n[h+e._yPoleWanderRadiansColumn],n[_+e._yPoleWanderRadiansColumn]),s.xPoleOffset=R0(f,n[h+e._xCelestialPoleOffsetRadiansColumn],n[_+e._xCelestialPoleOffsetRadiansColumn]),s.yPoleOffset=R0(f,n[h+e._yCelestialPoleOffsetRadiansColumn],n[_+e._yCelestialPoleOffsetRadiansColumn]),s.ut1MinusUtc=R0(f,g,p),s}function Ur(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.roll=A(n,0)}Ur.fromQuaternion=function(e,t){if(!l(e))throw new x("quaternion is required");l(t)||(t=new Ur);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=-N.asinClamped(n),t};Ur.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 Ur),i.heading=e*N.RADIANS_PER_DEGREE,i.pitch=t*N.RADIANS_PER_DEGREE,i.roll=n*N.RADIANS_PER_DEGREE,i};Ur.clone=function(e,t){if(l(e))return l(t)?(t.heading=e.heading,t.pitch=e.pitch,t.roll=e.roll,t):new Ur(e.heading,e.pitch,e.roll)};Ur.equals=function(e,t){return e===t||l(e)&&l(t)&&e.heading===t.heading&&e.pitch===t.pitch&&e.roll===t.roll};Ur.equalsEpsilon=function(e,t,n,i){return e===t||l(e)&&l(t)&&N.equalsEpsilon(e.heading,t.heading,n,i)&&N.equalsEpsilon(e.pitch,t.pitch,n,i)&&N.equalsEpsilon(e.roll,t.roll,n,i)};Ur.prototype.clone=function(e){return Ur.clone(this,e)};Ur.prototype.equals=function(e){return Ur.equals(this,e)};Ur.prototype.equalsEpsilon=function(e,t,n){return Ur.equalsEpsilon(this,e,t,n)};Ur.prototype.toString=function(){return`(${this.heading}, ${this.pitch}, ${this.roll})`};const MW=/((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;function vpe(){const e=document.getElementsByTagName("script");for(let t=0,n=e.length;t<n;++t){const i=e[t].getAttribute("src"),o=MW.exec(i);if(o!==null)return o[1]}}let Z_;function FW(e){return typeof document>"u"?e:(l(Z_)||(Z_=document.createElement("a")),Z_.href=e,Z_.href=Z_.href,Z_.href)}let Tm;function zW(){if(l(Tm))return Tm;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=PT("..",dn("Core/buildModuleUrl.js")):e=vpe(),!l(e))throw new x("Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL.");return Tm=new Re({url:FW(e)}),Tm.appendForwardSlash(),Tm}function Dpe(e){return FW(require.toUrl(`../${e}`))}function UW(e){return zW().getDerivedResource({url:e}).url}let eE;function dn(e){return l(eE)||(typeof define=="object"&&l(define.amd)&&!define.amd.toUrlUndefined&&l(require.toUrl)?eE=Dpe:eE=UW),eE(e)}dn._cesiumScriptRegex=MW;dn._buildModuleUrlFromBaseUrl=UW;dn._clearBaseResource=function(){Tm=void 0};dn.setBaseUrl=function(e){Tm=Re.DEFAULT.getDerivedResource({url:e})};dn.getCesiumBaseUrl=zW;function HW(e,t,n){this.x=e,this.y=t,this.s=n}function yN(e){e=A(e,A.EMPTY_OBJECT),this._xysFileUrlTemplate=Re.createIfNeeded(e.xysFileUrlTemplate),this._interpolationOrder=A(e.interpolationOrder,9),this._sampleZeroJulianEphemerisDate=A(e.sampleZeroJulianEphemerisDate,24423965e-1),this._sampleZeroDateTT=new ne(this._sampleZeroJulianEphemerisDate,0,zn.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 Ipe=new ne(0,0,zn.TAI);function yL(e,t,n){const i=Ipe;return i.dayNumber=t,i.secondsOfDay=n,ne.daysDifference(i,e._sampleZeroDateTT)}yN.prototype.preload=function(e,t,n,i){const o=yL(this,e,t),r=yL(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,f=[];for(let h=c;h<=u;++h)f.push(AL(this,h));return Promise.all(f)};yN.prototype.computeXysRadians=function(e,t,n){const i=yL(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])||(AL(this,s/this._samplesPerXysFile|0),c=!0),l(u[a*3])||(AL(this,a/this._samplesPerXysFile|0),c=!0),c)return;l(n)?(n.x=0,n.y=0,n.s=0):n=new HW(0,0,0);const f=i-s*this._stepSizeDays,h=this._work,_=this._denominators,g=this._coef,p=this._xTable;let y,C;for(y=0;y<=r;++y)h[y]=f-p[y];for(y=0;y<=r;++y){for(g[y]=1,C=0;C<=r;++C)C!==y&&(g[y]*=h[C]);g[y]*=_[y];let T=(s+y)*3;n.x+=g[y]*u[T++],n.y+=g[y]*u[T++],n.s+=g[y]*u[T]}return n};function AL(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 Re({url:dn(`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,f=a.length;u<f;++u)s[c+u]=a[u]});return e._chunkDownloadsInProgress[t]=o,o}const li={},TI={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"}},eg={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},bI={},va={east:new d,north:new d,up:new d,west:new d,south:new d,down:new d};let Qd=new d,Zd=new d,eh=new d;li.localFrameToFixedFrameGenerator=function(e,t){if(!TI.hasOwnProperty(e)||!TI[e].hasOwnProperty(t))throw new x("firstAxis and secondAxis must be east, north, up, west, south or down.");const n=TI[e][t];let i;const o=e+t;return l(bI[o])?i=bI[o]:(i=function(r,s,a){if(!l(r))throw new x("origin is required.");if(l(a)||(a=new B),d.equalsEpsilon(r,d.ZERO,N.EPSILON14))d.unpack(eg[e],0,Qd),d.unpack(eg[t],0,Zd),d.unpack(eg[n],0,eh);else if(N.equalsEpsilon(r.x,0,N.EPSILON14)&&N.equalsEpsilon(r.y,0,N.EPSILON14)){const c=N.sign(r.z);d.unpack(eg[e],0,Qd),e!=="east"&&e!=="west"&&d.multiplyByScalar(Qd,c,Qd),d.unpack(eg[t],0,Zd),t!=="east"&&t!=="west"&&d.multiplyByScalar(Zd,c,Zd),d.unpack(eg[n],0,eh),n!=="east"&&n!=="west"&&d.multiplyByScalar(eh,c,eh)}else{s=A(s,pe.WGS84),s.geodeticSurfaceNormal(r,va.up);const c=va.up,u=va.east;u.x=-r.y,u.y=r.x,u.z=0,d.normalize(u,va.east),d.cross(c,u,va.north),d.multiplyByScalar(va.up,-1,va.down),d.multiplyByScalar(va.east,-1,va.west),d.multiplyByScalar(va.north,-1,va.south),Qd=va[e],Zd=va[t],eh=va[n]}return a[0]=Qd.x,a[1]=Qd.y,a[2]=Qd.z,a[3]=0,a[4]=Zd.x,a[5]=Zd.y,a[6]=Zd.z,a[7]=0,a[8]=eh.x,a[9]=eh.y,a[10]=eh.z,a[11]=0,a[12]=r.x,a[13]=r.y,a[14]=r.z,a[15]=1,a},bI[o]=i),i};li.eastNorthUpToFixedFrame=li.localFrameToFixedFrameGenerator("east","north");li.northEastDownToFixedFrame=li.localFrameToFixedFrameGenerator("north","east");li.northUpEastToFixedFrame=li.localFrameToFixedFrameGenerator("north","up");li.northWestUpToFixedFrame=li.localFrameToFixedFrameGenerator("north","west");const Ppe=new Ce,Ope=new d(1,1,1),Lpe=new B;li.headingPitchRollToFixedFrame=function(e,t,n,i,o){b.typeOf.object("HeadingPitchRoll",t),i=A(i,li.eastNorthUpToFixedFrame);const r=Ce.fromHeadingPitchRoll(t,Ppe),s=B.fromTranslationQuaternionRotationScale(d.ZERO,r,Ope,Lpe);return o=i(e,n,o),B.multiply(o,s,o)};const Bpe=new B,Rpe=new J;li.headingPitchRollQuaternion=function(e,t,n,i,o){b.typeOf.object("HeadingPitchRoll",t);const r=li.headingPitchRollToFixedFrame(e,t,n,i,Bpe),s=B.getMatrix3(r,Rpe);return Ce.fromRotationMatrix(s,o)};const Npe=new d(1,1,1),Mpe=new d,Cz=new B,Fpe=new B,zpe=new J,Upe=new Ce;li.fixedFrameToHeadingPitchRoll=function(e,t,n,i){b.defined("transform",e),t=A(t,pe.WGS84),n=A(n,li.eastNorthUpToFixedFrame),l(i)||(i=new Ur);const o=B.getTranslation(e,Mpe);if(d.equals(o,d.ZERO))return i.heading=0,i.pitch=0,i.roll=0,i;let r=B.inverseTransformation(n(o,t,Cz),Cz),s=B.setScale(e,Npe,Fpe);s=B.setTranslation(s,d.ZERO,s),r=B.multiply(r,s,r);let a=Ce.fromRotationMatrix(B.getMatrix3(r,zpe),Upe);return a=Ce.normalize(a,a),Ur.fromQuaternion(a,i)};const Hpe=6*3600+41*60+50.54841,Vpe=8640184812866e-6,kpe=.093104,Gpe=-62e-7,Wpe=11772758384668e-32,jpe=72921158553e-15,qpe=N.TWO_PI/86400;let tE=new ne;li.computeTemeToPseudoFixedMatrix=function(e,t){if(!l(e))throw new x("date is required.");tE=ne.addSeconds(e,-ne.computeTaiMinusUtc(e),tE);const n=tE.dayNumber,i=tE.secondsOfDay;let o;const r=n-2451545;i>=43200?o=(r+.5)/Ti.DAYS_PER_JULIAN_CENTURY:o=(r-.5)/Ti.DAYS_PER_JULIAN_CENTURY;const a=(Hpe+o*(Vpe+o*(kpe+o*Gpe)))*qpe%N.TWO_PI,c=jpe+Wpe*(n-24515455e-1),u=(i+Ti.SECONDS_PER_DAY*.5)%Ti.SECONDS_PER_DAY,f=a+c*u,h=Math.cos(f),_=Math.sin(f);return l(t)?(t[0]=h,t[1]=-_,t[2]=0,t[3]=_,t[4]=h,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t):new J(h,_,0,-_,h,0,0,0,1)};li.iau2006XysData=new yN;li.earthOrientationParameters=FC.NONE;const CL=32.184,Ype=2451545;li.preloadIcrfFixed=function(e){const t=e.start.dayNumber,n=e.start.secondsOfDay+CL,i=e.stop.dayNumber,o=e.stop.secondsOfDay+CL;return li.iau2006XysData.preload(t,n,i,o)};li.computeIcrfToFixedMatrix=function(e,t){if(!l(e))throw new x("date is required.");l(t)||(t=new J);const n=li.computeFixedToIcrfMatrix(e,t);if(l(n))return J.transpose(n,t)};const $pe=new HW(0,0,0),Xpe=new uN(0,0,0,0,0),EI=new J,xI=new J;li.computeFixedToIcrfMatrix=function(e,t){if(!l(e))throw new x("date is required.");l(t)||(t=new J);const n=li.earthOrientationParameters.compute(e,Xpe);if(!l(n))return;const i=e.dayNumber,o=e.secondsOfDay+CL,r=li.iau2006XysData.computeXysRadians(i,o,$pe);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=EI;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 f=J.fromRotationZ(-r.s,xI),h=J.multiply(u,f,EI),_=e.dayNumber,g=e.secondsOfDay-ne.computeTaiMinusUtc(e)+n.ut1MinusUtc,p=_-2451545,y=g/Ti.SECONDS_PER_DAY;let C=.779057273264+y+.00273781191135448*(p+y);C=C%1*N.TWO_PI;const T=J.fromRotationZ(C,xI),E=J.multiply(h,T,EI),w=Math.cos(n.xPoleWander),S=Math.cos(n.yPoleWander),P=Math.sin(n.xPoleWander),O=Math.sin(n.yPoleWander);let z=i-Ype+o/Ti.SECONDS_PER_DAY;z/=36525;const R=-47e-6*z*N.RADIANS_PER_DEGREE/3600,F=Math.cos(R),H=Math.sin(R),v=xI;return v[0]=w*F,v[1]=w*H,v[2]=P,v[3]=-S*H+O*P*F,v[4]=S*F+O*P*H,v[5]=-O*w,v[6]=-O*H-S*P*F,v[7]=O*F-S*P*H,v[8]=S*w,J.multiply(E,v,t)};const Kpe=new oe;li.pointToWindowCoordinates=function(e,t,n,i){return i=li.pointToGLWindowCoordinates(e,t,n,i),i.y=2*t[5]-i.y,i};li.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=Kpe;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 Jpe=new d,Qpe=new d,Zpe=new d;li.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,pe.WGS84).geodeticSurfaceNormal(e,Jpe);let r=d.cross(t,o,Qpe);d.equalsEpsilon(r,d.ZERO,N.EPSILON6)&&(r=d.clone(d.UNIT_X,r));const s=d.cross(r,t,Zpe);return d.normalize(s,s),d.cross(t,s,r),d.negate(r,r),d.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 VW=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1),kW=new Ae,GW=new d,eme=new d,tme=new J,TL=new B,WW=new B;li.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,eme),o=e.ellipsoid,r=o.cartesianToCartographic(i,kW),s=e.project(r,GW);d.fromElements(s.z,s.x,s.y,s);const a=li.eastNorthUpToFixedFrame(i,o,TL),c=B.inverseTransformation(a,WW),u=B.getMatrix3(t,tme),f=B.multiplyByMatrix3(c,u,n);return B.multiply(VW,f,n),B.setTranslation(n,s,n),n};li.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=li.eastNorthUpToFixedFrame(t,i,TL),r=B.inverseTransformation(o,WW),s=i.cartesianToCartographic(t,kW),a=e.project(s,GW);d.fromElements(a.z,a.x,a.y,a);const c=B.fromTranslation(a,TL);return B.multiply(VW,r,n),B.multiply(c,n,n),n};const tn=li;function Dt(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.attributes",e.attributes),this.attributes=e.attributes,this.indices=e.indices,this.primitiveType=A(e.primitiveType,Je.TRIANGLES),this.boundingSphere=e.boundingSphere,this.geometryType=A(e.geometryType,qg.NONE),this.boundingSphereCV=e.boundingSphereCV,this.offsetAttribute=e.offsetAttribute}Dt.computeNumberOfVertices=function(e){b.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 nme=new Ae,ime=new d,Tz=new B,ome=[new Ae,new Ae,new Ae],rme=[new j,new j,new j],sme=[new j,new j,new j],ame=new d,cme=new Ce,lme=new B,ume=new at;Dt._textureCoordinateRotationPoints=function(e,t,n,i){let o;const r=_e.center(i,nme),s=Ae.toCartesian(r,n,ime),a=tn.eastNorthUpToFixedFrame(s,n,Tz),c=B.inverse(a,Tz),u=rme,f=ome;f[0].longitude=i.west,f[0].latitude=i.south,f[1].longitude=i.west,f[1].latitude=i.north,f[2].longitude=i.east,f[2].latitude=i.south;let h=ame;for(o=0;o<3;o++)Ae.toCartesian(f[o],n,h),h=B.multiplyByPointAsVector(c,h,h),u[o].x=h.x,u[o].y=h.y;const _=Ce.fromAxisAngle(d.UNIT_Z,-t,cme),g=J.fromQuaternion(_,lme),p=e.length;let y=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,T=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),C=Math.min(C,h.y),T=Math.max(T,h.x),E=Math.max(E,h.y);const w=at.fromRotation(t,ume),S=sme;S[0].x=y,S[0].y=C,S[1].x=y,S[1].y=E,S[2].x=T,S[2].y=C;const P=u[0],O=u[2].x-P.x,z=u[1].y-P.y;for(o=0;o<3;o++){const I=S[o];at.multiplyByVector(w,I,I),I.x=(I.x-P.x)/O,I.y=(I.y-P.y)/z}const R=S[0],F=S[1],H=S[2],v=new Array(6);return j.pack(R,v),j.pack(F,v,2),j.pack(H,v,4),v};function ze(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 Ny(e,t,n,i,o){this._format=e,this._datatype=t,this._width=n,this._height=i,this._buffer=o}Object.defineProperties(Ny.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}}});Ny.clone=function(e){if(l(e))return new Ny(e._format,e._datatype,e._width,e._height,e._buffer)};Ny.prototype.clone=function(){return Ny.clone(this)};function jW(){if(!l(vi._canTransferArrayBuffer)){const e=new Worker(YW("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=Ep();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 bL=new $e;function qW(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 Se(t.error.message),r.stack=t.error.stack):r.name==="DeveloperError"&&(r=new x(t.error.message),r.stack=t.error.stack),bL.raiseEvent(r),o.reject(r)}else bL.raiseEvent(),o.resolve(t.result);delete i[n]}function YW(e){let t=dn(e);if(IW(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 wI;function fme(){return l(wI)||(wI=YW("Workers/cesiumWorkerBootstrapper.js")),wI}function $W(e){const t=new Worker(fme());t.postMessage=A(t.webkitPostMessage,t.postMessage);const n={loaderConfig:{paths:{Workers:dn("Workers")},baseUrl:dn.getCesiumBaseUrl().url},workerModule:e._workerPath};return t.postMessage(n),t.onmessage=function(i){qW(e,i.data)},t}function dme(e,t){const n={modulePath:void 0,wasmBinaryFile:void 0,wasmBinary:void 0};if(!un.supportsWebAssembly()){if(!l(t.fallbackModulePath))throw new Se(`This browser does not support Web Assembly, and no backup module was provided for ${e._workerPath}`);return n.modulePath=dn(t.fallbackModulePath),Promise.resolve(n)}return n.modulePath=dn(t.modulePath),n.wasmBinaryFile=dn(t.wasmBinaryFile),Re.fetchArrayBuffer({url:n.wasmBinaryFile}).then(function(i){return n.wasmBinary=i,n})}function vi(e,t){const n=new Ts(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 hme=[];vi.prototype.scheduleTask=function(e,t){if(l(this._worker)||(this._worker=$W(this)),this._activeTasks>=this._maximumActiveTasks)return;++this._activeTasks;const n=this;return Promise.resolve(jW()).then(function(i){l(t)?i||(t.length=0):t=hme;const o=n._nextID++,r=Ep();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=$W(this));const t=Ep(),n=this,i=this._worker;return dme(this,e).then(function(o){return Promise.resolve(jW()).then(function(r){let s;const a=o.wasmBinary;l(a)&&r&&(s=[a]),i.onmessage=function(c){i.onmessage=function(u){qW(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(),Ue(this)};vi.taskCompletedEvent=bL;vi._defaultWorkerModulePrefix="Workers/";vi._workerModulePrefix=vi._defaultWorkerModulePrefix;vi._canTransferArrayBuffer=void 0;function Kf(){}Kf._transcodeTaskProcessor=new vi("transcodeKTX2",Number.POSITIVE_INFINITY);Kf._readyPromise=void 0;function pme(){const e=Kf._transcodeTaskProcessor.initWebAssemblyModule({modulePath:"ThirdParty/Workers/basis_transcoder.js",wasmBinaryFile:"ThirdParty/basis_transcoder.wasm"}).then(function(){return Kf._transcodeTaskProcessor});Kf._readyPromise=e}Kf.transcode=function(e,t){return b.defined("supportedTargetFormats",t),l(Kf._readyPromise)||pme(),Kf._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 Ny(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 XW;b_.setKTX2SupportedFormats=function(e,t,n,i,o,r){XW={s3tc:e,pvrtc:t,astc:n,etc:i,etc1:o,bc7:r}};function b_(e){b.defined("resourceOrUrlOrBuffer",e);let t;return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?t=Promise.resolve(e):t=Re.createIfNeeded(e).fetchArrayBuffer(),t.then(function(n){return Kf.transcode(n,XW)})}function Mf(e,t,n,i,o,r,s,a,c,u,f){this._context=e,this._texture=t,this._textureTarget=n,this._targetFace=i,this._pixelDatatype=s,this._internalFormat=o,this._pixelFormat=r,this._size=a,this._preMultiplyAlpha=c,this._flipY=u,this._initialized=f}Object.defineProperties(Mf.prototype,{pixelFormat:{get:function(){return this._pixelFormat}},pixelDatatype:{get:function(){return this._pixelDatatype}},_target:{get:function(){return this._targetFace}}});Mf.prototype.copyFrom=function(e){b.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(b.defined("options.source",e.source),b.typeOf.number.greaterThanOrEquals("xOffset",t,0),b.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 f=this._size,h=this._pixelFormat,_=this._internalFormat,g=this._pixelDatatype,p=this._preMultiplyAlpha,y=this._flipY,C=A(e.skipColorSpaceConversion,!1);let T=4;l(u)&&(T=nt.alignmentInBytes(h,g,a)),o.pixelStorei(o.UNPACK_ALIGNMENT,T),C?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===f&&c===f)l(u)?(o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,!1),y&&(u=nt.flipY(u,h,g,f,f)),o.texImage2D(s,0,_,f,f,0,h,Ke.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,_,h,Ke.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=nt.createTypedArray(h,g,f,f);o.texImage2D(s,0,_,f,f,0,h,Ke.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=nt.flipY(u,h,g,a,c)),o.texSubImage2D(s,0,t,n,a,c,h,Ke.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,Ke.toWebGLConstant(g,this._context),i))),o.bindTexture(r,null)};Mf.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),b.typeOf.number.greaterThanOrEquals("xOffset",e,0),b.typeOf.number.greaterThanOrEquals("yOffset",t,0),b.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),b.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===Ke.FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Ke.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 Jx={DONT_CARE:se.DONT_CARE,FASTEST:se.FASTEST,NICEST:se.NICEST,validate:function(e){return e===Jx.DONT_CARE||e===Jx.FASTEST||e===Jx.NICEST}},My=Object.freeze(Jx),Qx={NEAREST:se.NEAREST,LINEAR:se.LINEAR};Qx.validate=function(e){return e===Qx.NEAREST||e===Qx.LINEAR};const Hr=Object.freeze(Qx),yh={NEAREST:se.NEAREST,LINEAR:se.LINEAR,NEAREST_MIPMAP_NEAREST:se.NEAREST_MIPMAP_NEAREST,LINEAR_MIPMAP_NEAREST:se.LINEAR_MIPMAP_NEAREST,NEAREST_MIPMAP_LINEAR:se.NEAREST_MIPMAP_LINEAR,LINEAR_MIPMAP_LINEAR:se.LINEAR_MIPMAP_LINEAR};yh.validate=function(e){return e===yh.NEAREST||e===yh.LINEAR||e===yh.NEAREST_MIPMAP_NEAREST||e===yh.LINEAR_MIPMAP_NEAREST||e===yh.NEAREST_MIPMAP_LINEAR||e===yh.LINEAR_MIPMAP_LINEAR};const An=Object.freeze(yh),Zx={CLAMP_TO_EDGE:se.CLAMP_TO_EDGE,REPEAT:se.REPEAT,MIRRORED_REPEAT:se.MIRRORED_REPEAT,validate:function(e){return e===Zx.CLAMP_TO_EDGE||e===Zx.REPEAT||e===Zx.MIRRORED_REPEAT}},Ei=Object.freeze(Zx);function Yn(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.wrapS,Ei.CLAMP_TO_EDGE),n=A(e.wrapT,Ei.CLAMP_TO_EDGE),i=A(e.minificationFilter,An.LINEAR),o=A(e.magnificationFilter,Hr.LINEAR),r=l(e.maximumAnisotropy)?e.maximumAnisotropy:1;if(!Ei.validate(t))throw new x("Invalid sampler.wrapS.");if(!Ei.validate(n))throw new x("Invalid sampler.wrapT.");if(!An.validate(i))throw new x("Invalid sampler.minificationFilter.");if(!Hr.validate(o))throw new x("Invalid sampler.magnificationFilter.");b.typeOf.number.greaterThanOrEquals("maximumAnisotropy",r,1),this._wrapS=t,this._wrapT=n,this._minificationFilter=i,this._magnificationFilter=o,this._maximumAnisotropy=r}Object.defineProperties(Yn.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}}});Yn.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};Yn.NEAREST=Object.freeze(new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:An.NEAREST,magnificationFilter:Hr.NEAREST}));function nu(e){e=A(e,A.EMPTY_OBJECT),b.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,Ke.UNSIGNED_BYTE),a=A(e.pixelFormat,nt.RGBA),c=nt.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>wt.maximumCubeMapSize)throw new x(`Width and height must be less than or equal to the maximum cube map size (${wt.maximumCubeMapSize}). Check maximumCubeMapSize.`);if(!nt.validate(a))throw new x("Invalid options.pixelFormat.");if(nt.isDepthFormat(a))throw new x("options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.");if(!Ke.validate(s))throw new x("Invalid options.pixelDatatype.");if(s===Ke.FLOAT&&!t.floatingPointTexture)throw new x("When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.");if(s===Ke.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=nt.textureSizeInBytes(a,s,r,r)*6,f=e.preMultiplyAlpha||a===nt.RGB||a===nt.LUMINANCE,h=A(e.flipY,!0),_=A(e.skipColorSpaceConversion,!1),g=t._gl,p=g.TEXTURE_CUBE_MAP,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);function C(E,w,S,P,O){let z=w.arrayBufferView;l(z)||(z=w.bufferView);let R=4;l(z)&&(R=nt.alignmentInBytes(a,s,i)),g.pixelStorei(g.UNPACK_ALIGNMENT,R),O?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=nt.flipY(z,a,s,r,r)),g.texImage2D(E,0,c,r,r,0,a,Ke.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,Ke.toWebGLConstant(s,t),w))}l(n)?(C(g.TEXTURE_CUBE_MAP_POSITIVE_X,n.positiveX,f,h,_),C(g.TEXTURE_CUBE_MAP_NEGATIVE_X,n.negativeX,f,h,_),C(g.TEXTURE_CUBE_MAP_POSITIVE_Y,n.positiveY,f,h,_),C(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,n.negativeY,f,h,_),C(g.TEXTURE_CUBE_MAP_POSITIVE_Z,n.positiveZ,f,h,_),C(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,n.negativeZ,f,h,_)):(g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_X,0,c,r,r,0,a,Ke.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_X,0,c,r,r,0,a,Ke.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Y,0,c,r,r,0,a,Ke.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,c,r,r,0,a,Ke.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_POSITIVE_Z,0,c,r,r,0,a,Ke.toWebGLConstant(s,t),null),g.texImage2D(g.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,c,r,r,0,a,Ke.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=f,this._flipY=h,this._sampler=void 0;const T=l(n);this._positiveX=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_X,c,a,s,r,f,h,T),this._negativeX=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_X,c,a,s,r,f,h,T),this._positiveY=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Y,c,a,s,r,f,h,T),this._negativeY=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Y,c,a,s,r,f,h,T),this._positiveZ=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_POSITIVE_Z,c,a,s,r,f,h,T),this._negativeZ=new Mf(t,y,p,g.TEXTURE_CUBE_MAP_NEGATIVE_Z,c,a,s,r,f,h,T),this.sampler=l(e.sampler)?e.sampler:new Yn}Object.defineProperties(nu.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===An.NEAREST_MIPMAP_NEAREST||t===An.NEAREST_MIPMAP_LINEAR||t===An.LINEAR_MIPMAP_NEAREST||t===An.LINEAR_MIPMAP_LINEAR,o=this._context,r=this._pixelDatatype;(r===Ke.FLOAT&&!o.textureFloatLinear||r===Ke.HALF_FLOAT&&!o.textureHalfFloatLinear)&&(t=i?An.NEAREST_MIPMAP_NEAREST:An.NEAREST,n=Hr.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}}});nu.prototype.generateMipmap=function(e){if(e=A(e,My.DONT_CARE),this._size>1&&!N.isPowerOfTwo(this._size))throw new x("width and height must be a power of two to call generateMipmap().");if(!My.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)};nu.prototype.isDestroyed=function(){return!1};nu.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),this._positiveX=Ue(this._positiveX),this._negativeX=Ue(this._negativeX),this._positiveY=Ue(this._positiveY),this._negativeY=Ue(this._negativeY),this._positiveZ=Ue(this._positiveZ),this._negativeZ=Ue(this._negativeZ),Ue(this)};function E_(e){this.context=e,this.framebuffer=void 0,this.blendingEnabled=void 0,this.scissorTest=void 0,this.viewport=void 0}function mme(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}\\]`,C=`czm_out${r}`;new RegExp(y,"g").test(e)&&(bz(C,a),Eu(y,C,i),i.splice(o,0,`layout(location = ${r}) out vec4 ${C};`),o+=1)}const c="czm_fragColor";gme("gl_FragColor",i)&&(bz(c,a),Eu("gl_FragColor",c,i),i.splice(o,0,"layout(location = 0) out vec4 czm_fragColor;"),o+=1);const u=Ame(a,i),f={};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)&&(f[s]=y)}for(const y in f)if(f.hasOwnProperty(y)){const C=f[y];let T=i.indexOf(y);const E=u[C],w=E.length;for(let S=0;S<w;S++)i.splice(T,0,E[S]);T+=w+1;for(let S=w-1;S>=0;S--)i.splice(T,0,`#endif //${E[S]}`)}const h="WEBGL_2",_=`#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,_),SI("EXT_draw_buffers",h,i),SI("EXT_frag_depth",h,i),SI("OES_standard_derivatives",h,i),Eu("texture2D","texture",i),Eu("texture3D","texture",i),Eu("textureCube","texture",i),Eu("gl_FragDepthEXT","gl_FragDepth",i),t?Eu("varying","in",i):(Eu("attribute","in",i),Eu("varying","out",i)),yme(i)}function Eu(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 _me(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 gme(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 yme(e){let t="";const n=e.length;for(let i=0;i<n;++i)t+=`${e[i]}
`;return t}function bz(e,t){t.indexOf(e)===-1&&t.push(e)}function Ame(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 f=0;f<i;++f){const h=e[f];s.indexOf(h)!==-1&&(l(n[h])?n[h]=n[h].filter(function(_){return o.indexOf(_)>=0}):n[h]=o.slice())}}return n}function SI(e,t,n){const i=`#extension\\s+GL_${e}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;_me(new RegExp(i,"g"),"",n),Eu(`GL_${e}`,t,n)}const Cme=`/**
* 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;
`,Tme=`/**
* 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);
`,bme=`/**
* 0.1
*
* @name czm_epsilon1
* @glslConstant
*/
const float czm_epsilon1 = 0.1;
`,Eme=`/**
* 0.01
*
* @name czm_epsilon2
* @glslConstant
*/
const float czm_epsilon2 = 0.01;
`,xme=`/**
* 0.001
*
* @name czm_epsilon3
* @glslConstant
*/
const float czm_epsilon3 = 0.001;
`,wme=`/**
* 0.0001
*
* @name czm_epsilon4
* @glslConstant
*/
const float czm_epsilon4 = 0.0001;
`,Sme=`/**
* 0.00001
*
* @name czm_epsilon5
* @glslConstant
*/
const float czm_epsilon5 = 0.00001;
`,vme=`/**
* 0.000001
*
* @name czm_epsilon6
* @glslConstant
*/
const float czm_epsilon6 = 0.000001;
`,Dme=`/**
* 0.0000001
*
* @name czm_epsilon7
* @glslConstant
*/
const float czm_epsilon7 = 0.0000001;
`,Ime=`/**
* 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?
`,Pme=`/**
* 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;
`,Ome=`/**
* 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;
`,Lme=`/**
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
*
* @name czm_passCesium3DTile
* @glslConstant
*
* @see czm_pass
*/
const float czm_passCesium3DTile = 4.0;
`,Bme=`/**
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
*
* @name czm_passCesium3DTileClassification
* @glslConstant
*
* @see czm_pass
*/
const float czm_passCesium3DTileClassification = 5.0;
`,Rme=`/**
* 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;
`,Nme=`/**
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}
*
* @name czm_passClassification
* @glslConstant
*
* @see czm_pass
*/
const float czm_passClassification = 7.0;
`,Mme=`/**
* The automatic GLSL constant for {@link Pass#COMPUTE}
*
* @name czm_passCompute
* @glslConstant
*
* @see czm_pass
*/
const float czm_passCompute = 1.0;
`,Fme=`/**
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}
*
* @name czm_passEnvironment
* @glslConstant
*
* @see czm_pass
*/
const float czm_passEnvironment = 0.0;
`,zme=`/**
* The automatic GLSL constant for {@link Pass#GLOBE}
*
* @name czm_passGlobe
* @glslConstant
*
* @see czm_pass
*/
const float czm_passGlobe = 2.0;
`,Ume=`/**
* The automatic GLSL constant for {@link Pass#OPAQUE}
*
* @name czm_passOpaque
* @glslConstant
*
* @see czm_pass
*/
const float czm_passOpaque = 7.0;
`,Hme=`/**
* The automatic GLSL constant for {@link Pass#OVERLAY}
*
* @name czm_passOverlay
* @glslConstant
*
* @see czm_pass
*/
const float czm_passOverlay = 10.0;
`,Vme=`/**
* The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}
*
* @name czm_passTerrainClassification
* @glslConstant
*
* @see czm_pass
*/
const float czm_passTerrainClassification = 3.0;
`,kme=`/**
* The automatic GLSL constant for {@link Pass#TRANSLUCENT}
*
* @name czm_passTranslucent
* @glslConstant
*
* @see czm_pass
*/
const float czm_passTranslucent = 8.0;
`,Gme=`/**
* The automatic GLSL constant for {@link Pass#VOXELS}
*
* @name czm_passVoxels
* @glslConstant
*
* @see czm_pass
*/
const float czm_passVoxels = 9.0;
`,Wme=`/**
* 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;
`,jme=`/**
* 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;
`,qme=`/**
* 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;
`,Yme=`/**
* 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;
`,$me=`/**
* 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;
`,Xme=`/**
* 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;
`,Kme=`/**
* 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;
`,Jme=`/**
* 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;
`,Qme=`/**
* 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;
`,Zme=`/**
* 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;
`,e_e=`/**
* 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;
`,t_e=`/**
* 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;
`,n_e=`/**
* 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;
`,i_e=`/**
* 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;
`,o_e=`/**
* @name czm_depthRangeStruct
* @glslStruct
*/
struct czm_depthRangeStruct
{
float near;
float far;
};
`,r_e=`/**
* 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;
};
`,s_e=`/**
* 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;
};
`,a_e=`/**
* 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;
};
`,c_e=`/**
* 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;
};
`,l_e=`/**
* 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;
};
`,u_e=`/**
* DOC_TBA
*
* @name czm_ray
* @glslStruct
*/
struct czm_ray
{
vec3 origin;
vec3 direction;
};
`,f_e=`/**
* 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);
`,d_e=`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;
};
`,h_e=`/**
* 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);
}
`,p_e=`/**
* 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;
}
`,m_e=`/**
* 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);
}
`,__e=`/**
* 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);
}
`,g_e=`/**
* 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;
}
`,y_e=`/**
* 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;
}
`,A_e=`// 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;
}
`,C_e=`/**
* @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))));
}
`,T_e=`/**
* 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);
}
`,b_e=`/**
* 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);
}
`,E_e=`/**
* 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;
}
`,x_e=`/**
* 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);
}
`,w_e=`
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;
}
`,S_e=`
uniform vec4 shadowMap_cascadeDistances;
float czm_cascadeDistance(vec4 weights)
{
return dot(shadowMap_cascadeDistances, weights);
}
`,v_e=`
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;
}
`,D_e=`
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;
}
`,I_e=`/**
* 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);
}
`,P_e=`/**
* 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();
`,O_e=`/**
* @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);
}
}
`,L_e=`/**
* 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);
}
`,B_e=`/**
* 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;
}
`,R_e=`// 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;
}
`,N_e=`/**
* 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);
}
`,M_e=`/**
* 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);
}
`,F_e=`/**
* 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);
}
`,z_e=`/**
* 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);
}
`,U_e=`/**
* 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;
}
`,H_e=`/**
* 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;
}
`,V_e=`/**
* 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;
}
`,k_e=`/**
* 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);
}
`,G_e=`/**
* 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;
}
`,W_e=`/**
* 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);
}
`,j_e=`/**
* 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;
}
`,q_e=`/**
* 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);
}
`,Y_e=`/**
* 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));
}
`,$_e=`/**
* @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;
}
`,X_e=`/**
* 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;
}
`,K_e=`/**
* 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));
}
`,J_e=`/**
* 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);
}
`,Q_e=`/**
* 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);
}
`,Z_e=`/**
* 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;
}
`,ege=`/**
* 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);
}
`,tge=`/**
* 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);
}
`,nge=`/**
* 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);
}
`,ige=`/**
* 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);
}
`,oge=`/**
* 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;
}
`,rge=`/**
* 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;
}
`,sge=`/**
* 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);
}
`,age=` /**
* 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));
}
`,cge=`/**
* 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;
}
`,lge=`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;
}
`,uge=`/**
* 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;
}
`,fge=`/**
* 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;
}
`,dge=`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);
}
`,hge=`/**
* 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);
}
`,pge=`/**
* 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);
}
`,mge=`/**
* 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;
}
}
}
`,_ge=`/**
* 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;
}
`,gge=`float czm_readDepth(sampler2D depthTexture, vec2 texCoords)
{
return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);
}
`,yge=`/**
* 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;
}
`,Age=`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;
}
`,Cge=`/**
* 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);
}
`,Tge=`/**
* 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);
}
`,bge=`/**
* 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);
}
`,Ege=`
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));
}
`,xge=`
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
`,wge=`/**
* 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));
}
`,Sge=`/**
* 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);
}
`,vge=`/**
* 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);
}
`,Dge=`/**
* 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);
}
`,Ige=`/**
* 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;
}
`,Pge=`/**
* 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);
}
`,Oge=`/**
* @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);
}
`,Lge=`/**
* 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]);
}
`,Bge=`/**
* 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));
}
`,Rge=`/**
* 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;
}
`,Nge=`/**
* 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)));
}
`,Mge=`/**
* 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;
}
`,Fge=`#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
}
`,zge=`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);
}
`,Uge=`// 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
}
`,Hge=`#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
}
`,Vge=`/**
* 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;
}
`,vI={czm_degreesPerRadian:Cme,czm_depthRange:Tme,czm_epsilon1:bme,czm_epsilon2:Eme,czm_epsilon3:xme,czm_epsilon4:wme,czm_epsilon5:Sme,czm_epsilon6:vme,czm_epsilon7:Dme,czm_infinity:Ime,czm_oneOverPi:Pme,czm_oneOverTwoPi:Ome,czm_passCesium3DTile:Lme,czm_passCesium3DTileClassification:Bme,czm_passCesium3DTileClassificationIgnoreShow:Rme,czm_passClassification:Nme,czm_passCompute:Mme,czm_passEnvironment:Fme,czm_passGlobe:zme,czm_passOpaque:Ume,czm_passOverlay:Hme,czm_passTerrainClassification:Vme,czm_passTranslucent:kme,czm_passVoxels:Gme,czm_pi:Wme,czm_piOverFour:jme,czm_piOverSix:qme,czm_piOverThree:Yme,czm_piOverTwo:$me,czm_radiansPerDegree:Xme,czm_sceneMode2D:Kme,czm_sceneMode3D:Jme,czm_sceneModeColumbusView:Qme,czm_sceneModeMorphing:Zme,czm_solarRadius:e_e,czm_threePiOver2:t_e,czm_twoPi:n_e,czm_webMercatorMaxLatitude:i_e,czm_depthRangeStruct:o_e,czm_material:r_e,czm_materialInput:s_e,czm_modelMaterial:a_e,czm_modelVertexOutput:c_e,czm_pbrParameters:l_e,czm_ray:u_e,czm_raySegment:f_e,czm_shadowParameters:d_e,czm_HSBToRGB:h_e,czm_HSLToRGB:p_e,czm_RGBToHSB:m_e,czm_RGBToHSL:__e,czm_RGBToXYZ:g_e,czm_XYZToRGB:y_e,czm_acesTonemapping:A_e,czm_alphaWeight:C_e,czm_antialias:T_e,czm_approximateSphericalCoordinates:b_e,czm_backFacing:E_e,czm_branchFreeTernary:x_e,czm_cascadeColor:w_e,czm_cascadeDistance:S_e,czm_cascadeMatrix:v_e,czm_cascadeWeights:D_e,czm_columbusViewMorph:I_e,czm_computePosition:P_e,czm_cosineAndSine:O_e,czm_decompressTextureCoordinates:L_e,czm_defaultPbrMaterial:B_e,czm_depthClamp:R_e,czm_eastNorthUpToEyeCoordinates:N_e,czm_ellipsoidContainsPoint:M_e,czm_ellipsoidWgs84TextureCoordinates:F_e,czm_equalsEpsilon:z_e,czm_eyeOffset:U_e,czm_eyeToWindowCoordinates:H_e,czm_fastApproximateAtan:V_e,czm_fog:k_e,czm_gammaCorrect:G_e,czm_geodeticSurfaceNormal:W_e,czm_getDefaultMaterial:j_e,czm_getLambertDiffuse:q_e,czm_getSpecular:Y_e,czm_getWaterNoise:$_e,czm_hue:X_e,czm_inverseGamma:K_e,czm_isEmpty:J_e,czm_isFull:Q_e,czm_latitudeToWebMercatorFraction:Z_e,czm_lineDistance:ege,czm_linearToSrgb:tge,czm_luminance:nge,czm_metersPerPixel:ige,czm_modelToWindowCoordinates:oge,czm_multiplyWithColorBalance:rge,czm_nearFarScalar:sge,czm_octDecode:age,czm_packDepth:cge,czm_pbrLighting:lge,czm_pbrMetallicRoughnessMaterial:uge,czm_pbrSpecularGlossinessMaterial:fge,czm_phong:dge,czm_planeDistance:hge,czm_pointAlongRay:pge,czm_rayEllipsoidIntersectionInterval:mge,czm_raySphereIntersectionInterval:_ge,czm_readDepth:gge,czm_readNonPerspective:yge,czm_reverseLogDepth:Age,czm_round:Cge,czm_sampleOctahedralProjection:Tge,czm_saturation:bge,czm_shadowDepthCompare:Ege,czm_shadowVisibility:xge,czm_signNotZero:wge,czm_sphericalHarmonics:Sge,czm_srgbToLinear:vge,czm_tangentToEyeSpaceMatrix:Dge,czm_transformPlane:Ige,czm_translateRelativeToEye:Pge,czm_translucentPhong:Oge,czm_transpose:Lge,czm_unpackDepth:Bge,czm_unpackFloat:Rge,czm_unpackUint:Nge,czm_valueTransform:Mge,czm_vertexLogDepth:Fge,czm_windowToEyeCoordinates:zge,czm_writeDepthClamp:Uge,czm_writeLogDepth:Hge,czm_writeNonPerspective:Vge};function KW(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 JW(e,t,n){let i;for(let o=0;o<n.length;++o)n[o].name===e&&(i=n[o]);return l(i)||(t=KW(t),i={name:e,glslSource:t,dependsOn:[],requiredBy:[],evaluated:!1},n.push(i)),i}function QW(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&&Ge._czmBuiltinsAndUniforms.hasOwnProperty(i)){const o=JW(i,Ge._czmBuiltinsAndUniforms[i],t);e.dependsOn.push(o),o.requiredBy.push(e),QW(o,t)}}))}function kge(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 Gge(e){const t=[],n=JW("main",e,t);QW(n,t),kge(t);let i="";for(let o=t.length-1;o>=0;--o)i=`${i+t[o].glslSource}
`;return i.replace(n.glslSource,"")}function ZW(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=KW(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=Ge.createPickFragmentShaderSource(r,u));let f="";l(a)&&(f=`#version ${a}
`);const h=c.length;for(i=0;i<h;i++)f+=c[i];t&&(f+=`#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
precision highp int;
#else
precision mediump float;
precision mediump int;
#define highp mediump
#endif
`);const _=e.defines;if(l(_))for(i=0,o=_.length;i<o;++i){const g=_[i];g.length!==0&&(f+=`#define ${g}
`)}return n.webgl2&&(f+=`#define OUTPUT_DECLARATION
`),n.textureFloatLinear&&(f+=`#define OES_texture_float_linear
`),n.floatingPointTexture&&(f+=`#define OES_texture_float
`),e.includeBuiltIns&&(f+=Gge(r)),f+=`
#line 0
`,f+=r,n.webgl2&&(f=mme(f,t)),f}function Ge(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)}Ge.prototype.clone=function(){return new Ge({sources:this.sources,defines:this.defines,pickColorQualifier:this.pickColorQualifier,includeBuiltIns:this.includeBuiltIns})};Ge.replaceMain=function(e,t){return t=`void ${t}()`,e.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g,t)};Ge.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}`};Ge.prototype.createCombinedVertexShader=function(e){return ZW(this,!1,e)};Ge.prototype.createCombinedFragmentShader=function(e){return ZW(this,!0,e)};Ge._czmBuiltinsAndUniforms={};for(const e in vI)vI.hasOwnProperty(e)&&(Ge._czmBuiltinsAndUniforms[e]=vI[e]);for(const e in qx)if(qx.hasOwnProperty(e)){const t=qx[e];typeof t.getDeclaration=="function"&&(Ge._czmBuiltinsAndUniforms[e]=t.getDeclaration(e))}Ge.createPickVertexShaderSource=function(e){return`${Ge.replaceMain(e,"czm_old_main")}
attribute vec4 pickColor;
varying vec4 czm_pickColor;
void main()
{
czm_old_main();
czm_pickColor = pickColor;
}`};Ge.createPickFragmentShaderSource=function(e,t){const n=Ge.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 Wge(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 ej(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 tj(e,t){const n=t.length;for(let i=0;i<n;++i){const o=t[i];if(ej(e,o))return o}}const jge=["v_normalEC","v_normal"];Ge.findNormalVarying=function(e){return ej(e,"#ifdef HAS_NORMALS")?Wge(e,"HAS_NORMALS")?"v_normalEC":void 0:tj(e,jge)};const qge=["v_positionEC"];Ge.findPositionVarying=function(e){return tj(e,qge)};function iu(e){this._context=e,this._shaders={},this._numberOfShaders=0,this._shadersToRelease={}}Object.defineProperties(iu.prototype,{numberOfShaders:{get:function(){return this._numberOfShaders}}});iu.prototype.replaceShaderProgram=function(e){return l(e.shaderProgram)&&e.shaderProgram.destroy(),this.getShaderProgram(e)};function Yge(e){const t=Object.keys(e).sort();return JSON.stringify(e,t)}iu.prototype.getShaderProgram=function(e){let t=e.vertexShaderSource,n=e.fragmentShaderSource;const i=e.attributeLocations;typeof t=="string"&&(t=new Ge({sources:[t]})),typeof n=="string"&&(n=new Ge({sources:[n]}));const o=t.getCacheKey(),r=n.getCacheKey(),s=l(i)?Yge(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,f=t.createCombinedVertexShader(u),h=n.createCombinedFragmentShader(u),_=new hn({gl:u._gl,logShaderCompilation:u.logShaderCompilation,debugShaders:u.debugShaders,vertexShaderSource:t,vertexShaderText:f,fragmentShaderSource:n,fragmentShaderText:h,attributeLocations:i});c={cache:this,shaderProgram:_,keyword:a,derivedKeywords:[],count:0},_._cachedShader=c,this._shaders[a]=c,++this._numberOfShaders}return++c.count,c.shaderProgram};iu.prototype.replaceDerivedShaderProgram=function(e,t,n){const i=e._cachedShader,o=t+i.keyword,r=this._shaders[o];if(l(r)){AN(this,r);const s=i.derivedKeywords.indexOf(t);s>-1&&i.derivedKeywords.splice(s,1)}return this.createDerivedShaderProgram(e,t,n)};iu.prototype.getDerivedShaderProgram=function(e,t){const n=e._cachedShader,i=t+n.keyword,o=this._shaders[i];if(l(o))return o.shaderProgram};iu.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 Ge({sources:[r]})),typeof s=="string"&&(s=new Ge({sources:[s]}));const c=this._context,u=r.createCombinedVertexShader(c),f=s.createCombinedFragmentShader(c),h=new hn({gl:c._gl,logShaderCompilation:c.logShaderCompilation,debugShaders:c.debugShaders,vertexShaderSource:r,vertexShaderText:u,fragmentShaderSource:s,fragmentShaderText:f,attributeLocations:a}),_={cache:this,shaderProgram:h,keyword:o,derivedKeywords:[],count:0};return i.derivedKeywords.push(t),h._cachedShader=_,this._shaders[o]=_,h};function AN(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];AN(e,s)}delete e._shaders[t.keyword],t.shaderProgram.finalDestroy()}iu.prototype.destroyReleasedShaderPrograms=function(){const e=this._shadersToRelease;for(const t in e)if(e.hasOwnProperty(t)){const n=e[t];AN(this,n),--this._numberOfShaders}this._shadersToRelease={}};iu.prototype.releaseShaderProgram=function(e){if(l(e)){const t=e._cachedShader;t&&--t.count===0&&(this._shadersToRelease[t.keyword]=t)}};iu.prototype.isDestroyed=function(){return!1};iu.prototype.destroy=function(){const e=this._shaders;for(const t in e)e.hasOwnProperty(t)&&e[t].shaderProgram.finalDestroy();return Ue(this)};function zt(e){e=A(e,A.EMPTY_OBJECT),b.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,nt.RGBA),s=A(e.pixelDatatype,Ke.UNSIGNED_BYTE),a=nt.toInternalFormat(r,s,t),c=nt.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(b.typeOf.number.greaterThan("width",n,0),n>wt.maximumTextureSize)throw new x(`Width must be less than or equal to the maximum texture size (${wt.maximumTextureSize}). Check maximumTextureSize.`);if(b.typeOf.number.greaterThan("height",i,0),i>wt.maximumTextureSize)throw new x(`Height must be less than or equal to the maximum texture size (${wt.maximumTextureSize}). Check maximumTextureSize.`);if(!nt.validate(r))throw new x("Invalid options.pixelFormat.");if(!c&&!Ke.validate(s))throw new x("Invalid options.pixelDatatype.");if(r===nt.DEPTH_COMPONENT&&s!==Ke.UNSIGNED_SHORT&&s!==Ke.UNSIGNED_INT)throw new x("When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.");if(r===nt.DEPTH_STENCIL&&s!==Ke.UNSIGNED_INT_24_8)throw new x("When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8.");if(s===Ke.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===Ke.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(nt.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(nt.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(nt.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(nt.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(nt.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(nt.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(nt.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(nt.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===nt.RGB||r===nt.LUMINANCE,f=A(e.flipY,!0),h=A(e.skipColorSpaceConversion,!1);let _=!0;const g=t._gl,p=g.TEXTURE_2D,y=g.createTexture();g.activeTexture(g.TEXTURE0),g.bindTexture(p,y);let C=4;if(l(o)&&l(o.arrayBufferView)&&!c&&(C=nt.alignmentInBytes(r,s,n)),g.pixelStorei(g.UNPACK_ALIGNMENT,C),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(f&&(E=nt.flipY(E,r,s,n,i)),g.texImage2D(p,0,a,n,i,0,r,Ke.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,Ke.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,f),g.texImage2D(p,0,a,r,Ke.toWebGLConstant(s,t),o));else g.texImage2D(p,0,a,n,i,0,r,Ke.toWebGLConstant(s,t),null),_=!1;g.bindTexture(p,null);let T;c?T=nt.compressedTextureSizeInBytes(r,n,i):T=nt.textureSizeInBytes(r,s,n,i),this._id=Es(),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=T,this._preMultiplyAlpha=u,this._flipY=f,this._initialized=_,this._sampler=void 0,this.sampler=l(e.sampler)?e.sampler:new Yn}zt.create=function(e){return new zt(e)};zt.fromFramebuffer=function(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context);const t=e.context,n=t._gl,i=A(e.pixelFormat,nt.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(!nt.validate(i))throw new x("Invalid pixelFormat.");if(nt.isDepthFormat(i)||nt.isCompressedFormat(i))throw new x("pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format.");if(b.defined("options.context",e.context),b.typeOf.number.greaterThanOrEquals("framebufferXOffset",o,0),b.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 zt({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(zt.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===An.NEAREST_MIPMAP_NEAREST||t===An.NEAREST_MIPMAP_LINEAR||t===An.LINEAR_MIPMAP_NEAREST||t===An.LINEAR_MIPMAP_LINEAR;(r===Ke.FLOAT&&!i.textureFloatLinear||r===Ke.HALF_FLOAT&&!i.textureHalfFloatLinear)&&(t=s?An.NEAREST_MIPMAP_NEAREST:An.NEAREST,n=Hr.NEAREST),i.webgl2&&nt.isDepthFormat(o)&&(t=An.NEAREST,n=Hr.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}}});zt.prototype.copyFrom=function(e){b.defined("options",e);const t=A(e.xOffset,0),n=A(e.yOffset,0);if(b.defined("options.source",e.source),nt.isDepthFormat(this._pixelFormat))throw new x("Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(nt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call copyFrom with a compressed texture pixel format.");b.typeOf.number.greaterThanOrEquals("xOffset",t,0),b.typeOf.number.greaterThanOrEquals("yOffset",n,0),b.typeOf.number.lessThanOrEquals("xOffset + options.source.width",t+e.source.width,this._width),b.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 f=this._width,h=this._height,_=this._internalFormat,g=this._pixelFormat,p=this._pixelDatatype,y=this._preMultiplyAlpha,C=this._flipY,T=A(e.skipColorSpaceConversion,!1);let E=4;l(u)&&(E=nt.alignmentInBytes(g,p,a)),r.pixelStorei(r.UNPACK_ALIGNMENT,E),T?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===f&&c===h)l(u)?(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),C&&(u=nt.flipY(u,g,p,f,h)),r.texImage2D(s,0,_,f,h,0,g,Ke.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,C),r.texImage2D(s,0,_,g,Ke.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=nt.createTypedArray(g,p,f,h);r.texImage2D(s,0,_,f,h,0,g,Ke.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),C&&(u=nt.flipY(u,g,p,a,c)),r.texSubImage2D(s,0,t,n,a,c,g,Ke.toWebGLConstant(p,o),u)):(r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,C),r.texSubImage2D(s,0,t,n,g,Ke.toWebGLConstant(p,o),i))),r.bindTexture(s,null)};zt.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),nt.isDepthFormat(this._pixelFormat))throw new x("Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(this._pixelDatatype===Ke.FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.");if(this._pixelDatatype===Ke.HALF_FLOAT)throw new x("Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT.");if(nt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call copyFrom with a compressed texture pixel format.");b.typeOf.number.greaterThanOrEquals("xOffset",e,0),b.typeOf.number.greaterThanOrEquals("yOffset",t,0),b.typeOf.number.greaterThanOrEquals("framebufferXOffset",n,0),b.typeOf.number.greaterThanOrEquals("framebufferYOffset",i,0),b.typeOf.number.lessThanOrEquals("xOffset + width",e+o,this._width),b.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};zt.prototype.generateMipmap=function(e){if(e=A(e,My.DONT_CARE),nt.isDepthFormat(this._pixelFormat))throw new x("Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL.");if(nt.isCompressedFormat(this._pixelFormat))throw new x("Cannot call generateMipmap with a compressed pixel format.");if(!this._context.webgl2){if(this._width>1&&!N.isPowerOfTwo(this._width))throw new x("width must be a power of two to call generateMipmap() in a WebGL1 context.");if(this._height>1&&!N.isPowerOfTwo(this._height))throw new x("height must be a power of two to call generateMipmap() in a WebGL1 context.")}if(!My.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)};zt.prototype.isDestroyed=function(){return!1};zt.prototype.destroy=function(){return this._context._gl.deleteTexture(this._texture),Ue(this)};function x_(){this._textures={},this._numberOfTextures=0,this._texturesToRelease={}}Object.defineProperties(x_.prototype,{numberOfTextures:{get:function(){return this._numberOfTextures}}});x_.prototype.getTexture=function(e){const t=this._textures[e];if(l(t))return delete this._texturesToRelease[e],++t.count,t.texture};x_.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};x_.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={}};x_.prototype.isDestroyed=function(){return!1};x_.prototype.destroy=function(){const e=this._textures;for(const t in e)e.hasOwnProperty(t)&&e[t].texture.finalDestroy();return Ue(this)};function wn(){this.high=d.clone(d.ZERO),this.low=d.clone(d.ZERO)}wn.encode=function(e,t){b.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 Sf={high:0,low:0};wn.fromCartesian=function(e,t){b.typeOf.object("cartesian",e),l(t)||(t=new wn);const n=t.high,i=t.low;return wn.encode(e.x,Sf),n.x=Sf.high,i.x=Sf.low,wn.encode(e.y,Sf),n.y=Sf.high,i.y=Sf.low,wn.encode(e.z,Sf),n.z=Sf.high,i.z=Sf.low,t};const DI=new wn;wn.writeElements=function(e,t,n){b.defined("cartesianArray",t),b.typeOf.number("index",n),b.typeOf.number.greaterThanOrEquals("index",n,0),wn.fromCartesian(e,DI);const i=DI.high,o=DI.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 St(e,t){if(b.typeOf.object("normal",e),!N.equalsEpsilon(d.magnitude(e),1,N.EPSILON6))throw new x("normal must be normalized.");b.typeOf.number("distance",t),this.normal=d.clone(e),this.distance=t}St.fromPointNormal=function(e,t,n){if(b.typeOf.object("point",e),b.typeOf.object("normal",t),!N.equalsEpsilon(d.magnitude(t),1,N.EPSILON6))throw new x("normal must be normalized.");const i=-d.dot(t,e);return l(n)?(d.clone(t,n.normal),n.distance=i,n):new St(t,i)};const $ge=new d;St.fromCartesian4=function(e,t){b.typeOf.object("coefficients",e);const n=d.fromCartesian4(e,$ge),i=e.w;if(!N.equalsEpsilon(d.magnitude(n),1,N.EPSILON6))throw new x("normal must be normalized.");return l(t)?(d.clone(n,t.normal),t.distance=i,t):new St(n,i)};St.getPointDistance=function(e,t){return b.typeOf.object("plane",e),b.typeOf.object("point",t),d.dot(e.normal,t)+e.distance};const Xge=new d;St.projectPointOntoPlane=function(e,t,n){b.typeOf.object("plane",e),b.typeOf.object("point",t),l(n)||(n=new d);const i=St.getPointDistance(e,t),o=d.multiplyByScalar(e.normal,i,Xge);return d.subtract(t,o,n)};const Kge=new B,Jge=new oe,Qge=new d;St.transform=function(e,t,n){b.typeOf.object("plane",e),b.typeOf.object("transform",t);const i=e.normal,o=e.distance,r=B.inverseTranspose(t,Kge);let s=oe.fromElements(i.x,i.y,i.z,o,Jge);s=B.multiplyByVector(r,s,s);const a=d.fromCartesian4(s,Qge);return s=oe.divideByScalar(s,d.magnitude(a),s),St.fromCartesian4(s,n)};St.clone=function(e,t){return b.typeOf.object("plane",e),l(t)?(d.clone(e.normal,t.normal),t.distance=e.distance,t):new St(e.normal,e.distance)};St.equals=function(e,t){return b.typeOf.object("left",e),b.typeOf.object("right",t),e.distance===t.distance&&d.equals(e.normal,t.normal)};St.ORIGIN_XY_PLANE=Object.freeze(new St(d.UNIT_Z,0));St.ORIGIN_YZ_PLANE=Object.freeze(new St(d.UNIT_X,0));St.ORIGIN_ZX_PLANE=Object.freeze(new St(d.UNIT_Y,0));function Ko(e){this.planes=A(e,[])}const zC=[new d,new d,new d];d.clone(d.UNIT_X,zC[0]);d.clone(d.UNIT_Y,zC[1]);d.clone(d.UNIT_Z,zC[2]);const th=new d,Zge=new d,nj=new St(new d(1,0,0),0);Ko.fromBoundingSphere=function(e,t){if(!l(e))throw new x("boundingSphere is required.");l(t)||(t=new Ko);const n=zC.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=zC[a];let u=i[s],f=i[s+1];l(u)||(u=i[s]=new oe),l(f)||(f=i[s+1]=new oe),d.multiplyByScalar(c,-r,th),d.add(o,th,th),u.x=c.x,u.y=c.y,u.z=c.z,u.w=-d.dot(c,th),d.multiplyByScalar(c,r,th),d.add(o,th,th),f.x=-c.x,f.y=-c.y,f.z=-c.z,f.w=-d.dot(d.negate(c,Zge),th),s+=2}return t};Ko.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(St.fromCartesian4(t[i],nj));if(r===mn.OUTSIDE)return mn.OUTSIDE;r===mn.INTERSECTING&&(n=!0)}return n?mn.INTERSECTING:mn.INSIDE};Ko.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===Ko.MASK_OUTSIDE||t===Ko.MASK_INSIDE)return t;let n=Ko.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(St.fromCartesian4(i[o],nj));if(a===mn.OUTSIDE)return Ko.MASK_OUTSIDE;a===mn.INTERSECTING&&(n|=s)}return n};Ko.MASK_OUTSIDE=4294967295;Ko.MASK_INSIDE=0;Ko.MASK_INDETERMINATE=2147483647;function Bo(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 Ko,this._orthographicMatrix=new B}function ij(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(Bo.prototype,{projectionMatrix:{get:function(){return ij(this),this._orthographicMatrix}}});const eye=new d,tye=new d,nye=new d,II=new d;Bo.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,f=d.cross(t,n,eye);d.normalize(f,f);const h=tye;d.multiplyByScalar(t,c,h),d.add(e,h,h);const _=nye;d.multiplyByScalar(f,a,_),d.add(h,_,_);let g=i[0];return l(g)||(g=i[0]=new oe),g.x=f.x,g.y=f.y,g.z=f.z,g.w=-d.dot(f,_),d.multiplyByScalar(f,s,_),d.add(h,_,_),g=i[1],l(g)||(g=i[1]=new oe),g.x=-f.x,g.y=-f.y,g.z=-f.z,g.w=-d.dot(d.negate(f,II),_),d.multiplyByScalar(n,r,_),d.add(h,_,_),g=i[2],l(g)||(g=i[2]=new oe),g.x=n.x,g.y=n.y,g.z=n.z,g.w=-d.dot(n,_),d.multiplyByScalar(n,o,_),d.add(h,_,_),g=i[3],l(g)||(g=i[3]=new oe),g.x=-n.x,g.y=-n.y,g.z=-n.z,g.w=-d.dot(d.negate(n,II),_),g=i[4],l(g)||(g=i[4]=new oe),g.x=t.x,g.y=t.y,g.z=t.z,g.w=-d.dot(t,h),d.multiplyByScalar(t,u,_),d.add(e,_,_),g=i[5],l(g)||(g=i[5]=new oe),g.x=-t.x,g.y=-t.y,g.z=-t.z,g.w=-d.dot(d.negate(t,II),_),this._cullingVolume};Bo.prototype.getPixelDimensions=function(e,t,n,i,o){if(ij(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};Bo.prototype.clone=function(e){return l(e)||(e=new Bo),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};Bo.prototype.equals=function(e){return l(e)&&e instanceof Bo&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Bo.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof Bo&&N.equalsEpsilon(this.right,e.right,t,n)&&N.equalsEpsilon(this.left,e.left,t,n)&&N.equalsEpsilon(this.top,e.top,t,n)&&N.equalsEpsilon(this.bottom,e.bottom,t,n)&&N.equalsEpsilon(this.near,e.near,t,n)&&N.equalsEpsilon(this.far,e.far,t,n)};function Ft(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new Bo,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}Ft.packedLength=4;Ft.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),t[n++]=e.width,t[n++]=e.aspectRatio,t[n++]=e.near,t[n]=e.far,t};Ft.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new Ft),n.width=e[t++],n.aspectRatio=e[t++],n.near=e[t++],n.far=e[t],n};function Km(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(Ft.prototype,{projectionMatrix:{get:function(){return Km(this),this._offCenterFrustum.projectionMatrix}}});Ft.prototype.computeCullingVolume=function(e,t,n){return Km(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};Ft.prototype.getPixelDimensions=function(e,t,n,i,o){return Km(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};Ft.prototype.clone=function(e){return l(e)||(e=new Ft),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};Ft.prototype.equals=function(e){return!l(e)||!(e instanceof Ft)?!1:(Km(this),Km(e),this.width===e.width&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};Ft.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof Ft)?!1:(Km(this),Km(e),N.equalsEpsilon(this.width,e.width,t,n)&&N.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};const CN={};function iye(e){const t=6.239996+.0172019696544*e;return .001657*Math.sin(t+.01671*Math.sin(t))}const oye=32.184,rye=2451545;function oj(e,t){t=ne.addSeconds(e,oye,t);const n=ne.totalDays(t)-rye;return t=ne.addSeconds(t,iye(n),t),t}const sS=new ne(2451545,0,zn.TAI),sye=1e3,Lc=N.RADIANS_PER_DEGREE,Ga=N.RADIANS_PER_ARCSECOND,xs=14959787e4,Ez=new J;function rj(e,t,n,i,o,r,s){if(n<0&&(n=-n,o+=N.PI),n<0||n>N.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,f=cye(r-i,t);if(aye(t,0)==="Hyperbolic"&&Math.abs(N.negativePiToPi(f))>=Math.acos(-1/t))throw new x("The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola.");dye(c,n,u,Ez);const _=a*(1+t),g=Math.cos(f),p=Math.sin(f),y=1+t*g;if(y<=N.Epsilon10)throw new x("elements cannot be converted to cartesian");const C=_/y;return l(s)?(s.x=C*g,s.y=C*p,s.z=0):s=new d(C*g,C*p,0),J.multiplyByVector(Ez,s,s)}function aye(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 cye(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=uye(e,t);return fye(n,t)}const xz=50,lye=N.EPSILON8;function uye(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=Math.floor(e/N.TWO_PI);e-=n*N.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<xz&&Math.abs(o-i)>lye;++r){o=i;const s=o-t*Math.sin(o)-e,a=1-t*Math.cos(o);i=o-s/a}if(r>=xz)throw new x("Kepler equation did not converge");return o=i+n*N.TWO_PI,o}function fye(e,t){if(t<0||t>=1)throw new x("eccentricity out of range.");const n=Math.floor(e/N.TWO_PI);e-=n*N.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=N.zeroToTwoPi(r),e<0&&(r-=N.TWO_PI),r+=n*N.TWO_PI,r}function dye(e,t,n,i){if(t<0||t>N.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 hye=1.0000010178*xs,pye=100.46645683*Lc,mye=129597742283429e-5*Ga,wz=16002,Sz=21863,vz=32004,Dz=10931,Iz=14529,Pz=16368,Oz=15318,Lz=32794,_ye=64*1e-7*xs,gye=-152*1e-7*xs,yye=62*1e-7*xs,Aye=-8*1e-7*xs,Cye=32*1e-7*xs,Tye=-41*1e-7*xs,bye=19*1e-7*xs,Eye=-11*1e-7*xs,xye=-150*1e-7*xs,wye=-46*1e-7*xs,Sye=68*1e-7*xs,vye=54*1e-7*xs,Dye=14*1e-7*xs,Iye=24*1e-7*xs,Pye=-28*1e-7*xs,Oye=22*1e-7*xs,Bz=10,Rz=16002,Nz=21863,Mz=10931,Fz=1473,zz=32004,Uz=4387,Hz=73,Lye=-325*1e-7,Bye=-322*1e-7,Rye=-79*1e-7,Nye=232*1e-7,Mye=-52*1e-7,Fye=97*1e-7,zye=55*1e-7,Uye=-41*1e-7,Hye=-105*1e-7,Vye=-137*1e-7,kye=258*1e-7,Gye=35*1e-7,Wye=-116*1e-7,jye=-88*1e-7,qye=-112*1e-7,Yye=-80*1e-7,sy=new ne(0,0,zn.TAI);function $ye(e,t){oj(e,sy);const i=(sy.dayNumber-sS.dayNumber+(sy.secondsOfDay-sS.secondsOfDay)/Ti.SECONDS_PER_DAY)/(Ti.DAYS_PER_JULIAN_CENTURY*10),o=.3595362*i,r=hye+_ye*Math.cos(wz*o)+xye*Math.sin(wz*o)+gye*Math.cos(Sz*o)+wye*Math.sin(Sz*o)+yye*Math.cos(vz*o)+Sye*Math.sin(vz*o)+Aye*Math.cos(Dz*o)+vye*Math.sin(Dz*o)+Cye*Math.cos(Iz*o)+Dye*Math.sin(Iz*o)+Tye*Math.cos(Pz*o)+Iye*Math.sin(Pz*o)+bye*Math.cos(Oz*o)+Pye*Math.sin(Oz*o)+Eye*Math.cos(Lz*o)+Oye*Math.sin(Lz*o),s=pye+mye*i+Lye*Math.cos(Bz*o)+Hye*Math.sin(Bz*o)+Bye*Math.cos(Rz*o)+Vye*Math.sin(Rz*o)+Rye*Math.cos(Nz*o)+kye*Math.sin(Nz*o)+Nye*Math.cos(Mz*o)+Gye*Math.sin(Mz*o)+Mye*Math.cos(Fz*o)+Wye*Math.sin(Fz*o)+Fye*Math.cos(zz*o)+jye*Math.sin(zz*o)+zye*Math.cos(Uz*o)+qye*Math.sin(Uz*o)+Uye*Math.cos(Hz*o)+Yye*Math.sin(Hz*o),a=.0167086342-.0004203654*i,c=102.93734808*Lc+11612.3529*Ga*i,u=469.97289*Ga*i,f=174.87317577*Lc-8679.27034*Ga*i;return rj(r,a,u,c,f,s,t)}function sj(e,t){oj(e,sy);const i=(sy.dayNumber-sS.dayNumber+(sy.secondsOfDay-sS.secondsOfDay)/Ti.SECONDS_PER_DAY)/Ti.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*Lc;let f=-8e-5*i+.02966*o-42e-6*r-13e-8*s;const h=83.35324312*Lc;let _=146434202669e-4*i-38.2702*o-.045047*r+21301e-8*s;const g=125.04455501*Lc;let p=-69679193631e-4*i+6.3602*o+.007625*r-3586e-8*s;const y=218.31664563*Lc;let C=17325593434847e-4*i-6.391*o+.006588*r-3169e-8*s;const T=297.85019547*Lc+Ga*(1602961601209e-3*i-6.3706*o+.006593*r-3169e-8*s),E=93.27209062*Lc+Ga*(17395272628478e-4*i-12.7512*o-.001037*r+417e-8*s),w=134.96340251*Lc+Ga*(17179159232178e-4*i+31.8792*o+.051635*r-2447e-7*s),S=357.52910918*Lc+Ga*(1295965810481e-4*i-.5532*o+136e-6*r-1149e-8*s),P=310.17137918*Lc-Ga*(6967051436e-3*i+6.2068*o+.007618*r-3219e-8*s),O=2*T,z=4*T,R=6*T,F=2*w,H=3*w,v=4*w,I=2*E;a+=3400.4*Math.cos(O)-635.6*Math.cos(O-w)-235.6*Math.cos(w)+218.1*Math.cos(O-S)+181*Math.cos(O+w),c+=.014216*Math.cos(O-w)+.008551*Math.cos(O-F)-.001383*Math.cos(w)+.001356*Math.cos(O+w)-.001147*Math.cos(z-H)-914e-6*Math.cos(z-F)+869e-6*Math.cos(O-S-w)-627e-6*Math.cos(O)-394e-6*Math.cos(z-v)+282e-6*Math.cos(O-S-F)-279e-6*Math.cos(T-w)-236e-6*Math.cos(F)+231e-6*Math.cos(z)+229e-6*Math.cos(R-v)-201e-6*Math.cos(F-I),f+=486.26*Math.cos(O-I)-40.13*Math.cos(O)+37.51*Math.cos(I)+25.73*Math.cos(F-I)+19.97*Math.cos(O-S-I),_+=-55609*Math.sin(O-w)-34711*Math.sin(O-F)-9792*Math.sin(w)+9385*Math.sin(z-H)+7505*Math.sin(z-F)+5318*Math.sin(O+w)+3484*Math.sin(z-v)-3417*Math.sin(O-S-w)-2530*Math.sin(R-v)-2376*Math.sin(O)-2075*Math.sin(O-H)-1883*Math.sin(F)-1736*Math.sin(R-5*w)+1626*Math.sin(S)-1370*Math.sin(R-H),p+=-5392*Math.sin(O-I)-540*Math.sin(S)-441*Math.sin(O)+423*Math.sin(I)-288*Math.sin(F-I),C+=-3332.9*Math.sin(O)+1197.4*Math.sin(O-w)-662.5*Math.sin(S)+396.3*Math.sin(w)-218*Math.sin(O-S);const m=2*P,D=3*P;f+=46.997*Math.cos(P)*i-.614*Math.cos(O-I+P)*i+.614*Math.cos(O-I-P)*i-.0297*Math.cos(m)*o-.0335*Math.cos(P)*o+.0012*Math.cos(O-I+m)*o-16e-5*Math.cos(P)*r+4e-5*Math.cos(D)*r+4e-5*Math.cos(m)*r;const L=2.116*Math.sin(P)*i-.111*Math.sin(O-I-P)*i-.0015*Math.sin(P)*o;_+=L,C+=L,p+=-520.77*Math.sin(P)*i+13.66*Math.sin(O-I+P)*i+1.12*Math.sin(O-P)*i-1.06*Math.sin(I-P)*i+.66*Math.sin(m)*o+.371*Math.sin(P)*o-.035*Math.sin(O-I+m)*o-.015*Math.sin(O-I+P)*o+.0014*Math.sin(P)*r-.0011*Math.sin(D)*r-9e-4*Math.sin(m)*r,a*=sye;const M=u+f*Ga,V=h+_*Ga,k=y+C*Ga,W=g+p*Ga;return rj(a,c,M,V,W,k,t)}const Vz=.012300034,Xye=Vz/(Vz+1)*-1;function Kye(e,t){return t=sj(e,t),d.multiplyByScalar(t,Xye,t)}const aj=new J(1.0000000000000002,5619723173785822e-31,4690511510146299e-34,-5154129427414611e-31,.9174820620691819,-.39777715593191376,-223970096136568e-30,.39777715593191376,.9174820620691819);let N0=new d;CN.computeSunPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ne.now()),l(t)||(t=new d),N0=$ye(e,N0),t=d.negate(N0,t),Kye(e,N0),d.subtract(t,N0,t),J.multiplyByVector(aj,t,t),t};CN.computeMoonPositionInEarthInertialFrame=function(e,t){return l(e)||(e=ne.now()),t=sj(e,t),J.multiplyByVector(aj,t,t),t};const EL=CN,ew={MORPHING:0,COLUMBUS_VIEW:1,SCENE2D:2,SCENE3D:3};ew.getMorphTime=function(e){return e===ew.SCENE3D?1:e===ew.MORPHING?void 0:0};const le=Object.freeze(ew);function bv(e){e=A(e,A.EMPTY_OBJECT),this.color=U.clone(A(e.color,U.WHITE)),this.intensity=A(e.intensity,2)}function i0(){this.globeDepthTexture=void 0,this.gamma=void 0,this._viewport=new qe,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 wn,this._cameraPosition=new d,this._sunPositionWC=new d,this._sunPositionColumbusView=new d,this._sunDirectionWC=new d,this._sunDirectionEC=new d,this._moonDirectionEC=new d,this._lightDirectionWC=new d,this._lightDirectionEC=new d,this._lightColor=new d,this._lightColorHdr=new d,this._pass=void 0,this._mode=void 0,this._mapProjection=void 0,this._ellipsoid=void 0,this._cameraDirection=new d,this._cameraRight=new d,this._cameraUp=new d,this._frustum2DWidth=0,this._eyeHeight=0,this._eyeHeight2D=new j,this._pixelRatio=1,this._orthographicIn3D=!1,this._backgroundColor=new U,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(i0.prototype,{frameState:{get:function(){return this._frameState}},viewport:{get:function(){return this._viewport},set:function(e){if(!qe.equals(e,this._viewport)){qe.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 kz(this),this._viewportOrthographicMatrix}},viewportTransformation:{get:function(){return kz(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 PI(this),this._view3D}},viewRotation:{get:function(){return PI(this),this._viewRotation}},viewRotation3D:{get:function(){return PI(this),this._viewRotation3D}},inverseView:{get:function(){return this._inverseView}},inverseView3D:{get:function(){return jz(this),this._inverseView3D}},inverseViewRotation:{get:function(){return this._inverseViewRotation}},inverseViewRotation3D:{get:function(){return jz(this),this._inverseViewRotation3D}},projection:{get:function(){return this._projection}},inverseProjection:{get:function(){return s0e(this),this._inverseProjection}},infiniteProjection:{get:function(){return this._infiniteProjection}},modelView:{get:function(){return a0e(this),this._modelView}},modelView3D:{get:function(){return c0e(this),this._modelView3D}},modelViewRelativeToEye:{get:function(){return p0e(this),this._modelViewRelativeToEye}},inverseModelView:{get:function(){return l0e(this),this._inverseModelView}},inverseModelView3D:{get:function(){return u0e(this),this._inverseModelView3D}},viewProjection:{get:function(){return f0e(this),this._viewProjection}},inverseViewProjection:{get:function(){return d0e(this),this._inverseViewProjection}},modelViewProjection:{get:function(){return h0e(this),this._modelViewProjection}},inverseModelViewProjection:{get:function(){return m0e(this),this._inverseModelViewProjection}},modelViewProjectionRelativeToEye:{get:function(){return _0e(this),this._modelViewProjectionRelativeToEye}},modelViewInfiniteProjection:{get:function(){return g0e(this),this._modelViewInfiniteProjection}},normal:{get:function(){return y0e(this),this._normal}},normal3D:{get:function(){return A0e(this),this._normal3D}},inverseNormal:{get:function(){return C0e(this),this._inverseNormal}},inverseNormal3D:{get:function(){return T0e(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 Wz(this),this._encodedCameraPositionMC.high}},encodedCameraPositionMCLow:{get:function(){return Wz(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,pe.WGS84)}}});function Jye(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 Qye(e,t){B.clone(t,e._inverseView),B.getMatrix3(t,e._inverseViewRotation)}function Zye(e,t){B.clone(t,e._projection),e._inverseProjectionDirty=!0,e._viewProjectionDirty=!0,e._inverseViewProjectionDirty=!0,e._modelViewProjectionDirty=!0,e._modelViewProjectionRelativeToEyeDirty=!0}function e0e(e,t){B.clone(t,e._infiniteProjection),e._modelViewInfiniteProjectionDirty=!0}function t0e(e,t){d.clone(t.positionWC,e._cameraPosition),d.clone(t.directionWC,e._cameraDirection),d.clone(t.rightWC,e._cameraRight),d.clone(t.upWC,e._cameraUp);const n=t.positionCartographic;l(n)?e._eyeHeight=n.height:e._eyeHeight=-e._ellipsoid.maximumRadius,e._encodedCameraPositionMCDirty=!0}let M0=new J;const n0e=new Ae;function i0e(e,t){l(tn.computeIcrfToFixedMatrix(t.time,M0))||(M0=tn.computeTemeToPseudoFixedMatrix(t.time,M0));let n=EL.computeSunPositionInEarthInertialFrame(t.time,e._sunPositionWC);J.multiplyByVector(M0,n,n),d.normalize(n,e._sunDirectionWC),n=J.multiplyByVector(e.viewRotation3D,n,e._sunDirectionEC),d.normalize(n,n),n=EL.computeMoonPositionInEarthInertialFrame(t.time,e._moonDirectionEC),J.multiplyByVector(M0,n,n),J.multiplyByVector(e.viewRotation3D,n,n),d.normalize(n,n);const i=t.mapProjection,r=i.ellipsoid.cartesianToCartographic(e._sunPositionWC,n0e);i.project(r,e._sunPositionColumbusView)}i0.prototype.updateCamera=function(e){Jye(this,e.viewMatrix),Qye(this,e.inverseViewMatrix),t0e(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 Ft};i0.prototype.updateFrustum=function(e){Zye(this,e.projectionMatrix),l(e.infiniteProjectionMatrix)&&e0e(this,e.infiniteProjectionMatrix),this._currentFrustum.x=e.near,this._currentFrustum.y=e.far,this._farDepthFromNearPlusOne=e.far-e.near+1,this._log2FarDepthFromNearPlusOne=N.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};i0.prototype.updatePass=function(e){this._pass=e};const o0e=[],r0e=new bv;i0.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),i0e(this,e);const n=A(e.light,r0e);n instanceof bv?(this._lightDirectionWC=d.clone(this._sunDirectionWC,this._lightDirectionWC),this._lightDirectionEC=d.clone(this._sunDirectionEC,this._lightDirectionEC)):(this._lightDirectionWC=d.normalize(d.negate(n.direction,this._lightDirectionWC),this._lightDirectionWC),this._lightDirectionEC=J.multiplyByVector(this.viewRotation3D,this._lightDirectionWC,this._lightDirectionEC));const i=n.color;let o=d.fromElements(i.red,i.green,i.blue,this._lightColorHdr);o=d.multiplyByScalar(o,n.intensity,o);const r=d.maximumComponent(o);r>1?d.divideByScalar(o,r,this._lightColor):d.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,o0e),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=tn.computeTemeToPseudoFixedMatrix(e.time,this._temeToPseudoFixed),this._splitPosition=e.splitPosition*e.context.drawingBufferWidth;const c=t.frustum.fov,u=this._viewport;let f;l(c)?u.height>u.width?f=Math.tan(.5*c)*2/u.height:f=Math.tan(.5*c)*2/u.width:f=1/Math.max(u.width,u.height),this._geometricToleranceOverMeter=f*e.maximumScreenSpaceError,U.clone(e.backgroundColor,this._backgroundColor),this._minimumDisableDepthTestDistance=e.minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance*=this._minimumDisableDepthTestDistance,this._minimumDisableDepthTestDistance===Number.POSITIVE_INFINITY&&(this._minimumDisableDepthTestDistance=-1)};function kz(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 s0e(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 a0e(e){e._modelViewDirty&&(e._modelViewDirty=!1,B.multiplyTransformation(e._view,e._model,e._modelView))}function c0e(e){e._modelView3DDirty&&(e._modelView3DDirty=!1,B.multiplyTransformation(e.view3D,e._model,e._modelView3D))}function l0e(e){e._inverseModelViewDirty&&(e._inverseModelViewDirty=!1,B.inverse(e.modelView,e._inverseModelView))}function u0e(e){e._inverseModelView3DDirty&&(e._inverseModelView3DDirty=!1,B.inverse(e.modelView3D,e._inverseModelView3D))}function f0e(e){e._viewProjectionDirty&&(e._viewProjectionDirty=!1,B.multiply(e._projection,e._view,e._viewProjection))}function d0e(e){e._inverseViewProjectionDirty&&(e._inverseViewProjectionDirty=!1,B.inverse(e.viewProjection,e._inverseViewProjection))}function h0e(e){e._modelViewProjectionDirty&&(e._modelViewProjectionDirty=!1,B.multiply(e._projection,e.modelView,e._modelViewProjection))}function p0e(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 m0e(e){e._inverseModelViewProjectionDirty&&(e._inverseModelViewProjectionDirty=!1,B.inverse(e.modelViewProjection,e._inverseModelViewProjection))}function _0e(e){e._modelViewProjectionRelativeToEyeDirty&&(e._modelViewProjectionRelativeToEyeDirty=!1,B.multiply(e._projection,e.modelViewRelativeToEye,e._modelViewProjectionRelativeToEye))}function g0e(e){e._modelViewInfiniteProjectionDirty&&(e._modelViewInfiniteProjectionDirty=!1,B.multiply(e._infiniteProjection,e.modelView,e._modelViewInfiniteProjection))}function y0e(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 A0e(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 C0e(e){e._inverseNormalDirty&&(e._inverseNormalDirty=!1,B.getMatrix3(e.inverseModelView,e._inverseNormal),J.getRotation(e._inverseNormal,e._inverseNormal))}function T0e(e){e._inverseNormal3DDirty&&(e._inverseNormal3DDirty=!1,B.getMatrix3(e.inverseModelView3D,e._inverseNormal3D),J.getRotation(e._inverseNormal3D,e._inverseNormal3D))}const Gz=new d;function Wz(e){e._encodedCameraPositionMCDirty&&(e._encodedCameraPositionMCDirty=!1,B.multiplyByPoint(e.inverseModel,e._cameraPosition,Gz),wn.fromCartesian(Gz,e._encodedCameraPositionMC))}const b0e=new d,E0e=new d,x0e=new d,w0e=new d,S0e=new Ae,v0e=new d,D0e=new B;function I0e(e,t,n,i,o,r,s,a){const c=b0e;c.x=e.y,c.y=e.z,c.z=e.x;const u=E0e;u.x=n.y,u.y=n.z,u.z=n.x;const f=x0e;f.x=i.y,f.y=i.z,f.z=i.x;const h=w0e;h.x=t.y,h.y=t.z,h.z=t.x,r===le.SCENE2D&&(c.z=o*.5);const _=s.unproject(c,S0e);_.longitude=N.clamp(_.longitude,-Math.PI,Math.PI),_.latitude=N.clamp(_.latitude,-N.PI_OVER_TWO,N.PI_OVER_TWO);const g=s.ellipsoid,p=g.cartographicToCartesian(_,v0e),y=tn.eastNorthUpToFixedFrame(p,g,D0e);return B.multiplyByPointAsVector(y,u,u),B.multiplyByPointAsVector(y,f,f),B.multiplyByPointAsVector(y,h,h),l(a)||(a=new B),a[0]=u.x,a[1]=f.x,a[2]=-h.x,a[3]=0,a[4]=u.y,a[5]=f.y,a[6]=-h.y,a[7]=0,a[8]=u.z,a[9]=f.z,a[10]=-h.z,a[11]=0,a[12]=-d.dot(u,p),a[13]=-d.dot(f,p),a[14]=d.dot(h,p),a[15]=1,a}function PI(e){e._view3DDirty&&(e._mode===le.SCENE3D?B.clone(e._view,e._view3D):I0e(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 jz(e){e._inverseView3DDirty&&(B.inverseTransformation(e.view3D,e._inverseView3D),B.getMatrix3(e._inverseView3D,e._inverseViewRotation3D),e._inverseView3DDirty=!1)}function P0e(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 cj(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 to(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context),b.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,f=i.length;for(r=0;r<f;++r)P0e(s,i[r],r,t);for(f=s.length,r=0;r<f;++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<f;++r)s[r].instanceDivisor>0&&(c=!0),l(s[r].value)&&(u=!0);const h={};for(r=0;r<f;++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 _;t.vertexArrayObject&&(_=t.glCreateVertexArray(),t.glBindVertexArray(_),cj(n,s,o),t.glBindVertexArray(null)),this._numberOfVertices=a,this._hasInstancedAttributes=c,this._hasConstantAttributes=u,this._context=t,this._gl=n,this._vao=_,this._attributes=s,this._indexBuffer=o}function qz(e){return e.values.length/e.componentsPerAttribute}function O0e(e){return ee.getSizeInBytes(e.componentDatatype)*e.componentsPerAttribute}function L0e(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=qz(e[o[0]]),t=1;t<s;++t){const u=qz(e[o[t]]);if(u!==r)throw new Se(`Each attribute list must have the same number of vertices. Attribute ${o[t]} has a different number of vertices (${u.toString()}) than attribute ${o[0]} (${r.toString()}).`)}o.sort(function(u,f){return ee.getSizeInBytes(e[f].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+=O0e(i);if(a>0){const u=ee.getSizeInBytes(e[o[0]].componentDatatype),f=a%u;f!==0&&(a+=u-f);const h=r*a,_=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,_),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,C=g[n],T=C.pointer,E=i.componentsPerAttribute;for(let w=0;w<E;++w)T[C.index+w]=y[t*E+w];C.index+=C.strideInComponentType}return{buffer:_,offsetsInBytes:c,vertexSizeInBytes:a}}}to.fromGeometry=function(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context);const t=e.context,n=A(e.geometry,A.EMPTY_OBJECT),i=A(e.bufferUsage,Ze.DYNAMIC_DRAW),o=A(e.attributeLocations,A.EMPTY_OBJECT),r=A(e.interleave,!1),s=e.vertexArrayAttributes;let a,c,u;const f=l(s)?s:[],h=n.attributes;if(r){const p=L0e(h);if(l(p)){u=At.createVertexBuffer({context:t,typedArray:p.buffer,usage:i});const y=p.offsetsInBytes,C=p.vertexSizeInBytes;for(a in h)h.hasOwnProperty(a)&&l(h[a])&&(c=h[a],l(c.values)?f.push({index:o[a],vertexBuffer:u,componentDatatype:c.componentDatatype,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize,offsetInBytes:y[a],strideInBytes:C}):f.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=At.createVertexBuffer({context:t,typedArray:ee.createTypedArray(p,c.values),usage:i})),f.push({index:o[a],vertexBuffer:u,value:c.value,componentDatatype:p,componentsPerAttribute:c.componentsPerAttribute,normalize:c.normalize})}let _;const g=n.indices;return l(g)&&(Dt.computeNumberOfVertices(n)>=N.SIXTY_FOUR_KILOBYTES&&t.elementIndexUint?_=At.createIndexBuffer({context:t,typedArray:new Uint32Array(g),usage:i,indexDatatype:it.UNSIGNED_INT}):_=At.createIndexBuffer({context:t,typedArray:new Uint16Array(g),usage:i,indexDatatype:it.UNSIGNED_SHORT})),new to({context:t,attributes:f,indexBuffer:_})};Object.defineProperties(to.prototype,{numberOfAttributes:{get:function(){return this._attributes.length}},numberOfVertices:{get:function(){return this._numberOfVertices}},indexBuffer:{get:function(){return this._indexBuffer}}});to.prototype.getAttribute=function(e){return b.defined("index",e),this._attributes[e]};function B0e(e){const t=e._context,n=e._hasInstancedAttributes;if(!n&&!t._previousDrawInstanced)return;t._previousDrawInstanced=n;const i=t._vertexAttribDivisors,o=e._attributes,r=wt.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,f=c.index;u!==i[f]&&(t.glVertexAttribDivisor(f,u),i[f]=u)}}}else for(s=0;s<r;++s)i[s]>0&&(t.glVertexAttribDivisor(s,0),i[s]=0)}function R0e(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)}}to.prototype._bind=function(){l(this._vao)?(this._context.glBindVertexArray(this._vao),this._context.instancedArrays&&B0e(this),this._hasConstantAttributes&&R0e(this,this._gl)):cj(this._gl,this._attributes,this._indexBuffer)};to.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)}};to.prototype.isDestroyed=function(){return!1};to.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),Ue(this)};function Ua(e,t){b.defined("canvas",e);let n=!1;l(t)&&l(t.requestWebgl2)&&(n=t.requestWebgl2,Ua._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):N0e(e,r,o),c=typeof WebGL2RenderingContext<"u"&&a instanceof WebGL2RenderingContext;this._canvas=e,this._originalGLContext=a,this._gl=a,this._webgl2=c,this._id=Es(),this.validateFramebuffer=!1,this.validateShaderProgram=!1,this.logShaderCompilation=!1,this._throwOnWebGLError=!1,this._shaderCache=new iu(this),this._textureCache=new x_;const u=a;this._stencilBits=u.getParameter(u.STENCIL_BITS),wt._maximumCombinedTextureImageUnits=u.getParameter(u.MAX_COMBINED_TEXTURE_IMAGE_UNITS),wt._maximumCubeMapSize=u.getParameter(u.MAX_CUBE_MAP_TEXTURE_SIZE),wt._maximumFragmentUniformVectors=u.getParameter(u.MAX_FRAGMENT_UNIFORM_VECTORS),wt._maximumTextureImageUnits=u.getParameter(u.MAX_TEXTURE_IMAGE_UNITS),wt._maximumRenderbufferSize=u.getParameter(u.MAX_RENDERBUFFER_SIZE),wt._maximumTextureSize=u.getParameter(u.MAX_TEXTURE_SIZE),wt._maximumVaryingVectors=u.getParameter(u.MAX_VARYING_VECTORS),wt._maximumVertexAttributes=u.getParameter(u.MAX_VERTEX_ATTRIBS),wt._maximumVertexTextureImageUnits=u.getParameter(u.MAX_VERTEX_TEXTURE_IMAGE_UNITS),wt._maximumVertexUniformVectors=u.getParameter(u.MAX_VERTEX_UNIFORM_VECTORS),wt._maximumSamples=this._webgl2?u.getParameter(u.MAX_SAMPLES):0;const f=u.getParameter(u.ALIASED_LINE_WIDTH_RANGE);wt._minimumAliasedLineWidth=f[0],wt._maximumAliasedLineWidth=f[1];const h=u.getParameter(u.ALIASED_POINT_SIZE_RANGE);wt._minimumAliasedPointSize=h[0],wt._maximumAliasedPointSize=h[1];const _=u.getParameter(u.MAX_VIEWPORT_DIMS);wt._maximumViewportWidth=_[0],wt._maximumViewportHeight=_[1];const g=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_FLOAT);wt._highpFloatSupported=g.precision!==0;const p=u.getShaderPrecisionFormat(u.FRAGMENT_SHADER,u.HIGH_INT);wt._highpIntSupported=p.rangeMax!==0,this._antialias=u.getContextAttributes().antialias,this._standardDerivatives=!!Mo(u,["OES_standard_derivatives"]),this._blendMinmax=!!Mo(u,["EXT_blend_minmax"]),this._elementIndexUint=!!Mo(u,["OES_element_index_uint"]),this._depthTexture=!!Mo(u,["WEBGL_depth_texture","WEBKIT_WEBGL_depth_texture"]),this._fragDepth=!!Mo(u,["EXT_frag_depth"]),this._debugShaders=Mo(u,["WEBGL_debug_shaders"]),this._textureFloat=!!Mo(u,["OES_texture_float"]),this._textureHalfFloat=!!Mo(u,["OES_texture_half_float"]),this._textureFloatLinear=!!Mo(u,["OES_texture_float_linear"]),this._textureHalfFloatLinear=!!Mo(u,["OES_texture_half_float_linear"]),this._colorBufferFloat=!!Mo(u,["EXT_color_buffer_float","WEBGL_color_buffer_float"]),this._floatBlend=!!Mo(u,["EXT_float_blend"]),this._colorBufferHalfFloat=!!Mo(u,["EXT_color_buffer_half_float"]),this._s3tc=!!Mo(u,["WEBGL_compressed_texture_s3tc","MOZ_WEBGL_compressed_texture_s3tc","WEBKIT_WEBGL_compressed_texture_s3tc"]),this._pvrtc=!!Mo(u,["WEBGL_compressed_texture_pvrtc","WEBKIT_WEBGL_compressed_texture_pvrtc"]),this._astc=!!Mo(u,["WEBGL_compressed_texture_astc"]),this._etc=!!Mo(u,["WEBG_compressed_texture_etc"]),this._etc1=!!Mo(u,["WEBGL_compressed_texture_etc1"]),this._bc7=!!Mo(u,["EXT_texture_compression_bptc"]),b_.setKTX2SupportedFormats(this._s3tc,this._pvrtc,this._astc,this._etc,this._etc1,this._bc7);const y=s?Mo(u,["EXT_texture_filter_anisotropic","WEBKIT_EXT_texture_filter_anisotropic"]):void 0;this._textureFilterAnisotropic=y,wt._maximumTextureFilterAnisotropy=l(y)?u.getParameter(y.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1;let C,T,E,w,S,P,O,z,R,F;if(c){const m=this;C=function(){return m._gl.createVertexArray()},T=function(D){m._gl.bindVertexArray(D)},E=function(D){m._gl.deleteVertexArray(D)},w=function(D,L,M,V,k){u.drawElementsInstanced(D,L,M,V,k)},S=function(D,L,M,V){u.drawArraysInstanced(D,L,M,V)},P=function(D,L){u.vertexAttribDivisor(D,L)},O=function(D){u.drawBuffers(D)}}else z=Mo(u,["OES_vertex_array_object"]),l(z)&&(C=function(){return z.createVertexArrayOES()},T=function(m){z.bindVertexArrayOES(m)},E=function(m){z.deleteVertexArrayOES(m)}),R=Mo(u,["ANGLE_instanced_arrays"]),l(R)&&(w=function(m,D,L,M,V){R.drawElementsInstancedANGLE(m,D,L,M,V)},S=function(m,D,L,M){R.drawArraysInstancedANGLE(m,D,L,M)},P=function(m,D){R.vertexAttribDivisorANGLE(m,D)}),F=Mo(u,["WEBGL_draw_buffers"]),l(F)&&(O=function(m){F.drawBuffersWEBGL(m)});this.glCreateVertexArray=C,this.glBindVertexArray=T,this.glDeleteVertexArray=E,this.glDrawElementsInstanced=w,this.glDrawArraysInstanced=S,this.glVertexAttribDivisor=P,this.glDrawBuffers=O,this._vertexArrayObject=!!z,this._instancedArrays=!!R,this._drawBuffers=!!F,wt._maximumDrawBuffers=this.drawBuffers?u.getParameter(se.MAX_DRAW_BUFFERS):1,wt._maximumColorAttachments=this.drawBuffers?u.getParameter(se.MAX_COLOR_ATTACHMENTS):1,this._clearColor=new U(0,0,0,0),this._clearDepth=1,this._clearStencil=0;const H=new i0,v=new E_(this),I=Qe.fromCache();this._defaultPassState=v,this._defaultRenderState=I,this._defaultTexture=void 0,this._defaultEmissiveTexture=void 0,this._defaultNormalTexture=void 0,this._defaultCubeMap=void 0,this._us=H,this._currentRenderState=I,this._currentPassState=v,this._currentFramebuffer=void 0,this._maxFrameTextureUnitIndex=0,this._vertexAttribDivisors=[],this._previousDrawInstanced=!1;for(let m=0;m<wt._maximumVertexAttributes;m++)this._vertexAttribDivisors.push(0);this._pickObjects={},this._nextPickColor=new Uint32Array(1),this.options={getWebGLStub:i,requestWebgl1:o,webgl:r,allowTextureFilterAnisotropic:s},this.cache={},Qe.apply(u,I,v)}function N0e(e,t,n){if(typeof WebGLRenderingContext>"u")throw new Se("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 Se("The browser supports WebGL, but initialization failed.");return r}function M0e(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 F0e(e,t,n,i){let o=`${M0e(e,i)}: ${t.name}(`;for(let r=0;r<n.length;++r)r!==0&&(o+=", "),o+=n[r];return o+=");",o}function z0e(e,t,n){const i=e.getError();if(i!==e.NO_ERROR)throw new Se(F0e(e,t,n,i))}function U0e(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 H0e(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,U0e(e,o,t))}return i}function Mo(e,t){const n=t.length;for(let i=0;i<n;++i){const o=e.getExtension(t[i]);if(o)return o}}const V0e={};Object.defineProperties(Ua.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=H0e(this._originalGLContext,e?z0e:void 0)}},defaultTexture:{get:function(){return this._defaultTexture===void 0&&(this._defaultTexture=new zt({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 zt({context:this,pixelFormat:nt.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 zt({context:this,pixelFormat:nt.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 nu({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 V0e}}});function k0e(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 lj(e,t,n,i){const o=e._currentRenderState,r=e._currentPassState;e._currentRenderState=t,e._currentPassState=n,Qe.partialApply(e._gl,o,t,r,n,i)}let TN;typeof WebGLRenderingContext<"u"&&(TN=[se.BACK]);function bN(e,t){if(t!==e._currentFramebuffer){e._currentFramebuffer=t;let n=TN;if(l(t))t._bind(),k0e(e),n=t._getActiveColorAttachments();else{const i=e._gl;i.bindFramebuffer(i.FRAMEBUFFER,null)}e.drawBuffers&&e.glDrawBuffers(n)}}const G0e=new Ji;Ua.prototype.clear=function(e,t){e=A(e,G0e),t=A(t,this._defaultPassState);const n=this._gl;let i=0;const o=e.color,r=e.depth,s=e.stencil;l(o)&&(U.equals(this._clearColor,o)||(U.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);lj(this,a,t,!0);const c=A(e.framebuffer,t.framebuffer);bN(this,c),n.clear(i)};function W0e(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.");bN(e,t),lj(e,o,n,!1),i._bind(),e._maxFrameTextureUnitIndex=Math.max(e._maxFrameTextureUnitIndex,i.maximumTextureUnitIndex)}function j0e(e,t,n,i){const o=t._primitiveType,r=t._vertexArray;let s=t._offset,a=t._count;const c=t.instanceCount;if(!Je.validate(o))throw new x("drawCommand.primitiveType is required and must be valid.");if(b.defined("drawCommand.vertexArray",r),b.typeOf.number.greaterThanOrEquals("drawCommand.offset",s,0),l(a)&&b.typeOf.number.greaterThanOrEquals("drawCommand.count",a,0),b.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()}Ua.prototype.draw=function(e,t,n,i){b.defined("drawCommand",e),b.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),W0e(this,o,t,n,r),j0e(this,e,n,i)};Ua.prototype.endFrame=function(){const e=this._gl;e.useProgram(null),this._currentFramebuffer=void 0,e.bindFramebuffer(e.FRAMEBUFFER,null);const t=TN;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)};Ua.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;b.typeOf.number.greaterThan("readState.width",o,0),b.typeOf.number.greaterThan("readState.height",r,0);let a=Ke.UNSIGNED_BYTE;l(s)&&s.numberOfColorAttachments>0&&(a=s.getColorTexture(0).pixelDatatype);const c=nt.createTypedArray(nt.RGBA,a,o,r);return bN(this,s),t.readPixels(n,i,o,r,nt.RGBA,Ke.toWebGLConstant(a,this),c),c};const uj={position:0,textureCoordinates:1};Ua.prototype.getViewportQuadVertexArray=function(){let e=this.cache.viewportQuad_vertexArray;if(!l(e)){const t=new Dt({attributes:{position:new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:[-1,-1,1,-1,1,1,-1,1]}),textureCoordinates:new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:[0,0,1,0,1,1,0,1]})},indices:new Uint16Array([0,1,2,0,2,3]),primitiveType:Je.TRIANGLES});e=to.fromGeometry({context:this,geometry:t,attributeLocations:uj,bufferUsage:Ze.STATIC_DRAW,interleave:!0}),this.cache.viewportQuad_vertexArray=e}return e};Ua.prototype.createViewportQuadCommand=function(e,t){return t=A(t,A.EMPTY_OBJECT),new dt({vertexArray:this.getViewportQuadVertexArray(),primitiveType:Je.TRIANGLES,renderState:t.renderState,shaderProgram:hn.fromCache({context:this,vertexShaderSource:V9,fragmentShaderSource:e,attributeLocations:uj}),uniformMap:t.uniformMap,owner:t.owner,framebuffer:t.framebuffer,pass:t.pass})};Ua.prototype.getObjectByPickColor=function(e){return b.defined("pickColor",e),this._pickObjects[e.toRgba()]};function EN(e,t,n){this._pickObjects=e,this.key=t,this.color=n}Object.defineProperties(EN.prototype,{object:{get:function(){return this._pickObjects[this.key]},set:function(e){this._pickObjects[this.key]=e}}});EN.prototype.destroy=function(){delete this._pickObjects[this.key]};Ua.prototype.createPickId=function(e){b.defined("object",e),++this._nextPickColor[0];const t=this._nextPickColor[0];if(t===0)throw new Se("Out of unique Pick IDs.");return this._pickObjects[t]=e,new EN(this._pickObjects,t,U.fromRgba(t))};Ua.prototype.isDestroyed=function(){return!1};Ua.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(),Ue(this)};Ua._deprecationWarning=Tp;function o0(e){e=A(e,A.EMPTY_OBJECT);const t=e.context,n=e.width,i=e.height;b.defined("options.context",t),b.defined("options.width",n),b.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 zr({context:t,colorRenderbuffers:o,depthStencilRenderbuffer:s,destroyAttachments:e.destroyAttachments}),this._colorFramebuffer=new zr({context:t,colorTextures:r,depthStencilTexture:a,destroyAttachments:e.destroyAttachments})}o0.prototype.getRenderFramebuffer=function(){return this._renderFramebuffer};o0.prototype.getColorFramebuffer=function(){return this._colorFramebuffer};o0.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)};o0.prototype.isDestroyed=function(){return!1};o0.prototype.destroy=function(){return this._renderFramebuffer.destroy(),this._colorFramebuffer.destroy(),Ue(this)};const Oa={RGBA4:se.RGBA4,RGBA8:se.RGBA8,RGBA16F:se.RGBA16F,RGBA32F:se.RGBA32F,RGB5_A1:se.RGB5_A1,RGB565:se.RGB565,DEPTH_COMPONENT16:se.DEPTH_COMPONENT16,STENCIL_INDEX8:se.STENCIL_INDEX8,DEPTH_STENCIL:se.DEPTH_STENCIL,DEPTH24_STENCIL8:se.DEPTH24_STENCIL8,validate:function(e){return e===Oa.RGBA4||e===Oa.RGBA8||e===Oa.RGBA16F||e===Oa.RGBA32F||e===Oa.RGB5_A1||e===Oa.RGB565||e===Oa.DEPTH_COMPONENT16||e===Oa.STENCIL_INDEX8||e===Oa.DEPTH_STENCIL||e===Oa.DEPTH24_STENCIL8},getColorFormat:function(e){return e===se.FLOAT?Oa.RGBA32F:e===se.HALF_FLOAT_OES?Oa.RGBA16F:Oa.RGBA8}},Gf=Object.freeze(Oa);function Ol(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.context",e.context);const n=e.context._gl,i=wt.maximumRenderbufferSize,o=A(e.format,Gf.RGBA4),r=l(e.width)?e.width:n.drawingBufferWidth,s=l(e.height)?e.height:n.drawingBufferHeight,a=A(e.numSamples,1);if(!Gf.validate(o))throw new x("Invalid format.");if(b.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(b.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(Ol.prototype,{format:{get:function(){return this._format}},width:{get:function(){return this._width}},height:{get:function(){return this._height}}});Ol.prototype._getRenderbuffer=function(){return this._renderbuffer};Ol.prototype.isDestroyed=function(){return!1};Ol.prototype.destroy=function(){return this._gl.deleteRenderbuffer(this._renderbuffer),Ue(this)};function En(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(En.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}}});En.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])};En.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,Ke.UNSIGNED_BYTE):void 0),r=A(r,this._color?A(this._pixelFormat,nt.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 zt({context:e,width:t,height:n,pixelFormat:r,pixelDatatype:o,sampler:Yn.NEAREST}),this._numSamples>1){const a=Gf.getColorFormat(o);this._colorRenderbuffers[s]=new Ol({context:e,width:t,height:n,format:a,numSamples:this._numSamples})}}this._depthStencil&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?(this._depthStencilTexture=new zt({context:e,width:t,height:n,pixelFormat:nt.DEPTH_STENCIL,pixelDatatype:Ke.UNSIGNED_INT_24_8,sampler:Yn.NEAREST}),this._numSamples>1&&(this._depthStencilRenderbuffer=new Ol({context:e,width:t,height:n,format:Gf.DEPTH24_STENCIL8,numSamples:this._numSamples}))):this._depthStencilRenderbuffer=new Ol({context:e,width:t,height:n,format:Gf.DEPTH_STENCIL})),this._depth&&this._createDepthAttachments&&(this._supportsDepthTexture&&e.depthTexture?this._depthTexture=new zt({context:e,width:t,height:n,pixelFormat:nt.DEPTH_COMPONENT,pixelDatatype:Ke.UNSIGNED_INT,sampler:Yn.NEAREST}):this._depthRenderbuffer=new Ol({context:e,width:t,height:n,format:Gf.DEPTH_COMPONENT16})),this._numSamples>1?this._multisampleFramebuffer=new o0({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 zr({context:e,colorTextures:this._colorTextures,depthTexture:this._depthTexture,depthRenderbuffer:this._depthRenderbuffer,depthStencilTexture:this._depthStencilTexture,depthStencilRenderbuffer:this._depthStencilRenderbuffer,destroyAttachments:!1})}};En.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]};En.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};En.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]};En.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};En.prototype.getDepthRenderbuffer=function(){return this._depthRenderbuffer};En.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};En.prototype.getDepthTexture=function(){return this._depthTexture};En.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};En.prototype.getDepthStencilRenderbuffer=function(){return this._depthStencilRenderbuffer};En.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};En.prototype.getDepthStencilTexture=function(){return this._depthStencilTexture};En.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};En.prototype.prepareTextures=function(e,t){this._numSamples>1&&this._multisampleFramebuffer.blitFramebuffers(e,t)};En.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this.framebuffer,t.execute(e,n),t.framebuffer=i};En.prototype.destroyFramebuffer=function(){this._framebuffer=this._framebuffer&&this._framebuffer.destroy(),this._multisampleFramebuffer=this._multisampleFramebuffer&&this._multisampleFramebuffer.destroy()};En.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 Fm={VERTEX:0,FRAGMENT:1,BOTH:2};Fm.includesVertexShader=function(e){return b.typeOf.number("destination",e),e===Fm.VERTEX||e===Fm.BOTH};Fm.includesFragmentShader=function(e){return b.typeOf.number("destination",e),e===Fm.FRAGMENT||e===Fm.BOTH};const we=Object.freeze(Fm);function xN(e){this.name=e,this.fields=[]}xN.prototype.addField=function(e,t){const n=` ${e} ${t};`;this.fields.push(n)};xN.prototype.generateGlslLines=function(){let e=this.fields;return e.length===0&&(e=[" float _empty;"]),[].concat(`struct ${this.name}`,"{",e,"};")};function wN(e){this.signature=e,this.body=[]}wN.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}`)};wN.prototype.generateGlslLines=function(){return[].concat(this.signature,"{",this.body,"}")};function oa(){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(oa.prototype,{attributeLocations:{get:function(){return this._attributeLocations}}});oa.prototype.addDefine=function(e,t,n){b.typeOf.string("identifier",e),n=A(n,we.BOTH);let i=e;l(t)&&(i+=` ${t.toString()}`),we.includesVertexShader(n)&&this._vertexShaderParts.defineLines.push(i),we.includesFragmentShader(n)&&this._fragmentShaderParts.defineLines.push(i)};oa.prototype.addStruct=function(e,t,n){b.typeOf.string("structId",e),b.typeOf.string("structName",t),b.typeOf.number("destination",n),this._structs[e]=new xN(t),we.includesVertexShader(n)&&this._vertexShaderParts.structIds.push(e),we.includesFragmentShader(n)&&this._fragmentShaderParts.structIds.push(e)};oa.prototype.addStructField=function(e,t,n){b.typeOf.string("structId",e),b.typeOf.string("type",t),b.typeOf.string("identifier",n),this._structs[e].addField(t,n)};oa.prototype.addFunction=function(e,t,n){b.typeOf.string("functionName",e),b.typeOf.string("signature",t),b.typeOf.number("destination",n),this._functions[e]=new wN(t),we.includesVertexShader(n)&&this._vertexShaderParts.functionIds.push(e),we.includesFragmentShader(n)&&this._fragmentShaderParts.functionIds.push(e)};oa.prototype.addFunctionLines=function(e,t){if(b.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)};oa.prototype.addUniform=function(e,t,n){b.typeOf.string("type",e),b.typeOf.string("identifier",t),n=A(n,we.BOTH);const i=`uniform ${e} ${t};`;we.includesVertexShader(n)&&this._vertexShaderParts.uniformLines.push(i),we.includesFragmentShader(n)&&this._fragmentShaderParts.uniformLines.push(i)};oa.prototype.setPositionAttribute=function(e,t){if(b.typeOf.string("type",e),b.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};oa.prototype.addAttribute=function(e,t){b.typeOf.string("type",e),b.typeOf.string("identifier",t);const n=`attribute ${e} ${t};`;this._attributeLines.push(n);const i=this._nextAttributeLocation;return this._attributeLocations[t]=i,this._nextAttributeLocation+=Y0e(e),i};oa.prototype.addVarying=function(e,t){b.typeOf.string("type",e),b.typeOf.string("identifier",t);const n=`varying ${e} ${t};`;this._vertexShaderParts.varyingLines.push(n),this._fragmentShaderParts.varyingLines.push(n)};oa.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)};oa.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)};oa.prototype.buildShaderProgram=function(e){b.typeOf.object("context",e);const t=l(this._positionAttributeLine)?[this._positionAttributeLine]:[],n=q0e(this),i=$0e(this),o=t.concat(this._attributeLines,this._vertexShaderParts.uniformLines,this._vertexShaderParts.varyingLines,n.vertexLines,i.vertexLines,this._vertexShaderParts.shaderLines).join(`
`),r=new Ge({defines:this._vertexShaderParts.defineLines,sources:[o]}),s=this._fragmentShaderParts.uniformLines.concat(this._fragmentShaderParts.varyingLines,n.fragmentLines,i.fragmentLines,this._fragmentShaderParts.shaderLines).join(`
`),a=new Ge({defines:this._fragmentShaderParts.defineLines,sources:[s]});return hn.fromCache({context:e,vertexShaderSource:r,fragmentShaderSource:a,attributeLocations:this._attributeLocations})};oa.prototype.clone=function(){return ut(this,!0)};function q0e(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 Y0e(e){switch(e){case"mat2":return 2;case"mat3":return 3;case"mat4":return 4;default:return 1}}function $0e(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 br(e,t,n,i){if(b.defined("context",e),!t||t.length===0)throw new x("At least one attribute is required.");const o=br._verifyAttributes(t);n=A(n,0);const r=[],s={};let a,c;const u=o.length;for(let h=0;h<u;++h){const _=o[h];if(_.vertexBuffer){r.push(_);continue}c=_.usage,a=s[c],l(a)||(a=s[c]=[]),a.push(_)}function f(h,_){return ee.getSizeInBytes(_.componentDatatype)-ee.getSizeInBytes(h.componentDatatype)}this._allBuffers=[];for(c in s)if(s.hasOwnProperty(c)){a=s[c],a.sort(f);const h=br._vertexSizeInBytes(a),_=a[0].usage,g={vertexSizeInBytes:h,vertexBuffer:void 0,usage:_,needsCommit:!1,arrayBuffer:void 0,arrayViews:br._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)}br._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,Ze.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(!Ze.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};br._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};br._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};br.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];br._resize(o,this._size),br._appendWriters(this.writers,o)}SN(this)};br._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 X0e=[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}}];br._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]=X0e[r.componentsPerAttribute-1](t,r.view,r.vertexSizeInComponentType)}};br.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=K0e(this,i)||t;if(t||!l(this.va)){SN(this);const s=this.va=[],a=N.SIXTY_FOUR_KILOBYTES-4,c=l(e)&&!this._instanced?Math.ceil(this._size/a):1;for(let u=0;u<c;++u){let f=[];for(o=0,r=n.length;o<r;++o){i=n[o];const h=u*(i.vertexSizeInBytes*a);br._appendAttributes(f,i,h,this._instanced)}f=f.concat(this._precreated),s.push({va:new to({context:this._context,attributes:f,indexBuffer:e}),indicesCount:1.5*(u!==c-1?a:this._size%a)})}}};function K0e(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=At.createVertexBuffer({context:e._context,typedArray:t.arrayBuffer,usage:t.usage}),t.vertexBuffer.vertexArrayDestroyable=!1,!0;t.vertexBuffer.copyFromArrayView(t.arrayBuffer)}return!1}br._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})}};br.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)J0e(n[i],e,t)};function J0e(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)}}br.prototype.endSubCommits=function(){const e=this._allBuffers;for(let t=0,n=e.length;t<n;++t)e[t].needsCommit=!1};function SN(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}br.prototype.isDestroyed=function(){return!1};br.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 SN(this),Ue(this)};function Q0e(e,t,n){if(b.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=[Re.createIfNeeded(t.positiveX).fetchImage(i),Re.createIfNeeded(t.negativeX).fetchImage(i),Re.createIfNeeded(t.positiveY).fetchImage(i),Re.createIfNeeded(t.negativeY).fetchImage(i),Re.createIfNeeded(t.positiveZ).fetchImage(i),Re.createIfNeeded(t.negativeZ).fetchImage(i)];return Promise.all(o).then(function(r){return new nu({context:e,source:{positiveX:r[0],negativeX:r[1],positiveY:r[2],negativeY:r[3],positiveZ:r[4],negativeZ:r[5]}})})}const Yz=`#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;
}
`,aS=`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);
}
`,Z0e=`#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
}
`,eAe=`#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;
}
`,tAe=`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);
}
`,nAe=`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);
}
`,iAe=`/**
* 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;
}
}
`,oAe=`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();
}
`,rAe=`attribute vec4 position;
varying vec4 positionEC;
void main()
{
positionEC = czm_modelView * position;
gl_Position = czm_projection * positionEC;
czm_vertexLogDepth();
}
`,$z=`#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
}
`,Xz=`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 sAe=`/**
* @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);
}
`,aAe=`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
`,cAe=`#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
}
`,Kz=`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
);
}
`,lAe=`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);
}
}
`,uAe=`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
}
`,fAe=`attribute vec4 position;
attribute vec3 cubeMapCoordinates;
varying vec3 v_cubeMapCoordinates;
void main()
{
gl_Position = position;
v_cubeMapCoordinates = cubeMapCoordinates;
}
`,nE=`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();
}
`,dAe=`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;
}
`,LT=`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);
}
`,fj=`#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();
}
`,hAe=`#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();
}
`,pAe=`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
}
`,mAe=`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
}
`,_Ae=`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
}
`,gAe=`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;
}
`,yAe=`uniform sampler2D u_texture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(u_texture, v_textureCoordinates);
}
`,AAe=`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));
}
`,dj=`#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
}
`,CAe=`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);
}
`,xL=`#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();
}
`,Jz=`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);
}
`,TAe=`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;
}
`,bAe=`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;
}
`,EAe=`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);
}
`,xAe=`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;
}
`,wAe=`uniform sampler2D u_texture;
varying vec2 v_textureCoordinates;
void main()
{
vec4 color = texture2D(u_texture, v_textureCoordinates);
gl_FragColor = czm_gammaCorrect(color);
}
`,SAe=`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));
}
`,vAe=`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;
}
`,DAe=`#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();
}
`,IAe=`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;
}
`,PAe=`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;
}
`,Qz=`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 vh(e){return vh=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},vh(e)}function wL(e,t){return wL=Object.setPrototypeOf||function(i,o){return i.__proto__=o,i},wL(e,t)}function OAe(){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 tw(e,t,n){return OAe()?tw=Reflect.construct:tw=function(o,r,s){var a=[null];a.push.apply(a,r);var c=Function.bind.apply(o,a),u=new c;return s&&wL(u,s.prototype),u},tw.apply(null,arguments)}function bl(e){return LAe(e)||BAe(e)||RAe(e)||NAe()}function LAe(e){if(Array.isArray(e))return SL(e)}function BAe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function RAe(e,t){if(e){if(typeof e=="string")return SL(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 SL(e,t)}}function SL(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 NAe(){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 MAe=Object.hasOwnProperty,Zz=Object.setPrototypeOf,FAe=Object.isFrozen,zAe=Object.getPrototypeOf,UAe=Object.getOwnPropertyDescriptor,Ca=Object.freeze,Yl=Object.seal,HAe=Object.create,hj=typeof Reflect<"u"&&Reflect,cS=hj.apply,vL=hj.construct;cS||(cS=function(t,n,i){return t.apply(n,i)});Ca||(Ca=function(t){return t});Yl||(Yl=function(t){return t});vL||(vL=function(t,n){return tw(t,bl(n))});var VAe=tl(Array.prototype.forEach),eU=tl(Array.prototype.pop),F0=tl(Array.prototype.push),nw=tl(String.prototype.toLowerCase),OI=tl(String.prototype.toString),kAe=tl(String.prototype.match),_l=tl(String.prototype.replace),GAe=tl(String.prototype.indexOf),WAe=tl(String.prototype.trim),ca=tl(RegExp.prototype.test),LI=jAe(TypeError);function tl(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 cS(e,t,i)}}function jAe(e){return function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return vL(e,n)}}function Fn(e,t,n){n=n||nw,Zz&&Zz(e,null);for(var i=t.length;i--;){var o=t[i];if(typeof o=="string"){var r=n(o);r!==o&&(FAe(t)||(t[i]=r),o=r)}e[o]=!0}return e}function Gp(e){var t=HAe(null),n;for(n in e)cS(MAe,e,[n])&&(t[n]=e[n]);return t}function iE(e,t){for(;e!==null;){var n=UAe(e,t);if(n){if(n.get)return tl(n.get);if(typeof n.value=="function")return tl(n.value)}e=zAe(e)}function i(o){return console.warn("fallback value for",o),null}return i}var tU=Ca(["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"]),BI=Ca(["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"]),RI=Ca(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),qAe=Ca(["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"]),NI=Ca(["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"]),YAe=Ca(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),nU=Ca(["#text"]),iU=Ca(["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"]),MI=Ca(["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"]),oU=Ca(["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"]),oE=Ca(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$Ae=Yl(/\{\{[\w\W]*|[\w\W]*\}\}/gm),XAe=Yl(/<%[\w\W]*|[\w\W]*%>/gm),KAe=Yl(/\${[\w\W]*}/gm),JAe=Yl(/^data-[\-\w.\u00B7-\uFFFF]/),QAe=Yl(/^aria-[\-\w]+$/),ZAe=Yl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),eCe=Yl(/^(?:\w+script|data):/i),tCe=Yl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),nCe=Yl(/^html$/i),iCe=function(){return typeof window>"u"?null:window},oCe=function(t,n){if(vh(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 pj(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:iCe(),t=function(be){return pj(be)};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,f=u===void 0?e.NamedNodeMap||e.MozNamedAttrMap:u,h=e.HTMLFormElement,_=e.DOMParser,g=e.trustedTypes,p=a.prototype,y=iE(p,"cloneNode"),C=iE(p,"nextSibling"),T=iE(p,"childNodes"),E=iE(p,"parentNode");if(typeof r=="function"){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var S=oCe(g,n),P=S?S.createHTML(""):"",O=i,z=O.implementation,R=O.createNodeIterator,F=O.createDocumentFragment,H=O.getElementsByTagName,v=n.importNode,I={};try{I=Gp(i).documentMode?i.documentMode:{}}catch{}var m={};t.isSupported=typeof E=="function"&&z&&typeof z.createHTMLDocument<"u"&&I!==9;var D=$Ae,L=XAe,M=KAe,V=JAe,k=QAe,W=eCe,G=tCe,K=ZAe,q=null,te=Fn({},[].concat(bl(tU),bl(BI),bl(RI),bl(NI),bl(nU))),$=null,X=Fn({},[].concat(bl(iU),bl(MI),bl(oU),bl(oE))),Y=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}})),ae=null,ue=null,re=!0,he=!0,ce=!1,Q=!1,ie=!1,de=!1,me=!1,Ee=!1,xe=!1,Pe=!1,Te=!0,Oe=!1,De="user-content-",Me=!0,ve=!1,Ie={},Ve=null,Le=Fn({},["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"]),_t=null,Tt=Fn({},["audio","video","img","source","image","track"]),Ot=null,Tn=Fn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Sn="http://www.w3.org/1998/Math/MathML",gn="http://www.w3.org/2000/svg",on="http://www.w3.org/1999/xhtml",Nt=on,yn=!1,Cn=null,Ht=Fn({},[Sn,gn,on],OI),Xt,Mn=["application/xhtml+xml","text/html"],ti="text/html",en,xi=null,Yi=i.createElement("form"),Pi=function(be){return be instanceof RegExp||be instanceof Function},Jn=function(be){xi&&xi===be||((!be||vh(be)!=="object")&&(be={}),be=Gp(be),Xt=Mn.indexOf(be.PARSER_MEDIA_TYPE)===-1?Xt=ti:Xt=be.PARSER_MEDIA_TYPE,en=Xt==="application/xhtml+xml"?OI:nw,q="ALLOWED_TAGS"in be?Fn({},be.ALLOWED_TAGS,en):te,$="ALLOWED_ATTR"in be?Fn({},be.ALLOWED_ATTR,en):X,Cn="ALLOWED_NAMESPACES"in be?Fn({},be.ALLOWED_NAMESPACES,OI):Ht,Ot="ADD_URI_SAFE_ATTR"in be?Fn(Gp(Tn),be.ADD_URI_SAFE_ATTR,en):Tn,_t="ADD_DATA_URI_TAGS"in be?Fn(Gp(Tt),be.ADD_DATA_URI_TAGS,en):Tt,Ve="FORBID_CONTENTS"in be?Fn({},be.FORBID_CONTENTS,en):Le,ae="FORBID_TAGS"in be?Fn({},be.FORBID_TAGS,en):{},ue="FORBID_ATTR"in be?Fn({},be.FORBID_ATTR,en):{},Ie="USE_PROFILES"in be?be.USE_PROFILES:!1,re=be.ALLOW_ARIA_ATTR!==!1,he=be.ALLOW_DATA_ATTR!==!1,ce=be.ALLOW_UNKNOWN_PROTOCOLS||!1,Q=be.SAFE_FOR_TEMPLATES||!1,ie=be.WHOLE_DOCUMENT||!1,Ee=be.RETURN_DOM||!1,xe=be.RETURN_DOM_FRAGMENT||!1,Pe=be.RETURN_TRUSTED_TYPE||!1,me=be.FORCE_BODY||!1,Te=be.SANITIZE_DOM!==!1,Oe=be.SANITIZE_NAMED_PROPS||!1,Me=be.KEEP_CONTENT!==!1,ve=be.IN_PLACE||!1,K=be.ALLOWED_URI_REGEXP||K,Nt=be.NAMESPACE||on,be.CUSTOM_ELEMENT_HANDLING&&Pi(be.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=be.CUSTOM_ELEMENT_HANDLING.tagNameCheck),be.CUSTOM_ELEMENT_HANDLING&&Pi(be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=be.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),be.CUSTOM_ELEMENT_HANDLING&&typeof be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=be.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Q&&(he=!1),xe&&(Ee=!0),Ie&&(q=Fn({},bl(nU)),$=[],Ie.html===!0&&(Fn(q,tU),Fn($,iU)),Ie.svg===!0&&(Fn(q,BI),Fn($,MI),Fn($,oE)),Ie.svgFilters===!0&&(Fn(q,RI),Fn($,MI),Fn($,oE)),Ie.mathMl===!0&&(Fn(q,NI),Fn($,oU),Fn($,oE))),be.ADD_TAGS&&(q===te&&(q=Gp(q)),Fn(q,be.ADD_TAGS,en)),be.ADD_ATTR&&($===X&&($=Gp($)),Fn($,be.ADD_ATTR,en)),be.ADD_URI_SAFE_ATTR&&Fn(Ot,be.ADD_URI_SAFE_ATTR,en),be.FORBID_CONTENTS&&(Ve===Le&&(Ve=Gp(Ve)),Fn(Ve,be.FORBID_CONTENTS,en)),Me&&(q["#text"]=!0),ie&&Fn(q,["html","head","body"]),q.table&&(Fn(q,["tbody"]),delete ae.tbody),Ca&&Ca(be),xi=be)},cn=Fn({},["mi","mo","mn","ms","mtext"]),Vn=Fn({},["foreignobject","desc","title","annotation-xml"]),On=Fn({},["title","style","font","a","script"]),rn=Fn({},BI);Fn(rn,RI),Fn(rn,qAe);var gt=Fn({},NI);Fn(gt,YAe);var ke=function(be){var je=E(be);(!je||!je.tagName)&&(je={namespaceURI:Nt,tagName:"template"});var tt=nw(be.tagName),kn=nw(je.tagName);return Cn[be.namespaceURI]?be.namespaceURI===gn?je.namespaceURI===on?tt==="svg":je.namespaceURI===Sn?tt==="svg"&&(kn==="annotation-xml"||cn[kn]):Boolean(rn[tt]):be.namespaceURI===Sn?je.namespaceURI===on?tt==="math":je.namespaceURI===gn?tt==="math"&&Vn[kn]:Boolean(gt[tt]):be.namespaceURI===on?je.namespaceURI===gn&&!Vn[kn]||je.namespaceURI===Sn&&!cn[kn]?!1:!gt[tt]&&(On[tt]||!rn[tt]):!!(Xt==="application/xhtml+xml"&&Cn[be.namespaceURI]):!1},vn=function(be){F0(t.removed,{element:be});try{be.parentNode.removeChild(be)}catch{try{be.outerHTML=P}catch{be.remove()}}},pn=function(be,je){try{F0(t.removed,{attribute:je.getAttributeNode(be),from:je})}catch{F0(t.removed,{attribute:null,from:je})}if(je.removeAttribute(be),be==="is"&&!$[be])if(Ee||xe)try{vn(je)}catch{}else try{je.setAttribute(be,"")}catch{}},Hi=function(be){var je,tt;if(me)be="<remove></remove>"+be;else{var kn=kAe(be,/^[\r\n\t ]+/);tt=kn&&kn[0]}Xt==="application/xhtml+xml"&&Nt===on&&(be='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+be+"</body></html>");var Gr=S?S.createHTML(be):be;if(Nt===on)try{je=new _().parseFromString(Gr,Xt)}catch{}if(!je||!je.documentElement){je=z.createDocument(Nt,"template",null);try{je.documentElement.innerHTML=yn?"":Gr}catch{}}var hr=je.body||je.documentElement;return be&&tt&&hr.insertBefore(i.createTextNode(tt),hr.childNodes[0]||null),Nt===on?H.call(je,ie?"html":"body")[0]:ie?je.documentElement:hr},Dn=function(be){return R.call(be.ownerDocument||be,be,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},Oi=function(be){return be instanceof h&&(typeof be.nodeName!="string"||typeof be.textContent!="string"||typeof be.removeChild!="function"||!(be.attributes instanceof f)||typeof be.removeAttribute!="function"||typeof be.setAttribute!="function"||typeof be.namespaceURI!="string"||typeof be.insertBefore!="function"||typeof be.hasChildNodes!="function")},bo=function(be){return vh(s)==="object"?be instanceof s:be&&vh(be)==="object"&&typeof be.nodeType=="number"&&typeof be.nodeName=="string"},no=function(be,je,tt){m[be]&&VAe(m[be],function(kn){kn.call(t,je,tt,xi)})},Dr=function(be){var je;if(no("beforeSanitizeElements",be,null),Oi(be)||ca(/[\u0080-\uFFFF]/,be.nodeName))return vn(be),!0;var tt=en(be.nodeName);if(no("uponSanitizeElement",be,{tagName:tt,allowedTags:q}),be.hasChildNodes()&&!bo(be.firstElementChild)&&(!bo(be.content)||!bo(be.content.firstElementChild))&&ca(/<[/\w]/g,be.innerHTML)&&ca(/<[/\w]/g,be.textContent)||tt==="select"&&ca(/<template/i,be.innerHTML))return vn(be),!0;if(!q[tt]||ae[tt]){if(!ae[tt]&&Li(tt)&&(Y.tagNameCheck instanceof RegExp&&ca(Y.tagNameCheck,tt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(tt)))return!1;if(Me&&!Ve[tt]){var kn=E(be)||be.parentNode,Gr=T(be)||be.childNodes;if(Gr&&kn)for(var hr=Gr.length,or=hr-1;or>=0;--or)kn.insertBefore(y(Gr[or],!0),C(be))}return vn(be),!0}return be instanceof a&&!ke(be)||(tt==="noscript"||tt==="noembed")&&ca(/<\/no(script|embed)/i,be.innerHTML)?(vn(be),!0):(Q&&be.nodeType===3&&(je=be.textContent,je=_l(je,D," "),je=_l(je,L," "),je=_l(je,M," "),be.textContent!==je&&(F0(t.removed,{element:be.cloneNode()}),be.textContent=je)),no("afterSanitizeElements",be,null),!1)},Vi=function(be,je,tt){if(Te&&(je==="id"||je==="name")&&(tt in i||tt in Yi))return!1;if(!(he&&!ue[je]&&ca(V,je))){if(!(re&&ca(k,je))){if(!$[je]||ue[je]){if(!(Li(be)&&(Y.tagNameCheck instanceof RegExp&&ca(Y.tagNameCheck,be)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(be))&&(Y.attributeNameCheck instanceof RegExp&&ca(Y.attributeNameCheck,je)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(je))||je==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&ca(Y.tagNameCheck,tt)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(tt))))return!1}else if(!Ot[je]){if(!ca(K,_l(tt,G,""))){if(!((je==="src"||je==="xlink:href"||je==="href")&&be!=="script"&&GAe(tt,"data:")===0&&_t[be])){if(!(ce&&!ca(W,_l(tt,G,"")))){if(tt)return!1}}}}}}return!0},Li=function(be){return be.indexOf("-")>0},Ir=function(be){var je,tt,kn,Gr;no("beforeSanitizeAttributes",be,null);var hr=be.attributes;if(hr){var or={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$};for(Gr=hr.length;Gr--;){je=hr[Gr];var jd=je,Eo=jd.name,bf=jd.namespaceURI;if(tt=Eo==="value"?je.value:WAe(je.value),kn=en(Eo),or.attrName=kn,or.attrValue=tt,or.keepAttr=!0,or.forceKeepAttr=void 0,no("uponSanitizeAttribute",be,or),tt=or.attrValue,!or.forceKeepAttr&&(pn(Eo,be),!!or.keepAttr)){if(ca(/\/>/i,tt)){pn(Eo,be);continue}Q&&(tt=_l(tt,D," "),tt=_l(tt,L," "),tt=_l(tt,M," "));var j_=en(be.nodeName);if(Vi(j_,kn,tt)){if(Oe&&(kn==="id"||kn==="name")&&(pn(Eo,be),tt=De+tt),S&&vh(g)==="object"&&typeof g.getAttributeType=="function"&&!bf)switch(g.getAttributeType(j_,kn)){case"TrustedHTML":tt=S.createHTML(tt);break;case"TrustedScriptURL":tt=S.createScriptURL(tt);break}try{bf?be.setAttributeNS(bf,Eo,tt):be.setAttribute(Eo,tt),eU(t.removed)}catch{}}}}no("afterSanitizeAttributes",be,null)}},aa=function yt(be){var je,tt=Dn(be);for(no("beforeSanitizeShadowDOM",be,null);je=tt.nextNode();)no("uponSanitizeShadowNode",je,null),!Dr(je)&&(je.content instanceof o&&yt(je.content),Ir(je));no("afterSanitizeShadowDOM",be,null)};return t.sanitize=function(yt){var be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},je,tt,kn,Gr,hr;if(yn=!yt,yn&&(yt="<!-->"),typeof yt!="string"&&!bo(yt)){if(typeof yt.toString!="function")throw LI("toString is not a function");if(yt=yt.toString(),typeof yt!="string")throw LI("dirty is not a string, aborting")}if(!t.isSupported){if(vh(e.toStaticHTML)==="object"||typeof e.toStaticHTML=="function"){if(typeof yt=="string")return e.toStaticHTML(yt);if(bo(yt))return e.toStaticHTML(yt.outerHTML)}return yt}if(de||Jn(be),t.removed=[],typeof yt=="string"&&(ve=!1),ve){if(yt.nodeName){var or=en(yt.nodeName);if(!q[or]||ae[or])throw LI("root node is forbidden and cannot be sanitized in-place")}}else if(yt instanceof s)je=Hi("<!---->"),tt=je.ownerDocument.importNode(yt,!0),tt.nodeType===1&&tt.nodeName==="BODY"||tt.nodeName==="HTML"?je=tt:je.appendChild(tt);else{if(!Ee&&!Q&&!ie&&yt.indexOf("<")===-1)return S&&Pe?S.createHTML(yt):yt;if(je=Hi(yt),!je)return Ee?null:Pe?P:""}je&&me&&vn(je.firstChild);for(var jd=Dn(ve?yt:je);kn=jd.nextNode();)kn.nodeType===3&&kn===Gr||Dr(kn)||(kn.content instanceof o&&aa(kn.content),Ir(kn),Gr=kn);if(Gr=null,ve)return yt;if(Ee){if(xe)for(hr=F.call(je.ownerDocument);je.firstChild;)hr.appendChild(je.firstChild);else hr=je;return $.shadowroot&&(hr=v.call(n,hr,!0)),hr}var Eo=ie?je.outerHTML:je.innerHTML;return ie&&q["!doctype"]&&je.ownerDocument&&je.ownerDocument.doctype&&je.ownerDocument.doctype.name&&ca(nCe,je.ownerDocument.doctype.name)&&(Eo="<!DOCTYPE "+je.ownerDocument.doctype.name+`>
`+Eo),Q&&(Eo=_l(Eo,D," "),Eo=_l(Eo,L," "),Eo=_l(Eo,M," ")),S&&Pe?S.createHTML(Eo):Eo},t.setConfig=function(yt){Jn(yt),de=!0},t.clearConfig=function(){xi=null,de=!1},t.isValidAttribute=function(yt,be,je){xi||Jn({});var tt=en(yt),kn=en(be);return Vi(tt,kn,je)},t.addHook=function(yt,be){typeof be=="function"&&(m[yt]=m[yt]||[],F0(m[yt],be))},t.removeHook=function(yt){if(m[yt])return eU(m[yt])},t.removeHooks=function(yt){m[yt]&&(m[yt]=[])},t.removeAllHooks=function(){m={}},t}var rCe=pj();let sCe=0;const FI={};function Kn(e,t){b.typeOf.string("html",e);let n;const i=e;l(FI[i])?n=FI[i]:(n=sCe++,FI[i]=n),t=A(t,!1),this._id=n,this._html=e,this._showOnScreen=t,this._element=void 0}Object.defineProperties(Kn.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=rCe.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}}});Kn.equals=function(e,t){return e===t||l(e)&&l(t)&&e._id===t._id&&e._showOnScreen===t._showOnScreen};Kn.prototype.equals=function(e){return Kn.equals(this,e)};Kn.getIonCredit=function(e){const t=l(e.collapsible)&&!e.collapsible,n=new Kn(e.html,t);return n._isIon=n.html.indexOf("ion-credit.png")!==-1,n};Kn.clone=function(e){if(l(e))return new Kn(e.html,e.showOnScreen)};let zI;const mj="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyZTlhMmUzMS1iZjI3LTRhMmQtYjFkZi02MDhlMDZjZDlmNDIiLCJpZCI6MjU5LCJpYXQiOjE2NzI2ODQyMDR9.GfS2oIjtP-hkhYm4g_Y6Vvpdp954z30qPWJnlNBF-co",Ev={};Ev.defaultAccessToken=mj;Ev.defaultServer=new Re({url:"https://api.cesium.com/"});Ev.getDefaultTokenCredit=function(e){if(e===mj){if(!l(zI)){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>`;zI=new Kn(t,!0)}return zI}};const zm=Ev;function ts(e,t){b.defined("endpoint",e),b.defined("endpointResource",t);let n;const i=e.externalType,o=l(i);if(!o)n={url:e.url,retryAttempts:1,retryCallback:aCe};else if(i==="3DTILES"||i==="STK_TERRAIN_SERVER")n={url:e.options.url};else throw new Se("Ion.createResource does not support external imagery assets; use IonImageryProvider instead.");Re.call(this,n),this._ionEndpoint=e,this._ionEndpointDomain=o?void 0:new Ts(e.url).authority(),this._ionEndpointResource=t,this._ionRoot=void 0,this._pendingPromise=void 0,this._credits=void 0,this._isExternal=o}l(Object.create)&&(ts.prototype=Object.create(Re.prototype),ts.prototype.constructor=ts);ts.fromAssetId=function(e,t){const n=ts._createEndpointResource(e,t);return n.fetchJson().then(function(i){return new ts(i,n)})};Object.defineProperties(ts.prototype,{credits:{get:function(){return l(this._ionRoot)?this._ionRoot.credits:l(this._credits)?this._credits:(this._credits=ts.getCreditsFromEndpoint(this._ionEndpoint,this._ionEndpointResource),this._credits)}}});ts.getCreditsFromEndpoint=function(e,t){const n=e.attributions.map(Kn.getIonCredit),i=zm.getDefaultTokenCredit(t.queryParameters.access_token);return l(i)&&n.push(Kn.clone(i)),n};ts.prototype.clone=function(e){const t=A(this._ionRoot,this);return l(e)||(e=new ts(t._ionEndpoint,t._ionEndpointResource)),e=Re.prototype.clone.call(this,e),e._ionRoot=t,e._isExternal=this._isExternal,e};ts.prototype.fetchImage=function(e){if(!this._isExternal){const t=e;e={preferBlob:!0},l(t)&&(e.flipY=t.flipY,e.preferImageBitmap=t.preferImageBitmap)}return Re.prototype.fetchImage.call(this,e)};ts.prototype._makeRequest=function(e){return this._isExternal||new Ts(this.url).authority()!==this._ionEndpointDomain?Re.prototype._makeRequest.call(this,e):(l(e.headers)||(e.headers={}),e.headers.Authorization=`Bearer ${this._ionEndpoint.accessToken}`,Re.prototype._makeRequest.call(this,e))};ts._createEndpointResource=function(e,t){b.defined("assetId",e),t=A(t,A.EMPTY_OBJECT);let n=A(t.server,zm.defaultServer);const i=A(t.accessToken,zm.defaultAccessToken);n=Re.createIfNeeded(n);const o={url:`v1/assets/${e}/endpoint`};return l(i)&&(o.queryParameters={access_token:i}),n.getDerivedResource(o)};function aCe(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 Xs(e){e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,pe.WGS84),this._rectangle=A(e.rectangle,_e.MAX_VALUE),this._projection=new jo(this._ellipsoid),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,2),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1)}Object.defineProperties(Xs.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});Xs.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};Xs.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};Xs.prototype.rectangleToNativeRectangle=function(e,t){b.defined("rectangle",e);const n=N.toDegrees(e.west),i=N.toDegrees(e.south),o=N.toDegrees(e.east),r=N.toDegrees(e.north);return l(t)?(t.west=n,t.south=i,t.east=o,t.north=r,t):new _e(n,i,o,r)};Xs.prototype.tileXYToNativeRectangle=function(e,t,n,i){const o=this.tileXYToRectangle(e,t,n,i);return o.west=N.toDegrees(o.west),o.south=N.toDegrees(o.south),o.east=N.toDegrees(o.east),o.north=N.toDegrees(o.north),o};Xs.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,f=o.height/s,h=o.north-t*f,_=o.north-(t+1)*f;return l(i)||(i=new _e(c,_,u,h)),i.west=c,i.south=_,i.east=u,i.north=h,i};Xs.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!_e.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+=N.TWO_PI);let u=(c-i.west)/s|0;u>=o&&(u=o-1);let f=(i.north-e.latitude)/a|0;return f>=r&&(f=r-1),l(n)?(n.x=u,n.y=f,n):new j(u,f)};function DL(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 Ki(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}Ki.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 Ki(t,i,o,r,s,0,a),n.numberOfListeners>0?n.raiseEvent(c):console.log(`An error occurred in "${t.constructor.name}": ${DL(i)}`),c};Ki.reportSuccess=function(e){l(e)&&(e.timesRetried=-1)};function Zn(e){this._ellipsoid=A(e,pe.WGS84),this._semimajorAxis=this._ellipsoid.maximumRadius,this._oneOverSemimajorAxis=1/this._semimajorAxis}Object.defineProperties(Zn.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});Zn.mercatorAngleToGeodeticLatitude=function(e){return N.PI_OVER_TWO-2*Math.atan(Math.exp(-e))};Zn.geodeticLatitudeToMercatorAngle=function(e){e>Zn.MaximumLatitude?e=Zn.MaximumLatitude:e<-Zn.MaximumLatitude&&(e=-Zn.MaximumLatitude);const t=Math.sin(e);return .5*Math.log((1+t)/(1-t))};Zn.MaximumLatitude=Zn.mercatorAngleToGeodeticLatitude(Math.PI);Zn.prototype.project=function(e,t){const n=this._semimajorAxis,i=e.longitude*n,o=Zn.geodeticLatitudeToMercatorAngle(e.latitude)*n,r=e.height;return l(t)?(t.x=i,t.y=o,t.z=r,t):new d(i,o,r)};Zn.prototype.unproject=function(e,t){if(!l(e))throw new x("cartesian is required");const n=this._oneOverSemimajorAxis,i=e.x*n,o=Zn.mercatorAngleToGeodeticLatitude(e.y*n),r=e.z;return l(t)?(t.longitude=i,t.latitude=o,t.height=r,t):new Ae(i,o,r)};function ws(e){if(e=A(e,A.EMPTY_OBJECT),this._ellipsoid=A(e.ellipsoid,pe.WGS84),this._numberOfLevelZeroTilesX=A(e.numberOfLevelZeroTilesX,1),this._numberOfLevelZeroTilesY=A(e.numberOfLevelZeroTilesY,1),this._projection=new Zn(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 _e(t.longitude,t.latitude,n.longitude,n.latitude)}Object.defineProperties(ws.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},rectangle:{get:function(){return this._rectangle}},projection:{get:function(){return this._projection}}});ws.prototype.getNumberOfXTilesAtLevel=function(e){return this._numberOfLevelZeroTilesX<<e};ws.prototype.getNumberOfYTilesAtLevel=function(e){return this._numberOfLevelZeroTilesY<<e};ws.prototype.rectangleToNativeRectangle=function(e,t){const n=this._projection,i=n.project(_e.southwest(e)),o=n.project(_e.northeast(e));return l(t)?(t.west=i.x,t.south=i.y,t.east=o.x,t.north=o.y,t):new _e(i.x,i.y,o.x,o.y)};ws.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,f=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=f,i):new _e(a,h,c,f)};ws.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};ws.prototype.positionToTileXY=function(e,t,n){const i=this._rectangle;if(!_e.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),_=h.x-this._rectangleSouthwestInMeters.x,g=this._rectangleNortheastInMeters.y-h.y;let p=_/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 vN(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=Re.createIfNeeded(e.missingImageUrl),n=this;function i(r){l(r.blob)&&(n._missingImageByteLength=r.blob.size);let s=oS(r);if(e.disableCheckIfAllPixelsAreTransparent){let a=!0;const c=r.width,u=e.pixelsToCheck;for(let f=0,h=u.length;a&&f<h;++f){const _=u[f],g=_.x*4+_.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)}vN.prototype.isReady=function(){return this._isReady};vN.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=oS(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 f=c+u;if(i[f]!==n[f])return!1}}return!0};function xp(){this.name=void 0,this.description=void 0,this.position=void 0,this.data=void 0,this.imageryLayer=void 0}xp.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])};xp.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 ou(){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(ou.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}});ou.prototype.getTileCredits=function(e,t,n){x.throwInstantiationError()};ou.prototype.requestImage=function(e,t,n,i){x.throwInstantiationError()};ou.prototype.pickFeatures=function(e,t,n,i,o){x.throwInstantiationError()};const cCe=/\.ktx2$/i;ou.loadImage=function(e,t){b.defined("url",t);const n=Re.createIfNeeded(t);return cCe.test(n.url)?b_(n):l(e)&&l(e.tileDiscardPolicy)?n.fetchImage({preferBlob:!0,preferImageBitmap:!0,flipY:!0}):n.fetchImage({preferImageBitmap:!0,flipY:!0})};function kh(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=Re.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 Xs({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 Kn(n)),this._credit=n,this.enablePickFeatures=A(e.enablePickFeatures,!0),this._errorEvent=new $e,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 ws({ellipsoid:e.ellipsoid});else if(c.tileInfo.spatialReference.wkid===4326)i._tilingScheme=new Xs({ellipsoid:e.ellipsoid});else{const f=`Tile spatial reference WKID ${c.tileInfo.spatialReference.wkid} is not supported.`;return o=Ki.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new Se(f))}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 f=new Zn,h=c.fullExtent,_=f.unproject(new d(Math.max(h.xmin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.max(h.ymin,-i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0)),g=f.unproject(new d(Math.min(h.xmax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),Math.min(h.ymax,i._tilingScheme.ellipsoid.maximumRadius*Math.PI),0));i._rectangle=new _e(_.longitude,_.latitude,g.longitude,g.latitude)}else if(c.fullExtent.spatialReference.wkid===4326)i._rectangle=_e.fromDegrees(c.fullExtent.xmin,c.fullExtent.ymin,c.fullExtent.xmax,c.fullExtent.ymax);else{const f=`fullExtent.spatialReference WKID ${c.fullExtent.spatialReference.wkid} is not supported.`;return o=Ki.reportError(o,i,i._errorEvent,f,void 0,void 0,void 0),o.retry?a():Promise.reject(new Se(f))}}else i._rectangle=i._tilingScheme.rectangle;l(i._tileDiscardPolicy)||(i._tileDiscardPolicy=new vN({missingImageUrl:_j(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 Kn(c.copyrightText)),i._ready=!0,Ki.reportSuccess(o),Promise.resolve(!0)}function s(c){const u=`An error occurred while accessing ${i._resource.url}.`;return o=Ki.reportError(o,i,i._errorEvent,u,void 0,void 0,void 0),Promise.reject(new Se(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 _j(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 jo?(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(kh.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}}});kh.prototype.getTileCredits=function(e,t,n){};kh.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 ou.loadImage(this,_j(this,e,t,n,i))};kh.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 jo)s=N.toDegrees(i),a=N.toDegrees(o),c="4326";else{const _=this._tilingScheme.projection.project(new Ae(i,o,0));s=_.x,a=_.y,c="3857"}let u="visible";l(this._layers)&&(u+=`:${this._layers}`);const f={f:"json",tolerance:2,geometryType:"esriGeometryPoint",geometry:`${s},${a}`,mapExtent:`${r.west},${r.south},${r.east},${r.north}`,imageDisplay:`${this._tileWidth},${this._tileHeight},96`,sr:c,layers:u};return this._resource.getDerivedResource({url:"identify",queryParameters:f}).fetchJson().then(function(_){const g=[],p=_.results;if(!l(p))return g;for(let y=0;y<p.length;++y){const C=p[y],T=new xp;if(T.data=C,T.name=C.value,T.properties=C.attributes,T.configureDescriptionFromProperties(C.attributes),C.geometryType==="esriGeometryPoint"&&C.geometry){const E=C.geometry.spatialReference&&C.geometry.spatialReference.wkid?C.geometry.spatialReference.wkid:4326;if(E===4326||E===4283)T.position=Ae.fromDegrees(C.geometry.x,C.geometry.y,C.geometry.z);else if(E===102100||E===900913||E===3857){const w=new Zn;T.position=w.unproject(new d(C.geometry.x,C.geometry.y,C.geometry.z))}}g.push(T)}return g})};const lCe={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"},uCe=Object.freeze(lCe);function Fy(e){}Fy.prototype.isReady=function(){return!0};Fy.prototype.shouldDiscardImage=function(e){return Fy.EMPTY_IMAGE===e};let rE;Object.defineProperties(Fy,{EMPTY_IMAGE:{get:function(){return l(rE)||(rE=new Image,rE.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),rE}}});function es(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=Re.createIfNeeded(e.url),this._resource.appendForwardSlash(),this._tileProtocol=e.tileProtocol,this._mapStyle=A(e.mapStyle,uCe.AERIAL),this._culture=A(e.culture,""),this._tileDiscardPolicy=e.tileDiscardPolicy,l(this._tileDiscardPolicy)||(this._tileDiscardPolicy=new Fy),this._proxy=e.proxy,this._credit=new Kn(`<a href="http://www.bing.com"><img src="${es.logoUrl}" title="Bing Imagery"/></a>`),this._tilingScheme=new ws({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 $e,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 _=h.resourceSets[0].resources[0];o._tileWidth=_.imageWidth,o._tileHeight=_.imageHeight,o._maximumLevel=_.zoomMax-1,o._imageUrlSubdomains=_.imageUrlSubdomains,o._imageUrlTemplate=_.imageUrl;let g=o._attributionList=_.imageryProviders;g||(g=o._attributionList=[]);for(let p=0,y=g.length;p<y;++p){const C=g[p];if(C.credit instanceof Kn)break;C.credit=new Kn(C.attribution);const T=C.coverageAreas;for(let E=0,w=C.coverageAreas.length;E<w;++E){const S=T[E],P=S.bbox;S.bbox=new _e(N.toRadians(P[1]),N.toRadians(P[0]),N.toRadians(P[3]),N.toRadians(P[2]))}}return o._ready=!0,Ki.reportSuccess(r),Promise.resolve(!0)}function a(h){const _=`An error occurred while accessing ${i.url}.`;return r=Ki.reportError(r,o,o._errorEvent,_,void 0,void 0,void 0),r.retry?u():Promise.reject(new Se(_))}const c=i.url;function u(){const h=i.fetchJsonp("jsonp");return es._metadataCache[c]=h,h.then(s).catch(a)}const f=es._metadataCache[c];l(f)?this._readyPromise=f.then(s).catch(a):this._readyPromise=u()}Object.defineProperties(es.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 fCe=new _e;es.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,fCe);return pCe(this._attributionList,n,i)};es.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=ou.loadImage(this,dCe(this,e,t,n,i));if(l(o))return o.catch(function(r){return l(r.blob)&&r.blob.size===0?Fy.EMPTY_IMAGE:Promise.reject(r)})};es.prototype.pickFeatures=function(e,t,n,i,o){};es.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};es.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}};es._logoUrl=void 0;Object.defineProperties(es,{logoUrl:{get:function(){return l(es._logoUrl)||(es._logoUrl=dn("Assets/Images/bing_maps_credit.png")),es._logoUrl},set:function(e){b.defined("value",e),es._logoUrl=e}}});function dCe(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:es.tileXYToQuadKey(t,n,i),subdomain:s[a],culture:e._culture},queryParameters:{n:"z"}})}const hCe=new _e;function pCe(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,f=s.coverageAreas.length;!c&&u<f;++u){const h=a[u];if(t>=h.zoomMin&&t<=h.zoomMax){const _=_e.intersection(n,h.bbox,hCe);l(_)&&(c=!0)}}c&&i.push(s.credit)}return i}es._metadataCache={};const gj=/{[^}]+}/g,yj={x:yCe,y:CCe,z:ECe,s:xCe,reverseX:ACe,reverseY:TCe,reverseZ:bCe,westDegrees:wCe,southDegrees:SCe,eastDegrees:vCe,northDegrees:DCe,westProjected:ICe,southProjected:PCe,eastProjected:OCe,northProjected:LCe,width:BCe,height:RCe},mCe=sn(yj,{i:NCe,j:MCe,reverseI:FCe,reverseJ:zCe,longitudeDegrees:HCe,latitudeDegrees:VCe,longitudeProjected:kCe,latitudeProjected:GCe,format:jCe});function _c(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 $e,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(_c.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}}});_c.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=sn(yj,i),r=sn(mCe,i),s=Re.createIfNeeded(n.url),a=Re.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 ws({ellipsoid:n.ellipsoid})),t._rectangle=A(n.rectangle,t._tilingScheme.rectangle),t._rectangle=_e.intersection(t._rectangle,t._tilingScheme.rectangle),t._hasAlphaChannel=A(n.hasAlphaChannel,!0);let c=n.credit;return typeof c=="string"&&(c=new Kn(c)),t._credit=c,t._resource=s,t._tags=o,t._pickFeaturesResource=a,t._pickFeaturesTags=r,!0})};_c.prototype.getTileCredits=function(e,t,n){if(!this.ready)throw new x("getTileCredits must not be called before the imagery provider is ready.")};_c.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 ou.loadImage(this,_Ce(this,e,t,n,i))};_c.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,f){return u.callback(f)}function c(){if(r>=s._getFeatureInfoFormats.length)return Promise.resolve([]);const u=s._getFeatureInfoFormats[r],f=gCe(s,e,t,n,i,o,u.format);return++r,u.type==="json"?f.fetchJson().then(u.callback).catch(c):u.type==="xml"?f.fetchXML().then(u.callback).catch(c):u.type==="text"||u.type==="html"?f.fetchText().then(u.callback).catch(c):f.fetch({responseType:u.format}).then(a.bind(void 0,u)).catch(c)}return c()};let lS=!1;const Wa=new _e;let uS=!1;const BT=new _e;function _Ce(e,t,n,i,o){lS=!1,uS=!1;const r=e._resource,s=r.getUrlComponent(!0),a=e._tags,c={},u=s.match(gj);return l(u)&&u.forEach(function(f){const h=f.substring(1,f.length-1);l(a[h])&&(c[h]=a[h](e,t,n,i))}),r.getDerivedResource({request:o,templateValues:c})}let IL=!1;const zy=new j;let PL=!1;function gCe(e,t,n,i,o,r,s){lS=!1,uS=!1,IL=!1,PL=!1;const a=e._pickFeaturesResource,c=a.getUrlComponent(!0),u=e._pickFeaturesTags,f={},h=c.match(gj);return l(h)&&h.forEach(function(_){const g=_.substring(1,_.length-1);l(u[g])&&(f[g]=u[g](e,t,n,i,o,r,s))}),a.getDerivedResource({templateValues:f})}function r0(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 yCe(e,t,n,i){return r0(e,"{x}",t)}function ACe(e,t,n,i){const o=e.tilingScheme.getNumberOfXTilesAtLevel(i)-t-1;return r0(e,"{reverseX}",o)}function CCe(e,t,n,i){return r0(e,"{y}",n)}function TCe(e,t,n,i){const o=e.tilingScheme.getNumberOfYTilesAtLevel(i)-n-1;return r0(e,"{reverseY}",o)}function bCe(e,t,n,i){const o=e.maximumLevel,r=l(o)&&i<o?o-i-1:i;return r0(e,"{reverseZ}",r)}function ECe(e,t,n,i){return r0(e,"{z}",i)}function xCe(e,t,n,i){const o=(t+n+i)%e._subdomains.length;return e._subdomains[o]}function xv(e,t,n,i){lS||(e.tilingScheme.tileXYToRectangle(t,n,i,Wa),Wa.west=N.toDegrees(Wa.west),Wa.south=N.toDegrees(Wa.south),Wa.east=N.toDegrees(Wa.east),Wa.north=N.toDegrees(Wa.north),lS=!0)}function wCe(e,t,n,i){return xv(e,t,n,i),Wa.west}function SCe(e,t,n,i){return xv(e,t,n,i),Wa.south}function vCe(e,t,n,i){return xv(e,t,n,i),Wa.east}function DCe(e,t,n,i){return xv(e,t,n,i),Wa.north}function wv(e,t,n,i){uS||(e.tilingScheme.tileXYToNativeRectangle(t,n,i,BT),uS=!0)}function ICe(e,t,n,i){return wv(e,t,n,i),BT.west}function PCe(e,t,n,i){return wv(e,t,n,i),BT.south}function OCe(e,t,n,i){return wv(e,t,n,i),BT.east}function LCe(e,t,n,i){return wv(e,t,n,i),BT.north}function BCe(e,t,n,i){return e.tileWidth}function RCe(e,t,n,i){return e.tileHeight}function NCe(e,t,n,i,o,r,s){return Sv(e,t,n,i,o,r),zy.x}function MCe(e,t,n,i,o,r,s){return Sv(e,t,n,i,o,r),zy.y}function FCe(e,t,n,i,o,r,s){return Sv(e,t,n,i,o,r),e.tileWidth-zy.x-1}function zCe(e,t,n,i,o,r,s){return Sv(e,t,n,i,o,r),e.tileHeight-zy.y-1}const UCe=new _e,ay=new d;function Sv(e,t,n,i,o,r,s){if(IL)return;DN(e,t,n,i,o,r);const a=ay,c=e.tilingScheme.tileXYToNativeRectangle(t,n,i,UCe);zy.x=e.tileWidth*(a.x-c.west)/c.width|0,zy.y=e.tileHeight*(c.north-a.y)/c.height|0,IL=!0}function HCe(e,t,n,i,o,r,s){return N.toDegrees(o)}function VCe(e,t,n,i,o,r,s){return N.toDegrees(r)}function kCe(e,t,n,i,o,r,s){return DN(e,t,n,i,o,r),ay.x}function GCe(e,t,n,i,o,r,s){return DN(e,t,n,i,o,r),ay.y}const WCe=new Ae;function DN(e,t,n,i,o,r,s){if(!PL){if(e.tilingScheme.projection instanceof jo)ay.x=N.toDegrees(o),ay.y=N.toDegrees(r);else{const a=WCe;a.longitude=o,a.latitude=r,e.tilingScheme.projection.project(a,ay)}PL=!0}}function jCe(e,t,n,i,o,r,s){return s}function Jf(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=Re.createIfNeeded(o),t.appendForwardSlash(),n._tmsResource=t,n._xmlResource=t.getDerivedResource({url:"tilemapresource.xml"}),n._requestMetadata()}).catch(o=>Promise.reject(o));_c.call(this,i),this._promise=i}l(Object.create)&&(Jf.prototype=Object.create(_c.prototype),Jf.prototype.constructor=Jf);Jf.prototype._requestMetadata=function(){return this._xmlResource.fetchXML().then(this._metadataSuccess).catch(e=>e instanceof By?this._metadataFailure():Promise.reject(e))};function Aj(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 Cj(e,t,n){const i=e.positionToTileXY(_e.southwest(t),n),o=e.positionToTileXY(_e.northeast(t),n);return(Math.abs(o.x-i.x)+1)*(Math.abs(o.y-i.y)+1)>4?0:n}Jf.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 f=this._metadataError;const h=this._requestMetadata,_=e.childNodes[0].childNodes;for(let R=0;R<_.length;R++)if(t.test(_.item(R).nodeName))r=_.item(R);else if(i.test(_.item(R).nodeName)){a=_.item(R);const F=_.item(R).childNodes;for(let H=0;H<F.length;H++)n.test(F.item(H).nodeName)&&c.push(F.item(H))}else o.test(_.item(R).nodeName)&&(s=_.item(R));let g;if(!l(a)||!l(s))return g=`Unable to find expected tilesets or bbox attributes in ${u.url}.`,f=Ki.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,h()):Promise.reject(new Se(g));const p=this._options,y=A(p.fileExtension,r.getAttribute("extension")),C=A(p.tileWidth,parseInt(r.getAttribute("width"),10)),T=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 Xs({ellipsoid:p.ellipsoid});else if(S==="mercator"||S==="global-mercator")P=new ws({ellipsoid:p.ellipsoid});else return g=`${u.url}specifies an unsupported profile attribute, ${S}.`,f=Ki.reportError(f,this,this.errorEvent,g),f.retry?(this._metadataError=f,h()):Promise.reject(new Se(g));let O=_e.clone(p.rectangle);if(!l(O)){let R,F,H,v;A(p.flipXY,!1)?(H=new j(parseFloat(s.getAttribute("miny")),parseFloat(s.getAttribute("minx"))),v=new j(parseFloat(s.getAttribute("maxy")),parseFloat(s.getAttribute("maxx")))):(H=new j(parseFloat(s.getAttribute("minx")),parseFloat(s.getAttribute("miny"))),v=new j(parseFloat(s.getAttribute("maxx")),parseFloat(s.getAttribute("maxy"))));const m=S==="geodetic"||S==="mercator";if(P.projection instanceof jo||m)R=Ae.fromDegrees(H.x,H.y),F=Ae.fromDegrees(v.x,v.y);else{const D=P.projection;R=D.unproject(H),F=D.unproject(v)}O=new _e(R.longitude,R.latitude,F.longitude,F.latitude)}O=Aj(O,P),E=Cj(P,O,E);const z=this._tmsResource.getDerivedResource({url:`{z}/{x}/{reverseY}.${y}`});return Promise.resolve({url:z,tilingScheme:P,rectangle:O,tileWidth:C,tileHeight:T,minimumLevel:E,maximumLevel:w,tileDiscardPolicy:p.tileDiscardPolicy,credit:p.credit})};Jf.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 ws({ellipsoid:e.ellipsoid});let s=A(e.rectangle,r.rectangle);s=Aj(s,r);const a=Cj(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 Hc(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=Re.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 Kn(`<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${Hc.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 $e,this._ready=!1;const o=i.getDerivedResource({url:"query",queryParameters:{request:"Json",vars:"geeServerDefs",is2d:"t"}}),r=this;let s;function a(f){let h;try{h=JSON.parse(f)}catch{h=JSON.parse(f.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g,'$1"$2":'))}let _;for(let p=0;p<h.layers.length;p++)if(h.layers[p].id===r._channel){_=h.layers[p];break}let g;if(!l(_))return g=`Could not find layer with channel (id) of ${r._channel}.`,s=Ki.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Se(g));if(!l(_.version))return g=`Could not find a version in channel (id) ${r._channel}.`,s=Ki.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Se(g));if(r._version=_.version,l(h.projection)&&h.projection==="flat")r._tilingScheme=new Xs({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,rectangle:new _e(-Math.PI,-Math.PI,Math.PI,Math.PI),ellipsoid:e.ellipsoid});else if(!l(h.projection)||h.projection==="mercator")r._tilingScheme=new ws({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:2,ellipsoid:e.ellipsoid});else return g=`Unsupported projection ${h.projection}.`,s=Ki.reportError(s,r,r._errorEvent,g),s.retry?u():Promise.reject(new Se(g));return r._ready=!0,Ki.reportSuccess(s),Promise.resolve(!0)}function c(f){const h=A(f.message,`An error occurred while accessing ${o.url}.`);return s=Ki.reportError(s,r,r._errorEvent,h),Promise.reject(new Se(h))}function u(){return o.fetchText().then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(Hc.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}}});Hc.prototype.getTileCredits=function(e,t,n){};Hc.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 ou.loadImage(this,o)};Hc.prototype.pickFeatures=function(e,t,n,i,o){};Hc._logoUrl=void 0;Object.defineProperties(Hc,{logoUrl:{get:function(){return l(Hc._logoUrl)||(Hc._logoUrl=dn("Assets/Images/google_earth_credit.png")),Hc._logoUrl},set:function(e){b.defined("value",e),Hc._logoUrl=e}}});const qCe=/\/$/,Tj=new Kn('&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>');function s0(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=Re.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();qCe.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 Kn(s))):s=Tj,this._resource=i,this._imageryProvider=new _c({url:i,credit:s,ellipsoid:e.ellipsoid,minimumLevel:e.minimumLevel,maximumLevel:e.maximumLevel,rectangle:e.rectangle})}Object.defineProperties(s0.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}}});s0.prototype.getTileCredits=function(e,t,n){};s0.prototype.requestImage=function(e,t,n,i){return this._imageryProvider.requestImage(e,t,n,i)};s0.prototype.pickFeatures=function(e,t,n,i,o){return this._imageryProvider.pickFeatures(e,t,n,i,o)};s0._defaultCredit=Tj;function RT(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=Re.createIfNeeded(e.url),n=A(e.rectangle,_e.MAX_VALUE),i=new Xs({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 $e,this._ready=!1;let o=e.credit;typeof o=="string"&&(o=new Kn(o)),this._credit=o;const r=this;let s;function a(f){return r._image=f,r._tileWidth=f.width,r._tileHeight=f.height,r._ready=!0,Ki.reportSuccess(r._errorEvent),Promise.resolve(!0)}function c(f){const h=`Failed to load image ${t.url}.`;return s=Ki.reportError(s,r,r._errorEvent,h,0,0,0),s.retry?u():Promise.reject(new Se(h))}function u(){return ou.loadImage(null,t).then(a).catch(c)}this._readyPromise=u()}Object.defineProperties(RT.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}}});RT.prototype.getTileCredits=function(e,t,n){};RT.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)};RT.prototype.pickFeatures=function(e,t,n,i,o){};function UI(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=YCe;else if(e==="xml")n=JCe;else if(e==="html")n=rU;else if(e==="text")n=rU;else throw new x('callback is required when type is not "json", "xml", "html", or "text".');this.callback=n}function YCe(e){const t=[],n=e.features;for(let i=0;i<n.length;++i){const o=n[i],r=new xp;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=Ae.fromDegrees(s,a)}t.push(r)}return t}const OL="http://www.mapinfo.com/mxp",$Ce="http://www.esri.com/wms",XCe="http://www.opengis.net/wfs",KCe="http://www.opengis.net/gml";function JCe(e){const t=e.documentElement;if(t.localName==="MultiFeatureCollection"&&t.namespaceURI===OL)return QCe(e);if(t.localName==="FeatureInfoResponse"&&t.namespaceURI===$Ce)return ZCe(e);if(t.localName==="FeatureCollection"&&t.namespaceURI===XCe)return eTe(e);if(t.localName==="ServiceExceptionReport")throw new Se(new XMLSerializer().serializeToString(t));return t.localName==="msGMLOutput"?tTe(e):nTe(e)}function QCe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(OL,"Feature");for(let o=0;o<i.length;++o){const r=i[o],s={},a=r.getElementsByTagNameNS(OL,"Val");for(let u=0;u<a.length;++u){const f=a[u];if(f.hasAttribute("ref")){const h=f.getAttribute("ref"),_=f.textContent.trim();s[h]=_}}const c=new xp;c.data=r,c.properties=s,c.configureNameFromProperties(s),c.configureDescriptionFromProperties(s),t.push(c)}return t}function ZCe(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(fS(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 f=c[u];f.nodeType===Node.ELEMENT_NODE&&(i[f.localName]=f.textContent)}n.push(fS(a,i))}}return n}function eTe(e){const t=[],i=e.documentElement.getElementsByTagNameNS(KCe,"featureMember");for(let o=0;o<i.length;++o){const r=i[o],s={};IN(r,s),t.push(fS(r,s))}return t}function tTe(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 Se("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={};IN(s,a),t.push(fS(s,a))}}return t}function IN(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()&&IN(o,t)&&(t[o.localName]=o.textContent)}return n}function fS(e,t){const n=new xp;return n.data=e,n.properties=t,n.configureNameFromProperties(t),n.configureDescriptionFromProperties(t),n}function nTe(e){const t=new XMLSerializer().serializeToString(e),n=document.createElement("div"),i=document.createElement("pre");i.textContent=t,n.appendChild(i);const o=new xp;return o.data=e,o.description=n.innerHTML,[o]}const iTe=/<body>\s*<\/body>/im,oTe=/<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im,rTe=/<title>([\s\S]*)<\/title>/im;function rU(e){if(iTe.test(e)||oTe.test(e))return;let t;const n=rTe.exec(e);n&&n.length>1&&(t=n[1]);const i=new xp;return i.name=t,i.description=e,i.data=e,[i]}function a0(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.clock",e.clock),b.typeOf.object("options.times",e.times),b.typeOf.func("options.requestImageFunction",e.requestImageFunction),b.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(a0.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)}}});a0.prototype.getFromCache=function(e,t,n,i){const o=bj(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};a0.prototype.checkApproachingInterval=function(e,t,n,i){const o=bj(e,t,n),r=this._tilesRequestedForInterval,s=Ej(this),a={key:o,priorityFunction:i.priorityFunction};(!l(s)||!xj(this,a,s))&&r.push(a),r.length>=512&&r.splice(0,256)};a0.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=Ej(this);if(l(r)){const s=this._tilesRequestedForInterval;let a=!0;for(;a&&s.length!==0;){const c=s.pop();a=xj(this,c,r),a||s.push(c)}}};function bj(e,t,n){return`${e}-${t}-${n}`}function sTe(e){const t=e.split("-");if(t.length===3)return{x:Number(t[0]),y:Number(t[1]),level:Number(t[2])}}function Ej(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=ne.secondsDifference(c.stop,i),++a):(s=ne.secondsDifference(c.start,i),--a),s/=r,a>=0&&s<=5?t.get(a):void 0}function xj(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=sTe(s),c=new ju({throttle:!1,throttleByServer:!0,type:C_.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 aTe=[3034,3035,3042,3043,3044],cTe=[4471,4559];function Ml(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=Re.createIfNeeded(e.url),n=Re.createIfNeeded(this._getFeatureInfoUrl);t.setQueryParameters(Ml.DefaultParameters,!0),n.setQueryParameters(Ml.GetFeatureInfoDefaultParameters,!0),l(e.parameters)&&t.setQueryParameters(sU(e.parameters)),l(e.getFeatureInfoParameters)&&n.setQueryParameters(sU(e.getFeatureInfoParameters));const i=this;this._reload=void 0,l(e.times)&&(this._timeDynamicImagery=new a0({clock:e.clock,times:e.times,requestImageFunction:function(s,a,c,u,f){return wj(i,s,a,c,u,f)},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 Zn?"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&&!cTe.includes(a)||aTe.includes(a))&&(o.bbox="{southProjected},{westProjected},{northProjected},{eastProjected}")}}else o.srs=A(e.srs,e.tilingScheme&&e.tilingScheme.projection instanceof Zn?"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 _c({url:t,pickFeaturesUrl:n,tilingScheme:A(e.tilingScheme,new Xs({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,Ml.DefaultGetFeatureInfoFormats),enablePickFeatures:e.enablePickFeatures})}function wj(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 lTe(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(Ml.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}}});Ml.prototype.getTileCredits=function(e,t,n){return this._tileProvider.getTileCredits(e,t,n)};Ml.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=wj(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};Ml.prototype.pickFeatures=function(e,t,n,i,o){const r=this._timeDynamicImagery,s=l(r)?r.currentInterval:void 0;return lTe(this,e,t,n,i,o,s)};Ml.DefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetMap",styles:"",format:"image/jpeg"});Ml.GetFeatureInfoDefaultParameters=Object.freeze({service:"WMS",version:"1.1.1",request:"GetFeatureInfo"});Ml.DefaultGetFeatureInfoFormats=Object.freeze([Object.freeze(new UI("json","application/json")),Object.freeze(new UI("xml","text/xml")),Object.freeze(new UI("text","text/html"))]);function sU(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n.toLowerCase()]=e[n]);return t}const uTe=Object.freeze({service:"WMTS",version:"1.0.0",request:"GetTile"});function NT(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=Re.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(uTe),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 ws({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 a0({clock:e.clock,times:e.times,requestImageFunction:function(h,_,g,p,y){return Sj(s,h,_,g,p,y)},reloadFunction:function(){l(s._reload)&&s._reload()}})),this._readyPromise=Promise.resolve(!0);const a=this._tilingScheme.positionToTileXY(_e.southwest(this._rectangle),this._minimumLevel),c=this._tilingScheme.positionToTileXY(_e.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 $e;const f=e.credit;this._credit=typeof f=="string"?new Kn(f):f,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 Sj(e,t,n,i,o,r){const s=e._tileMatrixLabels,a=l(s)?s[i]:i.toString(),c=e._subdomains,u=e._dimensions,f=l(r)?r.data:void 0;let h,_;if(!e._useKvp)_={TileMatrix:a,TileRow:n.toString(),TileCol:t.toString(),s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({request:o}),h.setTemplateValues(_),l(u)&&h.setTemplateValues(u),l(f)&&h.setTemplateValues(f);else{let g={};g.tilematrix=a,g.layer=e._layer,g.style=e._style,g.tilerow=n,g.tilecol=t,g.tilematrixset=e._tileMatrixSetID,g.format=e._format,l(u)&&(g=sn(g,u)),l(f)&&(g=sn(g,f)),_={s:c[(t+n+i)%c.length]},h=e._resource.getDerivedResource({queryParameters:g,request:o}),h.setTemplateValues(_)}return ou.loadImage(e,h)}Object.defineProperties(NT.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())}}});NT.prototype.getTileCredits=function(e,t,n){};NT.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=Sj(this,e,t,n,i,s)),l(o)&&l(r)&&r.checkApproachingInterval(e,t,n,i),o};NT.prototype.pickFeatures=function(e,t,n,i,o){};function vf(e){return function(t){return new e(t)}}const fTe={ARCGIS_MAPSERVER:vf(kh),BING:vf(es),GOOGLE_EARTH:vf(Hc),MAPBOX:vf(s0),SINGLE_TILE:vf(RT),TMS:vf(Jf),URL_TEMPLATE:vf(_c),WMS:vf(Ml),WMTS:vf(NT)};function Fl(e){e=A(e,A.EMPTY_OBJECT);const t=e.assetId;b.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 $e;const n=this,i=ts._createEndpointResource(t,e),o=e.assetId.toString()+e.accessToken+e.server;let r=Fl._endpointCache[o];l(r)||(r=i.fetchJson(),Fl._endpointCache[o]=r),this._readyPromise=r.then(function(s){if(s.type!=="IMAGERY")return Promise.reject(new Se(`Cesium ion asset ${t} is not an imagery asset.`));let a;const c=s.externalType;if(!l(c))a=new Jf({url:new ts(s,i)});else{const u=fTe[c];if(!l(u))return Promise.reject(new Se(`Unrecognized Cesium ion imagery type: ${c}`));a=u(s.options)}return n._tileCredits=ts.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(Fl.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(){}}}});Fl.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};Fl.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)};Fl.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)};Fl._endpointCache={};const dTe={AERIAL:2,AERIAL_WITH_LABELS:3,ROAD:4},iw=Object.freeze(dTe);function ow(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.style,iw.AERIAL);return new Fl({assetId:t})}const hTe={UNBOUNDED:0,CLAMPED:1,LOOP_STOP:2},Gh=Object.freeze(hTe),pTe={TICK_DEPENDENT:0,SYSTEM_CLOCK_MULTIPLIER:1,SYSTEM_CLOCK:2},Ms=Object.freeze(pTe);let LL;typeof performance<"u"&&typeof performance.now=="function"&&isFinite(performance.now())?LL=function(){return performance.now()}:LL=function(){return Date.now()};const er=LL;function MT(e){e=A(e,A.EMPTY_OBJECT);let t=e.currentTime,n=e.startTime,i=e.stopTime;if(l(t)?t=ne.clone(t):l(n)?t=ne.clone(n):l(i)?t=ne.addDays(i,-1,new ne):t=ne.now(),l(n)?n=ne.clone(n):n=ne.clone(t),l(i)?i=ne.clone(i):i=ne.addDays(n,1,new ne),ne.greaterThan(n,i))throw new x("startTime must come before stopTime.");this.startTime=n,this.stopTime=i,this.clockRange=A(e.clockRange,Gh.UNBOUNDED),this.canAnimate=A(e.canAnimate,!0),this.onTick=new $e,this.onStop=new $e,this._currentTime=void 0,this._multiplier=void 0,this._clockStep=void 0,this._shouldAnimate=void 0,this._lastSystemTime=er(),this.currentTime=t,this.multiplier=A(e.multiplier,1),this.shouldAnimate=A(e.shouldAnimate,!1),this.clockStep=A(e.clockStep,Ms.SYSTEM_CLOCK_MULTIPLIER)}Object.defineProperties(MT.prototype,{currentTime:{get:function(){return this._currentTime},set:function(e){ne.equals(this._currentTime,e)||(this._clockStep===Ms.SYSTEM_CLOCK&&(this._clockStep=Ms.SYSTEM_CLOCK_MULTIPLIER),this._currentTime=e)}},multiplier:{get:function(){return this._multiplier},set:function(e){this._multiplier!==e&&(this._clockStep===Ms.SYSTEM_CLOCK&&(this._clockStep=Ms.SYSTEM_CLOCK_MULTIPLIER),this._multiplier=e)}},clockStep:{get:function(){return this._clockStep},set:function(e){e===Ms.SYSTEM_CLOCK&&(this._multiplier=1,this._shouldAnimate=!0,this._currentTime=ne.now()),this._clockStep=e}},shouldAnimate:{get:function(){return this._shouldAnimate},set:function(e){this._shouldAnimate!==e&&(this._clockStep===Ms.SYSTEM_CLOCK&&(this._clockStep=Ms.SYSTEM_CLOCK_MULTIPLIER),this._shouldAnimate=e)}}});MT.prototype.tick=function(){const e=er();let t=ne.clone(this._currentTime);if(this.canAnimate&&this._shouldAnimate){const n=this._clockStep;if(n===Ms.SYSTEM_CLOCK)t=ne.now(t);else{const i=this._multiplier;if(n===Ms.TICK_DEPENDENT)t=ne.addSeconds(t,i,t);else{const a=e-this._lastSystemTime;t=ne.addSeconds(t,i*(a/1e3),t)}const o=this.clockRange,r=this.startTime,s=this.stopTime;if(o===Gh.CLAMPED)ne.lessThan(t,r)?t=ne.clone(r,t):ne.greaterThan(t,s)&&(t=ne.clone(s,t),this.onStop.raiseEvent(this));else if(o===Gh.LOOP_STOP)for(ne.lessThan(t,r)&&(t=ne.clone(r,t));ne.greaterThan(t,s);)t=ne.addSeconds(r,ne.secondsDifference(t,s),t),this.onStop.raiseEvent(this)}}return this._currentTime=t,this._lastSystemTime=e,this.onTick.raiseEvent(this),t};function cr(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 Ih(e,t){this.start=A(e,0),this.stop=A(t,0)}function fe(e,t){this.center=d.clone(A(e,d.ZERO)),this.radius=A(t,0)}const PN=new d,ON=new d,LN=new d,BN=new d,RN=new d,NN=new d,MN=new d,Kr=new d,FN=new d,zN=new d,UN=new d,HN=new d,mTe=4/3*N.PI;fe.fromPoints=function(e,t){if(l(t)||(t=new fe),!l(e)||e.length===0)return t.center=d.clone(d.ZERO,t.center),t.radius=0,t;const n=d.clone(e[0],MN),i=d.clone(n,PN),o=d.clone(n,ON),r=d.clone(n,LN),s=d.clone(n,BN),a=d.clone(n,RN),c=d.clone(n,NN),u=e.length;let f;for(f=1;f<u;f++){d.clone(e[f],n);const R=n.x,F=n.y,H=n.z;R<i.x&&d.clone(n,i),R>s.x&&d.clone(n,s),F<o.y&&d.clone(n,o),F>a.y&&d.clone(n,a),H<r.z&&d.clone(n,r),H>c.z&&d.clone(n,c)}const h=d.magnitudeSquared(d.subtract(s,i,Kr)),_=d.magnitudeSquared(d.subtract(a,o,Kr)),g=d.magnitudeSquared(d.subtract(c,r,Kr));let p=i,y=s,C=h;_>C&&(C=_,p=o,y=a),g>C&&(C=g,p=r,y=c);const T=FN;T.x=(p.x+y.x)*.5,T.y=(p.y+y.y)*.5,T.z=(p.z+y.z)*.5;let E=d.magnitudeSquared(d.subtract(y,T,Kr)),w=Math.sqrt(E);const S=zN;S.x=i.x,S.y=o.y,S.z=r.z;const P=UN;P.x=s.x,P.y=a.y,P.z=c.z;const O=d.midpoint(S,P,HN);let z=0;for(f=0;f<u;f++){d.clone(e[f],n);const R=d.magnitude(d.subtract(n,O,Kr));R>z&&(z=R);const F=d.magnitudeSquared(d.subtract(n,T,Kr));if(F>E){const H=Math.sqrt(F);w=(w+H)*.5,E=w*w;const v=H-w;T.x=(w*T.x+v*n.x)/H,T.y=(w*T.y+v*n.y)/H,T.z=(w*T.z+v*n.z)/H}}return w<z?(d.clone(T,t.center),t.radius=w):(d.clone(O,t.center),t.radius=z),t};const _Te=new jo,gTe=new d,yTe=new d,HI=new Ae,VI=new Ae;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=d.clone(d.ZERO,o.center),o.radius=0,o;t=A(t,_Te),_e.southwest(e,HI),HI.height=n,_e.northeast(e,VI),VI.height=i;const r=t.project(HI,gTe),s=t.project(VI,yTe),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 f=o.center;return f.x=r.x+a*.5,f.y=r.y+c*.5,f.z=r.z+u*.5,o};const ATe=[];fe.fromRectangle3D=function(e,t,n,i){if(t=A(t,pe.WGS84),n=A(n,0),l(i)||(i=new fe),!l(e))return i.center=d.clone(d.ZERO,i.center),i.radius=0,i;const o=_e.subsample(e,t,n,ATe);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=d.clone(d.ZERO,i.center),i.radius=0,i;t=A(t,d.ZERO),n=A(n,3),b.typeOf.number.greaterThanOrEquals("stride",n,3);const o=MN;o.x=e[0]+t.x,o.y=e[1]+t.y,o.z=e[2]+t.z;const r=d.clone(o,PN),s=d.clone(o,ON),a=d.clone(o,LN),c=d.clone(o,BN),u=d.clone(o,RN),f=d.clone(o,NN),h=e.length;let _;for(_=0;_<h;_+=n){const H=e[_]+t.x,v=e[_+1]+t.y,I=e[_+2]+t.z;o.x=H,o.y=v,o.z=I,H<r.x&&d.clone(o,r),H>c.x&&d.clone(o,c),v<s.y&&d.clone(o,s),v>u.y&&d.clone(o,u),I<a.z&&d.clone(o,a),I>f.z&&d.clone(o,f)}const g=d.magnitudeSquared(d.subtract(c,r,Kr)),p=d.magnitudeSquared(d.subtract(u,s,Kr)),y=d.magnitudeSquared(d.subtract(f,a,Kr));let C=r,T=c,E=g;p>E&&(E=p,C=s,T=u),y>E&&(E=y,C=a,T=f);const w=FN;w.x=(C.x+T.x)*.5,w.y=(C.y+T.y)*.5,w.z=(C.z+T.z)*.5;let S=d.magnitudeSquared(d.subtract(T,w,Kr)),P=Math.sqrt(S);const O=zN;O.x=r.x,O.y=s.y,O.z=a.z;const z=UN;z.x=c.x,z.y=u.y,z.z=f.z;const R=d.midpoint(O,z,HN);let F=0;for(_=0;_<h;_+=n){o.x=e[_]+t.x,o.y=e[_+1]+t.y,o.z=e[_+2]+t.z;const H=d.magnitude(d.subtract(o,R,Kr));H>F&&(F=H);const v=d.magnitudeSquared(d.subtract(o,w,Kr));if(v>S){const I=Math.sqrt(v);P=(P+I)*.5,S=P*P;const m=I-P;w.x=(P*w.x+m*o.x)/I,w.y=(P*w.y+m*o.y)/I,w.z=(P*w.z+m*o.z)/I}}return P<F?(d.clone(w,i.center),i.radius=P):(d.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=d.clone(d.ZERO,n.center),n.radius=0,n;const i=MN;i.x=e[0]+t[0],i.y=e[1]+t[1],i.z=e[2]+t[2];const o=d.clone(i,PN),r=d.clone(i,ON),s=d.clone(i,LN),a=d.clone(i,BN),c=d.clone(i,RN),u=d.clone(i,NN),f=e.length;let h;for(h=0;h<f;h+=3){const F=e[h]+t[h],H=e[h+1]+t[h+1],v=e[h+2]+t[h+2];i.x=F,i.y=H,i.z=v,F<o.x&&d.clone(i,o),F>a.x&&d.clone(i,a),H<r.y&&d.clone(i,r),H>c.y&&d.clone(i,c),v<s.z&&d.clone(i,s),v>u.z&&d.clone(i,u)}const _=d.magnitudeSquared(d.subtract(a,o,Kr)),g=d.magnitudeSquared(d.subtract(c,r,Kr)),p=d.magnitudeSquared(d.subtract(u,s,Kr));let y=o,C=a,T=_;g>T&&(T=g,y=r,C=c),p>T&&(T=p,y=s,C=u);const E=FN;E.x=(y.x+C.x)*.5,E.y=(y.y+C.y)*.5,E.z=(y.z+C.z)*.5;let w=d.magnitudeSquared(d.subtract(C,E,Kr)),S=Math.sqrt(w);const P=zN;P.x=o.x,P.y=r.y,P.z=s.z;const O=UN;O.x=a.x,O.y=c.y,O.z=u.z;const z=d.midpoint(P,O,HN);let R=0;for(h=0;h<f;h+=3){i.x=e[h]+t[h],i.y=e[h+1]+t[h+1],i.z=e[h+2]+t[h+2];const F=d.magnitude(d.subtract(i,z,Kr));F>R&&(R=F);const H=d.magnitudeSquared(d.subtract(i,E,Kr));if(H>w){const v=Math.sqrt(H);S=(S+v)*.5,w=S*S;const I=v-S;E.x=(S*E.x+I*i.x)/v,E.y=(S*E.y+I*i.y)/v,E.z=(S*E.z+I*i.z)/v}}return S<R?(d.clone(E,n.center),n.radius=S):(d.clone(z,n.center),n.radius=R),n};fe.fromCornerPoints=function(e,t,n){b.typeOf.object("corner",e),b.typeOf.object("oppositeCorner",t),l(n)||(n=new fe);const i=d.midpoint(e,t,n.center);return n.radius=d.distance(i,t),n};fe.fromEllipsoid=function(e,t){return b.typeOf.object("ellipsoid",e),l(t)||(t=new fe),d.clone(d.ZERO,t.center),t.radius=e.maximumRadius,t};const CTe=new d;fe.fromBoundingSpheres=function(e,t){if(l(t)||(t=new fe),!l(e)||e.length===0)return t.center=d.clone(d.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,d.distance(r,a.center,CTe)+a.radius)}return t.radius=s,t};const TTe=new d,bTe=new d,ETe=new d;fe.fromOrientedBoundingBox=function(e,t){b.defined("orientedBoundingBox",e),l(t)||(t=new fe);const n=e.halfAxes,i=J.getColumn(n,0,TTe),o=J.getColumn(n,1,bTe),r=J.getColumn(n,2,ETe);return d.add(i,o,i),d.add(i,r,i),t.center=d.clone(e.center,t.center),t.radius=d.magnitude(i),t};const xTe=new d,wTe=new d;fe.fromTransformation=function(e,t){b.typeOf.object("transformation",e),l(t)||(t=new fe);const n=B.getTranslation(e,xTe),i=B.getScale(e,wTe),o=.5*d.magnitude(i);return t.center=d.clone(n,t.center),t.radius=o,t};fe.clone=function(e,t){if(l(e))return l(t)?(t.center=d.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){b.typeOf.object("value",e),b.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){b.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 STe=new d,vTe=new d;fe.union=function(e,t,n){b.typeOf.object("left",e),b.typeOf.object("right",t),l(n)||(n=new fe);const i=e.center,o=e.radius,r=t.center,s=t.radius,a=d.subtract(r,i,STe),c=d.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,f=d.multiplyByScalar(a,(-o+u)/c,vTe);return d.add(f,i,f),d.clone(f,n.center),n.radius=u,n};const DTe=new d;fe.expand=function(e,t,n){b.typeOf.object("sphere",e),b.typeOf.object("point",t),n=fe.clone(e,n);const i=d.magnitude(d.subtract(t,n.center,DTe));return i>n.radius&&(n.radius=i),n};fe.intersectPlane=function(e,t){b.typeOf.object("sphere",e),b.typeOf.object("plane",t);const n=e.center,i=e.radius,o=t.normal,r=d.dot(o,n)+t.distance;return r<-i?mn.OUTSIDE:r<i?mn.INTERSECTING:mn.INSIDE};fe.transform=function(e,t,n){return b.typeOf.object("sphere",e),b.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 ITe=new d;fe.distanceSquaredTo=function(e,t){b.typeOf.object("sphere",e),b.typeOf.object("cartesian",t);const n=d.subtract(e.center,t,ITe),i=d.magnitude(n)-e.radius;return i<=0?0:i*i};fe.transformWithoutScale=function(e,t,n){return b.typeOf.object("sphere",e),b.typeOf.object("transform",t),l(n)||(n=new fe),n.center=B.multiplyByPoint(t,e.center,n.center),n.radius=e.radius,n};const PTe=new d;fe.computePlaneDistances=function(e,t,n,i){b.typeOf.object("sphere",e),b.typeOf.object("position",t),b.typeOf.object("direction",n),l(i)||(i=new Ih);const o=d.subtract(e.center,t,PTe),r=d.dot(n,o);return i.start=r-e.radius,i.stop=r+e.radius,i};const aU=new d,OTe=new d,LTe=new d,BTe=new d,RTe=new d,NTe=new Ae,vj=new Array(8);for(let e=0;e<8;++e)vj[e]=new d;const MTe=new jo;fe.projectTo2D=function(e,t,n){b.typeOf.object("sphere",e),t=A(t,MTe);const i=t.ellipsoid;let o=e.center;const r=e.radius;let s;d.equals(o,d.ZERO)?s=d.clone(d.UNIT_X,aU):s=i.geodeticSurfaceNormal(o,aU);const a=d.cross(d.UNIT_Z,s,OTe);d.normalize(a,a);const c=d.cross(s,a,LTe);d.normalize(c,c),d.multiplyByScalar(s,r,s),d.multiplyByScalar(c,r,c),d.multiplyByScalar(a,r,a);const u=d.negate(c,RTe),f=d.negate(a,BTe),h=vj;let _=h[0];d.add(s,c,_),d.add(_,a,_),_=h[1],d.add(s,c,_),d.add(_,f,_),_=h[2],d.add(s,u,_),d.add(_,f,_),_=h[3],d.add(s,u,_),d.add(_,a,_),d.negate(s,s),_=h[4],d.add(s,c,_),d.add(_,a,_),_=h[5],d.add(s,c,_),d.add(_,f,_),_=h[6],d.add(s,u,_),d.add(_,f,_),_=h[7],d.add(s,u,_),d.add(_,a,_);const g=h.length;for(let T=0;T<g;++T){const E=h[T];d.add(o,E,E);const w=i.cartesianToCartographic(E,NTe);t.project(w,E)}n=fe.fromPoints(h,n),o=n.center;const p=o.x,y=o.y,C=o.z;return o.x=C,o.y=p,o.z=y,n};fe.isOccluded=function(e,t){return b.typeOf.object("sphere",e),b.typeOf.object("occluder",t),!t.isBoundingSphereVisible(e)};fe.equals=function(e,t){return e===t||l(e)&&l(t)&&d.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 mTe*e*e*e};const FTe={NONE:0,LERC:1},BL=Object.freeze(FTe);function bs(e,t,n){this.minimum=d.clone(A(e,d.ZERO)),this.maximum=d.clone(A(t,d.ZERO)),l(n)?n=d.clone(n):n=d.midpoint(this.minimum,this.maximum,new d),this.center=n}bs.fromCorners=function(e,t,n){return b.defined("minimum",e),b.defined("maximum",t),l(n)||(n=new bs),n.minimum=d.clone(e,n.minimum),n.maximum=d.clone(t,n.maximum),n.center=d.midpoint(e,t,n.center),n};bs.fromPoints=function(e,t){if(l(t)||(t=new bs),!l(e)||e.length===0)return t.minimum=d.clone(d.ZERO,t.minimum),t.maximum=d.clone(d.ZERO,t.maximum),t.center=d.clone(d.ZERO,t.center),t;let n=e[0].x,i=e[0].y,o=e[0].z,r=e[0].x,s=e[0].y,a=e[0].z;const c=e.length;for(let h=1;h<c;h++){const _=e[h],g=_.x,p=_.y,y=_.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 f=t.maximum;return f.x=r,f.y=s,f.z=a,t.center=d.midpoint(u,f,t.center),t};bs.clone=function(e,t){if(l(e))return l(t)?(t.minimum=d.clone(e.minimum,t.minimum),t.maximum=d.clone(e.maximum,t.maximum),t.center=d.clone(e.center,t.center),t):new bs(e.minimum,e.maximum,e.center)};bs.equals=function(e,t){return e===t||l(e)&&l(t)&&d.equals(e.center,t.center)&&d.equals(e.minimum,t.minimum)&&d.equals(e.maximum,t.maximum)};let sE=new d;bs.intersectPlane=function(e,t){b.defined("box",e),b.defined("plane",t),sE=d.subtract(e.maximum,e.minimum,sE);const n=d.multiplyByScalar(sE,.5,sE),i=t.normal,o=n.x*Math.abs(i.x)+n.y*Math.abs(i.y)+n.z*Math.abs(i.z),r=d.dot(e.center,i)+t.distance;return r-o>0?mn.INSIDE:r+o<0?mn.OUTSIDE:mn.INTERSECTING};bs.prototype.clone=function(e){return bs.clone(this,e)};bs.prototype.intersectPlane=function(e){return bs.intersectPlane(this,e)};bs.prototype.equals=function(e){return bs.equals(this,e)};function cl(e,t){b.typeOf.object("ellipsoid",e),this._ellipsoid=e,this._cameraPosition=new d,this._cameraPositionInScaledSpace=new d,this._distanceToLimbInScaledSpaceSquared=0,l(t)&&(this.cameraPosition=t)}Object.defineProperties(cl.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=d.magnitudeSquared(n)-1;d.clone(e,this._cameraPosition),this._cameraPositionInScaledSpace=n,this._distanceToLimbInScaledSpaceSquared=i}}});const Dj=new d;cl.prototype.isPointVisible=function(e){const n=this._ellipsoid.transformPositionToScaledSpace(e,Dj);return VN(n,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};cl.prototype.isScaledSpacePointVisible=function(e){return VN(e,this._cameraPositionInScaledSpace,this._distanceToLimbInScaledSpaceSquared)};const zTe=new d;cl.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid=function(e,t){const n=this._ellipsoid;let i,o;return l(t)&&t<0&&n.minimumRadius>-t?(o=zTe,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),VN(e,o,i)};cl.prototype.computeHorizonCullingPoint=function(e,t,n){return Oj(this._ellipsoid,e,t,n)};const Ij=pe.clone(pe.UNIT_SPHERE);cl.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid=function(e,t,n,i){const o=Pj(this._ellipsoid,n,Ij);return Oj(o,e,t,i)};cl.prototype.computeHorizonCullingPointFromVertices=function(e,t,n,i,o){return Lj(this._ellipsoid,e,t,n,i,o)};cl.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid=function(e,t,n,i,o,r){const s=Pj(this._ellipsoid,o,Ij);return Lj(s,e,t,n,i,r)};const UTe=[];cl.prototype.computeHorizonCullingPointFromRectangle=function(e,t,n){b.typeOf.object("rectangle",e);const i=_e.subsample(e,t,0,UTe),o=fe.fromPoints(i);if(!(d.magnitude(o.center)<.1*t.minimumRadius))return this.computeHorizonCullingPoint(o.center,i,n)};const HTe=new d;function Pj(e,t,n){if(l(t)&&t<0&&e.minimumRadius>-t){const i=d.fromElements(e.radii.x+t,e.radii.y+t,e.radii.z+t,HTe);e=pe.fromCartesian3(i,n)}return e}function Oj(e,t,n,i){b.typeOf.object("directionToPoint",t),b.defined("positions",n),l(i)||(i=new d);const o=Nj(e,t);let r=0;for(let s=0,a=n.length;s<a;++s){const c=n[s],u=Bj(e,c,o);if(u<0)return;r=Math.max(r,u)}return Rj(o,r,i)}const aE=new d;function Lj(e,t,n,i,o,r){b.typeOf.object("directionToPoint",t),b.defined("vertices",n),b.typeOf.number("stride",i),l(r)||(r=new d),i=A(i,3),o=A(o,d.ZERO);const s=Nj(e,t);let a=0;for(let c=0,u=n.length;c<u;c+=i){aE.x=n[c]+o.x,aE.y=n[c+1]+o.y,aE.z=n[c+2]+o.z;const f=Bj(e,aE,s);if(f<0)return;a=Math.max(a,f)}return Rj(s,a,r)}function VN(e,t,n){const i=t,o=n,r=d.subtract(e,i,Dj),s=-d.dot(r,i);return!(o<0?s>0:s>o&&s*s/d.magnitudeSquared(r)>o)}const VTe=new d,kTe=new d;function Bj(e,t,n){const i=e.transformPositionToScaledSpace(t,VTe);let o=d.magnitudeSquared(i),r=Math.sqrt(o);const s=d.divideByScalar(i,r,kTe);o=Math.max(1,o),r=Math.max(1,r);const a=d.dot(s,n),c=d.magnitude(d.cross(s,n,s)),u=1/r,f=Math.sqrt(o-1)*u;return 1/(a*u-c*f)}function Rj(e,t,n){if(!(t<=0||t===1/0||t!==t))return d.multiplyByScalar(e,t,n)}const kI=new d;function Nj(e,t){return d.equals(t,d.ZERO)?t:(e.transformPositionToScaledSpace(t,kI),d.normalize(kI,kI))}const kN={};kN.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 cU(e,t,n){const i=e+t;return N.sign(e)!==N.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}kN.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<N.EPSILON14)return[0,0];if(c>u&&u/c<N.EPSILON14)return[];if(i=-n/e,i<0)return[];const f=Math.sqrt(i);return[-f,f]}else if(n===0)return i=-t/e,i<0?[i,0]:[0,i];const o=t*t,r=4*e*n,s=cU(o,-r,N.EPSILON14);if(s<0)return[];const a=-.5*cU(t,N.sign(t)*Math.sqrt(s),N.EPSILON14);return t>0?[a/e,n/a]:[n/a,a/e]};const Qf=kN,GN={};GN.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 GI(e,t,n,i){const o=e,r=t/3,s=n/3,a=i,c=o*s,u=r*a,f=r*r,h=s*s,_=o*s-f,g=o*a-r*s,p=r*a-h,y=4*_*p-g*g;let C,T;if(y<0){let K,q,te;f*u>=c*h?(K=o,q=_,te=-2*r*_+o*g):(K=a,q=p,te=-a*g+2*s*p);const X=-(te<0?-1:1)*Math.abs(K)*Math.sqrt(-y);T=-te+X;const Y=T/2,ae=Y<0?-Math.pow(-Y,1/3):Math.pow(Y,1/3),ue=T===X?-ae:-q/ae;return C=q<=0?ae+ue:-te/(ae*ae+ue*ue+q),f*u>=c*h?[(C-r)/o]:[-a/(C+s)]}const E=_,w=-2*r*_+o*g,S=p,P=-a*g+2*s*p,O=Math.sqrt(y),z=Math.sqrt(3)/2;let R=Math.abs(Math.atan2(o*O,-w)/3);C=2*Math.sqrt(-E);let F=Math.cos(R);T=C*F;let H=C*(-F/2-z*Math.sin(R));const v=T+H>2*r?T-r:H-r,I=o,m=v/I;R=Math.abs(Math.atan2(a*O,-P)/3),C=2*Math.sqrt(-S),F=Math.cos(R),T=C*F,H=C*(-F/2-z*Math.sin(R));const D=-a,L=T+H<2*s?T+s:H+s,M=D/L,V=I*L,k=-v*L-I*D,W=v*D,G=(s*k-r*W)/(-r*k+s*V);return m<=G?m<=M?G<=M?[m,G,M]:[m,M,G]:[M,m,G]:m<=M?[G,m,M]:G<=M?[G,M,m]:[M,G,m]}GN.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 Qf.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=Qf.computeRealRoots(e,0,n),o.Length===0?[0]:[o[0],0,o[1]];return GI(e,0,n,i)}else{if(n===0)return i===0?(r=-t/e,r<0?[r,0,0]:[0,0,r]):GI(e,t,0,i);if(i===0)return o=Qf.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 GI(e,t,n,i)};const WN=GN,jN={};jN.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,f=u*n,h=i*i,_=h*i,g=o*o,p=g*o;return a*u*h-4*c*_-4*e*f*h+18*e*t*n*_-27*r*h*h+256*s*p+o*(18*c*n*i-4*a*f+16*e*u*u-80*e*t*u*i-6*e*a*h+144*r*n*h)+g*(144*e*a*n-27*a*a-128*r*u-192*r*t*i)};function gl(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=WN.computeRealRoots(1,2*r,r*r-4*a,-s*s);if(c.length>0){const u=-e/4,f=c[c.length-1];if(Math.abs(f)<N.EPSILON14){const h=Qf.computeRealRoots(1,r,a);if(h.length===2){const _=h[0],g=h[1];let p;if(_>=0&&g>=0){const y=Math.sqrt(_),C=Math.sqrt(g);return[u-C,u-y,u+y,u+C]}else{if(_>=0&&g<0)return p=Math.sqrt(_),[u-p,u+p];if(_<0&&g>=0)return p=Math.sqrt(g),[u-p,u+p]}}return[]}else if(f>0){const h=Math.sqrt(f),_=(r+f-s/h)/2,g=(r+f+s/h)/2,p=Qf.computeRealRoots(1,h,_),y=Qf.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 z0(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,f=WN.computeRealRoots(1,a,c,u);if(f.length>0){const h=f[0],_=t-h,g=_*_,p=e/2,y=_/2,C=g-4*i,T=g+4*Math.abs(i),E=s-4*h,w=s+4*Math.abs(h);let S,P;if(h<0||C*w<E*T){const I=Math.sqrt(E);S=I/2,P=I===0?0:(e*y-n)/I}else{const I=Math.sqrt(C);S=I===0?0:(e*y-n)/I,P=I/2}let O,z;p===0&&S===0?(O=0,z=0):N.sign(p)===N.sign(S)?(O=p+S,z=h/O):(z=p-S,O=h/z);let R,F;y===0&&P===0?(R=0,F=0):N.sign(y)===N.sign(P)?(R=y+P,F=i/R):(F=y-P,R=i/F);const H=Qf.computeRealRoots(1,O,R),v=Qf.computeRealRoots(1,z,F);if(H.length!==0)return v.length!==0?H[1]<=v[0]?[H[0],H[1],v[0],v[1]]:v[1]<=H[0]?[v[0],v[1],H[0],H[1]]:H[0]>=v[0]&&H[1]<=v[1]?[v[0],H[0],H[1],v[1]]:v[0]>=H[0]&&v[1]<=H[1]?[H[0],v[0],v[1],H[1]]:H[0]>v[0]&&H[0]<v[1]?[v[0],H[0],v[1],H[1]]:[H[0],v[0],H[1],v[1]]:H;if(v.length!==0)return v}return[]}jN.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)<N.EPSILON15)return WN.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 gl(r,s,a,c);case 1:return z0(r,s,a,c);case 2:return z0(r,s,a,c);case 3:return gl(r,s,a,c);case 4:return gl(r,s,a,c);case 5:return z0(r,s,a,c);case 6:return gl(r,s,a,c);case 7:return gl(r,s,a,c);case 8:return z0(r,s,a,c);case 9:return gl(r,s,a,c);case 10:return gl(r,s,a,c);case 11:return z0(r,s,a,c);case 12:return gl(r,s,a,c);case 13:return gl(r,s,a,c);case 14:return gl(r,s,a,c);case 15:return gl(r,s,a,c);default:return}};const GTe=jN;function Pn(e,t){t=d.clone(A(t,d.ZERO)),d.equals(t,d.ZERO)||d.normalize(t,t),this.origin=d.clone(A(e,d.ZERO)),this.direction=t}Pn.clone=function(e,t){if(l(e))return l(t)?(t.origin=d.clone(e.origin),t.direction=d.clone(e.direction),t):new Pn(e.origin,e.direction)};Pn.getPoint=function(e,t,n){return b.typeOf.object("ray",e),b.typeOf.number("t",t),l(n)||(n=new d),n=d.multiplyByScalar(e.direction,t,n),d.add(e.origin,n,n)};const uo={};uo.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 d);const i=e.origin,o=e.direction,r=t.normal,s=d.dot(r,o);if(Math.abs(s)<N.EPSILON15)return;const a=(-t.distance-d.dot(r,i))/s;if(!(a<0))return n=d.multiplyByScalar(o,a,n),d.add(i,n,n)};const WTe=new d,jTe=new d,Mj=new d,lU=new d,uU=new d;uo.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=d.subtract(n,t,WTe),c=d.subtract(i,t,jTe),u=d.cross(s,c,Mj),f=d.dot(a,u);let h,_,g,p,y;if(o){if(f<N.EPSILON6||(h=d.subtract(r,t,lU),g=d.dot(h,u),g<0||g>f)||(_=d.cross(h,a,uU),p=d.dot(s,_),p<0||g+p>f))return;y=d.dot(c,_)/f}else{if(Math.abs(f)<N.EPSILON6)return;const C=1/f;if(h=d.subtract(r,t,lU),g=d.dot(h,u)*C,g<0||g>1||(_=d.cross(h,a,uU),p=d.dot(s,_)*C,p<0||g+p>1))return;y=d.dot(c,_)*C}return y};uo.rayTriangle=function(e,t,n,i,o,r){const s=uo.rayTriangleParametric(e,t,n,i,o);if(!(!l(s)||s<0))return l(r)||(r=new d),d.multiplyByScalar(e.direction,s,r),d.add(e.origin,r,r)};const qTe=new Pn;uo.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=qTe;d.clone(e,a.origin),d.subtract(t,e,a.direction),d.normalize(a.direction,a.direction);const c=uo.rayTriangleParametric(a,n,i,o,r);if(!(!l(c)||c<0||c>d.distance(e,t)))return l(s)||(s=new d),d.multiplyByScalar(a.direction,c,s),d.add(a.origin,s,s)};function YTe(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 $Te={root0:0,root1:0};function Fj(e,t,n){l(n)||(n=new Ih);const i=e.origin,o=e.direction,r=t.center,s=t.radius*t.radius,a=d.subtract(i,r,Mj),c=d.dot(o,o),u=2*d.dot(o,a),f=d.magnitudeSquared(a)-s,h=YTe(c,u,f,$Te);if(l(h))return n.start=h.root0,n.stop=h.root1,n}uo.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=Fj(e,t,n),!(!l(n)||n.stop<0))return n.start=Math.max(n.start,0),n};const XTe=new Pn;uo.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=XTe;d.clone(e,o.origin);const r=d.subtract(t,e,o.direction),s=d.magnitude(r);if(d.normalize(r,r),i=Fj(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 KTe=new d,JTe=new d;uo.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=d.multiplyComponents(n,e.origin,KTe),o=d.multiplyComponents(n,e.direction,JTe),r=d.magnitudeSquared(i),s=d.dot(i,o);let a,c,u,f,h;if(r>1){if(s>=0)return;const _=s*s;if(a=r-1,c=d.magnitudeSquared(o),u=c*a,_<u)return;if(_>u){f=s*s-u,h=-s+Math.sqrt(f);const p=h/c,y=a/h;return p<y?new Ih(p,y):{start:y,stop:p}}const g=Math.sqrt(a/c);return new Ih(g,g)}else if(r<1)return a=r-1,c=d.magnitudeSquared(o),u=c*a,f=s*s-u,h=-s+Math.sqrt(f),new Ih(0,h/c);if(s<0)return c=d.magnitudeSquared(o),new Ih(0,-s/c)};function Wp(e,t,n){const i=e+t;return N.sign(e)!==N.sign(t)&&Math.abs(i/Math.max(Math.abs(e),Math.abs(t)))<n?0:i}function QTe(e,t,n,i,o){const r=i*i,s=o*o,a=(e[J.COLUMN1ROW1]-e[J.COLUMN2ROW2])*s,c=o*(i*Wp(e[J.COLUMN1ROW0],e[J.COLUMN0ROW1],N.EPSILON15)+t.y),u=e[J.COLUMN0ROW0]*r+e[J.COLUMN2ROW2]*s+i*t.x+n,f=s*Wp(e[J.COLUMN2ROW1],e[J.COLUMN1ROW2],N.EPSILON15),h=o*(i*Wp(e[J.COLUMN2ROW0],e[J.COLUMN0ROW2])+t.z);let _;const g=[];if(h===0&&f===0){if(_=Qf.computeRealRoots(a,c,u),_.length===0)return g;const R=_[0],F=Math.sqrt(Math.max(1-R*R,0));if(g.push(new d(i,o*R,o*-F)),g.push(new d(i,o*R,o*F)),_.length===2){const H=_[1],v=Math.sqrt(Math.max(1-H*H,0));g.push(new d(i,o*H,o*-v)),g.push(new d(i,o*H,o*v))}return g}const p=h*h,y=f*f,C=a*a,T=h*f,E=C+y,w=2*(c*a+T),S=2*u*a+c*c-y+p,P=2*(u*c-T),O=u*u-p;if(E===0&&w===0&&S===0&&P===0)return g;_=GTe.computeRealRoots(E,w,S,P,O);const z=_.length;if(z===0)return g;for(let R=0;R<z;++R){const F=_[R],H=F*F,v=Math.max(1-H,0),I=Math.sqrt(v);let m;N.sign(a)===N.sign(u)?m=Wp(a*H+u,c*F,N.EPSILON12):N.sign(u)===N.sign(c*F)?m=Wp(a*H,c*F+u,N.EPSILON12):m=Wp(a*H+c*F,u,N.EPSILON12);const D=Wp(f*F,h,N.EPSILON15),L=m*D;L<0?g.push(new d(i,o*F,o*I)):L>0?g.push(new d(i,o*F,o*-I)):I!==0?(g.push(new d(i,o*F,o*-I)),g.push(new d(i,o*F,o*I)),++R):g.push(new d(i,o*F,o*I))}return g}const WI=new d,fU=new d,dU=new d,cE=new d,ZTe=new d,ebe=new J,tbe=new J,nbe=new J,ibe=new J,obe=new J,hU=new J,pU=new J,mU=new d,rbe=new d,sbe=new Ae;uo.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(!d.equals(n,d.ZERO)){const O=t.geodeticSurfaceNormal(n,WI);if(d.dot(i,O)>=0)return n}const o=l(this.rayEllipsoid(e,t)),r=t.transformPositionToScaledSpace(i,WI),s=d.normalize(r,r),a=d.mostOrthogonalAxis(r,cE),c=d.normalize(d.cross(a,s,fU),fU),u=d.normalize(d.cross(s,c,dU),dU),f=ebe;f[0]=s.x,f[1]=s.y,f[2]=s.z,f[3]=c.x,f[4]=c.y,f[5]=c.z,f[6]=u.x,f[7]=u.y,f[8]=u.z;const h=J.transpose(f,tbe),_=J.fromScale(t.radii,nbe),g=J.fromScale(t.oneOverRadii,ibe),p=obe;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,hU),p,hU),C=J.multiply(J.multiply(y,_,pU),f,pU),T=J.multiplyByVector(y,n,ZTe),E=QTe(C,d.negate(T,WI),0,0,1);let w,S;const P=E.length;if(P>0){let O=d.clone(d.ZERO,rbe),z=Number.NEGATIVE_INFINITY;for(let F=0;F<P;++F){w=J.multiplyByVector(_,J.multiplyByVector(f,E[F],mU),mU);const H=d.normalize(d.subtract(w,n,cE),cE),v=d.dot(H,i);v>z&&(z=v,O=d.clone(w,O))}const R=t.cartesianToCartographic(O,sbe);return z=N.clamp(z,0,1),S=d.magnitude(d.subtract(O,n,cE))*Math.sqrt(1-z*z),S=o?-S:S,R.height=S,t.cartographicToCartesian(R,new d)}};const abe=new d;uo.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 d);const o=d.subtract(t,e,abe),r=n.normal,s=d.dot(r,o);if(Math.abs(s)<N.EPSILON6)return;const a=d.dot(r,e),c=-(n.distance+a)/s;if(!(c<0||c>1))return d.multiplyByScalar(o,c,i),d.add(e,i,i),i};uo.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=d.dot(o,e)+r<0,a=d.dot(o,t)+r<0,c=d.dot(o,n)+r<0;let u=0;u+=s?1:0,u+=a?1:0,u+=c?1:0;let f,h;if((u===1||u===2)&&(f=new d,h=new d),u===1){if(s)return uo.lineSegmentPlane(e,t,i,f),uo.lineSegmentPlane(e,n,i,h),{positions:[e,t,n,f,h],indices:[0,3,4,1,2,4,1,4,3]};if(a)return uo.lineSegmentPlane(t,n,i,f),uo.lineSegmentPlane(t,e,i,h),{positions:[e,t,n,f,h],indices:[1,3,4,2,0,4,2,4,3]};if(c)return uo.lineSegmentPlane(n,e,i,f),uo.lineSegmentPlane(n,t,i,h),{positions:[e,t,n,f,h],indices:[2,3,4,0,1,4,0,4,3]}}else if(u===2)if(s)if(a){if(!c)return uo.lineSegmentPlane(e,n,i,f),uo.lineSegmentPlane(t,n,i,h),{positions:[e,t,n,f,h],indices:[0,1,4,0,4,3,2,3,4]}}else return uo.lineSegmentPlane(n,t,i,f),uo.lineSegmentPlane(e,t,i,h),{positions:[e,t,n,f,h],indices:[2,0,4,2,4,3,1,3,4]};else return uo.lineSegmentPlane(t,e,i,f),uo.lineSegmentPlane(n,e,i,h),{positions:[e,t,n,f,h],indices:[1,2,4,1,4,3,0,3,4]}};const nr=uo,jI=new oe;function ss(e,t){if(b.defined("origin",e),t=A(t,pe.WGS84),e=t.scaleToGeodeticSurface(e),!l(e))throw new x("origin must not be at the center of the ellipsoid.");const n=tn.eastNorthUpToFixedFrame(e,t);this._ellipsoid=t,this._origin=e,this._xAxis=d.fromCartesian4(B.getColumn(n,0,jI)),this._yAxis=d.fromCartesian4(B.getColumn(n,1,jI));const i=d.fromCartesian4(B.getColumn(n,2,jI));this._plane=St.fromPointNormal(e,i)}Object.defineProperties(ss.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 cbe=new bs;ss.fromPoints=function(e,t){b.defined("cartesians",e);const n=bs.fromPoints(e,cbe);return new ss(n.center,t)};const zj=new Pn,dS=new d;ss.prototype.projectPointOntoPlane=function(e,t){b.defined("cartesian",e);const n=zj;n.origin=e,d.normalize(e,n.direction);let i=nr.rayPlane(n,this._plane,dS);if(l(i)||(d.negate(n.direction,n.direction),i=nr.rayPlane(n,this._plane,dS)),l(i)){const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return l(t)?(t.x=r,t.y=s,t):new j(r,s)}};ss.prototype.projectPointsOntoPlane=function(e,t){b.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};ss.prototype.projectPointToNearestOnPlane=function(e,t){b.defined("cartesian",e),l(t)||(t=new j);const n=zj;n.origin=e,d.clone(this._plane.normal,n.direction);let i=nr.rayPlane(n,this._plane,dS);l(i)||(d.negate(n.direction,n.direction),i=nr.rayPlane(n,this._plane,dS));const o=d.subtract(i,this._origin,i),r=d.dot(this._xAxis,o),s=d.dot(this._yAxis,o);return t.x=r,t.y=s,t};ss.prototype.projectPointsToNearestOnPlane=function(e,t){b.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 lbe=new d;ss.prototype.projectPointOntoEllipsoid=function(e,t){b.defined("cartesian",e),l(t)||(t=new d);const n=this._ellipsoid,i=this._origin,o=this._xAxis,r=this._yAxis,s=lbe;return d.multiplyByScalar(o,e.x,s),t=d.add(i,s,t),d.multiplyByScalar(r,e.y,s),d.add(t,s,t),n.scaleToGeocentricSurface(t,t),t};ss.prototype.projectPointsOntoEllipsoid=function(e,t){b.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 Bt(e,t){this.center=d.clone(A(e,d.ZERO)),this.halfAxes=J.clone(A(t,J.ZERO))}Bt.packedLength=d.packedLength+J.packedLength;Bt.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),d.pack(e.center,t,n),J.pack(e.halfAxes,t,n+d.packedLength),t};Bt.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new Bt),d.unpack(e,t,n.center),J.unpack(e,t+d.packedLength,n.halfAxes),n};const ube=new d,fbe=new d,dbe=new d,hbe=new d,pbe=new d,mbe=new d,_be=new J,gbe={unitary:new J,diagonal:new J};Bt.fromPoints=function(e,t){if(l(t)||(t=new Bt),!l(e)||e.length===0)return t.halfAxes=J.ZERO,t.center=d.ZERO,t;let n;const i=e.length,o=d.clone(e[0],ube);for(n=1;n<i;n++)d.add(o,e[n],o);const r=1/i;d.multiplyByScalar(o,r,o);let s=0,a=0,c=0,u=0,f=0,h=0,_;for(n=0;n<i;n++)_=d.subtract(e[n],o,fbe),s+=_.x*_.x,a+=_.x*_.y,c+=_.x*_.z,u+=_.y*_.y,f+=_.y*_.z,h+=_.z*_.z;s*=r,a*=r,c*=r,u*=r,f*=r,h*=r;const g=_be;g[0]=s,g[1]=a,g[2]=c,g[3]=a,g[4]=u,g[5]=f,g[6]=c,g[7]=f,g[8]=h;const p=J.computeEigenDecomposition(g,gbe),y=J.clone(p.unitary,t.halfAxes);let C=J.getColumn(y,0,hbe),T=J.getColumn(y,1,pbe),E=J.getColumn(y,2,mbe),w=-Number.MAX_VALUE,S=-Number.MAX_VALUE,P=-Number.MAX_VALUE,O=Number.MAX_VALUE,z=Number.MAX_VALUE,R=Number.MAX_VALUE;for(n=0;n<i;n++)_=e[n],w=Math.max(d.dot(C,_),w),S=Math.max(d.dot(T,_),S),P=Math.max(d.dot(E,_),P),O=Math.min(d.dot(C,_),O),z=Math.min(d.dot(T,_),z),R=Math.min(d.dot(E,_),R);C=d.multiplyByScalar(C,.5*(O+w),C),T=d.multiplyByScalar(T,.5*(z+S),T),E=d.multiplyByScalar(E,.5*(R+P),E);const F=d.add(C,T,t.center);d.add(F,E,F);const H=dbe;return H.x=w-O,H.y=S-z,H.z=P-R,d.multiplyByScalar(H,.5,H),J.multiplyByScale(t.halfAxes,H,t.halfAxes),t};const Uj=new d,ybe=new d;function _U(e,t,n,i,o,r,s,a,c,u,f){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(f)||(f=new Bt);const h=f.halfAxes;J.setColumn(h,0,t,h),J.setColumn(h,1,n,h),J.setColumn(h,2,i,h);let _=Uj;_.x=(o+r)/2,_.y=(s+a)/2,_.z=(c+u)/2;const g=ybe;g.x=(r-o)/2,g.y=(a-s)/2,g.z=(u-c)/2;const p=f.center;return _=J.multiplyByVector(h,_,_),d.add(e,_,p),J.multiplyByScale(h,g,h),f}const gU=new Ae,Abe=new d,Cbe=new Ae,Tbe=new Ae,bbe=new Ae,Ebe=new Ae,xbe=new Ae,wbe=new d,yU=new d,Sbe=new d,AU=new d,vbe=new d,Dbe=new j,Ibe=new j,Pbe=new j,Obe=new j,Lbe=new j,Bbe=new d,Rbe=new d,Nbe=new d,Mbe=new d,Fbe=new j,zbe=new d,Ube=new d,Hbe=new d,Vbe=new St(d.UNIT_X,0);Bt.fromRectangle=function(e,t,n,i,o){if(!l(e))throw new x("rectangle is required");if(e.width<0||e.width>N.TWO_PI)throw new x("Rectangle width must be between 0 and 2 * pi");if(e.height<0||e.height>N.PI)throw new x("Rectangle height must be between 0 and pi");if(l(i)&&!N.equalsEpsilon(i.radii.x,i.radii.y,N.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,pe.WGS84);let r,s,a,c,u,f,h;if(e.width<=N.PI){const z=_e.center(e,gU),R=i.cartographicToCartesian(z,Abe),F=new ss(R,i);h=F.plane;const H=z.longitude,v=e.south<0&&e.north>0?0:z.latitude,I=Ae.fromRadians(H,e.north,n,Cbe),m=Ae.fromRadians(e.west,e.north,n,Tbe),D=Ae.fromRadians(e.west,v,n,bbe),L=Ae.fromRadians(e.west,e.south,n,Ebe),M=Ae.fromRadians(H,e.south,n,xbe),V=i.cartographicToCartesian(I,wbe);let k=i.cartographicToCartesian(m,yU);const W=i.cartographicToCartesian(D,Sbe);let G=i.cartographicToCartesian(L,AU);const K=i.cartographicToCartesian(M,vbe),q=F.projectPointToNearestOnPlane(V,Dbe),te=F.projectPointToNearestOnPlane(k,Ibe),$=F.projectPointToNearestOnPlane(W,Pbe),X=F.projectPointToNearestOnPlane(G,Obe),Y=F.projectPointToNearestOnPlane(K,Lbe);return r=Math.min(te.x,$.x,X.x),s=-r,c=Math.max(te.y,q.y),a=Math.min(X.y,Y.y),m.height=L.height=t,k=i.cartographicToCartesian(m,yU),G=i.cartographicToCartesian(L,AU),u=Math.min(St.getPointDistance(h,k),St.getPointDistance(h,G)),f=n,_U(F.origin,F.xAxis,F.yAxis,F.zAxis,r,s,a,c,u,f,o)}const _=e.south>0,g=e.north<0,p=_?e.south:g?e.north:0,y=_e.center(e,gU).longitude,C=d.fromRadians(y,p,n,i,Bbe);C.z=0;const E=Math.abs(C.x)<N.EPSILON10&&Math.abs(C.y)<N.EPSILON10?d.UNIT_X:d.normalize(C,Rbe),w=d.UNIT_Z,S=d.cross(E,w,Nbe);h=St.fromPointNormal(C,E,Vbe);const P=d.fromRadians(y+N.PI_OVER_TWO,p,n,i,Mbe);s=d.dot(St.projectPointOntoPlane(h,P,Fbe),S),r=-s,c=d.fromRadians(0,e.north,g?t:n,i,zbe).z,a=d.fromRadians(0,e.south,_?t:n,i,Ube).z;const O=d.fromRadians(e.east,p,n,i,Hbe);return u=St.getPointDistance(h,O),f=0,_U(C,S,w,E,r,s,a,c,u,f,o)};Bt.fromTransformation=function(e,t){return b.typeOf.object("transformation",e),l(t)||(t=new Bt),t.center=B.getTranslation(e,t.center),t.halfAxes=B.getMatrix3(e,t.halfAxes),t.halfAxes=J.multiplyByScalar(t.halfAxes,.5,t.halfAxes),t};Bt.clone=function(e,t){if(l(e))return l(t)?(d.clone(e.center,t.center),J.clone(e.halfAxes,t.halfAxes),t):new Bt(e.center,e.halfAxes)};Bt.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=d.dot(i,n)+t.distance;return u<=-c?mn.OUTSIDE:u>=c?mn.INSIDE:mn.INTERSECTING};const Hj=new d,Vj=new d,kj=new d,kbe=new d,CU=new d,Gbe=new d;Bt.distanceSquaredTo=function(e,t){if(!l(e))throw new x("box is required.");if(!l(t))throw new x("cartesian is required.");const n=d.subtract(t,e.center,Uj),i=e.halfAxes;let o=J.getColumn(i,0,Hj),r=J.getColumn(i,1,Vj),s=J.getColumn(i,2,kj);const a=d.magnitude(o),c=d.magnitude(r),u=d.magnitude(s);let f=!0,h=!0,_=!0;a>0?d.divideByScalar(o,a,o):f=!1,c>0?d.divideByScalar(r,c,r):h=!1,u>0?d.divideByScalar(s,u,s):_=!1;const g=!f+!h+!_;let p,y,C;if(g===1){let S=o;p=r,y=s,h?_||(S=s,y=o):(S=r,p=o),C=d.cross(p,y,CU),S===o?o=C:S===r?r=C:S===s&&(s=C)}else if(g===2){p=o,h?p=r:_&&(p=s);let S=d.UNIT_Y;S.equalsEpsilon(p,N.EPSILON3)&&(S=d.UNIT_X),y=d.cross(p,S,kbe),d.normalize(y,y),C=d.cross(p,y,CU),d.normalize(C,C),p===o?(r=y,s=C):p===r?(s=y,o=C):p===s&&(o=y,r=C)}else g===3&&(o=d.UNIT_X,r=d.UNIT_Y,s=d.UNIT_Z);const T=Gbe;T.x=d.dot(n,o),T.y=d.dot(n,r),T.z=d.dot(n,s);let E=0,w;return T.x<-a?(w=T.x+a,E+=w*w):T.x>a&&(w=T.x-a,E+=w*w),T.y<-c?(w=T.y+c,E+=w*w):T.y>c&&(w=T.y-c,E+=w*w),T.z<-u?(w=T.z+u,E+=w*w):T.z>u&&(w=T.z-u,E+=w*w),E};const Wbe=new d,jbe=new d;Bt.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 Ih);let o=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;const s=e.center,a=e.halfAxes,c=J.getColumn(a,0,Hj),u=J.getColumn(a,1,Vj),f=J.getColumn(a,2,kj),h=d.add(c,u,Wbe);d.add(h,f,h),d.add(h,s,h);const _=d.subtract(h,t,jbe);let g=d.dot(n,_);return o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.add(s,c,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.add(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.add(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.subtract(h,u,h),d.add(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),d.subtract(s,c,h),d.subtract(h,u,h),d.subtract(h,f,h),d.subtract(h,t,_),g=d.dot(n,_),o=Math.min(g,o),r=Math.max(g,r),i.start=o,i.stop=r,i};const qbe=new d,Ybe=new d,$be=new d;Bt.computeCorners=function(e,t){b.typeOf.object("box",e),l(t)||(t=[new d,new d,new d,new d,new d,new d,new d,new d]);const n=e.center,i=e.halfAxes,o=J.getColumn(i,0,qbe),r=J.getColumn(i,1,Ybe),s=J.getColumn(i,2,$be);return d.clone(n,t[0]),d.subtract(t[0],o,t[0]),d.subtract(t[0],r,t[0]),d.subtract(t[0],s,t[0]),d.clone(n,t[1]),d.subtract(t[1],o,t[1]),d.subtract(t[1],r,t[1]),d.add(t[1],s,t[1]),d.clone(n,t[2]),d.subtract(t[2],o,t[2]),d.add(t[2],r,t[2]),d.subtract(t[2],s,t[2]),d.clone(n,t[3]),d.subtract(t[3],o,t[3]),d.add(t[3],r,t[3]),d.add(t[3],s,t[3]),d.clone(n,t[4]),d.add(t[4],o,t[4]),d.subtract(t[4],r,t[4]),d.subtract(t[4],s,t[4]),d.clone(n,t[5]),d.add(t[5],o,t[5]),d.subtract(t[5],r,t[5]),d.add(t[5],s,t[5]),d.clone(n,t[6]),d.add(t[6],o,t[6]),d.add(t[6],r,t[6]),d.subtract(t[6],s,t[6]),d.clone(n,t[7]),d.add(t[7],o,t[7]),d.add(t[7],r,t[7]),d.add(t[7],s,t[7]),t};const Xbe=new J;Bt.computeTransformation=function(e,t){b.typeOf.object("box",e),l(t)||(t=new B);const n=e.center,i=J.multiplyByUniformScale(e.halfAxes,2,Xbe);return B.fromRotationTranslation(i,n,t)};const Kbe=new fe;Bt.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,Kbe);return!t.isBoundingSphereVisible(n)};Bt.prototype.intersectPlane=function(e){return Bt.intersectPlane(this,e)};Bt.prototype.distanceSquaredTo=function(e){return Bt.distanceSquaredTo(this,e)};Bt.prototype.computePlaneDistances=function(e,t,n){return Bt.computePlaneDistances(this,e,t,n)};Bt.prototype.computeCorners=function(e){return Bt.computeCorners(this,e)};Bt.prototype.computeTransformation=function(e){return Bt.computeTransformation(this,e)};Bt.prototype.isOccluded=function(e){return Bt.isOccluded(this,e)};Bt.equals=function(e,t){return e===t||l(e)&&l(t)&&d.equals(e.center,t.center)&&J.equals(e.halfAxes,t.halfAxes)};Bt.prototype.clone=function(e){return Bt.clone(this,e)};Bt.prototype.equals=function(e){return Bt.equals(this,e)};const pi={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4"};pi.getMathType=function(e){switch(e){case pi.SCALAR:return Number;case pi.VEC2:return j;case pi.VEC3:return d;case pi.VEC4:return oe;case pi.MAT2:return at;case pi.MAT3:return J;case pi.MAT4:return B;default:throw new x("attributeType is not a valid value.")}};pi.getNumberOfComponents=function(e){switch(e){case pi.SCALAR:return 1;case pi.VEC2:return 2;case pi.VEC3:return 3;case pi.VEC4:case pi.MAT2:return 4;case pi.MAT3:return 9;case pi.MAT4:return 16;default:throw new x("attributeType is not a valid value.")}};pi.getAttributeLocationCount=function(e){switch(e){case pi.SCALAR:case pi.VEC2:case pi.VEC3:case pi.VEC4:return 1;case pi.MAT2:return 2;case pi.MAT3:return 3;case pi.MAT4:return 4;default:throw new x("attributeType is not a valid value.")}};pi.getGlslType=function(e){switch(b.typeOf.string("attributeType",e),e){case pi.SCALAR:return"float";case pi.VEC2:return"vec2";case pi.VEC3:return"vec3";case pi.VEC4:return"vec4";case pi.MAT2:return"mat2";case pi.MAT3:return"mat3";case pi.MAT4:return"mat4";default:throw new x("attributeType is not a valid value.")}};const ln=Object.freeze(pi),TU=1/256,bU=256,Fi={};Fi.octEncodeInRange=function(e,t,n){b.defined("vector",e),b.defined("result",n);const i=d.magnitudeSquared(e);if(Math.abs(i-1)>N.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))*N.signNotZero(o),n.y=(1-Math.abs(o))*N.signNotZero(r)}return n.x=N.toSNorm(n.x,t),n.y=N.toSNorm(n.y,t),n};Fi.octEncode=function(e,t){return Fi.octEncodeInRange(e,255,t)};const U0=new j,EU=new Uint8Array(1);function lE(e){return EU[0]=e,EU[0]}Fi.octEncodeToCartesian4=function(e,t){return Fi.octEncodeInRange(e,65535,U0),t.x=lE(U0.x*TU),t.y=lE(U0.x),t.z=lE(U0.y*TU),t.w=lE(U0.y),t};Fi.octDecodeInRange=function(e,t,n,i){if(b.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=N.fromSNorm(e,n),i.y=N.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))*N.signNotZero(o),i.y=(1-Math.abs(o))*N.signNotZero(i.y)}return d.normalize(i,i)};Fi.octDecode=function(e,t,n){return Fi.octDecodeInRange(e,t,255,n)};Fi.octDecodeFromCartesian4=function(e,t){b.typeOf.object("encoded",e),b.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*bU+i,a=o*bU+r;return Fi.octDecodeInRange(s,a,65535,t)};Fi.octPackFloat=function(e){return b.defined("encoded",e),256*e.x+e.y};const RL=new j;Fi.octEncodeFloat=function(e){return Fi.octEncode(e,RL),Fi.octPackFloat(RL)};Fi.octDecodeFloat=function(e,t){b.defined("value",e);const n=e/256,i=Math.floor(n),o=(n-i)*256;return Fi.octDecode(i,o,t)};Fi.octPack=function(e,t,n,i){b.defined("v1",e),b.defined("v2",t),b.defined("v3",n),b.defined("result",i);const o=Fi.octEncodeFloat(e),r=Fi.octEncodeFloat(t),s=Fi.octEncode(n,RL);return i.x=65536*s.x+o,i.y=65536*s.y+r,i};Fi.octUnpack=function(e,t,n,i){b.defined("packed",e),b.defined("v1",t),b.defined("v2",n),b.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;Fi.octDecodeFloat(s,t),Fi.octDecodeFloat(c,n),Fi.octDecode(r,a,i)};Fi.compressTextureCoordinates=function(e){b.defined("textureCoordinates",e);const t=e.x*4095|0,n=e.y*4095|0;return 4096*t+n};Fi.decompressTextureCoordinates=function(e,t){b.defined("compressed",e),b.defined("result",t);const n=e/4096,i=Math.floor(n);return t.x=i/4095,t.y=(e-i*4096)/4095,t};function qI(e){return e>>1^-(e&1)}Fi.zigZagDeltaDecode=function(e,t,n){b.defined("uBuffer",e),b.defined("vBuffer",t),b.typeOf.number.equals("uBuffer.length","vBuffer.length",e.length,t.length),l(n)&&b.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+=qI(e[a]),r+=qI(t[a]),e[a]=o,t[a]=r,l(n)&&(s+=qI(n[a]),n[a]=s)};Fi.dequantize=function(e,t,n,i){b.defined("typedArray",e),b.defined("componentDatatype",t),b.defined("type",n),b.defined("count",i);const o=ln.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};Fi.decodeRGB565=function(e,t){b.defined("typedArray",e);const n=e.length*3;l(t)&&b.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],f=u>>11,h=u>>5&r,_=u&o,g=3*c;t[g]=f*s,t[g+1]=h*a,t[g+2]=_*s}return t};const oi=Fi,hS={};hS.getHeight=function(e,t,n){return(e-n)*t+n};const Jbe=new d;hS.getPosition=function(e,t,n,i,o){const r=t.cartesianToCartographic(e,Jbe),s=hS.getHeight(r.height,n,i);return d.fromRadians(r.longitude,r.latitude,s,t,o)};const Wh=hS,Qbe={NONE:0,BITS12:1},Qa=Object.freeze(Qbe),bm=new d,Zbe=new d,Rc=new j,uE=new B,eEe=new B,tEe=Math.pow(2,12);function ur(e,t,n,i,o,r,s,a,c,u){let f=Qa.NONE,h,_;if(l(t)&&l(n)&&l(i)&&l(o)){const g=t.minimum,p=t.maximum,y=d.subtract(p,g,Zbe),C=i-n;Math.max(d.maximumComponent(y),C)<tEe-1?f=Qa.BITS12:f=Qa.NONE,h=B.inverseTransformation(o,new B);const E=d.negate(g,bm);B.multiply(B.fromTranslation(E,uE),h,h);const w=bm;w.x=1/y.x,w.y=1/y.y,w.z=1/y.z,B.multiply(B.fromScale(w,uE),h,h),_=B.clone(o),B.setTranslation(_,d.ZERO,_),o=B.clone(o,new B);const S=B.fromTranslation(g,uE),P=B.fromScale(y,eEe),O=B.multiply(S,P,uE);B.multiply(o,O,o),B.multiply(_,O,_)}this.quantization=f,this.minimumHeight=n,this.maximumHeight=i,this.center=d.clone(e),this.toScaledENU=h,this.fromScaledENU=o,this.matrix=_,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()}ur.prototype.encode=function(e,t,n,i,o,r,s,a){const c=i.x,u=i.y;if(this.quantization===Qa.BITS12){n=B.multiplyByPoint(this.toScaledENU,n,bm),n.x=N.clamp(n.x,0,1),n.y=N.clamp(n.y,0,1),n.z=N.clamp(n.z,0,1);const f=this.maximumHeight-this.minimumHeight,h=N.clamp((o-this.minimumHeight)/f,0,1);j.fromElements(n.x,n.y,Rc);const _=oi.compressTextureCoordinates(Rc);j.fromElements(n.z,h,Rc);const g=oi.compressTextureCoordinates(Rc);j.fromElements(c,u,Rc);const p=oi.compressTextureCoordinates(Rc);if(e[t++]=_,e[t++]=g,e[t++]=p,this.hasWebMercatorT){j.fromElements(s,0,Rc);const y=oi.compressTextureCoordinates(Rc);e[t++]=y}}else d.subtract(n,this.center,bm),e[t++]=bm.x,e[t++]=bm.y,e[t++]=bm.z,e[t++]=o,e[t++]=c,e[t++]=u,this.hasWebMercatorT&&(e[t++]=s);return this.hasVertexNormals&&(e[t++]=oi.octPackFloat(r)),this.hasGeodeticSurfaceNormals&&(e[t++]=a.x,e[t++]=a.y,e[t++]=a.z),t};const nEe=new d,Gj=new d;ur.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 f=0;f<i;f++){const h=s*i+f,_=s*r+f;t[_]=e[h]}const a=this.decodePosition(t,s,nEe),c=n.geodeticSurfaceNormal(a,Gj),u=s*r+this._offsetGeodeticSurfaceNormal;t[u]=c.x,t[u+1]=c.y,t[u+2]=c.z}};ur.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]}};ur.prototype.decodePosition=function(e,t,n){if(l(n)||(n=new d),t*=this.stride,this.quantization===Qa.BITS12){const i=oi.decompressTextureCoordinates(e[t],Rc);n.x=i.x,n.y=i.y;const o=oi.decompressTextureCoordinates(e[t+1],Rc);return n.z=o.x,B.multiplyByPoint(this.fromScaledENU,n,n)}return n.x=e[t],n.y=e[t+1],n.z=e[t+2],d.add(n,this.center,n)};ur.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,Gj),a=this.decodeHeight(e,t),c=Wh.getHeight(a,i,o)-a;n.x+=s.x*c,n.y+=s.y*c,n.z+=s.z*c}return n};ur.prototype.decodeTextureCoordinates=function(e,t,n){return l(n)||(n=new j),t*=this.stride,this.quantization===Qa.BITS12?oi.decompressTextureCoordinates(e[t+2],n):j.fromElements(e[t+4],e[t+5],n)};ur.prototype.decodeHeight=function(e,t){return t*=this.stride,this.quantization===Qa.BITS12?oi.decompressTextureCoordinates(e[t+1],Rc).y*(this.maximumHeight-this.minimumHeight)+this.minimumHeight:e[t+3]};ur.prototype.decodeWebMercatorT=function(e,t){return t*=this.stride,this.quantization===Qa.BITS12?oi.decompressTextureCoordinates(e[t+3],Rc).x:e[t+6]};ur.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)};ur.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};ur.prototype._calculateStrideAndOffsets=function(){let e=0;switch(this.quantization){case Qa.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 rw={position3DAndHeight:0,textureCoordAndEncodedNormals:1,geodeticSurfaceNormal:2},sw={compressed0:0,compressed1:1,geodeticSurfaceNormal:2};ur.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===Qa.NONE){s(rw.position3DAndHeight,4);let a=2;a+=this.hasWebMercatorT?1:0,a+=this.hasVertexNormals?1:0,s(rw.textureCoordAndEncodedNormals,a),this.hasGeodeticSurfaceNormals&&s(rw.geodeticSurfaceNormal,3)}else{const a=this.hasWebMercatorT||this.hasVertexNormals,c=this.hasWebMercatorT&&this.hasVertexNormals;s(sw.compressed0,a?4:3),c&&s(sw.compressed1,1),this.hasGeodeticSurfaceNormals&&s(sw.geodeticSurfaceNormal,3)}return r};ur.prototype.getAttributeLocations=function(){return this.quantization===Qa.NONE?rw:sw};ur.clone=function(e,t){if(l(e))return l(t)||(t=new ur),t.quantization=e.quantization,t.minimumHeight=e.minimumHeight,t.maximumHeight=e.maximumHeight,t.center=d.clone(e.center),t.toScaledENU=B.clone(e.toScaledENU),t.fromScaledENU=B.clone(e.fromScaledENU),t.matrix=B.clone(e.matrix),t.hasVertexNormals=e.hasVertexNormals,t.hasWebMercatorT=e.hasWebMercatorT,t.hasGeodeticSurfaceNormals=e.hasGeodeticSurfaceNormals,t.exaggeration=e.exaggeration,t.exaggerationRelativeHeight=e.exaggerationRelativeHeight,t._calculateStrideAndOffsets(),t};const xu={};xu.DEFAULT_STRUCTURE=Object.freeze({heightScale:1,heightOffset:0,elementsPerHeight:1,stride:1,elementMultiplier:256,isBigEndian:!1});const YI=new d,iEe=new B,oEe=new d,rEe=new d;xu.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=N.PI_OVER_TWO,a=N.toRadians,c=e.heightmap,u=e.width,f=e.height,h=e.skirtHeight,_=h>0,g=A(e.isGeographic,!0),p=A(e.ellipsoid,pe.WGS84),y=1/p.maximumRadius,C=_e.clone(e.nativeRectangle),T=_e.clone(e.rectangle);let E,w,S,P;l(T)?(E=T.west,w=T.south,S=T.east,P=T.north):g?(E=a(C.west),w=a(C.south),S=a(C.east),P=a(C.north)):(E=C.west*y,w=s-2*o(r(-C.south*y)),S=C.east*y,P=s-2*o(r(-C.north*y)));let O=e.relativeToCenter;const z=l(O);O=z?O:d.ZERO;const R=A(e.includeWebMercatorT,!1),F=A(e.exaggeration,1),H=A(e.exaggerationRelativeHeight,0),I=F!==1,m=A(e.structure,xu.DEFAULT_STRUCTURE),D=A(m.heightScale,xu.DEFAULT_STRUCTURE.heightScale),L=A(m.heightOffset,xu.DEFAULT_STRUCTURE.heightOffset),M=A(m.elementsPerHeight,xu.DEFAULT_STRUCTURE.elementsPerHeight),V=A(m.stride,xu.DEFAULT_STRUCTURE.stride),k=A(m.elementMultiplier,xu.DEFAULT_STRUCTURE.elementMultiplier),W=A(m.isBigEndian,xu.DEFAULT_STRUCTURE.isBigEndian);let G=_e.computeWidth(C),K=_e.computeHeight(C);const q=G/(u-1),te=K/(f-1);g||(G*=y,K*=y);const $=p.radiiSquared,X=$.x,Y=$.y,ae=$.z;let ue=65536,re=-65536;const he=tn.eastNorthUpToFixedFrame(O,p),ce=B.inverseTransformation(he,iEe);let Q,ie;R&&(Q=Zn.geodeticLatitudeToMercatorAngle(w),ie=1/(Zn.geodeticLatitudeToMercatorAngle(P)-Q));const de=oEe;de.x=Number.POSITIVE_INFINITY,de.y=Number.POSITIVE_INFINITY,de.z=Number.POSITIVE_INFINITY;const me=rEe;me.x=Number.NEGATIVE_INFINITY,me.y=Number.NEGATIVE_INFINITY,me.z=Number.NEGATIVE_INFINITY;let Ee=Number.POSITIVE_INFINITY;const xe=u*f,Pe=h>0?u*2+f*2:0,Te=xe+Pe,Oe=new Array(Te),De=new Array(Te),Me=new Array(Te),ve=R?new Array(Te):[],Ie=I?new Array(Te):[];let Ve=0,Le=f,_t=0,Tt=u;_&&(--Ve,++Le,--_t,++Tt);const Ot=1e-5;for(let Ht=Ve;Ht<Le;++Ht){let Xt=Ht;Xt<0&&(Xt=0),Xt>=f&&(Xt=f-1);let Mn=C.north-te*Xt;g?Mn=a(Mn):Mn=s-2*o(r(-Mn*y));let ti=(Mn-w)/(P-w);ti=N.clamp(ti,0,1);const en=Ht===Ve,xi=Ht===Le-1;h>0&&(en?Mn+=Ot*K:xi&&(Mn-=Ot*K));const Yi=t(Mn),Pi=n(Mn),Jn=ae*Pi;let cn;R&&(cn=(Zn.geodeticLatitudeToMercatorAngle(Mn)-Q)*ie);for(let Vn=_t;Vn<Tt;++Vn){let On=Vn;On<0&&(On=0),On>=u&&(On=u-1);const rn=Xt*(u*V)+On*V;let gt;if(M===1)gt=c[rn];else{gt=0;let yt;if(W)for(yt=0;yt<M;++yt)gt=gt*k+c[rn+yt];else for(yt=M-1;yt>=0;--yt)gt=gt*k+c[rn+yt]}gt=gt*D+L,re=Math.max(re,gt),ue=Math.min(ue,gt);let ke=C.west+q*On;g?ke=a(ke):ke=ke*y;let vn=(ke-E)/(S-E);vn=N.clamp(vn,0,1);let pn=Xt*u+On;if(h>0){const yt=Vn===_t,be=Vn===Tt-1,je=en||xi||yt||be;if((en||xi)&&(yt||be))continue;je&&(gt-=h,yt?(pn=xe+(f-Xt-1),ke-=Ot*G):xi?pn=xe+f+(u-On-1):be?(pn=xe+f+u+Xt,ke+=Ot*G):en&&(pn=xe+f+u+f+On))}const Hi=Yi*t(ke),Dn=Yi*n(ke),Oi=X*Hi,bo=Y*Dn,Dr=1/i(Oi*Hi+bo*Dn+Jn*Pi),Vi=Oi*Dr,Li=bo*Dr,Ir=Jn*Dr,aa=new d;aa.x=Vi+Hi*gt,aa.y=Li+Dn*gt,aa.z=Ir+Pi*gt,B.multiplyByPoint(ce,aa,YI),d.minimumByComponent(YI,de,de),d.maximumByComponent(YI,me,me),Ee=Math.min(Ee,gt),Oe[pn]=aa,Me[pn]=new j(vn,ti),De[pn]=gt,R&&(ve[pn]=cn),I&&(Ie[pn]=p.geodeticSurfaceNormal(aa))}}const Tn=fe.fromPoints(Oe);let Sn;l(T)&&(Sn=Bt.fromRectangle(T,ue,re,p));let gn;z&&(gn=new cl(p).computeHorizonCullingPointPossiblyUnderEllipsoid(O,Oe,ue));const on=new bs(de,me,O),Nt=new ur(O,on,Ee,re,he,!1,R,I,F,H),yn=new Float32Array(Te*Nt.stride);let Cn=0;for(let Ht=0;Ht<Te;++Ht)Cn=Nt.encode(yn,Cn,Oe[Ht],Me[Ht],De[Ht],void 0,ve[Ht],Ie[Ht]);return{vertices:yn,maximumHeight:re,minimumHeight:ue,encoding:Nt,boundingSphere3D:Tn,orientedBoundingBox:Sn,occludeePointInScaledSpace:gn}};const Wj=xu;function rf(){x.throwInstantiationError()}Object.defineProperties(rf.prototype,{credits:{get:x.throwInstantiationError},waterMask:{get:x.throwInstantiationError}});rf.prototype.interpolateHeight=x.throwInstantiationError;rf.prototype.isChildAvailable=x.throwInstantiationError;rf.prototype.createMesh=x.throwInstantiationError;rf.prototype.upsample=x.throwInstantiationError;rf.prototype.wasCreatedByUpsampling=x.throwInstantiationError;rf.maximumAsynchronousTasks=5;function vv(e,t,n,i,o,r,s,a,c,u,f,h,_,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=f,this.encoding=h,this.westIndicesSouthToNorth=_,this.southIndicesEastToWest=g,this.eastIndicesNorthToSouth=p,this.northIndicesWestToEast=y}function Go(){x.throwInstantiationError()}Object.defineProperties(Go.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 xU=[];Go.getRegularGridIndices=function(e,t){if(e*t>=N.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=xU[e];l(n)||(xU[e]=n=[]);let i=n[t];return l(i)||(e*t<N.SIXTY_FOUR_KILOBYTES?i=n[t]=new Uint16Array((e-1)*(t-1)*6):i=n[t]=new Uint32Array((e-1)*(t-1)*6),qj(e,t,i,0)),i};const wU=[];Go.getRegularGridIndicesAndEdgeIndices=function(e,t){if(e*t>=N.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=wU[e];l(n)||(wU[e]=n=[]);let i=n[t];if(!l(i)){const o=Go.getRegularGridIndices(e,t),r=jj(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 SU=[];Go.getRegularGridAndSkirtIndicesAndEdgeIndices=function(e,t){if(e*t>=N.FOUR_GIGABYTES)throw new x("The total number of vertices (width * height) must be less than 4,294,967,296.");let n=SU[e];l(n)||(SU[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,f=jj(e,t),h=f.westIndicesSouthToNorth,_=f.southIndicesEastToWest,g=f.eastIndicesNorthToSouth,p=f.northIndicesWestToEast,y=it.createTypedArray(c,u);qj(e,t,y,0),Go.addSkirtIndices(h,_,g,p,o,y,r),i=n[t]={indices:y,westIndicesSouthToNorth:h,southIndicesEastToWest:_,eastIndicesNorthToSouth:g,northIndicesWestToEast:p,indexCountWithoutSkirts:r}}return i};Go.addSkirtIndices=function(e,t,n,i,o,r,s){let a=o;s=fE(e,a,r,s),a+=e.length,s=fE(t,a,r,s),a+=t.length,s=fE(n,a,r,s),a+=n.length,fE(i,a,r,s)};function jj(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 qj(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,f=a+1;n[i++]=a,n[i++]=c,n[i++]=f,n[i++]=f,n[i++]=c,n[i++]=u,++o}++o}}function fE(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}Go.heightmapTerrainQuality=.25;Go.getEstimatedLevelZeroGeometricErrorForAHeightmap=function(e,t,n){return e.maximumRadius*2*Math.PI*Go.heightmapTerrainQuality/(t*n)};Go.prototype.requestTileGeometry=x.throwInstantiationError;Go.prototype.getLevelMaximumGeometricError=x.throwInstantiationError;Go.prototype.getTileDataAvailable=x.throwInstantiationError;Go.prototype.loadTileDataAvailability=x.throwInstantiationError;function $l(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,BL.NONE);const t=Wj.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===BL.LERC?Float32Array:this._buffer.constructor,this._mesh=void 0}Object.defineProperties($l.prototype,{credits:{get:function(){}},waterMask:{get:function(){return this._waterMask}},childTileMask:{get:function(){return this._childTileMask}}});const Yj="createVerticesFromHeightmap",sEe=new vi(Yj),aEe=new vi(Yj,rf.maximumAsynchronousTasks);$l.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.tilingScheme",e.tilingScheme),b.typeOf.number("options.x",e.x),b.typeOf.number("options.y",e.y),b.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),f=t.tileXYToRectangle(n,i,o),h=c.cartographicToCartesian(_e.center(f)),_=this._structure,p=Go.getEstimatedLevelZeroGeometricErrorForAHeightmap(c,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(p*4,1e3);const C=(a?aEe:sEe).scheduleTask({heightmap:this._buffer,structure:_,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:u,rectangle:f,relativeToCenter:h,ellipsoid:c,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof jo,exaggeration:r,exaggerationRelativeHeight:s,encoding:this._encoding});if(!l(C))return;const T=this;return Promise.resolve(C).then(function(E){let w;T._skirtHeight>0?w=Go.getRegularGridAndSkirtIndicesAndEdgeIndices(E.gridWidth,E.gridHeight):w=Go.getRegularGridIndicesAndEdgeIndices(E.gridWidth,E.gridHeight);const S=E.gridWidth*E.gridHeight;return T._mesh=new vv(h,new Float32Array(E.vertices),w.indices,w.indexCountWithoutSkirts,S,E.minimumHeight,E.maximumHeight,fe.clone(E.boundingSphere3D),d.clone(E.occludeePointInScaledSpace),E.numberOfAttributes,Bt.clone(E.orientedBoundingBox),ur.clone(E.encoding),w.westIndicesSouthToNorth,w.southIndicesEastToWest,w.eastIndicesNorthToSouth,w.northIndicesWestToEast),T._buffer=void 0,T._mesh})};$l.prototype._createMeshSync=function(e){b.typeOf.object("options.tilingScheme",e.tilingScheme),b.typeOf.number("options.x",e.x),b.typeOf.number("options.y",e.y),b.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),f=a.cartographicToCartesian(_e.center(u)),h=this._structure,g=Go.getEstimatedLevelZeroGeometricErrorForAHeightmap(a,this._width,t.getNumberOfXTilesAtLevel(0))/(1<<o);this._skirtHeight=Math.min(g*4,1e3);const p=Wj.computeVertices({heightmap:this._buffer,structure:h,includeWebMercatorT:!0,width:this._width,height:this._height,nativeRectangle:c,rectangle:u,relativeToCenter:f,ellipsoid:a,skirtHeight:this._skirtHeight,isGeographic:t.projection instanceof jo,exaggeration:r,exaggerationRelativeHeight:s});this._buffer=void 0;let y;this._skirtHeight>0?y=Go.getRegularGridAndSkirtIndicesAndEdgeIndices(this._width,this._height):y=Go.getRegularGridIndicesAndEdgeIndices(this._width,this._height);const C=p.gridWidth*p.gridHeight;return this._mesh=new vv(f,p.vertices,y.indices,y.indexCountWithoutSkirts,C,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};$l.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,f=r.heightOffset,h=r.heightScale,_=l(this._mesh),g=this._encoding===BL.LERC;if(!_&&g)return;let y;if(_){const C=this._mesh.vertices,T=this._mesh.encoding;y=$j(C,T,f,h,e,i,o,t,n)}else y=cEe(this._buffer,a,c,s,u,e,i,o,t,n),y=y*h+f;return y};$l.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,f=this._height,h=this._structure,_=h.stride,g=new this._bufferType(u*f*_),p=c.vertices,y=c.encoding,C=e.tileXYToRectangle(t,n,i),T=e.tileXYToRectangle(o,r,s),E=h.heightOffset,w=h.heightScale,S=h.elementsPerHeight,P=h.elementMultiplier,O=h.isBigEndian,z=Math.pow(P,S-1);for(let R=0;R<f;++R){const F=N.lerp(T.north,T.south,R/(f-1));for(let H=0;H<u;++H){const v=N.lerp(T.west,T.east,H/(u-1));let I=$j(p,y,E,w,C,u,f,v,F);I=I<h.lowestEncodedHeight?h.lowestEncodedHeight:I,I=I>h.highestEncodedHeight?h.highestEncodedHeight:I,lEe(g,S,P,z,_,O,R*u+H,I)}}return Promise.resolve(new $l({buffer:g,width:u,height:f,childTileMask:0,structure:this._structure,createdByUpsampling:!0}))};$l.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};$l.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function cEe(e,t,n,i,o,r,s,a,c,u){const f=(c-r.west)*(s-1)/(r.east-r.west),h=(u-r.south)*(a-1)/(r.north-r.south);let _=f|0,g=_+1;g>=s&&(g=s-1,_=s-2);let p=h|0,y=p+1;y>=a&&(y=a-1,p=a-2);const C=f-_,T=h-p;p=a-1-p,y=a-1-y;const E=dE(e,t,n,i,o,p*s+_),w=dE(e,t,n,i,o,p*s+g),S=dE(e,t,n,i,o,y*s+_),P=dE(e,t,n,i,o,y*s+g);return Xj(C,T,E,w,S,P)}function $j(e,t,n,i,o,r,s,a,c){const u=(a-o.west)*(r-1)/(o.east-o.west),f=(c-o.south)*(s-1)/(o.north-o.south);let h=u|0,_=h+1;_>=r&&(_=r-1,h=r-2);let g=f|0,p=g+1;p>=s&&(p=s-1,g=s-2);const y=u-h,C=f-g;g=s-1-g,p=s-1-p;const T=(t.decodeHeight(e,g*r+h)-n)/i,E=(t.decodeHeight(e,g*r+_)-n)/i,w=(t.decodeHeight(e,p*r+h)-n)/i,S=(t.decodeHeight(e,p*r+_)-n)/i;return Xj(y,C,T,E,w,S)}function Xj(e,t,n,i,o,r){return t<e?n+e*(i-n)+t*(r-i):n+e*(r-o)+t*(o-n)}function dE(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 lEe(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 wp(e){e=A(e,A.EMPTY_OBJECT),this._tilingScheme=e.tilingScheme,l(this._tilingScheme)||(this._tilingScheme=new Xs({ellipsoid:A(e.ellipsoid,pe.WGS84)})),this._levelZeroMaximumGeometricError=Go.getEstimatedLevelZeroGeometricErrorForAHeightmap(this._tilingScheme.ellipsoid,64,this._tilingScheme.getNumberOfXTilesAtLevel(0)),this._errorEvent=new $e,this._readyPromise=Promise.resolve(!0)}Object.defineProperties(wp.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(){}}});wp.prototype.requestTileGeometry=function(e,t,n,i){return Promise.resolve(new $l({buffer:new Uint8Array(16*16),width:16,height:16}))};wp.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};wp.prototype.getTileDataAvailable=function(e,t,n){};wp.prototype.loadTileDataAvailability=function(e,t,n){};function Mt(e,t,n,i){this.near=A(e,0),this.nearValue=A(t,0),this.far=A(n,1),this.farValue=A(i,0)}Mt.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 Mt(e.near,e.nearValue,e.far,e.farValue)};Mt.packedLength=4;Mt.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};Mt.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new Mt),n.near=e[t++],n.nearValue=e[t++],n.far=e[t++],n.farValue=e[t],n};Mt.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};Mt.prototype.clone=function(e){return Mt.clone(this,e)};Mt.prototype.equals=function(e){return Mt.equals(this,e)};function ip(e,t){b.typeOf.object("normal",e),b.typeOf.number("distance",t),this._distance=t,this._normal=new Kj(e,this),this.onChangeCallback=void 0,this.index=-1}Object.defineProperties(ip.prototype,{distance:{get:function(){return this._distance},set:function(e){b.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){b.typeOf.object("value",e),l(this.onChangeCallback)&&!d.equals(this._normal._cartesian3,e)&&this.onChangeCallback(this.index),d.clone(e,this._normal._cartesian3)}}});ip.fromPlane=function(e,t){return b.typeOf.object("plane",e),l(t)?(t.normal=e.normal,t.distance=e.distance):t=new ip(e.normal,e.distance),t};ip.clone=function(e,t){return l(t)?(t.normal=e.normal,t.distance=e.distance,t):new ip(e.normal,e.distance)};function Kj(e,t){this._clippingPlane=t,this._cartesian3=d.clone(e)}Object.defineProperties(Kj.prototype,{x:{get:function(){return this._cartesian3.x},set:function(e){b.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){b.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){b.typeOf.number("value",e),l(this._clippingPlane.onChangeCallback)&&e!==this._cartesian3.z&&this._clippingPlane.onChangeCallback(this._clippingPlane.index),this._cartesian3.z=e}}});function Ao(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=U.clone(A(e.edgeColor,U.WHITE)),this.edgeWidth=A(e.edgeWidth,0),this.planeAdded=new $e,this.planeRemoved=new $e,this._owner=void 0;const t=A(e.unionClippingRegions,!1);this._unionClippingRegions=t,this._testIntersection=t?Jj:Qj,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 Jj(e){return e===mn.OUTSIDE}function Qj(e){return e===mn.INSIDE}Object.defineProperties(Ao.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?Jj:Qj)}},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 vU(e,t){e._multipleDirtyPlanes=e._multipleDirtyPlanes||e._dirtyIndex!==-1&&e._dirtyIndex!==t,e._dirtyIndex=t}Ao.prototype.add=function(e){const t=this._planes.length,n=this;e.onChangeCallback=function(i){vU(n,i)},e.index=t,vU(this,t),this._planes.push(e),this.planeAdded.raiseEvent(e,t)};Ao.prototype.get=function(e){return b.typeOf.number("index",e),this._planes[e]};function Zj(e,t){const n=e.length;for(let i=0;i<n;++i)if(St.equals(e[i],t))return i;return-1}Ao.prototype.contains=function(e){return Zj(this._planes,e)!==-1};Ao.prototype.remove=function(e){const t=this._planes,n=Zj(t,e);if(n===-1)return!1;e instanceof ip&&(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 ip&&(r.index=o)}return this._multipleDirtyPlanes=!0,t.length=i,this.planeRemoved.raiseEvent(e,n),!0};Ao.prototype.removeAll=function(){const e=this._planes,t=e.length;for(let n=0;n<t;++n){const i=e[n];i instanceof ip&&(i.onChangeCallback=void 0,i.index=-1),this.planeRemoved.raiseEvent(i,n)}this._multipleDirtyPlanes=!0,this._planes=[]};const uEe=new oe,fEe=new oe;function DU(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=oi.octEncodeToCartesian4(a.normal,fEe);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,uEe);i[r+4]=u.x,i[r+5]=u.y,i[r+6]=u.z,i[r+7]=u.w,r+=8}}function IU(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 eq(e,t){const n=wt.maximumTextureSize;return t.x=Math.min(e,n),t.y=Math.ceil(e/t.x),t}const dEe=new j;Ao.prototype.update=function(e){let t=this._clippingPlanesTexture;const n=e.context,i=Ao.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=eq(o,dEe);s.y*=2,i?(t=new zt({context:n,width:s.x,height:s.y,pixelFormat:nt.RGBA,pixelDatatype:Ke.FLOAT,sampler:Yn.NEAREST,flipY:!1}),this._float32View=new Float32Array(s.x*s.y*4)):(t=new zt({context:n,width:s.x,height:s.y,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,sampler:Yn.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?(IU(this,0,this._planes.length),t.copyFrom({source:{width:t.width,height:t.height,arrayBufferView:this._float32View}})):(DU(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),IU(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),DU(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 hEe=new B,PU=new St(d.UNIT_X,0);Ao.prototype.computeIntersectionWithBoundingVolume=function(e,t){const n=this._planes,i=n.length;let o=this.modelMatrix;l(t)&&(o=B.multiply(t,o,hEe));let r=mn.INSIDE;!this.unionClippingRegions&&i>0&&(r=mn.OUTSIDE);for(let s=0;s<i;++s){const a=n[s];St.transform(a,o,PU);const c=e.intersectPlane(PU);if(c===mn.INTERSECTING)r=c;else if(this._testIntersection(c))return c}return r};Ao.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}};Ao.useFloatTexture=function(e){return e.floatingPointTexture};Ao.getTextureResolution=function(e,t,n){const i=e.texture;if(l(i))return n.x=i.width,n.y=i.height,n;const o=Ao.useFloatTexture(t)?e.length:e.length*2,r=eq(o,n);return r.y*=2,r};Ao.prototype.isDestroyed=function(){return!1};Ao.prototype.destroy=function(){return this._clippingPlanesTexture=this._clippingPlanesTexture&&this._clippingPlanesTexture.destroy(),Ue(this)};const pEe=new j;function qN(e,t){b.typeOf.object("clippingPlaneCollection",e),b.typeOf.object("context",t);const n=e.unionClippingRegions,i=e.length,o=Ao.useFloatTexture(t),r=Ao.getTextureResolution(e,t,pEe),s=r.x,a=r.y;let c=o?gEe(s,a):yEe(s,a);return c+=`
`,c+=n?mEe(i):_Ee(i),c}function mEe(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 _Ee(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 gEe(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 yEe(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 AEe(e,t,n,i,o){this.numberOfDayTextures=e,this.flags=t,this.material=n,this.shaderProgram=i,this.clippingShaderState=o}function YN(){this.baseVertexShaderSource=void 0,this.baseFragmentShaderSource=void 0,this._shadersByTexturesFlags=[],this.material=void 0}function CEe(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 TEe(e){return e?"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }":"float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }"}YN.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,f=e.applyDayNightAlpha,h=e.applySplit,_=e.showReflectiveOcean,g=e.showOceanWaves,p=e.enableLighting,y=e.dynamicAtmosphereLighting,C=e.dynamicAtmosphereLightingFromSun,T=e.showGroundAtmosphere,E=e.perFragmentGroundAtmosphere,w=e.hasVertexNormals,S=e.useWebMercatorProjection,P=e.enableFog,O=e.enableClippingPlanes,z=e.clippingPlanes,R=e.clippedByBoundaries,F=e.hasImageryLayerCutout,H=e.colorCorrect,v=e.highlightFillTile,I=e.colorToAlpha,m=e.hasGeodeticSurfaceNormals,D=e.hasExaggeration,L=e.showUndergroundColor,M=e.translucent;let V=0,k="";const G=n.renderedMesh.encoding;G.quantization===Qa.BITS12&&(V=1,k="QUANTIZATION_BITS12");let q=0,te="";R&&(q=1,te="TILE_LIMIT_RECTANGLE");let $=0,X="";F&&($=1,X="APPLY_IMAGERY_CUTOUT");const Y=t.mode,ae=Y|o<<2|r<<3|s<<4|a<<5|c<<6|u<<7|_<<8|g<<9|p<<10|y<<11|C<<12|T<<13|E<<14|w<<15|S<<16|P<<17|V<<18|h<<19|O<<20|q<<21|$<<22|H<<23|v<<24|I<<25|m<<26|D<<27|L<<28|M<<29|f<<30;let ue=0;l(z)&&z.length>0&&(ue=O?z.clippingPlanesState:0);let re=n.surfaceShader;if(l(re)&&re.numberOfDayTextures===i&&re.flags===ae&&re.material===this.material&&re.clippingShaderState===ue)return re.shaderProgram;let he=this._shadersByTexturesFlags[i];if(l(he)||(he=this._shadersByTexturesFlags[i]=[]),re=he[ae],!l(re)||re.material!==this.material||re.clippingShaderState!==ue){const ce=this.baseVertexShaderSource.clone(),Q=this.baseFragmentShaderSource.clone();ue!==0&&Q.sources.unshift(qN(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"),f&&Q.defines.push("APPLY_DAY_NIGHT_ALPHA"),_&&(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"),L&&(ce.defines.push("UNDERGROUND_COLOR"),Q.defines.push("UNDERGROUND_COLOR")),M&&(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"),C&&(ce.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"),Q.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN"))),T&&(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"),O&&Q.defines.push("ENABLE_CLIPPING_PLANES"),H&&Q.defines.push("COLOR_CORRECT"),v&&Q.defines.push("HIGHLIGHT_FILL_TILE"),m&&ce.defines.push("GEODETIC_SURFACE_NORMALS"),D&&ce.defines.push("EXAGGERATION");let ie=` vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)
{
vec4 color = initialColor;
`;F&&(ie+=` vec4 cutoutAndColorResult;
bool texelUnclipped;
`);for(let me=0;me<i;++me)F?ie+=` cutoutAndColorResult = u_dayTextureCutoutRectangles[${me}];
texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
cutoutAndColorResult = sampleAndBlend(
`:ie+=` color = sampleAndBlend(
`,ie+=` color,
u_dayTextures[${me}],
u_dayTextureUseWebMercatorT[${me}] ? textureCoordinates.xz : textureCoordinates.xy,
u_dayTextureTexCoordsRectangle[${me}],
u_dayTextureTranslationAndScale[${me}],
${u?`u_dayTextureAlpha[${me}]`:"1.0"},
${f?`u_dayTextureNightAlpha[${me}]`:"1.0"},
${f?`u_dayTextureDayAlpha[${me}]`:"1.0"},
${o?`u_dayTextureBrightness[${me}]`:"0.0"},
${r?`u_dayTextureContrast[${me}]`:"0.0"},
${s?`u_dayTextureHue[${me}]`:"0.0"},
${a?`u_dayTextureSaturation[${me}]`:"0.0"},
${c?`u_dayTextureOneOverGamma[${me}]`:"0.0"},
${h?`u_dayTextureSplit[${me}]`:"0.0"},
${I?`u_colorsToAlpha[${me}]`:"vec4(0.0)"},
nightBlend );
`,F&&(ie+=` color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);
`);ie+=` return color;
}`,Q.sources.push(ie),ce.sources.push(CEe(Y)),ce.sources.push(TEe(S));const de=hn.fromCache({context:t.context,vertexShaderSource:ce,fragmentShaderSource:Q,attributeLocations:G.getAttributeLocations()});re=he[ae]=new AEe(i,ae,this.material,de,ue)}return n.surfaceShader=re,re.shaderProgram};YN.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 Ue(this)};function Ui(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 bEe={NONE:0,TOP:1,ALL:2},fn=Object.freeze(bEe),EEe=new d;function ac(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(b.typeOf.object("min",t),b.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===fn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._min=d.clone(t),this._max=d.clone(n),this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxOutlineGeometry"}ac.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;b.typeOf.object("dimensions",t),b.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),b.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),b.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new ac({minimum:d.negate(n,new d),maximum:n,offsetAttribute:e.offsetAttribute})};ac.fromAxisAlignedBoundingBox=function(e){return b.typeOf.object("boundindBox",e),new ac({minimum:e.minimum,maximum:e.maximum})};ac.packedLength=2*d.packedLength+1;ac.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),d.pack(e._min,t,n),d.pack(e._max,t,n+d.packedLength),t[n+d.packedLength*2]=A(e._offsetAttribute,-1),t};const tq=new d,nq=new d,OU={minimum:tq,maximum:nq,offsetAttribute:void 0};ac.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=d.unpack(e,t,tq),o=d.unpack(e,t+d.packedLength,nq),r=e[t+d.packedLength*2];return l(n)?(n._min=d.clone(i,n._min),n._max=d.clone(o,n._max),n._offsetAttribute=r===-1?void 0:r,n):(OU.offsetAttribute=r===-1?void 0:r,new ac(OU))};ac.createGeometry=function(e){const t=e._min,n=e._max;if(d.equals(t,n))return;const i=new Ui,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 ze({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=d.subtract(n,t,EEe),a=d.magnitude(s)*.5;if(l(e._offsetAttribute)){const c=r.length,u=e._offsetAttribute===fn.NONE?0:1,f=new Uint8Array(c/3).fill(u);i.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:f})}return new Dt({attributes:i,indices:o,primitiveType:Je.LINES,boundingSphere:new fe(d.ZERO,a),offsetAttribute:e._offsetAttribute})};function an(e,t,n,i){e=A(e,1),t=A(t,1),n=A(n,1),i=A(i,1),this.value=new Uint8Array([U.floatToByte(e),U.floatToByte(t),U.floatToByte(n),U.floatToByte(i)])}Object.defineProperties(an.prototype,{componentDatatype:{get:function(){return ee.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 4}},normalize:{get:function(){return!0}}});an.fromColor=function(e){if(!l(e))throw new x("color is required.");return new an(e.red,e.green,e.blue,e.alpha)};an.toValue=function(e,t){if(!l(e))throw new x("color is required.");return l(t)?e.toBytes(t):new Uint8Array(e.toBytes())};an.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 nn(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 LU=new d,BU=new d,RU=new d;function xEe(e,t,n,i,o){b.defined("point",e),b.defined("p0",t),b.defined("p1",n),b.defined("p2",i),l(o)||(o=new d);let r,s,a,c,u,f,h,_;if(l(t.z)){if(d.equalsEpsilon(e,t,N.EPSILON14))return d.clone(d.UNIT_X,o);if(d.equalsEpsilon(e,n,N.EPSILON14))return d.clone(d.UNIT_Y,o);if(d.equalsEpsilon(e,i,N.EPSILON14))return d.clone(d.UNIT_Z,o);r=d.subtract(n,t,LU),s=d.subtract(i,t,BU),a=d.subtract(e,t,RU),c=d.dot(r,r),u=d.dot(r,s),f=d.dot(r,a),h=d.dot(s,s),_=d.dot(s,a)}else{if(j.equalsEpsilon(e,t,N.EPSILON14))return d.clone(d.UNIT_X,o);if(j.equalsEpsilon(e,n,N.EPSILON14))return d.clone(d.UNIT_Y,o);if(j.equalsEpsilon(e,i,N.EPSILON14))return d.clone(d.UNIT_Z,o);r=j.subtract(n,t,LU),s=j.subtract(i,t,BU),a=j.subtract(e,t,RU),c=j.dot(r,r),u=j.dot(r,s),f=j.dot(r,a),h=j.dot(s,s),_=j.dot(s,a)}o.y=h*f-u*_,o.z=c*_-u*f;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 $N={};$N.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)};$N.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(v,I,m,D){for(;I.length>=1;){const L=I[I.length-1];if(I.splice(I.length-1,1),v[L].numLiveTriangles>0)return L}for(;o<D;){if(v[o].numLiveTriangles>0)return++o,o-1;++o}return-1}function s(v,I,m,D,L,M,V){let k=-1,W,G=-1,K=0;for(;K<m.length;){const q=m[K];D[q].numLiveTriangles&&(W=0,L-D[q].timeStamp+2*D[q].numLiveTriangles<=I&&(W=L-D[q].timeStamp),(W>G||G===-1)&&(G=W,k=q)),++K}return k===-1?r(D,M,v,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,f=t[u];const h=a;if(l(n))c=n+1;else{for(;u<h;)f>c&&(c=f),++u,f=t[u];if(c===-1)return 0;++c}const _=[];let g;for(g=0;g<c;g++)_[g]={numLiveTriangles:0,timeStamp:0,vertexTriangles:[]};u=0;let p=0;for(;u<h;)_[t[u]].vertexTriangles.push(p),++_[t[u]].numLiveTriangles,_[t[u+1]].vertexTriangles.push(p),++_[t[u+1]].numLiveTriangles,_[t[u+2]].vertexTriangles.push(p),++_[t[u+2]].numLiveTriangles,++p,u+=3;let y=0,C=i+1;o=1;let T=[];const E=[];let w,S,P=0;const O=[],z=a/3,R=[];for(g=0;g<z;g++)R[g]=!1;let F,H;for(;y!==-1;){T=[],S=_[y],H=S.vertexTriangles.length;for(let v=0;v<H;++v)if(p=S.vertexTriangles[v],!R[p]){R[p]=!0,u=p+p+p;for(let I=0;I<3;++I)F=t[u],T.push(F),E.push(F),O[P]=F,++P,w=_[F],--w.numLiveTriangles,C-w.timeStamp>i&&(w.timeStamp=C,++C),++u}y=s(t,i,T,_,C,E,c)}return O};const wEe=$N,Ea={};function pS(e,t,n,i,o){e[t++]=n,e[t++]=i,e[t++]=i,e[t++]=o,e[t++]=o,e[t]=n}function SEe(e){const t=e.length,n=t/3*6,i=it.createTypedArray(t,n);let o=0;for(let r=0;r<t;r+=3,o+=6)pS(i,o,e[r],e[r+1],e[r+2]);return i}function vEe(e){const t=e.length;if(t>=3){const n=(t-2)*6,i=it.createTypedArray(t,n);pS(i,0,e[0],e[1],e[2]);let o=6;for(let r=3;r<t;++r,o+=6)pS(i,o,e[r-1],e[r],e[r-2]);return i}return new Uint16Array}function DEe(e){if(e.length>0){const t=e.length-1,n=(t-1)*6,i=it.createTypedArray(t,n),o=e[0];let r=0;for(let s=1;s<t;++s,r+=6)pS(i,r,o,e[s],e[s+1]);return i}return new Uint16Array}Ea.toWireframe=function(e){if(!l(e))throw new x("geometry is required.");const t=e.indices;if(l(t)){switch(e.primitiveType){case Je.TRIANGLES:e.indices=SEe(t);break;case Je.TRIANGLE_STRIP:e.indices=vEe(t);break;case Je.TRIANGLE_FAN:e.indices=DEe(t);break;default:throw new x("geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN.")}e.primitiveType=Je.LINES}return e};Ea.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 f=0;f<r;f+=3)s[a++]=i[f],s[a++]=i[f+1],s[a++]=i[f+2],s[a++]=i[f]+o[f]*n,s[a++]=i[f+1]+o[f+1]*n,s[a++]=i[f+2]+o[f+2]*n;let c;const u=e.boundingSphere;return l(u)&&(c=new fe(u.center,u.radius+n)),new Dt({attributes:{position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})},primitiveType:Je.LINES,boundingSphere:c})};Ea.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};Ea.reorderForPreVertexCache=function(e){if(!l(e))throw new x("geometry is required.");const t=Dt.computeNumberOfVertices(e),n=e.indices;if(l(n)){const i=new Int32Array(t);for(let _=0;_<t;_++)i[_]=-1;const o=n,r=o.length,s=it.createTypedArray(t,r);let a=0,c=0,u=0,f;for(;a<r;)f=i[o[a]],f!==-1?s[c]=f:(f=o[a],i[f]=u,s[c]=u,++u),++a,++c;e.indices=s;const h=e.attributes;for(const _ in h)if(h.hasOwnProperty(_)&&l(h[_])&&l(h[_].values)){const g=h[_],p=g.values;let y=0;const C=g.componentsPerAttribute,T=ee.createTypedArray(g.componentDatatype,u*C);for(;y<t;){const E=i[y];if(E!==-1)for(let w=0;w<C;w++)T[C*E+w]=p[C*y+w];++y}g.values=T}}return e};Ea.reorderForPostVertexCache=function(e,t){if(!l(e))throw new x("geometry is required.");const n=e.indices;if(e.primitiveType===Je.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=wEe.tipsify({indices:n,maximumIndex:o,cacheSize:t})}return e};function NU(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 ze({componentDatatype:i.componentDatatype,componentsPerAttribute:i.componentsPerAttribute,normalize:i.normalize,values:[]})}return t}function IEe(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])}}Ea.fitToUnsignedShortIndices=function(e){if(!l(e))throw new x("geometry is required.");if(l(e.indices)&&e.primitiveType!==Je.TRIANGLES&&e.primitiveType!==Je.LINES&&e.primitiveType!==Je.POINTS)throw new x("geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS.");const t=[],n=Dt.computeNumberOfVertices(e);if(l(e.indices)&&n>=N.SIXTY_FOUR_KILOBYTES){let i=[],o=[],r=0,s=NU(e.attributes);const a=e.indices,c=a.length;let u;e.primitiveType===Je.TRIANGLES?u=3:e.primitiveType===Je.LINES?u=2:e.primitiveType===Je.POINTS&&(u=1);for(let f=0;f<c;f+=u){for(let h=0;h<u;++h){const _=a[f+h];let g=i[_];l(g)||(g=r++,i[_]=g,IEe(s,e.attributes,_)),o.push(g)}r+u>=N.SIXTY_FOUR_KILOBYTES&&(t.push(new Dt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV})),i=[],o=[],r=0,s=NU(e.attributes))}o.length!==0&&t.push(new Dt({attributes:s,indices:o,primitiveType:e.primitiveType,boundingSphere:e.boundingSphere,boundingSphereCV:e.boundingSphereCV}))}else t.push(e);return t};const MU=new d,PEe=new Ae;Ea.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 jo;const s=o.ellipsoid,a=r.values,c=new Float64Array(a.length);let u=0;for(let f=0;f<a.length;f+=3){const h=d.fromArray(a,f,MU),_=s.cartesianToCartographic(h,PEe);if(!l(_))throw new x(`Could not project point (${h.x}, ${h.y}, ${h.z}) to 2D.`);const g=o.project(_,MU);c[u++]=g.x,c[u++]=g.y,c[u++]=g.z}return e.attributes[n]=r,e.attributes[i]=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c}),delete e.attributes[t],e};const $I={high:0,low:0};Ea.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 f=0;f<s;++f)wn.encode(r[f],$I),a[f]=$I.high,c[f]=$I.low;const u=o.componentsPerAttribute;return e.attributes[n]=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:u,values:a}),e.attributes[i]=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:u,values:c}),delete e.attributes[t],e};let vl=new d;function XI(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,vl),B.multiplyByPoint(e,vl,vl),d.pack(vl,n,o)}}function KI(e,t){if(l(t)){const n=t.values,i=n.length;for(let o=0;o<i;o+=3)d.unpack(n,o,vl),J.multiplyByVector(e,vl,vl),vl=d.normalize(vl,vl),d.pack(vl,n,o)}}const hE=new B,pE=new J;Ea.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;XI(t,n.position),XI(t,n.prevPosition),XI(t,n.nextPosition),(l(n.normal)||l(n.tangent)||l(n.bitangent))&&(B.inverse(t,hE),B.transpose(hE,hE),B.getMatrix3(hE,pE),KI(pE,n.normal),KI(pE,n.tangent),KI(pE,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 OEe(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 f=e[u][t].attributes[r];if(!l(f)||s.componentDatatype!==f.componentDatatype||s.componentsPerAttribute!==f.componentsPerAttribute||s.normalize!==f.normalize){c=!1;break}a+=f.values.length}c&&(i[r]=new ze({componentDatatype:s.componentDatatype,componentsPerAttribute:s.componentsPerAttribute,normalize:s.normalize,values:ee.createTypedArray(s.componentDatatype,a)}))}return i}const LEe=new d;function JI(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 f=OEe(e,t);let h,_,g;for(i in f)if(f.hasOwnProperty(i))for(h=f[i].values,s=0,o=0;o<n;++o)for(_=e[o][t].attributes[i].values,g=_.length,r=0;r<g;++r)h[s++]=_[r];let p;if(c){let E=0;for(o=0;o<n;++o)E+=e[o][t].indices.length;const w=Dt.computeNumberOfVertices(new Dt({attributes:f,primitiveType:Je.POINTS})),S=it.createTypedArray(w,E);let P=0,O=0;for(o=0;o<n;++o){const z=e[o][t].indices,R=z.length;for(s=0;s<R;++s)S[P++]=O+z[s];O+=Dt.computeNumberOfVertices(e[o][t])}p=S}let y=new d,C=0,T;for(o=0;o<n;++o){if(T=e[o][t].boundingSphere,!l(T)){y=void 0;break}d.add(T.center,y,y)}if(l(y))for(d.divideByScalar(y,n,y),o=0;o<n;++o){T=e[o][t].boundingSphere;const E=d.magnitude(d.subtract(T.center,y,LEe))+T.radius;E>C&&(C=E)}return new Dt({attributes:f,indices:p,primitiveType:u,boundingSphere:l(y)?new fe(y,C):void 0})}Ea.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(JI(t,"geometry")),n.length>0&&(o.push(JI(n,"westHemisphereGeometry")),o.push(JI(n,"eastHemisphereGeometry"))),o};const xc=new d,H0=new d,tg=new d,ng=new d;Ea.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!==Je.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 f=0;for(u=0;u<r;u+=3){const p=t[u],y=t[u+1],C=t[u+2],T=p*3,E=y*3,w=C*3;H0.x=i[T],H0.y=i[T+1],H0.z=i[T+2],tg.x=i[E],tg.y=i[E+1],tg.z=i[E+2],ng.x=i[w],ng.y=i[w+1],ng.z=i[w+2],s[p].count++,s[y].count++,s[C].count++,d.subtract(tg,H0,tg),d.subtract(ng,H0,ng),a[f]=d.cross(tg,ng,new d),f++}let h=0;for(u=0;u<o;u++)s[u].indexOffset+=h,h+=s[u].count;f=0;let _;for(u=0;u<r;u+=3){_=s[t[u]];let p=_.indexOffset+_.currentCount;c[p]=f,_.currentCount++,_=s[t[u+1]],p=_.indexOffset+_.currentCount,c[p]=f,_.currentCount++,_=s[t[u+2]],p=_.indexOffset+_.currentCount,c[p]=f,_.currentCount++,f++}const g=new Float32Array(o*3);for(u=0;u<o;u++){const p=u*3;if(_=s[u],d.clone(d.ZERO,xc),_.count>0){for(f=0;f<_.count;f++)d.add(xc,a[c[_.indexOffset+f]],xc);d.equalsEpsilon(d.ZERO,xc,N.EPSILON10)&&d.clone(a[c[_.indexOffset]],xc)}d.equalsEpsilon(d.ZERO,xc,N.EPSILON10)&&(xc.z=1),d.normalize(xc,xc),g[p]=xc.x,g[p+1]=xc.y,g[p+2]=xc.z}return e.attributes.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g}),e};const BEe=new d,FU=new d,REe=new d;Ea.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!==Je.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 f,h,_;for(u=0;u<a;u+=3){const y=n[u],C=n[u+1],T=n[u+2];f=y*3,h=C*3,_=T*3;const E=y*2,w=C*2,S=T*2,P=i[f],O=i[f+1],z=i[f+2],R=r[E],F=r[E+1],H=r[w+1]-F,v=r[S+1]-F,I=1/((r[w]-R)*v-(r[S]-R)*H),m=(v*(i[h]-P)-H*(i[_]-P))*I,D=(v*(i[h+1]-O)-H*(i[_+1]-O))*I,L=(v*(i[h+2]-z)-H*(i[_+2]-z))*I;c[f]+=m,c[f+1]+=D,c[f+2]+=L,c[h]+=m,c[h+1]+=D,c[h+2]+=L,c[_]+=m,c[_+1]+=D,c[_+2]+=L}const g=new Float32Array(s*3),p=new Float32Array(s*3);for(u=0;u<s;u++){f=u*3,h=f+1,_=f+2;const y=d.fromArray(o,f,BEe),C=d.fromArray(c,f,REe),T=d.dot(y,C);d.multiplyByScalar(y,T,FU),d.normalize(d.subtract(C,FU,C),C),g[f]=C.x,g[h]=C.y,g[_]=C.z,d.normalize(d.cross(y,C,C),C),p[f]=C.x,p[h]=C.y,p[_]=C.z}return e.attributes.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g}),e.attributes.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p}),e};const V0=new j,yl=new d,zU=new d,UU=new d;let mE=new j;Ea.compressVertices=function(e){if(!l(e))throw new x("geometry is required.");const t=e.attributes.extrudeDirection;let n,i;if(l(t)){const O=t.values;i=O.length/3;const z=new Float32Array(i*2);let R=0;for(n=0;n<i;++n){if(d.fromArray(O,n*3,yl),d.equals(yl,d.ZERO)){R+=2;continue}mE=oi.octEncodeInRange(yl,65535,mE),z[R++]=mE.x,z[R++]=mE.y}return e.attributes.compressedAttributes=new ze({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,f=l(c),h=l(u);let _,g,p,y;s&&(_=o.values),a&&(g=r.values),f&&(p=c.values),h&&(y=u.values),i=(s?_.length:g.length)/(s?3:2);let E=i,w=a&&s?2:1;w+=f||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,V0),S[P++]=oi.compressTextureCoordinates(V0));const O=n*3;s&&l(p)&&l(y)?(d.fromArray(_,O,yl),d.fromArray(p,O,zU),d.fromArray(y,O,UU),oi.octPack(yl,zU,UU,V0),S[P++]=V0.x,S[P++]=V0.y):(s&&(d.fromArray(_,O,yl),S[P++]=oi.octEncodeFloat(yl)),f&&(d.fromArray(p,O,yl),S[P++]=oi.octEncodeFloat(yl)),h&&(d.fromArray(y,O,yl),S[P++]=oi.octEncodeFloat(yl)))}return e.attributes.compressedAttributes=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:w,values:S}),s&&delete e.attributes.normal,a&&delete e.attributes.st,h&&delete e.attributes.bitangent,f&&delete e.attributes.tangent,e};function NEe(e){if(l(e.indices))return e;const t=Dt.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=it.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function MEe(e){const t=Dt.computeNumberOfVertices(e);if(t<3)throw new x("The number of vertices must be at least three.");const n=it.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=Je.TRIANGLES,e}function FEe(e){const t=Dt.computeNumberOfVertices(e);if(t<3)throw new x("The number of vertices must be at least 3.");const n=it.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=Je.TRIANGLES,e}function zEe(e){if(l(e.indices))return e;const t=Dt.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=it.createTypedArray(t,t);for(let i=0;i<t;++i)n[i]=i;return e.indices=n,e}function UEe(e){const t=Dt.computeNumberOfVertices(e);if(t<2)throw new x("The number of vertices must be at least two.");const n=it.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=Je.LINES,e}function HEe(e){const t=Dt.computeNumberOfVertices(e);if(t<2)throw new x("The number of vertices must be at least two.");const n=it.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=Je.LINES,e}function VEe(e){switch(e.primitiveType){case Je.TRIANGLE_FAN:return MEe(e);case Je.TRIANGLE_STRIP:return FEe(e);case Je.TRIANGLES:return NEe(e);case Je.LINE_STRIP:return UEe(e);case Je.LINE_LOOP:return HEe(e);case Je.LINES:return zEe(e)}return e}function xh(e,t){Math.abs(e.y)<N.EPSILON6&&(t?e.y=-N.EPSILON6:e.y=N.EPSILON6)}function kEe(e,t,n){if(e.y!==0&&t.y!==0&&n.y!==0){xh(e,e.y<0),xh(t,t.y<0),xh(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=N.sign(e.y):s=N.sign(n.y):o>r?s=N.sign(t.y):s=N.sign(n.y);const a=s<0;xh(e,a),xh(t,a),xh(n,a)}const HU=new d;function wc(e,t,n,i){d.add(e,d.multiplyByScalar(d.subtract(t,e,HU),e.y/(e.y-t.y),HU),n),d.clone(n,i),xh(n,!0),xh(i,!1)}const jp=new d,qp=new d,Yp=new d,$p=new d,QI={positions:new Array(7),indices:new Array(3*3)};function GEe(e,t,n){if(e.x>=0||t.x>=0||n.x>=0)return;kEe(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=QI.indices;s===1?(a[1]=3,a[2]=4,a[5]=6,a[7]=6,a[8]=5,i?(wc(e,t,jp,Yp),wc(e,n,qp,$p),a[0]=0,a[3]=1,a[4]=2,a[6]=1):o?(wc(t,n,jp,Yp),wc(t,e,qp,$p),a[0]=1,a[3]=2,a[4]=0,a[6]=2):r&&(wc(n,e,jp,Yp),wc(n,t,qp,$p),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||(wc(n,e,jp,Yp),wc(n,t,qp,$p),a[0]=0,a[1]=1,a[3]=0,a[6]=2):(wc(t,n,jp,Yp),wc(t,e,qp,$p),a[0]=2,a[1]=0,a[3]=2,a[6]=1):(wc(e,t,jp,Yp),wc(e,n,qp,$p),a[0]=1,a[1]=2,a[3]=1,a[6]=0));const c=QI.positions;return c[0]=e,c[1]=t,c[2]=n,c.length=3,(s===1||s===2)&&(c[3]=jp,c[4]=qp,c[5]=Yp,c[6]=$p,c.length=7),QI}function VU(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=Dt.computeNumberOfVertices(e);return e.indices=it.createTypedArray(i,e.indices),t&&(e.boundingSphere=fe.fromVertices(n.position.values)),e}function Uy(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 ze({componentDatatype:o.componentDatatype,componentsPerAttribute:o.componentsPerAttribute,normalize:o.normalize,values:[]})}return new Dt({attributes:n,indices:[],primitiveType:e.primitiveType})}function XN(e,t,n){const i=l(e.geometry.boundingSphere);t=VU(t,i),n=VU(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 KN(e,t){const n=new e,i=new e,o=new e;return function(r,s,a,c,u,f,h,_){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 C=e.add(g,p,g);e.add(C,y,C),_&&e.normalize(C,C),e.pack(C,f,h*t)}}const WEe=KN(oe,4),aw=KN(d,3),iq=KN(j,2),jEe=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>N.EPSILON6?1:0},sC=new d,NL=new d,ML=new d,qEe=new d;function _E(e,t,n,i,o,r,s,a,c,u,f,h,_,g,p,y){if(!l(r)&&!l(s)&&!l(a)&&!l(c)&&!l(u)&&g===0)return;const C=d.fromArray(o,e*3,sC),T=d.fromArray(o,t*3,NL),E=d.fromArray(o,n*3,ML),w=xEe(i,C,T,E,qEe);if(l(w)){if(l(r)&&aw(e,t,n,w,r,h.normal.values,y,!0),l(u)){const S=d.fromArray(u,e*3,sC),P=d.fromArray(u,t*3,NL),O=d.fromArray(u,n*3,ML);d.multiplyByScalar(S,w.x,S),d.multiplyByScalar(P,w.y,P),d.multiplyByScalar(O,w.z,O);let z;!d.equals(S,d.ZERO)||!d.equals(P,d.ZERO)||!d.equals(O,d.ZERO)?(z=d.add(S,P,S),d.add(z,O,z),d.normalize(z,z)):(z=sC,z.x=0,z.y=0,z.z=0),d.pack(z,h.extrudeDirection.values,y*3)}if(l(f)&&jEe(e,t,n,w,f,h.applyOffset.values,y),l(s)&&aw(e,t,n,w,s,h.tangent.values,y,!0),l(a)&&aw(e,t,n,w,a,h.bitangent.values,y,!0),l(c)&&iq(e,t,n,w,c,h.st.values,y),g>0)for(let S=0;S<g;S++){const P=_[S];YEe(e,t,n,w,y,p[P],h[P])}}}function YEe(e,t,n,i,o,r,s){const a=r.componentsPerAttribute,c=r.values,u=s.values;switch(a){case 4:WEe(e,t,n,i,c,u,o,!1);break;case 3:aw(e,t,n,i,c,u,o,!1);break;case 2:iq(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 vu(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 $Ee={position:!0,normal:!0,bitangent:!0,tangent:!0,st:!0,extrudeDirection:!0,applyOffset:!0};function kU(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,f=t.indices,h=[];for(const z in n)n.hasOwnProperty(z)&&!$Ee[z]&&l(n[z])&&h.push(z);const _=h.length,g=Uy(t),p=Uy(t);let y,C,T,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 O=f.length;for(w=0;w<O;w+=3){const z=f[w],R=f[w+1],F=f[w+2];let H=d.fromArray(i,z*3),v=d.fromArray(i,R*3),I=d.fromArray(i,F*3);const m=GEe(H,v,I);if(l(m)&&m.positions.length>3){const D=m.positions,L=m.indices,M=L.length;for(let V=0;V<M;++V){const k=L[V],W=D[k];W.y<0?(y=p.attributes,C=p.indices,T=S):(y=g.attributes,C=g.indices,T=P),E=vu(y,C,T,f,k<3?w+k:-1,W),_E(z,R,F,W,i,o,s,r,a,c,u,y,h,_,n,E)}}else l(m)&&(H=m.positions[0],v=m.positions[1],I=m.positions[2]),H.y<0?(y=p.attributes,C=p.indices,T=S):(y=g.attributes,C=g.indices,T=P),E=vu(y,C,T,f,w,H),_E(z,R,F,H,i,o,s,r,a,c,u,y,h,_,n,E),E=vu(y,C,T,f,w+1,v),_E(z,R,F,v,i,o,s,r,a,c,u,y,h,_,n,E),E=vu(y,C,T,f,w+2,I),_E(z,R,F,I,i,o,s,r,a,c,u,y,h,_,n,E)}XN(e,p,g)}const oq=St.fromPointNormal(d.ZERO,d.UNIT_Y),XEe=new d,KEe=new d;function ig(e,t,n,i,o,r,s){if(!l(s))return;const a=d.fromArray(i,e*3,sC);d.equalsEpsilon(a,n,N.EPSILON10)?r.applyOffset.values[o]=s[e]:r.applyOffset.values[o]=s[t]}function GU(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=Uy(t),a=Uy(t);let c;const u=r.length,f=[];f.length=i.length/3;const h=[];for(h.length=i.length/3,c=0;c<f.length;++c)f[c]=-1,h[c]=-1;for(c=0;c<u;c+=2){const _=r[c],g=r[c+1],p=d.fromArray(i,_*3,sC),y=d.fromArray(i,g*3,NL);let C;Math.abs(p.y)<N.EPSILON6&&(p.y<0?p.y=-N.EPSILON6:p.y=N.EPSILON6),Math.abs(y.y)<N.EPSILON6&&(y.y<0?y.y=-N.EPSILON6:y.y=N.EPSILON6);let T=s.attributes,E=s.indices,w=h,S=a.attributes,P=a.indices,O=f;const z=nr.lineSegmentPlane(p,y,oq,ML);if(l(z)){const R=d.multiplyByScalar(d.UNIT_Y,5*N.EPSILON9,XEe);p.y<0&&(d.negate(R,R),T=a.attributes,E=a.indices,w=f,S=s.attributes,P=s.indices,O=h);const F=d.add(z,R,KEe);C=vu(T,E,w,r,c,p),ig(_,g,p,i,C,T,o),C=vu(T,E,w,r,-1,F),ig(_,g,F,i,C,T,o),d.negate(R,R),d.add(z,R,F),C=vu(S,P,O,r,-1,F),ig(_,g,F,i,C,S,o),C=vu(S,P,O,r,c+1,y),ig(_,g,y,i,C,S,o)}else{let R,F,H;p.y<0?(R=a.attributes,F=a.indices,H=f):(R=s.attributes,F=s.indices,H=h),C=vu(R,F,H,r,c,p),ig(_,g,p,i,C,R,o),C=vu(R,F,H,r,c+1,y),ig(_,g,y,i,C,R,o)}}XN(e,a,s)}const WU=new j,JEe=new j,rq=new d,sq=new d,FL=new d,QEe=new d,ZEe=new d,exe=new d,jU=new oe;function qU(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=d.unpack(n,s,rq);if(a.x>0)continue;const c=d.unpack(i,s,sq);(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]):d.pack(a,i,s));const u=d.unpack(o,s,FL);(a.y<0&&u.y>0||a.y>0&&u.y<0)&&(s+3<r?(o[s]=n[s+3],o[s+1]=n[s+4],o[s+2]=n[s+5]):d.pack(a,o,s))}}const txe=5*N.EPSILON9,gE=N.EPSILON6;function nxe(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=Uy(t),f=Uy(t);let h,_,g,p=!1;const y=i.length/3;for(h=0;h<y;h+=4){const C=h,T=h+2,E=d.fromArray(i,C*3,rq),w=d.fromArray(i,T*3,sq);if(Math.abs(E.y)<gE)for(E.y=gE*(w.y<0?-1:1),i[h*3+1]=E.y,i[(h+1)*3+1]=E.y,_=C*3;_<C*3+4*3;_+=3)o[_]=i[h*3],o[_+1]=i[h*3+1],o[_+2]=i[h*3+2];if(Math.abs(w.y)<gE)for(w.y=gE*(E.y<0?-1:1),i[(h+2)*3+1]=w.y,i[(h+3)*3+1]=w.y,_=C*3;_<C*3+4*3;_+=3)r[_]=i[(h+2)*3],r[_+1]=i[(h+2)*3+1],r[_+2]=i[(h+2)*3+2];let S=u.attributes,P=u.indices,O=f.attributes,z=f.indices;const R=nr.lineSegmentPlane(E,w,oq,QEe);if(l(R)){p=!0;const F=d.multiplyByScalar(d.UNIT_Y,txe,ZEe);E.y<0&&(d.negate(F,F),S=f.attributes,P=f.indices,O=u.attributes,z=u.indices);const H=d.add(R,F,exe);S.position.values.push(E.x,E.y,E.z,E.x,E.y,E.z),S.position.values.push(H.x,H.y,H.z),S.position.values.push(H.x,H.y,H.z),S.prevPosition.values.push(o[C*3],o[C*3+1],o[C*3+2]),S.prevPosition.values.push(o[C*3+3],o[C*3+4],o[C*3+5]),S.prevPosition.values.push(E.x,E.y,E.z,E.x,E.y,E.z),S.nextPosition.values.push(H.x,H.y,H.z),S.nextPosition.values.push(H.x,H.y,H.z),S.nextPosition.values.push(H.x,H.y,H.z),S.nextPosition.values.push(H.x,H.y,H.z),d.negate(F,F),d.add(R,F,H),O.position.values.push(H.x,H.y,H.z),O.position.values.push(H.x,H.y,H.z),O.position.values.push(w.x,w.y,w.z,w.x,w.y,w.z),O.prevPosition.values.push(H.x,H.y,H.z),O.prevPosition.values.push(H.x,H.y,H.z),O.prevPosition.values.push(H.x,H.y,H.z),O.prevPosition.values.push(H.x,H.y,H.z),O.nextPosition.values.push(w.x,w.y,w.z,w.x,w.y,w.z),O.nextPosition.values.push(r[T*3],r[T*3+1],r[T*3+2]),O.nextPosition.values.push(r[T*3+3],r[T*3+4],r[T*3+5]);const v=j.fromArray(s,C*2,WU),I=Math.abs(v.y);S.expandAndWidth.values.push(-1,I,1,I),S.expandAndWidth.values.push(-1,-I,1,-I),O.expandAndWidth.values.push(-1,I,1,I),O.expandAndWidth.values.push(-1,-I,1,-I);let m=d.magnitudeSquared(d.subtract(R,E,FL));if(m/=d.magnitudeSquared(d.subtract(w,E,FL)),l(c)){const D=oe.fromArray(c,C*4,jU),L=oe.fromArray(c,T*4,jU),M=N.lerp(D.x,L.x,m),V=N.lerp(D.y,L.y,m),k=N.lerp(D.z,L.z,m),W=N.lerp(D.w,L.w,m);for(_=C*4;_<C*4+2*4;++_)S.color.values.push(c[_]);for(S.color.values.push(M,V,k,W),S.color.values.push(M,V,k,W),O.color.values.push(M,V,k,W),O.color.values.push(M,V,k,W),_=T*4;_<T*4+2*4;++_)O.color.values.push(c[_])}if(l(a)){const D=j.fromArray(a,C*2,WU),L=j.fromArray(a,(h+3)*2,JEe),M=N.lerp(D.x,L.x,m);for(_=C*2;_<C*2+2*2;++_)S.st.values.push(a[_]);for(S.st.values.push(M,D.y),S.st.values.push(M,L.y),O.st.values.push(M,D.y),O.st.values.push(M,L.y),_=T*2;_<T*2+2*2;++_)O.st.values.push(a[_])}g=S.position.values.length/3-4,P.push(g,g+2,g+1),P.push(g+1,g+2,g+3),g=O.position.values.length/3-4,z.push(g,g+2,g+1),z.push(g+1,g+2,g+3)}else{let F,H;for(E.y<0?(F=f.attributes,H=f.indices):(F=u.attributes,H=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),_=h*3;_<h*3+4*3;++_)F.prevPosition.values.push(o[_]),F.nextPosition.values.push(r[_]);for(_=h*2;_<h*2+4*2;++_)F.expandAndWidth.values.push(s[_]),l(a)&&F.st.values.push(a[_]);if(l(c))for(_=h*4;_<h*4+4*4;++_)F.color.values.push(c[_]);g=F.position.values.length/3-4,H.push(g,g+2,g+1),H.push(g+1,g+2,g+3)}}p&&(qU(f),qU(u)),XN(e,f,u)}Ea.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,St.ORIGIN_ZX_PLANE)!==mn.INTERSECTING))return e;if(t.geometryType!==qg.NONE)switch(t.geometryType){case qg.POLYLINES:nxe(e);break;case qg.TRIANGLES:kU(e);break;case qg.LINES:GU(e);break}else VEe(t),t.primitiveType===Je.TRIANGLES?kU(e):t.primitiveType===Je.LINES&&GU(e);return e};const Ri=Ea,ixe=new d(1,1,1),yE=Math.cos,AE=Math.sin;function cc(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,ixe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,N.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,N.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===fn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");this._radii=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._subdivisions=u,this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidOutlineGeometry"}cc.packedLength=2*d.packedLength+8;cc.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),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,t[n++]=e._minimumClock,t[n++]=e._maximumClock,t[n++]=e._minimumCone,t[n++]=e._maximumCone,t[n++]=e._stackPartitions,t[n++]=e._slicePartitions,t[n++]=e._subdivisions,t[n]=A(e._offsetAttribute,-1),t};const aq=new d,cq=new d,Df={radii:aq,innerRadii:cq,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0,offsetAttribute:void 0};cc.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=d.unpack(e,t,aq);t+=d.packedLength;const o=d.unpack(e,t,cq);t+=d.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._minimumClock=r,n._maximumClock=s,n._minimumCone=a,n._maximumCone=c,n._stackPartitions=u,n._slicePartitions=f,n._subdivisions=h,n._offsetAttribute=_===-1?void 0:_,n):(Df.minimumClock=r,Df.maximumClock=s,Df.minimumCone=a,Df.maximumCone=c,Df.stackPartitions=u,Df.slicePartitions=f,Df.subdivisions=h,Df.offsetAttribute=_===-1?void 0:_,new cc(Df))};cc.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=pe.fromCartesian3(t);let u=e._slicePartitions+1,f=e._stackPartitions+1;u=Math.round(u*Math.abs(o-i)/N.TWO_PI),f=Math.round(f*Math.abs(s-r)/N.PI),u<2&&(u=2),f<2&&(f=2);let h=0,_=1;const g=n.x!==t.x||n.y!==t.y||n.z!==t.z;let p=!1,y=!1;g&&(_=2,r>0&&(p=!0,h+=u),s<Math.PI&&(y=!0,h+=u));const C=a*_*(f+u),T=new Float64Array(C*3),E=2*(C+h-(u+f)*_),w=it.createTypedArray(C,E);let S,P,O,z,R=0;const F=new Array(f),H=new Array(f);for(S=0;S<f;S++)z=r+S*(s-r)/(f-1),F[S]=AE(z),H[S]=yE(z);const v=new Array(a),I=new Array(a);for(S=0;S<a;S++)O=i+S*(o-i)/(a-1),v[S]=AE(O),I[S]=yE(O);for(S=0;S<f;S++)for(P=0;P<a;P++)T[R++]=t.x*F[S]*I[P],T[R++]=t.y*F[S]*v[P],T[R++]=t.z*H[S];if(g)for(S=0;S<f;S++)for(P=0;P<a;P++)T[R++]=n.x*F[S]*I[P],T[R++]=n.y*F[S]*v[P],T[R++]=n.z*H[S];for(F.length=a,H.length=a,S=0;S<a;S++)z=r+S*(s-r)/(a-1),F[S]=AE(z),H[S]=yE(z);for(v.length=u,I.length=u,S=0;S<u;S++)O=i+S*(o-i)/(u-1),v[S]=AE(O),I[S]=yE(O);for(S=0;S<a;S++)for(P=0;P<u;P++)T[R++]=t.x*F[S]*I[P],T[R++]=t.y*F[S]*v[P],T[R++]=t.z*H[S];if(g)for(S=0;S<a;S++)for(P=0;P<u;P++)T[R++]=n.x*F[S]*I[P],T[R++]=n.y*F[S]*v[P],T[R++]=n.z*H[S];for(R=0,S=0;S<f*_;S++){const L=S*a;for(P=0;P<a-1;P++)w[R++]=L+P,w[R++]=L+P+1}let m=f*a*_;for(S=0;S<u;S++)for(P=0;P<a-1;P++)w[R++]=m+S+P*u,w[R++]=m+S+(P+1)*u;if(g)for(m=f*a*_+u*a,S=0;S<u;S++)for(P=0;P<a-1;P++)w[R++]=m+S+P*u,w[R++]=m+S+(P+1)*u;if(g){let L=f*a*_,M=L+a*u;if(p)for(S=0;S<u;S++)w[R++]=L+S,w[R++]=M+S;if(y)for(L+=a*u-u,M+=a*u-u,S=0;S<u;S++)w[R++]=L+S,w[R++]=M+S}const D=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:T})});if(l(e._offsetAttribute)){const L=T.length,M=e._offsetAttribute===fn.NONE?0:1,V=new Uint8Array(L/3).fill(M);D.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:V})}return new Dt({attributes:D,indices:w,primitiveType:Je.LINES,boundingSphere:fe.fromEllipsoid(c),offsetAttribute:e._offsetAttribute})};function op(e){const t=A(e.radius,1),i={radii:new d(t,t,t),stackPartitions:e.stackPartitions,slicePartitions:e.slicePartitions,subdivisions:e.subdivisions};this._ellipsoidGeometry=new cc(i),this._workerName="createSphereOutlineGeometry"}op.packedLength=cc.packedLength;op.pack=function(e,t,n){return b.typeOf.object("value",e),cc.pack(e._ellipsoidGeometry,t,n)};const oxe=new cc,Xp={radius:void 0,radii:new d,stackPartitions:void 0,slicePartitions:void 0,subdivisions:void 0};op.unpack=function(e,t,n){const i=cc.unpack(e,t,oxe);return Xp.stackPartitions=i._stackPartitions,Xp.slicePartitions=i._slicePartitions,Xp.subdivisions=i._subdivisions,l(n)?(d.clone(i._radii,Xp.radii),n._ellipsoidGeometry=new cc(Xp),n):(Xp.radius=i._radii.x,new op(Xp))};op.createGeometry=function(e){return cc.createGeometry(e._ellipsoidGeometry)};const rxe={NONE:-1,PARTIAL:0,FULL:1},Br=Object.freeze(rxe),sxe={ADD:se.FUNC_ADD,SUBTRACT:se.FUNC_SUBTRACT,REVERSE_SUBTRACT:se.FUNC_REVERSE_SUBTRACT,MIN:se.MIN,MAX:se.MAX},Nc=Object.freeze(sxe),axe={ZERO:se.ZERO,ONE:se.ONE,SOURCE_COLOR:se.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:se.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:se.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:se.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:se.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:se.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:se.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:se.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:se.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:se.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:se.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:se.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:se.SRC_ALPHA_SATURATE},So=Object.freeze(axe),cxe={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.SOURCE_ALPHA,functionSourceAlpha:So.ONE,functionDestinationRgb:So.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:So.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.ONE,functionSourceAlpha:So.ONE,functionDestinationRgb:So.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:So.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.SOURCE_ALPHA,functionSourceAlpha:So.ONE,functionDestinationRgb:So.ONE,functionDestinationAlpha:So.ONE})},Ii=Object.freeze(cxe),lxe={NEVER:se.NEVER,LESS:se.LESS,EQUAL:se.EQUAL,LESS_OR_EQUAL:se.LEQUAL,GREATER:se.GREATER,NOT_EQUAL:se.NOTEQUAL,GREATER_OR_EQUAL:se.GEQUAL,ALWAYS:se.ALWAYS},Jm=Object.freeze(lxe),uxe={UNLOADED:0,TRANSITIONING:1,RECEIVED:2,TEXTURE_LOADED:3,READY:4,FAILED:5,INVALID:6,PLACEHOLDER:7},ai=Object.freeze(uxe),fxe={START:0,LOADING:1,DONE:2,FAILED:3},nl=Object.freeze(fxe),dxe={FAILED:0,UNLOADED:1,RECEIVING:2,RECEIVED:3,TRANSFORMING:4,TRANSFORMED:5,READY:6},io=Object.freeze(dxe);function bi(){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 d,this.boundingVolumeSourceTile=void 0,this.boundingVolumeIsFromMesh=!1,this.terrainState=io.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(bi.prototype,{eligibleForUnloading:{get:function(){const e=this.terrainState;let n=!(e===io.RECEIVING||e===io.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 hxe=new Ae;function ZI(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,hxe);s=n.project(c,r),s=d.fromElements(s.z,s.x,s.y,r)}return s}const pxe=new d,mxe=new d,_xe=new d;bi.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 f=Number.MAX_VALUE;for(let h=0;h<u;h+=3){const _=a[h],g=a[h+1],p=a[h+2],y=ZI(c,t,n,s,_,pxe),C=ZI(c,t,n,s,g,mxe),T=ZI(c,t,n,s,p,_xe),E=nr.rayTriangleParametric(e,y,C,T,i);l(E)&&E<f&&E>=0&&(f=E)}return f!==Number.MAX_VALUE?Pn.getPoint(e,f,o):void 0};bi.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=io.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()};bi.prototype.freeVertexArray=function(){bi._freeVertexArray(this.vertexArray),this.vertexArray=void 0,bi._freeVertexArray(this.wireframeVertexArray),this.wireframeVertexArray=void 0};bi.initialize=function(e,t,n){let i=e.data;l(i)||(i=e.data=new bi),e.state===nl.START&&(gxe(e,t,n),e.state=nl.LOADING)};bi.processStateMachine=function(e,t,n,i,o,r,s){bi.initialize(e,n,i);const a=e.data;if(e.state===nl.LOADING&&yxe(e,t,n,i,o,r),s)return;const c=e.renderable;e.renderable=l(a.vertexArray);const u=a.terrainState===io.READY;e.upsampledFromParent=l(a.terrainData)&&a.terrainData.wasCreatedByUpsampling();const f=a.processImagery(e,n,t);if(u&&f){const h=e._loadedCallbacks,_={};for(const g in h)h.hasOwnProperty(g)&&(h[g](e)||(_[g]=h[g]));e._loadedCallbacks=_,e.state=nl.DONE}c&&(e.renderable=!0)};bi.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,f;for(u=0,f=c.length;u<f;++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,f=c.length;continue}else r=!1}const _=h.processStateMachine(e,n,i);a=a&&_,s=s||_||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 lq(e,t,n,i){const o=e.renderedMesh,r=o.vertices,s=o.encoding,a=r.length/s.stride;let c=ur.clone(s);c.hasGeodeticSurfaceNormals=t,c=ur.clone(c);const u=c.stride,f=new Float32Array(a*u);t?s.addGeodeticSurfaceNormals(r,f,n):s.removeGeodeticSurfaceNormals(r,f),o.vertices=f,o.stride=u,o!==e.mesh?(bi._freeVertexArray(e.fill.vertexArray),e.fill.vertexArray=bi._createVertexArrayForMesh(i.context,o)):(bi._freeVertexArray(e.vertexArray),e.vertexArray=bi._createVertexArrayForMesh(i.context,o)),bi._freeVertexArray(e.wireframeVertexArray),e.wireframeVertexArray=void 0}bi.prototype.addGeodeticSurfaceNormals=function(e,t){lq(this,!0,e,t)};bi.prototype.removeGeodeticSurfaceNormals=function(e){lq(this,!1,void 0,e)};bi.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,f=c.exaggerationRelativeHeight!==s;if(u||f){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,_=h.length;for(let g=0;g<_;g++){const p=h[g];p.level=-1}}}};function gxe(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=io.FAILED);for(let o=0,r=n.length;o<r;++o){const s=n.get(o);s.show&&s._createTileImagerySkeletons(e,t)}}function yxe(e,t,n,i,o,r){const s=e.data,a=e.parent;if(s.terrainState===io.FAILED&&a!==void 0&&(a.data!==void 0&&a.data.terrainData!==void 0&&a.data.terrainData.canUpsample!==!1||bi.processStateMachine(a,t,n,i,o,r,!0)),s.terrainState===io.FAILED&&Axe(s,e,t,n,e.x,e.y,e.level),s.terrainState===io.UNLOADED&&Cxe(s,n,e.x,e.y,e.level),s.terrainState===io.RECEIVED&&bxe(s,t,n,e.x,e.y,e.level),s.terrainState===io.TRANSFORMED&&(Exe(s,t.context,n,e.x,e.y,e.level,r),s.updateExaggeration(e,t,o)),s.terrainState>=io.RECEIVED&&s.waterMaskTexture===void 0&&n.hasWaterMask)if(s.terrainData.waterMask!==void 0)wxe(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 Axe(e,t,n,i,o,r,s){const a=t.parent;if(!a){t.state=nl.FAILED;return}const c=a.data.terrainData,u=a.x,f=a.y,h=a.level;if(!l(c))return;const _=c.upsample(i.tilingScheme,u,f,h,o,r,s);l(_)&&(e.terrainState=io.RECEIVING,Promise.resolve(_).then(function(g){e.terrainData=g,e.terrainState=io.RECEIVED}).catch(function(){e.terrainState=io.FAILED}))}function Cxe(e,t,n,i,o){function r(c){e.terrainData=c,e.terrainState=io.RECEIVED,e.request=void 0}function s(c){if(e.request.state===yo.CANCELLED){e.terrainData=void 0,e.terrainState=io.UNLOADED,e.request=void 0;return}e.terrainState=io.FAILED,e.request=void 0;const u=`Failed to obtain terrain tile X: ${n} Y: ${i} Level: ${o}. Error message: "${c}"`;t._requestError=Ki.reportError(t._requestError,t,t.errorEvent,u,n,i,o),t._requestError.retry&&a()}function a(){const c=new ju({throttle:!1,throttleByServer:!0,type:C_.TERRAIN});e.request=c;const u=t.requestTileGeometry(n,i,o,c);l(u)?(e.terrainState=io.RECEIVING,Promise.resolve(u).then(function(f){r(f)}).catch(function(f){s(f)})):(e.terrainState=io.UNLOADED,e.request=void 0)}a()}const Txe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0,throttle:!0};function bxe(e,t,n,i,o,r){const s=n.tilingScheme,a=Txe;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=io.TRANSFORMING,Promise.resolve(u).then(function(f){e.mesh=f,e.terrainState=io.TRANSFORMED}).catch(function(){e.terrainState=io.FAILED}))}bi._createVertexArrayForMesh=function(e,t){const n=t.vertices,i=At.createVertexBuffer({context:e,typedArray:n,usage:Ze.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=At.createIndexBuffer({context:e,typedArray:a,usage:Ze.STATIC_DRAW,indexDatatype:it.fromSizeInBytes(a.BYTES_PER_ELEMENT)}),s.vertexArrayDestroyable=!1,s.referenceCount=1,r[e.id]=s,t.indices.indexBuffers=r}else++s.referenceCount;return new to({context:e,attributes:o,indexBuffer:s})};bi._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 Exe(e,t,n,i,o,r,s){e.vertexArray=bi._createVertexArrayForMesh(t,e.mesh),e.terrainState=io.READY,e.fill=e.fill&&e.fill.destroy(s)}function xxe(e){let t=e.cache.tile_waterMaskData;if(!l(t)){const n=zt.create({context:e,pixelFormat:nt.LUMINANCE,pixelDatatype:Ke.UNSIGNED_BYTE,source:{arrayBufferView:new Uint8Array([255]),width:1,height:1}});n.referenceCount=1;const i=new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:An.LINEAR,magnificationFilter:Hr.LINEAR});t={allWaterTexture:n,sampler:i,destroy:function(){this.allWaterTexture.destroy()}},e.cache.tile_waterMaskData=t}return t}function wxe(e,t){const n=t.terrainData.waterMask,i=xxe(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=zt.create({context:e,pixelFormat:nt.LUMINANCE,pixelDatatype:Ke.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)}bi.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};bi.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 Qm(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}Qm.createPlaceholder=function(e){const t=new Qm(e,0,0,0);return t.addReference(),t.state=ai.PLACEHOLDER,t};Qm.prototype.addReference=function(){++this.referenceCount};Qm.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(),Ue(this),0):this.referenceCount};Qm.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 Sxe={LEFT:-1,NONE:0,RIGHT:1},w_=Object.freeze(Sxe);function Dv(e,t,n){this.readyImagery=void 0,this.loadingImagery=e,this.textureCoordinateRectangle=t,this.textureTranslationAndScale=void 0,this.useWebMercatorT=n}Dv.prototype.freeResources=function(){l(this.readyImagery)&&this.readyImagery.releaseReference(),l(this.loadingImagery)&&this.loadingImagery.releaseReference()};Dv.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 Ln(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,Ln.DEFAULT_BRIGHTNESS)),this.contrast=A(t.contrast,A(e.defaultContrast,Ln.DEFAULT_CONTRAST)),this.hue=A(t.hue,A(e.defaultHue,Ln.DEFAULT_HUE)),this.saturation=A(t.saturation,A(e.defaultSaturation,Ln.DEFAULT_SATURATION)),this.gamma=A(t.gamma,A(e.defaultGamma,Ln.DEFAULT_GAMMA)),this.splitDirection=A(t.splitDirection,A(e.defaultSplit,Ln.DEFAULT_SPLIT)),this.minificationFilter=A(t.minificationFilter,A(e.defaultMinificationFilter,Ln.DEFAULT_MINIFICATION_FILTER)),this.magnificationFilter=A(t.magnificationFilter,A(e.defaultMagnificationFilter,Ln.DEFAULT_MAGNIFICATION_FILTER)),this.show=A(t.show,!0),this._minimumTerrainLevel=t.minimumTerrainLevel,this._maximumTerrainLevel=t.maximumTerrainLevel,this._rectangle=A(t.rectangle,_e.MAX_VALUE),this._maximumAnisotropy=t.maximumAnisotropy,this._imageryCache={},this._skeletonPlaceholder=new Dv(Qm.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,Ln.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD)}Object.defineProperties(Ln.prototype,{imageryProvider:{get:function(){return this._imageryProvider}},rectangle:{get:function(){return this._rectangle}}});Ln.DEFAULT_BRIGHTNESS=1;Ln.DEFAULT_CONTRAST=1;Ln.DEFAULT_HUE=0;Ln.DEFAULT_SATURATION=1;Ln.DEFAULT_GAMMA=1;Ln.DEFAULT_SPLIT=w_.NONE;Ln.DEFAULT_MINIFICATION_FILTER=An.LINEAR;Ln.DEFAULT_MAGNIFICATION_FILTER=Hr.LINEAR;Ln.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD=.004;Ln.prototype.isBaseLayer=function(){return this._isBaseLayer};Ln.prototype.isDestroyed=function(){return!1};Ln.prototype.destroy=function(){return Ue(this)};const uq=new _e,YU=new _e,eP=new _e,fq=new _e;Ln.prototype.getViewableRectangle=function(){const e=this._imageryProvider,t=this._rectangle;return e.readyPromise.then(function(){return _e.intersection(e.rectangle,t)})};Ln.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 Zn&&e.rectangle.north<Zn.MaximumLatitude&&e.rectangle.south>-Zn.MaximumLatitude,s=_e.intersection(o.rectangle,this._rectangle,uq);let a=_e.intersection(e.rectangle,s,YU);if(!l(a)){if(!this.isBaseLayer())return!1;const m=s,D=e.rectangle;a=YU,D.south>=m.north?a.north=a.south=m.north:D.north<=m.south?a.north=a.south=m.south:(a.south=Math.max(D.south,m.south),a.north=Math.min(D.north,m.north)),D.west>=m.east?a.west=a.east=m.east:D.east<=m.west?a.west=a.east=m.west:(a.west=Math.max(D.west,m.west),a.east=Math.min(D.east,m.east))}let c=0;a.south>0?c=a.south:a.north<0&&(c=a.north);const f=1*t.getLevelMaximumGeometricError(e.level);let h=Ixe(this,f,c);h=Math.max(0,h);const _=o.maximumLevel;if(h>_&&(h=_),l(o.minimumLevel)){const m=o.minimumLevel;h<m&&(h=m)}const g=o.tilingScheme,p=g.positionToTileXY(_e.northwest(a),h),y=g.positionToTileXY(_e.southeast(a),h);let C=e.rectangle.width/512,T=e.rectangle.height/512;const E=g.tileXYToRectangle(p.x,p.y,h);Math.abs(E.south-e.rectangle.north)<T&&p.y<y.y&&++p.y,Math.abs(E.east-e.rectangle.west)<C&&p.x<y.x&&++p.x;const w=g.tileXYToRectangle(y.x,y.y,h);Math.abs(w.north-e.rectangle.south)<T&&y.y>p.y&&--y.y,Math.abs(w.west-e.rectangle.east)<C&&y.x>p.x&&--y.x;const S=_e.clone(e.rectangle,fq);let P=g.tileXYToRectangle(p.x,p.y,h),O=_e.intersection(P,s,eP),z;r?(g.rectangleToNativeRectangle(S,S),g.rectangleToNativeRectangle(P,P),g.rectangleToNativeRectangle(O,O),g.rectangleToNativeRectangle(s,s),z=g.tileXYToNativeRectangle.bind(g),C=S.width/512,T=S.height/512):z=g.tileXYToRectangle.bind(g);let R,F=0,H=1,v;!this.isBaseLayer()&&Math.abs(O.west-S.west)>=C&&(F=Math.min(1,(O.west-S.west)/S.width)),!this.isBaseLayer()&&Math.abs(O.north-S.north)>=T&&(H=Math.max(0,(O.north-S.south)/S.height));const I=H;for(let m=p.x;m<=y.x;m++)if(R=F,P=z(m,p.y,h),O=_e.simpleIntersection(P,s,eP),!!l(O)){F=Math.min(1,(O.east-S.west)/S.width),m===y.x&&(this.isBaseLayer()||Math.abs(O.east-S.east)<C)&&(F=1),H=I;for(let D=p.y;D<=y.y;D++){if(v=H,P=z(m,D,h),O=_e.simpleIntersection(P,s,eP),!l(O))continue;H=Math.max(0,(O.south-S.south)/S.height),D===y.y&&(this.isBaseLayer()||Math.abs(O.south-S.south)<T)&&(H=0);const L=new oe(R,H,F,v),M=this.getImageryFromCache(m,D,h);i.imagery.splice(n,0,new Dv(M,L,r)),++n}}return!0};Ln.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,uq),i=c.rectangleToNativeRectangle(i,fq)}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)};Ln.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,Ki.reportSuccess(n._requestImageError)}function o(s){if(e.request.state===yo.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=Ki.reportError(n._requestImageError,t,t.errorEvent,a,e.x,e.y,e.level,s),n._requestImageError.retry&&r()}function r(){const s=new ju({throttle:!1,throttleByServer:!0,type:C_.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()};Ln.prototype._createTextureWebGL=function(e,t){const n=new Yn({minificationFilter:this.minificationFilter,magnificationFilter:this.magnificationFilter}),i=t.image;return l(i.internalFormat)?new zt({context:e,pixelFormat:i.internalFormat,width:i.width,height:i.height,source:{arrayBufferView:i.bufferView},sampler:n}):new zt({context:e,source:i,pixelFormat:this._imageryProvider.hasAlphaChannel?nt.RGBA:nt.RGB,sampler:n})};Ln.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!==An.NEAREST&&this.minificationFilter!==An.LINEAR)throw new x("ImageryLayer minification filter must be NEAREST or LINEAR");const o=this._createTextureWebGL(e,t);n.tilingScheme.projection instanceof Zn?t.textureWebMercator=o:t.texture=o,t.image=void 0,t.state=ai.TEXTURE_LOADED};function $U(e,t,n){return`${e}:${t}:${n}`}Ln.prototype._finalizeReprojectTexture=function(e,t){let n=this.minificationFilter;const i=this.magnificationFilter;if(n===An.LINEAR&&i===Hr.LINEAR&&!nt.isCompressedFormat(t.pixelFormat)&&N.isPowerOfTwo(t.width)&&N.isPowerOfTwo(t.height)){n=An.LINEAR_MIPMAP_LINEAR;const r=wt.maximumTextureFilterAnisotropy,s=Math.min(r,A(this._maximumAnisotropy,r)),a=$U(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 Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i,maximumAnisotropy:s})),t.generateMipmap(My.NICEST),t.sampler=u}else{const r=$U(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 Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i})),t.sampler=a}};Ln.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 jo)&&o.width/i.width>1e-5){const s=this;t.addReference();const a=new MC({persists:!0,owner:this,preExecute:function(c){Dxe(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};Ln.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};Ln.prototype.cancelReprojections=function(){this._reprojectComputeCommands.forEach(function(e){l(e.canceled)&&e.canceled()}),this._reprojectComputeCommands.length=0};Ln.prototype.getImageryFromCache=function(e,t,n,i){const o=dq(e,t,n);let r=this._imageryCache[o];return l(r)||(r=new Qm(this,e,t,n,i),this._imageryCache[o]=r),r.addReference(),r};Ln.prototype.removeImageryFromCache=function(e){const t=dq(e.x,e.y,e.level);delete this._imageryCache[t]};function dq(e,t,n){return JSON.stringify([e,t,n])}const CE={u_textureDimensions:function(){return this.textureDimensions},u_texture:function(){return this.texture},textureDimensions:new j,texture:void 0},vxe=un.supportsTypedArrays()?new Float32Array(2*64):void 0;function Dxe(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 C=new Float32Array(2*64*2);let T=0;for(let O=0;O<64;++O){const z=O/63;C[T++]=0,C[T++]=z,C[T++]=1,C[T++]=z}const E={position:0,webMercatorT:1},w=Go.getRegularGridIndices(2,64),S=At.createIndexBuffer({context:t,typedArray:w,usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT});o.vertexArray=new to({context:t,attributes:[{index:E.position,vertexBuffer:At.createVertexBuffer({context:t,typedArray:C,usage:Ze.STATIC_DRAW}),componentsPerAttribute:2},{index:E.webMercatorT,vertexBuffer:At.createVertexBuffer({context:t,sizeInBytes:64*2*4,usage:Ze.STREAM_DRAW}),componentsPerAttribute:1}],indexBuffer:S});const P=new Ge({sources:[AAe]});o.shaderProgram=hn.fromCache({context:t,vertexShaderSource:P,fragmentShaderSource:yAe,attributeLocations:E}),o.sampler=new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:An.LINEAR,magnificationFilter:Hr.LINEAR})}n.sampler=o.sampler;const r=n.width,s=n.height;CE.textureDimensions.x=r,CE.textureDimensions.y=s,CE.texture=n;let a=Math.sin(i.south);const c=.5*Math.log((1+a)/(1-a));a=Math.sin(i.north);const f=1/(.5*Math.log((1+a)/(1-a))-c),h=new zt({context:t,width:r,height:s,pixelFormat:n.pixelFormat,pixelDatatype:n.pixelDatatype,preMultiplyAlpha:n.preMultiplyAlpha});N.isPowerOfTwo(r)&&N.isPowerOfTwo(s)&&h.generateMipmap(My.NICEST);const _=i.south,g=i.north,p=vxe;let y=0;for(let C=0;C<64;++C){const T=C/63,E=N.lerp(_,g,T);a=Math.sin(E);const S=(.5*Math.log((1+a)/(1-a))-c)*f;p[y++]=S,p[y++]=S}o.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(p),e.shaderProgram=o.shaderProgram,e.outputTexture=h,e.uniformMap=CE,e.vertexArray=o.vertexArray}function Ixe(e,t,n){const i=e._imageryProvider,o=i.tilingScheme,r=o.ellipsoid,s=e._imageryProvider.tilingScheme.projection instanceof jo?1:Math.cos(n),a=o.rectangle,u=r.maximumRadius*a.width*s/(i.tileWidth*o.getNumberOfXTilesAtLevel(0))/t,f=Math.log(u)/Math.log(2);return Math.round(f)|0}function Ne(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)}Ne.POSITION_ONLY=Object.freeze(new Ne({position:!0}));Ne.POSITION_AND_NORMAL=Object.freeze(new Ne({position:!0,normal:!0}));Ne.POSITION_NORMAL_AND_ST=Object.freeze(new Ne({position:!0,normal:!0,st:!0}));Ne.POSITION_AND_ST=Object.freeze(new Ne({position:!0,st:!0}));Ne.POSITION_AND_COLOR=Object.freeze(new Ne({position:!0,color:!0}));Ne.ALL=Object.freeze(new Ne({position:!0,normal:!0,st:!0,tangent:!0,bitangent:!0}));Ne.DEFAULT=Ne.POSITION_NORMAL_AND_ST;Ne.packedLength=6;Ne.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};Ne.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new Ne),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};Ne.clone=function(e,t){if(l(e))return l(t)||(t=new Ne),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 Pxe=`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);
}
`,Oxe=`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;
}
`,hq=`varying vec4 v_color;
void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
}
`,Lxe=`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;
}
`,Bxe={FRONT:se.FRONT,BACK:se.BACK,FRONT_AND_BACK:se.FRONT_AND_BACK},Po=Object.freeze(Bxe);function fr(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(fr.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}}});fr.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(`
`)};fr.prototype.isTranslucent=function(){return l(this.material)&&this.material.isTranslucent()||!l(this.material)&&this.translucent};fr.prototype.getRenderState=function(){const e=this.isTranslucent(),t=ut(this.renderState,!1);return e?(t.depthMask=!1,t.blending=Ii.ALPHA_BLEND):t.depthMask=!0,t};fr.getDefaultRenderState=function(e,t,n){let i={depthTest:{enabled:!0}};return e&&(i.depthMask=!1,i.blending=Ii.ALPHA_BLEND),t&&(i.cull={enabled:!0,face:Po.BACK}),l(n)&&(i=sn(n,i,!0)),i};function _n(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?Lxe:Oxe,r=i?hq:Pxe,s=i?_n.FLAT_VERTEX_FORMAT:_n.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,o),this._fragmentShaderSource=A(e.fragmentShaderSource,r),this._renderState=fr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=s,this._flat=i,this._faceForward=A(e.faceForward,!n)}Object.defineProperties(_n.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}}});_n.VERTEX_FORMAT=Ne.POSITION_AND_NORMAL;_n.FLAT_VERTEX_FORMAT=Ne.POSITION_ONLY;_n.prototype.getFragmentShaderSource=fr.prototype.getFragmentShaderSource;_n.prototype.isTranslucent=fr.prototype.isTranslucent;_n.prototype.getRenderState=fr.prototype.getRenderState;function Rxe(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 sf(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=Nxe(t),o=e.floatingPointTexture,r=i===Ke.FLOAT&&!o,s=Mxe(t,r),a=Fxe(s,t,r),c=Math.floor(wt.maximumTextureSize/a),u=Math.min(n,c),f=a*u,h=Math.ceil(n/u),_=1/f,g=_*.5,p=1/h,y=p*.5;this._textureDimensions=new j(f,h),this._textureStep=new oe(_,g,p,y),this._pixelDatatype=r?Ke.UNSIGNED_BYTE:i,this._packFloats=r,this._offsets=s,this._stride=a,this._texture=void 0;const C=4*f*h;this._batchValues=i===Ke.FLOAT&&!r?new Float32Array(C):new Uint8Array(C),this._batchValuesDirty=!1}Object.defineProperties(sf.prototype,{attributes:{get:function(){return this._attributes}},numberOfInstances:{get:function(){return this._numberOfInstances}}});function Nxe(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?Ke.FLOAT:Ke.UNSIGNED_BYTE}function pq(e,t){const n=e[t].componentsPerAttribute;return n===2?j:n===3?d:n===4?oe:Number}function Mxe(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 Fxe(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 PA=new oe;function zxe(e,t,n){let i=oe.unpack(e,t,PA);const o=oe.unpackFloat(i);i=oe.unpack(e,t+4,PA);const r=oe.unpackFloat(i);i=oe.unpack(e,t+8,PA);const s=oe.unpackFloat(i);i=oe.unpack(e,t+12,PA);const a=oe.unpackFloat(i);return oe.fromElements(o,r,s,a,n)}function Uxe(e,t,n){let i=oe.packFloat(e.x,PA);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 XU=new oe;sf.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!==Ke.UNSIGNED_BYTE?a=zxe(this._batchValues,s,XU):a=oe.unpack(this._batchValues,s,XU);const c=pq(i,t);return l(c.fromCartesian4)?c.fromCartesian4(a,n):l(c.clone)?c.clone(a,n):a.x};const Hxe=[void 0,void 0,new j,new d,new oe],Vxe=new oe;sf.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=Hxe[i[t].componentsPerAttribute],r=this.getBatchedAttribute(e,t,o),s=pq(this._attributes,t);if(l(s.equals)?s.equals(r,n):r===n)return;const c=Vxe;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!==Ke.UNSIGNED_BYTE?Uxe(c,this._batchValues,h):oe.pack(c,this._batchValues,h),this._batchValuesDirty=!0};function kxe(e,t){const n=e._textureDimensions;e._texture=new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:e._pixelDatatype,width:n.x,height:n.y,sampler:Yn.NEAREST,flipY:!1})}function Gxe(e){const t=e._textureDimensions;e._texture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}sf.prototype.update=function(e){l(this._texture)&&!this._batchValuesDirty||this._attributes.length===0||(this._batchValuesDirty=!1,l(this._texture)||kxe(this,e.context),Gxe(this))};sf.prototype.getUniformMapCallback=function(){const e=this;return function(t){return e._attributes.length===0?t:sn(t,{batchTexture:function(){return e._texture},batchTextureDimensions:function(){return e._textureDimensions},batchTextureStep:function(){return e._textureStep}})}};function Wxe(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 jxe(e){return e===1?"float":`vec${e}`}function qxe(e){return e===1?".x":e===2?".xy":e===3?".xyz":""}function Yxe(e,t){const i=e._attributes[t],o=i.componentsPerAttribute,r=i.functionName,s=jxe(o),a=qxe(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!==Ke.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===Ke.UNSIGNED_BYTE&&i.componentDatatype===ee.UNSIGNED_BYTE&&!i.normalize?u+=`value *= 255.0;
`:e._pixelDatatype===Ke.FLOAT&&i.componentDatatype===ee.UNSIGNED_BYTE&&i.normalize&&(u+=`value /= 255.0;
`),u+=` return value;
}
`,u}sf.prototype.getVertexShaderCallback=function(){const e=this._attributes;if(e.length===0)return function(i){return i};let t=`uniform highp sampler2D batchTexture;
`;t+=`${Wxe(this)}
`;const n=e.length;for(let i=0;i<n;++i)t+=Yxe(this,i);return function(i){const o=i.indexOf("void main"),r=i.substring(0,o),s=i.substring(o);return`${r}
${t}
${s}`}};sf.prototype.isDestroyed=function(){return!1};sf.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),Ue(this)};function Ro(e,t,n){e=A(e,0),t=A(t,0),n=A(n,0),this.value=new Float32Array([e,t,n])}Object.defineProperties(Ro.prototype,{componentDatatype:{get:function(){return ee.FLOAT}},componentsPerAttribute:{get:function(){return 3}},normalize:{get:function(){return!1}}});Ro.fromCartesian3=function(e){return b.defined("offset",e),new Ro(e.x,e.y,e.z)};Ro.toValue=function(e,t){return b.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 $xe(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)&&Ri.transformToWorldCoordinates(e[r]);else B.multiplyTransformation(t,e[0].modelMatrix,t)}function tP(e,t){const n=e.attributes,i=n.position,o=i.values.length/i.componentsPerAttribute;n.batchId=new ze({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 Xxe(e){const t=e.length;for(let n=0;n<t;++n){const i=e[n];l(i.geometry)?tP(i.geometry,n):l(i.westHemisphereGeometry)&&l(i.eastHemisphereGeometry)&&(tP(i.westHemisphereGeometry,n),tP(i.eastHemisphereGeometry,n))}}function Kxe(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,f,h=t.length;for(c=0;c<h;++c)if(l(t[c].geometry)){f=t[c].geometry.primitiveType;break}for(c=1;c<h;++c)if(l(t[c].geometry)&&t[c].geometry.primitiveType!==f)throw new x("All instance geometries must have the same primitiveType.");if($xe(t,a,o),!o)for(c=0;c<h;++c)l(t[c].geometry)&&Ri.splitLongitude(t[c]);if(Xxe(t),r)for(c=0;c<h;++c){const g=t[c];l(g.geometry)?(Ri.reorderForPostVertexCache(g.geometry),Ri.reorderForPreVertexCache(g.geometry)):l(g.westHemisphereGeometry)&&l(g.eastHemisphereGeometry)&&(Ri.reorderForPostVertexCache(g.westHemisphereGeometry),Ri.reorderForPreVertexCache(g.westHemisphereGeometry),Ri.reorderForPostVertexCache(g.eastHemisphereGeometry),Ri.reorderForPreVertexCache(g.eastHemisphereGeometry))}let _=Ri.combineInstances(t);for(h=_.length,c=0;c<h;++c){u=_[c];const g=u.attributes;if(o)for(const p in g)g.hasOwnProperty(p)&&g[p].componentDatatype===ee.DOUBLE&&Ri.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`,C=`${p}2D`;Ri.projectTo2D(u,p,y,C,n),l(u.boundingSphere)&&p==="position"&&(u.boundingSphereCV=fe.fromVertices(u.attributes.position2D.values)),Ri.encodeAttribute(u,y,`${y}High`,`${y}Low`),Ri.encodeAttribute(u,C,`${C}High`,`${C}Low`)}s&&Ri.compressVertices(u)}if(!i){let g=[];for(h=_.length,c=0;c<h;++c)u=_[c],g=g.concat(Ri.fitToUnsignedShortIndices(u));_=g}return _}function nP(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 _=h.indices.length;o+_>r&&(o=0,r=n[++s].indices.length),i.push({index:s,offset:o,count:_}),o+=_}}function Jxe(e,t){const n=[];return nP(e,"geometry",t,n),nP(e,"westHemisphereGeometry",t,n),nP(e,"eastHemisphereGeometry",t,n),n}const dd={};dd.combineGeometry=function(e){let t,n;const i=e.instances,o=i.length;let r,s,a=!1;o>0&&(t=Kxe(e),t.length>0&&(n=Ri.createAttributeLocations(t[0]),e.createPickOffsets&&(r=Jxe(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 f=0;f<o;++f){const h=i[f],_=h.geometry;l(_)&&(c[f]=_.boundingSphere,u[f]=_.boundingSphereCV,a&&(s[f]=h.geometry.offsetAttribute));const g=h.eastHemisphereGeometry,p=h.westHemisphereGeometry;l(g)&&l(p)&&(l(g.boundingSphere)&&l(p.boundingSphere)&&(c[f]=fe.union(g.boundingSphere,p.boundingSphere)),l(g.boundingSphereCV)&&l(p.boundingSphereCV)&&(u[f]=fe.union(g.boundingSphereCV,p.boundingSphereCV)))}return{geometries:t,modelMatrix:e.modelMatrix,attributeLocations:n,pickOffsets:r,offsetInstanceExtend:s,boundingSpheres:c,boundingSpheresCV:u}};function Qxe(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 Zxe(e,t){const n=e.length;for(let i=0;i<n;++i)Qxe(e[i],t)}function ewe(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}dd.packCreateGeometryResults=function(e,t){const n=new Float64Array(ewe(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 f=l(c.boundingSphere)?1:0;n[s++]=f,f&&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 _=c.attributes,g=[];for(const y in _)_.hasOwnProperty(y)&&l(_[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 C=g[y],T=_[C];n[s++]=o[C],n[s++]=T.componentDatatype,n[s++]=T.componentsPerAttribute,n[s++]=T.normalize?1:0,n[s++]=T.values.length,n.set(T.values,s),s+=T.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}};dd.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 f=n[s++];f===-1&&(f=void 0);let h,_;n[s++]===1&&(h=fe.unpack(n,s)),s+=fe.packedLength,n[s++]===1&&(_=fe.unpack(n,s)),s+=fe.packedLength;let y,C,T;const E=new Ui,w=n[s++];for(i=0;i<w;i++){const P=t[n[s++]],O=n[s++];T=n[s++];const z=n[s++]!==0;y=n[s++],C=ee.createTypedArray(O,y);for(let R=0;R<y;R++)C[R]=n[s++];E[P]=new ze({componentDatatype:O,componentsPerAttribute:T,normalize:z,values:C})}let S;if(y=n[s++],y>0){const P=C.length/T;for(S=it.createTypedArray(P,y),i=0;i<y;i++)S[i]=n[s++]}o[r++]=new Dt({primitiveType:c,geometryType:u,boundingSphere:h,boundingSphereCV:_,indices:S,attributes:E,offsetAttribute:f})}return o};function twe(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 nwe(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 Ro(t[o],t[o+1],t[o+2])}),o+=3,n[i++]={modelMatrix:r,attributes:s}}return n}dd.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:twe(e.instances,t),ellipsoid:e.ellipsoid,isGeographic:e.projection instanceof jo,elementIndexUintSupported:e.elementIndexUintSupported,scene3DOnly:e.scene3DOnly,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e.createPickOffsets}};dd.unpackCombineGeometryParameters=function(e){const t=nwe(e.packedInstances),n=e.createGeometryResults,i=n.length;let o=0;for(let a=0;a<i;a++){const c=dd.unpackCreateGeometryResults(n[a]),u=c.length;for(let f=0;f<u;f++){const h=c[f],_=t[o];_.geometry=h,++o}}const r=pe.clone(e.ellipsoid),s=e.isGeographic?new jo(r):new Zn(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 KU(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 JU(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}dd.packCombineGeometryResults=function(e,t){l(e.geometries)&&Zxe(e.geometries,t);const n=KU(e.boundingSpheres),i=KU(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}};dd.unpackCombineGeometryResults=function(e){return{geometries:e.geometries,attributeLocations:e.attributeLocations,modelMatrix:e.modelMatrix,pickOffsets:e.pickOffsets,offsetInstanceExtend:e.offsetInstanceExtend,boundingSpheres:JU(e.boundingSpheres),boundingSpheresCV:JU(e.boundingSpheresCV)}};const zL=dd,iwe={READY:0,CREATING:1,CREATED:2,COMBINING:3,COMBINED:4,COMPLETE:5,FAILED:6},gr=Object.freeze(iwe),$a={DISABLED:0,ENABLED:1,CAST_ONLY:2,RECEIVE_ONLY:3};$a.NUMBER_OF_SHADOW_MODES=4;$a.castShadows=function(e){return e===$a.ENABLED||e===$a.CAST_ONLY};$a.receiveShadows=function(e){return e===$a.ENABLED||e===$a.RECEIVE_ONLY};$a.fromCastReceive=function(e,t){return e&&t?$a.ENABLED:e?$a.CAST_ONLY:t?$a.RECEIVE_ONLY:$a.DISABLED};const Co=Object.freeze($a);function Wt(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,Co.DISABLED),this._translucent=void 0,this._state=gr.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===gr.COMPLETE||t._state===gr.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(Wt.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 owe(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 rwe=new j,swe=new d,mq=new oe;function _q(e){const t=e.length;if(t===1)return e[0];if(t===2)return j.unpack(e,0,rwe);if(t===3)return d.unpack(e,0,swe);if(t===4)return oe.unpack(e,0,mq)}function awe(e,t){const n=e.geometryInstances,i=Array.isArray(n)?n:[n],o=i.length;if(o===0)return;const r=owe(i),s=r.length,a=[],c={},u={};let f,_=i[0].attributes,g,p,y;for(g=0;g<s;++g)p=r[g],y=_[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}),f=a.length-1),a.push({functionName:"czm_batchTable_pickColor",componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:4,normalize:!0});const C=a.length,T=new sf(t,a,o);for(g=0;g<o;++g){const E=i[g];_=E.attributes;for(let z=0;z<s;++z){p=r[z],y=_[p];const R=_q(y.value),F=c[p];T.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,O=mq;O.x=U.floatToByte(P.red),O.y=U.floatToByte(P.green),O.z=U.floatToByte(P.blue),O.w=U.floatToByte(P.alpha),T.setBatchedAttribute(g,C-1,O)}e._batchTable=T,e._batchTableAttributeIndices=c,e._batchTableBoundingSphereAttributeIndices=u,e._batchTableOffsetAttribute2DIndex=f}function cwe(e){let t;return Array.isArray(e.values)?t=e.values.slice(0):t=new e.values.constructor(e.values),new ze({componentDatatype:e.componentDatatype,componentsPerAttribute:e.componentsPerAttribute,normalize:e.normalize,values:t})}function lwe(e){const t=e.attributes,n=new Ui;for(const o in t)t.hasOwnProperty(o)&&l(t[o])&&(n[o]=cwe(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 Dt({attributes:n,indices:i,primitiveType:e.primitiveType,boundingSphere:fe.clone(e.boundingSphere)})}function uwe(e,t){return{geometry:t,attributes:e.attributes,modelMatrix:B.clone(e.modelMatrix),pickPrimitive:e.pickPrimitive,id:e.id}}const fwe=/attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;Wt._modifyShaderPosition=function(e,t,n){let i,o="",r="",s="";for(;(i=fwe.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(`
`)};Wt._appendShowToShader=function(e,t){return l(e._batchTableAttributeIndices.show)?`${Ge.replaceMain(t,"czm_non_show_main")}
void main()
{
czm_non_show_main();
gl_Position *= czm_batchTable_show(batchId);
}`:t};Wt._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 QU(e){return`${Ge.replaceMain(e,"czm_non_pick_main")}
varying vec4 v_pickColor;
void main()
{
czm_non_pick_main();
v_pickColor = czm_batchTable_pickColor(batchId);
}`}function ZU(e){return`varying vec4 v_pickColor;
${e}`}Wt._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};Wt._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};Wt._appendDistanceDisplayConditionToShader=function(e,t,n){if(!l(e._batchTableAttributeIndices.distanceDisplayCondition))return t;const i=Ge.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 eH(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 f="",h="";if(i){f+=`vec2 st;
`;const p=s>1?`${c}.x`:c;h+=` st = czm_decompressTextureCoordinates(${p});
`}n&&o&&r?(f+=`vec3 normal;
vec3 tangent;
vec3 bitangent;
`,h+=` czm_octDecode(${c}.${i?"yz":"xy"}, normal, tangent, bitangent);
`):(n&&(f+=`vec3 normal;
`,h+=` normal = czm_octDecode(${c}${s>1?`.${i?"y":"x"}`:""});
`),o&&(f+=`vec3 tangent;
`,h+=` tangent = czm_octDecode(${c}.${i&&n?"z":"y"});
`),r&&(f+=`vec3 bitangent;
`,h+=` bitangent = czm_octDecode(${c}.${i&&n?"z":"y"});
`));let _=t;_=_.replace(/attribute\s+vec3\s+normal;/g,""),_=_.replace(/attribute\s+vec2\s+st;/g,""),_=_.replace(/attribute\s+vec3\s+tangent;/g,""),_=_.replace(/attribute\s+vec3\s+bitangent;/g,""),_=Ge.replaceMain(_,"czm_non_compressed_main");const g=`void main()
{
${h} czm_non_compressed_main();
}`;return[u,f,_,g].join(`
`)}function dwe(e){let t=Ge.replaceMain(e,"czm_non_depth_clamp_main");return t+=`void main() {
czm_non_depth_clamp_main();
gl_Position = czm_depthClamp(gl_Position);}
`,t}function hwe(e){let t=Ge.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 tH(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 pwe(e,t){return function(){return e[t]}}const iP=Math.max(un.hardwareConcurrency-1,1);let TE;const mwe=new vi("combineGeometry");function _we(e,t){let n,i,o,r;const s=e._instanceIds;if(e._state===gr.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(TE))for(TE=new Array(iP),o=0;o<iP;o++)TE[o]=new vi("createGeometry");let f;for(u=Rxe(u,iP),o=0;o<u.length;o++){let h=0;const _=u[o],g=_.length;for(r=0;r<g;++r)f=_[r],i=f.geometry,l(i.constructor.pack)&&(f.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)f=_[r],i=f.geometry,l(i.constructor.pack)&&(i.constructor.pack(i,y,f.offset),f.geometry=y)}c.push(TE[o].scheduleTask({subTasks:u[o]},p))}e._state=gr.CREATING,Promise.all(c).then(function(h){e._createGeometryResults=h,e._state=gr.CREATED}).catch(function(h){aC(e,t,gr.FAILED,h)})}else if(e._state===gr.CREATED){const a=[];n=Array.isArray(e.geometryInstances)?e.geometryInstances:[e.geometryInstances];const c=t.scene3DOnly,u=t.mapProjection,f=mwe.scheduleTask(zL.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=gr.COMBINING,Promise.resolve(f).then(function(h){const _=zL.unpackCombineGeometryResults(h);e._geometries=_.geometries,e._attributeLocations=_.attributeLocations,e.modelMatrix=B.clone(_.modelMatrix,e.modelMatrix),e._pickOffsets=_.pickOffsets,e._offsetInstanceExtend=_.offsetInstanceExtend,e._instanceBoundingSpheres=_.boundingSpheres,e._instanceBoundingSpheresCV=_.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=gr.COMBINED):aC(e,t,gr.FAILED,void 0)}).catch(function(h){aC(e,t,gr.FAILED,h)})}}function gwe(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 _=s.geometry;let g;l(_.attributes)&&l(_.primitiveType)?g=lwe(_):g=_.constructor.createGeometry(_),o[c++]=uwe(s,g),r.push(s.id)}o.length=c;const u=t.scene3DOnly,f=t.mapProjection,h=zL.combineGeometry({instances:o,ellipsoid:f.ellipsoid,projection:f,elementIndexUintSupported:t.context.elementIndexUint,scene3DOnly:u,vertexCacheOptimize:e.vertexCacheOptimize,compressVertices:e.compressVertices,modelMatrix:e.modelMatrix,createPickOffsets:e._createPickOffsets});e._geometries=h.geometries,e._attributeLocations=h.attributeLocations,e.modelMatrix=B.clone(h.modelMatrix,e.modelMatrix),e._pickOffsets=h.pickOffsets,e._offsetInstanceExtend=h.offsetInstanceExtend,e._instanceBoundingSpheres=h.boundingSpheres,e._instanceBoundingSpheresCV=h.boundingSpheresCV,l(e._geometries)&&e._geometries.length>0?(e._recomputeBoundingSpheres=!0,e._state=gr.COMBINED):aC(e,t,gr.FAILED,void 0)}function ywe(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 C=e._batchTable.getBatchedAttribute(i,n,new d);y=r[i].clone(y),Cq(y,C,o[i])}const c=[],u=[],f=[];for(i=0;i<s;++i){const y=a[i];y.center.x-y.radius>0||fe.intersectPlane(y,St.ORIGIN_ZX_PLANE)!==mn.INTERSECTING?c.push(y):(u.push(y),f.push(y))}let h=c[0],_=f[0],g=u[0];for(i=1;i<c.length;i++)h=fe.union(h,c[i]);for(i=1;i<f.length;i++)_=fe.union(_,f[i]);for(i=1;i<u.length;i++)g=fe.union(g,u[i]);const p=[];for(l(h)&&p.push(h),l(_)&&p.push(_),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])}Wt._updateBoundingVolumes(e,t,e.modelMatrix,!0),e._recomputeBoundingSpheres=!1}const nH=new wn,gq=new Ae,yq=new d,Aq=new fe;function Awe(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,f=u.ellipsoid,h=e._batchTable,_=e._instanceBoundingSpheres,g=_.length;for(let p=0;p<g;++p){let y=_[p];if(!l(y))continue;const C=e.modelMatrix;l(C)&&(y=fe.transform(y,C,Aq));const T=y.center,E=y.radius;let w=wn.fromCartesian(T,nH);if(h.setBatchedAttribute(p,o,w.high),h.setBatchedAttribute(p,r,w.low),!t.scene3DOnly){const S=f.cartesianToCartographic(T,gq),P=u.project(S,yq);w=wn.fromCartesian(P,nH),h.setBatchedAttribute(p,s,w.high),h.setBatchedAttribute(p,a,w.low)}h.setBatchedAttribute(p,c,E)}e._batchTableBoundingSpheresUpdated=!0}const oP=new d,Cwe=new d;function iH(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 f=a[u];if(!l(f))continue;const h=s.getBatchedAttribute(u,e._batchTableAttributeIndices.offset);if(d.equals(h,d.ZERO)){s.setBatchedAttribute(u,i,d.ZERO);continue}const _=e.modelMatrix;l(_)&&(f=fe.transform(f,_,Aq));let g=f.center;g=r.scaleToGeodeticSurface(g,Cwe);let p=r.cartesianToCartographic(g,gq);const y=o.project(p,yq),C=d.add(h,g,oP);p=r.cartesianToCartographic(C,p);const T=o.project(p,oP),E=d.subtract(T,y,oP),w=E.x;E.x=E.z,E.z=E.y,E.y=w,s.setBatchedAttribute(u,i,E)}e._batchTableOffsetsUpdated=!0}function Twe(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(to.fromGeometry({context:r,geometry:u,attributeLocations:n,bufferUsage:Ze.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 f=u.boundingSphereCV.center,h=f.x,_=f.y,g=f.z;f.x=g,f.y=h,f.z=_,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,aC(e,t,gr.COMPLETE,void 0)}function bwe(e,t,n,i){let o=n.getRenderState(),r;i?(r=ut(o,!1),r.cull={enabled:!0,face:Po.BACK},e._frontFaceRS=Qe.fromCache(r),r.cull.face=Po.FRONT,e._backFaceRS=Qe.fromCache(r)):(e._frontFaceRS=Qe.fromCache(o),e._backFaceRS=e._frontFaceRS),r=ut(o,!1),l(e._depthFailAppearance)&&(r.depthTest.enabled=!1),l(e._depthFailAppearance)&&(o=e._depthFailAppearance.getRenderState(),r=ut(o,!1),r.depthTest.func=Jm.GREATER,i?(r.cull={enabled:!0,face:Po.BACK},e._frontFaceDepthFailRS=Qe.fromCache(r),r.cull.face=Po.FRONT,e._backFaceDepthFailRS=Qe.fromCache(r)):(e._frontFaceDepthFailRS=Qe.fromCache(r),e._backFaceDepthFailRS=e._frontFaceRS))}function Ewe(e,t,n){const i=t.context,o=e._attributeLocations;let r=e._batchTable.getVertexShaderCallback()(n.vertexShaderSource);r=Wt._appendOffsetToShader(e,r),r=Wt._appendShowToShader(e,r),r=Wt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=QU(r),r=Wt._updateColorAttribute(e,r,!1),r=eH(e,r),r=Wt._modifyShaderPosition(e,r,t.scene3DOnly);let s=n.getFragmentShaderSource();s=ZU(s),e._sp=hn.replaceCache({context:i,shaderProgram:e._sp,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),tH(e._sp,o),l(e._depthFailAppearance)&&(r=e._batchTable.getVertexShaderCallback()(e._depthFailAppearance.vertexShaderSource),r=Wt._appendShowToShader(e,r),r=Wt._appendDistanceDisplayConditionToShader(e,r,t.scene3DOnly),r=QU(r),r=Wt._updateColorAttribute(e,r,!0),r=eH(e,r),r=Wt._modifyShaderPosition(e,r,t.scene3DOnly),r=dwe(r),s=e._depthFailAppearance.getFragmentShaderSource(),s=ZU(s),s=hwe(s),e._spDepthFail=hn.replaceCache({context:i,shaderProgram:e._spDepthFail,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o}),tH(e._spDepthFail,o))}const k0=new B,oH=new d;function rH(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]=pwe(s,c)}}let a=sn(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,k0),B.multiplyByPoint(k0,e.rtcCenter,oH),B.setTranslation(k0,oH,k0),k0}),a}function xwe(e,t,n,i,o,r,s,a){const c=rH(e,t,n,a);let u;l(e._depthFailAppearance)&&(u=rH(e,e._depthFailAppearance,e._depthFailAppearance.material,a));const f=i?Be.TRANSLUCENT:Be.OPAQUE;let h=o?2:1;h*=l(e._depthFailAppearance)?2:1,r.length=e._va.length*h;const _=r.length;let g=0;for(let p=0;p<_;++p){let y;o&&(y=r[p],l(y)||(y=r[p]=new dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=f,++p),y=r[p],l(y)||(y=r[p]=new dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceRS,y.shaderProgram=e._sp,y.uniformMap=c,y.pass=f,l(e._depthFailAppearance)&&(o&&(++p,y=r[p],l(y)||(y=r[p]=new dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._backFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++p,y=r[p],l(y)||(y=r[p]=new dt({owner:e,primitiveType:e._primitiveType})),y.vertexArray=e._va[g],y.renderState=e._frontFaceDepthFailRS,y.shaderProgram=e._spDepthFail,y.uniformMap=u,y.pass=f),++g}}Wt._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],f=t.camera.getPixelSize(s,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*a;c.radius=s.radius+f}};function wwe(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.");Wt._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,f=t.passes;if(f.render||f.pick){const h=e.allowPicking,_=Co.castShadows(e.shadows),g=Co.receiveShadows(e.shadows),p=n.length;let y=a?2:1;y*=l(e._depthFailAppearance)?2:1;for(let C=0;C<p;++C){const T=Math.floor(C/y),E=n[C];E.modelMatrix=o,E.boundingVolume=c[T],E.cull=r,E.debugShowBoundingVolume=s,E.castShadows=_,E.receiveShadows=g,h?E.pickId="v_pickColor":E.pickId=void 0,u.push(E)}}}Wt.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===gr.FAILED)return;const t=e.context;if(l(this._batchTable)||awe(this,t),this._batchTable.attributes.length>0){if(wt.maximumVertexTextureImageUnits===0)throw new Se("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!==gr.COMPLETE&&this._state!==gr.COMBINED&&(this.asynchronous?_we(this,e):gwe(this,e)),this._state===gr.COMBINED&&(Awe(this,e),iH(this,e),Twe(this,e)),!this.show||this._state!==gr.COMPLETE)return;this._batchTableOffsetsUpdated||iH(this,e),this._recomputeBoundingSpheres&&ywe(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,bwe)(this,t,n,u),r&&A(this._createShaderProgramFunction,Ewe)(this,e,n),(o||r)&&A(this._createCommandsFunction,xwe)(this,n,i,c,u,this._colorCommands,this._pickCommands,e),A(this._updateAndQueueCommandsFunction,wwe)(this,e,this._colorCommands,this._pickCommands,this.modelMatrix,this.cull,this.debugShowBoundingVolume,u)};const Swe=new fe,vwe=new fe;function Cq(e,t,n){if(n===fn.TOP){const i=fe.clone(e,Swe),o=fe.clone(e,vwe);o.center=d.add(o.center,t,o.center),e=fe.union(i,o,e)}else n===fn.ALL&&(e.center=d.add(e.center,t,e.center));return e}function Dwe(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 Iwe(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=_q(r);e.setBatchedAttribute(t,n,s),o==="offset"&&(i._recomputeBoundingSpheres=!0,i._batchTableOffsetsUpdated=!1)}}const Pwe=new d;function Owe(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)&&Cq(i,d.fromArray(r.get(),0,Pwe),e._offsetInstanceExtend[n]),l(o)&&(i=fe.transform(i,o))}return i}},t.boundingSphereCV={get:function(){return e._instanceBoundingSpheresCV[n]}}}function Lwe(e,t,n){t.pickId={get:function(){return e._pickIds[n]}}}Wt.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 f=(n+u)%o;if(e===i[f]){t=f;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 f=a[u];c[u]={get:Dwe(s,t,f),set:Iwe(s,t,f,this,u)}}return Owe(this,c,t),Lwe(this,c,t),Object.defineProperties(r,c),this._lastPerInstanceAttributeIndex=t,this._perInstanceAttributeCache[t]=r,r};Wt.prototype.isDestroyed=function(){return!1};Wt.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,Ue(this)};function aC(e,t,n,i){e._completeLoad(t,n,i)}function af(){this._array=[],this._offset=0,this._length=0}Object.defineProperties(af.prototype,{length:{get:function(){return this._length}}});af.prototype.enqueue=function(e){this._array.push(e),this._length++};af.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};af.prototype.peek=function(){if(this._length!==0)return this._array[this._offset]};af.prototype.contains=function(e){return this._array.indexOf(e)!==-1};af.prototype.clear=function(){this._array.length=this._offset=this._length=0};af.prototype.sort=function(e){this._offset>0&&(this._array=this._array.slice(this._offset),this._offset=0),this._array.sort(e)};const Bwe={WEST:0,NORTH:1,EAST:2,SOUTH:3,NORTHWEST:4,NORTHEAST:5,SOUTHWEST:6,SOUTHEAST:7},qt=Bwe,Tq={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>=Tq.RENDERED_AND_KICKED},originalResult:function(e){return e&3},kick:function(e){return e|4}},qn=Tq;function S_(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}S_.prototype.update=function(e,t,n){this.changedThisFrame&&(bq(e,t,this.tile,n),this.changedThisFrame=!1)};S_.prototype.destroy=function(e){this._destroyVertexArray(e),l(this.waterMaskTexture)&&(--this.waterMaskTexture.referenceCount,this.waterMaskTexture.referenceCount===0&&this.waterMaskTexture.destroy(),this.waterMaskTexture=void 0)};S_.prototype._destroyVertexArray=function(e){l(this.vertexArray)&&(l(e)?e.push(this.vertexArray):bi._freeVertexArray(this.vertexArray),this.vertexArray=void 0)};const Rwe=new af;S_.updateFillTiles=function(e,t,n,i){const o=e._quadtree,r=o._levelZeroTiles,s=o._lastSelectionFrameNumber,a=Rwe;a.clear();for(let u=0;u<t.length;++u){const f=t[u];l(f.data.vertexArray)&&a.enqueue(t[u])}let c=a.dequeue();for(;c!==void 0;){const u=c.findTileToWest(r),f=c.findTileToSouth(r),h=c.findTileToEast(r),_=c.findTileToNorth(r);pr(e,n,c,u,s,qt.EAST,!1,a,i),pr(e,n,c,f,s,qt.NORTH,!1,a,i),pr(e,n,c,h,s,qt.WEST,!1,a,i),pr(e,n,c,_,s,qt.SOUTH,!1,a,i);const g=u.findTileToNorth(r),p=u.findTileToSouth(r),y=h.findTileToNorth(r),C=h.findTileToSouth(r);pr(e,n,c,g,s,qt.SOUTHEAST,!1,a,i),pr(e,n,c,y,s,qt.SOUTHWEST,!1,a,i),pr(e,n,c,p,s,qt.NORTHEAST,!1,a,i),pr(e,n,c,C,s,qt.NORTHWEST,!1,a,i),c=a.dequeue()}};function pr(e,t,n,i,o,r,s,a,c){if(i===void 0)return;let u=i;for(;u&&(u._lastSelectionResultFrame!==o||qn.wasKicked(u._lastSelectionResult)||qn.originalResult(u._lastSelectionResult)===qn.CULLED);){if(s)return;const f=u.parent;if(r>=qt.NORTHWEST&&f!==void 0)switch(r){case qt.NORTHWEST:u=u===f.northwestChild?f:void 0;break;case qt.NORTHEAST:u=u===f.northeastChild?f:void 0;break;case qt.SOUTHWEST:u=u===f.southwestChild?f:void 0;break;case qt.SOUTHEAST:u=u===f.southeastChild?f:void 0;break}else u=f}if(u!==void 0){if(u._lastSelectionResult===qn.RENDERED){if(l(u.data.vertexArray))return;Nwe(e,t,n,u,r,o,a,c);return}if(qn.originalResult(i._lastSelectionResult)!==qn.CULLED)switch(r){case qt.WEST:pr(e,t,n,i.northwestChild,o,r,!0,a,c),pr(e,t,n,i.southwestChild,o,r,!0,a,c);break;case qt.EAST:pr(e,t,n,i.southeastChild,o,r,!0,a,c),pr(e,t,n,i.northeastChild,o,r,!0,a,c);break;case qt.SOUTH:pr(e,t,n,i.southwestChild,o,r,!0,a,c),pr(e,t,n,i.southeastChild,o,r,!0,a,c);break;case qt.NORTH:pr(e,t,n,i.northeastChild,o,r,!0,a,c),pr(e,t,n,i.northwestChild,o,r,!0,a,c);break;case qt.NORTHWEST:pr(e,t,n,i.northwestChild,o,r,!0,a,c);break;case qt.NORTHEAST:pr(e,t,n,i.northeastChild,o,r,!0,a,c);break;case qt.SOUTHWEST:pr(e,t,n,i.southwestChild,o,r,!0,a,c);break;case qt.SOUTHEAST:pr(e,t,n,i.southeastChild,o,r,!0,a,c);break;default:throw new x("Invalid edge")}}}function Nwe(e,t,n,i,o,r,s,a){const c=i.data;if(c.fill===void 0)c.fill=new S_(i);else if(c.fill.visitedFrame===r)return;c.fill.enqueuedFrame!==r&&(c.fill.enqueuedFrame=r,c.fill.changedThisFrame=!1,s.enqueue(i)),Mwe(e,t,n,i,o,a)}function Mwe(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&&(bq(e,t,n,r),c.changedThisFrame=!1),a=n.data.fill.mesh):a=n.data.mesh;let u,f;switch(o){case qt.WEST:u=s.westMeshes,f=s.westTiles;break;case qt.SOUTH:u=s.southMeshes,f=s.southTiles;break;case qt.EAST:u=s.eastMeshes,f=s.eastTiles;break;case qt.NORTH:u=s.northMeshes,f=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,f[0]=n,u.length=1,f.length=1;return}let h,_,g,p;const y=n.rectangle;let C;const T=i.rectangle;switch(o){case qt.WEST:for(C=(T.north-T.south)*N.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!N.greaterThan(y.north,p.south,C));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!N.greaterThanOrEquals(y.south,p.north,C));++_);break;case qt.SOUTH:for(C=(T.east-T.west)*N.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!N.lessThan(y.west,p.east,C));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!N.lessThanOrEquals(y.east,p.west,C));++_);break;case qt.EAST:for(C=(T.north-T.south)*N.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!N.lessThan(y.south,p.north,C));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!N.lessThanOrEquals(y.north,p.south,C));++_);break;case qt.NORTH:for(C=(T.east-T.west)*N.EPSILON5,h=0;h<f.length&&(g=f[h],p=g.rectangle,!N.greaterThan(y.east,p.west,C));++h);for(_=h;_<f.length&&(g=f[_],p=g.rectangle,!N.greaterThanOrEquals(y.west,p.east,C));++_);break}_-h===1?(s.changedThisFrame=s.changedThisFrame||u[h]!==a,u[h]=a,f[h]=n):(s.changedThisFrame=!0,u.splice(h,_-h,a),f.splice(h,_-h,n))}const Dm=new Ae,Fwe=new Ae,cy=new d,JN=new d,UL=new j,HL=new j,ja=new j;function Iv(){this.height=0,this.encodedNormal=new j}function bE(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 _=0,g=0;l(h)&&(_=h.minimumHeight,g=h.maximumHeight),u=(_+g)*.5}return Eq(e,t,n,i,u,c),c}const zwe={minimumHeight:0,maximumHeight:0},Uwe=new d,sH=new Iv,aH=new Iv,cH=new Iv,lH=new Iv,Hwe=typeof Uint8Array<"u"?new Uint8Array(9*9):void 0,Vwe={tilingScheme:void 0,x:0,y:0,level:0,exaggeration:1,exaggerationRelativeHeight:0};function bq(e,t,n,i){bi.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,f=n.tilingScheme.ellipsoid;let h=xE(r,f,0,1,r.northwestTile,r.northwestMesh,r.northTiles,r.northMeshes,r.westTiles,r.westMeshes,cH),_=xE(r,f,0,0,r.southwestTile,r.southwestMesh,r.westTiles,r.westMeshes,r.southTiles,r.southMeshes,sH),g=xE(r,f,1,0,r.southeastTile,r.southeastMesh,r.southTiles,r.southMeshes,r.eastTiles,r.eastMeshes,aH),p=xE(r,f,1,1,r.northeastTile,r.northeastMesh,r.eastTiles,r.eastMeshes,r.northTiles,r.northMeshes,lH);h=bE(r,f,0,1,h,_,p,g,cH),_=bE(r,f,0,0,_,h,g,p,sH),g=bE(r,f,1,1,g,_,p,h,aH),p=bE(r,f,1,1,p,g,h,_,lH);const y=_.height,C=g.height,T=h.height,E=p.height;let w=Math.min(y,C,T,E),S=Math.max(y,C,T,E);const P=(w+S)*.5;let O,z;const R=e.getLevelMaximumGeometricError(n.level),F=f.maximumRadius-R;let H=Math.acos(F/f.maximumRadius)*4;if(H*=1.5,s.width>H&&S-w<=R){const m=new $l({width:9,height:9,buffer:Hwe,structure:{heightOffset:S}}),D=Vwe;D.tilingScheme=n.tilingScheme,D.x=n.x,D.y=n.y,D.level=n.level,D.exaggeration=a,D.exaggerationRelativeHeight=c,r.mesh=m._createMeshSync(D)}else{const m=u,D=_e.center(s,Fwe);D.height=P;const L=f.cartographicToCartesian(D,Uwe),M=new ur(L,void 0,void 0,void 0,void 0,!0,!0,m,a,c);let V=5,k;for(k=r.westMeshes,O=0,z=k.length;O<z;++O)V+=k[O].eastIndicesNorthToSouth.length;for(k=r.southMeshes,O=0,z=k.length;O<z;++O)V+=k[O].northIndicesWestToEast.length;for(k=r.eastMeshes,O=0,z=k.length;O<z;++O)V+=k[O].westIndicesSouthToNorth.length;for(k=r.northMeshes,O=0,z=k.length;O<z;++O)V+=k[O].southIndicesEastToWest.length;const W=zwe;W.minimumHeight=w,W.maximumHeight=S;const G=M.stride;let K=new Float32Array(V*G),q=0;const te=q;q=EE(f,s,M,K,q,0,1,h.height,h.encodedNormal,1,W),q=SE(r,f,M,K,q,r.westTiles,r.westMeshes,qt.EAST,W);const $=q;q=EE(f,s,M,K,q,0,0,_.height,_.encodedNormal,0,W),q=SE(r,f,M,K,q,r.southTiles,r.southMeshes,qt.NORTH,W);const X=q;q=EE(f,s,M,K,q,1,0,g.height,g.encodedNormal,0,W),q=SE(r,f,M,K,q,r.eastTiles,r.eastMeshes,qt.WEST,W);const Y=q;q=EE(f,s,M,K,q,1,1,p.height,p.encodedNormal,1,W),q=SE(r,f,M,K,q,r.northTiles,r.northMeshes,qt.SOUTH,W),w=W.minimumHeight,S=W.maximumHeight;const ae=Bt.fromRectangle(s,w,S,n.tilingScheme.ellipsoid),ue=Zn.geodeticLatitudeToMercatorAngle(s.south),re=1/(Zn.geodeticLatitudeToMercatorAngle(s.north)-ue),he=(Zn.geodeticLatitudeToMercatorAngle(D.latitude)-ue)*re,ce=f.geodeticSurfaceNormalCartographic(Dm,JN),Q=oi.octEncode(ce,UL),ie=q;M.encode(K,q*G,ae.center,j.fromElements(.5,.5,ja),P,Q,he,ce),++q;const de=q,me=de<256?1:2,Ee=(de-1)*3,xe=Ee*me,Pe=(K.length-de*G)*Float32Array.BYTES_PER_ELEMENT;let Te;if(Pe>=xe){const Ve=de*G*Float32Array.BYTES_PER_ELEMENT;Te=de<256?new Uint8Array(K.buffer,Ve,Ee):new Uint16Array(K.buffer,Ve,Ee)}else Te=de<256?new Uint8Array(Ee):new Uint16Array(Ee);K=new Float32Array(K.buffer,0,de*G);let Oe=0;for(O=0;O<de-2;++O)Te[Oe++]=ie,Te[Oe++]=O,Te[Oe++]=O+1;Te[Oe++]=ie,Te[Oe++]=O,Te[Oe++]=0;const De=[];for(O=$;O>=te;--O)De.push(O);const Me=[];for(O=X;O>=$;--O)Me.push(O);const ve=[];for(O=Y;O>=X;--O)ve.push(O);const Ie=[];for(Ie.push(0),O=ie-1;O>=Y;--O)Ie.push(O);r.mesh=new vv(M.center,K,Te,Ee,de,w,S,fe.fromOrientedBoundingBox(ae),$we(e,ae.center,s,w,S),M.stride,ae,M,De,Me,ve,Ie)}const v=t.context;r._destroyVertexArray(i),r.vertexArray=bi._createVertexArrayForMesh(v,r.mesh),o.processImagery(n,e.terrainProvider,t,!0);const I=r.waterMaskTexture;if(r.waterMaskTexture=void 0,e.terrainProvider.hasWaterMask){const m=o._findAncestorTileWithTerrainData(n);l(m)&&l(m.data.waterMaskTexture)&&(r.waterMaskTexture=m.data.waterMaskTexture,++r.waterMaskTexture.referenceCount,o._computeWaterMaskTranslationAndScale(n,m,r.waterMaskTranslationAndScale))}l(I)&&(--I.referenceCount,I.referenceCount===0&&I.destroy())}function EE(e,t,n,i,o,r,s,a,c,u,f){const h=Dm;h.longitude=N.lerp(t.west,t.east,r),h.latitude=N.lerp(t.south,t.north,s),h.height=a;const _=e.cartographicToCartesian(h,cy);let g;n.hasGeodeticSurfaceNormals&&(g=e.geodeticSurfaceNormal(_,JN));const p=HL;return p.x=r,p.y=s,n.encode(i,o*n.stride,_,p,a,c,u,g),f.minimumHeight=Math.min(f.minimumHeight,a),f.maximumHeight=Math.max(f.maximumHeight,a),o+1}const mS=new _e;function UC(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=_e.clone(e.rectangle,mS),o.west-=N.TWO_PI,o.east-=N.TWO_PI):e.x===0&&n.x===0&&t.x===t.tilingScheme.getNumberOfXTilesAtLevel(t.level)-1&&(o=_e.clone(e.rectangle,mS),o.west+=N.TWO_PI,o.east+=N.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,f=(r.south-o.south)/u,h=(r.north-o.south)/u;let _=(n.x-a)/(c-a),g=(n.y-f)/(h-f);return Math.abs(_)<Math.EPSILON5?_=0:Math.abs(_-1)<Math.EPSILON5&&(_=1),Math.abs(g)<Math.EPSILON5?g=0:Math.abs(g-1)<Math.EPSILON5&&(g=1),i.x=_,i.y=g,i}const kwe=new j;function VL(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 Gwe=new j,Wwe=new d;function jwe(e,t,n,i,o,r,s,a,c,u){const f=i.encoding,h=i.vertices,_=UC(t,n,f.decodeTextureCoordinates(h,o,ja),ja),g=UC(t,n,f.decodeTextureCoordinates(h,r,HL),HL);let p;c?p=(s-_.x)/(g.x-_.x):p=(a-_.y)/(g.y-_.y);const y=f.decodeHeight(h,o),C=f.decodeHeight(h,r),T=n.rectangle;Dm.longitude=N.lerp(T.west,T.east,s),Dm.latitude=N.lerp(T.south,T.north,a),u.height=Dm.height=N.lerp(y,C,p);let E;if(f.hasVertexNormals){const w=f.getOctEncodedNormal(h,o,kwe),S=f.getOctEncodedNormal(h,r,Gwe),P=oi.octDecode(w.x,w.y,cy),O=oi.octDecode(S.x,S.y,Wwe);E=d.lerp(P,O,p,cy),d.normalize(E,E),oi.octEncode(E,u.encodedNormal)}else E=e.geodeticSurfaceNormalCartographic(Dm,cy),oi.octEncode(E,u.encodedNormal)}function Eq(e,t,n,i,o,r){r.height=o;const s=t.geodeticSurfaceNormalCartographic(Dm,cy);oi.octEncode(s,r.encodedNormal)}function xE(e,t,n,i,o,r,s,a,c,u,f){if(fH(e,t,a,s,!1,n,i,f)||fH(e,t,u,c,!0,n,i,f))return f;let _;if(QN(o,r))return n===0?i===0?_=r.eastIndicesNorthToSouth[0]:_=r.southIndicesEastToWest[0]:i===0?_=r.northIndicesWestToEast[0]:_=r.westIndicesSouthToNorth[0],VL(r,_,n,i,f),f;let g;if(n===0?i===0?g=wE(e.westMeshes,e.westTiles,qt.EAST,e.southMeshes,e.southTiles,qt.NORTH):g=wE(e.northMeshes,e.northTiles,qt.SOUTH,e.westMeshes,e.westTiles,qt.EAST):i===0?g=wE(e.southMeshes,e.southTiles,qt.NORTH,e.eastMeshes,e.eastTiles,qt.WEST):g=wE(e.eastMeshes,e.eastTiles,qt.WEST,e.northMeshes,e.northTiles,qt.SOUTH),l(g))return Eq(e,t,n,i,g,f),f}function wE(e,t,n,i,o,r,s,a){const c=uH(e,t,!1,n),u=uH(i,o,!0,r);return l(c)&&l(u)?(c+u)*.5:l(c)?c:u}function SE(e,t,n,i,o,r,s,a,c){for(let u=0;u<r.length;++u)o=qwe(e,t,n,i,o,r[u],s[u],a,c);return o}function qwe(e,t,n,i,o,r,s,a,c){let u=r.rectangle;a===qt.EAST&&e.tile.x===0?(u=_e.clone(r.rectangle,mS),u.west-=N.TWO_PI,u.east-=N.TWO_PI):a===qt.WEST&&r.x===0&&(u=_e.clone(r.rectangle,mS),u.west+=N.TWO_PI,u.east+=N.TWO_PI);const f=e.tile.rectangle;let h,_;o>0&&(n.decodeTextureCoordinates(i,o-1,ja),h=ja.x,_=ja.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,C=e.tile,T=s.encoding,E=s.vertices,w=n.stride;let S,P;T.hasWebMercatorT&&(S=Zn.geodeticLatitudeToMercatorAngle(f.south),P=1/(Zn.geodeticLatitudeToMercatorAngle(f.north)-S));for(let O=0;O<g.length;++O){const z=g[O],R=T.decodeTextureCoordinates(E,z,ja);UC(y,C,R,R);const F=R.x,H=R.y,v=p?F:H;if(v<0||v>1||Math.abs(F-h)<N.EPSILON5&&Math.abs(H-_)<N.EPSILON5)continue;const I=Math.abs(F)<N.EPSILON5||Math.abs(F-1)<N.EPSILON5,m=Math.abs(H)<N.EPSILON5||Math.abs(H-1)<N.EPSILON5;if(I&&m)continue;const D=T.decodePosition(E,z,cy),L=T.decodeHeight(E,z);let M;T.hasVertexNormals?M=T.getOctEncodedNormal(E,z,UL):(M=UL,M.x=0,M.y=0);let V=H;if(T.hasWebMercatorT){const W=N.lerp(f.south,f.north,H);V=(Zn.geodeticLatitudeToMercatorAngle(W)-S)*P}let k;n.hasGeodeticSurfaceNormals&&(k=t.geodeticSurfaceNormal(D,JN)),n.encode(i,o*w,D,R,L,M,V,k),c.minimumHeight=Math.min(c.minimumHeight,L),c.maximumHeight=Math.max(c.maximumHeight,L),++o}return o}function uH(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 f=e[u],h=t[u];if(!QN(h,f))continue;let _;switch(i){case qt.WEST:_=f.westIndicesSouthToNorth;break;case qt.SOUTH:_=f.southIndicesEastToWest;break;case qt.EAST:_=f.eastIndicesNorthToSouth;break;case qt.NORTH:_=f.northIndicesWestToEast;break}const g=_[n?0:_.length-1];if(l(g))return f.encoding.decodeHeight(f.vertices,g)}}function QN(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,f,h,_;const g=i[o?0:n.length-1],p=n[o?0:n.length-1];if(QN(g,p)&&(r===0?s===0?(c=o?p.northIndicesWestToEast:p.eastIndicesNorthToSouth,u=o,f=o):(c=o?p.eastIndicesNorthToSouth:p.southIndicesEastToWest,u=!o,f=!1):s===0?(c=o?p.westIndicesSouthToNorth:p.northIndicesWestToEast,u=!o,f=!0):(c=o?p.southIndicesEastToWest:p.westIndicesSouthToNorth,u=o,f=!o),c.length>0)){h=o?0:c.length-1,_=c[h],p.encoding.decodeTextureCoordinates(p.vertices,_,ja);const y=UC(g,e.tile,ja,ja);if(y.x===r&&y.y===s)return VL(p,_,r,s,a),!0;if(h=Cs(c,u?r:s,function(C,T){p.encoding.decodeTextureCoordinates(p.vertices,C,ja);const E=UC(g,e.tile,ja,ja);return f?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 jwe(t,g,e.tile,p,c[h-1],c[h],r,s,u,a),!0}else return VL(p,c[h],r,s,a),!0}return!1}const Ywe=[new d,new d,new d,new d];function $we(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=Ywe;return d.fromRadians(n.west,n.south,o,a,c[0]),d.fromRadians(n.east,n.south,o,a,c[1]),d.fromRadians(n.west,n.north,o,a,c[2]),d.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}var _S={},Xwe={get exports(){return _S},set exports(e){_S=e}};Xwe.exports=Pv;_S.default=Pv;function Pv(e,t,n){n=n||2;var i=t&&t.length,o=i?t[0]*n:e.length,r=xq(e,0,o,n,!0),s=[];if(!r||r.next===r.prev)return s;var a,c,u,f,h,_,g;if(i&&(r=eSe(e,t,r,n)),e.length>80*n){a=u=e[0],c=f=e[1];for(var p=n;p<o;p+=n)h=e[p],_=e[p+1],h<a&&(a=h),_<c&&(c=_),h>u&&(u=h),_>f&&(f=_);g=Math.max(u-a,f-c),g=g!==0?32767/g:0}return HC(r,s,n,a,c,g,0),s}function xq(e,t,n,i,o){var r,s;if(o===WL(e,t,n,i)>0)for(r=t;r<n;r+=i)s=dH(r,e[r],e[r+1],s);else for(r=n-i;r>=t;r-=i)s=dH(r,e[r],e[r+1],s);return s&&Ov(s,s.next)&&(kC(s),s=s.next),s}function Zm(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(Ov(n,n.next)||Uo(n.prev,n,n.next)===0)){if(kC(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function HC(e,t,n,i,o,r,s){if(e){!s&&r&&rSe(e,i,o,r);for(var a=e,c,u;e.prev!==e.next;){if(c=e.prev,u=e.next,r?Jwe(e,i,o,r):Kwe(e)){t.push(c.i/n|0),t.push(e.i/n|0),t.push(u.i/n|0),kC(e),e=u.next,a=u.next;continue}if(e=u,e===a){s?s===1?(e=Qwe(Zm(e),t,n),HC(e,t,n,i,o,r,2)):s===2&&Zwe(e,t,n,i,o,r):HC(Zm(e),t,n,i,o,r,1);break}}}}function Kwe(e){var t=e.prev,n=e,i=e.next;if(Uo(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,f=o<r?o<s?o:s:r<s?r:s,h=a<c?a<u?a:u:c<u?c:u,_=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>=f&&p.x<=_&&p.y>=h&&p.y<=g&&$g(o,a,r,c,s,u,p.x,p.y)&&Uo(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Jwe(e,t,n,i){var o=e.prev,r=e,s=e.next;if(Uo(o,r,s)>=0)return!1;for(var a=o.x,c=r.x,u=s.x,f=o.y,h=r.y,_=s.y,g=a<c?a<u?a:u:c<u?c:u,p=f<h?f<_?f:_:h<_?h:_,y=a>c?a>u?a:u:c>u?c:u,C=f>h?f>_?f:_:h>_?h:_,T=kL(g,p,t,n,i),E=kL(y,C,t,n,i),w=e.prevZ,S=e.nextZ;w&&w.z>=T&&S&&S.z<=E;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=C&&w!==o&&w!==s&&$g(a,f,c,h,u,_,w.x,w.y)&&Uo(w.prev,w,w.next)>=0||(w=w.prevZ,S.x>=g&&S.x<=y&&S.y>=p&&S.y<=C&&S!==o&&S!==s&&$g(a,f,c,h,u,_,S.x,S.y)&&Uo(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;w&&w.z>=T;){if(w.x>=g&&w.x<=y&&w.y>=p&&w.y<=C&&w!==o&&w!==s&&$g(a,f,c,h,u,_,w.x,w.y)&&Uo(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<=C&&S!==o&&S!==s&&$g(a,f,c,h,u,_,S.x,S.y)&&Uo(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function Qwe(e,t,n){var i=e;do{var o=i.prev,r=i.next.next;!Ov(o,r)&&wq(o,i,i.next,r)&&VC(o,r)&&VC(r,o)&&(t.push(o.i/n|0),t.push(i.i/n|0),t.push(r.i/n|0),kC(i),kC(i.next),i=e=r),i=i.next}while(i!==e);return Zm(i)}function Zwe(e,t,n,i,o,r){var s=e;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&cSe(s,a)){var c=Sq(s,a);s=Zm(s,s.next),c=Zm(c,c.next),HC(s,t,n,i,o,r,0),HC(c,t,n,i,o,r,0);return}a=a.next}s=s.next}while(s!==e)}function eSe(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=xq(e,a,c,i,!1),u===u.next&&(u.steiner=!0),o.push(aSe(u));for(o.sort(tSe),r=0;r<o.length;r++)n=nSe(o[r],n);return n}function tSe(e,t){return e.x-t.x}function nSe(e,t){var n=iSe(e,t);if(!n)return t;var i=Sq(n,e);return Zm(i,i.next),Zm(n,n.next)}function iSe(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,f=s.y,h=1/0,_;n=s;do i>=n.x&&n.x>=u&&i!==n.x&&$g(o<f?i:r,o,u,f,o<f?r:i,o,n.x,n.y)&&(_=Math.abs(o-n.y)/(i-n.x),VC(n,e)&&(_<h||_===h&&(n.x>s.x||n.x===s.x&&oSe(s,n)))&&(s=n,h=_)),n=n.next;while(n!==c);return s}function oSe(e,t){return Uo(e.prev,e,t.prev)<0&&Uo(t.next,e,e.next)<0}function rSe(e,t,n,i){var o=e;do o.z===0&&(o.z=kL(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,sSe(o)}function sSe(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 kL(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 aSe(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 $g(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 cSe(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!lSe(e,t)&&(VC(e,t)&&VC(t,e)&&uSe(e,t)&&(Uo(e.prev,e,t.prev)||Uo(e,t.prev,t))||Ov(e,t)&&Uo(e.prev,e,e.next)>0&&Uo(t.prev,t,t.next)>0)}function Uo(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Ov(e,t){return e.x===t.x&&e.y===t.y}function wq(e,t,n,i){var o=DE(Uo(e,t,n)),r=DE(Uo(e,t,i)),s=DE(Uo(n,i,e)),a=DE(Uo(n,i,t));return!!(o!==r&&s!==a||o===0&&vE(e,n,t)||r===0&&vE(e,i,t)||s===0&&vE(n,e,i)||a===0&&vE(n,t,i))}function vE(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 DE(e){return e>0?1:e<0?-1:0}function lSe(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&&wq(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function VC(e,t){return Uo(e.prev,e,e.next)<0?Uo(e,t,e.next)>=0&&Uo(e,e.prev,t)>=0:Uo(e,t,e.prev)<0||Uo(e,e.next,t)<0}function uSe(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 Sq(e,t){var n=new GL(e.i,e.x,e.y),i=new GL(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 dH(e,t,n,i){var o=new GL(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 kC(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 GL(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}Pv.deviation=function(e,t,n,i){var o=t&&t.length,r=o?t[0]*n:e.length,s=Math.abs(WL(e,0,r,n));if(o)for(var a=0,c=t.length;a<c;a++){var u=t[a]*n,f=a<c-1?t[a+1]*n:e.length;s-=Math.abs(WL(e,u,f,n))}var h=0;for(a=0;a<i.length;a+=3){var _=i[a]*n,g=i[a+1]*n,p=i[a+2]*n;h+=Math.abs((e[_]-e[p])*(e[g+1]-e[_+1])-(e[_]-e[g])*(e[p+1]-e[_+1]))}return s===0&&h===0?0:Math.abs((h-s)/s)};function WL(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}Pv.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 jL(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,f=Math.sin(2*u),h=Math.sin(4*u),_=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)*f+(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)*_+(315*s/131072+2205*a/524288+43659*c/8388608)*g-(693*a/1310720+6237*c/5242880)*p+1001*c/8388608*y)}function fSe(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,f=u*c,h=f*c,_=h*c,g=_*c,p=Math.sin(2*i),y=Math.cos(2*i),C=Math.sin(4*i),T=Math.cos(4*i),E=Math.sin(6*i),w=Math.cos(6*i),S=Math.sin(8*i),P=Math.cos(8*i),O=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*f/256+579*i*h/16384+1515*i*_/65536+16837*i*g/1048576+(3*i*u/16+45*i*f/256-i*(32*o-561)*h/4096-i*(232*o-1677)*_/16384+i*(399985-90560*o+512*s)*g/5242880)*y+(21*i*f/256+483*i*h/4096-i*(224*o-1969)*_/16384-i*(33152*o-112599)*g/1048576)*T+(151*i*h/4096+4681*i*_/65536+1479*i*g/16384-453*r*g/32768)*w+(1097*i*_/65536+42783*i*g/1048576)*P+8011*i*g/1048576*z+(3*c/8+3*u/16+213*f/2048-3*o*f/64+255*h/4096-33*o*h/512+20861*_/524288-33*o*_/512+s*_/1024+28273*g/1048576-471*o*g/8192+9*s*g/4096)*p+(21*u/256+21*f/256+533*h/8192-21*o*h/512+197*_/4096-315*o*_/4096+584039*g/16777216-12517*o*g/131072+7*s*g/2048)*C+(151*f/6144+151*h/4096+5019*_/131072-453*o*_/16384+26965*g/786432-8607*o*g/131072)*E+(1097*h/131072+1097*_/65536+225797*g/10485760-1097*o*g/65536)*S+(8011*_/2621440+8011*g/1048576)*O+293393*g/251658240*R}function Hy(e,t){if(e===0)return Math.log(Math.tan(.5*(N.PI_OVER_TWO+t)));const n=e*Math.sin(t);return Math.log(Math.tan(.5*(N.PI_OVER_TWO+t)))-e/2*Math.log((1+n)/(1-n))}function dSe(e,t,n,i,o){const r=Hy(e._ellipticity,n),s=Hy(e._ellipticity,o);return Math.atan2(N.negativePiToPi(i-t),s-r)}function hSe(e,t,n,i,o,r,s){const a=e._heading,c=r-i;let u=0;if(N.equalsEpsilon(Math.abs(a),N.PI_OVER_TWO,N.EPSILON8))if(t===n)u=t*Math.cos(o)*N.negativePiToPi(c);else{const f=Math.sin(o);u=t*Math.cos(o)*N.negativePiToPi(c)/Math.sqrt(1-e._ellipticitySquared*f*f)}else{const f=jL(e._ellipticity,t,o);u=(jL(e._ellipticity,t,s)-f)/Math.cos(a)}return Math.abs(u)}const pSe=new d,rP=new d;function vq(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,rP),pSe),r=d.normalize(i.cartographicToCartesian(n,rP),rP);b.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.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=Ae.clone(t,e._start),e._start.height=0,e._end=Ae.clone(n,e._end),e._end.height=0,e._heading=dSe(e,t.longitude,t.latitude,n.longitude,n.latitude),e._distance=hSe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude)}function Dq(e,t,n,i,o,r){if(n===0)return Ae.clone(e,r);const s=o*o;let a,c,u;if(Math.abs(N.PI_OVER_TWO-Math.abs(t))>N.EPSILON8){const f=jL(o,i,e.latitude),h=n*Math.cos(t),_=f+h;c=fSe(_,o,i);const g=Hy(o,e.latitude),p=Hy(o,c);u=Math.tan(t)*(p-g),a=N.negativePiToPi(e.longitude+u)}else{c=e.latitude;let f;if(o===0)f=i*Math.cos(e.latitude);else{const h=Math.sin(e.latitude);f=i*Math.cos(e.latitude)/Math.sqrt(1-s*h*h)}u=n/f,t>0?a=N.negativePiToPi(e.longitude+u):a=N.negativePiToPi(e.longitude-u)}return l(r)?(r.longitude=a,r.latitude=c,r.height=0,r):new Ae(a,c,0)}function ns(e,t,n){const i=A(n,pe.WGS84);this._ellipsoid=i,this._start=new Ae,this._end=new Ae,this._heading=void 0,this._distance=void 0,this._ellipticity=void 0,this._ellipticitySquared=void 0,l(e)&&l(t)&&vq(this,e,t,i)}Object.defineProperties(ns.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return b.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},heading:{get:function(){return b.defined("distance",this._distance),this._heading}}});ns.fromStartHeadingDistance=function(e,t,n,i,o){b.defined("start",e),b.defined("heading",t),b.defined("distance",n),b.typeOf.number.greaterThan("distance",n,0);const r=A(i,pe.WGS84),s=r.maximumRadius,a=r.minimumRadius,c=s*s,u=a*a,f=Math.sqrt((c-u)/c);t=N.negativePiToPi(t);const h=Dq(e,t,n,r.maximumRadius,f);return!l(o)||l(i)&&!i.equals(o.ellipsoid)?new ns(e,h,r):(o.setEndPoints(e,h),o)};ns.prototype.setEndPoints=function(e,t){b.defined("start",e),b.defined("end",t),vq(this,e,t,this._ellipsoid)};ns.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(e*this._distance,t)};ns.prototype.interpolateUsingSurfaceDistance=function(e,t){if(b.typeOf.number("distance",e),!l(this._distance)||this._distance===0)throw new x("EllipsoidRhumbLine must have distinct start and end set.");return Dq(this._start,this._heading,e,this._ellipsoid.maximumRadius,this._ellipticity,t)};ns.prototype.findIntersectionWithLongitude=function(e,t){if(b.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=N.negativePiToPi(e),N.equalsEpsilon(Math.abs(e),Math.PI,N.EPSILON14)&&(e=N.sign(r.longitude)*Math.PI),l(t)||(t=new Ae),Math.abs(N.PI_OVER_TWO-o)<=N.EPSILON8)return t.longitude=e,t.latitude=r.latitude,t.height=0,t;if(N.equalsEpsilon(Math.abs(N.PI_OVER_TWO-o),N.PI_OVER_TWO,N.EPSILON8))return N.equalsEpsilon(e,r.longitude,N.EPSILON12)?void 0:(t.longitude=e,t.latitude=N.PI_OVER_TWO*N.sign(N.PI_OVER_TWO-i),t.height=0,t);const s=r.latitude,a=n*Math.sin(s),c=Math.tan(.5*(N.PI_OVER_TWO+s))*Math.exp((e-r.longitude)/Math.tan(i)),u=(1+a)/(1-a);let f=r.latitude,h;do{h=f;const _=n*Math.sin(h),g=(1+_)/(1-_);f=2*Math.atan(c*Math.pow(g/u,n/2))-N.PI_OVER_TWO}while(!N.equalsEpsilon(f,h,N.EPSILON12));return t.longitude=e,t.latitude=f,t.height=0,t};ns.prototype.findIntersectionWithLatitude=function(e,t){if(b.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(N.equalsEpsilon(Math.abs(i),N.PI_OVER_TWO,N.EPSILON8))return;const r=Hy(n,o.latitude),s=Hy(n,e),a=Math.tan(i)*(s-r),c=N.negativePiToPi(o.longitude+a);return l(t)?(t.longitude=c,t.latitude=e,t.height=0,t):new Ae(c,e,0)};const mSe=new d,_Se=new d,rp={};rp.computeArea2D=function(e){b.defined("positions",e),b.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};rp.computeWindingOrder2D=function(e){return rp.computeArea2D(e)>0?el.COUNTER_CLOCKWISE:el.CLOCKWISE};rp.triangulate=function(e,t){b.defined("positions",e);const n=j.packArray(e);return _S(n,t,2)};const Iq=new d,Pq=new d,Oq=new d,hH=new d,pH=new d,mH=new d,Ff=new d,Lq=new j,Bq=new j,Rq=new j,ly=new j;rp.computeSubdivision=function(e,t,n,i,o){o=A(o,N.RADIANS_PER_DEGREE);const r=l(i);b.typeOf.object("ellipsoid",e),b.defined("positions",t),b.defined("indices",n),b.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),b.typeOf.number.equals("indices.length % 3","0",n.length%3,0),b.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),f=new Array(c*2);let h=0,_=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];f[_++]=S.x,f[_++]=S.y}}const g=[],p={},y=e.maximumRadius,C=N.chordLength(o,y),T=C*C;for(;s.length>0;){const w=s.pop(),S=s.pop(),P=s.pop(),O=d.fromArray(u,P*3,Iq),z=d.fromArray(u,S*3,Pq),R=d.fromArray(u,w*3,Oq);let F,H,v;r&&(F=j.fromArray(f,P*2,Lq),H=j.fromArray(f,S*2,Bq),v=j.fromArray(f,w*2,Rq));const I=d.multiplyByScalar(d.normalize(O,hH),y,hH),m=d.multiplyByScalar(d.normalize(z,pH),y,pH),D=d.multiplyByScalar(d.normalize(R,mH),y,mH),L=d.magnitudeSquared(d.subtract(I,m,Ff)),M=d.magnitudeSquared(d.subtract(m,D,Ff)),V=d.magnitudeSquared(d.subtract(D,I,Ff)),k=Math.max(L,M,V);let W,G,K;k>T?L===k?(W=`${Math.min(P,S)} ${Math.max(P,S)}`,a=p[W],l(a)||(G=d.add(O,z,Ff),d.multiplyByScalar(G,.5,G),u.push(G.x,G.y,G.z),a=u.length/3-1,p[W]=a,r&&(K=j.add(F,H,ly),j.multiplyByScalar(K,.5,K),f.push(K.x,K.y))),s.push(P,a,w),s.push(a,S,w)):M===k?(W=`${Math.min(S,w)} ${Math.max(S,w)}`,a=p[W],l(a)||(G=d.add(z,R,Ff),d.multiplyByScalar(G,.5,G),u.push(G.x,G.y,G.z),a=u.length/3-1,p[W]=a,r&&(K=j.add(H,v,ly),j.multiplyByScalar(K,.5,K),f.push(K.x,K.y))),s.push(S,a,P),s.push(a,w,P)):V===k&&(W=`${Math.min(w,P)} ${Math.max(w,P)}`,a=p[W],l(a)||(G=d.add(R,O,Ff),d.multiplyByScalar(G,.5,G),u.push(G.x,G.y,G.z),a=u.length/3-1,p[W]=a,r&&(K=j.add(v,F,ly),j.multiplyByScalar(K,.5,K),f.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 ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Je.TRIANGLES};return r&&(E.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:f})),new Dt(E)};const gSe=new Ae,ySe=new Ae,ASe=new Ae,sP=new Ae;rp.computeRhumbLineSubdivision=function(e,t,n,i,o){o=A(o,N.RADIANS_PER_DEGREE);const r=l(i);b.typeOf.object("ellipsoid",e),b.defined("positions",t),b.defined("indices",n),b.typeOf.number.greaterThanOrEquals("indices.length",n.length,3),b.typeOf.number.equals("indices.length % 3","0",n.length%3,0),b.typeOf.number.greaterThan("granularity",o,0);const s=n.slice(0);let a;const c=t.length,u=new Array(c*3),f=new Array(c*2);let h=0,_=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 O=i[a];f[_++]=O.x,f[_++]=O.y}}const g=[],p={},y=e.maximumRadius,C=N.chordLength(o,y),T=new ns(void 0,void 0,e),E=new ns(void 0,void 0,e),w=new ns(void 0,void 0,e);for(;s.length>0;){const P=s.pop(),O=s.pop(),z=s.pop(),R=d.fromArray(u,z*3,Iq),F=d.fromArray(u,O*3,Pq),H=d.fromArray(u,P*3,Oq);let v,I,m;r&&(v=j.fromArray(f,z*2,Lq),I=j.fromArray(f,O*2,Bq),m=j.fromArray(f,P*2,Rq));const D=e.cartesianToCartographic(R,gSe),L=e.cartesianToCartographic(F,ySe),M=e.cartesianToCartographic(H,ASe);T.setEndPoints(D,L);const V=T.surfaceDistance;E.setEndPoints(L,M);const k=E.surfaceDistance;w.setEndPoints(M,D);const W=w.surfaceDistance,G=Math.max(V,k,W);let K,q,te,$,X;G>C?V===G?(K=`${Math.min(z,O)} ${Math.max(z,O)}`,a=p[K],l(a)||(q=T.interpolateUsingFraction(.5,sP),te=(D.height+L.height)*.5,$=d.fromRadians(q.longitude,q.latitude,te,e,Ff),u.push($.x,$.y,$.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(v,I,ly),j.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(z,a,P),s.push(a,O,P)):k===G?(K=`${Math.min(O,P)} ${Math.max(O,P)}`,a=p[K],l(a)||(q=E.interpolateUsingFraction(.5,sP),te=(L.height+M.height)*.5,$=d.fromRadians(q.longitude,q.latitude,te,e,Ff),u.push($.x,$.y,$.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(I,m,ly),j.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(O,a,z),s.push(a,P,z)):W===G&&(K=`${Math.min(P,z)} ${Math.max(P,z)}`,a=p[K],l(a)||(q=w.interpolateUsingFraction(.5,sP),te=(M.height+D.height)*.5,$=d.fromRadians(q.longitude,q.latitude,te,e,Ff),u.push($.x,$.y,$.z),a=u.length/3-1,p[K]=a,r&&(X=j.add(m,v,ly),j.multiplyByScalar(X,.5,X),f.push(X.x,X.y))),s.push(P,a,O),s.push(a,z,O)):(g.push(z),g.push(O),g.push(P))}const S={attributes:{position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})},indices:g,primitiveType:Je.TRIANGLES};return r&&(S.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:f})),new Dt(S)};rp.scaleToGeodeticHeight=function(e,t,n,i){n=A(n,pe.WGS84);let o=mSe,r=_Se;if(t=A(t,0),i=A(i,!0),l(e)){const s=e.length;for(let a=0;a<s;a+=3)d.fromArray(e,a,r),i&&(r=n.scaleToGeodeticSurface(r,r)),t!==0&&(o=n.geodeticSurfaceNormal(r,o),d.multiplyByScalar(o,t,o),d.add(r,o,r)),e[a]=r.x,e[a+1]=r.y,e[a+2]=r.z}return e};const Wi=rp,_H=Math.cos,gH=Math.sin,CSe=Math.sqrt,ZN={};ZN.computePosition=function(e,t,n,i,o,r,s){const a=t.radiiSquared,c=e.nwCorner,u=e.boundingRectangle;let f=c.latitude-e.granYCos*i+o*e.granXSin;const h=_H(f),_=gH(f),g=a.z*_;let p=c.longitude+i*e.granYSin+o*e.granXCos;const y=h*_H(p),C=h*gH(p),T=a.x*y,E=a.y*C,w=CSe(T*y+E*C+g*_);if(r.x=T/w,r.y=E/w,r.z=g/w,n){const S=e.stNwCorner;l(S)?(f=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=(f-e.stSouth)*e.latScalar):(s.x=(p-u.west)*e.lonScalar,s.y=(f-u.south)*e.latScalar)}};const TSe=new at;let Sc=new d;const bSe=new Ae;let gS=new d;const qL=new jo;function yH(e,t,n,i,o,r,s){const a=Math.cos(t),c=i*a,u=n*a,f=Math.sin(t),h=i*f,_=n*f;Sc=qL.project(e,Sc),Sc=d.subtract(Sc,gS,Sc);const g=at.fromRotation(t,TSe);Sc=at.multiplyByVector(g,Sc,Sc),Sc=d.add(Sc,gS,Sc),e=qL.unproject(Sc,e),r-=1,s-=1;const p=e.latitude,y=p+r*_,C=p-c*s,T=p-c*s+r*_,E=Math.max(p,y,C,T),w=Math.min(p,y,C,T),S=e.longitude,P=S+r*u,O=S+s*h,z=S+s*h+r*u,R=Math.max(S,P,O,z),F=Math.min(S,P,O,z);return{north:E,south:w,east:R,west:F,granYCos:c,granYSin:h,granXCos:u,granXSin:_,nwCorner:e}}ZN.computeOptions=function(e,t,n,i,o,r,s){let a=e.east,c=e.west,u=e.north,f=e.south,h=!1,_=!1;u===N.PI_OVER_TWO&&(h=!0),f===-N.PI_OVER_TWO&&(_=!0);let g;const p=u-f;c>a?g=N.TWO_PI-c+a:g=a-c;const y=Math.ceil(g/t)+1,C=Math.ceil(p/t)+1,T=g/(y-1),E=p/(C-1),w=_e.northwest(e,r),S=_e.center(e,bSe);(n!==0||i!==0)&&(S.longitude<w.longitude&&(S.longitude+=N.TWO_PI),gS=qL.project(S,gS));const P=E,O=T,z=0,R=0,F=_e.clone(e,o),H={granYCos:P,granYSin:z,granXCos:O,granXSin:R,nwCorner:w,boundingRectangle:F,width:y,height:C,northCap:h,southCap:_};if(n!==0){const v=yH(w,n,T,E,S,y,C);if(u=v.north,f=v.south,a=v.east,c=v.west,u<-N.PI_OVER_TWO||u>N.PI_OVER_TWO||f<-N.PI_OVER_TWO||f>N.PI_OVER_TWO)throw new x("Rotated rectangle is invalid. It crosses over either the north or south pole.");H.granYCos=v.granYCos,H.granYSin=v.granYSin,H.granXCos=v.granXCos,H.granXSin=v.granXSin,F.north=u,F.south=f,F.east=a,F.west=c}if(i!==0){n=n-i;const v=_e.northwest(F,s),I=yH(v,n,T,E,S,y,C);H.stGranYCos=I.granYCos,H.stGranXCos=I.granXCos,H.stGranYSin=I.granYSin,H.stGranXSin=I.granXSin,H.stNwCorner=v,H.stWest=I.west,H.stSouth=I.south}return H};const ma=ZN,ESe=new fe,xSe=new fe,wSe=new d,SSe=new _e;function Nq(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,f=4;r&&(c-=1,a-=1,u+=1,f-=2),s&&(c-=1,a-=1,u+=1,f-=2),u+=c*o+2*a-f;const h=new Float64Array(u*3);let _=0,g=0,p;const y=wSe;if(r)ma.computePosition(t,n,!1,g,0,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;else for(p=0;p<o;p++)ma.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;for(p=o-1,g=1;g<i;g++)ma.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;if(g=i-1,!s)for(p=o-2;p>=0;p--)ma.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;for(p=0,g=i-2;g>0;g--)ma.computePosition(t,n,!1,g,p,y),h[_++]=y.x,h[_++]=y.y,h[_++]=y.z;const C=h.length/3*2,T=it.createTypedArray(h.length/3,C);let E=0;for(let S=0;S<h.length/3-1;S++)T[E++]=S,T[E++]=S+1;T[E++]=h.length/3-1,T[E++]=0;const w=new Dt({attributes:new Ui,primitiveType:Je.LINES});return w.attributes.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h}),w.indices=T,w}function vSe(e,t){const n=e._surfaceHeight,i=e._extrudedHeight,o=e._ellipsoid,r=i,s=n,a=Nq(e,t),c=t.height,u=t.width,f=Wi.scaleToGeodeticHeight(a.attributes.position.values,s,o,!1);let h=f.length;const _=new Float64Array(h*2);_.set(f);const g=Wi.scaleToGeodeticHeight(a.attributes.position.values,r,o);_.set(g,h),a.attributes.position.values=_;const p=t.northCap,y=t.southCap;let C=4;p&&(C-=1),y&&(C-=1);const T=(_.length/3+C)*2,E=it.createTypedArray(_.length/3,T);h=_.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 e_(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle,n=A(e.granularity,N.RADIANS_PER_DEGREE),i=A(e.ellipsoid,pe.WGS84),o=A(e.rotation,0);if(!l(t))throw new x("rectangle is required.");if(_e.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=_e.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"}e_.packedLength=_e.packedLength+pe.packedLength+5;e_.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),_e.pack(e._rectangle,t,n),n+=_e.packedLength,pe.pack(e._ellipsoid,t,n),n+=pe.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 Mq=new _e,Fq=pe.clone(pe.UNIT_SPHERE),og={rectangle:Mq,ellipsoid:Fq,granularity:void 0,height:void 0,rotation:void 0,extrudedHeight:void 0,offsetAttribute:void 0};e_.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=_e.unpack(e,t,Mq);t+=_e.packedLength;const o=pe.unpack(e,t,Fq);t+=pe.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t];return l(n)?(n._rectangle=_e.clone(i,n._rectangle),n._ellipsoid=pe.clone(o,n._ellipsoid),n._surfaceHeight=s,n._rotation=a,n._extrudedHeight=c,n._offsetAttribute=u===-1?void 0:u,n):(og.granularity=r,og.height=s,og.rotation=a,og.extrudedHeight=c,og.offsetAttribute=u===-1?void 0:u,new e_(og))};const DSe=new Ae;e_.createGeometry=function(e){const t=e._rectangle,n=e._ellipsoid,i=ma.computeOptions(t,e._granularity,e._rotation,0,SSe,DSe);let o,r;if(N.equalsEpsilon(t.north,t.south,N.EPSILON10)||N.equalsEpsilon(t.east,t.west,N.EPSILON10))return;const s=e._surfaceHeight,a=e._extrudedHeight,c=!N.equalsEpsilon(s,a,0,N.EPSILON2);let u;if(c){if(o=vSe(e,i),l(e._offsetAttribute)){const _=o.attributes.position.values.length/3;let g=new Uint8Array(_);e._offsetAttribute===fn.TOP?g=g.fill(1,0,_/2):(u=e._offsetAttribute===fn.NONE?0:1,g=g.fill(u)),o.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:g})}const f=fe.fromRectangle3D(t,n,s,xSe),h=fe.fromRectangle3D(t,n,a,ESe);r=fe.union(f,h)}else{if(o=Nq(e,i),o.attributes.position.values=Wi.scaleToGeodeticHeight(o.attributes.position.values,s,n,!1),l(e._offsetAttribute)){const f=o.attributes.position.values.length;u=e._offsetAttribute===fn.NONE?0:1;const h=new Uint8Array(f/3).fill(u);o.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}r=fe.fromRectangle3D(t,n,s)}return new Dt({attributes:o.attributes,indices:o.indices,primitiveType:Je.LINES,boundingSphere:r,offsetAttribute:e._offsetAttribute})};function qu(e){b.typeOf.object("options",e),b.typeOf.object("options.rectangle",e.rectangle),this.rectangle=_e.clone(e.rectangle),this.minimumHeight=A(e.minimumHeight,0),this.maximumHeight=A(e.maximumHeight,0),this.southwestCornerCartesian=new d,this.northeastCornerCartesian=new d,this.westNormal=new d,this.southNormal=new d,this.eastNormal=new d,this.northNormal=new d;const t=A(e.ellipsoid,pe.WGS84);BSe(this,e.rectangle,t),this._orientedBoundingBox=void 0,this._boundingSphere=void 0,A(e.computeBoundingVolumes,!0)&&this.computeBoundingVolumes(t)}Object.defineProperties(qu.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});qu.prototype.computeBoundingVolumes=function(e){this._orientedBoundingBox=Bt.fromRectangle(this.rectangle,this.minimumHeight,this.maximumHeight,e),this._boundingSphere=fe.fromOrientedBoundingBox(this._orientedBoundingBox)};const AH=new d,IE=new d,CH=new d,ISe=new d,PSe=new d,OSe=new d,LSe=new d,vc=new Ae,TH=new St(d.UNIT_X,0),rg=new Pn;function BSe(e,t,n){n.cartographicToCartesian(_e.southwest(t),e.southwestCornerCartesian),n.cartographicToCartesian(_e.northeast(t),e.northeastCornerCartesian),vc.longitude=t.west,vc.latitude=(t.south+t.north)*.5,vc.height=0;const i=n.cartographicToCartesian(vc,OSe),o=d.cross(i,d.UNIT_Z,ISe);d.normalize(o,e.westNormal),vc.longitude=t.east;const r=n.cartographicToCartesian(vc,LSe),s=d.cross(d.UNIT_Z,r,AH);d.normalize(s,e.eastNormal);let a=d.subtract(i,r,AH);d.magnitude(a)===0&&(a=d.clone(o,a));const c=d.normalize(a,PSe),u=t.south;let f;if(u>0){vc.longitude=(t.west+t.east)*.5,vc.latitude=u;const y=n.cartographicToCartesian(vc,rg.origin);d.clone(c,rg.direction);const C=St.fromPointNormal(e.southwestCornerCartesian,e.westNormal,TH);nr.rayPlane(rg,C,e.southwestCornerCartesian),f=n.geodeticSurfaceNormal(y,IE)}else f=n.geodeticSurfaceNormalCartographic(_e.southeast(t),IE);const h=d.cross(f,a,CH);d.normalize(h,e.southNormal);const _=t.north;let g;if(_<0){vc.longitude=(t.west+t.east)*.5,vc.latitude=_;const y=n.cartographicToCartesian(vc,rg.origin);d.negate(c,rg.direction);const C=St.fromPointNormal(e.northeastCornerCartesian,e.eastNormal,TH);nr.rayPlane(rg,C,e.northeastCornerCartesian),g=n.geodeticSurfaceNormal(y,IE)}else g=n.geodeticSurfaceNormalCartographic(_e.northwest(t),IE);const p=d.cross(a,g,CH);d.normalize(p,e.northNormal)}const RSe=new d,NSe=new d,MSe=new d(0,-1,0),FSe=new d(0,0,-1),bH=new d;function zSe(e,t){const n=t.camera,i=n.positionWC,o=n.positionCartographic;let r=0;if(!_e.contains(e.rectangle,o)){let u=e.southwestCornerCartesian,f=e.northeastCornerCartesian,h=e.westNormal,_=e.southNormal,g=e.eastNormal,p=e.northNormal;t.mode!==le.SCENE3D&&(u=t.mapProjection.project(_e.southwest(e.rectangle),RSe),u.z=u.y,u.y=u.x,u.x=0,f=t.mapProjection.project(_e.northeast(e.rectangle),NSe),f.z=f.y,f.y=f.x,f.x=0,h=MSe,g=d.UNIT_Y,_=FSe,p=d.UNIT_Z);const y=d.subtract(i,u,bH),C=d.dot(y,h),T=d.dot(y,_),E=d.subtract(i,f,bH),w=d.dot(E,g),S=d.dot(E,p);C>0?r+=C*C:w>0&&(r+=w*w),T>0?r+=T*T: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)}qu.prototype.distanceToCamera=function(e){b.defined("frameState",e);const t=zSe(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};qu.prototype.intersectPlane=function(e){return b.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};qu.prototype.createDebugVolume=function(e){b.defined("color",e);const t=new B.clone(B.IDENTITY),n=new e_({rectangle:this.rectangle,height:this.minimumHeight,extrudedHeight:this.maximumHeight}),i=new nn({geometry:n,id:"outline",modelMatrix:t,attributes:{color:an.fromColor(e)}});return new Wt({geometryInstances:i,appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})};function oo(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=Co.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 $e,this._imageryLayers.layerAdded.addEventListener(oo.prototype._onLayerAdded,this),this._imageryLayers.layerRemoved.addEventListener(oo.prototype._onLayerRemoved,this),this._imageryLayers.layerMoved.addEventListener(oo.prototype._onLayerMoved,this),this._imageryLayers.layerShownOrHidden.addEventListener(oo.prototype._onLayerShownOrHidden,this),this._imageryLayersUpdatedEvent=new $e,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 U(0,0,.5,1),this._clippingPlanes=void 0,this.cartographicLimitRectangle=_e.clone(_e.MAX_VALUE),this._hasLoadedTilesThisFrame=!1,this._hasFillTilesThisFrame=!1,this._oldTerrainExaggeration=void 0,this._oldTerrainExaggerationRelativeHeight=void 0}Object.defineProperties(oo.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){Ao.setOwner(e,this,"_clippingPlanes")}}});function USe(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}oo.prototype.update=function(e){this._imageryLayers._update()};function HSe(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)}}oo.prototype.initialize=function(e){this._imageryLayers.queueReprojectionCommands(e),this._layerOrderChanged&&(this._layerOrderChanged=!1,this._quadtree.forEachLoadedTile(function(i){i.data.imagery.sort(USe)})),HSe(this,e);const t=this._vertexArraysToDestroy,n=t.length;for(let i=0;i<n;++i)bi._freeVertexArray(t[i]);t.length=0};oo.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};oo.prototype.endUpdate=function(e){if(!l(this._renderState)){this._renderState=Qe.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Jm.LESS}}),this._blendRenderState=Qe.fromCache({cull:{enabled:!0},depthTest:{enabled:!0,func:Jm.LESS_OR_EQUAL},blending:Ii.ALPHA_BLEND});let s=ut(this._renderState,!0);s.cull.enabled=!1,this._disableCullingRenderState=Qe.fromCache(s),s=ut(this._blendRenderState,!0),s.cull.enabled=!1,this._disableCullingBlendRenderState=Qe.fromCache(s)}this._hasFillTilesThisFrame&&this._hasLoadedTilesThisFrame&&S_.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,f=c.length;u<f;++u){const h=c[u],_=h.data.tileBoundingRegion;uve(this,h,e),e.minimumTerrainHeight=Math.min(e.minimumTerrainHeight,_.minimumHeight)}}};function zq(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)}oo.prototype.updateForPick=function(e){const t=this._drawCommands;for(let n=0,i=this._usedDrawCommands;n<i;++n)zq(t[n],e)};oo.prototype.cancelReprojections=function(){this._imageryLayers.cancelReprojections()};oo.prototype.getLevelMaximumGeometricError=function(e){return this._terrainProvider.getLevelMaximumGeometricError(e)};oo.prototype.loadTile=function(e,t){let n=t.data,i=!0,o;l(n)&&(i=n.boundingVolumeSourceTile!==t||t._lastSelectionResult===qn.CULLED_BUT_NEEDED,o=n.terrainState),bi.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)!==Br.NONE&&n.boundingVolumeSourceTile===t&&(i=!1,bi.processStateMachine(t,e,this.terrainProvider,this._imageryLayers,this.quadtree,this._vertexArraysToDestroy,i))};const VSe=new fe,Uq=new _e,kSe=new _e,GSe=new Ae;function cw(e,t){if(t.west<t.east)return t;const n=_e.clone(t,kSe);return _e.center(e,GSe).longitude>0?n.east=N.PI:n.west=-N.PI,n}function Hq(e,t){if(t.cameraUnderground||t.globeTranslucencyState.translucent)return!0;if(e.backFaceCulling)return!1;const n=e._clippingPlanes;return!!(l(n)&&n.enabled||!_e.equals(e.cartographicLimitRectangle,_e.MAX_VALUE))}oo.prototype.computeTileVisibility=function(e,t,n){const i=this.computeDistanceToTile(e,t);e._distance=i;const o=Hq(this,t);if(t.fog.enabled&&!o&&N.fog(i,t.fog.density)>=1)return Br.NONE;const r=e.data,s=r.tileBoundingRegion;if(r.boundingVolumeSourceTile===void 0)return Br.PARTIAL;const a=t.cullingVolume;let c=s.boundingVolume;l(c)||(c=s.boundingSphere),r.clippedByBoundaries=!1;const u=cw(e.rectangle,this.cartographicLimitRectangle),f=_e.simpleIntersection(u,e.rectangle,Uq);if(!l(f))return Br.NONE;if(_e.equals(f,e.rectangle)||(r.clippedByBoundaries=!0),t.mode!==le.SCENE3D&&(c=VSe,fe.fromRectangleWithHeights2D(e.rectangle,t.mapProjection,s.minimumHeight,s.maximumHeight,c),d.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 Br.PARTIAL;const h=this._clippingPlanes;if(l(h)&&h.enabled){const y=h.computeIntersectionWithBoundingVolume(c);if(e.isClipped=y!==mn.INSIDE,y===mn.OUTSIDE)return Br.NONE}let _;const g=a.computeVisibility(c);if(g===mn.OUTSIDE?_=Br.NONE:g===mn.INTERSECTING?_=Br.PARTIAL:g===mn.INSIDE&&(_=Br.FULL),_===Br.NONE)return _;const p=t.mode===le.SCENE3D&&t.camera.frustum instanceof Ft;if(t.mode===le.SCENE3D&&!p&&l(n)&&!o){const y=r.occludeePointInScaledSpace;return!l(y)||n.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(y,s.minimumHeight)?_:Br.NONE}return _};oo.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 WSe=[],jSe=[];oo.prototype.canRenderWithoutLosingDetail=function(e,t){const n=e.data,i=WSe;i.length=this._imageryLayers.length;let o=!1,r=!1,s;l(n)&&(o=n.terrainState===io.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],_=h.loadingImagery,g=!l(_)||_.state===ai.FAILED||_.state===ai.INVALID,p=(h.loadingImagery||h.readyImagery).imageryLayer._layerIndex;i[p]=g&&i[p]}const u=this.quadtree._lastSelectionFrameNumber,f=jSe;for(f.length=0,f.push(e.southwestChild,e.southeastChild,e.northwestChild,e.northeastChild);f.length>0;){const h=f.pop(),_=h._lastSelectionResultFrame===u?h._lastSelectionResult:qn.NONE;if(_===qn.RENDERED){const g=h.data;if(!l(g))continue;if(!o&&h.data.terrainState===io.READY)return!1;const p=h.data.imagery;for(a=0,c=p.length;a<c;++a){const y=p[a],C=y.loadingImagery,T=!l(C)||C.state===ai.FAILED||C.state===ai.INVALID,E=(y.loadingImagery||y.readyImagery).imageryLayer._layerIndex;if(T&&!i[E])return!1}}else _===qn.REFINED&&f.push(h.southwestChild,h.southeastChild,h.northwestChild,h.northeastChild)}return!0};const qSe=new d;oo.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=d.subtract(i.center,o,qSe),a=d.magnitude(s);return a<N.EPSILON5?0:(d.divideByScalar(s,a,s),(1-d.dot(s,r))*e._distance)};const EH=new B,PE=new B,YSe=new oe,$Se=new oe,XSe=new oe,KSe=new d,xH=new d,JSe=new d,QSe=new d;oo.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 ZSe=[new d,new d,new d,new d];function wH(e,t,n,i,o,r){const s=e.quadtree._occluders.ellipsoid,a=s.ellipsoid,c=ZSe;return d.fromRadians(n.west,n.south,o,a,c[0]),d.fromRadians(n.east,n.south,o,a,c[1]),d.fromRadians(n.west,n.north,o,a,c[2]),d.fromRadians(n.east,n.north,o,a,c[3]),s.computeHorizonCullingPointPossiblyUnderEllipsoid(t,c,i,r)}oo.prototype.computeDistanceToTile=function(e,t){eve(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),f=Math.abs(c-s);u>f?(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 eve(e,t,n){let i=e.data;i===void 0&&(i=e.data=new bi);const o=e.tilingScheme.ellipsoid;i.tileBoundingRegion===void 0&&(i.tileBoundingRegion=new qu({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 f=i.mesh,h=i.terrainData;if(f!==void 0&&f.minimumHeight!==void 0&&f.maximumHeight!==void 0)r.minimumHeight=f.minimumHeight,r.maximumHeight=f.maximumHeight,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 _=e.parent;for(;_!==void 0;){const g=_.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}}_=_.parent}u=_}if(u!==void 0){const _=n.terrainExaggeration,g=n.terrainExaggerationRelativeHeight;if(_!==1&&(c=!1,r.minimumHeight=Wh.getHeight(r.minimumHeight,_,g),r.maximumHeight=Wh.getHeight(r.maximumHeight,_,g)),c)i.boundingVolumeIsFromMesh||(r._orientedBoundingBox=Bt.clone(f.orientedBoundingBox,r._orientedBoundingBox),r._boundingSphere=fe.clone(f.boundingSphere3D,r._boundingSphere),i.occludeePointInScaledSpace=d.clone(f.occludeePointInScaledSpace,i.occludeePointInScaledSpace),l(i.occludeePointInScaledSpace)||(i.occludeePointInScaledSpace=wH(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=wH(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}oo.prototype.isDestroyed=function(){return!1};oo.prototype.destroy=function(){return this._tileProvider=this._tileProvider&&this._tileProvider.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),Ue(this)};function tve(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 f=s+e;if(o=a[f],r=l(o)?A(o.readyImagery,o.loadingImagery):void 0,!l(r)||r.imageryLayer!==t)return!t._createTileImagerySkeletons(i,n,f);for(u=s;u<f;++u)a[u].freeResources();a.splice(s,e)}return!0}}oo.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 f=-1,h=0;for(a=0;a<u;++a){const g=c[a];if(A(g.readyImagery,g.loadingImagery).imageryLayer===e)f===-1&&(f=a),++h;else if(f!==-1)break}if(f===-1)return;const _=f+h;e._createTileImagerySkeletons(s,n,_)&&(s._loadedCallbacks[e._layerIndex]=tve(h,e,n),s.state=nl.LOADING)})},this._quadtree.forEachLoadedTile(function(s){e._createTileImagerySkeletons(s,n)&&(s.state=nl.LOADING,s.level!==0&&(s._lastSelectionResultFrame!==i.quadtree._lastSelectionFrameNumber||s._lastSelectionResult!==qn.RENDERED)&&(s.renderable=!1))}),this._layerOrderChanged=!0,r.raiseEvent()}};oo.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()};oo.prototype._onLayerMoved=function(e,t,n){this._layerOrderChanged=!0,this._imageryLayersUpdatedEvent.raiseEvent()};oo.prototype._onLayerShownOrHidden=function(e,t,n){n?this._onLayerAdded(e,t):this._onLayerRemoved(e,t)};const nve=new B,ive=new B;function SH(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,xH);return B.setTranslation(i,o,EH),EH},u_modifiedModelViewProjection:function(){const i=e.context.uniformState.view,o=e.context.uniformState.projection,r=B.multiplyByPoint(i,this.properties.rtc,xH);return B.setTranslation(i,r,PE),B.multiply(o,PE,PE),PE},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,nve):B.IDENTITY;return B.inverseTranspose(o,ive)},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 U(0,0,0,0),zoomedOutOceanSpecularIntensity:.5,oceanNormalMap:void 0,lightingFadeDistance:new j(65e5,9e6),nightFadeDistance:new j(1e7,4e7),atmosphereLightIntensity:10,atmosphereRayleighCoefficient:new d(55e-7,13e-6,284e-7),atmosphereMieCoefficient:new d(21e-6,21e-6,21e-6),atmosphereRayleighScaleHeight:1e4,atmosphereMieScaleHeight:3200,atmosphereMieAnisotropy:.9,hsbShift:new d,center3D:void 0,rtc:new d,modifiedModelView:new B,tileRectangle:new 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:U.clone(U.WHITE),clippingPlanesEdgeWidth:0,localizedCartographicLimitRectangle:new oe,frontFaceAlphaByDistance:new oe,backFaceAlphaByDistance:new oe,localizedTranslucencyRectangle:new oe,undergroundColor:U.clone(U.TRANSPARENT),undergroundColorAlphaByDistance:new oe,lambertDiffuseMultiplier:0,vertexShadowDarkness:0}};return l(t.materialUniformMap)?sn(n,t.materialUniformMap):n}function ove(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=rve(e,r,o),i.wireframeVertexArray.mesh=o}}function rve(e,t,n){const o={indices:n.indices,primitiveType:Je.TRIANGLES};Ri.toWireframe(o);const r=o.indices,s=At.createIndexBuffer({context:e,typedArray:r,usage:Ze.STATIC_DRAW,indexDatatype:it.fromSizeInBytes(r.BYTES_PER_ELEMENT)});return new to({context:e,attributes:t._attributes,indexBuffer:s})}let Vq,kq,lw;(function(){const e=new nn({geometry:ac.fromDimensions({dimensions:new d(2,2,2)})}),t=new nn({geometry:new op({radius:1})});let n=new B,i,o;function r(s){return new Wt({geometryInstances:s,appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})}Vq=function(s,a){return s===i||(lw(),i=s,n=B.fromRotationTranslation(s.halfAxes,s.center,n),e.modelMatrix=n,e.attributes.color=an.fromColor(a),o=r(e)),o},kq=function(s,a){return s===i||(lw(),i=s,n=B.fromTranslation(s.center,n),n=B.multiplyByUniformScale(n,s.radius,n),t.modelMatrix=n,t.attributes.color=an.fromColor(a),o=r(t)),o},lw=function(){l(o)&&(o.destroy(),o=void 0,i=void 0)}})();const sve=new oe(0,0,0,0),ave={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},cve=U.TRANSPARENT,lve=new Mt;function uve(e,t,n){const i=t.data;l(i.vertexArray)||(i.fill===void 0&&(i.fill=new S_(t)),i.fill.update(e,n));const o=n.creditDisplay,r=i.terrainData;if(l(r)&&l(r.credits)){const ve=r.credits;for(let Ie=0,Ve=ve.length;Ie<Ve;++Ie)o.addCredit(ve[Ie])}let s=wt.maximumTextureImageUnits,a=i.waterMaskTexture,c=i.waterMaskTranslationAndScale;!l(a)&&l(i.fill)&&(a=i.fill.waterMaskTexture,c=i.fill.waterMaskTranslationAndScale);const u=n.cameraUnderground,f=n.globeTranslucencyState,h=f.translucent,_=f.frontFaceAlphaByDistance,g=f.backFaceAlphaByDistance,p=f.rectangle,y=A(e.undergroundColor,cve),C=A(e.undergroundColorAlphaByDistance,lve),T=Hq(e,n)&&n.mode===le.SCENE3D&&y.alpha>0&&(C.nearValue>0||C.farValue>0),E=e.lambertDiffuseMultiplier,w=e.vertexShadowDarkness,S=e.hasWaterMask&&l(a),P=e.oceanNormalMap,O=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,H=Co.castShadows(e.shadows)&&!h,v=Co.receiveShadows(e.shadows)&&!h,I=e.hueShift,m=e.saturationShift,D=e.brightnessShift;let L=!(N.equalsEpsilon(I,0,N.EPSILON7)&&N.equalsEpsilon(m,0,N.EPSILON7)&&N.equalsEpsilon(D,0,N.EPSILON7)),M=!1;if(F){const ve=d.magnitude(n.camera.positionWC),Ie=e.nightFadeOutDistance;M=ve>Ie}S&&--s,O&&--s,l(n.shadowState)&&n.shadowState.shadowsEnabled&&--s,l(e.clippingPlanes)&&e.clippingPlanes.enabled&&--s,s-=f.numberOfTextureUniforms;const V=i.renderedMesh;let k=V.center;const W=V.encoding,G=i.tileBoundingRegion,K=n.terrainExaggeration,q=n.terrainExaggerationRelativeHeight,te=K!==1,$=W.hasGeodeticSurfaceNormals,X=YSe;let Y=0,ae=0,ue=0,re=0,he=!1;if(n.mode!==le.SCENE3D){const ve=n.mapProjection,Ie=ve.project(_e.southwest(t.rectangle),JSe),Ve=ve.project(_e.northeast(t.rectangle),QSe);if(X.x=Ie.x,X.y=Ie.y,X.z=Ve.x,X.w=Ve.y,n.mode!==le.MORPHING&&(k=KSe,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&&W.quantization===Qa.BITS12){const Le=1/(Math.pow(2,12)-1)*.5,_t=(X.z-X.x)*Le,Tt=(X.w-X.y)*Le;X.x-=_t,X.y-=Tt,X.z+=_t,X.w+=Tt}ve instanceof Zn&&(Y=t.rectangle.south,ae=t.rectangle.north,ue=Zn.geodeticLatitudeToMercatorAngle(Y),re=1/(Zn.geodeticLatitudeToMercatorAngle(ae)-ue),he=!0)}const ce=ave;ce.frameState=n,ce.surfaceTile=i,ce.showReflectiveOcean=S,ce.showOceanWaves=O,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=M,ce.hasVertexNormals=z,ce.useWebMercatorProjection=he,ce.clippedByBoundaries=i.clippedByBoundaries,ce.hasGeodeticSurfaceNormals=$,ce.hasExaggeration=te;const Q=i.imagery;let ie=0;const de=Q.length,me=e.showSkirts&&!u&&!h,Ee=e.backFaceCulling&&!u&&!h,xe=Ee?e._renderState:e._disableCullingRenderState,Pe=Ee?e._blendRenderState:e._disableCullingBlendRenderState;let Te=xe,Oe=e._firstPassInitialColor;const De=n.context;if(l(e._debug.boundingSphereTile)||lw(),e._materialUniformMap!==e.materialUniformMap){e._materialUniformMap=e.materialUniformMap;const ve=e._drawCommands.length;for(let Ie=0;Ie<ve;++Ie)e._uniformMaps[Ie]=SH(n,e)}do{let ve=0,Ie,Ve;if(e._drawCommands.length<=e._usedDrawCommands?(Ie=new dt,Ie.owner=t,Ie.cull=!1,Ie.boundingVolume=new fe,Ie.orientedBoundingBox=void 0,Ve=SH(n,e),e._drawCommands.push(Ie),e._uniformMaps.push(Ve)):(Ie=e._drawCommands[e._usedDrawCommands],Ve=e._uniformMaps[e._usedDrawCommands]),Ie.owner=t,++e._usedDrawCommands,t===e._debug.boundingSphereTile){const pn=G.boundingVolume,Hi=G.boundingSphere;l(pn)?Vq(pn,U.RED).update(n):l(Hi)&&kq(Hi,U.RED).update(n)}const Le=Ve.properties;oe.clone(Oe,Le.initialColor),Le.oceanNormalMap=P,Le.lightingFadeDistance.x=e.lightingFadeOutDistance,Le.lightingFadeDistance.y=e.lightingFadeInDistance,Le.nightFadeDistance.x=e.nightFadeOutDistance,Le.nightFadeDistance.y=e.nightFadeInDistance,Le.atmosphereLightIntensity=e.atmosphereLightIntensity,Le.atmosphereRayleighCoefficient=e.atmosphereRayleighCoefficient,Le.atmosphereMieCoefficient=e.atmosphereMieCoefficient,Le.atmosphereRayleighScaleHeight=e.atmosphereRayleighScaleHeight,Le.atmosphereMieScaleHeight=e.atmosphereMieScaleHeight,Le.atmosphereMieAnisotropy=e.atmosphereMieAnisotropy,Le.zoomedOutOceanSpecularIntensity=e.zoomedOutOceanSpecularIntensity;const _t=u?g:_,Tt=u?_:g;l(_t)&&(oe.fromElements(_t.near,_t.nearValue,_t.far,_t.farValue,Le.frontFaceAlphaByDistance),oe.fromElements(Tt.near,Tt.nearValue,Tt.far,Tt.farValue,Le.backFaceAlphaByDistance)),oe.fromElements(C.near,C.nearValue,C.far,C.farValue,Le.undergroundColorAlphaByDistance),U.clone(y,Le.undergroundColor),Le.lambertDiffuseMultiplier=E,Le.vertexShadowDarkness=w;const Ot=!l(i.vertexArray)&&l(e.fillHighlightColor)&&e.fillHighlightColor.alpha>0;Ot&&U.clone(e.fillHighlightColor,Le.fillHighlightColor),Le.terrainExaggerationAndRelativeHeight.x=K,Le.terrainExaggerationAndRelativeHeight.y=q,Le.center3D=V.center,d.clone(k,Le.rtc),oe.clone(X,Le.tileRectangle),Le.southAndNorthLatitude.x=Y,Le.southAndNorthLatitude.y=ae,Le.southMercatorYAndOneOverHeight.x=ue,Le.southMercatorYAndOneOverHeight.y=re;const Tn=$Se,Sn=cw(t.rectangle,e.cartographicLimitRectangle),gn=XSe,on=cw(t.rectangle,p);d.fromElements(I,m,D,Le.hsbShift);const Nt=t.rectangle,yn=1/Nt.width,Cn=1/Nt.height;Tn.x=(Sn.west-Nt.west)*yn,Tn.y=(Sn.south-Nt.south)*Cn,Tn.z=(Sn.east-Nt.west)*yn,Tn.w=(Sn.north-Nt.south)*Cn,oe.clone(Tn,Le.localizedCartographicLimitRectangle),gn.x=(on.west-Nt.west)*yn,gn.y=(on.south-Nt.south)*Cn,gn.z=(on.east-Nt.west)*yn,gn.w=(on.north-Nt.south)*Cn,oe.clone(gn,Le.localizedTranslucencyRectangle);const Ht=R&&N.fog(t._distance,n.fog.density)>N.EPSILON3;L=L&&(Ht||F);let Xt=!1,Mn=!1,ti=!1,en=!1,xi=!1,Yi=!1,Pi=!1,Jn=!1,cn=!1,Vn=!1;for(;ve<s&&ie<de;){const pn=Q[ie],Hi=pn.readyImagery;if(++ie,!l(Hi)||Hi.imageryLayer.alpha===0)continue;const Dn=pn.useWebMercatorT?Hi.textureWebMercator:Hi.texture;if(!l(Dn))throw new x("readyImagery is not actually ready!");const Oi=Hi.imageryLayer;l(pn.textureTranslationAndScale)||(pn.textureTranslationAndScale=Oi._calculateTextureTranslationAndScale(t,pn)),Le.dayTextures[ve]=Dn,Le.dayTextureTranslationAndScale[ve]=pn.textureTranslationAndScale,Le.dayTextureTexCoordsRectangle[ve]=pn.textureCoordinateRectangle,Le.dayTextureUseWebMercatorT[ve]=pn.useWebMercatorT,Le.dayTextureAlpha[ve]=Oi.alpha,Yi=Yi||Le.dayTextureAlpha[ve]!==1,Le.dayTextureNightAlpha[ve]=Oi.nightAlpha,Pi=Pi||Le.dayTextureNightAlpha[ve]!==1,Le.dayTextureDayAlpha[ve]=Oi.dayAlpha,Pi=Pi||Le.dayTextureDayAlpha[ve]!==1,Le.dayTextureBrightness[ve]=Oi.brightness,Xt=Xt||Le.dayTextureBrightness[ve]!==Ln.DEFAULT_BRIGHTNESS,Le.dayTextureContrast[ve]=Oi.contrast,Mn=Mn||Le.dayTextureContrast[ve]!==Ln.DEFAULT_CONTRAST,Le.dayTextureHue[ve]=Oi.hue,ti=ti||Le.dayTextureHue[ve]!==Ln.DEFAULT_HUE,Le.dayTextureSaturation[ve]=Oi.saturation,en=en||Le.dayTextureSaturation[ve]!==Ln.DEFAULT_SATURATION,Le.dayTextureOneOverGamma[ve]=1/Oi.gamma,xi=xi||Le.dayTextureOneOverGamma[ve]!==1/Ln.DEFAULT_GAMMA,Le.dayTextureSplit[ve]=Oi.splitDirection,Jn=Jn||Le.dayTextureSplit[ve]!==0;let bo=Le.dayTextureCutoutRectangles[ve];if(l(bo)||(bo=Le.dayTextureCutoutRectangles[ve]=new oe),oe.clone(oe.ZERO,bo),l(Oi.cutoutRectangle)){const Vi=cw(Nt,Oi.cutoutRectangle),Li=_e.simpleIntersection(Vi,Nt,Uq);cn=l(Li)||cn,bo.x=(Vi.west-Nt.west)*yn,bo.y=(Vi.south-Nt.south)*Cn,bo.z=(Vi.east-Nt.west)*yn,bo.w=(Vi.north-Nt.south)*Cn}let no=Le.colorsToAlpha[ve];l(no)||(no=Le.colorsToAlpha[ve]=new oe);const Dr=l(Oi.colorToAlpha)&&Oi.colorToAlphaThreshold>0;if(Vn=Vn||Dr,Dr){const Vi=Oi.colorToAlpha;no.x=Vi.red,no.y=Vi.green,no.z=Vi.blue,no.w=Oi.colorToAlphaThreshold}else no.w=-1;if(l(Hi.credits)){const Vi=Hi.credits;for(let Li=0,Ir=Vi.length;Li<Ir;++Li)o.addCredit(Vi[Li])}++ve}Le.dayTextures.length=ve,Le.waterMask=a,oe.clone(c,Le.waterMaskTranslationAndScale),Le.minMaxHeight.x=W.minimumHeight,Le.minMaxHeight.y=W.maximumHeight,B.clone(W.matrix,Le.scaleAndBias);const On=e._clippingPlanes,rn=l(On)&&On.enabled&&t.isClipped;rn&&(Le.clippingPlanesEdgeColor=U.clone(On.edgeColor,Le.clippingPlanesEdgeColor),Le.clippingPlanesEdgeWidth=On.edgeWidth),ce.numberOfDayTextures=ve,ce.applyBrightness=Xt,ce.applyContrast=Mn,ce.applyHue=ti,ce.applySaturation=en,ce.applyGamma=xi,ce.applyAlpha=Yi,ce.applyDayNightAlpha=Pi,ce.applySplit=Jn,ce.enableFog=Ht,ce.enableClippingPlanes=rn,ce.clippingPlanes=On,ce.hasImageryLayerCutout=cn,ce.colorCorrect=L,ce.highlightFillTile=Ot,ce.colorToAlpha=Vn,ce.showUndergroundColor=T,ce.translucent=h;let gt=i.renderedMesh.indices.length;me||(gt=i.renderedMesh.indexCountWithoutSkirts),Ie.shaderProgram=e._surfaceShaderSet.getShaderProgram(ce),Ie.castShadows=H,Ie.receiveShadows=v,Ie.renderState=Te,Ie.primitiveType=Je.TRIANGLES,Ie.vertexArray=i.vertexArray||i.fill.vertexArray,Ie.count=gt,Ie.uniformMap=Ve,Ie.pass=Be.GLOBE,e._debug.wireframe&&(ove(De,e,t),l(i.wireframeVertexArray)&&(Ie.vertexArray=i.wireframeVertexArray,Ie.primitiveType=Je.LINES,Ie.count=gt*2));let ke=Ie.boundingVolume;const vn=Ie.orientedBoundingBox;n.mode!==le.SCENE3D?(fe.fromRectangleWithHeights2D(t.rectangle,n.mapProjection,G.minimumHeight,G.maximumHeight,ke),d.fromElements(ke.center.z,ke.center.x,ke.center.y,ke.center),n.mode===le.MORPHING&&(ke=fe.union(G.boundingSphere,ke,ke))):(Ie.boundingVolume=fe.clone(G.boundingSphere,ke),Ie.orientedBoundingBox=Bt.clone(G.boundingVolume,vn)),Ie.dirty=!0,h&&f.updateDerivedCommands(Ie,n),zq(Ie,n),Te=Pe,Oe=sve}while(ie<de)}function Gq(){this._enabled=!1,this._frontFaceAlpha=1,this._frontFaceAlphaByDistance=void 0,this._backFaceAlpha=1,this._backFaceAlphaByDistance=void 0,this._rectangle=_e.clone(_e.MAX_VALUE)}Object.defineProperties(Gq.prototype,{enabled:{get:function(){return this._enabled},set:function(e){b.typeOf.bool("enabled",e),this._enabled=e}},frontFaceAlpha:{get:function(){return this._frontFaceAlpha},set:function(e){b.typeOf.number.greaterThanOrEquals("frontFaceAlpha",e,0),b.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=Mt.clone(e,this._frontFaceAlphaByDistance)}},backFaceAlpha:{get:function(){return this._backFaceAlpha},set:function(e){b.typeOf.number.greaterThanOrEquals("backFaceAlpha",e,0),b.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=Mt.clone(e,this._backFaceAlphaByDistance)}},rectangle:{get:function(){return this._rectangle},set:function(e){l(e)||(e=_e.clone(_e.MAX_VALUE)),_e.clone(e,this._rectangle)}}});function Sr(){this._layers=[],this.layerAdded=new $e,this.layerRemoved=new $e,this.layerMoved=new $e,this.layerShownOrHidden=new $e}Object.defineProperties(Sr.prototype,{length:{get:function(){return this._layers.length}}});Sr.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)};Sr.prototype.addImageryProvider=function(e,t){if(!l(e))throw new x("imageryProvider is required.");const n=new Ln(e);return this.add(n,t),n};Sr.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};Sr.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=[]};Sr.prototype.contains=function(e){return this.indexOf(e)!==-1};Sr.prototype.indexOf=function(e){return this._layers.indexOf(e)};Sr.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._layers[e]};function Lv(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 Wq(e,t,n){const i=e._layers;if(t=N.clamp(t,0,i.length-1),n=N.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)}Sr.prototype.raise=function(e){const t=Lv(this._layers,e);Wq(this,t,t+1)};Sr.prototype.lower=function(e){const t=Lv(this._layers,e);Wq(this,t,t-1)};Sr.prototype.raiseToTop=function(e){const t=Lv(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))};Sr.prototype.lowerToBottom=function(e){const t=Lv(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 fve=new _e;function jq(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];_e.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 f=u.imageryLayer.imageryProvider;if(n&&!l(f.pickFeatures)||!_e.contains(u.rectangle,t))continue;const h=fve,_=1/1024;h.west=N.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.x-_),h.east=N.lerp(r.rectangle.west,r.rectangle.east,c.textureCoordinateRectangle.z+_),h.south=N.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.y-_),h.north=N.lerp(r.rectangle.south,r.rectangle.north,c.textureCoordinateRectangle.w+_),_e.contains(h,t)&&i(u)}}Sr.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(jq(t,i,!1,function(r){o.push(r.imageryLayer)}),o.length!==0)return o};Sr.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(jq(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],f=r[c];if(l(u)&&u.length>0)for(let h=0;h<u.length;++h){const _=u[h];_.imageryLayer=f,l(_.position)||(_.position=i),a.push(_)}}return a})};Sr.prototype.queueReprojectionCommands=function(e){const t=this._layers;for(let n=0,i=t.length;n<i;++n)t[n].queueReprojectionCommands(e)};Sr.prototype.cancelReprojections=function(){const e=this._layers;for(let t=0,n=e.length;t<n;++t)e[t].cancelReprojections()};Sr.prototype.isDestroyed=function(){return!1};Sr.prototype.destroy=function(){return this.removeAll(!0),Ue(this)};Sr.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 qq(e){this._ellipsoid=new cl(e.ellipsoid,d.ZERO)}Object.defineProperties(qq.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});function _a(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=qn.NONE,this._lastSelectionResultFrame=void 0,this._loadedCallbacks={},this.state=nl.START,this.renderable=!1,this.upsampledFromParent=!1,this.data=void 0}_a.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 _a({tilingScheme:e,x:s,y:r,level:0});return i};_a.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],_e.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],_e.contains(s,r.positionCartographic)&&i.push(r);this._frameUpdated=a._frameUpdated}}};Object.defineProperties(_a.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 _a({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 _a({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 _a({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 _a({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<nl.DONE}},eligibleForUnloading:{get:function(){let e=!0;return l(this.data)&&(e=this.data.eligibleForUnloading,l(e)||(e=!0)),e}}});_a.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]};_a.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};_a.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};_a.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};_a.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};_a.prototype.freeResources=function(){this.state=nl.START,this.renderable=!1,this.upsampledFromParent=!1,l(this.data)&&l(this.data.freeResources)&&this.data.freeResources(),OE(this._southwestChild),this._southwestChild=void 0,OE(this._southeastChild),this._southeastChild=void 0,OE(this._northwestChild),this._northwestChild=void 0,OE(this._northeastChild),this._northeastChild=void 0};function OE(e){l(e)&&e.freeResources()}function Bv(){this.head=void 0,this.tail=void 0,this.count=0,this._lastBeforeStartOfFrame=void 0}Bv.prototype.markStartOfRenderFrame=function(){this._lastBeforeStartOfFrame=this.head};Bv.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(),Yq(this,t)),t=i}};function Yq(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}Bv.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))&&Yq(this,e),e.replacementPrevious=void 0,e.replacementNext=t,t.replacementPrevious=e,this.head=e};function ll(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 Bv,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 qq({ellipsoid:n}),this._tileLoadProgressEvent=new $e,this._lastTileLoadQueueLength=0,this._lastSelectionFrameNumber=void 0}Object.defineProperties(ll.prototype,{tileProvider:{get:function(){return this._tileProvider}},tileLoadProgressEvent:{get:function(){return this._tileLoadProgressEvent}},occluders:{get:function(){return this._occluders}}});ll.prototype.invalidateAllTiles=function(){this._tilesInvalidated=!0};function dve(e){const t=e._tileReplacementQueue;t.head=void 0,t.tail=void 0,t.count=0,$q(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()}ll.prototype.forEachLoadedTile=function(e){let t=this._tileReplacementQueue.head;for(;l(t);)t.state!==nl.START&&e(t),t=t.replacementNext};ll.prototype.forEachRenderedTile=function(e){const t=this._tilesToRender;for(let n=0,i=t.length;n<i;++n)e(t[n])};ll.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};ll.prototype.update=function(e){l(this._tileProvider.update)&&this._tileProvider.update(e)};function $q(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}ll.prototype.beginFrame=function(e){e.passes.render&&(this._tilesInvalidated&&(dve(this),this._tilesInvalidated=!1),this._tileProvider.initialize(e),$q(this),!this._debug.suspendLodUpdate&&this._tileReplacementQueue.markStartOfRenderFrame())};ll.prototype.render=function(e){const t=e.passes,n=this._tileProvider;t.render&&(n.beginUpdate(e),_ve(this,e),Sve(this,e),n.endUpdate(e)),t.pick&&this._tilesToRender.length>0&&n.updateForPick(e)};function hve(e,t){const n=e._tileLoadQueueHigh.length+e._tileLoadQueueMedium.length+e._tileLoadQueueLow.length;if(n!==e._lastTileLoadQueueLength||e._tilesInvalidated){const o=$e.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))}ll.prototype.endFrame=function(e){!e.passes.render||e.mode===le.MORPHING||(bve(this,e),wve(this,e),hve(this,e))};ll.prototype.isDestroyed=function(){return!1};ll.prototype.destroy=function(){this._tileProvider=this._tileProvider&&this._tileProvider.destroy()};let OA;const vH=new Ae;function pve(e,t){let n=_e.center(e.rectangle,vH);const i=n.longitude-OA.longitude,o=n.latitude-OA.latitude;n=_e.center(t.rectangle,vH);const r=n.longitude-OA.longitude,s=n.latitude-OA.latitude;return i*i+o*o-(r*r+s*s)}const mve=new d;let G0=[];function _ve(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=_a.createLevelZeroTiles(y);const C=e._levelZeroTiles.length;if(G0.length<C)for(G0=new Array(C),o=0;o<C;++o)G0[o]===void 0&&(G0[o]=new LA)}else return;e._occluders.ellipsoid.cameraPosition=t.camera.positionWC;let s;const a=e._levelZeroTiles,c=a.length>1?e._occluders:void 0;OA=t.camera.positionCartographic,a.sort(pve);const u=e._addHeightCallbacks,f=e._removeHeightCallbacks,h=t.frameNumber;let _;if(u.length>0||f.length>0){for(o=0,_=a.length;o<_;++o)s=a[o],s._updateCustomData(h,u,f);u.length=0,f.length=0}const g=t.camera;e._cameraPositionCartographic=g.positionCartographic;const p=B.getTranslation(g.transform,mve);for(e._cameraReferenceFrameOriginCartographic=e.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(p,e._cameraReferenceFrameOriginCartographic),o=0,_=a.length;o<_;++o)s=a[o],e._tileReplacementQueue.markTileRendered(s),s.renderable?ls(e,s,r,t,c,!1,G0[o]):(zf(e,e._tileLoadQueueHigh,s,t),++n.tilesWaitingForChildren);e._lastSelectionFrameNumber=h}function zf(e,t,n,i){n.needsLoading&&(e.tileProvider.computeTileLoadPriority!==void 0&&(n._loadPriority=e.tileProvider.computeTileLoadPriority(n,i)),t.push(n))}function LA(){this.allAreRenderable=!0,this.anyWereRenderedLastFrame=!1,this.notYetRenderableCount=0}function Xq(){this.southwest=new LA,this.southeast=new LA,this.northwest=new LA,this.northeast=new LA}Xq.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 YL=new Array(31);for(let e=0;e<YL.length;++e)YL[e]=new Xq;function gve(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=Cve(e,t,n)<e.maximumScreenSpaceError,a=n.southwestChild,c=n.southeastChild,u=n.northwestChild,f=n.northeastChild,h=e._lastSelectionFrameNumber,_=n._lastSelectionResultFrame===h?n._lastSelectionResult:qn.NONE,g=e.tileProvider;if(s||i){const p=qn.originalResult(_)===qn.RENDERED,y=qn.originalResult(_)===qn.CULLED||_===qn.NONE,C=n.state===nl.DONE;let T=p||y||C;if(T||l(g.canRenderWithoutLosingDetail)&&(T=g.canRenderWithoutLosingDetail(n)),T){s&&zf(e,e._tileLoadQueueMedium,n,t),LE(e,n),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===qn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=qn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}i=!0,s&&zf(e,e._tileLoadQueueHigh,n,t)}if(g.canRefine(n)){if(a.upsampledFromParent&&c.upsampledFromParent&&u.upsampledFromParent&&f.upsampledFromParent){LE(e,n),zf(e,e._tileLoadQueueMedium,n,t),e._tileReplacementQueue.markTileRendered(a),e._tileReplacementQueue.markTileRendered(c),e._tileReplacementQueue.markTileRendered(u),e._tileReplacementQueue.markTileRendered(f),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===qn.RENDERED,o.notYetRenderableCount=n.renderable?0:1,n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=qn.RENDERED,o.anyWereRenderedLastFrame||e._tileToUpdateHeights.push(n);return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=qn.REFINED;const y=e._tilesToRender.length,C=e._tileLoadQueueLow.length,T=e._tileLoadQueueMedium.length,E=e._tileLoadQueueHigh.length,w=e._tileToUpdateHeights.length;if(yve(e,a,c,u,f,t,i,o),y!==e._tilesToRender.length){const S=o.allAreRenderable,P=o.anyWereRenderedLastFrame,O=o.notYetRenderableCount;let z=!1;if(!S&&!P){const R=e._tilesToRender;for(let H=y;H<R.length;++H){let v=R[H];for(;v!==void 0&&v._lastSelectionResult!==qn.KICKED&&v!==n;)v._lastSelectionResult=qn.kick(v._lastSelectionResult),v=v.parent}e._tilesToRender.length=y,e._tileToUpdateHeights.length=w,LE(e,n),n._lastSelectionResult=qn.RENDERED;const F=_===qn.RENDERED;!F&&O>e.loadingDescendantLimit&&(e._tileLoadQueueLow.length=C,e._tileLoadQueueMedium.length=T,e._tileLoadQueueHigh.length=E,zf(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&&zf(e,e._tileLoadQueueLow,n,t)}return}n._lastSelectionResultFrame=t.frameNumber,n._lastSelectionResult=qn.RENDERED,LE(e,n),zf(e,e._tileLoadQueueHigh,n,t),o.allAreRenderable=n.renderable,o.anyWereRenderedLastFrame=_===qn.RENDERED,o.notYetRenderableCount=n.renderable?0:1}function yve(e,t,n,i,o,r,s,a){const c=r.camera.positionCartographic,u=e._tileProvider,f=e._occluders,h=YL[t.level],_=h.southwest,g=h.southeast,p=h.northwest,y=h.northeast;c.longitude<t.rectangle.east?c.latitude<t.rectangle.north?(ls(e,t,u,r,f,s,_),ls(e,n,u,r,f,s,g),ls(e,i,u,r,f,s,p),ls(e,o,u,r,f,s,y)):(ls(e,i,u,r,f,s,p),ls(e,t,u,r,f,s,_),ls(e,o,u,r,f,s,y),ls(e,n,u,r,f,s,g)):c.latitude<t.rectangle.north?(ls(e,n,u,r,f,s,g),ls(e,t,u,r,f,s,_),ls(e,o,u,r,f,s,y),ls(e,i,u,r,f,s,p)):(ls(e,o,u,r,f,s,y),ls(e,i,u,r,f,s,p),ls(e,n,u,r,f,s,g),ls(e,t,u,r,f,s,_)),h.combine(a)}function Ave(e,t){const n=t.rectangle;return l(e._cameraPositionCartographic)&&_e.contains(n,e._cameraPositionCartographic)||l(e._cameraReferenceFrameOriginCartographic)&&_e.contains(n,e._cameraReferenceFrameOriginCartographic)}function ls(e,t,n,i,o,r,s){if(n.computeTileVisibility(t,i,o)!==Br.NONE)return gve(e,i,t,r,s);if(++e._debug.tilesCulled,e._tileReplacementQueue.markTileRendered(t),s.allAreRenderable=!0,s.anyWereRenderedLastFrame=!1,s.notYetRenderableCount=0,Ave(e,t)){(!l(t.data)||!l(t.data.vertexArray))&&zf(e,e._tileLoadQueueMedium,t,i);const a=e._lastSelectionFrameNumber,c=t._lastSelectionResultFrame===a?t._lastSelectionResult:qn.NONE;c!==qn.CULLED_BUT_NEEDED&&c!==qn.RENDERED&&e._tileToUpdateHeights.push(t),t._lastSelectionResult=qn.CULLED_BUT_NEEDED}else(e.preloadSiblings||t.level===0)&&zf(e,e._tileLoadQueueLow,t,i),t._lastSelectionResult=qn.CULLED;t._lastSelectionResultFrame=i.frameNumber}function Cve(e,t,n){if(t.mode===le.SCENE2D||t.camera.frustum instanceof Ft||t.camera.frustum instanceof Bo)return Tve(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-=N.fog(o,t.fog.density)*t.fog.sse),a/=t.pixelRatio,a}function Tve(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 f=c/u;return t.fog.enabled&&t.mode!==le.SCENE2D&&(f-=N.fog(n._distance,t.fog.density)*t.fog.sse),f/=t.pixelRatio,f}function LE(e,t){e._tilesToRender.push(t)}function bve(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=er()+e._loadQueueTimeSlice,s=e._tileProvider;let a=aP(e,t,s,r,n,!1);a=aP(e,t,s,r,i,a),aP(e,t,s,r,o,a)}function Eve(e,t){return e._loadPriority-t._loadPriority}function aP(e,t,n,i,o,r){n.computeTileLoadPriority!==void 0&&o.sort(Eve);for(let s=0,a=o.length;s<a&&(er()<i||!r);++s){const c=o[s];e._tileReplacementQueue.markTileRendered(c),n.loadTile(t,c),r=!0}return r}const sg=new Pn,cP=new Ae,nh=new d,xve=[];function wve(e,t){if(!e.tileProvider.ready)return;const n=xve;n.length=0;const i=e._tileToUpdateHeights,o=er(),r=e._updateHeightsTimeSlice,s=o+r,a=t.mode,c=t.mapProjection,u=e.tileProvider.tilingScheme.ellipsoid;let f;for(;i.length>0;){const h=i[0];if(!l(h.data)||!l(h.data.mesh)){const y=h._lastSelectionResultFrame===e._lastSelectionFrameNumber?h._lastSelectionResult:qn.NONE;(y===qn.RENDERED||y===qn.CULLED_BUT_NEEDED)&&n.push(h),i.shift(),e._lastTileIndex=0;continue}const _=h.customData,g=_.length;let p=!1;for(f=e._lastTileIndex;f<g;++f){const y=_[f],C=h.data.terrainData,T=l(C)&&C.wasCreatedByUpsampling();if(h.level>y.level&&!T){if(l(y.positionOnEllipsoidSurface)||(y.positionOnEllipsoidSurface=d.fromRadians(y.positionCartographic.longitude,y.positionCartographic.latitude,0,u)),a===le.SCENE3D){const w=u.geodeticSurfaceNormal(y.positionOnEllipsoidSurface,sg.direction),S=u.getSurfaceNormalIntersectionWithZAxis(y.positionOnEllipsoidSurface,11500,sg.origin);if(!l(S)){let P=0;l(h.data.tileBoundingRegion)&&(P=h.data.tileBoundingRegion.minimumHeight);const O=Math.min(P,-11500),z=d.multiplyByScalar(w,Math.abs(O)+1,nh);d.subtract(y.positionOnEllipsoidSurface,z,sg.origin)}}else Ae.clone(y.positionCartographic,cP),cP.height=-11500,c.project(cP,nh),d.fromElements(nh.z,nh.x,nh.y,nh),d.clone(nh,sg.origin),d.clone(d.UNIT_X,sg.direction);const E=h.data.pick(sg,a,c,!1,nh);l(E)&&(l(y.callback)&&y.callback(E),y.level=h.level)}if(er()>=s){p=!0;break}}if(p){e._lastTileIndex=f;break}else e._lastTileIndex=0,i.shift()}for(f=0;f<n.length;f++)i.push(n[f])}function Sve(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 ru(e){e=A(e,pe.WGS84);const t=new wp({ellipsoid:e}),n=new Sr;this._ellipsoid=e,this._imageryLayerCollection=n,this._surfaceShaderSet=new YN,this._material=void 0,this._surface=new ll({tileProvider:new oo({terrainProvider:t,imageryLayers:n,surfaceShaderSet:this._surfaceShaderSet})}),this._terrainProvider=t,this._terrainProviderChanged=new $e,this._undergroundColor=U.clone(U.BLACK),this._undergroundColorAlphaByDistance=new Mt(e.maximumRadius/1e3,0,e.maximumRadius/5,1),this._translucency=new Gq,$L(this),this.show=!0,this._oceanNormalMapResourceDirty=!0,this._oceanNormalMapResource=new Re({url:dn("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 d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.lightingFadeOutDistance=1e7,this.lightingFadeInDistance=2e7,this.nightFadeOutDistance=1e7,this.nightFadeInDistance=5e7,this.showWaterEffect=!0,this.depthTestAgainstTerrain=!1,this.shadows=Co.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(ru.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=_e.clone(_e.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)&&$L(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,$L(this))}},undergroundColor:{get:function(){return this._undergroundColor},set:function(e){this._undergroundColor=U.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=Mt.clone(e,this._undergroundColorAlphaByDistance)}},translucency:{get:function(){return this._translucency}}});function $L(e){const t=[],n=l(e._material)&&(e._material.shaderSource.match(/slope/)||e._material.shaderSource.match("normalEC")),i=[aS,Kz];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(aAe),e._surfaceShaderSet.baseVertexShaderSource=new Ge({sources:[aS,Kz,cAe],defines:t}),e._surfaceShaderSet.baseFragmentShaderSource=new Ge({sources:i,defines:t}),e._surfaceShaderSet.material=e._material}function vve(e){return function(t,n){const i=fe.distanceSquaredTo(t.pickBoundingSphere,e),o=fe.distanceSquaredTo(n.pickBoundingSphere,e);return i-o}}const Dve=[],Ive={start:0,stop:0};ru.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=Dve;s.length=0;const a=this._surface._tilesToRender;let c=a.length,u,f;for(f=0;f<c;++f){u=a[f];const _=u.data;if(!l(_))continue;let g=_.pickBoundingSphere;if(o!==le.SCENE3D)_.pickBoundingSphere=g=fe.fromRectangleWithHeights2D(u.rectangle,r,_.tileBoundingRegion.minimumHeight,_.tileBoundingRegion.maximumHeight,g),d.fromElements(g.center.z,g.center.x,g.center.y,g.center);else if(l(_.renderedMesh))fe.clone(_.tileBoundingRegion.boundingSphere,g);else continue;const p=nr.raySphere(e,g,Ive);l(p)&&s.push(_)}s.sort(vve(e.origin));let h;for(c=s.length,f=0;f<c&&(h=s[f].pick(e,t.mode,t.mapProjection,n,i),!l(h));++f);return h};const Pve=new Ae;ru.prototype.pick=function(e,t,n){if(n=this.pickWorldCoordinates(e,t,!0,n),l(n)&&t.mode!==le.SCENE3D){n=d.fromElements(n.y,n.z,n.x,n);const i=t.mapProjection.unproject(n,Pve);n=t.globe.ellipsoid.cartographicToCartesian(i,n)}return n};const Ove=new d,DH=new d,Lve=new Ae,Bve=new Pn;function lP(e,t){return l(e)&&_e.contains(e.rectangle,t)?e:void 0}ru.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],!_e.contains(n.rectangle,e));++i);if(i>=o)return;let r=n;for(;l(n);)n=lP(n._southwestChild,e)||lP(n._southeastChild,e)||lP(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=d.fromRadians(e.longitude,e.latitude,0,a,Ove),u=Bve,f=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=d.multiplyByScalar(f,Math.abs(p)+1,DH);d.subtract(c,y,u.origin)}const _=n.data.pick(u,void 0,s,!1,DH);if(l(_))return a.cartesianToCartographic(_,Lve).height};ru.prototype.update=function(e){this.show&&e.passes.render&&this._surface.update(e)};ru.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(f){c===u._oceanNormalMapResource.url&&(u._oceanNormalMap=u._oceanNormalMap&&u._oceanNormalMap.destroy(),u._oceanNormalMap=new zt({context:e.context,source:f}))})}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))};ru.prototype.render=function(e){this.show&&(l(this._material)&&this._material.update(e.context),this._surface.render(e))};ru.prototype.endFrame=function(e){this.show&&e.passes.render&&this._surface.endFrame(e)};ru.prototype.isDestroyed=function(){return!1};ru.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(),Ue(this)};function Rve(e,t,n,i){this.rightAscension=e,this.declination=t,this.rotation=n,this.rotationRate=i}const Kq={},Nve=32.184,Mve=2451545,IH=-.0529921,PH=-.1059842,OH=13.0120009,LH=13.3407154,BH=.9856003,RH=26.4057084,NH=13.064993,MH=.3287146,FH=1.7484877,zH=-.1589763,UH=.0036096,HH=.1643573,VH=12.9590088;let uP=new ne;Kq.ComputeMoon=function(e,t){l(e)||(e=ne.now()),uP=ne.addSeconds(e,Nve,uP);const n=ne.totalDays(uP)-Mve,i=n/Ti.DAYS_PER_JULIAN_CENTURY,o=(125.045+IH*n)*N.RADIANS_PER_DEGREE,r=(250.089+PH*n)*N.RADIANS_PER_DEGREE,s=(260.008+OH*n)*N.RADIANS_PER_DEGREE,a=(176.625+LH*n)*N.RADIANS_PER_DEGREE,c=(357.529+BH*n)*N.RADIANS_PER_DEGREE,u=(311.589+RH*n)*N.RADIANS_PER_DEGREE,f=(134.963+NH*n)*N.RADIANS_PER_DEGREE,h=(276.617+MH*n)*N.RADIANS_PER_DEGREE,_=(34.226+FH*n)*N.RADIANS_PER_DEGREE,g=(15.134+zH*n)*N.RADIANS_PER_DEGREE,p=(119.743+UH*n)*N.RADIANS_PER_DEGREE,y=(239.961+HH*n)*N.RADIANS_PER_DEGREE,C=(25.053+VH*n)*N.RADIANS_PER_DEGREE,T=Math.sin(o),E=Math.sin(r),w=Math.sin(s),S=Math.sin(a),P=Math.sin(c),O=Math.sin(u),z=Math.sin(f),R=Math.sin(h),F=Math.sin(_),H=Math.sin(g),v=Math.sin(p),I=Math.sin(y),m=Math.sin(C),D=Math.cos(o),L=Math.cos(r),M=Math.cos(s),V=Math.cos(a),k=Math.cos(c),W=Math.cos(u),G=Math.cos(f),K=Math.cos(h),q=Math.cos(_),te=Math.cos(g),$=Math.cos(p),X=Math.cos(y),Y=Math.cos(C),ae=(269.9949+.0031*i-3.8787*T-.1204*E+.07*w-.0172*S+.0072*O-.0052*H+.0043*m)*N.RADIANS_PER_DEGREE,ue=(66.5392+.013*i+1.5419*D+.0239*L-.0278*M+.0068*V-.0029*W+9e-4*G+8e-4*te-9e-4*Y)*N.RADIANS_PER_DEGREE,re=(38.3213+13.17635815*n-14e-13*n*n+3.561*T+.1208*E-.0642*w+.0158*S+.0252*P-.0066*O-.0047*z-.0046*R+.0028*F+.0052*H+.004*v+.0019*I-.0044*m)*N.RADIANS_PER_DEGREE,he=(13.17635815-14e-13*(2*n)+3.561*D*IH+.1208*L*PH-.0642*M*OH+.0158*V*LH+.0252*k*BH-.0066*W*RH-.0047*G*NH-.0046*K*MH+.0028*q*FH+.0052*te*zH+.004*$*UH+.0019*X*HH-.0044*Y*VH)/86400*N.RADIANS_PER_DEGREE;return l(t)||(t=new Rve),t.rightAscension=ae,t.declination=ue,t.rotation=re,t.rotationRate=he,t};const Fve=Kq;function Jq(e){(!l(e)||typeof e!="function")&&(e=Fve.ComputeMoon),this._computeFunction=e}const zve=new d,Uve=new d,Hve=new d;function Vve(e,t,n){const i=zve;i.x=Math.cos(e+N.PI_OVER_TWO),i.y=Math.sin(e+N.PI_OVER_TWO),i.z=0;const o=Math.cos(t),r=Hve;r.x=o*Math.cos(e),r.y=o*Math.sin(e),r.z=Math.sin(t);const s=d.cross(r,i,Uve);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 kve=new J,Gve=new Ce;Jq.prototype.evaluate=function(e,t){l(e)||(e=ne.now());const n=this._computeFunction(e),i=Vve(n.rightAscension,n.declination,t),o=N.zeroToTwoPi(n.rotation),r=Ce.fromAxisAngle(d.UNIT_Z,o,Gve),s=J.fromQuaternion(Ce.conjugate(r,r),kve);return J.multiply(s,i,i)};const Wve=new d;function Mr(e){e=A(e,A.EMPTY_OBJECT);const t=e.minimum,n=e.maximum;if(b.typeOf.object("min",t),b.typeOf.object("max",n),l(e.offsetAttribute)&&e.offsetAttribute===fn.TOP)throw new x("GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry.");const i=A(e.vertexFormat,Ne.DEFAULT);this._minimum=d.clone(t),this._maximum=d.clone(n),this._vertexFormat=i,this._offsetAttribute=e.offsetAttribute,this._workerName="createBoxGeometry"}Mr.fromDimensions=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.dimensions;b.typeOf.object("dimensions",t),b.typeOf.number.greaterThanOrEquals("dimensions.x",t.x,0),b.typeOf.number.greaterThanOrEquals("dimensions.y",t.y,0),b.typeOf.number.greaterThanOrEquals("dimensions.z",t.z,0);const n=d.multiplyByScalar(t,.5,new d);return new Mr({minimum:d.negate(n,new d),maximum:n,vertexFormat:e.vertexFormat,offsetAttribute:e.offsetAttribute})};Mr.fromAxisAlignedBoundingBox=function(e){return b.typeOf.object("boundingBox",e),new Mr({minimum:e.minimum,maximum:e.maximum})};Mr.packedLength=2*d.packedLength+Ne.packedLength+1;Mr.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),d.pack(e._minimum,t,n),d.pack(e._maximum,t,n+d.packedLength),Ne.pack(e._vertexFormat,t,n+2*d.packedLength),t[n+2*d.packedLength+Ne.packedLength]=A(e._offsetAttribute,-1),t};const Qq=new d,Zq=new d,e7=new Ne,kH={minimum:Qq,maximum:Zq,vertexFormat:e7,offsetAttribute:void 0};Mr.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=d.unpack(e,t,Qq),o=d.unpack(e,t+d.packedLength,Zq),r=Ne.unpack(e,t+2*d.packedLength,e7),s=e[t+2*d.packedLength+Ne.packedLength];return l(n)?(n._minimum=d.clone(i,n._minimum),n._maximum=d.clone(o,n._maximum),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._offsetAttribute=s===-1?void 0:s,n):(kH.offsetAttribute=s===-1?void 0:s,new Mr(kH))};Mr.createGeometry=function(e){const t=e._minimum,n=e._maximum,i=e._vertexFormat;if(d.equals(t,n))return;const o=new Ui;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 ze({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 ze({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 ze({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 ze({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 ze({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 ze({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=d.subtract(n,t,Wve),c=d.magnitude(a)*.5;if(l(e._offsetAttribute)){const u=s.length,f=e._offsetAttribute===fn.NONE?0:1,h=new Uint8Array(u/3).fill(f);o.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return new Dt({attributes:o,indices:r,primitiveType:Je.TRIANGLES,boundingSphere:new fe(d.ZERO,c),offsetAttribute:e._offsetAttribute})};let fP;Mr.getUnitBox=function(){return l(fP)||(fP=Mr.createGeometry(Mr.fromDimensions({dimensions:new d(1,1,1),vertexFormat:Ne.POSITION_ONLY}))),fP};const jve=`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;
}
`,qve=`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;
}
`,Yve=`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;
}
`,$ve=`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;
}
`,Xve=`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;
}
`,Kve=`#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;
}
`,Jve=`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;
}
`,Qve=`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;
}
`,Zve=`#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;
}
`,eDe=`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;
}
`,tDe=`#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;
}
`,nDe=`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;
}
`,iDe=`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;
}
`,oDe=`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;
}
`,rDe=`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;
}
`,sDe=`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;
}
`,aDe=`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;
}
`,cDe=`// 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 Fe(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,An.LINEAR),this._magnificationFilter=A(e.magnificationFilter,Hr.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,lDe(e,this),Object.defineProperties(this,{type:{value:this.type,writable:!1}}),l(Fe._uniformList[this.type])||(Fe._uniformList[this.type]=Object.keys(this._uniforms))}Fe._uniformList={};Fe.fromType=function(e,t){if(!l(Fe._materialCache.getMaterial(e)))throw new x(`material with type '${e}' does not exist.`);const n=new Fe({fabric:{type:e}});if(l(t))for(const i in t)t.hasOwnProperty(i)&&(n.uniforms[i]=t[i]);return n};Fe.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};Fe.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,f;Array.isArray(u)&&(f=u.slice(1,u.length).map(function(y){return y.bufferView}),u=u[0]);const h=new Yn({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter});let _;l(u.internalFormat)?_=new zt({context:e,pixelFormat:u.internalFormat,width:u.width,height:u.height,source:{arrayBufferView:u.bufferView,mipLevels:f},sampler:h}):_=new zt({context:e,source:u,sampler:h});const g=this._textures[n];l(g)&&g!==this._defaultTexture&&g.destroy(),this._textures[n]=_;const p=`${n}Dimensions`;if(this.uniforms.hasOwnProperty(p)){const y=this.uniforms[p];y.x=_._width,y.y=_._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,f=new nu({context:e,source:{positiveX:u[0],negativeX:u[1],positiveY:u[2],negativeY:u[3],positiveZ:u[4],negativeZ:u[5]},sampler:new Yn({minificationFilter:this._minificationFilter,magnificationFilter:this._magnificationFilter})});this._textures[n]=f}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)};Fe.prototype.isDestroyed=function(){return!1};Fe.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 Ue(this)};function lDe(e,t){e=A(e,A.EMPTY_OBJECT),t._strict=A(e.strict,!1),t._count=A(e.count,0),t._template=ut(A(e.fabric,A.EMPTY_OBJECT)),t._template.uniforms=ut(A(t._template.uniforms,A.EMPTY_OBJECT)),t._template.materials=ut(A(t._template.materials,A.EMPTY_OBJECT)),t.type=l(t._template.type)?t._template.type:Es(),t.shaderSource="",t.materials={},t.uniforms={},t._uniforms={},t._translucentFunctions=[];let n;const i=Fe._materialCache.getMaterial(t.type);if(l(i)){const r=ut(i.fabric,!0);t._template=sn(t._template,r,!0),n=i.translucent}hDe(t),l(i)||Fe._materialCache.addMaterial(t.type,t),mDe(t),ADe(t),TDe(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 dP(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 GH(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 uDe(e,t){const n=`fabric: uniforms and materials cannot share the same property '${e}'`;throw new x(n)}const fDe=["type","materials","uniforms","components","source"],dDe=["diffuse","specular","shininess","normal","emission","alpha"];function hDe(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.");dP(t,fDe,GH,!0),dP(o,dDe,GH,!0);const r=[];for(const s in i)i.hasOwnProperty(s)&&r.push(s);dP(n,r,uDe,!1)}function pDe(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 mDe(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&&pDe(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 WH={mat2:at,mat3:J,mat4:B},_De=/\.ktx2$/i;function gDe(e){let t;return function(n,i){const o=n.uniforms,r=o[e],s=t!==r,a=!l(r)||r===Fe.DefaultImageId;t=r;let c=n._textures[e],u,f;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 _=new Yn({minificationFilter:n._minificationFilter,magnificationFilter:n._magnificationFilter});c=new zt({context:i,source:r,sampler:_}),n._textures[e]=c;return}c.copyFrom({source:r})}else l(c)||(n._textures[e]=i.defaultTexture);return}if(r instanceof zt&&r!==c){n._texturePaths[e]=void 0;const _=n._textures[e];l(_)&&_!==n._defaultTexture&&_.destroy(),n._textures[e]=r,u=`${e}Dimensions`,o.hasOwnProperty(u)&&(f=o[u],f.x=r._width,f.y=r._height);return}if(s&&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)&&(f=o[u],f.x=c._width,f.y=c._height)),a)return;const h=r instanceof Re;if(!l(n._texturePaths[e])||h&&r.url!==n._texturePaths[e].url||!h&&r!==n._texturePaths[e]){if(typeof r=="string"||h){const _=h?r:Re.createIfNeeded(r);let g;_De.test(_.url)?g=b_(_.url):g=_.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 yDe(e){return function(t,n){const i=t.uniforms[e];if(i instanceof nu){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===Fe.DefaultCubeMapId)return;const o=i.positiveX+i.negativeX+i.positiveY+i.negativeY+i.positiveZ+i.negativeZ;if(o!==t._texturePaths[e]){const r=[Re.createIfNeeded(i.positiveX).fetchImage(),Re.createIfNeeded(i.negativeX).fetchImage(),Re.createIfNeeded(i.positiveY).fetchImage(),Re.createIfNeeded(i.negativeY).fetchImage(),Re.createIfNeeded(i.positiveZ).fetchImage(),Re.createIfNeeded(i.negativeZ).fetchImage()];Promise.all(r).then(function(s){t._loadedCubeMaps.push({id:e,images:s})}),t._texturePaths[e]=o}}}function ADe(e){const t=e._template.uniforms;for(const n in t)t.hasOwnProperty(n)&&t7(e,n)}function t7(e,t){const n=e._strict,i=e._template.uniforms,o=i[t],r=CDe(o);if(!l(r))throw new x(`fabric: uniform '${t}' has invalid type.`);let s;if(r==="channels"){if(s=GC(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`;bDe(e,u)>0&&(i[u]={type:"ivec3",x:1,y:1},t7(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=GC(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(gDe(t));else if(r==="samplerCube")e._uniforms[c]=function(){return e._textures[t]},e._updateFunctions.push(yDe(t));else if(r.indexOf("mat")!==-1){const u=new WH[r];e._uniforms[c]=function(){return WH[r].fromColumnMajorArray(e.uniforms[t],u)}}else e._uniforms[c]=function(){return e.uniforms[t]}}}function CDe(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 Re||e instanceof HTMLCanvasElement||e instanceof HTMLImageElement)/^([rgba]){1,4}$/i.test(e)?t="channels":e===Fe.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 TDe(e){const t=e._strict,n=e._template.materials;for(const i in n)if(n.hasOwnProperty(i)){const o=new Fe({strict:t,fabric:n[i],count:e._count});e._count=o._count,e._uniforms=sn(e._uniforms,o._uniforms,!0),e.materials[i]=o,e._translucentFunctions=e._translucentFunctions.concat(o._translucentFunctions);const r="czm_getMaterial",s=`${r}_${e._count++}`;GC(o,r,s),e.shaderSource=o.shaderSource+e.shaderSource;const a=`${s}(materialInput)`;if(GC(e,i,a)===0&&t)throw new x(`strict: shader source does not use material '${i}'.`)}}function GC(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,f){return u||f?c:(o+=1,n)}),o}function bDe(e,t,n){return GC(e,t,t,n)}Fe._materialCache={_materials:{},addMaterial:function(e,t){this._materials[e]=t},getMaterial:function(e){return this._materials[e]}};Fe.DefaultImageId="czm_defaultImage";Fe.DefaultCubeMapId="czm_defaultCubeMap";Fe.ColorType="Color";Fe._materialCache.addMaterial(Fe.ColorType,{fabric:{type:Fe.ColorType,uniforms:{color:new U(1,0,0,.5)},components:{diffuse:"color.rgb",alpha:"color.a"}},translucent:function(e){return e.uniforms.color.alpha<1}});Fe.ImageType="Image";Fe._materialCache.addMaterial(Fe.ImageType,{fabric:{type:Fe.ImageType,uniforms:{image:Fe.DefaultImageId,repeat:new j(1,1),color:new U(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}});Fe.DiffuseMapType="DiffuseMap";Fe._materialCache.addMaterial(Fe.DiffuseMapType,{fabric:{type:Fe.DiffuseMapType,uniforms:{image:Fe.DefaultImageId,channels:"rgb",repeat:new j(1,1)},components:{diffuse:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Fe.AlphaMapType="AlphaMap";Fe._materialCache.addMaterial(Fe.AlphaMapType,{fabric:{type:Fe.AlphaMapType,uniforms:{image:Fe.DefaultImageId,channel:"a",repeat:new j(1,1)},components:{alpha:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!0});Fe.SpecularMapType="SpecularMap";Fe._materialCache.addMaterial(Fe.SpecularMapType,{fabric:{type:Fe.SpecularMapType,uniforms:{image:Fe.DefaultImageId,channel:"r",repeat:new j(1,1)},components:{specular:"texture2D(image, fract(repeat * materialInput.st)).channel"}},translucent:!1});Fe.EmissionMapType="EmissionMap";Fe._materialCache.addMaterial(Fe.EmissionMapType,{fabric:{type:Fe.EmissionMapType,uniforms:{image:Fe.DefaultImageId,channels:"rgb",repeat:new j(1,1)},components:{emission:"texture2D(image, fract(repeat * materialInput.st)).channels"}},translucent:!1});Fe.BumpMapType="BumpMap";Fe._materialCache.addMaterial(Fe.BumpMapType,{fabric:{type:Fe.BumpMapType,uniforms:{image:Fe.DefaultImageId,channel:"r",strength:.8,repeat:new j(1,1)},source:qve},translucent:!1});Fe.NormalMapType="NormalMap";Fe._materialCache.addMaterial(Fe.NormalMapType,{fabric:{type:Fe.NormalMapType,uniforms:{image:Fe.DefaultImageId,channels:"rgb",strength:.8,repeat:new j(1,1)},source:eDe},translucent:!1});Fe.GridType="Grid";Fe._materialCache.addMaterial(Fe.GridType,{fabric:{type:Fe.GridType,uniforms:{color:new U(0,1,0,1),cellAlpha:.1,lineCount:new j(8,8),lineThickness:new j(1,1),lineOffset:new j(0,0)},source:Zve},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.cellAlpha<1}});Fe.StripeType="Stripe";Fe._materialCache.addMaterial(Fe.StripeType,{fabric:{type:Fe.StripeType,uniforms:{horizontal:!0,evenColor:new U(1,1,1,.5),oddColor:new U(0,0,1,.5),offset:0,repeat:5},source:aDe},translucent:function(e){const t=e.uniforms;return t.evenColor.alpha<1||t.oddColor.alpha<1}});Fe.CheckerboardType="Checkerboard";Fe._materialCache.addMaterial(Fe.CheckerboardType,{fabric:{type:Fe.CheckerboardType,uniforms:{lightColor:new U(1,1,1,.5),darkColor:new U(0,0,0,.5),repeat:new j(5,5)},source:Yve},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Fe.DotType="Dot";Fe._materialCache.addMaterial(Fe.DotType,{fabric:{type:Fe.DotType,uniforms:{lightColor:new U(1,1,0,.75),darkColor:new U(0,1,1,.75),repeat:new j(5,5)},source:$ve},translucent:function(e){const t=e.uniforms;return t.lightColor.alpha<1||t.darkColor.alpha<1}});Fe.WaterType="Water";Fe._materialCache.addMaterial(Fe.WaterType,{fabric:{type:Fe.WaterType,uniforms:{baseWaterColor:new U(.2,.3,.6,1),blendColor:new U(0,1,.699,1),specularMap:Fe.DefaultImageId,normalMap:Fe.DefaultImageId,frequency:10,animationSpeed:.01,amplitude:1,specularIntensity:.5,fadeFactor:1},source:cDe},translucent:function(e){const t=e.uniforms;return t.baseWaterColor.alpha<1||t.blendColor.alpha<1}});Fe.RimLightingType="RimLighting";Fe._materialCache.addMaterial(Fe.RimLightingType,{fabric:{type:Fe.RimLightingType,uniforms:{color:new U(1,0,0,.7),rimColor:new U(1,1,1,.4),width:.3},source:rDe},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.rimColor.alpha<1}});Fe.FadeType="Fade";Fe._materialCache.addMaterial(Fe.FadeType,{fabric:{type:Fe.FadeType,uniforms:{fadeInColor:new U(1,0,0,1),fadeOutColor:new U(0,0,0,0),maximumDistance:.5,repeat:!0,fadeDirection:{x:!0,y:!0},time:new j(.5,.5)},source:Qve},translucent:function(e){const t=e.uniforms;return t.fadeInColor.alpha<1||t.fadeOutColor.alpha<1}});Fe.PolylineArrowType="PolylineArrow";Fe._materialCache.addMaterial(Fe.PolylineArrowType,{fabric:{type:Fe.PolylineArrowType,uniforms:{color:new U(1,1,1,1)},source:tDe},translucent:!0});Fe.PolylineDashType="PolylineDash";Fe._materialCache.addMaterial(Fe.PolylineDashType,{fabric:{type:Fe.PolylineDashType,uniforms:{color:new U(1,0,1,1),gapColor:new U(0,0,0,0),dashLength:16,dashPattern:255},source:nDe},translucent:!0});Fe.PolylineGlowType="PolylineGlow";Fe._materialCache.addMaterial(Fe.PolylineGlowType,{fabric:{type:Fe.PolylineGlowType,uniforms:{color:new U(0,.5,1,1),glowPower:.25,taperPower:1},source:iDe},translucent:!0});Fe.PolylineOutlineType="PolylineOutline";Fe._materialCache.addMaterial(Fe.PolylineOutlineType,{fabric:{type:Fe.PolylineOutlineType,uniforms:{color:new U(1,1,1,1),outlineColor:new U(1,0,0,1),outlineWidth:1},source:oDe},translucent:function(e){const t=e.uniforms;return t.color.alpha<1||t.outlineColor.alpha<1}});Fe.ElevationContourType="ElevationContour";Fe._materialCache.addMaterial(Fe.ElevationContourType,{fabric:{type:Fe.ElevationContourType,uniforms:{spacing:100,color:new U(1,0,0,1),width:1},source:Kve},translucent:!1});Fe.ElevationRampType="ElevationRamp";Fe._materialCache.addMaterial(Fe.ElevationRampType,{fabric:{type:Fe.ElevationRampType,uniforms:{image:Fe.DefaultImageId,minimumHeight:0,maximumHeight:1e4},source:Jve},translucent:!1});Fe.SlopeRampMaterialType="SlopeRamp";Fe._materialCache.addMaterial(Fe.SlopeRampMaterialType,{fabric:{type:Fe.SlopeRampMaterialType,uniforms:{image:Fe.DefaultImageId},source:sDe},translucent:!1});Fe.AspectRampMaterialType="AspectRamp";Fe._materialCache.addMaterial(Fe.AspectRampMaterialType,{fabric:{type:Fe.AspectRampMaterialType,uniforms:{image:Fe.DefaultImageId},source:jve},translucent:!1});Fe.ElevationBandType="ElevationBand";Fe._materialCache.addMaterial(Fe.ElevationBandType,{fabric:{type:Fe.ElevationBandType,uniforms:{heights:Fe.DefaultImageId,colors:Fe.DefaultImageId},source:Xve},translucent:!0});const XL={position:0};function Rv(e){e=A(e,A.EMPTY_OBJECT),this.center=d.clone(A(e.center,d.ZERO)),this._center=new d,this.radii=d.clone(e.radii),this._radii=new d,this._oneOverEllipsoidRadiiSquared=new d,this._boundingSphere=new 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,Fe.fromType(Fe.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 dt({owner:A(e._owner,this)}),this._pickCommand=new dt({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 EDe(e){let t=e.cache.ellipsoidPrimitive_vertexArray;if(l(t))return t;const n=Mr.createGeometry(Mr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ne.POSITION_ONLY}));return t=to.fromGeometry({context:e,geometry:n,attributeLocations:XL,bufferUsage:Ze.STATIC_DRAW,interleave:!0}),e.cache.ellipsoidPrimitive_vertexArray=t,t}const jH=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`;Rv.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=Qe.fromCache({cull:{enabled:!0,face:Po.FRONT},depthTest:{enabled:this._depthTestEnabled},depthMask:!n&&t.fragmentDepth,blending:n?Ii.ALPHA_BLEND:void 0})),l(this._va)||(this._va=EDe(t));let o=!1;const r=this.radii;if(!d.equals(this._radii,r)){d.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)||!d.equals(this.center,this._center))&&(B.clone(this.modelMatrix,this._modelMatrix),d.clone(this.center,this._center),B.multiplyByTranslation(this.modelMatrix,this.center,this._computedModelMatrix),o=!0),o&&(d.clone(d.ZERO,this._boundingSphere.center),this._boundingSphere.radius=d.maximumComponent(r),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 f=this._colorCommand;let h,_;(s||a||i||u)&&(h=new Ge({sources:[Xz]}),_=new Ge({sources:[this.material.shaderSource,$z]}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH"),_.sources.push(jH)),this._sp=hn.replaceCache({context:t,shaderProgram:this._sp,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:XL}),f.vertexArray=this._va,f.renderState=this._rs,f.shaderProgram=this._sp,f.uniformMap=sn(this._uniforms,this.material._uniforms),f.executeInClosestFrustum=n);const g=e.commandList,p=e.passes;if(p.render&&(f.boundingVolume=this._boundingSphere,f.debugShowBoundingVolume=this.debugShowBoundingVolume,f.modelMatrix=this._computedModelMatrix,f.pass=n?Be.TRANSLUCENT:Be.OPAQUE,g.push(f)),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 Ge({sources:[Xz]}),_=new Ge({sources:[this.material.shaderSource,$z],pickColorQualifier:"uniform"}),this.onlySunLighting&&_.defines.push("ONLY_SUN_LIGHTING"),!n&&t.fragmentDepth&&_.defines.push("WRITE_DEPTH"),this._useLogDepth&&(h.defines.push("LOG_DEPTH"),_.defines.push("LOG_DEPTH"),_.sources.push(jH)),this._pickSP=hn.replaceCache({context:t,shaderProgram:this._pickSP,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:XL}),y.vertexArray=this._va,y.renderState=this._rs,y.shaderProgram=this._pickSP,y.uniformMap=sn(sn(this._uniforms,this._pickUniforms),this.material._uniforms),y.executeInClosestFrustum=n),y.boundingVolume=this._boundingSphere,y.modelMatrix=this._computedModelMatrix,y.pass=n?Be.TRANSLUCENT:Be.OPAQUE,g.push(y)}};Rv.prototype.isDestroyed=function(){return!1};Rv.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(),Ue(this)};function FT(e){e=A(e,A.EMPTY_OBJECT);let t=e.textureUrl;l(t)||(t=dn("Assets/Textures/moonSmall.jpg")),this.show=A(e.show,!0),this.textureUrl=t,this._ellipsoid=A(e.ellipsoid,pe.MOON),this.onlySunLighting=A(e.onlySunLighting,!0),this._ellipsoidPrimitive=new Rv({radii:this.ellipsoid.radii,material:Fe.fromType(Fe.ImageType),depthTestEnabled:!1,_owner:this}),this._ellipsoidPrimitive.material.translucent=!1,this._axes=new Jq}Object.defineProperties(FT.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});const BE=new J,xDe=new J,wDe=new d,RE=[];FT.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(tn.computeIcrfToFixedMatrix(n,BE))||tn.computeTemeToPseudoFixedMatrix(n,BE);const i=this._axes.evaluate(n,xDe);J.transpose(i,i),J.multiply(BE,i,i);const o=EL.computeMoonPositionInEarthInertialFrame(n,wDe);J.multiplyByVector(BE,o,o),B.fromRotationTranslation(i,o,t.modelMatrix);const r=e.commandList;return e.commandList=RE,RE.length=0,t.update(e),e.commandList=r,RE.length===1?RE[0]:void 0};FT.prototype.isDestroyed=function(){return!1};FT.prototype.destroy=function(){return this._ellipsoidPrimitive=this._ellipsoidPrimitive&&this._ellipsoidPrimitive.destroy(),Ue(this)};const SDe=new d,vDe=new d,DDe=new d,IDe=new d,PDe=new d,ODe=new d(1,1,1),qH=Math.cos,YH=Math.sin;function Za(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.radii,ODe),n=A(e.innerRadii,t),i=A(e.minimumClock,0),o=A(e.maximumClock,N.TWO_PI),r=A(e.minimumCone,0),s=A(e.maximumCone,N.PI),a=Math.round(A(e.stackPartitions,64)),c=Math.round(A(e.slicePartitions,64)),u=A(e.vertexFormat,Ne.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=d.clone(t),this._innerRadii=d.clone(n),this._minimumClock=i,this._maximumClock=o,this._minimumCone=r,this._maximumCone=s,this._stackPartitions=a,this._slicePartitions=c,this._vertexFormat=Ne.clone(u),this._offsetAttribute=e.offsetAttribute,this._workerName="createEllipsoidGeometry"}Za.packedLength=2*d.packedLength+Ne.packedLength+7;Za.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),d.pack(e._radii,t,n),n+=d.packedLength,d.pack(e._innerRadii,t,n),n+=d.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.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 n7=new d,i7=new d,o7=new Ne,ih={radii:n7,innerRadii:i7,vertexFormat:o7,minimumClock:void 0,maximumClock:void 0,minimumCone:void 0,maximumCone:void 0,stackPartitions:void 0,slicePartitions:void 0,offsetAttribute:void 0};Za.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=d.unpack(e,t,n7);t+=d.packedLength;const o=d.unpack(e,t,i7);t+=d.packedLength;const r=Ne.unpack(e,t,o7);t+=Ne.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._radii=d.clone(i,n._radii),n._innerRadii=d.clone(o,n._innerRadii),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._minimumClock=s,n._maximumClock=a,n._minimumCone=c,n._maximumCone=u,n._stackPartitions=f,n._slicePartitions=h,n._offsetAttribute=_===-1?void 0:_,n):(ih.minimumClock=s,ih.maximumClock=a,ih.minimumCone=c,ih.maximumCone=u,ih.stackPartitions=f,ih.slicePartitions=h,ih.offsetAttribute=_===-1?void 0:_,new Za(ih))};Za.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)/N.TWO_PI),u=Math.round(u*Math.abs(s-r)/N.PI),c<2&&(c=2),u<2&&(u=2);let f,h,_=0;const g=[r],p=[i];for(f=0;f<u;f++)g.push(r+f*(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,C=p.length;let T=0,E=1;const w=n.x!==t.x||n.y!==t.y||n.z!==t.z;let S=!1,P=!1,O=!1;w&&(E=2,r>0&&(S=!0,T+=c-1),s<Math.PI&&(P=!0,T+=c-1),(o-i)%N.TWO_PI?(O=!0,T+=(u-1)*2+1):T+=1);const z=C*y*E,R=new Float64Array(z*3),F=new Array(z).fill(!1),H=new Array(z).fill(!1),v=c*u*E,I=6*(v+T+1-(c+u)*E),m=it.createTypedArray(v,I),D=a.normal?new Float32Array(z*3):void 0,L=a.tangent?new Float32Array(z*3):void 0,M=a.bitangent?new Float32Array(z*3):void 0,V=a.st?new Float32Array(z*2):void 0,k=new Array(y),W=new Array(y);for(f=0;f<y;f++)k[f]=YH(g[f]),W[f]=qH(g[f]);const G=new Array(C),K=new Array(C);for(h=0;h<C;h++)K[h]=qH(p[h]),G[h]=YH(p[h]);for(f=0;f<y;f++)for(h=0;h<C;h++)R[_++]=t.x*k[f]*K[h],R[_++]=t.y*k[f]*G[h],R[_++]=t.z*W[f];let q=z/2;if(w)for(f=0;f<y;f++)for(h=0;h<C;h++)R[_++]=n.x*k[f]*K[h],R[_++]=n.y*k[f]*G[h],R[_++]=n.z*W[f],F[q]=!0,f>0&&f!==y-1&&h!==0&&h!==C-1&&(H[q]=!0),q++;_=0;let te,$;for(f=1;f<y-2;f++)for(te=f*C,$=(f+1)*C,h=1;h<C-2;h++)m[_++]=$+h,m[_++]=$+h+1,m[_++]=te+h+1,m[_++]=$+h,m[_++]=te+h+1,m[_++]=te+h;if(w){const Ee=y*C;for(f=1;f<y-2;f++)for(te=Ee+f*C,$=Ee+(f+1)*C,h=1;h<C-2;h++)m[_++]=$+h,m[_++]=te+h,m[_++]=te+h+1,m[_++]=$+h,m[_++]=te+h+1,m[_++]=$+h+1}let X,Y;if(w){if(S)for(Y=y*C,f=1;f<C-2;f++)m[_++]=f,m[_++]=f+1,m[_++]=Y+f+1,m[_++]=f,m[_++]=Y+f+1,m[_++]=Y+f;if(P)for(X=y*C-C,Y=y*C*E-C,f=1;f<C-2;f++)m[_++]=X+f+1,m[_++]=X+f,m[_++]=Y+f,m[_++]=X+f+1,m[_++]=Y+f,m[_++]=Y+f+1}if(O){for(f=1;f<y-2;f++)Y=C*y+C*f,X=C*f,m[_++]=Y,m[_++]=X+C,m[_++]=X,m[_++]=Y,m[_++]=Y+C,m[_++]=X+C;for(f=1;f<y-2;f++)Y=C*y+C*(f+1)-1,X=C*(f+1)-1,m[_++]=X+C,m[_++]=Y,m[_++]=X,m[_++]=X+C,m[_++]=Y+C,m[_++]=Y}const ae=new Ui;a.position&&(ae.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:R}));let ue=0,re=0,he=0,ce=0;const Q=z/2;let ie;const de=pe.fromCartesian3(t),me=pe.fromCartesian3(n);if(a.st||a.normal||a.tangent||a.bitangent){for(f=0;f<z;f++){ie=F[f]?me:de;const Ee=d.fromArray(R,f*3,SDe),xe=ie.geodeticSurfaceNormal(Ee,vDe);if(H[f]&&d.negate(xe,xe),a.st){const Pe=j.negate(xe,PDe);V[ue++]=Math.atan2(Pe.y,Pe.x)/N.TWO_PI+.5,V[ue++]=Math.asin(xe.z)/Math.PI+.5}if(a.normal&&(D[re++]=xe.x,D[re++]=xe.y,D[re++]=xe.z),a.tangent||a.bitangent){const Pe=DDe;let Te=0,Oe;if(F[f]&&(Te=Q),!S&&f>=Te&&f<Te+C*2?Oe=d.UNIT_X:Oe=d.UNIT_Z,d.cross(Oe,xe,Pe),d.normalize(Pe,Pe),a.tangent&&(L[he++]=Pe.x,L[he++]=Pe.y,L[he++]=Pe.z),a.bitangent){const De=d.cross(xe,Pe,IDe);d.normalize(De,De),M[ce++]=De.x,M[ce++]=De.y,M[ce++]=De.z}}}a.st&&(ae.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:V})),a.normal&&(ae.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:D})),a.tangent&&(ae.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:L})),a.bitangent&&(ae.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:M}))}if(l(e._offsetAttribute)){const Ee=R.length,xe=e._offsetAttribute===fn.NONE?0:1,Pe=new Uint8Array(Ee/3).fill(xe);ae.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:Pe})}return new Dt({attributes:ae,indices:m,primitiveType:Je.TRIANGLES,boundingSphere:fe.fromEllipsoid(de),offsetAttribute:e._offsetAttribute})};let hP;Za.getUnitEllipsoid=function(){return l(hP)||(hP=Za.createGeometry(new Za({radii:new d(1,1,1),vertexFormat:Ne.POSITION_ONLY}))),hP};const KL=[],JL=[];function LDe(e,t,n,i,o,r){const s=o-i+1,a=r-o,c=KL,u=JL;let f,h;for(f=0;f<s;++f)c[f]=e[i+f];for(h=0;h<a;++h)u[h]=e[o+h+1];f=0,h=0;for(let _=i;_<=r;++_){const g=c[f],p=u[h];f<s&&(h>=a||t(g,p,n)<=0)?(e[_]=g,++f):h<a&&(e[_]=p,++h)}}function QL(e,t,n,i,o){if(i>=o)return;const r=Math.floor((i+o)*.5);QL(e,t,n,i,r),QL(e,t,n,r+1,o),LDe(e,t,n,i,r,o)}function eM(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);KL.length=o,JL.length=o,QL(e,t,n,0,i-1),KL.length=0,JL.length=0}function qs(e,t){if(!l(e))throw new x("occluderBoundingSphere is required.");if(!l(t))throw new x("camera position is required.");this._occluderPosition=d.clone(e.center),this._occluderRadius=e.radius,this._horizonDistance=0,this._horizonPlaneNormal=void 0,this._horizonPlanePosition=void 0,this._cameraPosition=void 0,this.cameraPosition=t}const NE=new d;Object.defineProperties(qs.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=d.clone(e,this._cameraPosition);const t=d.subtract(this._occluderPosition,e,NE);let n=d.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=d.multiplyByScalar(t,n,NE);const a=o*o*n;s=d.add(e,d.multiplyByScalar(r,a,NE),NE)}else o=Number.MAX_VALUE;this._horizonDistance=o,this._horizonPlaneNormal=r,this._horizonPlanePosition=s,this._cameraPosition=e}}});qs.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)?(d.clone(e.center,n._occluderPosition),n._occluderRadius=e.radius,n.cameraPosition=t,n):new qs(e,t)};const r7=new d;qs.prototype.isPointVisible=function(e){if(this._horizonDistance!==Number.MAX_VALUE){let t=d.subtract(e,this._occluderPosition,r7),n=this._occluderRadius;if(n=d.magnitudeSquared(t)-n*n,n>0)return n=Math.sqrt(n)+this._horizonDistance,t=d.subtract(e,this._cameraPosition,t),n*n>d.magnitudeSquared(t)}return!1};const BDe=new d;qs.prototype.isBoundingSphereVisible=function(e){const t=d.clone(e.center,BDe),n=e.radius;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,r7),o=this._occluderRadius-n;if(o=d.magnitudeSquared(i)-o*o,n<this._occluderRadius)return o>0?(o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i),o*o+n*n>d.magnitudeSquared(i)):!1;if(o>0){i=d.subtract(t,this._cameraPosition,i);const r=d.magnitudeSquared(i),s=this._occluderRadius*this._occluderRadius,a=n*n;return(this._horizonDistance*this._horizonDistance+s)*a>r*s?!0:(o=Math.sqrt(o)+this._horizonDistance,o*o+a>r)}return!0}return!1};const RDe=new d;qs.prototype.computeVisibility=function(e){if(!l(e))throw new x("occludeeBS is required.");const t=d.clone(e.center),n=e.radius;if(n>this._occluderRadius)return Br.FULL;if(this._horizonDistance!==Number.MAX_VALUE){let i=d.subtract(t,this._occluderPosition,RDe),o=this._occluderRadius-n;const r=d.magnitudeSquared(i);if(o=r-o*o,o>0){o=Math.sqrt(o)+this._horizonDistance,i=d.subtract(t,this._cameraPosition,i);const s=d.magnitudeSquared(i);return o*o+n*n<s?Br.NONE:(o=this._occluderRadius+n,o=r-o*o,o>0?(o=Math.sqrt(o)+this._horizonDistance,s<o*o+n*n?Br.FULL:Br.PARTIAL):(i=d.subtract(t,this._horizonPlanePosition,i),d.dot(i,this._horizonPlaneNormal)>-n?Br.PARTIAL:Br.FULL))}}return Br.NONE};const ME=new d;qs.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=d.clone(t),o=d.clone(e.center),r=e.radius,s=n.length;if(d.equals(o,t))throw new x("occludeePosition must be different than occluderBoundingSphere.center");const a=d.normalize(d.subtract(i,o,ME),ME),c=-d.dot(a,o),u=qs._anyRotationVector(o,a,c);let f=qs._horizonToPlaneNormalDotProduct(e,a,c,u,n[0]);if(!f)return;let h;for(let g=1;g<s;++g){if(h=qs._horizonToPlaneNormalDotProduct(e,a,c,u,n[g]),!h)return;h<f&&(f=h)}if(f<.0017453283658983088)return;const _=r/f;return d.add(o,d.multiplyByScalar(a,_,ME),ME)};const NDe=[];qs.computeOccludeePointFromRectangle=function(e,t){if(!l(e))throw new x("rectangle is required.");t=A(t,pe.WGS84);const n=_e.subsample(e,t,0,NDe),i=fe.fromPoints(n),o=d.ZERO;if(!d.equals(o,i.center))return qs.computeOccludeePoint(new fe(o,t.minimumRadius),i.center,n)};const MDe=new d;qs._anyRotationVector=function(e,t,n){const i=d.abs(t,MDe);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 d;let s;o===0?(i.x=e.x,i.y=e.y+1,i.z=e.z+1,s=d.UNIT_X):o===1?(i.x=e.x+1,i.y=e.y,i.z=e.z+1,s=d.UNIT_Y):(i.x=e.x+1,i.y=e.y+1,i.z=e.z,s=d.UNIT_Z);const a=(d.dot(t,i)+n)/-d.dot(t,s);return d.normalize(d.subtract(d.add(i,d.multiplyByScalar(s,a,r),i),e,i),i)};const FDe=new d;qs._rotationVector=function(e,t,n,i,o){let r=d.subtract(i,e,FDe);if(r=d.normalize(r,r),d.dot(t,r)<.9999999847691291){const s=d.cross(t,r,r);if(d.magnitude(s)>N.EPSILON13)return d.normalize(s,new d)}return o};const pP=new d,zDe=new d,FE=new d,$H=new d;qs._horizonToPlaneNormalDotProduct=function(e,t,n,i,o){const r=d.clone(o,pP),s=d.clone(e.center,zDe),a=e.radius;let c=d.subtract(s,r,FE);const u=d.magnitudeSquared(c),f=a*a;if(u<f)return!1;const h=u-f,_=Math.sqrt(h),p=1/Math.sqrt(u),C=_*p*_;c=d.normalize(c,c);const T=d.add(r,d.multiplyByScalar(c,C,$H),$H),E=Math.sqrt(h-C*C);let w=this._rotationVector(s,t,n,r,i),S=d.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,pP);S=d.normalize(S,S);const P=d.multiplyByScalar(S,E,pP);w=d.normalize(d.subtract(d.add(T,P,FE),s,FE),FE);const O=d.dot(t,w);w=d.normalize(d.subtract(d.subtract(T,P,w),s,w),w);const z=d.dot(t,w);return O<z?O:z};function Ks(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 Ko,this._perspectiveMatrix=new B,this._infinitePerspective=new B}function ZL(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(Ks.prototype,{projectionMatrix:{get:function(){return ZL(this),this._perspectiveMatrix}},infiniteProjectionMatrix:{get:function(){return ZL(this),this._infinitePerspective}}});const UDe=new d,HDe=new d,VDe=new d,kDe=new d;Ks.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,f=d.cross(t,n,UDe),h=HDe;d.multiplyByScalar(t,c,h),d.add(e,h,h);const _=VDe;d.multiplyByScalar(t,u,_),d.add(e,_,_);const g=kDe;d.multiplyByScalar(f,a,g),d.add(h,g,g),d.subtract(g,e,g),d.normalize(g,g),d.cross(g,n,g),d.normalize(g,g);let 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=-d.dot(g,e),d.multiplyByScalar(f,s,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(n,g,g),d.normalize(g,g),p=i[1],l(p)||(p=i[1]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),d.multiplyByScalar(n,r,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(f,g,g),d.normalize(g,g),p=i[2],l(p)||(p=i[2]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.dot(g,e),d.multiplyByScalar(n,o,g),d.add(h,g,g),d.subtract(g,e,g),d.cross(g,f,g),d.normalize(g,g),p=i[3],l(p)||(p=i[3]=new oe),p.x=g.x,p.y=g.y,p.z=g.z,p.w=-d.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=-d.dot(t,h),d.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=-d.dot(g,_),this._cullingVolume};Ks.prototype.getPixelDimensions=function(e,t,n,i,o){if(ZL(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};Ks.prototype.clone=function(e){return l(e)||(e=new Ks),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};Ks.prototype.equals=function(e){return l(e)&&e instanceof Ks&&this.right===e.right&&this.left===e.left&&this.top===e.top&&this.bottom===e.bottom&&this.near===e.near&&this.far===e.far};Ks.prototype.equalsEpsilon=function(e,t,n){return e===this||l(e)&&e instanceof Ks&&N.equalsEpsilon(this.right,e.right,t,n)&&N.equalsEpsilon(this.left,e.left,t,n)&&N.equalsEpsilon(this.top,e.top,t,n)&&N.equalsEpsilon(this.bottom,e.bottom,t,n)&&N.equalsEpsilon(this.near,e.near,t,n)&&N.equalsEpsilon(this.far,e.far,t,n)};function Un(e){e=A(e,A.EMPTY_OBJECT),this._offCenterFrustum=new Ks,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}Un.packedLength=6;Un.pack=function(e,t,n){return b.typeOf.object("value",e),b.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};Un.unpack=function(e,t,n){return b.defined("array",e),t=A(t,0),l(n)||(n=new Un),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 Nu(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(Un.prototype,{projectionMatrix:{get:function(){return Nu(this),this._offCenterFrustum.projectionMatrix}},infiniteProjectionMatrix:{get:function(){return Nu(this),this._offCenterFrustum.infiniteProjectionMatrix}},fovy:{get:function(){return Nu(this),this._fovy}},sseDenominator:{get:function(){return Nu(this),this._sseDenominator}}});Un.prototype.computeCullingVolume=function(e,t,n){return Nu(this),this._offCenterFrustum.computeCullingVolume(e,t,n)};Un.prototype.getPixelDimensions=function(e,t,n,i,o){return Nu(this),this._offCenterFrustum.getPixelDimensions(e,t,n,i,o)};Un.prototype.clone=function(e){return l(e)||(e=new Un),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};Un.prototype.equals=function(e){return!l(e)||!(e instanceof Un)?!1:(Nu(this),Nu(e),this.fov===e.fov&&this.aspectRatio===e.aspectRatio&&this._offCenterFrustum.equals(e._offCenterFrustum))};Un.prototype.equalsEpsilon=function(e,t,n){return!l(e)||!(e instanceof Un)?!1:(Nu(this),Nu(e),N.equalsEpsilon(this.fov,e.fov,t,n)&&N.equalsEpsilon(this.aspectRatio,e.aspectRatio,t,n)&&this._offCenterFrustum.equalsEpsilon(e._offCenterFrustum,t,n))};function zT(){this._colorTexture=void 0,this._drawCommand=void 0}Object.defineProperties(zT.prototype,{colorTexture:{get:function(){return this._colorTexture}}});function GDe(e,t,n){const i=t.createViewportQuadCommand(tAe,{framebuffer:n,renderState:Qe.fromCache({viewport:new qe(0,0,256,256)})});e._drawCommand=i}zT.prototype.update=function(e){if(!l(this._colorTexture)){const t=e.context,n=new zt({context:t,width:256,height:256,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,sampler:Yn.NEAREST});this._colorTexture=n;const i=new zr({context:t,colorTextures:[n],destroyAttachments:!1});GDe(this,t,i),this._drawCommand.execute(t),i.destroy(),this._drawCommand.shaderProgram=this._drawCommand.shaderProgram&&this._drawCommand.shaderProgram.destroy()}};zT.prototype.isDestroyed=function(){return!1};zT.prototype.destroy=function(){return this._colorTexture=this._colorTexture&&this._colorTexture.destroy(),Ue(this)};var ni={Linear:{None:function(e){return e}},Quadratic:{In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}},Cubic:{In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},Quartic:{In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}},Quintic:{In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}},Sinusoidal:{In:function(e){return 1-Math.cos(e*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.cos(Math.PI*e))}},Exponential:{In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}},Circular:{In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}},Elastic:{In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}},Back:{In:function(e){var t=1.70158;return e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}},Bounce:{In:function(e){return 1-ni.Bounce.Out(1-e)},Out:function(e){return e<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?ni.Bounce.In(e*2)*.5:ni.Bounce.Out(e*2-1)*.5+.5}}},BA;typeof self>"u"&&typeof process<"u"&&process.hrtime?BA=function(){var e=process.hrtime();return e[0]*1e3+e[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?BA=self.performance.now.bind(self.performance):Date.now!==void 0?BA=Date.now:BA=function(){return new Date().getTime()};var Lg=BA,WDe=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=Lg()),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}(),RA={Linear:function(e,t){var n=e.length-1,i=n*t,o=Math.floor(i),r=RA.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=RA.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=RA.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=RA.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}}},s7=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),a7=new WDe,jDe=function(){function e(t,n){n===void 0&&(n=a7),this._object=t,this._group=n,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ni.Linear.None,this._interpolationFunction=RA.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=s7.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"?Lg()+parseFloat(t):t:Lg(),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 f=i[r];if(f.length===0)continue;f=f.map(this._handleRelativeValue.bind(this,s)),i[r]=[s].concat(f)}if((c==="object"||a)&&s&&!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=Lg()),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=Lg()),!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=Lg()),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),f=!c&&u;f?t[r]=this._interpolationFunction(a,o):typeof a=="object"&&a?this._updateProperties(t[r],s,a,o):(a=this._handleRelativeValue(s,a),typeof a=="number"&&(t[r]=s+(a-s)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],i=this._valuesEnd[t];typeof i=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(i):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e}();s7.nextId;var Yu=a7;Yu.getAll.bind(Yu);Yu.removeAll.bind(Yu);Yu.add.bind(Yu);Yu.remove.bind(Yu);Yu.update.bind(Yu);const qDe={LINEAR_NONE:ni.Linear.None,QUADRATIC_IN:ni.Quadratic.In,QUADRATIC_OUT:ni.Quadratic.Out,QUADRATIC_IN_OUT:ni.Quadratic.InOut,CUBIC_IN:ni.Cubic.In,CUBIC_OUT:ni.Cubic.Out,CUBIC_IN_OUT:ni.Cubic.InOut,QUARTIC_IN:ni.Quartic.In,QUARTIC_OUT:ni.Quartic.Out,QUARTIC_IN_OUT:ni.Quartic.InOut,QUINTIC_IN:ni.Quintic.In,QUINTIC_OUT:ni.Quintic.Out,QUINTIC_IN_OUT:ni.Quintic.InOut,SINUSOIDAL_IN:ni.Sinusoidal.In,SINUSOIDAL_OUT:ni.Sinusoidal.Out,SINUSOIDAL_IN_OUT:ni.Sinusoidal.InOut,EXPONENTIAL_IN:ni.Exponential.In,EXPONENTIAL_OUT:ni.Exponential.Out,EXPONENTIAL_IN_OUT:ni.Exponential.InOut,CIRCULAR_IN:ni.Circular.In,CIRCULAR_OUT:ni.Circular.Out,CIRCULAR_IN_OUT:ni.Circular.InOut,ELASTIC_IN:ni.Elastic.In,ELASTIC_OUT:ni.Elastic.Out,ELASTIC_IN_OUT:ni.Elastic.InOut,BACK_IN:ni.Back.In,BACK_OUT:ni.Back.Out,BACK_IN_OUT:ni.Back.InOut,BOUNCE_IN:ni.Bounce.In,BOUNCE_OUT:ni.Bounce.Out,BOUNCE_IN_OUT:ni.Bounce.InOut},lc=Object.freeze(qDe);function YDe(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,f=Math.atan2(a,r),h=c*s,_=h*h,g=1-_,p=Math.sqrt(g),y=t/4,C=y*y,T=C*y,E=C*C,w=1+y-3*C/4+5*T/4-175*E/64,S=1-y+15*C/8-35*T/8,P=1-3*y+35*C/4,O=1-5*y,z=w*f-S*Math.sin(2*f)*y/2-P*Math.sin(4*f)*C/16-O*Math.sin(6*f)*T/48-Math.sin(8*f)*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=f,R.sineAlpha=h,R.sineSquaredAlpha=_,R.cosineSquaredAlpha=g,R.cosineAlpha=p,R.u2Over4=y,R.u4Over16=C,R.u6Over64=T,R.u8Over256=E,R.a0=w,R.a1=S,R.a2=P,R.a3=O,R.distanceRatio=z}function $De(e,t){return e*t*(4+e*(4-3*t))/16}function c7(e,t,n,i,o,r,s){const a=$De(e,n);return(1-a)*e*t*(i+a*o*(s+a*r*(2*s*s-1)))}function XDe(e,t,n,i,o,r,s){const a=(t-n)/t,c=r-i,u=Math.atan((1-a)*Math.tan(o)),f=Math.atan((1-a)*Math.tan(s)),h=Math.cos(u),_=Math.sin(u),g=Math.cos(f),p=Math.sin(f),y=h*g,C=h*p,T=_*p,E=_*g;let w=c,S=N.TWO_PI,P=Math.cos(w),O=Math.sin(w),z,R,F,H,v;do{P=Math.cos(w),O=Math.sin(w);const G=C-E*P;F=Math.sqrt(g*g*O*O+G*G),R=T+y*P,z=Math.atan2(F,R);let K;F===0?(K=0,H=1):(K=y*O/F,H=1-K*K),S=w,v=R-2*T/H,isFinite(v)||(v=0),w=c+c7(a,K,H,z,F,R,v)}while(Math.abs(w-S)>N.EPSILON12);const I=H*(t*t-n*n)/(n*n),m=1+I*(4096+I*(I*(320-175*I)-768))/16384,D=I*(256+I*(I*(74-47*I)-128))/1024,L=v*v,M=D*F*(v+D*(R*(2*L-1)-D*v*(4*F*F-3)*(4*L-3)/6)/4),V=n*m*(z-M),k=Math.atan2(g*O,C-E*P),W=Math.atan2(h*O,C*P-E);e._distance=V,e._startHeading=k,e._endHeading=W,e._uSquared=I}const KDe=new d,mP=new d;function l7(e,t,n,i){const o=d.normalize(i.cartographicToCartesian(t,mP),KDe),r=d.normalize(i.cartographicToCartesian(n,mP),mP);b.typeOf.number.greaterThanOrEquals("value",Math.abs(Math.abs(d.angleBetween(o,r))-Math.PI),.0125),XDe(e,i.maximumRadius,i.minimumRadius,t.longitude,t.latitude,n.longitude,n.latitude),e._start=Ae.clone(t,e._start),e._end=Ae.clone(n,e._end),e._start.height=0,e._end.height=0,YDe(e)}function vd(e,t,n){const i=A(n,pe.WGS84);this._ellipsoid=i,this._start=new Ae,this._end=new Ae,this._constants={},this._startHeading=void 0,this._endHeading=void 0,this._distance=void 0,this._uSquared=void 0,l(e)&&l(t)&&l7(this,e,t,i)}Object.defineProperties(vd.prototype,{ellipsoid:{get:function(){return this._ellipsoid}},surfaceDistance:{get:function(){return b.defined("distance",this._distance),this._distance}},start:{get:function(){return this._start}},end:{get:function(){return this._end}},startHeading:{get:function(){return b.defined("distance",this._distance),this._startHeading}},endHeading:{get:function(){return b.defined("distance",this._distance),this._endHeading}}});vd.prototype.setEndPoints=function(e,t){b.defined("start",e),b.defined("end",t),l7(this,e,t,this._ellipsoid)};vd.prototype.interpolateUsingFraction=function(e,t){return this.interpolateUsingSurfaceDistance(this._distance*e,t)};vd.prototype.interpolateUsingSurfaceDistance=function(e,t){b.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),f=Math.sin(8*i),h=i*i,_=i*h,g=n.u8Over256,p=n.u2Over4,y=n.u6Over64,C=n.u4Over16;let T=2*_*g*o/3+i*(1-p+7*C/4-15*y/4+579*g/64-(C-15*y/4+187*g/16)*o-(5*y/4-115*g/16)*r-29*g*s/16)+(p/2-C+71*y/32-85*g/16)*a+(5*C/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*f/1536;const E=Math.asin(Math.sin(T)*n.cosineAlpha),w=Math.atan(n.a/n.b*Math.tan(E));T=T-n.sigma;const S=Math.cos(2*n.sigma+T),P=Math.sin(T),O=Math.cos(T),z=n.cosineU*O,R=n.sineU*P,H=Math.atan2(P*n.sineHeading,z-R*n.cosineHeading)-c7(n.f,n.sineAlpha,n.cosineSquaredAlpha,T,P,O,S);return l(t)?(t.longitude=this._start.longitude+H,t.latitude=w,t.height=0,t):new Ae(this._start.longitude+H,w,0)};function t_(e,t,n){this.heading=A(e,0),this.pitch=A(t,0),this.range=A(n,0)}t_.clone=function(e,t){if(l(e))return l(t)||(t=new t_),t.heading=e.heading,t.pitch=e.pitch,t.range=e.range,t};const u7={};function JDe(e,t,n){let i,o,r;if(e instanceof Un){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 Ks)return i=e.near,o=e.top,r=e.right,Math.max(t*i/r,n*i/o);return Math.max(t,n)}const QDe=new d,XH=new d;function f7(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 f=n(u);if(u<=.5){const _=(f-o)/a;return N.lerp(e,-N.PI_OVER_TWO,_)}const h=(f-r)/c;return N.lerp(-N.PI_OVER_TWO,t,1-h)}}return function(o){return N.lerp(e,t,o)}}function tM(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,f=e.right,h=e.frustum,_=d.subtract(a,c,QDe),g=d.magnitude(d.multiplyByScalar(u,d.dot(_,u),XH)),p=d.magnitude(d.multiplyByScalar(f,d.dot(_,f),XH));r=Math.min(JDe(h,g,p)*.2,1e9)}if(s<r){const u=-Math.pow((r-n)*1e6,.125),f=Math.pow((r-i)*1e6,1/8);return function(h){const _=h*(f-u)+u;return-Math.pow(_,8)/1e6+r}}return function(a){return N.lerp(n,i,a)}}function WC(e,t){return N.equalsEpsilon(e,N.TWO_PI,N.EPSILON11)&&(e=0),t>e+Math.PI?e+=N.TWO_PI:t<e-Math.PI&&(e-=N.TWO_PI),e}const d7=new d;function ZDe(e,t,n,i,o,r,s,a){const c=e.camera,u=d.clone(c.position,d7),f=c.pitch,h=WC(c.heading,i),_=WC(c.roll,r),g=tM(c,n,u.z,n.z,s),p=f7(f,o,g,a);function y(C){const T=C.time/t;c.setView({orientation:{heading:N.lerp(h,i,T),pitch:p(T),roll:N.lerp(_,r,T)}}),j.lerp(u,n,T,c.position),c.position.z=g(T)}return y}function eIe(e,t){e.longitude<t.longitude?e.longitude+=N.TWO_PI:t.longitude+=N.TWO_PI}function tIe(e,t){const n=e.longitude-t.longitude;n<-N.PI?e.longitude+=N.TWO_PI:n>N.PI&&(t.longitude+=N.TWO_PI)}const nIe=new Ae,iIe=new Ae;function oIe(e,t,n,i,o,r,s,a,c,u){const f=e.camera,_=e.mapProjection.ellipsoid,g=Ae.clone(f.positionCartographic,nIe),p=f.pitch,y=WC(f.heading,i),C=WC(f.roll,r),T=_.cartesianToCartographic(n,iIe);g.longitude=N.zeroToTwoPi(g.longitude),T.longitude=N.zeroToTwoPi(T.longitude);let E=!1;if(l(a)){const O=N.zeroToTwoPi(a),z=Math.min(g.longitude,T.longitude),R=Math.max(g.longitude,T.longitude),F=O>=z&&O<=R;if(l(c)){const H=Math.abs(g.longitude-T.longitude),v=N.TWO_PI-H;(F?H:v)<(F?v:H)*c&&!F&&(E=!0)}else F||(E=!0)}E?eIe(g,T):tIe(g,T);const w=tM(f,n,g.height,T.height,s),S=f7(p,o,w,u);function P(){const O=g.longitude,z=T.longitude,R=g.latitude,F=T.latitude;return function(v){const I=v.time/t,m=d.fromRadians(N.lerp(O,z,I),N.lerp(R,F,I),w(I),_);f.setView({destination:m,orientation:{heading:N.lerp(y,i,I),pitch:S(I),roll:N.lerp(C,r,I)}})}}return P()}function rIe(e,t,n,i,o,r,s){const a=e.camera,c=d.clone(a.position,d7),u=WC(a.heading,i),f=a.frustum.right-a.frustum.left,h=tM(a,n,f,n.z,s);function _(g){const p=g.time/t;a.setView({orientation:{heading:N.lerp(u,i,p)}}),j.lerp(c,n,p,a.position);const y=h(p),C=a.frustum,T=C.top/C.right,E=(y-(C.right-C.left))*.5;C.right+=E,C.left-=E,C.top=T*C.right,C.bottom=-C.top}return _}const KH=new Ae,sIe=new d;function _P(e,t){return{startObject:{},stopObject:{},duration:0,complete:e,cancel:t}}function JH(e,t){function n(){typeof t=="function"&&t(),e.enableInputs=!0}return n}u7.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 _P();const o=A(t.convert,!0),r=e.mapProjection,s=r.ellipsoid,a=t.maximumHeight,c=t.flyOverLongitude,u=t.flyOverLongitudeWeight,f=t.pitchAdjustHeight;let h=t.easingFunction;o&&i!==le.SCENE3D&&(s.cartesianToCartographic(n,KH),n=r.project(KH,sIe));const _=e.camera,g=t.endTransform;l(g)&&_._setTransform(g);let p=t.duration;l(p)||(p=Math.ceil(d.distance(_.position,n)/1e6)+2,p=Math.min(p,3));const y=A(t.heading,0),C=A(t.pitch,-N.PI_OVER_TWO),T=A(t.roll,0),E=e.screenSpaceCameraController;E.enableInputs=!1;const w=JH(E,t.complete),S=JH(E,t.cancel),P=_.frustum;let O=e.mode===le.SCENE2D;if(O=O&&j.equalsEpsilon(_.position,n,N.EPSILON6),O=O&&N.equalsEpsilon(Math.max(P.right-P.left,P.top-P.bottom),n.z,N.EPSILON6),O=O||e.mode!==le.SCENE2D&&d.equalsEpsilon(n,_.position,N.EPSILON10),O=O&&N.equalsEpsilon(N.negativePiToPi(y),N.negativePiToPi(_.heading),N.EPSILON10)&&N.equalsEpsilon(N.negativePiToPi(C),N.negativePiToPi(_.pitch),N.EPSILON10)&&N.equalsEpsilon(N.negativePiToPi(T),N.negativePiToPi(_.roll),N.EPSILON10),O)return _P(w,S);const z=new Array(4);if(z[le.SCENE2D]=rIe,z[le.SCENE3D]=oIe,z[le.COLUMBUS_VIEW]=ZDe,p<=0)return _P(function(){z[i](e,1,n,y,C,T,a,c,u,f)({time:1}),typeof w=="function"&&w()},S);const R=z[i](e,p,n,y,C,T,a,c,u,f);if(!l(h)){const F=_.positionCartographic.height,H=i===le.SCENE3D?s.cartesianToCartographic(n).height:n.z;F>H&&F>11500?h=lc.CUBIC_OUT:h=lc.QUINTIC_IN_OUT}return{duration:p,easingFunction:h,startObject:{time:0},stopObject:{time:p},update:R,complete:w,cancel:S}};const aIe=u7,cIe={ROTATE:0,INFINITE_SCROLL:1},sp=Object.freeze(cIe);function ot(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 d,this._position=new d,this._positionWC=new d,this._positionCartographic=new Ae,this._oldPositionWC=void 0,this.positionWCDeltaMagnitude=0,this.positionWCDeltaMagnitudeLastFrame=0,this.timeSinceMoved=0,this._lastMovedTimestamp=0,this.direction=new d,this._direction=new d,this._directionWC=new d,this.up=new d,this._up=new d,this._upWC=new d,this.right=new d,this._right=new d,this._rightWC=new d,this.frustum=new Un,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=N.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 $e,this._moveEnd=new $e,this._changed=new $e,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,h7(this),this._mode=le.SCENE3D,this._modeChanged=!0;const t=e.mapProjection;this._projection=t,this._maxCoord=t.project(new Ae(Math.PI,N.PI_OVER_TWO)),this._max2Dfrustum=void 0,w7(this,ot.DEFAULT_VIEW_RECTANGLE,this.position,!0);let n=d.magnitude(this.position);n+=n*ot.DEFAULT_VIEW_FACTOR,d.normalize(this.position,this.position),d.multiplyByScalar(this.position,n,this.position)}ot.TRANSFORM_2D=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);ot.TRANSFORM_2D_INVERSE=B.inverseTransformation(ot.TRANSFORM_2D,new B);ot.DEFAULT_VIEW_RECTANGLE=_e.fromDegrees(-95,-20,-70,90);ot.DEFAULT_VIEW_FACTOR=.5;ot.DEFAULT_OFFSET=new t_(0,-N.PI_OVER_FOUR,0);function h7(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 lIe(e){if(!l(e._oldPositionWC))e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC);else{e.positionWCDeltaMagnitudeLastFrame=e.positionWCDeltaMagnitude;const t=d.subtract(e.positionWC,e._oldPositionWC,e._oldPositionWC);e.positionWCDeltaMagnitude=d.magnitude(t),e._oldPositionWC=d.clone(e.positionWC,e._oldPositionWC),e.positionWCDeltaMagnitude>0?(e.timeSinceMoved=0,e._lastMovedTimestamp=er()):e.timeSinceMoved=Math.max(er()-e._lastMovedTimestamp,0)/1e3}}ot.prototype.canPreloadFlight=function(){return l(this._currentFlight)&&this._mode!==le.SCENE2D};ot.prototype._updateCameraChanged=function(){const e=this;if(lIe(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)%N.TWO_PI;i=i>N.PI?N.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=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone();return}const u=e.position,f=e._changedPosition,h=e.frustum,_=e._changedFrustum,g=u.x+h.left,p=u.x+h.right,y=f.x+_.left,C=f.x+_.right,T=u.y+h.bottom,E=u.y+h.top,w=f.y+_.bottom,S=f.y+_.top,P=Math.max(g,y),O=Math.min(p,C),z=Math.max(T,w),R=Math.min(E,S);let F;if(P>=O||z>=E)F=1;else{let H=_;g<y&&p>C&&T<w&&E>S&&(H=h),F=1-(O-P)*(R-z)/((H.right-H.left)*(H.top-H.bottom))}F>t&&(e._changed.raiseEvent(F),e._changedPosition=d.clone(e.position,e._changedPosition),e._changedFrustum=e.frustum.clone(e._changedFrustum));return}if(!l(e._changedDirection)){e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection);return}const r=N.acosClamped(d.dot(e.directionWC,e._changedDirection));let s;l(e.frustum.fovy)?s=r/(e.frustum.fovy*.5):s=r;const c=d.distance(e.positionWC,e._changedPosition)/e.positionCartographic.height;(s>t||c>t)&&(e._changed.raiseEvent(Math.max(s,c)),e._changedPosition=d.clone(e.positionWC,e._changedPosition),e._changedDirection=d.clone(e.directionWC,e._changedDirection))};function uIe(e){tn.basisTo2D(e._projection,e._transform,e._actualTransform)}const fIe=new Ae,dIe=new d,zE=new d,hIe=new oe,pIe=new oe,mIe=new oe,_Ie=new oe,gIe=new oe;function yIe(e){const t=e._projection,n=t.ellipsoid,i=B.getColumn(e._transform,3,hIe),o=n.cartesianToCartographic(i,fIe),r=t.project(o,dIe),s=pIe;s.x=r.z,s.y=r.x,s.z=r.y,s.w=1;const a=oe.clone(oe.UNIT_X,gIe),c=oe.add(B.getColumn(e._transform,0,zE),i,zE);n.cartesianToCartographic(c,o),t.project(o,r);const u=mIe;u.x=r.z,u.y=r.x,u.z=r.y,u.w=0,d.subtract(u,s,u),u.x=0;const f=_Ie;if(d.magnitudeSquared(u)>N.EPSILON10)d.cross(a,u,f);else{const h=oe.add(B.getColumn(e._transform,1,zE),i,zE);n.cartesianToCartographic(h,o),t.project(o,r),f.x=r.z,f.y=r.x,f.z=r.y,f.w=0,d.subtract(f,s,f),f.x=0,d.magnitudeSquared(f)<N.EPSILON10&&(oe.clone(oe.UNIT_Y,u),oe.clone(oe.UNIT_Z,f))}d.cross(f,a,u),d.normalize(u,u),d.cross(a,u,f),d.normalize(f,f),B.setColumn(e._actualTransform,0,u,e._actualTransform),B.setColumn(e._actualTransform,1,f,e._actualTransform),B.setColumn(e._actualTransform,2,a,e._actualTransform),B.setColumn(e._actualTransform,3,s,e._actualTransform)}const gP=new d;function Ns(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=!d.equals(o,e.position)||n;r&&(o=d.clone(e.position,e._position));let s=e._direction;const a=!d.equals(s,e.direction);a&&(d.normalize(e.direction,e.direction),s=d.clone(e.direction,e._direction));let c=e._up;const u=!d.equals(c,e.up);u&&(d.normalize(e.up,e.up),c=d.clone(e.up,e._up));let f=e._right;const h=!d.equals(f,e.right);h&&(d.normalize(e.right,e.right),f=d.clone(e.right,e._right));const _=e._transformChanged||e._modeChanged;e._transformChanged=!1,_&&(B.inverseTransformation(e._transform,e._invTransform),e._mode===le.COLUMBUS_VIEW||e._mode===le.SCENE2D?B.equals(B.IDENTITY,e._transform)?B.clone(ot.TRANSFORM_2D,e._actualTransform):e._mode===le.COLUMBUS_VIEW?uIe(e):yIe(e):B.clone(e._transform,e._actualTransform),B.inverseTransformation(e._actualTransform,e._actualInvTransform),e._modeChanged=!1);const g=e._actualTransform;if(r||_)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=gP;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=d.dot(s,d.cross(c,f,gP));if(Math.abs(1-p)>N.EPSILON2){const y=1/d.magnitudeSquared(c),C=d.dot(c,s)*y,T=d.multiplyByScalar(s,C,gP);c=d.normalize(d.subtract(c,T,e._up),e._up),d.clone(c,e.up),f=d.cross(s,c,e._right),d.clone(f,e.right)}}(a||_)&&(e._directionWC=B.multiplyByPointAsVector(g,s,e._directionWC),d.normalize(e._directionWC,e._directionWC)),(u||_)&&(e._upWC=B.multiplyByPointAsVector(g,c,e._upWC),d.normalize(e._upWC,e._upWC)),(h||_)&&(e._rightWC=B.multiplyByPointAsVector(g,f,e._rightWC),d.normalize(e._rightWC,e._rightWC)),(r||a||u||h||_)&&h7(e)}function p7(e,t){let n;return N.equalsEpsilon(Math.abs(e.z),1,N.EPSILON3)?n=Math.atan2(t.y,t.x)-N.PI_OVER_TWO:n=Math.atan2(e.y,e.x)-N.PI_OVER_TWO,N.TWO_PI-N.zeroToTwoPi(n)}function m7(e){return N.PI_OVER_TWO-N.acosClamped(e.z)}function _7(e,t,n){let i=0;return N.equalsEpsilon(Math.abs(e.z),1,N.EPSILON3)||(i=Math.atan2(-n.z,t.z),i=N.zeroToTwoPi(i+N.TWO_PI)),i}const uw=new B,fw=new B;Object.defineProperties(ot.prototype,{transform:{get:function(){return this._transform}},inverseTransform:{get:function(){return Ns(this),this._invTransform}},viewMatrix:{get:function(){return Ns(this),this._viewMatrix}},inverseViewMatrix:{get:function(){return Ns(this),this._invViewMatrix}},positionCartographic:{get:function(){return Ns(this),this._positionCartographic}},positionWC:{get:function(){return Ns(this),this._positionWC}},directionWC:{get:function(){return Ns(this),this._directionWC}},upWC:{get:function(){return Ns(this),this._upWC}},rightWC:{get:function(){return Ns(this),this._rightWC}},heading:{get:function(){if(this._mode!==le.MORPHING){const e=this._projection.ellipsoid,t=B.clone(this._transform,uw),n=tn.eastNorthUpToFixedFrame(this.positionWC,e,fw);this._setTransform(n);const i=p7(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,uw),n=tn.eastNorthUpToFixedFrame(this.positionWC,e,fw);this._setTransform(n);const i=m7(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,uw),n=tn.eastNorthUpToFixedFrame(this.positionWC,e,fw);this._setTransform(n);const i=_7(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}}});ot.prototype.update=function(e){if(!l(e))throw new x("mode is required.");if(e===le.SCENE2D&&!(this.frustum instanceof Bo))throw new x("An OrthographicOffCenterFrustum is required in 2D.");if((e===le.SCENE3D||e===le.COLUMBUS_VIEW)&&!(this.frustum instanceof Un)&&!(this.frustum instanceof Ft))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 Bo))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&&C7(this,this.position)};const AIe=new d,CIe=new d,TIe=new d;ot.prototype._setTransform=function(e){const t=d.clone(this.positionWC,AIe),n=d.clone(this.upWC,CIe),i=d.clone(this.directionWC,TIe);B.clone(e,this._transform),this._transformChanged=!0,Ns(this);const o=this._actualInvTransform;B.multiplyByPoint(o,t,this.position),B.multiplyByPointAsVector(o,i,this.direction),B.multiplyByPointAsVector(o,n,this.up),d.cross(this.direction,this.up,this.right),Ns(this)};const bIe=new j,EIe=new Pn,xIe=new d,wIe=new d;function g7(e){if(!B.equals(B.IDENTITY,e.transform))return d.magnitude(e.position);const t=e._scene,n=t.globe,i=bIe;i.x=t.drawingBufferWidth/2,i.y=t.drawingBufferHeight/2;let o;if(l(n)){const a=e.getPickRay(i,EIe);o=n.pickWorldCoordinates(a,t,!0,xIe)}let r;t.pickPositionSupported&&(r=t.pickPositionWorldCoordinates(i,wIe));let s;if(l(o)||l(r)){const a=l(r)?d.distance(r,e.positionWC):Number.POSITIVE_INFINITY,c=l(o)?d.distance(o,e.positionWC):Number.POSITIVE_INFINITY;s=Math.min(a,c)}else s=Math.max(e.positionCartographic.height,0);return s}ot.prototype._adjustOrthographicFrustum=function(e){this.frustum instanceof Ft&&(!e&&this._positionCartographic.height<15e4||(this.frustum.width=g7(this)))};const yS=new d,nM=new B,SIe=new B,iM=new Ce,oM=new J,y7=new Ae;function vIe(e,t,n){const i=B.clone(e.transform,nM),o=tn.eastNorthUpToFixedFrame(t,e._projection.ellipsoid,SIe);e._setTransform(o),d.clone(d.ZERO,e.position),n.heading=n.heading-N.PI_OVER_TWO;const r=Ce.fromHeadingPitchRoll(n,iM),s=J.fromQuaternion(r,oM);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(i),e._adjustOrthographicFrustum(!0)}function DIe(e,t,n,i){const o=B.clone(e.transform,nM);if(e._setTransform(B.IDENTITY),!d.equals(t,e.positionWC)){if(i){const a=e._projection,c=a.ellipsoid.cartesianToCartographic(t,y7);t=a.project(c,yS)}d.clone(t,e.position)}n.heading=n.heading-N.PI_OVER_TWO;const r=Ce.fromHeadingPitchRoll(n,iM),s=J.fromQuaternion(r,oM);J.getColumn(s,0,e.direction),J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right),e._setTransform(o),e._adjustOrthographicFrustum(!0)}function IIe(e,t,n,i){const o=B.clone(e.transform,nM);if(e._setTransform(B.IDENTITY),!d.equals(t,e.positionWC)){if(i){const c=e._projection,u=c.ellipsoid.cartesianToCartographic(t,y7);t=c.project(u,yS)}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===sp.ROTATE){n.heading=n.heading-N.PI_OVER_TWO,n.pitch=-N.PI_OVER_TWO,n.roll=0;const r=Ce.fromHeadingPitchRoll(n,iM),s=J.fromQuaternion(r,oM);J.getColumn(s,2,e.up),d.cross(e.direction,e.up,e.right)}e._setTransform(o)}const PIe=new d,OIe=new d,LIe=new d;function A7(e,t,n,i){const o=d.clone(n.direction,PIe),r=d.clone(n.up,OIe);if(e._scene.mode===le.SCENE3D){const a=e._projection.ellipsoid,c=tn.eastNorthUpToFixedFrame(t,a,uw),u=B.inverseTransformation(c,fw);B.multiplyByPointAsVector(u,o,o),B.multiplyByPointAsVector(u,r,r)}const s=d.cross(o,r,LIe);return i.heading=p7(o,r),i.pitch=m7(o),i.roll=_7(o,r,s),i}const eB={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},ag=new Ur;ot.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,d.clone(this.positionWC,yS));l(o)&&l(o.west)&&(o=this.getRectangleCameraCoordinates(o,yS),i=!1),l(t.direction)&&(t=A7(this,o,t,eB.orientation)),ag.heading=A(t.heading,0),ag.pitch=A(t.pitch,-N.PI_OVER_TWO),ag.roll=A(t.roll,0),n===le.SCENE3D?vIe(this,o,ag):n===le.SCENE2D?IIe(this,o,ag,i):DIe(this,o,ag,i)};const BIe=new d;ot.prototype.flyHome=function(e){const t=this._mode;if(t===le.MORPHING&&this._scene.completeMorph(),t===le.SCENE2D)this.flyTo({destination:ot.DEFAULT_VIEW_RECTANGLE,duration:e,endTransform:B.IDENTITY});else if(t===le.SCENE3D){const n=this.getRectangleCameraCoordinates(ot.DEFAULT_VIEW_RECTANGLE);let i=d.magnitude(n);i+=i*ot.DEFAULT_VIEW_FACTOR,d.normalize(n,n),d.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 d(0,-1,1);i=d.multiplyByScalar(d.normalize(i,i),5*n,i),this.flyTo({destination:i,duration:e,orientation:{heading:0,pitch:-Math.acos(d.normalize(i,BIe).z),roll:0},endTransform:B.IDENTITY,convert:!1})}};ot.prototype.worldToCameraCoordinates=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new oe),Ns(this),B.multiplyByVector(this._actualInvTransform,e,t)};ot.prototype.worldToCameraCoordinatesPoint=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new d),Ns(this),B.multiplyByPoint(this._actualInvTransform,e,t)};ot.prototype.worldToCameraCoordinatesVector=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new d),Ns(this),B.multiplyByPointAsVector(this._actualInvTransform,e,t)};ot.prototype.cameraToWorldCoordinates=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new oe),Ns(this),B.multiplyByVector(this._actualTransform,e,t)};ot.prototype.cameraToWorldCoordinatesPoint=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new d),Ns(this),B.multiplyByPoint(this._actualTransform,e,t)};ot.prototype.cameraToWorldCoordinatesVector=function(e,t){if(!l(e))throw new x("cartesian is required.");return l(t)||(t=new d),Ns(this),B.multiplyByPointAsVector(this._actualTransform,e,t)};function C7(e,t){const n=e._scene.mapMode2D===sp.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 QH=new d;ot.prototype.move=function(e,t){if(!l(e))throw new x("direction is required.");const n=this.position;d.multiplyByScalar(e,t,QH),d.add(n,QH,n),this._mode===le.SCENE2D&&C7(this,n),this._adjustOrthographicFrustum(!0)};ot.prototype.moveForward=function(e){e=A(e,this.defaultMoveAmount),this._mode===le.SCENE2D?Nv(this,e):this.move(this.direction,e)};ot.prototype.moveBackward=function(e){e=A(e,this.defaultMoveAmount),this._mode===le.SCENE2D?Nv(this,-e):this.move(this.direction,-e)};ot.prototype.moveUp=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,e)};ot.prototype.moveDown=function(e){e=A(e,this.defaultMoveAmount),this.move(this.up,-e)};ot.prototype.moveRight=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,e)};ot.prototype.moveLeft=function(e){e=A(e,this.defaultMoveAmount),this.move(this.right,-e)};ot.prototype.lookLeft=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.up,-e)};ot.prototype.lookRight=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.up,e)};ot.prototype.lookUp=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.right,-e)};ot.prototype.lookDown=function(e){e=A(e,this.defaultLookAmount),this._mode!==le.SCENE2D&&this.look(this.right,e)};const RIe=new Ce,NIe=new J;ot.prototype.look=function(e,t){if(!l(e))throw new x("axis is required.");const n=A(t,this.defaultLookAmount),i=Ce.fromAxisAngle(e,-n,RIe),o=J.fromQuaternion(i,NIe),r=this.direction,s=this.up,a=this.right;J.multiplyByVector(o,r,r),J.multiplyByVector(o,s,s),J.multiplyByVector(o,a,a)};ot.prototype.twistLeft=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,e)};ot.prototype.twistRight=function(e){e=A(e,this.defaultLookAmount),this.look(this.direction,-e)};const MIe=new Ce,FIe=new J;ot.prototype.rotate=function(e,t){if(!l(e))throw new x("axis is required.");const n=A(t,this.defaultRotateAmount),i=Ce.fromAxisAngle(e,-n,MIe),o=J.fromQuaternion(i,FIe);J.multiplyByVector(o,this.position,this.position),J.multiplyByVector(o,this.direction,this.direction),J.multiplyByVector(o,this.up,this.up),d.cross(this.direction,this.up,this.right),d.cross(this.right,this.direction,this.up),this._adjustOrthographicFrustum(!1)};ot.prototype.rotateDown=function(e){e=A(e,this.defaultRotateAmount),T7(this,e)};ot.prototype.rotateUp=function(e){e=A(e,this.defaultRotateAmount),T7(this,-e)};const zIe=new d,UIe=new d,HIe=new d,ZH=new d;function T7(e,t){const n=e.position;if(l(e.constrainedAxis)&&!d.equalsEpsilon(e.position,d.ZERO,N.EPSILON2)){const i=d.normalize(n,zIe),o=d.equalsEpsilon(i,e.constrainedAxis,N.EPSILON2),r=d.equalsEpsilon(i,d.negate(e.constrainedAxis,ZH),N.EPSILON2);if(!o&&!r){const s=d.normalize(e.constrainedAxis,UIe);let a=d.dot(i,s),c=N.acosClamped(a);t>0&&t>c&&(t=c-N.EPSILON4),a=d.dot(i,d.negate(s,ZH)),c=N.acosClamped(a),t<0&&-t>c&&(t=-c+N.EPSILON4);const u=d.cross(s,i,HIe);e.rotate(u,t)}else(o&&t<0||r&&t>0)&&e.rotate(e.right,t)}else e.rotate(e.right,t)}ot.prototype.rotateRight=function(e){e=A(e,this.defaultRotateAmount),b7(this,-e)};ot.prototype.rotateLeft=function(e){e=A(e,this.defaultRotateAmount),b7(this,e)};function b7(e,t){l(e.constrainedAxis)?e.rotate(e.constrainedAxis,t):e.rotate(e.up,t)}function Nv(e,t){const n=e.frustum;if(!(n instanceof Bo)||!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===sp.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===sp.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 E7(e,t){e.move(e.direction,t)}ot.prototype.zoomIn=function(e){e=A(e,this.defaultZoomAmount),this._mode===le.SCENE2D?Nv(this,e):E7(this,e)};ot.prototype.zoomOut=function(e){e=A(e,this.defaultZoomAmount),this._mode===le.SCENE2D?Nv(this,-e):E7(this,-e)};ot.prototype.getMagnitude=function(){if(this._mode===le.SCENE3D)return d.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 VIe=new B;ot.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=tn.eastNorthUpToFixedFrame(e,pe.WGS84,VIe);this.lookAtTransform(n,t)};const kIe=new d,GIe=new Ce,WIe=new Ce,jIe=new J;function x7(e,t,n){t=N.clamp(t,-N.PI_OVER_TWO,N.PI_OVER_TWO),e=N.zeroToTwoPi(e)-N.PI_OVER_TWO;const i=Ce.fromAxisAngle(d.UNIT_Y,-t,GIe),o=Ce.fromAxisAngle(d.UNIT_Z,-e,WIe),r=Ce.multiply(o,i,o),s=J.fromQuaternion(r,jIe),a=d.clone(d.UNIT_X,kIe);return J.multiplyByVector(s,a,a),d.negate(a,a),d.multiplyByScalar(a,n,a),a}ot.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=x7(t.heading,t.pitch,t.range):n=t,this._mode===le.SCENE2D){j.clone(j.ZERO,this.position),d.negate(n,this.up),this.up.z=0,d.magnitudeSquared(this.up)<N.EPSILON10&&d.clone(d.UNIT_Y,this.up),d.normalize(this.up,this.up),this._setTransform(B.IDENTITY),d.negate(d.UNIT_Z,this.direction),d.cross(this.direction,this.up,this.right),d.normalize(this.right,this.right);const i=this.frustum,o=i.top/i.right;i.right=d.magnitude(n)*.5,i.left=-i.right,i.top=o*i.right,i.bottom=-i.top,this._setTransform(e);return}d.clone(n,this.position),d.negate(this.position,this.direction),d.normalize(this.direction,this.direction),d.cross(this.direction,d.UNIT_Z,this.right),d.magnitudeSquared(this.right)<N.EPSILON10&&d.clone(d.UNIT_X,this.right),d.normalize(this.right,this.right),d.cross(this.right,this.direction,this.up),d.normalize(this.up,this.up),this._adjustOrthographicFrustum(!0)};const W0=new Ae,qIe=new Ae,YIe=new d,$Ie=new d,XIe=new d,KIe=new d,JIe=new d,QIe=new d,ZIe=new d,yP=new d,ePe={direction:new d,right:new d,up:new d};let eV;function Ds(e,t,n,i){return Math.abs(d.dot(t,n))/i-d.dot(e,n)}function w7(e,t,n,i){const o=e._projection.ellipsoid,r=i?e:ePe,s=t.north,a=t.south;let c=t.east;const u=t.west;u>c&&(c+=N.TWO_PI);const f=(u+c)*.5;let h;if(a<-N.PI_OVER_TWO+N.RADIANS_PER_DEGREE&&s>N.PI_OVER_TWO-N.RADIANS_PER_DEGREE)h=0;else{const F=W0;F.longitude=f,F.latitude=s,F.height=0;const H=qIe;H.longitude=f,H.latitude=a,H.height=0;let v=eV;(!l(v)||v.ellipsoid!==o)&&(eV=v=new vd(void 0,void 0,o)),v.setEndPoints(F,H),h=v.interpolateUsingFraction(.5,W0).latitude}const _=W0;_.longitude=f,_.latitude=h,_.height=0;const g=o.cartographicToCartesian(_,ZIe),p=W0;p.longitude=c,p.latitude=s;const y=o.cartographicToCartesian(p,YIe);p.longitude=u;const C=o.cartographicToCartesian(p,XIe);p.longitude=f;const T=o.cartographicToCartesian(p,JIe);p.latitude=a;const E=o.cartographicToCartesian(p,QIe);p.longitude=c;const w=o.cartographicToCartesian(p,KIe);p.longitude=u;const S=o.cartographicToCartesian(p,$Ie);d.subtract(C,g,C),d.subtract(w,g,w),d.subtract(y,g,y),d.subtract(S,g,S),d.subtract(T,g,T),d.subtract(E,g,E);const P=o.geodeticSurfaceNormal(g,r.direction);d.negate(P,P);const O=d.cross(P,d.UNIT_Z,r.right);d.normalize(O,O);const z=d.cross(O,P,r.up);let R;if(e.frustum instanceof Ft){const F=Math.max(d.distance(y,C),d.distance(w,S)),H=Math.max(d.distance(y,w),d.distance(C,S));let v,I;const m=e.frustum._offCenterFrustum.right/e.frustum._offCenterFrustum.top,D=H*m;F>D?(v=F,I=v/m):(I=H,v=D),R=Math.max(v,I)}else{const F=Math.tan(e.frustum.fovy*.5),H=e.frustum.aspectRatio*F;if(R=Math.max(Ds(P,z,C,F),Ds(P,z,w,F),Ds(P,z,y,F),Ds(P,z,S,F),Ds(P,z,T,F),Ds(P,z,E,F),Ds(P,O,C,H),Ds(P,O,w,H),Ds(P,O,y,H),Ds(P,O,S,H),Ds(P,O,T,H),Ds(P,O,E,H)),a<0&&s>0){const v=W0;v.longitude=u,v.latitude=0,v.height=0;let I=o.cartographicToCartesian(v,yP);d.subtract(I,g,I),R=Math.max(R,Ds(P,z,I,F),Ds(P,O,I,H)),v.longitude=c,I=o.cartographicToCartesian(v,yP),d.subtract(I,g,I),R=Math.max(R,Ds(P,z,I,F),Ds(P,O,I,H))}}return d.add(g,d.multiplyByScalar(P,-R,yP),n)}const tPe=new Ae,nPe=new d,iPe=new d;function oPe(e,t,n){const i=e._projection;t.west>t.east&&(t=_e.MAX_VALUE);const o=e._actualTransform,r=e._actualInvTransform,s=tPe;s.longitude=t.east,s.latitude=t.north;const a=i.project(s,nPe);B.multiplyByPoint(o,a,a),B.multiplyByPoint(r,a,a),s.longitude=t.west,s.latitude=t.south;const c=i.project(s,iPe);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),f=e.frustum.aspectRatio*u;n.z=Math.max((a.x-c.x)/f,(a.y-c.y)/u)*.5}else{const u=a.x-c.x,f=a.y-c.y;n.z=Math.max(u,f)}return n}const rPe=new Ae,sPe=new d,aPe=new d;function cPe(e,t,n){const i=e._projection;let o=t.east;t.west>t.east&&(e._scene.mapMode2D===sp.INFINITE_SCROLL?o+=N.TWO_PI:(t=_e.MAX_VALUE,o=t.east));let r=rPe;r.longitude=o,r.latitude=t.north;const s=i.project(r,sPe);r.longitude=t.west,r.latitude=t.south;const a=i.project(r,aPe),c=Math.abs(s.x-a.x)*.5;let u=Math.abs(s.y-a.y)*.5,f,h;const _=e.frustum.right/e.frustum.top,g=u*_;return c>g?(f=c,h=f/_):(h=u,f=g),u=Math.max(2*f,2*h),n.x=(s.x-a.x)*.5+a.x,n.y=(s.y-a.y)*.5+a.y,r=i.unproject(n,r),r.height=u,n=i.project(r,n),n}ot.prototype.getRectangleCameraCoordinates=function(e,t){if(!l(e))throw new x("rectangle is required");const n=this._mode;if(l(t)||(t=new d),n===le.SCENE3D)return w7(this,e,t);if(n===le.COLUMBUS_VIEW)return oPe(this,e,t);if(n===le.SCENE2D)return cPe(this,e,t)};const lPe=new Pn;function uPe(e,t,n,i){n=A(n,pe.WGS84);const o=e.getPickRay(t,lPe),r=nr.rayEllipsoid(o,n);if(!r)return;const s=r.start>0?r.start:r.stop;return Pn.getPoint(o,s,i)}const fPe=new Pn;function dPe(e,t,n,i){let r=e.getPickRay(t,fPe).origin;r=d.fromElements(r.y,r.z,0,r);const s=n.unproject(r);if(!(s.latitude<-N.PI_OVER_TWO||s.latitude>N.PI_OVER_TWO))return n.ellipsoid.cartographicToCartesian(s,i)}const hPe=new Pn;function pPe(e,t,n,i){const o=e.getPickRay(t,hPe),r=-o.origin.x/o.direction.x;Pn.getPoint(o,r,i);const s=n.unproject(new d(i.y,i.z,0));if(!(s.latitude<-N.PI_OVER_TWO||s.latitude>N.PI_OVER_TWO||s.longitude<-Math.PI||s.longitude>Math.PI))return n.ellipsoid.cartographicToCartesian(s,i)}ot.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 d),t=A(t,pe.WGS84),this._mode===le.SCENE3D)n=uPe(this,e,t,n);else if(this._mode===le.SCENE2D)n=dPe(this,e,this._projection,n);else if(this._mode===le.COLUMBUS_VIEW)n=pPe(this,e,this._projection,n);else return;return n}};const mPe=new d,_Pe=new d,gPe=new d;function yPe(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,f=2/r*(r-t.y)-1,h=e.positionWC;d.clone(h,n.origin);const _=d.multiplyByScalar(e.directionWC,c,mPe);d.add(h,_,_);const g=d.multiplyByScalar(e.rightWC,u*c*a,_Pe),p=d.multiplyByScalar(e.upWC,f*c*s,gPe),y=d.add(_,g,n.direction);return d.add(y,p,y),d.subtract(y,h,y),d.normalize(y,y),n}const UE=new d;function APe(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 d.clone(e.position,u),d.multiplyByScalar(e.right,a,UE),d.add(UE,u,u),d.multiplyByScalar(e.up,c,UE),d.add(UE,u,u),d.clone(e.directionWC,n.direction),(e._mode===le.COLUMBUS_VIEW||e._mode===le.SCENE2D)&&d.fromElements(n.origin.z,n.origin.x,n.origin.y,n.origin),n}ot.prototype.getPickRay=function(e,t){if(!l(e))throw new x("windowPosition is required.");l(t)||(t=new Pn);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)?yPe(this,e,t):APe(this,e,t)};const CPe=new d,TPe=new d;ot.prototype.distanceToBoundingSphere=function(e){if(!l(e))throw new x("boundingSphere is required.");const t=d.subtract(this.positionWC,e.center,CPe),n=d.multiplyByScalar(this.directionWC,d.dot(t,this.directionWC),TPe);return Math.max(0,d.magnitude(n)-e.radius)};const bPe=new j;ot.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,bPe);return Math.max(o.x,o.y)};function EPe(e,t,n,i,o,r){const s=d.clone(t);n.y>i?s.y-=n.y-i:n.y<-i&&(s.y+=-i-n.y),n.z>o?s.z-=n.z-o:n.z<-o&&(s.z+=-o-n.z);function a(c){const u=d.lerp(t,s,c.time,new d);e.worldToCameraCoordinatesPoint(u,e.position)}return{easingFunction:lc.EXPONENTIAL_OUT,startObject:{time:0},stopObject:{time:1},duration:r,update:a}}const xPe=new d,tV=new d,wPe=new d,SPe=new d;function vPe(e,t){let n=e.position;const i=e.direction,o=e.worldToCameraCoordinatesVector(d.UNIT_X,xPe),r=-d.dot(o,n)/d.dot(o,i),s=d.add(n,d.multiplyByScalar(i,r,tV),tV);e.cameraToWorldCoordinatesPoint(s,s),n=e.cameraToWorldCoordinatesPoint(e.position,wPe);const a=Math.tan(e.frustum.fovy*.5),c=e.frustum.aspectRatio*a,u=d.magnitude(d.subtract(n,s,SPe)),f=c*u,h=a*u,_=e._maxCoord.x,g=e._maxCoord.y,p=Math.max(f-_,_),y=Math.max(h-g,g);if(n.z<-p||n.z>p||n.y<-y||n.y>y){const C=s.y<-p||s.y>p,T=s.z<-y||s.z>y;if(C||T)return EPe(e,n,s,p,y,t)}}ot.prototype.createCorrectPositionTween=function(e){if(!l(e))throw new x("duration is required.");if(this._mode===le.COLUMBUS_VIEW)return vPe(this,e)};const DPe=new d,Or={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};ot.prototype.cancelFlight=function(){l(this._currentFlight)&&(this._currentFlight.cancelTween(),this._currentFlight=void 0)};ot.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=Or.destination,e.orientation.heading=Or.heading,e.orientation.pitch=Or.pitch,e.orientation.roll=Or.roll,this.setView(e),l(this._currentFlight.complete)&&this._currentFlight.complete(),this._currentFlight=void 0}};ot.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 _e;i&&(t=this.getRectangleCameraCoordinates(t,DPe));let o=A(e.orientation,A.EMPTY_OBJECT);if(l(o.direction)&&(o=A7(this,t,o,eB.orientation)),l(e.duration)&&e.duration<=0){const f=eB;f.destination=e.destination,f.orientation.heading=o.heading,f.orientation.pitch=o.pitch,f.orientation.roll=o.roll,f.convert=e.convert,f.endTransform=e.endTransform,this.setView(f),typeof e.complete=="function"&&e.complete();return}const r=this;let s;Or.destination=t,Or.heading=o.heading,Or.pitch=o.pitch,Or.roll=o.roll,Or.duration=e.duration,Or.complete=function(){s===r._currentFlight&&(r._currentFlight=void 0),l(e.complete)&&e.complete()},Or.cancel=e.cancel,Or.endTransform=e.endTransform,Or.convert=i?!1:e.convert,Or.maximumHeight=e.maximumHeight,Or.pitchAdjustHeight=e.pitchAdjustHeight,Or.flyOverLongitude=e.flyOverLongitude,Or.flyOverLongitudeWeight=e.flyOverLongitudeWeight,Or.easingFunction=e.easingFunction;const a=this._scene,c=aIe.createTween(a,Or);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=ot.clone(this)),u.setView({destination:t,orientation:o}),this._scene.preloadFlightCullingVolume=u.frustum.computeCullingVolume(u.positionWC,u.directionWC,u.upWC))};function IPe(e,t){const n=e.frustum,i=Math.tan(n.fovy*.5),o=n.aspectRatio*i;return Math.max(t/o,t/i)}function PPe(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 OPe=100;function S7(e,t,n){n=t_.clone(l(n)?n:ot.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=OPe:e.frustum instanceof Ft||e._mode===le.SCENE2D?n.range=PPe(e,s):n.range=IPe(e,s),n.range=N.clamp(n.range,i,o)}return n}ot.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=S7(this,e,t),this.lookAt(e.center,t)};const LPe=new B,BPe=new d,RPe=new d,NPe=new d,MPe=new d,FPe=new oe,zPe=new Ce,UPe=new J;ot.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=S7(this,e,t.offset);let o;n?o=d.multiplyByScalar(d.UNIT_Z,i.range,BPe):o=x7(i.heading,i.pitch,i.range);const r=tn.eastNorthUpToFixedFrame(e.center,pe.WGS84,LPe);B.multiplyByPoint(r,o,o);let s,a;if(!n){if(s=d.subtract(e.center,o,RPe),d.normalize(s,s),a=B.multiplyByPointAsVector(r,d.UNIT_Z,NPe),1-Math.abs(d.dot(s,a))<N.EPSILON6){const u=Ce.fromAxisAngle(s,i.heading,zPe),f=J.fromQuaternion(u,UPe);d.fromCartesian4(B.getColumn(r,1,FPe),a),J.multiplyByVector(f,a,a)}const c=d.cross(s,a,MPe);d.cross(c,s,a),d.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 nV=new d,iV=new d,AP=new d,oV=new d,j0=[new d,new d,new d,new d];function HPe(e,t){const n=t.radii,i=e.positionWC,o=d.multiplyComponents(t.oneOverRadii,i,nV),r=d.magnitude(o),s=d.normalize(o,iV);let a,c;d.equalsEpsilon(s,d.UNIT_Z,N.EPSILON10)?(a=new d(0,1,0),c=new d(0,0,1)):(a=d.normalize(d.cross(d.UNIT_Z,s,AP),AP),c=d.normalize(d.cross(s,a,oV),oV));const u=Math.sqrt(d.magnitudeSquared(o)-1),f=d.multiplyByScalar(s,1/r,nV),h=u/r,_=d.multiplyByScalar(a,h,iV),g=d.multiplyByScalar(c,h,AP),p=d.add(f,g,j0[0]);d.subtract(p,_,p),d.multiplyComponents(n,p,p);const y=d.subtract(f,g,j0[1]);d.subtract(y,_,y),d.multiplyComponents(n,y,y);const C=d.subtract(f,g,j0[2]);d.add(C,_,C),d.multiplyComponents(n,C,C);const T=d.add(f,g,j0[3]);return d.add(T,_,T),d.multiplyComponents(n,T,T),j0}const CP=new j,VPe=new d,Ph=[new Ae,new Ae,new Ae,new Ae];function HE(e,t,n,i,o,r){CP.x=e,CP.y=t;const s=i.pickEllipsoid(CP,o,VPe);return l(s)?(Ph[n]=o.cartesianToCartographic(s,Ph[n]),1):(Ph[n]=o.cartesianToCartographic(r[n],Ph[n]),0)}ot.prototype.computeViewRectangle=function(e,t){e=A(e,pe.WGS84);const n=this.frustum.computeCullingVolume(this.positionWC,this.directionWC,this.upWC),i=new fe(d.ZERO,e.maximumRadius);if(n.computeVisibility(i)===mn.OUTSIDE)return;const r=this._scene.canvas,s=r.clientWidth,a=r.clientHeight;let c=0;const u=HPe(this,e);if(c+=HE(0,0,0,this,e,u),c+=HE(0,a,1,this,e,u),c+=HE(s,a,2,this,e,u),c+=HE(s,0,3,this,e,u),c<2)return _e.MAX_VALUE;t=_e.fromCartographicArray(Ph,t);let f=0,h=Ph[3].longitude;for(let _=0;_<4;++_){const g=Ph[_].longitude,p=Math.abs(g-h);p>N.PI?f+=N.TWO_PI-p:f+=p,h=g}return N.equalsEpsilon(Math.abs(f),N.TWO_PI,N.EPSILON9)&&(t.west=-N.PI,t.east=N.PI,Ph[0].latitude>=0?t.north=N.PI_OVER_TWO:t.south=-N.PI_OVER_TWO),t};ot.prototype.switchToPerspectiveFrustum=function(){if(this._mode===le.SCENE2D||this.frustum instanceof Un)return;const e=this._scene;this.frustum=new Un,this.frustum.aspectRatio=e.drawingBufferWidth/e.drawingBufferHeight,this.frustum.fov=N.toRadians(60)};ot.prototype.switchToOrthographicFrustum=function(){if(this._mode===le.SCENE2D||this.frustum instanceof Ft)return;const e=g7(this),t=this._scene;this.frustum=new Ft,this.frustum.aspectRatio=t.drawingBufferWidth/t.drawingBufferHeight,this.frustum.width=e};ot.clone=function(e,t){return l(t)||(t=new ot(e._scene)),d.clone(e.position,t.position),d.clone(e.direction,t.direction),d.clone(e.up,t.up),d.clone(e.right,t.right),B.clone(e._transform,t.transform),t._transformChanged=!0,t.frustum=e.frustum.clone(),t};function Js(e){e=A(e,0),this._array=new Array(e),this._length=e}Object.defineProperties(Js.prototype,{length:{get:function(){return this._length},set:function(e){b.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}}});Js.prototype.get=function(e){return b.typeOf.number.lessThan("index",e,this._array.length),this._array[e]};Js.prototype.set=function(e,t){b.typeOf.number("index",e),e>=this._length&&(this.length=e+1),this._array[e]=t};Js.prototype.peek=function(){return this._array[this._length-1]};Js.prototype.push=function(e){const t=this.length++;this._array[t]=e};Js.prototype.pop=function(){if(this._length===0)return;const e=this._array[this._length-1];return--this.length,e};Js.prototype.reserve=function(e){b.typeOf.number.greaterThanOrEquals("length",e,0),e>this._array.length&&(this._array.length=e)};Js.prototype.resize=function(e){b.typeOf.number.greaterThanOrEquals("length",e,0),this.length=e};Js.prototype.trim=function(e){e=A(e,this._length),this._array.length=e};const kPe={ADD:0,REPLACE:1},Aa=Object.freeze(kPe);function rM(){}const q0={stack:new Js,stackMaximumLength:0};rM.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),!v7(i))return n;const o=q0.stack;for(o.push(e.root);o.length>0;){q0.stackMaximumLength=Math.max(q0.stackMaximumLength,o.length);const r=o.pop(),s=r.refine===Aa.ADD,a=r.refine===Aa.REPLACE,c=WPe(e,r);c&&jPe(e,r,o,t),(s||a&&!c)&&(qPe(e,r),YPe(e,r,t),XPe(e,r,t),!D7(r)&&!r.contentAvailable&&(n=!1)),$Pe(e)}return q0.stack.trim(q0.stackMaximumLength),n};function v7(e){return e._visible&&e._inRequestVolume}function D7(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function GPe(e){return!D7(e)&&e.contentUnloaded}function WPe(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:(t.hasEmptyContent,!0)}function jPe(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),v7(a)&&n.push(a)}}function qPe(e,t){(GPe(t)||t.contentExpired)&&(t._priority=0,e._requestedTiles.push(t))}function YPe(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function $Pe(e){++e.statistics.visited}function XPe(e,t,n){t.contentAvailable&&t.contentVisibility(n)!==mn.OUTSIDE&&e._selectedTiles.push(t)}const KPe={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0},Xg=Object.freeze(KPe);function v_(){}function D_(e){return e._visible&&e._inRequestVolume}const cC={stack:new Js,stackMaximumLength:0},lC={stack:new Js,stackMaximumLength:0},uC={stack:new Js,stackMaximumLength:0},Du={stack:new Js,stackMaximumLength:0,ancestorStack:new Js,ancestorStackMaximumLength:0},JPe=2;v_.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(Fv(e,n,t),!D_(n)||n.getScreenSpaceError(t,!0)<=e._maximumScreenSpaceError)return;jC(e)?e.immediatelyLoadDesiredLevelOfDetail?ZPe(e,n,t):eOe(e,n,t):QPe(e,n,t),cC.stack.trim(cC.stackMaximumLength),lC.stack.trim(lC.stackMaximumLength),uC.stack.trim(uC.stackMaximumLength),Du.stack.trim(Du.stackMaximumLength),Du.ancestorStack.trim(Du.ancestorStackMaximumLength);const i=e._requestedTiles,o=i.length;for(let r=0;r<o;++r)i[r].updatePriority()};function QPe(e,t,n){const i=e._maximumScreenSpaceError,o=e._maximumScreenSpaceError;aM(e,t,i,o,n)}function ZPe(e,t,n){const i=Number.MAX_VALUE,o=e._maximumScreenSpaceError;aM(e,t,i,o,n),L7(e,t,n)}function eOe(e,t,n){const i=Math.max(e.baseScreenSpaceError,e.maximumScreenSpaceError),o=e.maximumScreenSpaceError;aM(e,t,i,o,n),L7(e,t,n)}function jC(e){return e._skipLevelOfDetail}function tOe(e,t){e._emptyTiles.push(t)}function fC(e,t,n){if(t.contentVisibility(n)!==mn.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 nOe(e,t,n){const i=uC.stack;for(i.push(t);i.length>0;){uC.stackMaximumLength=Math.max(uC.stackMaximumLength,i.length);const r=i.pop().children,s=r.length;for(let a=0;a<s;++a){const c=r[a];D_(c)&&(c.contentAvailable?(Fv(e,c,n),Mv(e,c,n),fC(e,c,n)):c._depth-t._depth<JPe&&i.push(c))}}}function VE(e,t,n){if(!jC(e)){t.contentAvailable&&fC(e,t,n);return}const i=t.contentAvailable?t:t._ancestorWithContentAvailable;l(i)?i._shouldSelect=!0:nOe(e,t,n)}function iOe(e,t,n){++e._statistics.visited,t._visitedFrame=n.frameNumber}function Mv(e,t,n){t._touchedFrame!==n.frameNumber&&(e._cache.touch(t),t._touchedFrame=n.frameNumber)}function oOe(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 rOe(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 Em(e,t,n){if(t._requestedFrame===n.frameNumber||!O7(t)&&!t.contentExpired||!rOe(e,t,n))return;const i=n.camera.timeSinceMoved<e.foveatedTimeDelay;t.priorityDeferred&&i||(t._requestedFrame=n.frameNumber,e._requestedTiles.push(t))}function I7(e,t,n){t._updatedVisibilityFrame!==e._updatedVisibilityFrame&&(t.updateVisibility(n),t._updatedVisibilityFrame=e._updatedVisibilityFrame)}function sOe(e,t,n){let i=!1;const o=t.children,r=o.length;for(let s=0;s<r;++s){const a=o[s];I7(e,a,n),i=i||D_(a)}return i}function aOe(e,t,n){const i=t.parent;return!l(i)||i.hasTilesetContent||i.hasImplicitContent||i.refine!==Aa.ADD?!1:t.getScreenSpaceError(n,!0)<=e._maximumScreenSpaceError}function P7(e,t,n){if(I7(e,t,n),!D_(t))return;const i=t.children.length>0;if((t.hasTilesetContent||t.hasImplicitContent)&&i){const s=t.children[0];P7(e,s,n),t._visible=s._visible;return}if(aOe(e,t,n)){t._visible=!1;return}const o=t.refine===Aa.REPLACE,r=t._optimChildrenWithinParent===Xg.USE_OPTIMIZATION;if(o&&r&&i&&!sOe(e,t,n)){++e._statistics.numberOfTilesCulledWithChildrenUnion,t._visible=!1;return}}function Fv(e,t,n){P7(e,t,n),t.updateExpiration(),t._wasMinPriorityChild=!1,t._priorityHolder=t,oOe(e,t),t._shouldSelect=!1,t._finalResolution=!0}function cOe(e,t){e._ancestorWithContent=void 0,e._ancestorWithContentAvailable=void 0;const n=e.parent;if(l(n)){const i=!O7(n)||n._requestedFrame===t.frameNumber;e._ancestorWithContent=i?n:n._ancestorWithContent,e._ancestorWithContentAvailable=n.contentAvailable?n:n._ancestorWithContentAvailable}}function qC(e){return e.hasEmptyContent||e.hasTilesetContent||e.hasImplicitContent}function O7(e){return!qC(e)&&e.contentUnloaded}function lOe(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 uOe(e,t){return t._distanceToCamera===0&&e._distanceToCamera===0?t._centerZDepth-e._centerZDepth:t._distanceToCamera-e._distanceToCamera}function fOe(e,t,n,i){let o;const r=t.refine===Aa.REPLACE,s=t.children,a=s.length;for(o=0;o<a;++o)Fv(e,s[o],i);s.sort(uOe);const c=!jC(e)&&r&&!qC(t);let u=!0,f=!1,h=-1,_=Number.MAX_VALUE,g;for(o=0;o<a;++o)if(g=s[o],D_(g)?(n.push(g),g._foveatedFactor<_&&(h=o,_=g._foveatedFactor),f=!0):(c||e.loadSiblings)&&(g._foveatedFactor<_&&(h=o,_=g._foveatedFactor),Em(e,g,i),Mv(e,g,i)),c){let p;g._inRequestVolume?qC(g)?p=hOe(e,g,i):p=g.contentAvailable:p=!1,u=u&&p}if(f||(u=!1),h!==-1&&!jC(e)&&r){const p=s[h];p._wasMinPriorityChild=!0;const y=(t._wasMinPriorityChild||t===e.root)&&_<=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 dOe(e,t,n){return jC(e)?e.immediatelyLoadDesiredLevelOfDetail?!1:l(t._ancestorWithContent)?t._screenSpaceError===0?t.parent._screenSpaceError>n:t._screenSpaceError>n:!0:!0}function sM(e,t){return t.children.length===0?!1:t.hasTilesetContent||t.hasImplicitContent?!t.contentExpired:t._screenSpaceError>e._maximumScreenSpaceError}function aM(e,t,n,i,o){const r=cC.stack;for(r.push(t);r.length>0;){cC.stackMaximumLength=Math.max(cC.stackMaximumLength,r.length);const s=r.pop();cOe(s,o);const a=dOe(e,s,n),c=s.refine===Aa.ADD,u=s.refine===Aa.REPLACE,f=s.parent,h=!l(f)||f._refines;let _=!1;sM(e,s)&&(_=fOe(e,s,r,o)&&h);const g=!_&&h;qC(s)?(tOe(e,s),Em(e,s,o),g&&VE(e,s,o)):c?(VE(e,s,o),Em(e,s,o)):u&&(a?(Em(e,s,o),g&&VE(e,s,o)):g?(VE(e,s,o),Em(e,s,o)):lOe(e,s)&&Em(e,s,o)),iOe(e,s,o),Mv(e,s,o),s._refines=_}}function hOe(e,t,n){let i=!0;const o=lC.stack;for(o.push(t);o.length>0;){lC.stackMaximumLength=Math.max(lC.stackMaximumLength,o.length);const r=o.pop(),s=r.children,a=s.length,c=qC(r),u=c&&sM(e,r),f=c&&r.children.length===0;if(!u&&!r.contentAvailable&&!f&&(i=!1),Fv(e,r,n),D_(r)||(Em(e,r,n),Mv(e,r,n)),u)for(let h=0;h<a;++h){const _=s[h];o.push(_)}}return i}function L7(e,t,n){const i=Du.stack,o=Du.ancestorStack;let r;for(i.push(t);i.length>0||o.length>0;){if(Du.stackMaximumLength=Math.max(Du.stackMaximumLength,i.length),Du.ancestorStackMaximumLength=Math.max(Du.ancestorStackMaximumLength,o.length),o.length>0){const _=o.peek();if(_._stackLength===i.length){o.pop(),_!==r&&(_._finalResolution=!1),fC(e,_,n);continue}}const s=i.pop();if(!l(s))continue;const a=s.refine===Aa.ADD,c=s._shouldSelect,u=s.children,f=u.length,h=sM(e,s);if(c)if(a)fC(e,s,n);else{if(s._selectionDepth=o.length,s._selectionDepth>0&&(e._hasMixedContent=!0),r=s,!h){fC(e,s,n);continue}o.push(s),s._stackLength=i.length}if(h)for(let _=0;_<f;++_){const g=u[_];D_(g)&&i.push(g)}}}const su={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},Dd=new Array(su.NUMBER_OF_PASSES);Dd[su.RENDER]=Object.freeze({traversal:v_,isRender:!0,requestTiles:!0,ignoreCommands:!1});Dd[su.PICK]=Object.freeze({traversal:v_,isRender:!1,requestTiles:!1,ignoreCommands:!1});Dd[su.SHADOW]=Object.freeze({traversal:v_,isRender:!1,requestTiles:!0,ignoreCommands:!1});Dd[su.PRELOAD]=Object.freeze({traversal:v_,isRender:!1,requestTiles:!0,ignoreCommands:!0});Dd[su.PRELOAD_FLIGHT]=Object.freeze({traversal:v_,isRender:!1,requestTiles:!0,ignoreCommands:!0});Dd[su.REQUEST_RENDER_MODE_DEFER_CHECK]=Object.freeze({traversal:v_,isRender:!1,requestTiles:!0,ignoreCommands:!0});Dd[su.MOST_DETAILED_PRELOAD]=Object.freeze({traversal:rM,isRender:!1,requestTiles:!0,ignoreCommands:!0});Dd[su.MOST_DETAILED_PICK]=Object.freeze({traversal:rM,isRender:!1,requestTiles:!1,ignoreCommands:!1});su.getPassOptions=function(e){return Dd[e]};const Ys=Object.freeze(su);function I_(e){b.typeOf.object("options",e),b.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 xt(){this._array=[],this._hash={}}Object.defineProperties(xt.prototype,{length:{get:function(){return this._array.length}},values:{get:function(){return this._array}}});xt.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])};xt.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))};xt.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]};xt.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};xt.prototype.removeAll=function(){const e=this._array;e.length>0&&(this._hash={},e.length=0)};const rV=576,pOe=100,Y0="#ffffff",TP="#48b";function B7(e,t){this.credit=e,this.count=A(t,1)}function mOe(e,t){const n=e.length;for(let i=0;i<n;i++){const o=e[i];if(Kn.equals(o,t))return!0}return!1}function _Oe(e){const t=e._previousCesiumCredit,n=e._currentCesiumCredit;Kn.equals(n,t)||(l(t)&&e._cesiumCreditContainer.removeChild(t.element),l(n)&&e._cesiumCreditContainer.appendChild(n.element),e._previousCesiumCredit=n)}const R7="cesium-credit-delimiter";function sV(e){const t=document.createElement("span");return t.textContent=e,t.className=R7,t}function aV(e,t){if(l(t)){const n=document.createElement(t);n._creditId=e._creditId,n.appendChild(e),e=n}return e}function cV(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(sV(n));else{const f=o[u];f.className!==R7&&e.replaceChild(sV(n),f)}}const c=a.element;if(o.length<=r)e.appendChild(aV(c,i));else{const u=o[r];u._creditId!==a._id&&e.replaceChild(aV(c,i),u)}}}for(++r;r<o.length;)e.removeChild(o[r])}function gOe(e){const t=e._lightboxCredits,n=e.viewport.clientWidth,i=e.viewport.clientHeight;n!==e._lastViewportWidth&&(n<rV?(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>=rV&&i!==e._lastViewportHeight&&(t.style.marginTop=`${Math.floor((i-t.clientHeight)*.5)}px`,e._lastViewportHeight=i)}function Is(e,t){let n=`${e} {`;for(const i in t)t.hasOwnProperty(i)&&(n+=`${i}: ${t[i]}; `);return n+=` }
`,n}function yOe(){let e="";e+=Is(".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+=Is(".cesium-credit-lightbox",{"background-color":"#303336",color:Y0,position:"relative","min-height":`${pOe}px`,margin:"auto"}),e+=Is(".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",{color:Y0}),e+=Is(".cesium-credit-lightbox > ul > li a:hover",{color:TP}),e+=Is(".cesium-credit-lightbox.cesium-credit-lightbox-expanded",{border:"1px solid #444","border-radius":"5px","max-width":"370px"}),e+=Is(".cesium-credit-lightbox.cesium-credit-lightbox-mobile",{height:"100%",width:"100%"}),e+=Is(".cesium-credit-lightbox-title",{padding:"20px 20px 0 20px"}),e+=Is(".cesium-credit-lightbox-close",{"font-size":"18pt",cursor:"pointer",position:"absolute",top:"0",right:"6px",color:Y0}),e+=Is(".cesium-credit-lightbox-close:hover",{color:TP}),e+=Is(".cesium-credit-lightbox > ul",{margin:"0",padding:"12px 20px 12px 40px","font-size":"13px"}),e+=Is(".cesium-credit-lightbox > ul > li",{"padding-bottom":"6px"}),e+=Is(".cesium-credit-lightbox > ul > li *",{padding:"0",margin:"0"}),e+=Is(".cesium-credit-expand-link",{"padding-left":"5px",cursor:"pointer","text-decoration":"underline",color:Y0}),e+=Is(".cesium-credit-expand-link:hover",{color:TP}),e+=Is(".cesium-credit-text",{color:Y0}),e+=Is(".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 Oo(e,t,n){b.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="&times;",c.className="cesium-credit-lightbox-close",r.appendChild(c);const u=document.createElement("ul");r.appendChild(u);const f=document.createElement("div");f.className="cesium-credit-logoContainer",f.style.display="inline",e.appendChild(f);const h=document.createElement("div");h.className="cesium-credit-textContainer",h.style.display="inline",e.appendChild(h);const _=document.createElement("a");_.className="cesium-credit-expand-link",_.onclick=this.showLightbox.bind(this),_.textContent="Data attribution",e.appendChild(_),yOe();const g=Kn.clone(Oo.cesiumCredit);this._delimiter=A(t," • "),this._screenContainer=h,this._cesiumCreditContainer=f,this._lastViewportHeight=void 0,this._lastViewportWidth=void 0,this._lightboxCredits=r,this._creditList=u,this._lightbox=o,this._hideLightbox=s,this._expandLink=_,this._expanded=!1,this._defaultCredits=[],this._cesiumCredit=g,this._previousCesiumCredit=void 0,this._currentCesiumCredit=g,this._creditDisplayElementPool=[],this._creditDisplayElementIndex=0,this._currentFrameCredits={screenCredits:new xt,lightboxCredits:new xt},this._defaultCredit=void 0,this.viewport=n,this.container=e}function N7(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 B7(n,i),r.push(o)),++e._creditDisplayElementPoolIndex,t.set(n.id,o)}}Oo.prototype.addCredit=function(e){if(b.defined("credit",e),e._isIon){l(this._defaultCredit)||(this._defaultCredit=Kn.clone(M7())),this._currentCesiumCredit=this._defaultCredit;return}let t;e.showOnScreen?t=this._currentFrameCredits.screenCredits:t=this._currentFrameCredits.lightboxCredits,N7(this,t,e)};Oo.prototype.addDefaultCredit=function(e){b.defined("credit",e);const t=this._defaultCredits;mOe(t,e)||t.push(e)};Oo.prototype.removeDefaultCredit=function(e){b.defined("credit",e);const t=this._defaultCredits,n=t.indexOf(e);n!==-1&&t.splice(n,1)};Oo.prototype.showLightbox=function(){this._lightbox.style.display="block",this._expanded=!0};Oo.prototype.hideLightbox=function(){this._lightbox.style.display="none",this._expanded=!1};Oo.prototype.update=function(){this._expanded&&gOe(this)};Oo.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];N7(this,t,o,Number.MAX_VALUE)}e.lightboxCredits.removeAll(),Kn.equals(Oo.cesiumCredit,this._cesiumCredit)||(this._cesiumCredit=Kn.clone(Oo.cesiumCredit)),this._currentCesiumCredit=this._cesiumCredit};Oo.prototype.endFrame=function(){const e=this._currentFrameCredits.screenCredits.values;cV(this._screenContainer,e,this._delimiter,void 0);const t=this._currentFrameCredits.lightboxCredits.values;this._expandLink.style.display=t.length>0?"inline":"none",cV(this._creditList,t,void 0,"li"),_Oe(this)};Oo.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),Ue(this)};Oo.prototype.isDestroyed=function(){return!1};Oo._cesiumCredit=void 0;Oo._cesiumCreditInitialized=!1;let kE;function M7(){if(!l(kE)){let e=dn("Assets/Images/ion-credit.png");e.indexOf("http://")!==0&&e.indexOf("https://")!==0&&e.indexOf("data:")!==0&&(e=new Ts(e).path()),kE=new Kn(`<a href="https://cesium.com/" target="_blank"><img src="${e}" title="Cesium ion"/></a>`,!0)}return Oo._cesiumCreditInitialized||(Oo._cesiumCredit=kE,Oo._cesiumCreditInitialized=!0),kE}Object.defineProperties(Oo,{cesiumCredit:{get:function(){return M7(),Oo._cesiumCredit},set:function(e){Oo._cesiumCredit=e,Oo._cesiumCreditInitialized=!0}}});Oo.CreditDisplayElement=B7;const zv=0,AOe=1;function ap(e){b.typeOf.object("options",e),b.typeOf.object("options.frustum",e.frustum),b.typeOf.object("options.origin",e.origin),b.typeOf.object("options.orientation",e.orientation);const t=e.frustum,n=e.orientation,i=e.origin,o=A(e.vertexFormat,Ne.DEFAULT),r=A(e._drawNearPlane,!0);let s,a;t instanceof Un?(s=zv,a=Un.packedLength):t instanceof Ft&&(s=AOe,a=Ft.packedLength),this._frustumType=s,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=Ce.clone(n),this._drawNearPlane=r,this._vertexFormat=o,this._workerName="createFrustumGeometry",this.packedLength=2+a+d.packedLength+Ce.packedLength+Ne.packedLength}ap.pack=function(e,t,n){b.typeOf.object("value",e),b.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===zv?(Un.pack(o,t,n),n+=Un.packedLength):(Ft.pack(o,t,n),n+=Ft.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,Ce.pack(e._orientation,t,n),n+=Ce.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.packedLength,t[n]=e._drawNearPlane?1:0,t};const COe=new Un,TOe=new Ft,bOe=new Ce,EOe=new d,xOe=new Ne;ap.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=e[t++];let o;i===zv?(o=Un.unpack(e,t,COe),t+=Un.packedLength):(o=Ft.unpack(e,t,TOe),t+=Ft.packedLength);const r=d.unpack(e,t,EOe);t+=d.packedLength;const s=Ce.unpack(e,t,bOe);t+=Ce.packedLength;const a=Ne.unpack(e,t,xOe);t+=Ne.packedLength;const c=e[t]===1;if(!l(n))return new ap({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=d.clone(r,n._origin),n._orientation=Ce.clone(s,n._orientation),n._vertexFormat=Ne.clone(a,n._vertexFormat),n._drawNearPlane=c,n};function cg(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 wOe=new J,SOe=new B,bP=new B,F7=new d,z7=new d,U7=new d,vOe=new d,DOe=new d,IOe=new d,oh=new Array(3),UT=new Array(4);UT[0]=new oe(-1,-1,1,1);UT[1]=new oe(1,-1,1,1);UT[2]=new oe(1,1,1,1);UT[3]=new oe(-1,1,1,1);const H7=new Array(4);for(let e=0;e<4;++e)H7[e]=new oe;ap._computeNearFarPlanes=function(e,t,n,i,o,r,s,a){const c=J.fromQuaternion(t,wOe);let u=A(r,F7),f=A(s,z7),h=A(a,U7);u=J.getColumn(c,0,u),f=J.getColumn(c,1,f),h=J.getColumn(c,2,h),d.normalize(u,u),d.normalize(f,f),d.normalize(h,h),d.negate(u,u);const _=B.computeView(e,h,f,u,SOe);let g,p;if(n===zv){const y=i.projectionMatrix,C=B.multiply(y,_,bP);p=B.inverse(C,bP)}else g=B.inverseTransformation(_,bP);l(p)?(oh[0]=i.near,oh[1]=i.far):(oh[0]=0,oh[1]=i.near,oh[2]=i.far);for(let y=0;y<2;++y)for(let C=0;C<4;++C){let T=oe.clone(UT[C],H7[C]);if(l(p)){T=B.multiplyByVector(p,T,T);const E=1/T.w;d.multiplyByScalar(T,E,T),d.subtract(T,e,T),d.normalize(T,T);const w=d.dot(h,T);d.multiplyByScalar(T,oh[y]/w,T),d.add(T,e,T)}else{l(i._offCenterFrustum)&&(i=i._offCenterFrustum);const E=oh[y],w=oh[y+1];T.x=(T.x*(i.right-i.left)+i.left+i.right)*.5,T.y=(T.y*(i.top-i.bottom)+i.bottom+i.top)*.5,T.z=(T.z*(E-w)-E-w)*.5,T.w=1,B.multiplyByVector(g,T,T)}o[12*y+C*3]=T.x,o[12*y+C*3+1]=T.y,o[12*y+C*3+2]=T.z}};ap.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);ap._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 f=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})});if(l(s.normal)||l(s.tangent)||l(s.bitangent)||l(s.st)){const _=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,C=F7,T=z7,E=U7,w=d.negate(C,vOe),S=d.negate(T,DOe),P=d.negate(E,IOe);u=0,r&&(cg(u,_,g,p,y,P,C,T),u+=3*4),cg(u,_,g,p,y,E,w,T),u+=3*4,cg(u,_,g,p,y,w,P,T),u+=3*4,cg(u,_,g,p,y,S,P,w),u+=3*4,cg(u,_,g,p,y,C,E,T),u+=3*4,cg(u,_,g,p,y,T,E,w),l(_)&&(f.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:_})),l(g)&&(f.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),l(p)&&(f.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),l(y)&&(f.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:y}))}const h=new Uint16Array(6*a);for(let _=0;_<a;++_){const g=_*6,p=_*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 Dt({attributes:f,indices:h,primitiveType:Je.TRIANGLES,boundingSphere:fe.fromVertices(c)})};const cM=0,POe=1;function YC(e){b.typeOf.object("options",e),b.typeOf.object("options.frustum",e.frustum),b.typeOf.object("options.origin",e.origin),b.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 Un?(r=cM,s=Un.packedLength):t instanceof Ft&&(r=POe,s=Ft.packedLength),this._frustumType=r,this._frustum=t.clone(),this._origin=d.clone(i),this._orientation=Ce.clone(n),this._drawNearPlane=o,this._workerName="createFrustumOutlineGeometry",this.packedLength=2+s+d.packedLength+Ce.packedLength}YC.pack=function(e,t,n){b.typeOf.object("value",e),b.defined("array",t),n=A(n,0);const i=e._frustumType,o=e._frustum;return t[n++]=i,i===cM?(Un.pack(o,t,n),n+=Un.packedLength):(Ft.pack(o,t,n),n+=Ft.packedLength),d.pack(e._origin,t,n),n+=d.packedLength,Ce.pack(e._orientation,t,n),n+=Ce.packedLength,t[n]=e._drawNearPlane?1:0,t};const OOe=new Un,LOe=new Ft,BOe=new Ce,ROe=new d;YC.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=e[t++];let o;i===cM?(o=Un.unpack(e,t,OOe),t+=Un.packedLength):(o=Ft.unpack(e,t,LOe),t+=Ft.packedLength);const r=d.unpack(e,t,ROe);t+=d.packedLength;const s=Ce.unpack(e,t,BOe);t+=Ce.packedLength;const a=e[t]===1;if(!l(n))return new YC({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=d.clone(r,n._origin),n._orientation=Ce.clone(s,n._orientation),n._drawNearPlane=a,n};YC.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);ap._computeNearFarPlanes(i,o,t,n,s);const a=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})});let c,u;const f=r?2:1,h=new Uint16Array(8*(f+1));let _=r?0:1;for(;_<2;++_)c=r?_*8:0,u=_*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(_=0;_<2;++_)c=(f+_)*8,u=_*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 Dt({attributes:a,indices:h,primitiveType:Je.LINES,boundingSphere:fe.fromVertices(s)})};function Oh(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,U.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 NOe=new d,MOe=new J,FOe=new Ce,zOe=new Un,UOe=new Ks,HOe=new Ft,VOe=new Bo,kOe=new U,GOe=[1,1e5];Oh.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 Un?a=zOe:s instanceof Ks?a=UOe:s instanceof Ft?a=HOe:a=VOe,a=s.clone(a);let c,u=this._frustumSplits;!l(u)||u.length<=1?(u=GOe,u[0]=this._camera.frustum.near,u[1]=this._camera.frustum.far,c=1):c=u.length-1;const f=r.positionWC,h=r.directionWC,_=r.upWC;let g=r.rightWC;g=d.negate(g,NOe);const p=MOe;J.setColumn(p,0,g,p),J.setColumn(p,1,_,p),J.setColumn(p,2,h,p);const y=Ce.fromRotationMatrix(p,FOe);for(t.length=n.length=c,i=0;i<c;++i)a.near=u[i],a.far=u[i+1],t[i]=new Wt({geometryInstances:new nn({geometry:new ap({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:an.fromColor(U.fromAlpha(this._color,.1,kOe))},id:this.id,pickPrimitive:this}),appearance:new _n({translucent:!0,flat:!0}),asynchronous:!1}),n[i]=new Wt({geometryInstances:new nn({geometry:new YC({origin:f,orientation:y,frustum:a,_drawNearPlane:i===0}),attributes:{color:an.fromColor(this._color)},id:this.id,pickPrimitive:this}),appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})}for(o=t.length,i=0;i<o;++i)n[i].update(e),t[i].update(e)};Oh.prototype.isDestroyed=function(){return!1};Oh.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 Ue(this)};function HT(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 $0=un.supportsTypedArrays()?new Float32Array(12):[],lV=new d,uV=new d,EP=new d,fV=new d,GE=new d;function WOe(e,t){const n=e.radii,i=t.camera;let o,r,s;if(i.frustum instanceof Ft)o=d.ZERO,r=i.rightWC,s=i.upWC;else{const h=i.positionWC,_=d.multiplyComponents(e.oneOverRadii,h,lV),g=d.normalize(_,uV),p=d.normalize(d.cross(d.UNIT_Z,_,EP),EP),y=d.normalize(d.cross(g,p,fV),fV),C=d.magnitude(_),T=Math.sqrt(C*C-1);o=d.multiplyByScalar(g,1/C,lV);const E=T/C;r=d.multiplyByScalar(p,E,uV),s=d.multiplyByScalar(y,E,EP)}const a=d.add(o,s,GE);d.subtract(a,r,a),d.multiplyComponents(n,a,a),d.pack(a,$0,0);const c=d.subtract(o,s,GE);d.subtract(c,r,c),d.multiplyComponents(n,c,c),d.pack(c,$0,3);const u=d.add(o,s,GE);d.add(u,r,u),d.multiplyComponents(n,u,u),d.pack(u,$0,6);const f=d.subtract(o,s,GE);return d.add(f,r,f),d.multiplyComponents(n,f,f),d.pack(f,$0,9),$0}HT.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 pe(n.x+this._ellipsoidOffset,n.y+this._ellipsoidOffset,n.z+this._ellipsoidOffset),o=e.useLogDepth;if(l(this._command)||(this._rs=Qe.fromCache({cull:{enabled:!0},depthTest:{enabled:!0},colorMask:{red:!1,green:!1,blue:!1,alpha:!1}}),this._command=new dt({renderState:this._rs,boundingVolume:new fe(d.ZERO,i.maximumRadius),pass:Be.OPAQUE,owner:this})),!l(this._sp)||this._useLogDepth!==o){this._useLogDepth=o;const s=new Ge({sources:[rAe]}),a=new Ge({sources:[oAe]});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=hn.replaceCache({shaderProgram:this._sp,context:t,vertexShaderSource:s,fragmentShaderSource:a,attributeLocations:{position:0}}),this._command.shaderProgram=this._sp}const r=WOe(i,e);if(l(this._va))this._va.getAttribute(0).vertexBuffer.copyFromArrayView(r);else{const s=new Dt({attributes:{position:new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:r})},indices:[0,1,2,2,1,3],primitiveType:Je.TRIANGLES});this._va=to.fromGeometry({context:t,geometry:s,attributeLocations:{position:0},bufferUsage:Ze.DYNAMIC_DRAW}),this._command.vertexArray=this._va}};HT.prototype.execute=function(e,t){this._mode===le.SCENE3D&&this._command.execute(e,t)};HT.prototype.isDestroyed=function(){return!1};HT.prototype.destroy=function(){this._sp=this._sp&&this._sp.destroy(),this._va=this._va&&this._va.destroy()};function Zf(){}const jOe=/\bgl_FragDepthEXT\b/,qOe=/\bdiscard\b/;function YOe(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(jOe.test(a[r])||qOe.test(a[r])){s=!0;break}let u=!1;const f=o.defines;for(c=f.length,r=0;r<c;++r)if(f[r]==="LOG_DEPTH"){u=!0;break}let h;!s&&!u?(h=`void main()
{
gl_FragColor = vec4(1.0);
}
`,o=new Ge({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 Ge({defines:["LOG_DEPTH"],sources:[h]})),n=e.shaderCache.createDerivedShaderProgram(t,"depthOnly",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:o,attributeLocations:i})}return n}function $Oe(e,t){const n=e._depthOnlyRenderStateCache;let i=n[t.id];if(!l(i)){const o=Qe.getState(t);o.depthMask=!0,o.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i=Qe.fromCache(o),n[t.id]=i}return i}Zf.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=dt.shallowClone(t,i.depthOnlyCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.depthOnlyCommand.shaderProgram=YOe(n,t.shaderProgram),i.depthOnlyCommand.renderState=$Oe(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.depthOnlyCommand.shaderProgram=o,i.depthOnlyCommand.renderState=r),i};const XOe=/\s+czm_writeLogDepth\(/,KOe=/\s+czm_vertexLogDepth\(/,JOe=/\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;function QOe(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,f=r.sources,h=f.length;for(a=0;a<h;++a)if(KOe.test(f[a])){u=!0;break}if(!u){for(a=0;a<h;++a)f[a]=Ge.replaceMain(f[a],"czm_log_depth_main");c=`
void main()
{
czm_log_depth_main();
czm_vertexLogDepth();
}
`,f.push(c)}for(f=s.sources,h=f.length,u=!1,a=0;a<h;++a)XOe.test(f[a])&&(u=!0);s.defines.indexOf("LOG_DEPTH_WRITE")!==-1&&(u=!0);let _=!0;for(a=0;a<h;++a)JOe.test(f[a])&&(_=!1);let g="";if(_&&(g+=`#ifdef GL_EXT_frag_depth
#extension GL_EXT_frag_depth : enable
#endif
`),!u){for(a=0;a<h;a++)f[a]=Ge.replaceMain(f[a],"czm_log_depth_main");g+=`
void main()
{
czm_log_depth_main();
czm_writeLogDepth();
}
`}f.push(g),i=e.shaderCache.createDerivedShaderProgram(t,"logDepth",{vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:o})}return i}Zf.createLogDepthCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=dt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=QOe(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function ZOe(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 f=0;f<a;++f)u[f]=Ge.replaceMain(s[f],"czm_non_pick_main");u[a]=c,r=new Ge({sources:u,defines:r.defines}),i=e.shaderCache.createDerivedShaderProgram(t,"pick",{vertexShaderSource:t.vertexShaderSource,fragmentShaderSource:r,attributeLocations:o})}return i}function e1e(e,t){const n=e.picking.pickRenderStateCache;let i=n[t.id];if(!l(i)){const o=Qe.getState(t);o.blending.enabled=!1,o.depthMask=!0,i=Qe.fromCache(o),n[t.id]=i}return i}Zf.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=dt.shallowClone(t,i.pickCommand),!l(o)||i.shaderProgramId!==t.shaderProgram.id?(i.pickCommand.shaderProgram=ZOe(n,t.shaderProgram,t.pickId),i.pickCommand.renderState=e1e(e,t.renderState),i.shaderProgramId=t.shaderProgram.id):(i.pickCommand.shaderProgram=o,i.pickCommand.renderState=r),i};function t1e(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}Zf.createHdrCommand=function(e,t,n){l(n)||(n={});let i;return l(n.command)&&(i=n.command.shaderProgram),n.command=dt.shallowClone(e,n.command),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.command.shaderProgram=t1e(t,e.shaderProgram),n.shaderProgramId=e.shaderProgram.id):n.command.shaderProgram=i,n};function Uv(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=N.toRadians(o),t._beta=N.toRadians(i.beta),t._gamma=N.toRadians(i.gamma)}window.addEventListener("deviceorientation",n,!1),this._removeListener=function(){window.removeEventListener("deviceorientation",n,!1)}}const n1e=new Ce,dV=new Ce,i1e=new J;function o1e(e,t,n,i){const o=e.direction,r=e.right,s=e.up,a=Ce.fromAxisAngle(o,n,dV),c=Ce.fromAxisAngle(r,i,n1e),u=Ce.multiply(c,a,c),f=Ce.fromAxisAngle(s,t,dV);Ce.multiply(f,u,u);const h=J.fromQuaternion(u,i1e);J.multiplyByVector(h,r,r),J.multiplyByVector(h,s,s),J.multiplyByVector(h,o,o)}Uv.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;o1e(this._scene.camera,-e,t,n),this._lastAlpha=this._alpha,this._lastBeta=this._beta,this._lastGamma=this._gamma};Uv.prototype.isDestroyed=function(){return!1};Uv.prototype.destroy=function(){return this._removeListener(),Ue(this)};function V7(){this.enabled=!0,this.renderable=!0,this.density=2e-4,this.screenSpaceErrorFactor=2,this.minimumBrightness=.03}const dw=[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],zu=[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<zu.length;++e)zu[e]*=1e6;const k7=zu[1],tB=zu[zu.length-1];for(let e=0;e<zu.length;++e)zu[e]=(zu[e]-tB)/(k7-tB);let Wr=0;function r1e(e){const t=dw,n=t.length;if(e<t[0])return Wr=0,Wr;if(e>t[n-1])return Wr=n-2,Wr;if(e>=t[Wr]){if(Wr+1<n&&e<t[Wr+1])return Wr;if(Wr+2<n&&e<t[Wr+2])return++Wr,Wr}else if(Wr-1>=0&&e>=t[Wr-1])return--Wr,Wr;let i;for(i=0;i<n-2&&!(e>=t[i]&&e<t[i+1]);++i);return Wr=i,Wr}const s1e=new d;V7.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=r1e(o),s=N.clamp((o-dw[r])/(dw[r+1]-dw[r]),0,1);let a=N.lerp(zu[r],zu[r+1],s);const c=this.density*1e6,u=c/k7*tB;a=a*(c-u)*1e-6;const f=d.normalize(n.positionWC,s1e),h=Math.abs(d.dot(n.directionWC,f));a*=1-h,e.fog.density=a,e.fog.sse=this.screenSpaceErrorFactor,e.fog.minimumBrightness=this.minimumBrightness};function a1e(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 Yr={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},Im=Yr.DERIVED_COMMANDS_MAXIMUM_LENGTH,G7=["opaqueFrontFaceCommand","opaqueBackFaceCommand","depthOnlyFrontFaceCommand","depthOnlyBackFaceCommand","depthOnlyFrontAndBackFaceCommand","translucentFrontFaceCommand","translucentBackFaceCommand","translucentFrontFaceManualDepthTestCommand","translucentBackFaceManualDepthTestCommand","pickFrontFaceCommand","pickBackFaceCommand"];function P_(){this._frontFaceAlphaByDistance=new Mt(0,1,0,1),this._backFaceAlphaByDistance=new Mt(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=_e.clone(_e.MAX_VALUE),this._derivedCommandKey=0,this._derivedCommandsDirty=!1,this._derivedCommandPacks=void 0,this._derivedCommandTypes=new Array(Im),this._derivedBlendCommandTypes=new Array(Im),this._derivedPickCommandTypes=new Array(Im),this._derivedCommandTypesToUpdate=new Array(Im),this._derivedCommandsLength=0,this._derivedBlendCommandsLength=0,this._derivedPickCommandsLength=0,this._derivedCommandsToUpdateLength=0}Object.defineProperties(P_.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}}});P_.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=hV(t.translucency.enabled,t.translucency.frontFaceAlpha,t.translucency.frontFaceAlphaByDistance,this._frontFaceAlphaByDistance),this._backFaceAlphaByDistance=hV(t.translucency.enabled,t.translucency.backFaceAlpha,t.translucency.backFaceAlphaByDistance,this._backFaceAlphaByDistance),this._frontFaceTranslucent=pV(t.translucency.enabled,this._frontFaceAlphaByDistance,t),this._backFaceTranslucent=pV(t.translucency.enabled,this._backFaceAlphaByDistance,t),this._requiresManualDepthTest=f1e(this,e,t),this._sunVisibleThroughGlobe=c1e(this,e),this._environmentVisible=l1e(this,e),this._useDepthPlane=u1e(this,e),this._numberOfTextureUniforms=d1e(this),this._rectangle=_e.clone(t.translucency.rectangle,this._rectangle),h1e(this,e)};function hV(e,t,n,i){return e?l(n)?(Mt.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 pV(e,t,n){return e&&(n.baseColor.alpha<1||t.nearValue<1||t.farValue<1)}function c1e(e,t){const n=e._frontFaceTranslucent,i=e._backFaceTranslucent;return n&&(t.cameraUnderground||i)}function l1e(e,t){return!t.cameraUnderground||e._frontFaceTranslucent}function u1e(e,t){return!t.cameraUnderground&&!e._frontFaceTranslucent}function f1e(e,t,n){return e._frontFaceTranslucent&&!e._backFaceTranslucent&&!n.depthTestAgainstTerrain&&t.mode!==le.SCENE2D&&t.context.depthTexture}function d1e(e){let t=0;return e._frontFaceTranslucent&&++t,e._requiresManualDepthTest&&++t,t}function h1e(e,t){e._derivedCommandsLength=xP(e,t,!1,!1,e._derivedCommandTypes),e._derivedBlendCommandsLength=xP(e,t,!0,!1,e._derivedBlendCommandTypes),e._derivedPickCommandsLength=xP(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<Im;++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=D1e())}function xP(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,f=i?Yr.PICK_FRONT_FACE:u?Yr.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST:Yr.TRANSLUCENT_FRONT_FACE,h=i?Yr.PICK_BACK_FACE:u?Yr.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST:Yr.TRANSLUCENT_BACK_FACE;return t.mode===le.SCENE2D?(o[r++]=Yr.DEPTH_ONLY_FRONT_FACE,o[r++]=f,r):(a?(n||(o[r++]=Yr.DEPTH_ONLY_FRONT_AND_BACK_FACE),c?(o[r++]=f,o[r++]=h):(o[r++]=h,o[r++]=f)):c?(n||(o[r++]=Yr.DEPTH_ONLY_BACK_FACE),o[r++]=Yr.OPAQUE_FRONT_FACE,o[r++]=h):(n||(o[r++]=Yr.DEPTH_ONLY_FRONT_FACE),o[r++]=Yr.OPAQUE_BACK_FACE,o[r++]=f),r)}function Mc(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}function mV(e,t){return e.indexOf(t)>-1}function p1e(e,t){Mc(e.defines,"TRANSLUCENT"),Mc(t.defines,"TRANSLUCENT")}function m1e(e,t){Mc(e.defines,"GROUND_ATMOSPHERE"),Mc(t.defines,"GROUND_ATMOSPHERE"),Mc(e.defines,"FOG"),Mc(t.defines,"FOG"),Mc(e.defines,"TRANSLUCENT"),Mc(t.defines,"TRANSLUCENT")}function wP(e,t){if(mV(t.defines,"TILE_LIMIT_RECTANGLE")||mV(t.defines,"ENABLE_CLIPPING_PLANES"))return;const n=`void main()
{
gl_FragColor = vec4(1.0);
}
`;t.sources=[n]}function lM(e,t){const n=t.sources,i=n.length;for(let r=0;r<i;++r)n[r]=Ge.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 W7(e,t){lM(e,t),Mc(e.defines,"GROUND_ATMOSPHERE"),Mc(t.defines,"GROUND_ATMOSPHERE"),Mc(e.defines,"FOG"),Mc(t.defines,"FOG")}function _1e(e,t){lM(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function g1e(e,t){W7(e,t),e.defines.push("GENERATE_POSITION"),t.defines.push("MANUAL_DEPTH_TEST")}function _V(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 y1e(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 A1e(e){e.cull.face=Po.BACK,e.cull.enabled=!0}function C1e(e){e.cull.face=Po.FRONT,e.cull.enabled=!0}function T1e(e){e.cull.face=Po.BACK,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function b1e(e){e.cull.face=Po.FRONT,e.cull.enabled=!0,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function E1e(e){e.cull.enabled=!1,e.colorMask={red:!1,green:!1,blue:!1,alpha:!1}}function gV(e){e.cull.face=Po.BACK,e.cull.enabled=!0,e.depthMask=!1,e.blending=Ii.ALPHA_BLEND}function yV(e){e.cull.face=Po.FRONT,e.cull.enabled=!0,e.depthMask=!1,e.blending=Ii.ALPHA_BLEND}function x1e(e){e.cull.face=Po.BACK,e.cull.enabled=!0,e.blending.enabled=!1}function w1e(e){e.cull.face=Po.FRONT,e.cull.enabled=!0,e.blending.enabled=!1}function S1e(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=Qe.getState(e);i(s),r=Qe.fromCache(s),o[e.id]=r}return r}function lg(e){return{u_classificationTexture:function(){return e._globeTranslucencyFramebuffer.classificationTexture}}}function v1e(e,t,n,i,o){return l(o)?!i&&l(n)?n:sn(t,o(e),!1):t}function Al(e){this.pass=e.pass,this.pickOnly=e.pickOnly,this.getShaderProgramFunction=e.getShaderProgramFunction,this.getRenderStateFunction=e.getRenderStateFunction,this.getUniformMapFunction=e.getUniformMapFunction,this.renderStateCache={}}function D1e(){return[new Al({pass:Be.GLOBE,pickOnly:!1,getShaderProgramFunction:p1e,getRenderStateFunction:A1e,getUniformMapFunction:void 0}),new Al({pass:Be.GLOBE,pickOnly:!1,getShaderProgramFunction:m1e,getRenderStateFunction:C1e,getUniformMapFunction:void 0}),new Al({pass:Be.GLOBE,pickOnly:!1,getShaderProgramFunction:wP,getRenderStateFunction:T1e,getUniformMapFunction:void 0}),new Al({pass:Be.GLOBE,pickOnly:!1,getShaderProgramFunction:wP,getRenderStateFunction:b1e,getUniformMapFunction:void 0}),new Al({pass:Be.GLOBE,pickOnly:!1,getShaderProgramFunction:wP,getRenderStateFunction:E1e,getUniformMapFunction:void 0}),new Al({pass:Be.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:lM,getRenderStateFunction:gV,getUniformMapFunction:lg}),new Al({pass:Be.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:W7,getRenderStateFunction:yV,getUniformMapFunction:lg}),new Al({pass:Be.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:_1e,getRenderStateFunction:gV,getUniformMapFunction:lg}),new Al({pass:Be.TRANSLUCENT,pickOnly:!1,getShaderProgramFunction:g1e,getRenderStateFunction:yV,getUniformMapFunction:lg}),new Al({pass:Be.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:_V,getRenderStateFunction:x1e,getUniformMapFunction:lg}),new Al({pass:Be.TRANSLUCENT,pickOnly:!0,getShaderProgramFunction:_V,getRenderStateFunction:w1e,getUniformMapFunction:lg})]}const AV=new Array(Im),CV=new Array(Im);P_.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]],AV[o]=G7[n[o]];I1e(this,e,i,n,AV,CV,t)}};function I1e(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,f=A(a.uniformMapDirtyFrame,0),h=A(a.shaderProgramDirtyFrame,0),_=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 C=0;C<n;++C){const T=r[C],E=i[C],w=o[C];let S=a[w],P,O,z;l(S)?(P=S.uniformMap,O=S.shaderProgram,z=S.renderState):(P=void 0,O=void 0,z=void 0),S=dt.shallowClone(t,S),a[w]=S;const R=A(S.derivedCommands.uniformMapDirtyFrame,0),F=A(S.derivedCommands.shaderProgramDirtyFrame,0),H=A(S.derivedCommands.renderStateDirtyFrame,0),v=g||R<f,I=p||F<h,m=y||H<_;v&&(S.derivedCommands.uniformMapDirtyFrame=u),I&&(S.derivedCommands.shaderProgramDirtyFrame=u),m&&(S.derivedCommands.renderStateDirtyFrame=u),S.derivedCommands.type=E,S.pass=T.pass,S.pickOnly=T.pickOnly,S.uniformMap=v1e(e,t.uniformMap,P,v,T.getUniformMapFunction),S.shaderProgram=y1e(s.context,t.shaderProgram,O,I,T.getShaderProgramFunction,w),S.renderState=S1e(t.renderState,z,m,T.getRenderStateFunction,T.renderStateCache)}}}P_.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=G7[o[a]];n.commandList.push(s[c])}};function j7(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 P1e=[Yr.OPAQUE_FRONT_FACE,Yr.OPAQUE_BACK_FACE],O1e=[Yr.DEPTH_ONLY_FRONT_FACE,Yr.DEPTH_ONLY_BACK_FACE,Yr.DEPTH_ONLY_FRONT_AND_BACK_FACE];P_.prototype.executeGlobeCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[Be.GLOBE],a=e.indices[Be.GLOBE];a!==0&&(this._globeTranslucencyFramebuffer=n,n.clearClassification(r,o),j7(s,a,t,i,r,o,P1e))};P_.prototype.executeGlobeClassificationCommands=function(e,t,n,i,o){const r=i.context,s=e.commands[Be.GLOBE],a=e.indices[Be.GLOBE],c=e.commands[Be.TERRAIN_CLASSIFICATION],u=e.indices[Be.TERRAIN_CLASSIFICATION];if(a===0||u===0)return;const f=this._frontFaceTranslucent,h=this._backFaceTranslucent;if((!f||!h)&&TV(c,u,t,i,r,o),!f&&!h)return;this._globeTranslucencyFramebuffer=n;const _=r.uniformState.globeDepthTexture,g=o.framebuffer;if(o.framebuffer=n.classificationFramebuffer,j7(s,a,t,i,r,o,O1e),r.depthTexture){const p=n.packDepth(r,o);r.uniformState.globeDepthTexture=p}TV(c,u,t,i,r,o),r.uniformState.globeDepthTexture=_,o.framebuffer=g};const n_=`uniform sampler2D colorTexture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = texture2D(colorTexture, v_textureCoordinates);
}
`,L1e={NEVER:se.NEVER,LESS:se.LESS,EQUAL:se.EQUAL,LESS_OR_EQUAL:se.LEQUAL,GREATER:se.GREATER,NOT_EQUAL:se.NOTEQUAL,GREATER_OR_EQUAL:se.GEQUAL,ALWAYS:se.ALWAYS},ri=Object.freeze(L1e),B1e={ZERO:se.ZERO,KEEP:se.KEEP,REPLACE:se.REPLACE,INCREMENT:se.INCR,DECREMENT:se.DECR,INVERT:se.INVERT,INCREMENT_WRAP:se.INCR_WRAP,DECREMENT_WRAP:se.DECR_WRAP},ht=Object.freeze(B1e),hw={CESIUM_3D_TILE_MASK:128,SKIP_LOD_MASK:112,SKIP_LOD_BIT_SHIFT:4,CLASSIFICATION_MASK:15};hw.setCesium3DTileBit=function(){return{enabled:!0,frontFunction:ri.ALWAYS,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.REPLACE},backFunction:ri.ALWAYS,backOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.REPLACE},reference:hw.CESIUM_3D_TILE_MASK,mask:hw.CESIUM_3D_TILE_MASK}};const Pt=Object.freeze(hw);function au(){this._numSamples=1,this.previousFramebuffer=void 0,this._previousFramebuffer=void 0,this._depthStencilTexture=void 0,this._depthStencilRenderbuffer=void 0,this._fbo=new En({depthStencil:!0,createDepthAttachments:!1}),this._fboClassified=new En({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 Ji({color:new U(0,0,0,0),owner:this}),this._clearCommand=new Ji({color:new U(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(au.prototype,{unclassifiedCommand:{get:function(){return this._unclassifiedCommand}}});au.isTranslucencySupported=function(e){return e.depthTexture&&e.fragmentDepth};const R1e={depthMask:!1,stencilTest:{enabled:!0,frontFunction:ri.EQUAL,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},backFunction:ri.NEVER,reference:0,mask:Pt.CLASSIFICATION_MASK},blending:Ii.ALPHA_BLEND},N1e={depthMask:!1,stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},backFunction:ri.NEVER,reference:0,mask:Pt.CLASSIFICATION_MASK},blending:Ii.ALPHA_BLEND},M1e={depthMask:!0,depthTest:{enabled:!0},stencilTest:Pt.setCesium3DTileBit(),stencilMask:Pt.CESIUM_3D_TILE_MASK,blending:Ii.ALPHA_BLEND},F1e=`#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;
}
`,z1e=`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
}
`;au.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 zt({context:e,width:s,height:a,pixelFormat:nt.DEPTH_STENCIL,pixelDatatype:Ke.UNSIGNED_INT_24_8}),t>1&&(this._depthStencilRenderbuffer=new Ol({context:e,width:s,height:a,format:Gf.DEPTH24_STENCIL8,numSamples:t})))),!l(this._fbo.framebuffer)||c||o||r){this._fbo.destroy(),this._fboClassified.destroy();let u,f;l(this._previousFramebuffer)?(u=n.getDepthStencilTexture(),f=n.getDepthStencilRenderbuffer()):(u=this._depthStencilTexture,f=this._depthStencilRenderbuffer),this._fbo.setDepthStencilTexture(u),l(f)&&this._fbo.setDepthStencilRenderbuffer(f),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=Qe.fromCache(R1e),this._rsClassified=Qe.fromCache(N1e),this._rsDefault=Qe.fromCache(M1e)),!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)?z1e:F1e,f=new Ge({defines:["UNCLASSIFIED"],sources:[u]}),h=new Ge({sources:[u]});this._unclassifiedCommand=e.createViewportQuadCommand(f,{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(n_,{renderState:this._rsUnclassified,uniformMap:this._uniformMap,owner:this}))}};au.prototype.prepareTextures=function(e,t){this._fbo._numSamples>1&&this._fbo.prepareTextures(e,t)};au.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))};au.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)};au.prototype.executeUnclassified=function(e,t){this._unclassifiedCommand.execute(e,t)};au.prototype.isDestroyed=function(){return!1};au.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()),Ue(this)};const U1e={TEXTURE:0,PROGRAM:1,BUFFER:2,NUMBER_OF_JOB_TYPES:3},Sl=Object.freeze(U1e);function pw(e){this._total=e,this.usedThisFrame=0,this.stolenFromMeThisFrame=0,this.starvedThisFrame=!1,this.starvedLastFrame=!1}Object.defineProperties(pw.prototype,{total:{get:function(){return this._total}}});function jh(e){if(l(e)&&e.length!==Sl.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(Sl.NUMBER_OF_JOB_TYPES);t[Sl.TEXTURE]=new pw(l(e)?e[Sl.TEXTURE]:10),t[Sl.PROGRAM]=new pw(l(e)?e[Sl.PROGRAM]:10),t[Sl.BUFFER]=new pw(l(e)?e[Sl.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}jh.getTimestamp=er;Object.defineProperties(jh.prototype,{totalBudget:{get:function(){return this._totalBudget}}});jh.prototype.disableThisFrame=function(){this._totalUsedThisFrame=this._totalBudget};jh.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};jh.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=jh.getTimestamp();e.execute();const a=jh.getTimestamp()-s;return this._totalUsedThisFrame+=a,r?r.stolenFromMeThisFrame+=a:i.usedThisFrame+=a,this._executedThisFrame[t]=!0,!0};function Xl(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=>{uM(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(Xl.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}}});Xl.isSupported=function(e){return e.colorBufferHalfFloat&&e.halfFloatingPointTexture||e.floatingPointTexture&&e.colorBufferFloat};const H1e=new d(1,0,0),V1e=new d(0,0,1),k1e=new d(-1,0,0),G1e=new d(0,0,-1),WE=new d(0,1,0),W1e=new d(0,-1,0),q7=[WE,k1e,V1e,W1e,H1e,WE,G1e,WE,WE],Y7=q7.length,$7=new Float32Array(Y7*3);let bV=0;for(let e=0;e<Y7;++e,bV+=3)d.pack(q7[e],$7,bV);const j1e=new Float32Array([-1,1,-1,0,0,1,0,0,1,0,1,1,0,-1,-1,-1,1,-1]),q1e=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 Y1e(e){const t=At.createVertexBuffer({context:e,typedArray:j1e,usage:Ze.STATIC_DRAW}),n=At.createVertexBuffer({context:e,typedArray:$7,usage:Ze.STATIC_DRAW}),i=At.createIndexBuffer({context:e,typedArray:q1e,usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT}),o=[{index:0,vertexBuffer:t,componentsPerAttribute:2,componentDatatype:ee.FLOAT},{index:1,vertexBuffer:n,componentsPerAttribute:3,componentDatatype:ee.FLOAT}];return new to({context:e,attributes:o,indexBuffer:i})}function EV(e){return function(){return e}}function uM(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}Xl.prototype.update=function(e){const t=e.context;if(!Xl.isSupported(t)||(l(this._texture)&&l(this._va)&&uM(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;b_(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?Ke.HALF_FLOAT:Ke.FLOAT;const r=nt.RGBA,s=new Ge({defines:i,sources:[uAe]});this._va=Y1e(t),this._sp=hn.fromCache({context:t,vertexShaderSource:fAe,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),f=n[0].positiveX.width*2,h={originalSize:function(){return f}};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 nu({context:t,source:n[g],pixelDatatype:o}),C=c[g].width*2,T=u[g]=new zt({context:t,width:C,height:C,pixelDatatype:o,pixelFormat:r}),E=new MC({vertexArray:this._va,shaderProgram:this._sp,uniformMap:{cubeMap:EV(y)},outputTexture:T,persists:!0,owner:this});e.commandList.push(E),h[`texture${g}`]=EV(T)}this._texture=new zt({context:t,width:f*1.5+2,height:f,pixelDatatype:o,pixelFormat:r}),this._texture.maximumMipmapLevel=this._maximumMipmapLevel,t.textureCache.addTexture(this._url,this._texture);const _=new MC({fragmentShaderSource:lAe,uniformMap:h,outputTexture:this._texture,persists:!1,owner:this});e.commandList.push(_),this._completeLoad()};Xl.prototype.isDestroyed=function(){return!1};Xl.prototype.destroy=function(){return uM(this),this._texture=this._texture&&this._texture.destroy(),Ue(this)};function Hv(e){e=A(e,A.EMPTY_OBJECT);const t=cr(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=er(),this._lastMsSampleTime=er(),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(Hv.prototype,{throttled:{get:function(){return this._throttled},set:function(e){this._throttled!==e&&(e?this._throttledText.nodeValue="(throttled)":this._throttledText.nodeValue="",this._throttled=e)}}});Hv.prototype.update=function(e){const t=er(),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}};Hv.prototype.destroy=function(){return Ue(this)};const xV=new d,wV=new d,SV=new Ae,SP=new d,$1e=new d,vV=new fe,X1e=new Xs,X0=[new Ae,new Ae,new Ae,new Ae],K0=new j,Do={};Do.initialize=function(){let e=Do._initPromise;return l(e)||(e=Re.fetchJson(dn("Assets/approximateTerrainHeights.json")).then(function(t){Do._terrainHeights=t}),Do._initPromise=e),e};Do.getMinimumMaximumHeights=function(e,t){if(b.defined("rectangle",e),!l(Do._terrainHeights))throw new x("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,pe.WGS84);const n=X7(e);let i=Do._defaultMinTerrainHeight,o=Do._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Do._terrainHeights[r];l(s)&&(i=s[0],o=s[1]),t.cartographicToCartesian(_e.northeast(e,SV),xV),t.cartographicToCartesian(_e.southwest(e,SV),wV),d.midpoint(wV,xV,SP);const a=t.scaleToGeodeticSurface(SP,$1e);if(l(a)){const c=d.distance(SP,a);i=Math.min(i,-c)}else i=Do._defaultMinTerrainHeight}return i=Math.max(Do._defaultMinTerrainHeight,i),{minimumTerrainHeight:i,maximumTerrainHeight:o}};Do.getBoundingSphere=function(e,t){if(b.defined("rectangle",e),!l(Do._terrainHeights))throw new x("You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function");t=A(t,pe.WGS84);const n=X7(e);let i=Do._defaultMaxTerrainHeight;if(l(n)){const r=`${n.level}-${n.x}-${n.y}`,s=Do._terrainHeights[r];l(s)&&(i=s[1])}const o=fe.fromRectangle3D(e,t,0);return fe.fromRectangle3D(e,t,i,vV),fe.union(o,vV,o)};function X7(e){Ae.fromRadians(e.east,e.north,0,X0[0]),Ae.fromRadians(e.west,e.north,0,X0[1]),Ae.fromRadians(e.east,e.south,0,X0[2]),Ae.fromRadians(e.west,e.south,0,X0[3]);let t=0,n=0,i=0,o=0;const r=Do._terrainHeightsMaxLevel;let s;for(s=0;s<=r;++s){let a=!1;for(let c=0;c<4;++c){const u=X0[c];if(X1e.positionToTileXY(u,s,K0),c===0)i=K0.x,o=K0.y;else if(i!==K0.x||o!==K0.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}}Do._terrainHeightsMaxLevel=6;Do._defaultMaxTerrainHeight=9e3;Do._defaultMinTerrainHeight=-1e5;Do._terrainHeights=void 0;Do._initPromise=void 0;Object.defineProperties(Do,{initialized:{get:function(){return l(Do._terrainHeights)}}});const Qi=Do;function Hn(e){e=A(e,!0),this.value=Hn.toValue(e)}Object.defineProperties(Hn.prototype,{componentDatatype:{get:function(){return ee.UNSIGNED_BYTE}},componentsPerAttribute:{get:function(){return 1}},normalize:{get:function(){return!1}}});Hn.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 U),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 O_(){this._framebuffer=new En,this._textureToCopy=void 0,this._copyDepthCommand=void 0}Object.defineProperties(O_.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function K1e(e,t,n){const i=n.width,o=n.height;e._framebuffer.update(t,i,o)}function J1e(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:Qe.fromCache(),uniformMap:{u_texture:function(){return e._textureToCopy}},owner:e})}e._textureToCopy=n,e._copyDepthCommand.framebuffer=e.framebuffer}O_.prototype.update=function(e,t){K1e(this,e,t),J1e(this,e,t)};const Q1e=new oe,Z1e=new oe(1,1/255,1/65025,1/16581375);O_.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,Q1e);return oe.divideByScalar(o,255,o),oe.dot(o,Z1e)};O_.prototype.executeCopyDepth=function(e,t){this._copyDepthCommand.execute(e,t)};O_.prototype.isDestroyed=function(){return!1};O_.prototype.destroy=function(){return this._framebuffer.destroy(),l(this._copyDepthCommand)&&(this._copyDepthCommand.shaderProgram=l(this._copyDepthCommand.shaderProgram)&&this._copyDepthCommand.shaderProgram.destroy()),Ue(this)};function No(e){e=A(e,A.EMPTY_OBJECT),this._primitives=[],this._guid=Es(),this._zIndex=void 0,this.show=A(e.show,!0),this.destroyPrimitives=A(e.destroyPrimitives,!0)}Object.defineProperties(No.prototype,{length:{get:function(){return this._primitives.length}}});No.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};No.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};No.prototype.removeAndDestroy=function(e){const t=this.remove(e);return t&&!this.destroyPrimitives&&e.destroy(),t};No.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=[]};No.prototype.contains=function(e){return!!(l(e)&&e._external&&e._external._composites&&e._external._composites[this._guid])};function Vv(e,t){if(!e.contains(t))throw new x("primitive is not in this collection.");return e._primitives.indexOf(t)}No.prototype.raise=function(e){if(l(e)){const t=Vv(this,e),n=this._primitives;if(t!==n.length-1){const i=n[t];n[t]=n[t+1],n[t+1]=i}}};No.prototype.raiseToTop=function(e){if(l(e)){const t=Vv(this,e),n=this._primitives;t!==n.length-1&&(n.splice(t,1),n.push(e))}};No.prototype.lower=function(e){if(l(e)){const t=Vv(this,e),n=this._primitives;if(t!==0){const i=n[t];n[t]=n[t-1],n[t-1]=i}}};No.prototype.lowerToBottom=function(e){if(l(e)){const t=Vv(this,e),n=this._primitives;t!==0&&(n.splice(t,1),n.unshift(e))}};No.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._primitives[e]};No.prototype.update=function(e){if(!this.show)return;const t=this._primitives;for(let n=0;n<t.length;++n)t[n].update(e)};No.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)}};No.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)}};No.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)}};No.prototype.isDestroyed=function(){return!1};No.prototype.destroy=function(){return this.removeAll(),Ue(this)};const ps={},eLe=new oe(0,0,0,1);let Ps=new oe;const tLe=new qe,vP=new j,DP=new j;ps.wgs84ToWindowCoordinates=function(e,t,n){return ps.wgs84WithEyeOffsetToWindowCoordinates(e,t,d.ZERO,n)};const DV=new oe,IV=new d;function J0(e,t,n,i){const o=n.viewMatrix,r=B.multiplyByVector(o,oe.fromElements(e.x,e.y,e.z,1,DV),DV),s=d.multiplyComponents(t,d.normalize(r,IV),IV);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 nLe=new Ae(Math.PI,N.PI_OVER_TWO),iLe=new d,oLe=new d;ps.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=ps.computeActualWgs84Position(o,t,eLe);if(!l(r))return;const s=e.canvas,a=tLe;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 f=e.mapProjection,h=nLe,_=f.project(h,iLe),g=d.clone(c.position,oLe),p=c.frustum.clone(),y=B.computeViewportTransformation(a,0,1,new B),C=c.frustum.projectionMatrix,T=c.positionWC.y,E=d.fromElements(N.sign(T)*_.x-T,0,-c.positionWC.x),w=tn.pointToGLWindowCoordinates(C,y,E);if(T===0||w.x<=0||w.x>=s.clientWidth)u=!0;else{if(w.x>s.clientWidth*.5){a.width=w.x,c.frustum.right=_.x-T,Ps=J0(r,n,c,Ps),ps.clipToGLWindowCoordinates(a,Ps,vP),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,Ps=J0(r,n,c,Ps),ps.clipToGLWindowCoordinates(a,Ps,DP)}else{a.x+=w.x,a.width-=w.x,c.frustum.left=-_.x-T,Ps=J0(r,n,c,Ps),ps.clipToGLWindowCoordinates(a,Ps,vP),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,Ps=J0(r,n,c,Ps),ps.clipToGLWindowCoordinates(a,Ps,DP)}d.clone(g,c.position),c.frustum=p.clone(),i=j.clone(vP,i),(i.x<0||i.x>s.clientWidth)&&(i.x=DP.x)}}if(o.mode!==le.SCENE2D||u){if(Ps=J0(r,n,c,Ps),Ps.z<0&&!(c.frustum instanceof Ft)&&!(c.frustum instanceof Bo))return;i=ps.clipToGLWindowCoordinates(a,Ps,i)}return i.y=s.clientHeight-i.y,i};ps.wgs84ToDrawingBufferCoordinates=function(e,t,n){if(n=ps.wgs84ToWindowCoordinates(e,t,n),!!l(n))return ps.transformWindowToDrawingBuffer(e,n,n)};const If=new d,rLe=new Ae;ps.computeActualWgs84Position=function(e,t,n){const i=e.mode;if(i===le.SCENE3D)return d.clone(t,n);const o=e.mapProjection,r=o.ellipsoid.cartesianToCartographic(t,rLe);if(!l(r))return;if(o.project(r,If),i===le.COLUMBUS_VIEW)return d.fromElements(If.z,If.x,If.y,n);if(i===le.SCENE2D)return d.fromElements(0,If.x,If.y,n);const s=e.morphTime;return d.fromElements(N.lerp(If.z,t.x,s),N.lerp(If.x,t.y,s),N.lerp(If.y,t.z,s),n)};const PV=new d,OV=new d,LV=new B;ps.clipToGLWindowCoordinates=function(e,t,n){return d.divideByScalar(t,t.w,PV),B.computeViewportTransformation(e,0,1,LV),B.multiplyByPoint(LV,PV,OV),j.fromCartesian3(OV,n)};ps.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 sLe=new oe,BV=new oe;ps.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,f=oe.clone(oe.UNIT_W,sLe);f.x=(t.x-u.x)/u.width*2-1,f.y=(t.y-u.y)/u.height*2-1,f.z=n*2-1,f.w=1;let h,_=e.camera.frustum;if(!l(_.fovy))l(_._offCenterFrustum)&&(_=_._offCenterFrustum),h=BV,h.x=(f.x*(_.right-_.left)+_.left+_.right)*.5,h.y=(f.y*(_.top-_.bottom)+_.bottom+_.top)*.5,h.z=(f.z*(a-c)-a-c)*.5,h.w=1,h=B.multiplyByVector(r.inverseView,h,h);else{h=B.multiplyByVector(r.inverseViewProjection,f,BV);const g=1/h.w;d.multiplyByScalar(h,g,h)}return d.fromCartesian4(h,i)};const lr=ps;function aLe(e,t){this.near=A(e,0),this.far=A(t,0);const n=Be.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 nB=`uniform highp sampler2D u_depthTexture;
varying vec2 v_textureCoordinates;
void main()
{
gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);
}
`;function cf(){this._picking=!1,this._numSamples=1,this._tempCopyDepthTexture=void 0,this._pickColorFramebuffer=new En({depthStencil:!0,supportsDepthTexture:!0}),this._outputFramebuffer=new En({depthStencil:!0,supportsDepthTexture:!0}),this._copyDepthFramebuffer=new En,this._tempCopyDepthFramebuffer=new En,this._updateDepthFramebuffer=new En({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 qe,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(cf.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 cLe(e){e._pickColorFramebuffer.destroy(),e._outputFramebuffer.destroy(),e._copyDepthFramebuffer.destroy(),e._tempCopyDepthFramebuffer.destroy(),e._updateDepthFramebuffer.destroy()}function K7(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!qe.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,qe.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=qe.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._rs)||!qe.equals(e._viewport,e._rs.viewport)||s)&&(e._rs=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}}),e._rsBlend=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Ii.ALPHA_BLEND}),e._rsUpdate=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:ri.EQUAL,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},backFunction:ri.NEVER,reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK}})),l(e._copyDepthCommand)||(e._copyDepthCommand=t.createViewportQuadCommand(nB,{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(n_,{uniformMap:{colorTexture:function(){return e.colorFramebufferManager.getColorTexture()}},owner:e})),e._copyColorCommand.renderState=e._rs,l(e._tempCopyDepthCommand)||(e._tempCopyDepthCommand=t.createViewportQuadCommand(nB,{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(n_,{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 Ji({color:new U(0,0,0,0),stencil:0,owner:e})),e._clearGlobeColorCommand.framebuffer=e.framebuffer}cf.prototype.update=function(e,t,n,i,o,r){const s=n.width,a=n.height,c=o?e.halfFloatingPointTexture?Ke.HALF_FLOAT:Ke.FLOAT:Ke.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),K7(this,e,s,a,t),e.uniformState.globeDepthTexture=void 0,this._useHdr=o,this._clearGlobeDepth=r};cf.prototype.prepareColorTextures=function(e,t){!this.picking&&this._numSamples>1&&this._outputFramebuffer.prepareTextures(e,t)};cf.prototype.executeCopyDepth=function(e,t){l(this._copyDepthCommand)&&(this.prepareColorTextures(e),this._copyDepthCommand.execute(e,t),e.uniformState.globeDepthTexture=this._copyDepthFramebuffer.getColorTexture())};cf.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),K7(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)};cf.prototype.executeCopyColor=function(e,t){l(this._copyColorCommand)&&this._copyColorCommand.execute(e,t)};cf.prototype.clear=function(e,t,n){const i=this._clearGlobeColorCommand;l(i)&&(U.clone(n,i.color),this.colorFramebufferManager.clear(e,i,t))};cf.prototype.isDestroyed=function(){return!1};cf.prototype.destroy=function(){return cLe(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()),Ue(this)};function L_(){this._framebuffer=new En({depthStencil:!0,supportsDepthTexture:!0}),this._packedDepthFramebuffer=new En,this._renderState=void 0,this._packedDepthCommand=void 0,this._clearCommand=void 0,this._viewport=new qe,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHdr=void 0}Object.defineProperties(L_.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 lLe(e){e._framebuffer.destroy(),e._packedDepthFramebuffer.destroy()}function uLe(e,t,n,i,o){const r=o?t.halfFloatingPointTexture?Ke.HALF_FLOAT:Ke.FLOAT:Ke.UNSIGNED_BYTE;e._framebuffer.update(t,n,i,1,r),e._packedDepthFramebuffer.update(t,n,i)}function fLe(e,t,n,i,o){e._viewport.width=n,e._viewport.height=i;const r=!qe.equals(e._viewport,o.viewport);let s=r!==e._useScissorTest;e._useScissorTest=r,qe.equals(e._scissorRectangle,o.viewport)||(e._scissorRectangle=qe.clone(o.viewport,e._scissorRectangle),s=!0),(!l(e._renderState)||!qe.equals(e._viewport,e._renderState.viewport)||s)&&(e._renderState=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packedDepthCommand)||(e._packedDepthCommand=t.createViewportQuadCommand(nB,{uniformMap:{u_depthTexture:function(){return e.depthStencilTexture}},owner:e})),l(e._clearCommand)||(e._clearCommand=new Ji({color:new U(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}L_.prototype.updateAndClear=function(e,t,n,i){const o=t.width,r=t.height;uLe(this,n,o,r,e),fLe(this,n,o,r,i),this._useHdr=e};L_.prototype.clearClassification=function(e,t){this._clearCommand.execute(e,t)};L_.prototype.packDepth=function(e,t){return this._packedDepthCommand.execute(e,t),this.packedDepthTexture};L_.prototype.isDestroyed=function(){return!1};L_.prototype.destroy=function(){return lLe(this),Ue(this)};function Id(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 En({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._alphaFBO=new En({createColorAttachments:!1,createDepthAttachments:!1,depth:!0}),this._adjustTranslucentFBO=new En({colorAttachmentsLength:this._translucentMRTSupport?2:1,createColorAttachments:!1}),this._adjustAlphaFBO=new En({createColorAttachments:!1}),this._opaqueClearCommand=new Ji({color:new U(0,0,0,0),owner:this}),this._translucentMRTClearCommand=new Ji({color:new U(0,0,0,1),owner:this}),this._translucentMultipassClearCommand=new Ji({color:new U(0,0,0,0),owner:this}),this._alphaClearCommand=new Ji({color:new U(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 qe,this._rs=void 0,this._useScissorTest=!1,this._scissorRectangle=void 0,this._useHDR=!1}function J7(e){e._accumulationTexture=e._accumulationTexture&&!e._accumulationTexture.isDestroyed()&&e._accumulationTexture.destroy(),e._revealageTexture=e._revealageTexture&&!e._revealageTexture.isDestroyed()&&e._revealageTexture.destroy()}function iB(e){e._translucentFBO.destroy(),e._alphaFBO.destroy(),e._adjustTranslucentFBO.destroy(),e._adjustAlphaFBO.destroy()}function Q7(e){J7(e),iB(e)}function dLe(e,t,n,i){J7(e),e._accumulationTexture=new zt({context:t,width:n,height:i,pixelFormat:nt.RGBA,pixelDatatype:Ke.FLOAT});const o=new Float32Array(n*i*4);e._revealageTexture=new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:Ke.FLOAT,source:{arrayBufferView:o,width:n,height:i},flipY:!1})}function hLe(e,t){iB(e);const n=se.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)&&(iB(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)&&(Q7(e),e._translucentMultipassSupport=!1,i=!1)}return i}Id.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,dLe(this,e,r,s)),(!l(this._translucentFBO.framebuffer)||c||u)&&!hLe(this,e))return;this._useHDR=i;const f=this;let h,_;l(this._compositeCommand)||(h=new Ge({sources:[iAe]}),this._translucentMRTSupport&&h.defines.push("MRT"),_={u_opaque:function(){return f._opaqueTexture},u_accumulation:function(){return f._accumulationTexture},u_revealage:function(){return f._revealageTexture}},this._compositeCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this})),l(this._adjustTranslucentCommand)||(this._translucentMRTSupport?(h=new Ge({defines:["MRT"],sources:[Yz]}),_={u_bgColor:function(){return f._translucentMRTClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this})):this._translucentMultipassSupport&&(h=new Ge({sources:[Yz]}),_={u_bgColor:function(){return f._translucentMultipassClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustTranslucentCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this}),_={u_bgColor:function(){return f._alphaClearCommand.color},u_depthTexture:function(){return f._depthStencilTexture}},this._adjustAlphaCommand=e.createViewportQuadCommand(h,{uniformMap:_,owner:this}))),this._viewport.width=r,this._viewport.height=s;const g=!qe.equals(this._viewport,t.viewport);let p=g!==this._useScissorTest;this._useScissorTest=g,qe.equals(this._scissorRectangle,t.viewport)||(this._scissorRectangle=qe.clone(t.viewport,this._scissorRectangle),p=!0),(!l(this._rs)||!qe.equals(this._viewport,this._rs.viewport)||p)&&(this._rs=Qe.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 pLe={enabled:!0,color:new U(0,0,0,0),equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.ONE,functionDestinationRgb:So.ONE,functionSourceAlpha:So.ZERO,functionDestinationAlpha:So.ONE_MINUS_SOURCE_ALPHA},mLe={enabled:!0,color:new U(0,0,0,0),equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.ONE,functionDestinationRgb:So.ONE,functionSourceAlpha:So.ONE,functionDestinationAlpha:So.ONE},_Le={enabled:!0,color:new U(0,0,0,0),equationRgb:Nc.ADD,equationAlpha:Nc.ADD,functionSourceRgb:So.ZERO,functionDestinationRgb:So.ONE_MINUS_SOURCE_ALPHA,functionSourceAlpha:So.ZERO,functionDestinationAlpha:So.ONE_MINUS_SOURCE_ALPHA};function fM(e,t,n,i){let o=n[i.id];if(!l(o)){const r=Qe.getState(i);r.depthMask=!1,r.blending=t,o=Qe.fromCache(r),n[i.id]=o}return o}function gLe(e,t,n){return fM(t,pLe,e._translucentRenderStateCache,n)}function yLe(e,t,n){return fM(t,mLe,e._translucentRenderStateCache,n)}function ALe(e,t,n){return fM(t,_Le,e._alphaRenderStateCache,n)}const CLe=` 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);
`,TLe=` 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;
`,bLe=` float ai = czm_gl_FragColor.a;
gl_FragColor = vec4(ai);
`;function dM(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=Ge.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 ELe(e,t){return dM(e,t,"translucentMRT",CLe)}function xLe(e,t){return dM(e,t,"translucentMultipass",TLe)}function wLe(e,t){return dM(e,t,"alphaMultipass",bLe)}Id.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=dt.shallowClone(e,n.translucentCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=ELe(t,e.shaderProgram),n.translucentCommand.renderState=gLe(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=dt.shallowClone(e,n.translucentCommand),n.alphaCommand=dt.shallowClone(e,n.alphaCommand),!l(i)||n.shaderProgramId!==e.shaderProgram.id?(n.translucentCommand.shaderProgram=xLe(t,e.shaderProgram),n.translucentCommand.renderState=yLe(this,t,e.renderState),n.alphaCommand.shaderProgram=wLe(t,e.shaderProgram),n.alphaCommand.renderState=ALe(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 SLe(e,t,n,i,o,r){let s,a,c;const u=t.context,f=t.frameState.useLogDepth,h=t._hdr,_=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=f?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=f?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=_}function vLe(e,t,n,i,o,r){const s=t.context,a=t.frameState.useLogDepth,c=t._hdr,u=i.framebuffer,f=o.length,h=t.frameState.shadowState.lightShadowsEnabled;i.framebuffer=e._adjustTranslucentFBO.framebuffer,e._adjustTranslucentCommand.execute(s,i);const _=e._opaqueFBO.framebuffer;i.framebuffer=e._translucentFBO.framebuffer;let g,p;for(let y=0;y<f;++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,_);l(r)&&(g=r.unclassifiedCommand,p=h&&g.receiveShadows?g.derivedCommands.oit.shadows.translucentCommand:g.derivedCommands.oit.translucentCommand,n(p,t,s,i,_)),i.framebuffer=u}Id.prototype.executeCommands=function(e,t,n,i,o){if(this._translucentMRTSupport){vLe(this,e,t,n,i,o);return}SLe(this,e,t,n,i,o)};Id.prototype.execute=function(e,t){this._compositeCommand.execute(e,t)};Id.prototype.clear=function(e,t,n){const i=t.framebuffer;t.framebuffer=this._opaqueFBO.framebuffer,U.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};Id.prototype.isSupported=function(){return this._translucentMRTSupport||this._translucentMultipassSupport};Id.prototype.isDestroyed=function(){return!1};Id.prototype.destroy=function(){return Q7(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()),Ue(this)};function VT(){this._framebuffer=new En({color:!1,depthStencil:!0,supportsDepthTexture:!0}),this._passState=void 0}Object.defineProperties(VT.prototype,{framebuffer:{get:function(){return this._framebuffer.framebuffer}}});function DLe(e){e._framebuffer.destroy()}function ILe(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i);const o=new E_(t);o.blendingEnabled=!1,o.scissorTest={enabled:!0,rectangle:new qe},o.viewport=new qe,e._passState=o}VT.prototype.update=function(e,t,n){const i=n.width,o=n.height;this._framebuffer.isDirty(i,o)&&ILe(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};VT.prototype.isDestroyed=function(){return!1};VT.prototype.destroy=function(){return DLe(this),Ue(this)};function kT(e){const t=new E_(e);t.blendingEnabled=!1,t.scissorTest={enabled:!0,rectangle:new qe},t.viewport=new qe,this._context=e,this._fb=new En({depthStencil:!0}),this._passState=t,this._width=0,this._height=0}kT.prototype.begin=function(e,t){const n=this._context,i=t.width,o=t.height;return qe.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 Q0=new U;kT.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,f=0,h=0,_=-1;for(let g=0;g<s;++g){if(-a<=u&&u<=a&&-c<=f&&f<=c){const p=4*((c-f)*t+u+a);Q0.red=U.byteToFloat(o[p]),Q0.green=U.byteToFloat(o[p+1]),Q0.blue=U.byteToFloat(o[p+2]),Q0.alpha=U.byteToFloat(o[p+3]);const y=i.getObjectByPickColor(Q0);if(l(y))return y}if(u===f||u<0&&-u===f||u>0&&u===1-f){const p=h;h=-_,_=p}u+=h,f+=_}};kT.prototype.isDestroyed=function(){return!1};kT.prototype.destroy=function(){return this._fb.destroy(),Ue(this)};function lf(){this._numSamples=1,this._colorFramebuffer=new En({depthStencil:!0,supportsDepthTexture:!0}),this._idFramebuffer=new En({depthStencil:!0,supportsDepthTexture:!0}),this._idClearColor=new U(0,0,0,0),this._clearCommand=new Ji({color:new U(0,0,0,0),depth:1,owner:this})}function PLe(e){e._colorFramebuffer.destroy(),e._idFramebuffer.destroy()}Object.defineProperties(lf.prototype,{framebuffer:{get:function(){return this._colorFramebuffer.framebuffer}},idFramebuffer:{get:function(){return this._idFramebuffer.framebuffer}},depthStencilTexture:{get:function(){return this._colorFramebuffer.getDepthStencilTexture()}}});lf.prototype.update=function(e,t,n,i){const o=t.width,r=t.height,s=n?e.halfFloatingPointTexture?Ke.HALF_FLOAT:Ke.FLOAT:Ke.UNSIGNED_BYTE;this._numSamples=i,this._colorFramebuffer.update(e,o,r,i,s),this._idFramebuffer.update(e,o,r)};lf.prototype.clear=function(e,t,n){U.clone(n,this._clearCommand.color),U.clone(this._idClearColor,this._clearCommand.color),this._colorFramebuffer.clear(e,this._clearCommand,t),this._idFramebuffer.clear(e,this._clearCommand,t)};lf.prototype.getFramebuffer=function(){return this._colorFramebuffer.framebuffer};lf.prototype.getIdFramebuffer=function(){return this._idFramebuffer.framebuffer};lf.prototype.prepareColorTextures=function(e){this._numSamples>1&&this._colorFramebuffer.prepareTextures(e)};lf.prototype.isDestroyed=function(){return!1};lf.prototype.destroy=function(){return PLe(this),Ue(this)};function Xc(){}Xc.getShadowCastShaderKeyword=function(e,t,n,i){return`castShadow ${e} ${t} ${n} ${i}`};Xc.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=Ge.findPositionVarying(e),s=l(r);if(t&&!s){const a=o.length;for(let u=0;u<a;++u)o[u]=Ge.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 Ge({defines:i,sources:o})};Xc.createShadowCastFragmentShader=function(e,t,n,i){const o=e.defines.slice(0),r=e.sources.slice(0);o.push("SHADOW_MAP");let s=Ge.findPositionVarying(e);const a=l(s);a||(s="v_positionEC");const c=r.length;for(let f=0;f<c;++f)r[f]=Ge.replaceMain(r[f],"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 Ge({defines:o,sources:r})};Xc.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,f=e.softShadows;return`receiveShadow ${o}${r}${s}${a}${c}${u}${f}${t}${n}${i}`};Xc.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 Ge({defines:i,sources:o})};Xc.createShadowReceiveFragmentShader=function(e,t,n,i,o){const r=Ge.findNormalVarying(e),s=!i&&l(r)||i&&o,a=Ge.findPositionVarying(e),c=l(a),u=t._usesDepthTexture,f=t._polygonOffsetSupported,h=t._isPointLight,_=t._isSpotLight,g=t._numberOfCascades>1,p=t.debugCascadeColors,y=t.softShadows,C=h?t._pointBias:i?t._terrainBias:t._primitiveBias,T=e.defines.slice(0),E=e.sources.slice(0),w=E.length;for(let O=0;O<w;++O)E[O]=Ge.replaceMain(E[O],"czm_shadow_receive_main");h?T.push("USE_CUBE_MAP_SHADOW"):u&&T.push("USE_SHADOW_DEPTH_TEXTURE"),y&&!h&&T.push("USE_SOFT_SHADOWS"),g&&n&&i&&(s?T.push("ENABLE_VERTEX_LIGHTING"):T.push("ENABLE_DAYNIGHT_SHADING")),n&&C.normalShading&&s&&(T.push("USE_NORMAL_SHADING"),C.normalShadingSmooth>0&&T.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)
{
${C.normalOffset&&s?` float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x;
float normalOffsetScale = 1.0 - nDotL;
vec3 offset = normalOffset * normalOffsetScale * normalEC;
positionEC.xyz += offset;
`:""}}
`,S+=`void main()
{
czm_shadow_receive_main();
vec4 positionEC = getPositionEC();
vec3 normalEC = getNormalEC();
float depth = -positionEC.z;
`,S+=` czm_shadowParameters shadowParameters;
shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
`,i?S+=` shadowParameters.depthBias *= max(depth * 0.01, 1.0);
`:f||(S+=` shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015);
`),h?S+=` vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz;
float distance = length(directionEC);
directionEC = normalize(directionEC);
float radius = shadowMap_lightPositionEC.w;
// Stop early if the fragment is beyond the point light radius
if (distance > radius)
{
return;
}
vec3 directionWC = czm_inverseViewRotation * directionEC;
shadowParameters.depth = distance / radius;
shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
shadowParameters.texCoords = directionWC;
float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters);
`:_?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 Ge({defines:T,sources:E})};function gc(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;(un.isInternetExplorer()||un.isEdge()||(un.isChrome()||un.isFirefox())&&un.isWindows()&&!t.depthTexture)&&(n=!1),this._polygonOffsetSupported=n,this._terrainBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.5,normalShading:!0,normalShadingSmooth:.3,depthBias:1e-4},this._primitiveBias={polygonOffset:n,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:.1,normalShading:!0,normalShadingSmooth:.05,depthBias:2e-5},this._pointBias={polygonOffset:!1,polygonOffsetFactor:1.1,polygonOffsetUnits:4,normalOffset:this._normalOffset,normalOffsetScale:0,normalShading:!0,normalShadingSmooth:.1,depthBias:5e-4},this._depthAttachment=void 0,this._colorAttachment=void 0,this._shadowMapMatrix=new B,this._shadowMapTexture=void 0,this._lightDirectionEC=new d,this._lightPositionEC=new oe,this._distance=0,this._lightCamera=e.lightCamera,this._shadowMapCamera=new kv,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 Bo: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 OLe(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,hM(this),this._clearCommand=new Ji({depth:1,color:new U}),this._clearPassState=new E_(t),this._size=A(e.size,2048),this.size=this._size}gc.MAXIMUM_DISTANCE=2e4;function OLe(e){this.camera=new kv,this.passState=new E_(e),this.framebuffer=void 0,this.textureOffsets=void 0,this.commandList=[],this.cullingVolume=void 0}function IP(e,t){return Qe.fromCache({cull:{enabled:!0,face:Po.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 hM(e){const t=!e._usesDepthTexture;e._primitiveRenderState=IP(t,e._primitiveBias),e._terrainRenderState=IP(t,e._terrainBias),e._pointRenderState=IP(t,e._pointBias)}gc.prototype.debugCreateRenderStates=function(){hM(this)};Object.defineProperties(gc.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){FLe(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 pM(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 LLe(e,t){const n=new Ol({context:t,width:e._textureSize.x,height:e._textureSize.y,format:Gf.DEPTH_COMPONENT16}),i=new zt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,sampler:Yn.NEAREST}),o=new zr({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 BLe(e,t){const n=new zt({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:nt.DEPTH_STENCIL,pixelDatatype:Ke.UNSIGNED_INT_24_8,sampler:Yn.NEAREST}),i=new zr({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 RLe(e,t){const n=new Ol({context:t,width:e._textureSize.x,height:e._textureSize.y,format:Gf.DEPTH_COMPONENT16}),i=new nu({context:t,width:e._textureSize.x,height:e._textureSize.y,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,sampler:Yn.NEAREST}),o=[i.negativeX,i.negativeY,i.negativeZ,i.positiveX,i.positiveY,i.positiveZ];for(let r=0;r<6;++r){const s=new zr({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 Z7(e,t){e._isPointLight?RLe(e,t):e._usesDepthTexture?BLe(e,t):LLe(e,t)}function NLe(e,t){e._usesDepthTexture&&e._passes[0].framebuffer.status!==se.FRAMEBUFFER_COMPLETE&&(e._usesDepthTexture=!1,hM(e),pM(e),Z7(e,t))}function MLe(e,t){(!l(e._passes[0].framebuffer)||e._shadowMapTexture.width!==e._textureSize.x)&&(pM(e),Z7(e,t),NLe(e,t),eY(e,t))}function eY(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 FLe(e,t){e._size=t;const n=e._passes,i=n.length,o=e._textureSize;if(e._isPointLight){t=wt.maximumCubeMapSize>=t?t:wt.maximumCubeMapSize,o.x=t,o.y=t;const r=new qe(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=wt.maximumTextureSize>=t?t:wt.maximumTextureSize,o.x=t,o.y=t,n[0].passState.viewport=new qe(0,0,t,t)):i===4&&(t=wt.maximumTextureSize>=t*2?t:wt.maximumTextureSize/2,o.x=t*2,o.y=t*2,n[0].passState.viewport=new qe(0,0,t,t),n[1].passState.viewport=new qe(t,0,t,t),n[2].passState.viewport=new qe(0,t,t,t),n[3].passState.viewport=new qe(t,t,t,t));e._clearPassState.viewport=new qe(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,f=a.width/o.x,h=a.height/o.y;s.textureOffsets=new B(f,0,0,c,0,h,0,u,0,0,1,0,0,0,0,1)}}const zLe=new qe;function ULe(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=Be.OVERLAY,i}function HLe(e,t){const n=t.context,i=t.context.drawingBufferWidth,o=t.context.drawingBufferHeight,r=Math.min(i,o)*.3,s=zLe;s.x=i-r,s.y=0,s.width=r,s.height=r;let a=e._debugShadowViewCommand;l(a)||(a=ULe(e,n),e._debugShadowViewCommand=a),(!l(a.renderState)||!qe.equals(a.renderState.viewport,s))&&(a.renderState=Qe.fromCache({viewport:qe.clone(s)})),t.commandList.push(e._debugShadowViewCommand)}const uf=new Array(8);uf[0]=new oe(-1,-1,-1,1);uf[1]=new oe(1,-1,-1,1);uf[2]=new oe(1,1,-1,1);uf[3]=new oe(-1,1,-1,1);uf[4]=new oe(-1,-1,1,1);uf[5]=new oe(1,-1,1,1);uf[6]=new oe(1,1,1,1);uf[7]=new oe(-1,1,1,1);const Lh=new B,mM=new Array(8);for(let e=0;e<8;++e)mM[e]=new oe;function VLe(e,t){const n=new nn({geometry:new ac({minimum:new d(-.5,-.5,-.5),maximum:new d(.5,.5,.5)}),attributes:{color:an.fromColor(t)}}),i=new nn({geometry:new op({radius:.5}),attributes:{color:an.fromColor(t)}});return new Wt({geometryInstances:[n,i],appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1,modelMatrix:e})}const kLe=[U.RED,U.GREEN,U.BLUE,U.MAGENTA],GLe=new d;function WLe(e,t){HLe(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 Oh({camera:e._sceneCamera,color:U.CYAN,updateOnChange:!1})),e._debugCameraFrustum.update(t)),e._cascadesEnabled){if(e.debugFreezeFrame){n&&(e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=new Oh({camera:e._shadowMapCamera,color:U.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 Oh({camera:e._passes[i].camera,color:kLe[i],updateOnChange:!1})),e._debugCascadeFrustums[i].update(t)}}else if(e._isPointLight){if(!l(e._debugLightFrustum)||e._needsUpdate){const i=e._shadowMapCamera.positionWC,o=Ce.IDENTITY,r=e._pointLightRadius*2,s=d.fromElements(r,r,r,GLe),a=B.fromTranslationQuaternionRotationScale(i,o,s,Lh);e._debugLightFrustum=e._debugLightFrustum&&e._debugLightFrustum.destroy(),e._debugLightFrustum=VLe(a,U.YELLOW)}e._debugLightFrustum.update(t)}else(!l(e._debugLightFrustum)||e._needsUpdate)&&(e._debugLightFrustum=new Oh({camera:e._shadowMapCamera,color:U.YELLOW,updateOnChange:!1})),e._debugLightFrustum.update(t)}function kv(){this.viewMatrix=new B,this.inverseViewMatrix=new B,this.frustum=void 0,this.positionCartographic=new Ae,this.positionWC=new d,this.directionWC=d.clone(d.UNIT_Z),this.upWC=d.clone(d.UNIT_Y),this.rightWC=d.clone(d.UNIT_X),this.viewProjectionMatrix=new B}kv.prototype.clone=function(e){B.clone(e.viewMatrix,this.viewMatrix),B.clone(e.inverseViewMatrix,this.inverseViewMatrix),this.frustum=e.frustum.clone(this.frustum),Ae.clone(e.positionCartographic,this.positionCartographic),d.clone(e.positionWC,this.positionWC),d.clone(e.directionWC,this.directionWC),d.clone(e.upWC,this.upWC),d.clone(e.rightWC,this.rightWC)};const jLe=new B(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);kv.prototype.getViewProjection=function(){const e=this.viewMatrix,t=this.frustum.projectionMatrix;return B.multiply(t,e,this.viewProjectionMatrix),B.multiply(jLe,this.viewProjectionMatrix,this.viewProjectionMatrix),this.viewProjectionMatrix};const qLe=new Array(5),YLe=new Un,$Le=new Array(4),tY=new d,nY=new d;function XLe(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 f=.9,h=!1;t.shadowState.closestObjectSize<200&&(h=!0,f=.9);const _=$Le,g=qLe;for(g[0]=o,g[s]=r,a=0;a<s;++a){const H=(a+1)/s,v=o*Math.pow(u,H),I=o+c*H,m=N.lerp(I,v,f);g[a+1]=m,_[a]=m-g[a]}if(h){for(a=0;a<s;++a)_[a]=Math.min(_[a],e._maximumCascadeDistances[a]);let H=g[0];for(a=0;a<s-1;++a)H+=_[a],g[a+1]=H}oe.unpack(g,0,e._cascadeSplits[0]),oe.unpack(g,1,e._cascadeSplits[1]),oe.unpack(_,0,e._cascadeDistances);const p=n.frustum,y=p.left,C=p.right,T=p.bottom,E=p.top,w=p.near,S=p.far,P=n.positionWC,O=n.directionWC,z=n.upWC,R=i.frustum.clone(YLe),F=n.getViewProjection();for(a=0;a<s;++a){R.near=g[a],R.far=g[a+1];const H=B.multiply(R.projectionMatrix,i.viewMatrix,Lh),v=B.inverse(H,Lh),I=B.multiply(F,v,Lh),m=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,tY),D=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,nY);for(let W=0;W<8;++W){const G=oe.clone(uf[W],mM[W]);B.multiplyByVector(I,G,G),d.divideByScalar(G,G.w,G),d.minimumByComponent(G,m,m),d.maximumByComponent(G,D,D)}m.x=Math.max(m.x,0),m.y=Math.max(m.y,0),m.z=0,D.x=Math.min(D.x,1),D.y=Math.min(D.y,1),D.z=Math.min(D.z,1);const L=e._passes[a],M=L.camera;M.clone(n);const V=M.frustum;V.left=y+m.x*(C-y),V.right=y+D.x*(C-y),V.bottom=T+m.y*(E-T),V.top=T+D.y*(E-T),V.near=w+m.z*(S-w),V.far=w+D.z*(S-w),L.cullingVolume=M.frustum.computeCullingVolume(P,O,z);const k=e._cascadeMatrices[a];B.multiply(M.getViewProjection(),i.inverseViewMatrix,k),B.multiply(L.textureOffsets,k,k)}}const KLe=new B,JLe=new d,QLe=new d,RV=new d;function ZLe(e,t){const n=e._shadowMapCamera,i=e._sceneCamera,o=B.multiply(i.frustum.projectionMatrix,i.viewMatrix,Lh),r=B.inverse(o,Lh),s=n.directionWC;let a=i.directionWC;d.equalsEpsilon(s,a,N.EPSILON10)&&(a=i.upWC);const c=d.cross(s,a,JLe);a=d.cross(c,s,QLe),d.normalize(a,a),d.normalize(c,c);const u=d.fromElements(0,0,0,RV);let f=B.computeView(u,s,a,c,KLe);const h=B.multiply(f,r,Lh),_=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,tY),g=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,nY);for(let S=0;S<8;++S){const P=oe.clone(uf[S],mM[S]);B.multiplyByVector(h,P,P),d.divideByScalar(P,P.w,P),d.minimumByComponent(P,_,_),d.maximumByComponent(P,g,g)}g.z+=1e3,_.z-=10;const p=RV;p.x=-(.5*(_.x+g.x)),p.y=-(.5*(_.y+g.y)),p.z=-g.z;const y=B.fromTranslation(p,Lh);f=B.multiply(y,f,f);const C=.5*(g.x-_.x),T=.5*(g.y-_.y),E=g.z-_.z,w=n.frustum;w.left=-C,w.right=C,w.bottom=-T,w.top=T,w.near=.01,w.far=E,B.clone(f,n.viewMatrix),B.inverse(f,n.inverseViewMatrix),B.getTranslation(n.inverseViewMatrix,n.positionWC),t.mapProjection.ellipsoid.cartesianToCartographic(n.positionWC,n.positionCartographic),d.clone(s,n.directionWC),d.clone(a,n.upWC),d.clone(c,n.rightWC)}const eBe=[new d(-1,0,0),new d(0,-1,0),new d(0,0,-1),new d(1,0,0),new d(0,1,0),new d(0,0,1)],tBe=[new d(0,-1,0),new d(0,0,-1),new d(0,-1,0),new d(0,-1,0),new d(0,0,1),new d(0,-1,0)],nBe=[new d(0,0,1),new d(1,0,0),new d(-1,0,0),new d(0,0,-1),new d(1,0,0),new d(1,0,0)];function iBe(e,t){const n=new Un;n.fov=N.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=eBe[i],o.upWC=tBe[i],o.rightWC=nBe[i],B.computeView(o.positionWC,o.directionWC,o.upWC,o.rightWC,o.viewMatrix),B.inverse(o.viewMatrix,o.inverseViewMatrix),o.frustum=n}}const oBe=new d,rBe=new d,iY=new fe,NV=iY.center;function sBe(e,t){const n=e._sceneCamera,i=e._shadowMapCamera,o=iY;if(e._cascadesEnabled){if(n.frustum.near>=e.maximumDistance){e._outOfView=!0,e._needsUpdate=!1;return}const r=t.mapProjection.ellipsoid.geodeticSurfaceNormal(n.positionWC,oBe),s=d.negate(i.directionWC,rBe),a=d.dot(r,s);if(e.fadingEnabled){const c=N.clamp(a/.1,0,1);e._darkness=N.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)===mn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),fe.clone(o,e._boundingSphere);else{const r=i.frustum.far/2,s=d.add(i.positionWC,d.multiplyByScalar(i.directionWC,r,NV),NV);o.center=s,o.radius=r,e._outOfView=t.cullingVolume.computeVisibility(o)===mn.OUTSIDE,e._needsUpdate=!e._outOfView&&!e._boundingSphere.equals(o),fe.clone(o,e._boundingSphere)}}function aBe(e,t){const n=t.camera,i=e._lightCamera,o=e._sceneCamera,r=e._shadowMapCamera;e._cascadesEnabled?d.clone(i.directionWC,r.directionWC):e._isPointLight?d.clone(i.positionWC,r.positionWC):r.clone(i);const s=e._lightDirectionEC;B.multiplyByPointAsVector(n.viewMatrix,r.directionWC,s),d.normalize(s,s),d.negate(s,s),B.multiplyByPoint(n.viewMatrix,r.positionWC,e._lightPositionEC),e._lightPositionEC.w=e._pointLightRadius;let a,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=ot.clone(n,o),n.frustum.clone(e._sceneCamera.frustum),e._sceneCamera.frustum.near=a,e._sceneCamera.frustum.far=c,e._distance=c-a,sBe(e,t),!e._outOfViewPrevious&&e._outOfView&&(e._needsUpdate=!0),e._outOfViewPrevious=e._outOfView}gc.prototype.update=function(e){if(aBe(this,e),this._needsUpdate)if(MLe(this,e.context),this._isPointLight&&iBe(this,e),this._cascadesEnabled&&(ZLe(this,e),this._numberOfCascades>1&&XLe(this,e)),this._isPointLight)this._shadowMapCullingVolume=Ko.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&&WLe(this,e)};gc.prototype.updatePass=function(e,t){eY(this,e,t)};const cBe=new j;function oY(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=cBe;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 sn(t,o,!1)}function lBe(e,t,n,i,o,r){let s,a,c;if(l(r)&&(s=r.shaderProgram,a=r.renderState,c=r.uniformMap),r=dt.shallowClone(n,r),r.castShadows=!0,r.receiveShadows=!1,!l(s)||o!==n.shaderProgram.id||t){const u=n.shaderProgram,f=n.pass===Be.GLOBE,h=n.pass!==Be.TRANSLUCENT,_=e._isPointLight,g=e._usesDepthTexture,p=Xc.getShadowCastShaderKeyword(_,f,g,h);if(s=i.shaderCache.getDerivedShaderProgram(u,p),!l(s)){const C=u.vertexShaderSource,T=u.fragmentShaderSource,E=Xc.createShadowCastVertexShader(C,_,f),w=Xc.createShadowCastFragmentShader(T,_,g,h);s=i.shaderCache.createDerivedShaderProgram(u,p,{vertexShaderSource:E,fragmentShaderSource:w,attributeLocations:u._attributeLocations})}a=e._primitiveRenderState,_?a=e._pointRenderState:f&&(a=e._terrainRenderState),n.renderState.cull.enabled||(a=ut(a,!1),a.cull=ut(a.cull,!1),a.cull.enabled=!1,a=Qe.fromCache(a)),c=oY(e,n.uniformMap,f)}return r.shaderProgram=s,r.renderState=a,r.uniformMap=c,r}gc.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===Be.GLOBE;let f=!1;if(u&&(f=t.owner.data.renderedMesh.encoding.hasVertexNormals),t.receiveShadows&&r){let h,_;l(o.receiveCommand)&&(h=o.receiveCommand.shaderProgram,_=o.receiveCommand.uniformMap),o.receiveCommand=dt.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=Xc.getShadowReceiveShaderKeyword(e[0],t.castShadows,u,f);if(h=i.shaderCache.getDerivedShaderProgram(s,y),!l(h)){const C=Xc.createShadowReceiveVertexShader(a,u,f),T=Xc.createShadowReceiveFragmentShader(c,e[0],t.castShadows,u,f);h=i.shaderCache.createDerivedShaderProgram(s,y,{vertexShaderSource:C,fragmentShaderSource:T,attributeLocations:s._attributeLocations})}_=oY(e[0],t.uniformMap,u)}o.receiveCommand.shaderProgram=h,o.receiveCommand.uniformMap=_,o.receiveShaderProgramId=t.shaderProgram.id,o.receiveShaderCastShadows=t.castShadows}return o};gc.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]=lBe(e[c],n,t,i,s,r[c]);o.castShaderProgramId=t.shaderProgram.id}return o};gc.prototype.isDestroyed=function(){return!1};gc.prototype.destroy=function(){pM(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 Ue(this)};const PP=`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 Sp(e){this._drawClassificationFBO=new En({createDepthAttachments:!1}),this._accumulationFBO=new En({createDepthAttachments:!1}),this._packFBO=new En,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 Ji({color:new U(0,0,0,0),owner:this}),this._clearDepthStencilCommand=new Ji({depth:1,stencil:0,owner:this}),this._supported=e.depthTexture,this._viewport=new qe,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(Sp.prototype,{hasTranslucentDepth:{get:function(){return this._hasTranslucentDepth}}});function rY(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 uBe(e,t,n,i){rY(e),e._translucentDepthStencilTexture=new zt({context:t,width:n,height:i,pixelFormat:nt.DEPTH_STENCIL,pixelDatatype:Ke.UNSIGNED_INT_24_8,sampler:Yn.NEAREST})}function fBe(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 dBe(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)&&(uBe(e,t,o,r),fBe(e,t,o,r));let s,a;if(l(e._packDepthCommand)||(s=new Ge({sources:[nAe]}),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 Ge({sources:[PP]}),a={colorTexture:function(){return e._textureToComposite}},e._compositeCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e});const f=e._compositeCommand,h=f.shaderProgram,_=t.shaderCache.createDerivedShaderProgram(h,"pick",{vertexShaderSource:h.vertexShaderSource,fragmentShaderSource:new Ge({sources:s.sources,defines:["PICK"]}),attributeLocations:h._attributeLocations}),g=dt.shallowClone(f);g.shaderProgram=_,f.derivedCommands.pick=g}l(e._copyCommand)||(s=new Ge({sources:[PP]}),a={colorTexture:function(){return e._drawClassificationFBO.getColorTexture()}},e._copyCommand=t.createViewportQuadCommand(s,{uniformMap:a,owner:e})),l(e._accumulateCommand)||(s=new Ge({sources:[PP]}),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=!qe.equals(e._viewport,n.viewport);let u=c!==e._useScissorTest;e._useScissorTest=c,qe.equals(e._scissorRectangle,n.viewport)||(e._scissorRectangle=qe.clone(n.viewport,e._scissorRectangle),u=!0),(!l(e._rsDepth)||!qe.equals(e._viewport,e._rsDepth.viewport)||u)&&(e._rsDepth=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle}})),l(e._packDepthCommand)&&(e._packDepthCommand.renderState=e._rsDepth),(!l(e._rsAccumulate)||!qe.equals(e._viewport,e._rsAccumulate.viewport)||u)&&(e._rsAccumulate=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},stencilTest:{enabled:!0,frontFunction:ri.EQUAL,reference:Pt.CESIUM_3D_TILE_MASK}})),l(e._accumulateCommand)&&(e._accumulateCommand.renderState=e._rsAccumulate),(!l(e._rsComp)||!qe.equals(e._viewport,e._rsComp.viewport)||u)&&(e._rsComp=Qe.fromCache({viewport:e._viewport,scissorTest:{enabled:e._useScissorTest,rectangle:e._scissorRectangle},blending:Ii.ALPHA_BLEND})),l(e._compositeCommand)&&(e._compositeCommand.renderState=e._rsComp,e._compositeCommand.derivedCommands.pick.renderState=e._rsComp)}Sp.prototype.executeTranslucentCommands=function(e,t,n,i,o){const r=i.length;let s,a;const c=e.frameState.useLogDepth,u=e.context,f=n.framebuffer;for(a=0;a<r;++a)if(s=i[a],s=c?s.derivedCommands.logDepth.command:s,s.depthForTranslucentClassification){this._hasTranslucentDepth=!0;break}if(this._hasTranslucentDepth){for(dBe(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=f}};Sp.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(Be.CESIUM_3D_TILE_CLASSIFICATION);const a=r.globeDepthTexture;r.globeDepthTexture=this._packFBO.getColorTexture();const c=i.commands[Be.CESIUM_3D_TILE_CLASSIFICATION],u=i.indices[Be.CESIUM_3D_TILE_CLASSIFICATION];for(let f=0;f<u;++f)t(c[f],e,o,n);r.globeDepthTexture=a,n.framebuffer=s,this._frustumsDrawn!==1&&(n.framebuffer=this._accumulationFBO.framebuffer,this._accumulateCommand.execute(o,n),n.framebuffer=s)};Sp.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),hBe(this,e,t)};function hBe(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}Sp.prototype.isSupported=function(){return this._supported};Sp.prototype.isDestroyed=function(){return!1};Sp.prototype.destroy=function(){return rY(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()),Ue(this)};function pBe(){this.command=void 0,this.near=void 0,this.far=void 0}function GT(e,t,n){const i=e.context;let o;i.depthTexture&&(o=new cf);let r;e._useOIT&&i.depthTexture&&(r=new Id(i));const s=new E_(i);s.viewport=qe.clone(n),this.camera=t,this._cameraClone=ot.clone(t),this._cameraStartFired=!1,this._cameraMovedTime=void 0,this.viewport=n,this.passState=s,this.pickFramebuffer=new kT(i),this.pickDepthFramebuffer=new VT,this.sceneFramebuffer=new lf,this.globeDepth=o,this.globeTranslucencyFramebuffer=new L_,this.oit=r,this.translucentTileClassification=new Sp(i),this.pickDepths=[],this.frustumCommandsList=[],this.debugFrustumStatistics=void 0,this._commandExtents=[]}const MV=new d,FV=new d;function mBe(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 _Be(e,t,n){const i=1/Math.max(1,mBe(e.position,t.position));return d.multiplyByScalar(e.position,i,MV),d.multiplyByScalar(t.position,i,FV),d.equalsEpsilon(MV,FV,n)&&d.equalsEpsilon(e.direction,t.direction,n)&&d.equalsEpsilon(e.up,t.up,n)&&d.equalsEpsilon(e.right,t.right,n)&&B.equalsEpsilon(e.transform,t.transform,n)&&e.frustum.equalsEpsilon(t.frustum,n)}GT.prototype.checkForCameraUpdates=function(e){const t=this.camera,n=this._cameraClone;return _Be(t,n,N.EPSILON15)?(this._cameraStartFired&&er()-this._cameraMovedTime>e.cameraEventWaitTime&&(t.moveEnd.raiseEvent(),this._cameraStartFired=!1),!1):(this._cameraStartFired||(t.moveStart.raiseEvent(),this._cameraStartFired=!0),this._cameraMovedTime=er(),ot.clone(t,n),!0)};function gBe(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+N.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 f=e.frustumCommandsList;f.length=u;for(let h=0;h<u;++h){let _,g;a?(_=Math.min(i-c,n+h*c),g=Math.min(i,_+c)):(_=Math.max(n,Math.pow(s,h)*n),g=Math.min(i,s*_));let p=f[h];l(p)?(p.near=_,p.far=g):p=f[h]=new aLe(_,g)}}function yBe(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,f=c.far;if(i>f)continue;if(o<u)break;const h=n.pass,_=c.indices[h]++;if(c.commands[h][_]=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 zV=new Ko,ABe=new Ih;GT.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,f=Be.NUMBER_OF_PASSES;for(let I=0;I<u;++I)for(let m=0;m<f;++m)c[I].indices[m]=0;r.length=0,s.length=0;const h=this._commandExtents,_=h.length;let g=0,p=+Number.MAX_VALUE,y=-Number.MAX_VALUE;const C=t.shadowState.shadowsEnabled;let T=+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 O=zV.planes;for(let I=0;I<5;++I)O[I]=P.planes[I];P=zV;const z=a.length;for(let I=0;I<z;++I){const m=a[I],D=m.pass;if(D===Be.COMPUTE)r.push(m);else if(D===Be.OVERLAY)s.push(m);else{let L,M;const V=m.boundingVolume;if(l(V)){if(!e.isVisible(m,P,S))continue;const W=V.computePlaneDistances(o,i,ABe);if(L=W.start,M=W.stop,p=Math.min(p,L),y=Math.max(y,M),C&&m.receiveShadows&&L<gc.MAXIMUM_DISTANCE&&!(D===Be.GLOBE&&L<-100&&M>100)){const G=M-L;D!==Be.GLOBE&&L<100&&(w=Math.min(w,G)),T=Math.min(T,L),E=Math.max(E,M)}}else m instanceof Ji?(L=n.frustum.near,M=n.frustum.far):(L=n.frustum.near,M=n.frustum.far,p=Math.min(p,L),y=Math.max(y,M));let k=h[g];l(k)||(k=h[g]=new pBe),k.command=m,k.near=L,k.far=M,g++}}C&&(T=Math.min(Math.max(T,n.frustum.near),n.frustum.far),E=Math.max(Math.min(E,n.frustum.far),T)),C&&(t.shadowState.nearPlane=T,t.shadowState.farPlane=E,t.shadowState.closestObjectSize=w),gBe(this,e,p,y);let R,F;for(R=0;R<g;R++)F=h[R],yBe(this,e,F.command,F.near,F.far);if(g<_)for(R=g;R<_&&(F=h[R],!!l(F.command));R++)F.command=void 0;const H=c.length,v=t.frustumSplits;v.length=H+1;for(let I=0;I<H;++I)v[I]=c[I].near,I===H-1&&(v[I+1]=c[I].far)};GT.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 aY=.1,CBe=new I_({pass:Ys.MOST_DETAILED_PRELOAD}),TBe=new I_({pass:Ys.MOST_DETAILED_PICK}),_M=new I_({pass:Ys.PICK});function Ss(e){this._mostDetailedRayPicks=[],this.pickRenderStateCache={},this._pickPositionCache={},this._pickPositionCacheDirty=!1;const t=new qe(0,0,1,1),n=new ot(e);n.frustum=new Ft({width:aY,aspectRatio:1,near:.1}),this._pickOffscreenView=new GT(e,n,t)}Ss.prototype.update=function(){this._pickPositionCacheDirty=!0};Ss.prototype.getPickDepth=function(e,t){const n=e.view.pickDepths;let i=n[t];return l(i)||(i=new O_,n[t]=i),i};const bBe=new Bo,EBe=new d,jE=new d,xBe=new j,wBe=new B;function SBe(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,wBe);r._setTransform(B.IDENTITY);const f=d.clone(r.position,EBe);d.multiplyByScalar(r.right,a,jE),d.add(jE,f,f),d.multiplyByScalar(r.up,c,jE),d.add(jE,f,f),r._setTransform(u),e.mode===le.SCENE2D&&d.fromElements(f.z,f.x,f.y,f);const h=s.getPixelDimensions(o.width,o.height,1,1,xBe),_=bBe;return _.right=h.x*.5,_.left=-_.right,_.top=h.y*.5,_.bottom=-_.top,_.near=s.near,_.far=s.far,_.computeCullingVolume(f,r.directionWC,r.upWC)}const vBe=new Ks,DBe=new j;function IBe(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,f=2*(t.x-o.x)/o.width-1,h=2*(o.height-t.y-o.y)/o.height-1,_=f*a*u,g=h*a*c,p=s.getPixelDimensions(o.width,o.height,1,1,DBe),y=p.x*n*.5,C=p.y*i*.5,T=vBe;return T.top=g+C,T.bottom=g-C,T.right=_+y,T.left=_-y,T.near=a,T.far=s.far,T.computeCullingVolume(r.positionWC,r.directionWC,r.upWC)}function cY(e,t,n,i,o){const r=e.camera.frustum;return r instanceof Ft||r instanceof Bo?SBe(e,t,n,i,o):IBe(e,t,n,i,o)}let Bg=3,NA=3,Iu=new qe(0,0,Bg,NA);const lY=new j,gM=new U(0,0,0,0);Ss.prototype.pick=function(e,t,n,i){if(!l(t))throw new x("windowPosition is undefined.");Bg=A(n,3),NA=A(i,Bg);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=qe.clone(c,u.viewport);const f=lr.transformWindowToDrawingBuffer(e,t,lY);e.jobScheduler.disableThisFrame(),e.updateFrameState(),s.cullingVolume=cY(e,f,Bg,NA,c),s.invertClassification=!1,s.passes.pick=!0,s.tilesetPassState=_M,r.update(s),e.updateEnvironment(),Iu.x=f.x-(Bg-1)*.5,Iu.y=e.drawingBufferHeight-f.y-(NA-1)*.5,Iu.width=Bg,Iu.height=NA,u=a.pickFramebuffer.begin(Iu,a.viewport),e.updateAndExecuteCommands(u,gM),e.resolveFramebuffers(u);const h=a.pickFramebuffer.end(Iu);return o.endFrame(),h};function PBe(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=qe.clone(s,a.viewport),e.clearPasses(i.passes),i.passes.pick=!0,i.passes.depth=!0,i.cullingVolume=cY(e,t,1,1,s),i.tilesetPassState=_M,e.updateEnvironment(),o.renderTranslucentDepthForPick=!0,a=r.pickDepthFramebuffer.update(n,t,s),e.updateAndExecuteCommands(a,gM),e.resolveFramebuffers(a),n.endFrame()}const OBe=new Un,LBe=new Ks,BBe=new Ft,RBe=new Bo;Ss.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 d.clone(this._pickPositionCache[i],n);const o=e.frameState,r=e.context,s=r.uniformState,a=e.defaultView;e.view=a;const c=lr.transformWindowToDrawingBuffer(e,t,lY);e.pickTranslucentDepth?PBe(e,c):(e.updateFrameState(),s.update(o),e.updateEnvironment()),c.y=e.drawingBufferHeight-c.y;const u=e.camera;let f;l(u.frustum.fov)?f=u.frustum.clone(OBe):l(u.frustum.infiniteProjectionMatrix)?f=u.frustum.clone(LBe):l(u.frustum.width)?f=u.frustum.clone(BBe):f=u.frustum.clone(RBe);const h=a.frustumCommandsList,_=h.length;for(let g=0;g<_;++g){const y=this.getPickDepth(e,g).getDepth(r,c.x,c.y);if(l(y)&&y>0&&y<1){const C=h[g];let T;return e.mode===le.SCENE2D?(T=u.position.z,u.position.z=T-C.near+1,f.far=Math.max(1,C.far-C.near),f.near=1,s.update(o),s.updateFrustum(f)):(f.near=C.near*(g!==0?e.opaqueFrustumNearOffset:1),f.far=C.far,s.updateFrustum(f)),n=lr.drawingBufferToWgs84Coordinates(e,c,y,n),e.mode===le.SCENE2D&&(u.position.z=T,s.update(o)),this._pickPositionCache[i]=d.clone(n),n}}this._pickPositionCache[i]=void 0};const NBe=new Ae;Ss.prototype.pickPosition=function(e,t,n){if(n=this.pickPositionWorldCoordinates(e,t,n),l(n)&&e.mode!==le.SCENE3D){d.fromElements(n.y,n.z,n.x,n);const i=e.mapProjection,o=i.ellipsoid,r=i.unproject(n,NBe);o.cartographicToCartesian(r,n)}return n};function uY(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,f=c.position,h=c.exclude;if(l(f)&&!l(u)){o.push(c);break}if(!l(u)||!l(u.primitive)||!h&&(o.push(c),0>=--e))break;const _=u.primitive;let g=!1;typeof _.getGeometryInstanceAttributes=="function"&&l(u.id)&&(i=_.getGeometryInstanceAttributes(u.id),l(i)&&l(i.show)&&(g=!0,i.show=Hn.toValue(!1,i.show),s.push(i))),u instanceof as&&(g=!0,u.show=!1,a.push(u)),g||(_.show=!1,r.push(_)),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=Hn.toValue(!0,i.show);for(n=0;n<a.length;++n)a[n].show=!0;return o}Ss.prototype.drillPick=function(e,t,n,i,o){const r=this;return uY(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 UV=new d,MBe=new d;function FBe(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 fY(e,t,n,i){const o=t.direction,r=d.mostOrthogonalAxis(o,UV),s=d.cross(o,r,UV),a=d.cross(o,s,MBe);return i.position=t.origin,i.direction=o,i.up=a,i.right=s,i.frustum.width=A(n,aY),i.frustum.computeCullingVolume(i.positionWC,i.directionWC,i.upWC)}function zBe(e,t,n){const i=t.frameState,o=n.ray,r=n.width,s=n.tilesets,a=e._pickOffscreenView.camera,c=fY(e,o,r,a),u=CBe;u.camera=a,u.cullingVolume=c;let f=!0;const h=s.length;for(let _=0;_<h;++_){const g=s[_];g.show&&t.primitives.contains(g)&&(g.updateForPass(i,u),f=f&&u.ready)}return f&&n._completePick(),f}Ss.prototype.updateMostDetailedRayPicks=function(e){const t=this._mostDetailedRayPicks;for(let n=0;n<t.length;++n)zBe(this,e,t[n])&&t.splice(n--,1)};function dY(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 No&&dY(r,t,n))}}function Gv(e,t,n,i,o,r){const s=[];if(dY(t.primitives,i,s),s.length===0)return Promise.resolve(r());const a=new FBe(n,o,s);return e._mostDetailedRayPicks.push(a),a.promise.then(function(){return r()})}function UBe(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 HBe(e,t,n,i,o,r,s){const a=t.context,c=a.uniformState,u=t.frameState,f=e._pickOffscreenView;t.view=f,fY(e,n,o,f.camera),Iu=qe.clone(f.viewport,Iu);const h=f.pickFramebuffer.begin(Iu,f.viewport);t.jobScheduler.disableThisFrame(),t.updateFrameState(),u.invertClassification=!1,u.passes.pick=!0,u.passes.offscreen=!0,s?u.tilesetPassState=TBe:u.tilesetPassState=_M,c.update(u),t.updateEnvironment(),t.updateAndExecuteCommands(h,gM),t.resolveFramebuffers(h);let _;const g=f.pickFramebuffer.end(Iu);if(t.context.depthTexture){const p=f.frustumCommandsList.length;for(let y=0;y<p;++y){const T=e.getPickDepth(t,y).getDepth(a,0,0);if(l(T)&&T>0&&T<1){const E=f.frustumCommandsList[y],w=E.near*(y!==0?t.opaqueFrustumNearOffset:1),S=E.far,P=w+T*(S-w);_=Pn.getPoint(n,P);break}}}if(t.view=t.defaultView,a.endFrame(),l(g)||l(_))return{object:g,position:_,exclude:!l(_)&&r||UBe(g,i)}}function hY(e,t,n,i,o,r,s,a){return uY(i,function(){return HBe(e,t,n,o,r,s,a)})}function c0(e,t,n,i,o,r,s){const a=hY(e,t,n,1,i,o,r,s);if(a.length>0)return a[0]}function pY(e,t,n,i,o,r,s,a){return hY(e,t,n,i,o,r,s,a)}function Wv(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)})})}Ss.prototype.pickFromRay=function(e,t,n,i){if(b.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");return c0(this,e,t,n,i,!1,!1)};Ss.prototype.drillPickFromRay=function(e,t,n,i,o){if(b.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");return pY(this,e,t,n,i,o,!1,!1)};Ss.prototype.pickFromRayMostDetailed=function(e,t,n,i){if(b.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");const o=this;return t=Pn.clone(t),n=l(n)?n.slice():n,Wv(e,Gv(o,e,t,n,i,function(){return c0(o,e,t,n,i,!1,!0)}))};Ss.prototype.drillPickFromRayMostDetailed=function(e,t,n,i,o){if(b.defined("ray",t),e.mode!==le.SCENE3D)throw new x("Ray intersections are only supported in 3D mode.");const r=this;return t=Pn.clone(t),i=l(i)?i.slice():i,Wv(e,Gv(r,e,t,i,o,function(){return pY(r,e,t,n,i,o,!1,!0)}))};const VBe=new d,kBe=new d,GBe=new Pn,mY=new Ae;function yM(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Qi._defaultMaxTerrainHeight,r=i.geodeticSurfaceNormalCartographic(t,kBe),s=Ae.toCartesian(t,i,VBe),a=GBe;a.origin=s,a.direction=r;const c=new Pn;return Pn.getPoint(a,o,c.origin),d.negate(r,c.direction),c}function _Y(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid,o=Ae.fromCartesian(t,i,mY);return yM(e,o)}function gY(e,t){const n=e.globe,i=l(n)?n.ellipsoid:e.mapProjection.ellipsoid;return Ae.fromCartesian(t,i,mY).height}function WBe(e,t,n,i,o){const r=yM(t,n);return Gv(e,t,r,i,o,function(){const s=c0(e,t,r,i,o,!0,!0);if(l(s))return gY(t,s.position)})}function jBe(e,t,n,i,o,r){const s=_Y(t,n);return Gv(e,t,s,i,o,function(){const a=c0(e,t,s,i,o,!0,!0);if(l(a))return d.clone(a.position,r)})}Ss.prototype.sampleHeight=function(e,t,n,i){if(b.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=yM(e,t),r=c0(this,e,o,n,i,!0,!1);if(l(r))return gY(e,r.position)};Ss.prototype.clampToHeight=function(e,t,n,i,o){if(b.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=_Y(e,t),s=c0(this,e,r,n,i,!0,!1);if(l(s))return d.clone(s.position,o)};Ss.prototype.sampleHeightMostDetailed=function(e,t,n,i){if(b.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]=WBe(this,e,t[s],n,i);return Wv(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}))};Ss.prototype.clampToHeightMostDetailed=function(e,t,n,i){if(b.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]=jBe(this,e,t[s],n,i,t[s]);return Wv(e,Promise.all(r).then(function(s){const a=s.length;for(let c=0;c<a;++c)t[c]=s[c];return t}))};Ss.prototype.destroy=function(){this._pickOffscreenView=this._pickOffscreenView&&this._pickOffscreenView.destroy()};const qBe=`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);
}
`,YBe=`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);
}
`,$Be=`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;
}
`,XBe=`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);
}
`,KBe=`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;
}
`,JBe=`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);
}
`,QBe=`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);
}
`,ZBe=`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);
}
`,eRe=`uniform sampler2D depthTexture;
varying vec2 v_textureCoordinates;
void main(void)
{
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
gl_FragColor = vec4(vec3(depth), 1.0);
}
`,tRe=`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);
}
`,nRe=`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);
}
`,iRe=`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);
}
`,oB=`#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;
}
`,oRe=`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;
}
`,rRe=`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);
}
`,sRe=`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);
}
`,aRe=`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);
}
`,cRe=`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 B_(){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 En,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(B_.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 yY(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 lRe(e,t){yY(e);let n=e._width,i=e._height;const o=t.halfFloatingPointTexture?Ke.HALF_FLOAT:Ke.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 En,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 AY(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 uRe(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 fRe(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 dRe(e,t){AY(e);const n=e._framebuffers,i=n.length,o=new Array(i);for(let r=0;r<i;++r)o[r]=t.createViewportQuadCommand(fRe(r,i),{framebuffer:n[r].framebuffer,uniformMap:uRe(e,r)});e._commands=o}B_.prototype.clear=function(e){const t=this._framebuffers;if(!l(t))return;let n=this._clearCommand;l(n)||(n=this._clearCommand=new Ji({color:new U(0,0,0,0),framebuffer:void 0}));const i=t.length;for(let o=0;o<i;++o)t[o].clear(e,n)};B_.prototype.update=function(e){const t=e.drawingBufferWidth,n=e.drawingBufferHeight;(t!==this._width||n!==this._height)&&(this._width=t,this._height=n,lRe(this,e),dRe(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};B_.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)};B_.prototype.isDestroyed=function(){return!1};B_.prototype.destroy=function(){return yY(this),AY(this),Ue(this)};const hRe={NEAREST:0,LINEAR:1},i_=hRe;function Ci(e){e=A(e,A.EMPTY_OBJECT);const t=e.fragmentShader,n=A(e.textureScale,1),i=A(e.pixelFormat,nt.RGBA);if(b.typeOf.string("options.fragmentShader",t),b.typeOf.number.greaterThan("options.textureScale",n,0),b.typeOf.number.lessThanOrEquals("options.textureScale",n,1),!nt.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,i_.NEAREST),this._pixelFormat=i,this._pixelDatatype=A(e.pixelDatatype,Ke.UNSIGNED_BYTE),this._clearColor=A(e.clearColor,U.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 E_;o.scissorTest={enabled:!0,rectangle:l(e.scissorRectangle)?qe.clone(e.scissorRectangle):new qe},this._passState=o,this._ready=!1;let r=e.name;l(r)||(r=Es()),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(Ci.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 pRe=/uniform\s+sampler2D\s+depthTexture/g;Ci.prototype._isSupported=function(e){return!pRe.test(this._fragmentShader)||e.depthTexture};function mRe(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 zt&&!l(e._textureCache.getStageByName(n))&&(e._texturesToRelease.push(a),delete s[n],delete s[`${n}Dimensions`]),r instanceof zt&&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 _Re(e,t){return function(){const n=e._actualUniforms[t];return typeof n=="function"?n():n}}function gRe(e,t){return function(){const n=e[t]();if(l(n))return n.dimensions}}function yRe(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]=_Re(e,r),n[r]=mRe(e,i,r)):(t[r]=i[r],n[r]=i[r]),o[r]=i[r];const s=t[r]();(typeof s=="string"||s instanceof zt||s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement)&&(t[`${r}Dimensions`]=gRe(t,r))}e._uniforms={},Object.defineProperties(e._uniforms,n),e._uniformMap=sn(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 ARe(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 Ge({defines:[e._useLogDepth?"LOG_DEPTH":""],sources:[n]});e._command=t.createViewportQuadCommand(i,{uniformMap:e._uniformMap,owner:e})}function CRe(e){const t=e._sampleMode;let n,i;t===i_.LINEAR?(n=An.LINEAR,i=Hr.LINEAR):(n=An.NEAREST,i=Hr.NEAREST);const o=e._sampler;(!l(o)||o.minificationFilter!==n||o.magnificationFilter!==i)&&(e._sampler=new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:n,magnificationFilter:i}))}function TRe(e,t){return function(n){e._texturesToCreate.push({name:t,source:n})}}function bRe(e,t){return function(){return e._textureCache.getOutputTexture(t)}}function ERe(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 _=h.source;e._actualUniforms[o]=new zt({context:t,source:_})}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,f=[];for(n=0;n<s;++n){o=c[n];const h=u[o],_=e._textureCache.getStageByName(h);if(l(_))e._actualUniforms[o]=bRe(e,h);else if(typeof h=="string"){const g=new Re({url:h});f.push(g.fetchImage().then(TRe(e,o)))}else e._texturesToCreate.push({name:o,source:h})}c.length=0,f.length>0?(e._ready=!1,e._texturePromise=Promise.all(f).then(function(){e._ready=!0,e._texturePromise=void 0})):e._ready=!0}function CY(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 zt&&(l(t.getStageByName(n[o]))||i[o].destroy(),e._dirtyUniforms.push(o))}function xRe(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 wRe(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 f=new Uint8Array(4);f[0]=255,f[1]=255,f[2]=255,f[3]=255,e._selectedIdTexture=new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,source:{arrayBufferView:f,width:1,height:1},sampler:Yn.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 f=o.pickIds,h=f.length;for(let _=0;_<h;++_)a=f[_].color,u[c]=U.floatToByte(a.red),u[c+1]=U.floatToByte(a.green),u[c+2]=U.floatToByte(a.blue),u[c+3]=U.floatToByte(a.alpha),c+=4}else l(o.pickId)&&(a=o.pickId.color,u[c]=U.floatToByte(a.red),u[c+1]=U.floatToByte(a.green),u[c+2]=U.floatToByte(a.blue),u[c+3]=U.floatToByte(a.alpha),c+=4);e._selectedIdTexture=new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,source:{arrayBufferView:u,width:r,height:1},sampler:Yn.NEAREST})}Ci.prototype.update=function(e,t){if(this.enabled!==this._enabled&&!this.enabled&&CY(this),this._enabled=this.enabled,!this._enabled||(this._logDepthChanged=t!==this._useLogDepth,this._useLogDepth=t,this._selectedDirty=xRe(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,wRe(this,e),yRe(this),ERe(this,e),ARe(this,e),CRe(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=Qe.fromCache({viewport:new qe(0,0,i.width,i.height)}))),this._command.renderState=o};Ci.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,Yn.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)};Ci.prototype.isDestroyed=function(){return!1};Ci.prototype.destroy=function(){return CY(this),Ue(this)};function Qs(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.stages",e.stages),b.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=Es()),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(Qs.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}}});Qs.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};Qs.prototype.get=function(e){return b.typeOf.number.greaterThanOrEquals("index",e,0),b.typeOf.number.lessThan("index",e,this.length),this._stages[e]};function SRe(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}Qs.prototype.update=function(e,t){this._selectedDirty=SRe(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)}};Qs.prototype.isDestroyed=function(){return!1};Qs.prototype.destroy=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Ue(this)};const qo={};function jv(e){const o=`#define USE_STEP_SIZE
${oB}`,r=new Ci({name:`${e}_x_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:0},sampleMode:i_.LINEAR}),s=new Ci({name:`${e}_y_direction`,fragmentShader:o,uniforms:{delta:1,sigma:2,stepSize:1,direction:1},sampleMode:i_.LINEAR}),a={};return Object.defineProperties(a,{delta:{get:function(){return r.uniforms.delta},set:function(c){const u=r.uniforms,f=s.uniforms;u.delta=f.delta=c}},sigma:{get:function(){return r.uniforms.sigma},set:function(c){const u=r.uniforms,f=s.uniforms;u.sigma=f.sigma=c}},stepSize:{get:function(){return r.uniforms.stepSize},set:function(c){const u=r.uniforms,f=s.uniforms;u.stepSize=f.stepSize=c}}}),new Qs({name:e,stages:[r,s],uniforms:a})}qo.createBlurStage=function(){return jv("czm_blur")};qo.createDepthOfFieldStage=function(){const e=jv("czm_depth_of_field_blur"),t=new Ci({name:"czm_depth_of_field_composite",fragmentShader:ZBe,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 Qs({name:"czm_depth_of_field",stages:[e,t],inputPreviousStageTexture:!1,uniforms:n})};qo.isDepthOfFieldSupported=function(e){return e.context.depthTexture};qo.createEdgeDetectionStage=function(){const e=Es();return new Ci({name:`czm_edge_detection_${e}`,fragmentShader:tRe,uniforms:{length:.25,color:U.clone(U.BLACK)}})};qo.isEdgeDetectionSupported=function(e){return e.context.depthTexture};function vRe(e){if(!l(e))return qo.createEdgeDetectionStage();const t=new Qs({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 Ci({name:"czm_edge_detection_combine",fragmentShader:r,uniforms:n});return new Qs({name:"czm_edge_detection_composite",stages:[t,s]})}qo.createSilhouetteStage=function(e){const t=vRe(e),n=new Ci({name:"czm_silhouette_color_edges",fragmentShader:cRe,uniforms:{silhouetteTexture:t.name}});return new Qs({name:"czm_silhouette",stages:[t,n],inputPreviousStageTexture:!1,uniforms:t.uniforms})};qo.isSilhouetteSupported=function(e){return e.context.depthTexture};qo.createBloomStage=function(){const e=new Ci({name:"czm_bloom_contrast_bias",fragmentShader:QBe,uniforms:{contrast:128,brightness:-.3}}),t=jv("czm_bloom_blur"),n=new Qs({name:"czm_bloom_contrast_bias_blur",stages:[e,t]}),i=new Ci({name:"czm_bloom_generate_composite",fragmentShader:KBe,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 Qs({name:"czm_bloom",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};qo.createAmbientOcclusionStage=function(){const e=new Ci({name:"czm_ambient_occlusion_generate",fragmentShader:YBe,uniforms:{intensity:3,bias:.1,lengthCap:.26,stepSize:1.95,frustumLength:1e3,randomTexture:void 0}}),t=jv("czm_ambient_occlusion_blur");t.uniforms.stepSize=.86;const n=new Qs({name:"czm_ambient_occlusion_generate_blur",stages:[e,t]}),i=new Ci({name:"czm_ambient_occlusion_composite",fragmentShader:$Be,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 Qs({name:"czm_ambient_occlusion",stages:[n,i],inputPreviousStageTexture:!1,uniforms:o})};qo.isAmbientOcclusionSupported=function(e){return e.context.depthTexture};const DRe=`#define FXAA_QUALITY_PRESET 39
${sAe}
${iRe}`;qo.createFXAAStage=function(){return new Ci({name:"czm_FXAA",fragmentShader:DRe,sampleMode:i_.LINEAR})};qo.createAcesTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=qBe,new Ci({name:"czm_aces",fragmentShader:t,uniforms:{autoExposure:void 0}})};qo.createFilmicTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=nRe,new Ci({name:"czm_filmic",fragmentShader:t,uniforms:{autoExposure:void 0}})};qo.createReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=aRe,new Ci({name:"czm_reinhard",fragmentShader:t,uniforms:{autoExposure:void 0}})};qo.createModifiedReinhardTonemappingStage=function(e){let t=e?`#define AUTO_EXPOSURE
`:"";return t+=rRe,new Ci({name:"czm_modified_reinhard",fragmentShader:t,uniforms:{white:U.WHITE,autoExposure:void 0}})};qo.createAutoExposureStage=function(){return new B_};qo.createBlackAndWhiteStage=function(){return new Ci({name:"czm_black_and_white",fragmentShader:XBe,uniforms:{gradations:5}})};qo.createBrightnessStage=function(){return new Ci({name:"czm_brightness",fragmentShader:JBe,uniforms:{brightness:.5}})};qo.createNightVisionStage=function(){return new Ci({name:"czm_night_vision",fragmentShader:sRe})};qo.createDepthViewStage=function(){return new Ci({name:"czm_depth_view",fragmentShader:eRe})};qo.createLensFlareStage=function(){return new Ci({name:"czm_lens_flare",fragmentShader:oRe,uniforms:{dirtTexture:dn("Assets/Textures/LensFlare/DirtMask.jpg"),starTexture:dn("Assets/Textures/LensFlare/StarBurst.jpg"),intensity:2,distortion:10,ghostDispersal:.4,haloWidth:.4,dirtAmount:.4,earthRadius:pe.WGS84.maximumRadius}})};const Bh=qo;function ff(e){this._collection=e,this._framebuffers=[],this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0,this._updateDependencies=!1}function dC(e){for(;l(e.length);)e=e.get(e.length-1);return e.name}function rB(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[dC(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 f=s[a[u]];if(typeof f=="string"){const h=e.getStageByName(f);l(h)&&(r[dC(h)]=!0)}}}return i.name}function MA(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 _=i.get(h);l(_.length)?a=MA(e,t,n,_,o):a=rB(e,t,n,_,o),s&&(o=a)}let u,f;if(s)for(u=1;u<c;++u)f=dC(i.get(u)),l(n[f])||(n[f]={}),n[f][r]=!0;else for(u=1;u<c;++u){f=dC(i.get(u));const h=n[f];for(let _=0;_<u;++_)h[dC(i.get(_))]=!0}return a}function IRe(e,t){const n={};if(l(e.ambientOcclusion)){const i=e.ambientOcclusion,o=e.bloom,r=e._tonemapping,s=e.fxaa;let a=MA(e,t,n,i,void 0);a=MA(e,t,n,o,a),a=rB(e,t,n,r,a),a=MA(e,t,n,e,a),rB(e,t,n,s,a)}else MA(e,t,n,e,void 0);return n}function PRe(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 f,h;const _=e._framebuffers,g=_.length;for(f=0;f<g;++f){if(h=_[f],r!==h.textureScale||s!==h.forcePowerOfTwo||a!==h.pixelFormat||c!==h.pixelDatatype||!U.equals(u,h.clearColor))continue;const p=h.stages,y=p.length;let C=!1;for(let T=0;T<y;++T)if(n[p[T]]){C=!0;break}if(!C)break}return l(h)&&f<g?(h.stages.push(t),h):(h={textureScale:r,forcePowerOfTwo:s,pixelFormat:a,pixelDatatype:c,clearColor:u,stages:[t],buffer:new En({pixelFormat:a,pixelDatatype:c}),clear:void 0},_.push(h),h)}function ORe(e,t){const n=IRe(e._collection,t);for(const i in n)n.hasOwnProperty(i)&&(e._stageNameToFramebuffer[i]=PRe(e,i,n[i]))}function sB(e){const t=e._framebuffers,n=t.length;for(let i=0;i<n;++i)t[i].buffer.destroy()}function LRe(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),f=Math.ceil(i*c),h=Math.min(u,f);a.forcePowerOfTwo&&(N.isPowerOfTwo(h)||(h=N.nextPowerOfTwo(h)),u=h,f=h),a.buffer.update(t,u,f),a.clear=new Ji({color:a.clearColor,framebuffer:a.buffer.framebuffer})}}ff.prototype.updateDependencies=function(){this._updateDependencies=!0};ff.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)&&(sB(this),this._framebuffers.length=0,this._stageNameToFramebuffer={},this._width=void 0,this._height=void 0),!n&&!a)return;this._framebuffers.length===0&&ORe(this,e);const c=e.drawingBufferWidth,u=e.drawingBufferHeight,f=this._width!==c||this._height!==u;!n&&!f||(this._width=c,this._height=u,this._updateDependencies=!1,sB(this),LRe(this,e))};ff.prototype.clear=function(e){const t=this._framebuffers;for(let n=0;n<t.length;++n)t[n].clear.execute(e)};ff.prototype.getStageByName=function(e){return this._collection.getStageByName(e)};ff.prototype.getOutputTexture=function(e){return this._collection.getOutputTexture(e)};ff.prototype.getFramebuffer=function(e){const t=this._stageNameToFramebuffer[e];if(l(t))return t.buffer.framebuffer};ff.prototype.isDestroyed=function(){return!1};ff.prototype.destroy=function(){return sB(this),Ue(this)};const FA={REINHARD:0,MODIFIED_REINHARD:1,FILMIC:2,ACES:3,validate:function(e){return e===FA.REINHARD||e===FA.MODIFIED_REINHARD||e===FA.FILMIC||e===FA.ACES}},zA=Object.freeze(FA),AM=[];function xa(){const e=Bh.createFXAAStage(),t=Bh.createAmbientOcclusionStage(),n=Bh.createBloomStage();this._autoExposureEnabled=!1,this._autoExposure=Bh.createAutoExposureStage(),this._tonemapping=void 0,this._tonemapper=void 0,this.tonemapper=zA.ACES;const i=this._tonemapping;e.enabled=!1,t.enabled=!1,n.enabled=!1,i.enabled=!1;const o=new ff(this),r={},s=AM;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 f=0;f<u;++f)s.push(c.get(f))}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(xa.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 CM(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(!zA.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 zA.REINHARD:n=Bh.createReinhardTonemappingStage(t);break;case zA.MODIFIED_REINHARD:n=Bh.createModifiedReinhardTonemappingStage(t);break;case zA.FILMIC:n=Bh.createFilmicTonemappingStage(t);break;default:n=Bh.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 CM(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}xa.prototype.add=function(e){b.typeOf.object("stage",e);const t=this._stageNames,n=AM;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};xa.prototype.remove=function(e){if(!this.contains(e))return!1;const t=this._stageNames,n=AM;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};xa.prototype.contains=function(e){return l(e)&&l(e._index)&&e._textureCache===this._textureCache};xa.prototype.get=function(e){CM(this);const t=this._stages,n=t.length;return b.typeOf.number.greaterThanOrEquals("stages length",n,0),b.typeOf.number.greaterThanOrEquals("index",e,0),b.typeOf.number.lessThan("index",e,n),t[e]};xa.prototype.removeAll=function(){const e=this._stages,t=e.length;for(let n=0;n<t;++n)this.remove(e[n]);e.length=0};xa.prototype.getStageByName=function(e){return this._stageNames[e]};xa.prototype.update=function(e,t,n){CM(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 f=u!==i.length;if(!f){for(a=0;a<u;++a)if(o[a]!==i[a]){f=!0;break}}const h=this._ao,_=this._bloom,g=this._autoExposure,p=this._tonemapping,y=this._fxaa;p.enabled=n;const C=h.enabled&&h._isSupported(e),T=_.enabled&&_._isSupported(e),E=p.enabled&&p._isSupported(e),w=y.enabled&&y._isSupported(e);if((f||this._textureCacheDirty||C!==this._aoEnabled||T!==this._bloomEnabled||E!==this._tonemappingEnabled||w!==this._fxaaEnabled)&&(this._textureCache.updateDependencies(),this._aoEnabled=C,this._bloomEnabled=T,this._tonemappingEnabled=E,this._fxaaEnabled=w,this._textureCacheDirty=!1),l(this._randomTexture)&&!C&&(this._randomTexture.destroy(),this._randomTexture=void 0),!l(this._randomTexture)&&C){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 zt({context:e,pixelFormat:nt.RGB,pixelDatatype:Ke.UNSIGNED_BYTE,source:{arrayBufferView:S,width:256,height:256},sampler:new Yn({wrapS:Ei.REPEAT,wrapT:Ei.REPEAT,minificationFilter:An.NEAREST,magnificationFilter:Hr.NEAREST})})}for(this._textureCache.update(e),y.update(e,t),h.update(e,t),_.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++;f=u!==o.length,f&&this.update(e,t,n)};xa.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}xa.prototype.getOutputTexture=function(e){const t=this.getStageByName(e);if(l(t))return xm(t)};function wu(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(wu(e.get(0),t,n,i,o),s=1;s<r;++s)wu(e.get(s),t,xm(e.get(s-1)),i,o);else for(s=0;s<r;++s)wu(e.get(s),t,n,i,o)}xa.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,f=this._tonemapping,h=a.enabled&&a._isSupported(e),_=c.enabled&&c._isSupported(e),g=this._autoExposureEnabled,p=f.enabled&&f._isSupported(e),y=s.enabled&&s._isSupported(e);if(!y&&!h&&!_&&!p&&r===0)return;let C=t;h&&a.ready&&(wu(a,e,C,n,i),C=xm(a)),_&&c.ready&&(wu(c,e,C,n,i),C=xm(c)),g&&u.ready&&wu(u,e,C,n,i),p&&f.ready&&(wu(f,e,C,n,i),C=xm(f));let T=C;if(r>0){wu(o[0],e,C,n,i);for(let E=1;E<r;++E)wu(o[E],e,xm(o[E-1]),n,i);T=xm(o[r-1])}y&&s.ready&&wu(s,e,T,n,i)};xa.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(n_,{uniformMap:{colorTexture:function(){return n.outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};xa.prototype.isDestroyed=function(){return!1};xa.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(),Ue(this)};const BRe={SHIFT:0,CTRL:1,ALT:2},Kc=Object.freeze(BRe),RRe={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},Bn=Object.freeze(RRe);function vp(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 TM(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function R_(e){if(e.shiftKey)return Kc.SHIFT;if(e.ctrlKey)return Kc.CTRL;if(e.altKey)return Kc.ALT}const yr={LEFT:0,MIDDLE:1,RIGHT:2};function Va(e,t,n,i){function o(r){i(e,r)}un.isInternetExplorer()?n.addEventListener(t,o,!1):n.addEventListener(t,o,{capture:!1,passive:!1}),e._removalFunctions.push(function(){n.removeEventListener(t,o,!1)})}function NRe(e){const t=e._element,n=l(t.disableRootEvents)?t:document;un.supportsPointerEvents()?(Va(e,"pointerdown",t,VRe),Va(e,"pointerup",t,XV),Va(e,"pointermove",t,kRe),Va(e,"pointercancel",t,XV)):(Va(e,"mousedown",t,TY),Va(e,"mouseup",n,bY),Va(e,"mousemove",n,EY),Va(e,"touchstart",t,URe),Va(e,"touchend",n,WV),Va(e,"touchmove",n,HRe),Va(e,"touchcancel",n,WV)),Va(e,"dblclick",t,FRe);let i;"onwheel"in t?i="wheel":document.onmousewheel!==void 0?i="mousewheel":i="DOMMouseScroll",Va(e,i,t,zRe)}function MRe(e){const t=e._removalFunctions;for(let n=0;n<t.length;++n)t[n]()}const HV={position:new j};function bM(e){e._lastSeenTouchEvent=er()}function EM(e){return er()-e._lastSeenTouchEvent>yc.mouseEmulationIgnoreMilliseconds}function aB(e,t,n){const i=e.x-t.x,o=e.y-t.y;return Math.sqrt(i*i+o*o)<n}function TY(e,t){if(!EM(e))return;const n=t.button;e._buttonDown[n]=!0;let i;if(n===yr.LEFT)i=Bn.LEFT_DOWN;else if(n===yr.MIDDLE)i=Bn.MIDDLE_DOWN;else if(n===yr.RIGHT)i=Bn.RIGHT_DOWN;else return;const o=vp(e,t,e._primaryPosition);j.clone(o,e._primaryStartPosition),j.clone(o,e._primaryPreviousPosition);const r=R_(t),s=e.getInputAction(i,r);l(s)&&(j.clone(o,HV.position),s(HV),t.preventDefault())}const VV={position:new j},kV={position:new j};function OP(e,t,n,i){const o=R_(i),r=e.getInputAction(t,o),s=e.getInputAction(n,o);if(l(r)||l(s)){const a=vp(e,i,e._primaryPosition);if(l(r)&&(j.clone(a,VV.position),r(VV)),l(s)){const c=e._primaryStartPosition;aB(c,a,e._clickPixelTolerance)&&(j.clone(a,kV.position),s(kV))}}}function bY(e,t){if(!EM(e))return;const n=t.button;n!==yr.LEFT&&n!==yr.MIDDLE&&n!==yr.RIGHT||(e._buttonDown[yr.LEFT]&&(OP(e,Bn.LEFT_UP,Bn.LEFT_CLICK,t),e._buttonDown[yr.LEFT]=!1),e._buttonDown[yr.MIDDLE]&&(OP(e,Bn.MIDDLE_UP,Bn.MIDDLE_CLICK,t),e._buttonDown[yr.MIDDLE]=!1),e._buttonDown[yr.RIGHT]&&(OP(e,Bn.RIGHT_UP,Bn.RIGHT_CLICK,t),e._buttonDown[yr.RIGHT]=!1))}const LP={startPosition:new j,endPosition:new j};function EY(e,t){if(!EM(e))return;const n=R_(t),i=vp(e,t,e._primaryPosition),o=e._primaryPreviousPosition,r=e.getInputAction(Bn.MOUSE_MOVE,n);l(r)&&(j.clone(o,LP.startPosition),j.clone(i,LP.endPosition),r(LP)),j.clone(i,o),(e._buttonDown[yr.LEFT]||e._buttonDown[yr.MIDDLE]||e._buttonDown[yr.RIGHT])&&t.preventDefault()}const GV={position:new j};function FRe(e,t){const n=t.button;let i;if(n===yr.LEFT)i=Bn.LEFT_DOUBLE_CLICK;else return;const o=R_(t),r=e.getInputAction(i,o);l(r)&&(vp(e,t,GV.position),r(GV))}function zRe(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=R_(t),o=e.getInputAction(Bn.WHEEL,i);l(o)&&(o(n),t.preventDefault())}function URe(e,t){bM(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,vp(e,r,new j));qv(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 WV(e,t){bM(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);qv(e,t);const c=e._previousPositions;for(i=0;i<o;++i)r=n[i],s=r.identifier,c.remove(s)}const jV={position:new j},BP={position1:new j,position2:new j},qV={position:new j},YV={position:new j},$V={position:new j};function qv(e,t){const n=R_(t),i=e._positions,o=i.length;let r,s;const a=e._isPinching;if(o!==1&&e._buttonDown[yr.LEFT]){if(e._buttonDown[yr.LEFT]=!1,l(e._touchHoldTimer)&&(clearTimeout(e._touchHoldTimer),e._touchHoldTimer=void 0),r=e.getInputAction(Bn.LEFT_UP,n),l(r)&&(j.clone(e._primaryPosition,qV.position),r(qV)),o===0&&!e._isTouchHolding&&(s=e.getInputAction(Bn.LEFT_CLICK,n),l(s))){const c=e._primaryStartPosition,u=e._previousPositions.values[0];aB(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(Bn.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[yr.LEFT]=!0,r=e.getInputAction(Bn.LEFT_DOWN,n),l(r)&&(j.clone(c,jV.position),r(jV)),e._touchHoldTimer=setTimeout(function(){if(!e.isDestroyed()&&(e._touchHoldTimer=void 0,e._isTouchHolding=!0,s=e.getInputAction(Bn.RIGHT_CLICK,n),l(s))){const u=e._primaryStartPosition,f=e._previousPositions.values[0];aB(u,f,e._holdPixelTolerance)&&(j.clone(e._primaryPosition,$V.position),s($V))}},yc.touchHoldDelayMilliseconds),t.preventDefault()}o===2&&!a&&(e._isPinching=!0,r=e.getInputAction(Bn.PINCH_START,n),l(r)&&(j.clone(i.values[0],BP.position1),j.clone(i.values[1],BP.position2),r(BP),t.preventDefault()))}function HRe(e,t){bM(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)&&vp(e,r,u)}xY(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 RP={startPosition:new j,endPosition:new j},Z0={distance:{startPosition:new j,endPosition:new j},angleAndHeight:{startPosition:new j,endPosition:new j}};function xY(e,t){const n=R_(t),i=e._positions,o=e._previousPositions,r=i.length;let s;if(r===1&&e._buttonDown[yr.LEFT]){const a=i.values[0];j.clone(a,e._primaryPosition);const c=e._primaryPreviousPosition;s=e.getInputAction(Bn.MOUSE_MOVE,n),l(s)&&(j.clone(c,RP.startPosition),j.clone(a,RP.endPosition),s(RP)),j.clone(a,c),t.preventDefault()}else if(r===2&&e._isPinching&&(s=e.getInputAction(Bn.PINCH_MOVE,n),l(s))){const a=i.values[0],c=i.values[1],u=o.values[0],f=o.values[1],h=c.x-a.x,_=c.y-a.y,g=Math.sqrt(h*h+_*_)*.25,p=f.x-u.x,y=f.y-u.y,C=Math.sqrt(p*p+y*y)*.25,T=(c.y+a.y)*.125,E=(f.y+u.y)*.125,w=Math.atan2(_,h),S=Math.atan2(y,p);j.fromElements(0,C,Z0.distance.startPosition),j.fromElements(0,g,Z0.distance.endPosition),j.fromElements(S,E,Z0.angleAndHeight.startPosition),j.fromElements(w,T,Z0.angleAndHeight.endPosition),s(Z0)}}function VRe(e,t){if(t.target.setPointerCapture(t.pointerId),t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.set(i,vp(e,t,new j)),qv(e,t),e._previousPositions.set(i,j.clone(n.get(i)))}else TY(e,t)}function XV(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId;n.remove(i),qv(e,t),e._previousPositions.remove(i)}else bY(e,t)}function kRe(e,t){if(t.pointerType==="touch"){const n=e._positions,i=t.pointerId,o=n.get(i);if(!l(o))return;vp(e,t,o),xY(e,t);const r=e._previousPositions;j.clone(n.get(i),r.get(i))}else EY(e,t)}function yc(e){this._inputEvents={},this._buttonDown={LEFT:!1,MIDDLE:!1,RIGHT:!1},this._isPinching=!1,this._isTouchHolding=!1,this._lastSeenTouchEvent=-yc.mouseEmulationIgnoreMilliseconds,this._primaryStartPosition=new j,this._primaryPosition=new j,this._primaryPreviousPosition=new j,this._positions=new xt,this._previousPositions=new xt,this._removalFunctions=[],this._touchHoldTimer=void 0,this._clickPixelTolerance=5,this._holdPixelTolerance=25,this._element=A(e,document),NRe(this)}yc.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=TM(t,n);this._inputEvents[i]=e};yc.prototype.getInputAction=function(e,t){if(!l(e))throw new x("type is required.");const n=TM(e,t);return this._inputEvents[n]};yc.prototype.removeInputAction=function(e,t){if(!l(e))throw new x("type is required.");const n=TM(e,t);delete this._inputEvents[n]};yc.prototype.isDestroyed=function(){return!1};yc.prototype.destroy=function(){return MRe(this),Ue(this)};yc.mouseEmulationIgnoreMilliseconds=800;yc.touchHoldDelayMilliseconds=1500;function N_(e){b.typeOf.object("scene",e),this._scene=e,this._currentTweens=[],this._morphHandler=void 0,this._morphCancelled=!1,this._completeMorph=void 0,this._morphToOrthographic=!1}N_.prototype.completeMorph=function(){l(this._completeMorph)&&this._completeMorph()};N_.prototype.morphTo2D=function(e,t){l(this._completeMorph)&&this._completeMorph();const n=this._scene;this._previousMode=n.mode,this._morphToOrthographic=n.camera.frustum instanceof Ft,!(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?TNe(this,e):DNe(this,e,t),e===0&&l(this._completeMorph)&&this._completeMorph())};const GRe=new d,WRe=new d,jRe=new d,qRe=new d,YRe=new d,$Re=new d,XRe=new d,KRe=new Ae,JRe=new B,QRe=new Un,ZRe=new Ft,eNe={position:void 0,direction:void 0,up:void 0,position2D:void 0,direction2D:void 0,up2D:void 0,frustum:void 0};N_.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=GRe;const o=WRe,r=jRe;if(e>0)i.x=0,i.y=-1,i.z=1,i=d.multiplyByScalar(d.normalize(i,i),5*t.maximumRadius,i),d.negate(d.normalize(i,o),o),d.cross(d.UNIT_X,o,r);else{const u=n.camera;if(this._previousMode===le.SCENE2D)d.clone(u.position,i),i.z=u.frustum.right-u.frustum.left,d.negate(d.UNIT_Z,o),d.clone(d.UNIT_Y,r);else{d.clone(u.positionWC,i),d.clone(u.directionWC,o),d.clone(u.upWC,r);const f=t.scaleToGeodeticSurface(i,XRe),h=tn.eastNorthUpToFixedFrame(f,t,JRe);B.inverseTransformation(h,h),n.mapProjection.project(t.cartesianToCartographic(i,KRe),i),B.multiplyByPointAsVector(h,o,o),B.multiplyByPointAsVector(h,r,r)}}let s;this._morphToOrthographic?(s=ZRe,s.width=n.camera.frustum.right-n.camera.frustum.left,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight):(s=QRe,s.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,s.fov=N.toRadians(60));const a=eNe;a.position=i,a.direction=o,a.up=r,a.frustum=s;const c=PNe(a);WT(this,c),this._previousMode===le.SCENE2D?INe(this,e,a,c):(a.position2D=B.multiplyByPoint(ot.TRANSFORM_2D,i,qRe),a.direction2D=B.multiplyByPointAsVector(ot.TRANSFORM_2D,o,YRe),a.up2D=B.multiplyByPointAsVector(ot.TRANSFORM_2D,r,$Re),n._mode=le.MORPHING,RY(this,e,a,c)),e===0&&l(this._completeMorph)&&this._completeMorph()};const xM={position:new d,direction:new d,up:new d,frustum:void 0},wY=new Un;N_.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)fNe(this,e,t);else{let i;e>0?(i=xM,d.fromDegrees(0,0,5*t.maximumRadius,t,i.position),d.negate(i.position,i.direction),d.normalize(i.direction,i.direction),d.clone(d.UNIT_Z,i.up)):i=SY(this,t);let o;const r=n.camera;r.frustum instanceof Ft?o=r.frustum.clone():(o=wY,o.aspectRatio=n.drawingBufferWidth/n.drawingBufferHeight,o.fov=N.toRadians(60)),i.frustum=o;const s=MY(i);WT(this,s),cB(this,e,i,s)}e===0&&l(this._completeMorph)&&this._completeMorph()}};N_.prototype.isDestroyed=function(){return!1};N_.prototype.destroy=function(){return Yv(this),Ue(this)};function WT(e,t){if(e._scene.completeMorphOnUserInput){e._morphHandler=new yc(e._scene.canvas);const n=function(){e._morphCancelled=!0,e._scene.camera.cancelFlight(),t(e)};e._completeMorph=n,e._morphHandler.setInputAction(n,Bn.LEFT_DOWN),e._morphHandler.setInputAction(n,Bn.MIDDLE_DOWN),e._morphHandler.setInputAction(n,Bn.RIGHT_DOWN),e._morphHandler.setInputAction(n,Bn.WHEEL)}}function Yv(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 tNe=new Ae,nNe=new d,iNe=new B;function SY(e,t){const n=e._scene,i=n.camera,o=xM,r=o.position,s=o.direction,a=o.up,c=n.mapProjection.unproject(i.position,tNe);t.cartographicToCartesian(c,r);const u=t.scaleToGeodeticSurface(r,nNe),f=tn.eastNorthUpToFixedFrame(u,t,iNe);return B.multiplyByPointAsVector(f,i.direction,s),B.multiplyByPointAsVector(f,i.up,a),o}const oNe=new d,rNe=new d,sNe=new d,aNe=new d,cNe=new d,lNe=new d;function cB(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(r.position,oNe),a=d.clone(r.direction,rNe),c=d.clone(r.up,sNe),u=B.multiplyByPoint(ot.TRANSFORM_2D_INVERSE,n.position,aNe),f=B.multiplyByPointAsVector(ot.TRANSFORM_2D_INVERSE,n.direction,cNe),h=B.multiplyByPointAsVector(ot.TRANSFORM_2D_INVERSE,n.up,lNe);function _(p){Jc(s,u,p.time,r.position),Jc(a,f,p.time,r.direction),Jc(c,h,p.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const g=o.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){NY(e,o,0,1,t,i)}});e._currentTweens.push(g)}const uNe=new Ft,vY=new d,DY=new d,IY=new d,wM=new d,PY=new d,OY=new d;function fNe(e,t,n){t/=3;const i=e._scene,o=i.camera;let r;t>0?(r=xM,d.fromDegrees(0,0,5*n.maximumRadius,n,r.position),d.negate(r.position,r.direction),d.normalize(r.direction,r.direction),d.clone(d.UNIT_Z,r.up)):(o.position.z=o.frustum.right-o.frustum.left,r=SY(e,n));let s;e._morphToOrthographic?(s=uNe,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.width=o.frustum.right-o.frustum.left):(s=wY,s.aspectRatio=i.drawingBufferWidth/i.drawingBufferHeight,s.fov=N.toRadians(60)),r.frustum=s;const a=MY(r);WT(e,a);let c;e._morphToOrthographic?c=function(){cB(e,t,r,a)}:c=function(){BY(e,t,r,function(){cB(e,t,r,a)})},t>0?(i._mode=le.SCENE2D,o.flyTo({duration:t,destination:d.fromDegrees(0,0,5*n.maximumRadius,n,wM),complete:function(){i._mode=le.MORPHING,c()}})):c()}function Jc(e,t,n,i){return d.lerp(e,t,n,i)}function LY(e,t,n,i,o){const r=e._scene,s=r.camera;if(s.frustum instanceof Ft)return;const a=s.frustum.fov,c=N.RADIANS_PER_DEGREE*.5,u=n.position.z*Math.tan(a*.5);s.frustum.far=u/Math.tan(c*.5)+1e7;function f(_){s.frustum.fov=N.lerp(a,c,_.time);const g=u/Math.tan(s.frustum.fov*.5);i(s,g)}const h=r.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){s.frustum=n.frustum.clone(),o(e)}});e._currentTweens.push(h)}const dNe=new d,hNe=new d,pNe=new d,NP=new d,mNe=new d,_Ne=new d,gNe=new Bo,yNe=new Pn,ANe=new d,CNe={position:void 0,direction:void 0,up:void 0,frustum:void 0};function TNe(e,t){t*=.5;const n=e._scene,i=n.camera,o=d.clone(i.position,dNe),r=d.clone(i.direction,hNe),s=d.clone(i.up,pNe),a=d.negate(d.UNIT_Z,mNe),c=d.clone(d.UNIT_Y,_Ne),u=NP;if(t>0)d.clone(d.ZERO,NP),u.z=5*n.mapProjection.ellipsoid.maximumRadius;else{d.clone(o,NP);const C=yNe;B.multiplyByPoint(ot.TRANSFORM_2D,o,C.origin),B.multiplyByPointAsVector(ot.TRANSFORM_2D,r,C.direction);const T=n.globe;if(l(T)){const E=T.pickWorldCoordinates(C,n,!0,ANe);l(E)&&(B.multiplyByPoint(ot.TRANSFORM_2D_INVERSE,E,u),u.z+=d.distance(o,u))}}const f=gNe;f.right=u.z*.5,f.left=-f.right,f.top=f.right*(n.drawingBufferHeight/n.drawingBufferWidth),f.bottom=-f.top;const h=CNe;h.position=u,h.direction=a,h.up=c,h.frustum=f;const _=FY(h);WT(e,_);function g(C){Jc(o,u,C.time,i.position),Jc(r,a,C.time,i.direction),Jc(s,c,C.time,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i._adjustOrthographicFrustum(!0)}function p(C,T){C.position.z=T}const y=n.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){LY(e,t,h,p,_)}});e._currentTweens.push(y)}const KV=new Ae,bNe={position:new d,direction:new d,up:new d,position2D:new d,direction2D:new d,up2D:new d,frustum:new Bo},ENe={position:new d,direction:new d,up:new d,frustum:void 0},xNe=new d,wNe=new Pn,SNe=new B,vNe=new d;function DNe(e,t,n){t*=.5;const i=e._scene,o=i.camera,r=bNe;if(t>0)d.clone(d.ZERO,r.position),r.position.z=5*n.maximumRadius,d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);else{n.cartesianToCartographic(o.positionWC,KV),i.mapProjection.project(KV,r.position),d.negate(d.UNIT_Z,r.direction),d.clone(d.UNIT_Y,r.up);const h=wNe;d.clone(r.position2D,h.origin);const _=d.clone(o.directionWC,h.direction),g=n.scaleToGeodeticSurface(o.positionWC,vNe),p=tn.eastNorthUpToFixedFrame(g,n,SNe);B.inverseTransformation(p,p),B.multiplyByPointAsVector(p,_,_),B.multiplyByPointAsVector(ot.TRANSFORM_2D,_,_);const y=i.globe;if(l(y)){const C=y.pickWorldCoordinates(h,i,!0,xNe);if(l(C)){const T=d.distance(r.position2D,C);C.x+=T,d.clone(C,r.position2D)}}}function s(h,_){h.position.x=_}B.multiplyByPoint(ot.TRANSFORM_2D,r.position,r.position2D),B.multiplyByPointAsVector(ot.TRANSFORM_2D,r.direction,r.direction2D),B.multiplyByPointAsVector(ot.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=ENe;B.multiplyByPoint(ot.TRANSFORM_2D_INVERSE,r.position2D,c.position),d.clone(r.direction,c.direction),d.clone(r.up,c.up),c.frustum=a;const u=FY(c);WT(e,u);function f(){LY(e,t,r,s,u)}RY(e,t,r,f)}function BY(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=N.RADIANS_PER_DEGREE*.5,u=s*Math.tan(a*.5);r.frustum.far=u/Math.tan(c*.5)+1e7,r.frustum.fov=c;function f(_){r.frustum.fov=N.lerp(c,a,_.time),r.position.z=u/Math.tan(r.frustum.fov*.5)}const h=o.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:f,complete:function(){i(e)}});e._currentTweens.push(h)}function INe(e,t,n,i){t*=.5;const o=e._scene,r=o.camera,s=d.clone(n.position,wM),a=d.clone(n.direction,PY),c=d.clone(n.up,OY);o._mode=le.MORPHING;function u(){r.frustum=n.frustum.clone();const f=d.clone(r.position,vY),h=d.clone(r.direction,DY),_=d.clone(r.up,IY);f.z=s.z;function g(y){Jc(f,s,y.time,r.position),Jc(h,a,y.time,r.direction),Jc(_,c,y.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right)}const p=o.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:g,complete:function(){i(e)}});e._currentTweens.push(p)}e._morphToOrthographic?u():BY(e,0,n,u)}function RY(e,t,n,i){const o=e._scene,r=o.camera,s=d.clone(r.position,vY),a=d.clone(r.direction,DY),c=d.clone(r.up,IY),u=d.clone(n.position2D,wM),f=d.clone(n.direction2D,PY),h=d.clone(n.up2D,OY);function _(p){Jc(s,u,p.time,r.position),Jc(a,f,p.time,r.direction),Jc(c,h,p.time,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.right,r.right),r._adjustOrthographicFrustum(!0)}const g=o.tweens.add({duration:t,easingFunction:lc.QUARTIC_OUT,startObject:{time:0},stopObject:{time:1},update:_,complete:function(){NY(e,o,1,0,t,i)}});e._currentTweens.push(g)}function NY(e,t,n,i,o,r){const s={object:t,property:"morphTime",startValue:n,stopValue:i,duration:o,easingFunction:lc.QUARTIC_OUT};l(r)&&(s.complete=function(){r(e)});const a=t.tweens.addProperty(s);e._currentTweens.push(a)}function MY(e){return function(t){const n=t._scene;n._mode=le.SCENE3D,n.morphTime=le.getMorphTime(le.SCENE3D),Yv(t);const i=n.camera;(t._previousMode!==le.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone());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 FY(e){return function(t){const n=t._scene;n._mode=le.SCENE2D,n.morphTime=le.getMorphTime(le.SCENE2D),Yv(t);const i=n.camera;d.clone(e.position,i.position),i.position.z=n.mapProjection.ellipsoid.maximumRadius*2,d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right),i.frustum=e.frustum.clone();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 PNe(e){return function(t){const n=t._scene;n._mode=le.COLUMBUS_VIEW,n.morphTime=le.getMorphTime(le.COLUMBUS_VIEW),Yv(t);const i=n.camera;(t._previousModeMode!==le.MORPHING||t._morphCancelled)&&(t._morphCancelled=!1,d.clone(e.position,i.position),d.clone(e.direction,i.direction),d.clone(e.up,i.up),d.cross(i.direction,i.up,i.right),d.normalize(i.right,i.right));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 ONe={LEFT_DRAG:0,RIGHT_DRAG:1,MIDDLE_DRAG:2,WHEEL:3,PINCH:4},yi=Object.freeze(ONe);function $s(e,t){let n=e;return l(t)&&(n+=`+${t}`),n}function LNe(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 JV(e,t,n){const i=$s(yi.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(f){e._buttonsDown++,r[i]=!0,a[i]=new Date,j.lerp(f.position1,f.position2,.5,s[i])},Bn.PINCH_START,t),e._eventHandler.setInputAction(function(){e._buttonsDown=Math.max(e._buttonsDown-1,0),r[i]=!1,c[i]=new Date},Bn.PINCH_END,t),e._eventHandler.setInputAction(function(f){if(r[i]){o[i]?(LNe(f,u),o[i]=!1,u.prevAngle=u.angleAndHeight.startPosition.x):(j.clone(f.distance.endPosition,u.distance.endPosition),j.clone(f.angleAndHeight.endPosition,u.angleAndHeight.endPosition));let h=u.angleAndHeight.endPosition.x;const _=u.prevAngle,g=Math.PI*2;for(;h>=_+Math.PI;)h-=g;for(;h<_-Math.PI;)h+=g;u.angleAndHeight.endPosition.x=-h*n.clientWidth/12,u.angleAndHeight.startPosition.x=-_*n.clientWidth/12}},Bn.PINCH_MOVE,t)}function QV(e,t){const n=$s(yi.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*N.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},Bn.WHEEL,t)}function ug(e,t,n){const i=$s(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,f;n===yi.LEFT_DRAG?(u=Bn.LEFT_DOWN,f=Bn.LEFT_UP):n===yi.RIGHT_DRAG?(u=Bn.RIGHT_DOWN,f=Bn.RIGHT_UP):n===yi.MIDDLE_DRAG&&(u=Bn.MIDDLE_DOWN,f=Bn.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},f,t)}function ZV(e,t){j.clone(e.startPosition,t.startPosition),j.clone(e.endPosition,t.endPosition)}function ek(e,t){const n=e._update,i=e._movement,o=e._lastMovement,r=e._isDown;for(const s in yi)if(yi.hasOwnProperty(s)){const a=yi[s];if(l(a)){const c=$s(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 yi)if(yi.hasOwnProperty(a)){const c=yi[a];if(l(c)){const u=$s(c,t);r[u]&&(n[u]?(ZV(i[u],o[u]),o[u].valid=!0,ZV(s,i[u]),n[u]=!1):j.clone(s.endPosition,i[u].endPosition))}}j.clone(s.endPosition,e._currentMousePosition)},Bn.MOUSE_MOVE,t)}function ul(e){if(!l(e))throw new x("canvas is required.");this._eventHandler=new yc(e),this._update={},this._movement={},this._lastMovement={},this._isDown={},this._eventStartPosition={},this._pressTime={},this._releaseTime={},this._buttonsDown=0,this._currentMousePosition=new j,QV(this,void 0),JV(this,void 0,e),ug(this,void 0,yi.LEFT_DRAG),ug(this,void 0,yi.RIGHT_DRAG),ug(this,void 0,yi.MIDDLE_DRAG),ek(this,void 0);for(const t in Kc)if(Kc.hasOwnProperty(t)){const n=Kc[t];l(n)&&(QV(this,n),JV(this,n,e),ug(this,n,yi.LEFT_DRAG),ug(this,n,yi.RIGHT_DRAG),ug(this,n,yi.MIDDLE_DRAG),ek(this,n))}}Object.defineProperties(ul.prototype,{currentMousePosition:{get:function(){return this._currentMousePosition}},anyButtonDown:{get:function(){const e=!this._update[$s(yi.WHEEL)]||!this._update[$s(yi.WHEEL,Kc.SHIFT)]||!this._update[$s(yi.WHEEL,Kc.CTRL)]||!this._update[$s(yi.WHEEL,Kc.ALT)];return this._buttonsDown>0||e}}});ul.prototype.isMoving=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t);return!this._update[n]};ul.prototype.getMovement=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t);return this._movement[n]};ul.prototype.getLastMovement=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t),i=this._lastMovement[n];if(i.valid)return i};ul.prototype.isButtonDown=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t);return this._isDown[n]};ul.prototype.getStartMousePosition=function(e,t){if(!l(e))throw new x("type is required.");if(e===yi.WHEEL)return this._currentMousePosition;const n=$s(e,t);return this._eventStartPosition[n]};ul.prototype.getButtonPressTime=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t);return this._pressTime[n]};ul.prototype.getButtonReleaseTime=function(e,t){if(!l(e))throw new x("type is required.");const n=$s(e,t);return this._releaseTime[n]};ul.prototype.reset=function(){for(const e in this._update)this._update.hasOwnProperty(e)&&(this._update[e]=!0)};ul.prototype.isDestroyed=function(){return!1};ul.prototype.destroy=function(){return this._eventHandler=this._eventHandler&&this._eventHandler.destroy(),Ue(this)};function AS(e,t,n,i,o,r,s,a,c,u){this._tweens=e,this._tweenjs=t,this._startObject=ut(n),this._stopObject=ut(i),this._duration=o,this._delay=r,this._easingFunction=s,this._update=a,this._complete=c,this.cancel=u,this.needsStart=!0}Object.defineProperties(AS.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}}});AS.prototype.cancelTween=function(){this._tweens.remove(this)};function fl(){this._tweens=[]}Object.defineProperties(fl.prototype,{length:{get:function(){return this._tweens.length}}});fl.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 AS(this);const t=e.duration/Ti.SECONDS_PER_MILLISECOND,n=A(e.delay,0),i=n/Ti.SECONDS_PER_MILLISECOND,o=A(e.easingFunction,lc.LINEAR_NONE),r=e.startObject,s=new jDe(r);s.to(ut(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 AS(this,s,e.startObject,e.stopObject,e.duration,n,o,e.update,e.complete,e.cancel);return this._tweens.push(a),a};fl.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})};fl.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})};fl.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})};fl.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};fl.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};fl.prototype.contains=function(e){return l(e)&&this._tweens.indexOf(e)!==-1};fl.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._tweens[e]};fl.prototype.update=function(e){const t=this._tweens;let n=0;for(e=l(e)?e/Ti.SECONDS_PER_MILLISECOND:er();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 jT(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=yi.LEFT_DRAG,this.zoomEventTypes=[yi.RIGHT_DRAG,yi.WHEEL,yi.PINCH],this.rotateEventTypes=yi.LEFT_DRAG,this.tiltEventTypes=[yi.MIDDLE_DRAG,yi.PINCH,{eventType:yi.LEFT_DRAG,modifier:Kc.CTRL},{eventType:yi.RIGHT_DRAG,modifier:Kc.CTRL}],this.lookEventTypes={eventType:yi.LEFT_DRAG,modifier:Kc.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 ul(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 fl,this._tween=void 0,this._horizontalRotationAxis=void 0,this._tiltCenterMousePosition=new j(-1,-1),this._tiltCenter=new d,this._rotateMousePosition=new j(-1,-1),this._rotateStartPosition=new d,this._strafeStartPosition=new d,this._strafeMousePosition=new j,this._strafeEndMousePosition=new j,this._zoomMouseStart=new j(-1,-1),this._zoomWorldPosition=new d,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 Ae(Math.PI,N.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 BNe(e,t){if(e<0)return 0;const n=(1-t)*25;return Math.exp(-n*e)}function RNe(e){return j.equalsEpsilon(e.startPosition,e.endPosition,N.EPSILON14)}const NNe=.4;function MNe(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),f=c&&u&&(u.getTime()-c.getTime())/1e3,h=new Date,_=u&&(h.getTime()-u.getTime())/1e3;if(c&&u&&f<NNe){const g=BNe(_,i),p=e.getLastMovement(t,n);if(!l(p)||RNe(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 FNe(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 tk=[];function ha(e,t,n,i,o,r){if(!l(n))return;const s=e._aggregator;Array.isArray(n)||(tk[0]=n,n=tk);const a=n.length;for(let c=0;c<a;++c){const u=n[c],f=l(u.eventType)?u.eventType:u,h=u.modifier,_=s.isMoving(f,h)&&s.getMovement(f,h),g=s.getStartMousePosition(f,h);e.enableInputs&&t&&(_?(i(e,g,_),FNe(e,r)):o<1&&MNe(s,f,h,o,i,e,r))}}const qE=new Pn,zNe=new d,UNe=new j,HNe=new d,VNe=new j,kNe=new d,GNe=new d,WNe=new d,jNe=new d,qNe=new d,YNe=new d,$Ne=new d,XNe=new d,KNe=new d,JNe=new d,QNe=new d,ZNe=new d,eMe=new d,tMe=new d,nMe=new d,Kp=new d,nk=new d,ik=new d,MP={orientation:new Ur};function SM(e,t,n,i,o,r){let s=1;l(r)&&(s=N.clamp(Math.abs(r),.25,1));const a=n.endPosition.y-n.startPosition.y,u=a>0?e.minimumZoomDistance*s:0,f=e.maximumZoomDistance,h=o-u;let _=i*h;_=N.clamp(_,e._minimumZoomRate,e._maximumZoomRate);let g=a/e._scene.canvas.clientHeight;g=Math.min(g,e.maximumMovementRatio);let p=_*g;if(e.enableCollisionDetection||e.minimumZoomDistance===0||!l(e._globe)){if(p>0&&Math.abs(o-u)<1||p<0&&Math.abs(o-f)<1)return;o-p<u?p=o-u-1:o-p>f&&(p=o-f)}const y=e._scene,C=y.camera,T=y.mode,E=MP.orientation;if(E.heading=C.heading,E.pitch=C.pitch,E.roll=C.roll,C.frustum instanceof Ft){Math.abs(p)>0&&(C.zoomIn(p),C._adjustOrthographicFrustum());return}const w=j.equals(t,e._zoomMouseStart);let S=e._zoomingOnVector,P=e._rotatingZoom,O;if(w||(e._zoomMouseStart=j.clone(t,e._zoomMouseStart),l(e._globe)&&(T===le.SCENE2D?(O=C.getPickRay(t,qE).origin,O=d.fromElements(O.y,O.z,O.x)):O=cp(e,t,zNe)),l(O)?(e._useZoomWorldPosition=!0,e._zoomWorldPosition=d.clone(O,e._zoomWorldPosition)):e._useZoomWorldPosition=!1,S=e._zoomingOnVector=!1,P=e._rotatingZoom=!1,e._zoomingUnderground=e._cameraUnderground),!e._useZoomWorldPosition){C.zoomIn(p);return}let z=T===le.COLUMBUS_VIEW;if(C.positionCartographic.height<2e6&&(P=!0),!w||P){if(T===le.SCENE2D){const R=e._zoomWorldPosition,F=C.position;if(!d.equals(R,F)&&C.positionCartographic.height<e._maxCoord.x*2){const H=C.position.x,v=d.subtract(R,F,HNe);d.normalize(v,v);const I=d.distance(R,F)*p/(C.getMagnitude()*.5);C.move(v,I*.5),(C.position.x<0&&H>0||C.position.x>0&&H<0)&&(O=C.getPickRay(t,qE).origin,O=d.fromElements(O.y,O.z,O.x),e._zoomWorldPosition=d.clone(O,e._zoomWorldPosition))}}else if(T===le.SCENE3D){const R=d.normalize(C.position,qNe);if(e._cameraUnderground||e._zoomingUnderground||C.positionCartographic.height<3e3&&Math.abs(d.dot(C.direction,R))<.6)z=!0;else{const F=y.canvas,H=VNe;H.x=F.clientWidth/2,H.y=F.clientHeight/2;const v=cp(e,H,kNe);if(!l(v))z=!0;else if(C.positionCartographic.height<1e6)if(d.dot(C.direction,R)>=-.5)z=!0;else{const I=$Ne;d.clone(C.position,I);const m=e._zoomWorldPosition;let D=YNe;if(D=d.normalize(m,D),d.dot(D,R)<0)return;const L=nMe,M=JNe;d.clone(C.direction,M),d.add(I,d.multiplyByScalar(M,1e3,Kp),L);const V=QNe,k=ZNe;d.subtract(m,I,V),d.normalize(V,k);const W=d.dot(R,k);if(W>=0){e._zoomMouseStart.x=-1;return}const G=Math.acos(-W),K=d.magnitude(I),q=d.magnitude(m),te=K-p,$=d.magnitude(V),X=Math.asin(N.clamp($/q*Math.sin(G),-1,1)),Y=Math.asin(N.clamp(te/q*Math.sin(G),-1,1)),ae=X-Y+G,ue=XNe;d.normalize(I,ue);let re=KNe;re=d.cross(k,ue,re),re=d.normalize(re,re),d.normalize(d.cross(ue,re,Kp),M),d.multiplyByScalar(d.normalize(L,Kp),d.magnitude(L)-p,L),d.normalize(I,I),d.multiplyByScalar(I,te,I);const he=eMe;d.multiplyByScalar(d.add(d.multiplyByScalar(ue,Math.cos(ae)-1,nk),d.multiplyByScalar(M,Math.sin(ae),ik),Kp),te,he),d.add(I,he,I),d.normalize(L,ue),d.normalize(d.cross(ue,re,Kp),M);const ce=tMe;d.multiplyByScalar(d.add(d.multiplyByScalar(ue,Math.cos(ae)-1,nk),d.multiplyByScalar(M,Math.sin(ae),ik),Kp),d.magnitude(L),ce),d.add(L,ce,L),d.clone(I,C.position),d.normalize(d.subtract(L,I,Kp),C.direction),d.clone(C.direction,C.direction),d.cross(C.direction,C.up,C.right),d.cross(C.right,C.direction,C.up),C.setView(MP);return}else{const I=d.normalize(v,GNe),m=d.normalize(e._zoomWorldPosition,WNe),D=d.dot(m,I);if(D>0&&D<1){const L=N.acosClamped(D),M=d.cross(m,I,jNe),V=Math.abs(L)>N.toRadians(20)?C.positionCartographic.height*.75:C.positionCartographic.height-p,k=p/V;C.rotate(M,L*k)}}}}e._rotatingZoom=!z}if(!w&&z||S){let R;const F=lr.wgs84ToWindowCoordinates(y,e._zoomWorldPosition,UNe);T!==le.COLUMBUS_VIEW&&j.equals(t,e._zoomMouseStart)&&l(F)?R=C.getPickRay(F,qE):R=C.getPickRay(t,qE);const H=R.direction;(T===le.COLUMBUS_VIEW||T===le.SCENE2D)&&d.fromElements(H.y,H.z,H.x,H),C.move(H,p),e._zoomingOnVector=!0}else C.zoomIn(p);e._cameraUnderground||C.setView(MP)}const iMe=new Pn,oMe=new Pn,rMe=new d;function sMe(e,t,n){const o=e._scene.camera;let r=o.getPickRay(n.startPosition,iMe).origin,s=o.getPickRay(n.endPosition,oMe).origin;r=d.fromElements(r.y,r.z,r.x,r),s=d.fromElements(s.y,s.z,s.x,s);const a=d.subtract(r,s,rMe),c=d.magnitude(a);c>0&&(d.normalize(a,a),o.move(a,c))}function ok(e,t,n){l(n.distance)&&(n=n.distance);const o=e._scene.camera;SM(e,t,n,e._zoomFactor,o.getMagnitude())}const aMe=new j,cMe=new j;function rk(e,t,n){if(l(n.angleAndHeight)){lMe(e,t,n.angleAndHeight);return}const i=e._scene,o=i.camera,r=i.canvas,s=r.clientWidth,a=r.clientHeight;let c=aMe;c.x=2/s*n.startPosition.x-1,c.y=2/a*(a-n.startPosition.y)-1,c=j.normalize(c,c);let u=cMe;u.x=2/s*n.endPosition.x-1,u.y=2/a*(a-n.endPosition.y)-1,u=j.normalize(u,u);let f=N.acosClamped(c.x);c.y<0&&(f=N.TWO_PI-f);let h=N.acosClamped(u.x);u.y<0&&(h=N.TWO_PI-h);const _=h-f;o.twistRight(_)}function lMe(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 uMe(e){const t=e._scene.mapMode2D===sp.ROTATE;B.equals(B.IDENTITY,e._scene.camera.transform)?(ha(e,e.enableTranslate,e.translateEventTypes,sMe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),ha(e,e.enableZoom,e.zoomEventTypes,ok,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&ha(e,e.enableRotate,e.tiltEventTypes,rk,e.inertiaSpin,"_lastInertiaTiltMovement")):(ha(e,e.enableZoom,e.zoomEventTypes,ok,e.inertiaZoom,"_lastInertiaZoomMovement"),t&&ha(e,e.enableRotate,e.translateEventTypes,rk,e.inertiaSpin,"_lastInertiaSpinMovement"))}const zY=new Pn,fMe=new d,dMe=new d;function cp(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,fMe));const c=r.getPickRay(t,zY),u=o.pickWorldCoordinates(c,i,s,dMe),f=l(a)?d.distance(a,r.positionWC):Number.POSITIVE_INFINITY,h=l(u)?d.distance(u,r.positionWC):Number.POSITIVE_INFINITY;return f<h?d.clone(a,n):d.clone(u,n)}const hMe=new Ae;function CS(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,hMe);l(c)&&(r=c.height)}else r=i.position.z;const s=A(e._scene.globeHeight,0);return Math.abs(s-r)}const pMe=new d;function UY(e,t){const n=t.origin,i=t.direction,o=CS(e),r=d.normalize(n,pMe);let s=Math.abs(d.dot(r,i));return s=Math.max(s,.5)*2,o*s}function HY(e,t,n,i){let o=d.distance(t.origin,n);const r=CS(e),s=N.clamp(r*5,e._minimumUndergroundPickDistance,e._maximumUndergroundPickDistance);return o>s&&(o=Math.min(o,r/5),o=Math.max(o,100)),Pn.getPoint(t,o,i)}function VY(e,t,n,i){let o;return l(n)?(o=d.distance(t.origin,n),o>e._maximumUndergroundPickDistance&&(o=CS(e))):o=CS(e),Pn.getPoint(t,o,i)}const mMe=new j;function kY(e,t){const n=t.endPosition,i=j.subtract(t.endPosition,t.startPosition,mMe),o=e._strafeEndMousePosition;j.add(o,i,o),t.endPosition=o,vM(e,t,e._strafeStartPosition),t.endPosition=n}const sk=new Pn,_Me=new Pn,FP=new d,gMe=new d,yMe=new d,AMe=new d,CMe=new St(d.UNIT_X,0),TMe=new j,bMe=new j;function EMe(e,t,n){if(d.equals(t,e._translateMousePosition)||(e._looking=!1),d.equals(t,e._strafeMousePosition)||(e._strafing=!1),e._looking){tc(e,t,n);return}if(e._strafing){kY(e,n);return}const o=e._scene.camera,r=e._cameraUnderground,s=j.clone(n.startPosition,TMe),a=j.clone(n.endPosition,bMe);let c=o.getPickRay(s,sk);const u=d.clone(d.ZERO,AMe),f=d.UNIT_X;let h;if(o.position.z<e._minimumPickingTerrainHeight&&(h=cp(e,s,FP),l(h)&&(u.x=h.x)),r||u.x>o.position.z&&l(h)){let w=h;r&&(w=VY(e,c,h,FP)),j.clone(t,e._strafeMousePosition),j.clone(t,e._strafeEndMousePosition),d.clone(w,e._strafeStartPosition),e._strafing=!0,vM(e,n,e._strafeStartPosition);return}const _=St.fromPointNormal(u,f,CMe);c=o.getPickRay(s,sk);const g=nr.rayPlane(c,_,FP),p=o.getPickRay(a,_Me),y=nr.rayPlane(p,_,gMe);if(!l(g)||!l(y)){e._looking=!0,tc(e,t,n),j.clone(t,e._translateMousePosition);return}const C=d.subtract(g,y,yMe),T=C.x;C.x=C.y,C.y=C.z,C.z=T;const E=d.magnitude(C);E>N.EPSILON6&&(d.normalize(C,C),o.move(C,E))}const GY=new j,mw=new Pn,_w=new d,xMe=new d,WY=new B,wMe=new B,SMe=new d,vMe=new St(d.UNIT_X,0),zP=new d,lB=new Ae,jY=new B,DMe=new Ce,IMe=new J,gw=new d;function PMe(e,t,n){if(l(n.angleAndHeight)&&(n=n.angleAndHeight),j.equals(t,e._tiltCenterMousePosition)||(e._tiltCVOffMap=!1,e._looking=!1),e._looking){tc(e,t,n);return}const o=e._scene.camera;e._tiltCVOffMap||!e.onMap()||Math.abs(o.position.z)>e._minimumPickingTerrainHeight?(e._tiltCVOffMap=!0,OMe(e,t,n)):LMe(e,t,n)}function OMe(e,t,n){const i=e._scene,o=i.camera,r=i.canvas,s=GY;s.x=r.clientWidth/2,s.y=r.clientHeight/2;const a=o.getPickRay(s,mw),c=d.UNIT_X,u=a.origin,f=a.direction;let h;const _=d.dot(c,f);if(Math.abs(_)>N.EPSILON6&&(h=-d.dot(c,u)/_),!l(h)||h<=0){e._looking=!0,tc(e,t,n),j.clone(t,e._tiltCenterMousePosition);return}const g=d.multiplyByScalar(f,h,_w);d.add(u,g,g);const p=i.mapProjection,y=p.ellipsoid;d.fromElements(g.y,g.z,g.x,g);const C=p.unproject(g,lB);y.cartographicToCartesian(C,g);const T=tn.eastNorthUpToFixedFrame(g,y,WY),E=e._globe,w=e._ellipsoid;e._globe=void 0,e._ellipsoid=pe.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const S=B.clone(o.transform,jY);o._setTransform(T),ec(e,t,n,d.UNIT_Z),o._setTransform(S),e._globe=E,e._ellipsoid=w;const P=w.maximumRadius;e._rotateFactor=1/P,e._rotateRateRangeAdjustment=P}function LMe(e,t,n){const i=e._scene,o=i.camera,r=e._cameraUnderground;let s,a;const c=d.UNIT_X;if(j.equals(t,e._tiltCenterMousePosition))s=d.clone(e._tiltCenter,_w);else{if(o.position.z<e._minimumPickingTerrainHeight&&(s=cp(e,t,_w)),!l(s)){a=o.getPickRay(t,mw);const v=a.origin,I=a.direction;let m;const D=d.dot(c,I);if(Math.abs(D)>N.EPSILON6&&(m=-d.dot(c,v)/D),!l(m)||m<=0){e._looking=!0,tc(e,t,n),j.clone(t,e._tiltCenterMousePosition);return}s=d.multiplyByScalar(I,m,_w),d.add(v,s,s)}r&&(l(a)||(a=o.getPickRay(t,mw)),HY(e,a,s,s)),j.clone(t,e._tiltCenterMousePosition),d.clone(s,e._tiltCenter)}const u=i.canvas,f=GY;f.x=u.clientWidth/2,f.y=e._tiltCenterMousePosition.y,a=o.getPickRay(f,mw);const h=d.clone(d.ZERO,SMe);h.x=s.x;const _=St.fromPointNormal(h,c,vMe),g=nr.rayPlane(a,_,xMe),p=o._projection,y=p.ellipsoid;d.fromElements(s.y,s.z,s.x,s);let C=p.unproject(s,lB);y.cartographicToCartesian(C,s);const T=tn.eastNorthUpToFixedFrame(s,y,WY);let E;l(g)?(d.fromElements(g.y,g.z,g.x,g),C=p.unproject(g,lB),y.cartographicToCartesian(C,g),E=tn.eastNorthUpToFixedFrame(g,y,wMe)):E=T;const w=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=pe.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const O=B.clone(o.transform,jY);o._setTransform(T);const z=d.cross(d.UNIT_Z,d.normalize(o.position,zP),zP),R=d.dot(o.right,z);if(ec(e,t,n,P,!1,!0),o._setTransform(E),R<0){const v=n.startPosition.y-n.endPosition.y;(r&&v<0||!r&&v>0)&&(P=void 0);const I=o.constrainedAxis;o.constrainedAxis=void 0,ec(e,t,n,P,!0,!1),o.constrainedAxis=I}else ec(e,t,n,P,!0,!1);if(l(o.constrainedAxis)){const v=d.cross(o.direction,o.constrainedAxis,gw);d.equalsEpsilon(v,d.ZERO,N.EPSILON6)||(d.dot(v,o.right)<0&&d.negate(v,v),d.cross(v,o.direction,o.up),d.cross(o.direction,o.up,o.right),d.normalize(o.up,o.up),d.normalize(o.right,o.right))}o._setTransform(O),e._globe=w,e._ellipsoid=S;const F=S.maximumRadius;e._rotateFactor=1/F,e._rotateRateRangeAdjustment=F;const H=d.clone(o.positionWC,zP);if(e.enableCollisionDetection&&PM(e),!d.equals(o.positionWC,H)){o._setTransform(E),o.worldToCameraCoordinatesPoint(H,H);const v=d.magnitudeSquared(H);d.magnitudeSquared(o.position)>v&&(d.normalize(o.position,o.position),d.multiplyByScalar(o.position,Math.sqrt(v),o.position));const I=d.angleBetween(H,o.position),m=d.cross(H,o.position,H);d.normalize(m,m);const D=Ce.fromAxisAngle(m,I,DMe),L=J.fromQuaternion(D,IMe);J.multiplyByVector(L,o.direction,o.direction),J.multiplyByVector(L,o.up,o.up),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up),o._setTransform(O)}}const qY=new j,YY=new Pn,$Y=new d;function BMe(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=qY,a.x=r.clientWidth/2,a.y=r.clientHeight/2);const c=o.getPickRay(a,YY),u=c.origin,f=c.direction,h=o.position.z;let _;h<e._minimumPickingTerrainHeight&&(_=cp(e,a,$Y));let g;if(l(_)&&(g=d.distance(u,_)),s){const p=UY(e,c);l(g)?g=Math.min(g,p):g=p}if(!l(g)){const p=d.UNIT_X;g=-d.dot(p,u)/d.dot(p,f)}SM(e,t,n,e._zoomFactor,g)}function RMe(e){const n=e._scene.camera;if(!B.equals(B.IDENTITY,n.transform))ha(e,e.enableRotate,e.rotateEventTypes,ec,e.inertiaSpin,"_lastInertiaSpinMovement"),ha(e,e.enableZoom,e.zoomEventTypes,XY,e.inertiaZoom,"_lastInertiaZoomMovement");else{const i=e._tweens;if(e._aggregator.anyButtonDown&&i.removeAll(),ha(e,e.enableTilt,e.tiltEventTypes,PMe,e.inertiaSpin,"_lastInertiaTiltMovement"),ha(e,e.enableTranslate,e.translateEventTypes,EMe,e.inertiaTranslate,"_lastInertiaTranslateMovement"),ha(e,e.enableZoom,e.zoomEventTypes,BMe,e.inertiaZoom,"_lastInertiaZoomMovement"),ha(e,e.enableLook,e.lookEventTypes,tc),!e._aggregator.anyButtonDown&&!i.contains(e._tween)){const o=n.createCorrectPositionTween(e.bounceAnimationTime);l(o)&&(e._tween=i.add(o))}i.update()}}const NMe=new Pn,MMe=new St(d.UNIT_X,0),FMe=new d,zMe=new d,UMe=new d;function vM(e,t,n){const i=e._scene,o=i.camera,r=o.getPickRay(t.endPosition,NMe);let s=d.clone(o.direction,zMe);i.mode===le.COLUMBUS_VIEW&&d.fromElements(s.z,s.x,s.y,s);const a=St.fromPointNormal(n,s,MMe),c=nr.rayPlane(r,a,FMe);l(c)&&(s=d.subtract(n,c,s),i.mode===le.COLUMBUS_VIEW&&d.fromElements(s.y,s.z,s.x,s),d.add(o.position,s,o.position))}const ak=new d,HMe=new Ae,uB=new d,fB=new pe,VMe=new d,kMe=new d;function GMe(e,t,n){const o=e._scene.camera,r=e._cameraUnderground;let s=e._ellipsoid;if(!B.equals(o.transform,B.IDENTITY)){ec(e,t,n);return}let a,c;const u=s.geodeticSurfaceNormal(o.position,VMe);if(j.equals(t,e._rotateMousePosition)){if(e._looking)tc(e,t,n,u);else if(e._rotating)ec(e,t,n);else if(e._strafing)kY(e,n);else{if(d.magnitude(o.position)<d.magnitude(e._rotateStartPosition))return;a=d.magnitude(e._rotateStartPosition),c=uB,c.x=c.y=c.z=a,s=pe.fromCartesian3(c,fB),HP(e,t,n,s)}return}e._looking=!1,e._rotating=!1,e._strafing=!1;const f=s.cartesianToCartographic(o.positionWC,HMe).height,h=e._globe;if(l(h)&&f<e._minimumPickingTerrainHeight){const _=cp(e,n.startPosition,UMe);if(l(_)){let g=!1;const p=o.getPickRay(n.startPosition,zY);if(r)g=!0,VY(e,p,_,_);else{const y=s.geodeticSurfaceNormal(_,kMe);Math.abs(d.dot(p.direction,y))<.05?g=!0:g=d.magnitude(o.position)<d.magnitude(_)}g?(j.clone(t,e._strafeEndMousePosition),d.clone(_,e._strafeStartPosition),e._strafing=!0,vM(e,n,e._strafeStartPosition)):(a=d.magnitude(_),c=uB,c.x=c.y=c.z=a,s=pe.fromCartesian3(c,fB),HP(e,t,n,s),d.clone(_,e._rotateStartPosition))}else e._looking=!0,tc(e,t,n,u)}else l(o.pickEllipsoid(n.startPosition,e._ellipsoid,ak))?(HP(e,t,n,e._ellipsoid),d.clone(ak,e._rotateStartPosition)):f>e._minimumTrackBallHeight?(e._rotating=!0,ec(e,t,n)):(e._looking=!0,tc(e,t,n,u));j.clone(t,e._rotateMousePosition)}function ec(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 f=d.magnitude(a.position);let h=e._rotateFactor*(f-e._rotateRateRangeAdjustment);h>e._maximumRotateRate&&(h=e._maximumRotateRate),h<e._minimumRotateRate&&(h=e._minimumRotateRate);let _=(n.startPosition.x-n.endPosition.x)/c.clientWidth,g=(n.startPosition.y-n.endPosition.y)/c.clientHeight;_=Math.min(_,e.maximumMovementRatio),g=Math.min(g,e.maximumMovementRatio);const p=h*_*Math.PI*2,y=h*g*Math.PI;o||a.rotateRight(p),r||a.rotateUp(y),a.constrainedAxis=u}const WMe=oe.clone(oe.UNIT_W),jMe=oe.clone(oe.UNIT_W),YE=new d,UP=new d,qMe=new d,YMe=new d,$Me=new j,XMe=new j;function HP(e,t,n,i){const r=e._scene.camera,s=j.clone(n.startPosition,$Me),a=j.clone(n.endPosition,XMe);let c=r.pickEllipsoid(s,i,WMe),u=r.pickEllipsoid(a,i,jMe);if(!l(c)||!l(u)){e._rotating=!0,ec(e,t,n);return}if(c=r.worldToCameraCoordinates(c,c),u=r.worldToCameraCoordinates(u,u),l(r.constrainedAxis)){const f=r.constrainedAxis,h=d.mostOrthogonalAxis(f,YE);d.cross(h,f,h),d.normalize(h,h);const _=d.cross(f,h,UP),g=d.magnitude(c),p=d.dot(f,c),y=Math.acos(p/g),C=d.multiplyByScalar(f,p,qMe);d.subtract(c,C,C),d.normalize(C,C);const T=d.magnitude(u),E=d.dot(f,u),w=Math.acos(E/T),S=d.multiplyByScalar(f,E,YMe);d.subtract(u,S,S),d.normalize(S,S);let P=Math.acos(d.dot(C,h));d.dot(C,_)<0&&(P=N.TWO_PI-P);let O=Math.acos(d.dot(S,h));d.dot(S,_)<0&&(O=N.TWO_PI-O);const z=P-O;let R;d.equalsEpsilon(f,r.position,N.EPSILON2)?R=r.right:R=d.cross(f,r.position,YE);const F=d.cross(f,R,YE),H=d.dot(F,d.subtract(c,f,UP)),v=d.dot(F,d.subtract(u,f,UP));let I;H>0&&v>0?I=w-y:H>0&&v<=0?d.dot(r.position,f)>0?I=-y-w:I=y+w:I=y-w,r.rotateRight(z),r.rotateUp(I)}else{d.normalize(c,c),d.normalize(u,u);const f=d.dot(c,u),h=d.cross(c,u,YE);if(f<1&&!d.equalsEpsilon(h,d.ZERO,N.EPSILON14)){const _=Math.acos(f);r.rotate(h,_)}}}const KMe=new d,JMe=new Ae;function XY(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=qY,c.x=s.clientWidth/2,c.y=s.clientHeight/2);const u=r.getPickRay(c,YY);let f;const h=i.cartesianToCartographic(r.position,JMe).height;h<e._minimumPickingTerrainHeight&&(f=cp(e,c,$Y));let _;if(l(f)&&(_=d.distance(u.origin,f)),a){const p=UY(e,u);l(_)?_=Math.min(_,p):_=p}l(_)||(_=h);const g=d.normalize(r.position,KMe);SM(e,t,n,e._zoomFactor,_,d.dot(g,r.direction))}const KY=new j,yw=new Pn,hC=new d,QMe=new d,JY=new B,ZMe=new B,QY=new B,eFe=new Ce,tFe=new J,DM=new Ae,IM=new d;function nFe(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,IM);tc(e,t,n,a);return}const s=e._ellipsoid.cartesianToCartographic(o.position,DM);e._tiltOnEllipsoid||s.height>e._minimumCollisionTerrainHeight?(e._tiltOnEllipsoid=!0,oFe(e,t,n)):rFe(e,t,n)}const iFe=new Ae;function oFe(e,t,n){const i=e._ellipsoid,o=e._scene,r=o.camera,s=e.minimumZoomDistance*.25,a=i.cartesianToCartographic(r.positionWC,iFe).height;if(a-s-1<N.EPSILON3&&n.endPosition.y-n.startPosition.y<0)return;const c=o.canvas,u=KY;u.x=c.clientWidth/2,u.y=c.clientHeight/2;const f=r.getPickRay(u,yw);let h;const _=nr.rayEllipsoid(f,i);if(l(_))h=Pn.getPoint(f,_.start,hC);else if(a>e._minimumTrackBallHeight){const E=nr.grazingAltitudeLocation(f,i);if(!l(E))return;const w=i.cartesianToCartographic(E,DM);w.height=0,h=i.cartographicToCartesian(w,hC)}else{e._looking=!0;const E=e._ellipsoid.geodeticSurfaceNormal(r.position,IM);tc(e,t,n,E),j.clone(t,e._tiltCenterMousePosition);return}const g=tn.eastNorthUpToFixedFrame(h,i,JY),p=e._globe,y=e._ellipsoid;e._globe=void 0,e._ellipsoid=pe.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;const C=B.clone(r.transform,QY);r._setTransform(g),ec(e,t,n,d.UNIT_Z),r._setTransform(C),e._globe=p,e._ellipsoid=y;const T=y.maximumRadius;e._rotateFactor=1/T,e._rotateRateRangeAdjustment=T}function rFe(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=d.clone(e._tiltCenter,hC);else{if(a=cp(e,t,hC),!l(a)){if(c=r.getPickRay(t,yw),u=nr.rayEllipsoid(c,i),!l(u)){if(i.cartesianToCartographic(r.position,DM).height<=e._minimumTrackBallHeight){e._looking=!0;const I=e._ellipsoid.geodeticSurfaceNormal(r.position,IM);tc(e,t,n,I),j.clone(t,e._tiltCenterMousePosition)}return}a=Pn.getPoint(c,u.start,hC)}s&&(l(c)||(c=r.getPickRay(t,yw)),HY(e,c,a,a)),j.clone(t,e._tiltCenterMousePosition),d.clone(a,e._tiltCenter)}const f=o.canvas,h=KY;h.x=f.clientWidth/2,h.y=e._tiltCenterMousePosition.y,c=r.getPickRay(h,yw);const _=d.magnitude(a),g=d.fromElements(_,_,_,uB),p=pe.fromCartesian3(g,fB);if(u=nr.rayEllipsoid(c,p),!l(u))return;const y=d.magnitude(c.origin)>_?u.start:u.stop,C=Pn.getPoint(c,y,QMe),T=tn.eastNorthUpToFixedFrame(a,i,JY),E=tn.eastNorthUpToFixedFrame(C,p,ZMe),w=e._globe,S=e._ellipsoid;e._globe=void 0,e._ellipsoid=pe.UNIT_SPHERE,e._rotateFactor=1,e._rotateRateRangeAdjustment=1;let P=d.UNIT_Z;const O=B.clone(r.transform,QY);r._setTransform(E);const z=d.cross(C,r.positionWC,gw);if(d.dot(r.rightWC,z)<0){const v=n.startPosition.y-n.endPosition.y;(s&&v<0||!s&&v>0)&&(P=void 0);const I=r.constrainedAxis;r.constrainedAxis=void 0,ec(e,t,n,P,!0,!1),r.constrainedAxis=I}else ec(e,t,n,P,!0,!1);if(r._setTransform(T),ec(e,t,n,P,!1,!0),l(r.constrainedAxis)){const v=d.cross(r.direction,r.constrainedAxis,gw);d.equalsEpsilon(v,d.ZERO,N.EPSILON6)||(d.dot(v,r.right)<0&&d.negate(v,v),d.cross(v,r.direction,r.up),d.cross(r.direction,r.up,r.right),d.normalize(r.up,r.up),d.normalize(r.right,r.right))}r._setTransform(O),e._globe=w,e._ellipsoid=S;const F=S.maximumRadius;e._rotateFactor=1/F,e._rotateRateRangeAdjustment=F;const H=d.clone(r.positionWC,gw);if(e.enableCollisionDetection&&PM(e),!d.equals(r.positionWC,H)){r._setTransform(E),r.worldToCameraCoordinatesPoint(H,H);const v=d.magnitudeSquared(H);d.magnitudeSquared(r.position)>v&&(d.normalize(r.position,r.position),d.multiplyByScalar(r.position,Math.sqrt(v),r.position));const I=d.angleBetween(H,r.position),m=d.cross(H,r.position,H);d.normalize(m,m);const D=Ce.fromAxisAngle(m,I,eFe),L=J.fromQuaternion(D,tFe);J.multiplyByVector(L,r.direction,r.direction),J.multiplyByVector(L,r.up,r.up),d.cross(r.direction,r.up,r.right),d.cross(r.right,r.direction,r.up),r._setTransform(O)}}const sFe=new j,aFe=new j,ck=new Pn,lk=new Pn,cFe=new d,lFe=new d;function tc(e,t,n,i){const r=e._scene.camera,s=sFe;s.x=n.startPosition.x,s.y=0;const a=aFe;a.x=n.endPosition.x,a.y=0;let c=r.getPickRay(s,ck),u=r.getPickRay(a,lk),f=0,h,_;r.frustum instanceof Ft?(h=c.origin,_=u.origin,d.add(r.direction,h,h),d.add(r.direction,_,_),d.subtract(h,r.position,h),d.subtract(_,r.position,_),d.normalize(h,h),d.normalize(_,_)):(h=c.direction,_=u.direction);let g=d.dot(h,_);g<1&&(f=Math.acos(g)),f=n.startPosition.x>n.endPosition.x?-f:f;const p=e._horizontalRotationAxis;if(l(i)?r.look(i,-f):l(p)?r.look(p,-f):r.lookLeft(f),s.x=0,s.y=n.startPosition.y,a.x=0,a.y=n.endPosition.y,c=r.getPickRay(s,ck),u=r.getPickRay(a,lk),f=0,r.frustum instanceof Ft?(h=c.origin,_=u.origin,d.add(r.direction,h,h),d.add(r.direction,_,_),d.subtract(h,r.position,h),d.subtract(_,r.position,_),d.normalize(h,h),d.normalize(_,_)):(h=c.direction,_=u.direction),g=d.dot(h,_),g<1&&(f=Math.acos(g)),f=n.startPosition.y>n.endPosition.y?-f:f,i=A(i,p),l(i)){const y=r.direction,C=d.negate(i,cFe),T=d.equalsEpsilon(y,i,N.EPSILON2),E=d.equalsEpsilon(y,C,N.EPSILON2);if(!T&&!E){g=d.dot(y,i);let w=N.acosClamped(g);f>0&&f>w&&(f=w-N.EPSILON4),g=d.dot(y,C),w=N.acosClamped(g),f<0&&-f>w&&(f=-w+N.EPSILON4);const S=d.cross(i,y,lFe);r.look(S,f)}else(T&&f<0||E&&f>0)&&r.look(r.right,-f)}else r.lookUp(f)}function uFe(e){ha(e,e.enableRotate,e.rotateEventTypes,GMe,e.inertiaSpin,"_lastInertiaSpinMovement"),ha(e,e.enableZoom,e.zoomEventTypes,XY,e.inertiaZoom,"_lastInertiaZoomMovement"),ha(e,e.enableTilt,e.tiltEventTypes,nFe,e.inertiaSpin,"_lastInertiaTiltMovement"),ha(e,e.enableLook,e.lookEventTypes,tc)}const fFe=new B,dFe=new Ae;function PM(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,fFe),c=d.magnitude(o.position),o._setTransform(B.IDENTITY));const u=dFe;n===le.SCENE3D?r.cartesianToCartographic(o.position,u):s.unproject(o.position,u);let f=!1;if(u.height<e._minimumCollisionTerrainHeight){const h=e._scene.globeHeight;if(l(h)){const _=h+e.minimumZoomDistance;u.height<_&&(u.height=_,n===le.SCENE3D?r.cartographicToCartesian(u,o.position):s.project(u,o.position),f=!0)}}l(a)&&(o._setTransform(a),f&&(d.normalize(o.position,o.position),d.negate(o.position,o.direction),d.multiplyByScalar(o.position,Math.max(c,e.minimumZoomDistance),o.position),d.normalize(o.direction,o.direction),d.cross(o.direction,o.up,o.right),d.cross(o.right,o.direction,o.up)))}jT.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 hFe=new d,pFe=new d;jT.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=pe.UNIT_SPHERE);const o=l(this._globe)?this._globe.terrainExaggeration:1,r=l(this._globe)?this._globe.terrainExaggerationRelativeHeight:0;this._minimumCollisionTerrainHeight=Wh.getHeight(this.minimumCollisionTerrainHeight,o,r),this._minimumPickingTerrainHeight=Wh.getHeight(this.minimumPickingTerrainHeight,o,r),this._minimumTrackBallHeight=Wh.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=d.clone(t.positionWC,hFe),c=d.clone(t.directionWC,pFe);i===le.SCENE2D?uMe(this):i===le.COLUMBUS_VIEW?(this._horizontalRotationAxis=d.UNIT_Z,RMe(this)):i===le.SCENE3D&&(this._horizontalRotationAxis=void 0,uFe(this)),this.enableCollisionDetection&&!this._adjustedHeightForTerrain&&(!d.equals(a,t.positionWC)||!d.equals(c,t.directionWC))&&PM(this),this._aggregator.reset()};jT.prototype.isDestroyed=function(){return!1};jT.prototype.destroy=function(){return this._tweens.removeAll(),this._aggregator=this._aggregator&&this._aggregator.destroy(),Ue(this)};const mFe=`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);
}
`,_Fe=`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 Pd(){this._sceneFramebuffer=new lf;const e=.125,t=new Array(6);t[0]=new Ci({fragmentShader:n_,textureScale:e,forcePowerOfTwo:!0,sampleMode:i_.LINEAR});const n=t[1]=new Ci({fragmentShader:_Fe,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 Ci({fragmentShader:oB,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 Ci({fragmentShader:oB,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 Ci({fragmentShader:n_,sampleMode:i_.LINEAR}),this._uCenter=new j,this._uRadius=void 0,t[5]=new Ci({fragmentShader:mFe,uniforms:{center:function(){return i._uCenter},radius:function(){return i._uRadius},colorTexture2:function(){return i._sceneFramebuffer.framebuffer.getColorTexture(0)}}}),this._stages=new Qs({stages:t});const o=new ff(this),r=t.length;for(let s=0;s<r;++s)t[s]._textureCache=o;this._textureCache=o,this.length=t.length}Pd.prototype.get=function(e){return this._stages.get(e)};Pd.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 gFe=new oe,uk=new j,yFe=new j,fk=new B;function AFe(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,gFe);let f=tn.pointToGLWindowCoordinates(s,c,o,uk);u.x+=N.SOLAR_RADIUS;const h=tn.pointToGLWindowCoordinates(a,c,u,u),_=j.magnitude(j.subtract(h,f,h))*30*2,g=yFe;g.x=_,g.y=_,e._uCenter=j.clone(f,e._uCenter),e._uRadius=Math.max(g.x,g.y)*.15;const p=t.drawingBufferWidth,y=t.drawingBufferHeight,C=e._stages,T=C.get(0),E=T.outputTexture.width,w=T.outputTexture.height,S=new qe;S.width=E,S.height=w,c=B.computeViewportTransformation(S,0,1,fk),f=tn.pointToGLWindowCoordinates(s,c,o,uk),g.x*=E/p,g.y*=w/y;const P=T.scissorRectangle;P.x=Math.max(f.x-g.x*.5,0),P.y=Math.max(f.y-g.y*.5,0),P.width=Math.min(g.x,p),P.height=Math.min(g.y,y);for(let O=1;O<4;++O)qe.clone(P,C.get(O).scissorRectangle)}Pd.prototype.clear=function(e,t,n){this._sceneFramebuffer.clear(e,t,n),this._textureCache.clear(e)};Pd.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),AFe(this,t,n),o};Pd.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)};Pd.prototype.copy=function(e,t){if(!l(this._copyColorCommand)){const n=this;this._copyColorCommand=e.createViewportQuadCommand(n_,{uniformMap:{colorTexture:function(){return n._stages.get(n._stages.length-1).outputTexture}},owner:this})}this._copyColorCommand.framebuffer=t,this._copyColorCommand.execute(e)};Pd.prototype.isDestroyed=function(){return!1};Pd.prototype.destroy=function(){return this._textureCache.destroy(),this._stages.destroy(),Ue(this)};function ZY(){this._cachedShowFrustumsShaders={}}function CFe(e){const t={},n=e.vertexAttributes;for(const i in n)n.hasOwnProperty(i)&&(t[i]=n[i].index);return t}function TFe(e,t){const n=e.context,i=t,o=i.fragmentShaderSource.clone(),r=[];o.sources=o.sources.map(function(f){f=Ge.replaceMain(f,"czm_Debug_main");const h=/gl_FragData\[(\d+)\]/g;let _;for(;(_=h.exec(f))!==null;)r.indexOf(_[1])===-1&&r.push(_[1]);return f});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=CFe(i);return hn.fromCache({context:n,vertexShaderSource:i.vertexShaderSource,fragmentShaderSource:o,attributeLocations:u})}const eA=new U;function bFe(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=U.fromRandom()),t._debugColor):U.WHITE},n.debugShowFrustumsColor=function(){return e.debugShowFrustums?(eA.red=t.debugOverlappingFrustums&1<<0?1:0,eA.green=t.debugOverlappingFrustums&1<<1?1:0,eA.blue=t.debugOverlappingFrustums&1<<2?1:0,eA.alpha=1,eA):U.WHITE}),n}const EFe=new dt;ZY.prototype.executeDebugShowFrustumsCommand=function(e,t,n){const i=t.shaderProgram.id;let o=this._cachedShowFrustumsShaders[i];l(o)||(o=TFe(e,t.shaderProgram),this._cachedShowFrustumsShaders[i]=o);const r=dt.shallowClone(t,EFe);r.shaderProgram=o,r.uniformMap=bFe(e,t),r.execute(e.context,n)};const TS=function(e){return function(){e.frameState.afterRender.push(function(){e.requestRender()})}};function fi(e){e=A(e,A.EMPTY_OBJECT);const t=e.canvas;let n=e.creditContainer,i=e.creditViewport;const o=ut(e.contextOptions);if(!l(t))throw new x("options and options.canvas are required.");const r=l(n),s=new Ua(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=Es(),this._jobScheduler=new jh,this._frameState=new a1e(s,new Oo(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 Av(s),this._globe=void 0,this._globeTranslucencyState=new P_,this._primitives=new No,this._groundPrimitives=new No,this._globeHeight=void 0,this._cameraUnderground=!1,this._logDepthBuffer=s.fragmentDepth,this._logDepthBufferDirty=!0,this._tweens=new fl,this._shaderFrameCount=0,this._sunPostProcess=void 0,this._computeCommandList=[],this._overlayCommandList=[],this._useOIT=A(e.orderIndependentTranslucency,!0),this._executeOITFunction=void 0,this._depthPlane=new HT(e.depthPlaneEllipsoidOffset),this._clearColorCommand=new Ji({color:new U,stencil:0,owner:this}),this._depthClearCommand=new Ji({depth:1,owner:this}),this._stencilClearCommand=new Ji({stencil:0}),this._classificationStencilClearCommand=new Ji({stencil:0,renderState:Qe.fromCache({stencilMask:Pt.CLASSIFICATION_MASK})}),this._depthOnlyRenderStateCache={},this._transitioner=new N_(this),this._preUpdate=new $e,this._postUpdate=new $e,this._renderError=new $e,this._preRender=new $e,this._postRender=new $e,this._minimumDisableDepthTestDistance=0,this._debugInspector=new ZY,this._msaaSamples=A(e.msaaSamples,1),this.rethrowRenderErrors=!1,this.completeMorphOnUserInput=!0,this.morphStart=new $e,this.morphComplete=new $e,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=U.clone(U.BLACK),this._mode=le.SCENE3D,this._mapProjection=l(e.mapProjection)?e.mapProjection:new jo,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 V7,this._shadowMapCamera=new ot(this),this.shadowMap=new gc({context:s,lightCamera:this._shadowMapCamera,enabled:A(e.shadows,!1)}),this.invertClassification=!1,this.invertClassificationColor=U.clone(U.WHITE),this._actualInvertClassificationColor=U.clone(this._invertClassificationColor),this._invertClassification=new au,this.focalLength=void 0,this.eyeSeparation=void 0,this.postProcessStages=new xa,this._brdfLutGenerator=new zT,this._performanceDisplay=void 0,this._debugVolume=void 0,this._screenSpaceCameraController=new jT(this),this._cameraUnderground=!1,this._mapMode2D=A(e.mapMode2D,sp.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=ci.requestCompletedEvent.addEventListener(TS(this)),this._removeTaskProcessorListenerCallback=vi.taskCompletedEvent.addEventListener(TS(this)),this._removeGlobeCallbacks=[];const a=new qe(0,0,s.drawingBufferWidth,s.drawingBufferHeight),c=new ot(this);this._logDepthBuffer&&(c.frustum.near=.1,c.frustum.far=1e10),this.preloadFlightCamera=new ot(this),this.preloadFlightCullingVolume=void 0,this._picking=new Ss(this),this._defaultView=new GT(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 bv,e$(this,0,ne.now()),this.updateFrameState(),this.initializeFrame()}function xFe(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(TS(e))),n.push(t.terrainProviderChanged.addEventListener(TS(e)))),e._removeGlobeCallbacks=n}Object.defineProperties(fi.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 wt.maximumAliasedLineWidth}},maximumCubeMapSize:{get:function(){return wt.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 Xl.isSupported(this._context)}},globe:{get:function(){return this._globe},set:function(e){this._globe=this._globe&&this._globe.destroy(),this._globe=e,xFe(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 Ft)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 ot(this),l(this._deviceOrientationCameraController)||(this._deviceOrientationCameraController=new Uv(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,wt.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}}});fi.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 dk(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=Zf.createPickDerivedCommand(e,t,o,c.picking)),t.pickOnly||(c.depth=Zf.createDepthOnlyDerivedCommand(e,t,o,c.depth)),c.originalCommand=t,e._hdr&&(c.hdr=Zf.createHdrCommand(t,o,c.hdr),t=c.hdr.command,c=t.derivedCommands),a&&t.receiveShadows&&(c.shadows=gc.createReceiveDerivedCommand(s,t,n,o,c.shadows)),t.pass===Be.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))}fi.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),f=l(a.originalCommand),h=r&&!c,_=s&&!u,g=(!r||!s)&&!f;if(e.dirty=e.dirty||h||_||g,e.dirty){e.dirty=!1;const p=t.shadowState.shadowMaps;t.shadowState.shadowsEnabled&&e.castShadows&&(a.shadows=gc.createCastDerivedCommand(p,e,i,n,a.shadows)),(c||h)&&(a.logDepth=Zf.createLogDepthCommand(e,n,a.logDepth),dk(this,a.logDepth.command,i)),(f||g)&&dk(this,e,i)}};const wFe=new I_({pass:Ys.RENDER}),VP=new I_({pass:Ys.PRELOAD}),kP=new I_({pass:Ys.PRELOAD_FLIGHT}),SFe=new I_({pass:Ys.REQUEST_RENDER_MODE_DEFER_CHECK}),hk=new fe;let GP;function vFe(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 hk.radius=n.minimumRadius+i,GP=qs.fromBoundingSphere(hk,e.camera.positionWC,GP),GP}}fi.prototype.clearPasses=function(e){e.render=!1,e.pick=!1,e.depth=!1,e.postProcess=!1,e.offscreen=!1};function e$(e,t,n){const i=e._frameState;i.frameNumber=t,i.time=ne.clone(n,i.time)}fi.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=vFe(this),t.minimumTerrainHeight=0,t.minimumDisableDepthTestDistance=this._minimumDisableDepthTestDistance,t.invertClassification=this.invertClassification,t.useLogDepth=this._logDepthBuffer&&!(this.camera.frustum instanceof Ft||this.camera.frustum instanceof Bo),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=U.clone(this.invertClassificationColor,this._actualInvertClassificationColor),au.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};fi.prototype.isVisible=function(e,t,n){return l(e)&&(!l(e.boundingVolume)||!e.cull||t.computeVisibility(e.boundingVolume)!==mn.OUTSIDE&&(!l(n)||!e.occlude||!e.boundingVolume.isOccluded(n)))};let Aw=new B(0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,1);Aw=B.inverseTransformation(Aw,Aw);function DFe(e,t,n,i){const o=t._frameState,r=o.context,s=e.boundingVolume;l(t._debugVolume)&&t._debugVolume.destroy();let a,c=d.clone(s.center);if(o.mode!==le.SCENE3D){c=B.multiplyByPoint(Aw,c,c);const _=o.mapProjection,g=_.unproject(c);c=_.ellipsoid.cartographicToCartesian(g)}if(l(s.radius)){const _=s.radius;a=Ri.toWireframe(Za.createGeometry(new Za({radii:new d(_,_,_),vertexFormat:_n.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Wt({geometryInstances:new nn({geometry:a,modelMatrix:B.fromTranslation(c),attributes:{color:new an(1,0,0,1)}}),appearance:new _n({flat:!0,translucent:!1}),asynchronous:!1})}else{const _=s.halfAxes;a=Ri.toWireframe(Mr.createGeometry(Mr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:_n.FLAT_VERTEX_FORMAT}))),t._debugVolume=new Wt({geometryInstances:new nn({geometry:a,modelMatrix:B.fromRotationTranslation(_,c,new B),attributes:{color:new an(1,0,0,1)}}),appearance:new _n({flat:!0,translucent:!1}),asynchronous:!1})}const u=o.commandList,f=o.commandList=[];t._debugVolume.update(o),e=f[0],o.useLogDepth&&(e=Zf.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 us(e,t,n,i,o){const r=t._frameState;if(l(t.debugCommandFilter)&&!t.debugCommandFilter(e))return;if(e instanceof Ji){e.execute(n,i);return}e.debugShowBoundingVolume&&l(e.boundingVolume)&&DFe(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 tA(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 t$(e,t,n){return t.boundingVolume.distanceSquaredTo(n)-e.boundingVolume.distanceSquaredTo(n)}function IFe(e,t,n){return e.boundingVolume.distanceSquaredTo(n)-t.boundingVolume.distanceSquaredTo(n)+N.EPSILON12}function PFe(e,t,n,i,o){const r=e.context;eM(i,t$,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 OFe(e,t,n,i,o){const r=e.context;eM(i,IFe,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 LFe(e,t,n,i){const o=e.context;eM(i,t$,e.camera.positionWC);const r=i.length;for(let s=0;s<r;++s)t(i[s],e,o,n)}const BFe=new Un,RFe=new Ks,NFe=new Ft,MFe=new Bo;function dB(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(BFe):l(n.frustum.infiniteProjectionMatrix)?s=n.frustum.clone(RFe):l(n.frustum.width)?s=n.frustum.clone(NFe):s=n.frustum.clone(MFe),s.near=n.frustum.near,s.far=n.frustum.far,r.updateFrustum(s),r.updatePass(Be.ENVIRONMENT);const a=o.passes,c=a.pick,u=e._environmentState,f=e._view,h=u.renderTranslucentDepthForPick,_=u.useWebVR;if(!c){const I=u.skyBoxCommand;if(l(I)&&us(I,e,i,t),u.isSkyAtmosphereVisible&&us(u.skyAtmosphereCommand,e,i,t),u.isSunVisible&&(u.sunDrawCommand.execute(i,t),e.sunBloom&&!_)){let m;u.useGlobeDepthFramebuffer?m=f.globeDepth.framebuffer:u.usePostProcess?m=f.sceneFramebuffer.framebuffer:m=u.originalFramebuffer,e._sunPostProcess.execute(i),e._sunPostProcess.copy(i,m),t.framebuffer=m}u.isMoonVisible&&u.moonCommand.execute(i,t)}let g;u.useOIT?(l(e._executeOITFunction)||(e._executeOITFunction=function(I,m,D,L,M){f.globeDepth.prepareColorTextures(i),f.oit.executeCommands(I,m,D,L,M)}),g=e._executeOITFunction):a.render?g=PFe:g=OFe;const p=f.frustumCommandsList,y=p.length,C=u.clearGlobeDepth,T=u.useDepthPlane,E=e._globeTranslucencyState,w=E.translucent,S=e._view.globeTranslucencyFramebuffer,P=e._depthClearCommand,O=e._stencilClearCommand,z=e._classificationStencilClearCommand,R=e._depthPlane,F=u.usePostProcessSelected,H=n.position.z;let v;for(let I=0;I<y;++I){const m=y-I-1,D=p[m];e.mode===le.SCENE2D?(n.position.z=H-D.near+1,s.far=Math.max(1,D.far-D.near),s.near=1,r.update(o),r.updateFrustum(s)):(s.near=m!==0?D.near*e.opaqueFrustumNearOffset:D.near,s.far=D.far,r.updateFrustum(s)),P.execute(i,t),i.stencilBuffer&&O.execute(i,t),r.updatePass(Be.GLOBE);let L=D.commands[Be.GLOBE],M=D.indices[Be.GLOBE];if(w)E.executeGlobeCommands(D,us,S,e,t);else for(v=0;v<M;++v)us(L[v],e,i,t);const V=f.globeDepth;if(l(V)&&u.useGlobeDepthFramebuffer&&V.executeCopyDepth(i,t),!u.renderTranslucentDepthForPick)if(r.updatePass(Be.TERRAIN_CLASSIFICATION),L=D.commands[Be.TERRAIN_CLASSIFICATION],M=D.indices[Be.TERRAIN_CLASSIFICATION],w)E.executeGlobeClassificationCommands(D,us,S,e,t);else for(v=0;v<M;++v)us(L[v],e,i,t);if(C&&(P.execute(i,t),T&&R.execute(i,t)),!u.useInvertClassification||c||u.renderTranslucentDepthForPick){for(r.updatePass(Be.CESIUM_3D_TILE),L=D.commands[Be.CESIUM_3D_TILE],M=D.indices[Be.CESIUM_3D_TILE],v=0;v<M;++v)us(L[v],e,i,t);if(M>0&&(l(V)&&u.useGlobeDepthFramebuffer&&(V.prepareColorTextures(i,C),V.executeUpdateDepth(i,t,C,V.depthStencilTexture)),!u.renderTranslucentDepthForPick))for(r.updatePass(Be.CESIUM_3D_TILE_CLASSIFICATION),L=D.commands[Be.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Be.CESIUM_3D_TILE_CLASSIFICATION],v=0;v<M;++v)us(L[v],e,i,t)}else{e._invertClassification.clear(i,t);const K=t.framebuffer;for(t.framebuffer=e._invertClassification._fbo.framebuffer,r.updatePass(Be.CESIUM_3D_TILE),L=D.commands[Be.CESIUM_3D_TILE],M=D.indices[Be.CESIUM_3D_TILE],v=0;v<M;++v)us(L[v],e,i,t);for(l(V)&&u.useGlobeDepthFramebuffer&&(e._invertClassification.prepareTextures(i),V.executeUpdateDepth(i,t,C,e._invertClassification._fbo.getDepthStencilTexture())),r.updatePass(Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW),L=D.commands[Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],M=D.indices[Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW],v=0;v<M;++v)us(L[v],e,i,t);for(t.framebuffer=K,e._invertClassification.executeClassified(i,t),o.invertClassificationColor.alpha===1&&e._invertClassification.executeUnclassified(i,t),M>0&&i.stencilBuffer&&z.execute(i,t),r.updatePass(Be.CESIUM_3D_TILE_CLASSIFICATION),L=D.commands[Be.CESIUM_3D_TILE_CLASSIFICATION],M=D.indices[Be.CESIUM_3D_TILE_CLASSIFICATION],v=0;v<M;++v)us(L[v],e,i,t)}for(M>0&&i.stencilBuffer&&O.execute(i,t),r.updatePass(Be.OPAQUE),L=D.commands[Be.OPAQUE],M=D.indices[Be.OPAQUE],v=0;v<M;++v)us(L[v],e,i,t);m!==0&&e.mode!==le.SCENE2D&&(s.near=D.near,r.updateFrustum(s));let k;if(!c&&u.useInvertClassification&&o.invertClassificationColor.alpha<1&&(k=e._invertClassification),r.updatePass(Be.TRANSLUCENT),L=D.commands[Be.TRANSLUCENT],L.length=D.indices[Be.TRANSLUCENT],g(e,us,t,L,k),D.indices[Be.CESIUM_3D_TILE_CLASSIFICATION]>0&&f.translucentTileClassification.isSupported()&&(f.translucentTileClassification.executeTranslucentCommands(e,us,t,L,V.depthStencilTexture),f.translucentTileClassification.executeClassificationCommands(e,us,t,D)),i.depthTexture&&e.useDepthPicking&&(u.useGlobeDepthFramebuffer||h)){const K=V.depthStencilTexture,q=e._picking.getPickDepth(e,m);q.update(i,K),q.executeCopyDepth(i,t)}if(r.updatePass(Be.VOXELS),L=D.commands[Be.VOXELS],M=D.indices[Be.VOXELS],L.length=M,LFe(e,us,t,L),c||!F)continue;const G=t.framebuffer;if(t.framebuffer=f.sceneFramebuffer.getIdFramebuffer(),s.near=m!==0?D.near*e.opaqueFrustumNearOffset:D.near,s.far=D.far,r.updateFrustum(s),r.updatePass(Be.GLOBE),L=D.commands[Be.GLOBE],M=D.indices[Be.GLOBE],w)E.executeGlobeCommands(D,tA,S,e,t);else for(v=0;v<M;++v)tA(L[v],e,i,t);for(C&&(P.framebuffer=t.framebuffer,P.execute(i,t),P.framebuffer=void 0),C&&T&&R.execute(i,t),r.updatePass(Be.CESIUM_3D_TILE),L=D.commands[Be.CESIUM_3D_TILE],M=D.indices[Be.CESIUM_3D_TILE],v=0;v<M;++v)tA(L[v],e,i,t);for(r.updatePass(Be.OPAQUE),L=D.commands[Be.OPAQUE],M=D.indices[Be.OPAQUE],v=0;v<M;++v)tA(L[v],e,i,t);for(r.updatePass(Be.TRANSLUCENT),L=D.commands[Be.TRANSLUCENT],M=D.indices[Be.TRANSLUCENT],v=0;v<M;++v)tA(L[v],e,i,t);t.framebuffer=G}}function n$(e){e.context.uniformState.updatePass(Be.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 FFe(e,t){e.context.uniformState.updatePass(Be.OVERLAY);const i=e.context,o=e._overlayCommandList,r=o.length;for(let s=0;s<r;++s)o[s].execute(i,t)}function zFe(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===Be.GLOBE||u.pass===Be.CESIUM_3D_TILE||u.pass===Be.OPAQUE||u.pass===Be.TRANSLUCENT)&&e.isVisible(u,i))if(o)for(let f=0;f<s;++f)r[f].commandList.push(u);else if(s===1)r[0].commandList.push(u);else{let f=!1;for(let h=s-1;h>=0;--h){const _=r[h].cullingVolume;if(e.isVisible(u,_))r[h].commandList.push(u),f=!0;else if(f)break}}}}function i$(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 f=e.frameState.commandList;zFe(e,f,a);for(let h=0;h<u;++h){const _=a.passes[h];r.updateCamera(_.camera),a.updatePass(o,h);const g=_.commandList.length;for(let p=0;p<g;++p){const y=_.commandList[p];r.updatePass(y.pass),us(y.derivedCommands.shadows.castCommands[s],e,o,_.passState)}}}}const UFe=new d;fi.prototype.updateAndExecuteCommands=function(e,t){const i=this._frameState.mode;this._environmentState.useWebVR?HFe(this,e,t):i!==le.SCENE2D||this._mapMode2D===sp.ROTATE?Ah(!0,this,e,t):(OM(this,e,t),XFe(this,e))};function HFe(e,t,n){const i=e._view,o=i.camera,s=e._environmentState.renderTranslucentDepthForPick;OM(e,t,n),o$(e),i.createPotentiallyVisibleSet(e),n$(e),s||i$(e);const a=t.viewport;a.x=0,a.y=0,a.width=a.width*.5;const c=ot.clone(o,e._cameraVR);c.frustum=o.frustum;const u=o.frustum.near,f=u*A(e.focalLength,5),h=A(e.eyeSeparation,f/30),_=d.multiplyByScalar(c.right,h*.5,UFe);o.frustum.aspectRatio=a.width/a.height;const g=.5*h*u/f;d.add(c.position,_,o.position),o.frustum.xOffset=g,dB(e,t),a.x=a.width,d.subtract(c.position,_,o.position),o.frustum.xOffset=-g,dB(e,t),ot.clone(c,o)}const VFe=new Ae(Math.PI,N.PI_OVER_TWO),kFe=new d,GFe=new d,WFe=new B,jFe=new B,qFe=new d,YFe=new d,$Fe=new qe;function XFe(e,t){const n=e.context,i=e.frameState,o=e.camera,r=t.viewport,s=qe.clone(r,$Fe);t.viewport=s;const a=VFe,c=kFe;e.mapProjection.project(a,c);const f=d.clone(o.position,GFe),h=B.clone(o.transform,jFe),_=o.frustum.clone();o._setTransform(B.IDENTITY);const g=B.computeViewportTransformation(s,0,1,WFe),p=o.frustum.projectionMatrix,y=o.positionWC.y,C=d.fromElements(N.sign(y)*c.x-y,0,-o.positionWC.x,qFe),T=tn.pointToGLWindowCoordinates(p,g,C,YFe);T.x=Math.floor(T.x);const E=s.x,w=s.width;if(y===0||T.x<=E||T.x>=E+w)Ah(!0,e,t);else if(Math.abs(E+w*.5-T.x)<1)s.width=T.x-s.x,o.position.x*=N.sign(o.position.x),o.frustum.right=0,i.cullingVolume=o.frustum.computeCullingVolume(o.positionWC,o.directionWC,o.upWC),n.uniformState.update(i),Ah(!0,e,t),s.x=T.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),Ah(!1,e,t);else if(T.x>E+w*.5){s.width=T.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),Ah(!0,e,t),s.x=T.x,s.width=E+w-T.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),Ah(!1,e,t)}else{s.x=T.x,s.width=E+w-T.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),Ah(!0,e,t),s.x=E,s.width=T.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),Ah(!1,e,t)}o._setTransform(h),d.clone(f,o.position),o.frustum=_.clone(),t.viewport=r}function Ah(e,t,n,i){const o=t._environmentState,r=t._view,s=o.renderTranslucentDepthForPick;e||(t.frameState.commandList.length=0),o$(t),r.createPotentiallyVisibleSet(t),e&&(l(i)&&OM(t,n,i),n$(t),s||i$(t)),dB(t,n)}const pk=new Ko;fi.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 Ft||!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 f=e.mode===le.SCENE3D&&!a.sunVisibleThroughGlobe?e.occluder:void 0;let h=e.cullingVolume;const _=pk.planes;for(let y=0;y<5;++y)_[y]=h.planes[y];h=pk,n.isSkyAtmosphereVisible=l(n.skyAtmosphereCommand)&&n.isReadyForAtmosphere,n.isSunVisible=this.isVisible(n.sunDrawCommand,h,f),n.isMoonVisible=this.isVisible(n.moonCommand,h,f);const g=this.specularEnvironmentMaps;let p=this._specularEnvironmentMapAtlas;l(g)&&(!l(p)||p.url!==g)?(p=p&&p.destroy(),this._specularEnvironmentMapAtlas=new Xl(g)):!l(g)&&l(p)&&(p.destroy(),this._specularEnvironmentMapAtlas=void 0),l(this._specularEnvironmentMapAtlas)&&this._specularEnvironmentMapAtlas.update(e)};function KFe(e){const t=e._frameState;e.debugShowFrustumPlanes!==e._debugShowFrustumPlanes&&(e.debugShowFrustumPlanes?e._debugFrustumPlanes=new Oh({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 JFe(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 o$(e){const t=e._frameState;e._groundPrimitives.update(t),e._primitives.update(t),KFe(e),JFe(e),e._globe&&e._globe.render(t)}function OM(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 Pd: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 f=e._clearColorCommand;U.clone(n,f.color),f.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 _=s.oit,g=r.useOIT=!c&&l(_)&&_.isSupported();g&&(_.update(i,t,s.globeDepth.colorFramebufferManager,e._hdr,e.msaaSamples),_.clear(i,t,n),r.useOIT=_.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)&&f.execute(i,t),r.useInvertClassification=!c&&l(t.framebuffer)&&e.invertClassification){let T;if(e.frameState.invertClassificationColor.alpha===1&&r.useGlobeDepthFramebuffer&&(T=s.globeDepth.framebuffer),l(T)||i.depthTexture){if(e._invertClassification.previousFramebuffer=T,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=_.createDerivedCommands(E,i,w.oit)}}else r.useInvertClassification=!1}e._globeTranslucencyState.translucent&&s.globeTranslucencyFramebuffer.updateAndClear(e._hdr,s.viewport,i,t)}fi.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,f=i.sceneFramebuffer._colorFramebuffer,h=i.sceneFramebuffer.idFramebuffer;r&&(e.framebuffer=a?f.framebuffer:c,i.oit.execute(t,e));const _=i.translucentTileClassification;if(_.hasTranslucentDepth&&_.isSupported()&&_.execute(this,e),a){i.sceneFramebuffer.prepareColorTextures(t);let g=f;s&&!r&&(g=u);const p=this.postProcessStages,y=g.getColorTexture(0),C=h.getColorTexture(0),T=A(u,f).getDepthStencilTexture();p.execute(t,y,T,C),p.copy(t,c)}!r&&!a&&s&&(e.framebuffer=c,o.executeCopyColor(t,e))};function QFe(e){const t=e._frameState.afterRender;for(let n=0,i=t.length;n<i;++n)t[n]()&&e.requestRender();t.length=0}function ZFe(e){const t=e._globe,i=e.camera.positionCartographic;if(l(t)&&t.show&&l(i))return t.getHeight(i)}function e2e(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}fi.prototype.initializeFrame=function(){this._shaderFrameCount++===120&&(this._shaderFrameCount=0,this._context.shaderCache.destroyReleasedShaderPrograms(),this._context.textureCache.destroyReleasedTextures()),this._tweens.update(),this._globeHeight=ZFe(this),this._cameraUnderground=e2e(this),this._globeTranslucencyState.update(this),this._screenSpaceCameraController.update(),l(this._deviceOrientationCameraController)&&this._deviceOrientationCameraController.update(),this.camera.update(this._mode),this.camera._updateCameraChanged()};function t2e(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 Hv({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 n2e(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 i2e(e){const t=e._frameState;e.primitives.postPassesUpdate(t),ci.update()}const o2e=new U;function r2e(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=wFe;let r=A(e.backgroundColor,U.BLACK);e._hdr&&(r=U.clone(r,o2e),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 bv?d.negate(i.sunDirectionWC,e._shadowMapCamera.direction):d.clone(e.light.direction,e._shadowMapCamera.direction),t.shadowMaps.push(s)),e._computeCommandList.length=0,e._overlayCommandList.length=0;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=qe.clone(a,c.viewport),l(e.globe)&&e.globe.beginFrame(t),e.updateEnvironment(),e.updateAndExecuteCommands(c,r),e.resolveFramebuffers(c),c.framebuffer=void 0,FFe(e,c),l(e.globe)&&(e.globe.endFrame(t),e.globe.tilesLoaded||(e._renderRequested=!0)),n.endFrame()}function Jp(e,t){try{t(e)}catch(n){if(e._renderError.raiseEvent(e,n),e.rethrowRenderErrors)throw n}}function s2e(e){return e._picking.updateMostDetailedRayPicks(e)}fi.prototype.render=function(e){this._preUpdate.raiseEvent(this,e);const t=this._frameState;t.newFrame=!1,l(e)||(e=ne.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(ne.secondsDifference(this._lastRenderTime,e));i=i||o>this.maximumRenderTimeChange}if(i){this._lastRenderTime=ne.clone(e,this._lastRenderTime),this._renderRequested=!1,this._logDepthBufferDirty=!1,this._hdrDirty=!1;const o=N.incrementWrap(t.frameNumber,15e6,1);e$(this,o,e),t.newFrame=!0}Jp(this,n2e),this.primitives.show&&(Jp(this,s2e),Jp(this,a2e),Jp(this,c2e),i||Jp(this,l2e)),this._postUpdate.raiseEvent(this,e),i&&(this._preRender.raiseEvent(this,e),t.creditDisplay.beginFrame(),Jp(this,r2e)),t2e(this,i),Jp(this,i2e),QFe(this),i&&(this._postRender.raiseEvent(this,e),t.creditDisplay.endFrame())};fi.prototype.forceRender=function(e){this._renderRequested=!0,this.render(e)};fi.prototype.requestRender=function(){this._renderRequested=!0};fi.prototype.clampLineWidth=function(e){return Math.max(wt.minimumAliasedLineWidth,Math.min(e,wt.maximumAliasedLineWidth))};fi.prototype.pick=function(e,t,n){return this._picking.pick(this,e,t,n)};fi.prototype.pickPositionWorldCoordinates=function(e,t){return this._picking.pickPositionWorldCoordinates(this,e,t)};fi.prototype.pickPosition=function(e,t){return this._picking.pickPosition(this,e,t)};fi.prototype.drillPick=function(e,t,n,i){return this._picking.drillPick(this,e,t,n,i)};function a2e(e){const t=e._frameState;VP.camera=t.camera,VP.cullingVolume=t.cullingVolume,e.primitives.updateForPass(t,VP)}function c2e(e){const t=e._frameState;if(!t.camera.canPreloadFlight())return;kP.camera=e.preloadFlightCamera,kP.cullingVolume=e.preloadFlightCullingVolume,e.primitives.updateForPass(t,kP)}function l2e(e){e.primitives.updateForPass(e._frameState,SFe)}fi.prototype.pickFromRay=function(e,t,n){return this._picking.pickFromRay(this,e,t,n)};fi.prototype.drillPickFromRay=function(e,t,n,i){return this._picking.drillPickFromRay(this,e,t,n,i)};fi.prototype.pickFromRayMostDetailed=function(e,t,n){return this._picking.pickFromRayMostDetailed(this,e,t,n)};fi.prototype.drillPickFromRayMostDetailed=function(e,t,n,i){return this._picking.drillPickFromRayMostDetailed(this,e,t,n,i)};fi.prototype.sampleHeight=function(e,t,n){return this._picking.sampleHeight(this,e,t,n)};fi.prototype.clampToHeight=function(e,t,n,i){return this._picking.clampToHeight(this,e,t,n,i)};fi.prototype.sampleHeightMostDetailed=function(e,t,n){return this._picking.sampleHeightMostDetailed(this,e,t,n)};fi.prototype.clampToHeightMostDetailed=function(e,t,n){return this._picking.clampToHeightMostDetailed(this,e,t,n)};fi.prototype.cartesianToCanvasCoordinates=function(e,t){return lr.wgs84ToWindowCoordinates(this,e,t)};fi.prototype.completeMorph=function(){this._transitioner.completeMorph()};fi.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)};fi.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)};fi.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)};fi.prototype.isDestroyed=function(){return!1};fi.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,Ue(this)};const hd={X:0,Y:1,Z:2};hd.Y_UP_TO_Z_UP=B.fromRotationTranslation(J.fromRotationX(N.PI_OVER_TWO));hd.Z_UP_TO_Y_UP=B.fromRotationTranslation(J.fromRotationX(-N.PI_OVER_TWO));hd.X_UP_TO_Z_UP=B.fromRotationTranslation(J.fromRotationY(-N.PI_OVER_TWO));hd.Z_UP_TO_X_UP=B.fromRotationTranslation(J.fromRotationY(N.PI_OVER_TWO));hd.X_UP_TO_Y_UP=B.fromRotationTranslation(J.fromRotationZ(N.PI_OVER_TWO));hd.Y_UP_TO_X_UP=B.fromRotationTranslation(J.fromRotationZ(-N.PI_OVER_TWO));hd.fromName=function(e){return b.typeOf.string("name",e),hd[e]};const Jr=Object.freeze(hd);function l0(e){e=A(e,pe.WGS84),this.show=!0,this.perFragmentAtmosphere=!1,this._ellipsoid=e;const t=1.025,n=d.multiplyByScalar(e.radii,t,new d);this._scaleMatrix=B.fromScale(n),this._modelMatrix=new B,this._command=new dt({owner:this,modelMatrix:this._modelMatrix}),this._spSkyFromSpace=void 0,this._spSkyFromAtmosphere=void 0,this._flags=void 0,this.atmosphereLightIntensity=50,this.atmosphereRayleighCoefficient=new d(55e-7,13e-6,284e-7),this.atmosphereMieCoefficient=new d(21e-6,21e-6,21e-6),this.atmosphereRayleighScaleHeight=1e4,this.atmosphereMieScaleHeight=3200,this.atmosphereMieAnisotropy=.9,this.hueShift=0,this.saturationShift=0,this.brightnessShift=0,this._hueSaturationBrightness=new d;const i=new d;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(l0.prototype,{ellipsoid:{get:function(){return this._ellipsoid}}});l0.prototype.setDynamicAtmosphereColor=function(e,t){const n=e?t?2:1:0;this._radiiAndDynamicAtmosphereColor.z=n};const WP=new B;l0.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,d.ZERO,WP),o=B.multiplyTransformation(i,Jr.Y_UP_TO_Z_UP,WP),r=B.multiply(this._scaleMatrix,o,WP);B.clone(r,this._modelMatrix);const s=e.context,a=u2e(this),c=e.globeTranslucencyState.translucent,u=this.perFragmentAtmosphere||c||!l(t)||!t.show,f=this._command;if(!l(f.vertexArray)){const _=Za.createGeometry(new Za({radii:new d(1,1,1),slicePartitions:256,stackPartitions:256,vertexFormat:Ne.POSITION_ONLY}));f.vertexArray=to.fromGeometry({context:s,geometry:_,attributeLocations:Ri.createAttributeLocations(_),bufferUsage:Ze.STATIC_DRAW}),f.renderState=Qe.fromCache({cull:{enabled:!0,face:Po.FRONT},blending:Ii.ALPHA_BLEND,depthMask:!1})}const h=a|u<<2|c<<3;if(h!==this._flags){this._flags=h;const _=[];a&&_.push("COLOR_CORRECT"),u&&_.push("PER_FRAGMENT_ATMOSPHERE"),c&&_.push("GLOBE_TRANSLUCENT");const g=new Ge({defines:_,sources:[aS,Jz,bAe]}),p=new Ge({defines:_,sources:[aS,Jz,TAe]});this._spSkyAtmosphere=hn.fromCache({context:s,vertexShaderSource:g,fragmentShaderSource:p}),f.shaderProgram=this._spSkyAtmosphere}return f};function u2e(e){return!(N.equalsEpsilon(e.hueShift,0,N.EPSILON7)&&N.equalsEpsilon(e.saturationShift,0,N.EPSILON7)&&N.equalsEpsilon(e.brightnessShift,0,N.EPSILON7))}l0.prototype.isDestroyed=function(){return!1};l0.prototype.destroy=function(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),this._spSkyAtmosphere=this._spSkyAtmosphere&&this._spSkyAtmosphere.destroy(),Ue(this)};function $v(e){this.sources=e.sources,this._sources=void 0,this.show=A(e.show,!0),this._command=new dt({modelMatrix:B.clone(B.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}$v.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"?Q0e(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 nu({context:i,source:r}))}const o=this._command;if(!l(o.vertexArray)){o.uniformMap={u_cubeMap:function(){return n._cubeMap}};const r=Mr.createGeometry(Mr.fromDimensions({dimensions:new d(2,2,2),vertexFormat:Ne.POSITION_ONLY})),s=this._attributeLocations=Ri.createAttributeLocations(r);o.vertexArray=to.fromGeometry({context:i,geometry:r,attributeLocations:s,bufferUsage:Ze.STATIC_DRAW}),o.renderState=Qe.fromCache({blending:Ii.ALPHA_BLEND})}if(!l(o.shaderProgram)||this._useHdr!==t){const r=new Ge({defines:[t?"HDR":""],sources:[EAe]});o.shaderProgram=hn.fromCache({context:i,vertexShaderSource:xAe,fragmentShaderSource:r,attributeLocations:this._attributeLocations}),this._useHdr=t}if(l(this._cubeMap))return o};$v.prototype.isDestroyed=function(){return!1};$v.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(),Ue(this)};function qT(){this.show=!0,this._drawCommand=new dt({primitiveType:Je.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(qT.prototype,{glowFactor:{get:function(){return this._glowFactor},set:function(e){e=Math.max(e,0),this._glowFactor=e,this._glowFactorDirty=!0}}});const f2e=new j,d2e=new j,h2e=new oe,nA=new oe;qT.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?Ke.HALF_FLOAT:Ke.FLOAT:Ke.UNSIGNED_BYTE;this._texture=new zt({context:o,width:S,height:S,pixelFormat:nt.RGBA,pixelDatatype:P}),this._glowLengthTS=this._glowFactor*5,this._radiusTS=1/(1+2*this._glowLengthTS)*.5;const O=this,z={u_radiusTS:function(){return O._radiusTS}};this._commands.computeCommand=new MC({fragmentShaderSource:SAe,outputTexture:this._texture,uniformMap:z,persists:!1,owner:this,postExecute:function(){O._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 O=At.createVertexBuffer({context:o,typedArray:P,usage:Ze.STATIC_DRAW}),z=[{index:S.direction,vertexBuffer:O,componentsPerAttribute:2,normalize:!0,componentDatatype:ee.UNSIGNED_BYTE}],R=At.createIndexBuffer({context:o,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT});a.vertexArray=new to({context:o,attributes:z,indexBuffer:R}),a.shaderProgram=hn.fromCache({context:o,vertexShaderSource:vAe,fragmentShaderSource:wAe,attributeLocations:S}),a.renderState=Qe.fromCache({blending:Ii.ALPHA_BLEND}),a.uniformMap=this._uniformMap}const c=o.uniformState.sunPositionWC,u=o.uniformState.sunPositionColumbusView,f=this._boundingVolume,h=this._boundingVolume2D;d.clone(c,f.center),h.center.x=u.z,h.center.y=u.x,h.center.z=u.y,f.radius=N.SOLAR_RADIUS+N.SOLAR_RADIUS*this._glowLengthTS,h.radius=f.radius,i===le.SCENE3D?fe.clone(f,a.boundingVolume):i===le.COLUMBUS_VIEW&&fe.clone(h,a.boundingVolume);const _=lr.computeActualWgs84Position(e,c,nA),g=d.magnitude(d.subtract(_,e.camera.position,nA)),p=o.uniformState.projection,y=h2e;y.x=0,y.y=0,y.z=-g,y.w=1;const C=B.multiplyByVector(p,y,nA),T=lr.clipToGLWindowCoordinates(t.viewport,C,f2e);y.x=N.SOLAR_RADIUS;const E=B.multiplyByVector(p,y,nA),w=lr.clipToGLWindowCoordinates(t.viewport,E,d2e);return this._size=j.magnitude(j.subtract(w,T,nA)),this._size=2*this._size*(1+2*this._glowLengthTS),this._size=Math.ceil(this._size),this._commands};qT.prototype.isDestroyed=function(){return!1};qT.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(),Ue(this)};function fg(e){return dn(`Assets/Textures/SkyBox/tycho2t3_80_${e}.jpg`)}function p2e(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 r$(e){let t=e._useBrowserRecommendedResolution?1:window.devicePixelRatio;return t*=e._resolutionScale,l(e._scene)&&(e._scene.pixelRatio=t),t}function s$(e){const t=e._canvas;let n=t.clientWidth,i=t.clientHeight;const o=r$(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 a$(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 M_(e,t){if(!l(e))throw new x("container is required.");e=cr(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=un.supportsImageRenderingPixelated();this._supportsImageRenderingPixelated=o,o&&(i.style.imageRendering=un.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)?cr(t.creditContainer):n;c.appendChild(a);const u=l(t.creditViewport)?cr(t.creditViewport):n,f=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=f,this._resolutionScale=1,this._useBrowserRecommendedResolution=h,this._forceResize=!1,this._clock=l(t.clock)?t.clock:new MT,s$(this);try{const _=new fi({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=_,_.camera.constrainedAxis=d.UNIT_Z,r$(this),a$(this);const g=A(_.mapProjection.ellipsoid,pe.WGS84);let p=t.globe;l(p)||(p=new ru(g)),p!==!1&&(_.globe=p,_.globe.shadows=A(t.terrainShadows,Co.RECEIVE_ONLY));let y=t.skyBox;l(y)||(y=new $v({sources:{positiveX:fg("px"),negativeX:fg("mx"),positiveY:fg("py"),negativeY:fg("my"),positiveZ:fg("pz"),negativeZ:fg("mz")}})),y!==!1&&(_.skyBox=y,_.sun=new qT,_.moon=new FT);let C=t.skyAtmosphere;l(C)||(C=new l0(g)),C!==!1&&(_.skyAtmosphere=C);let T=t.globe===!1?!1:t.imageryProvider;l(T)||(T=ow()),T!==!1&&_.imageryLayers.addImageryProvider(T),l(t.terrainProvider)&&t.globe!==!1&&(_.terrainProvider=t.terrainProvider),this._screenSpaceEventHandler=new yc(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)}},_.renderError.addEventListener(this._onRenderError)}catch(_){if(f){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,_)}throw _}}Object.defineProperties(M_.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&&p2e(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)}}});M_.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),f=l(n);if(u||f){const g=document.createElement("div");if(g.className="cesium-widget-errorPanel-message",a.appendChild(g),f){let p=DL(n);u||(typeof n=="string"&&(n=new Error(n)),t=DL({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 C=document.createElement("span");C.className="cesium-widget-errorPanel-more-details",C.appendChild(document.createTextNode("See more...")),y.appendChild(C),y.onclick=function(T){y.removeChild(C),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 _=document.createElement("button");_.setAttribute("type","button"),_.className="cesium-button",_.appendChild(document.createTextNode("OK")),_.onclick=function(){l(c)&&l(window.removeEventListener)&&window.removeEventListener("resize",c,!1),i.removeChild(o)},h.appendChild(_),i.appendChild(o)};M_.prototype.isDestroyed=function(){return!1};M_.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),Ue(this)};M_.prototype.resize=function(){const e=this._canvas;!this._forceResize&&this._canvasClientWidth===e.clientWidth&&this._canvasClientHeight===e.clientHeight&&this._lastDevicePixelRatio===window.devicePixelRatio||(this._forceResize=!1,s$(this),a$(this),this._scene.requestRender())};M_.prototype.render=function(){if(this._canRender){this._scene.initializeFrame();const e=this._clock.tick();this._scene.render(e)}else this._clock.tick()};function Wo(e){this._value=void 0,this._hasClone=!1,this._hasEquals=!1,this._definitionChanged=new $e,this.setValue(e)}Object.defineProperties(Wo.prototype,{isConstant:{value:!0},definitionChanged:{get:function(){return this._definitionChanged}}});Wo.prototype.getValue=function(e,t){return this._hasClone?this._value.clone(t):this._value};Wo.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))}};Wo.prototype.equals=function(e){return this===e||e instanceof Wo&&(!this._hasEquals&&this._value===e._value||this._hasEquals&&this._value.equals(e._value))};Wo.prototype.valueOf=function(){return this._value};Wo.prototype.toString=function(){return String(this._value)};function m2e(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 _2e(e){return new Wo(e)}function ge(e,t,n){return m2e(e,`_${e.toString()}`,`_${e.toString()}Subscription`,A(t,!1),A(n,_2e))}function $C(e){this._definitionChanged=new $e,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($C.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),image:ge("image"),scale:ge("scale"),pixelOffset:ge("pixelOffset"),eyeOffset:ge("eyeOffset"),horizontalOrigin:ge("horizontalOrigin"),verticalOrigin:ge("verticalOrigin"),heightReference:ge("heightReference"),color:ge("color"),rotation:ge("rotation"),alignedAxis:ge("alignedAxis"),sizeInMeters:ge("sizeInMeters"),width:ge("width"),height:ge("height"),scaleByDistance:ge("scaleByDistance"),translucencyByDistance:ge("translucencyByDistance"),pixelOffsetScaleByDistance:ge("pixelOffsetScaleByDistance"),imageSubRegion:ge("imageSubRegion"),distanceDisplayCondition:ge("distanceDisplayCondition"),disableDepthTestDistance:ge("disableDepthTestDistance")});$C.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 $C(this)};$C.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 Ut(e,t){e=A(e,0),this._near=e,t=A(t,Number.MAX_VALUE),this._far=t}Object.defineProperties(Ut.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}}});Ut.packedLength=2;Ut.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};Ut.unpack=function(e,t,n){if(!l(e))throw new x("array is required");return t=A(t,0),l(n)||(n=new Ut),n.near=e[t++],n.far=e[t],n};Ut.equals=function(e,t){return e===t||l(e)&&l(t)&&e.near===t.near&&e.far===t.far};Ut.clone=function(e,t){if(l(e))return l(t)||(t=new Ut),t.near=e.near,t.far=e.far,t};Ut.prototype.clone=function(e){return Ut.clone(this,e)};Ut.prototype.equals=function(e){return Ut.equals(this,e)};const g2e={NONE:0,CLAMP_TO_GROUND:1,RELATIVE_TO_GROUND:2},Et=Object.freeze(g2e),y2e={CENTER:0,LEFT:1,RIGHT:-1},Ta=Object.freeze(y2e),A2e={CENTER:0,BOTTOM:1,BASELINE:2,TOP:-1},Si=Object.freeze(A2e),C2e={DONE:0,PENDING:1,FAILED:2},pt=Object.freeze(C2e);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 T2e=U.WHITE,b2e=d.ZERO,E2e=Et.NONE,x2e=j.ZERO,w2e=1,S2e=0,v2e=d.ZERO,D2e=Ta.CENTER,I2e=Si.CENTER,P2e=!1,O2e=new d,L2e=new U,B2e=new d,R2e=new j,N2e=new Mt,M2e=new Mt,F2e=new Mt,z2e=new qe,U2e=new Ut;function mk(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 xt,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,f=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(f&&(h=Z.getValueOrUndefined(s._position,e,O2e),c=Z.getValueOrUndefined(a._image,e),f=l(h)&&l(c)),!f){hB(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=f,(!l(u.image)||r.textureValue!==c)&&(u.image=c,r.textureValue=c),u.position=h,u.color=Z.getValueOrDefault(a._color,e,T2e,L2e),u.eyeOffset=Z.getValueOrDefault(a._eyeOffset,e,b2e,B2e),u.heightReference=Z.getValueOrDefault(a._heightReference,e,E2e),u.pixelOffset=Z.getValueOrDefault(a._pixelOffset,e,x2e,R2e),u.scale=Z.getValueOrDefault(a._scale,e,w2e),u.rotation=Z.getValueOrDefault(a._rotation,e,S2e),u.alignedAxis=Z.getValueOrDefault(a._alignedAxis,e,v2e),u.horizontalOrigin=Z.getValueOrDefault(a._horizontalOrigin,e,D2e),u.verticalOrigin=Z.getValueOrDefault(a._verticalOrigin,e,I2e),u.width=Z.getValueOrUndefined(a._width,e),u.height=Z.getValueOrUndefined(a._height,e),u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,N2e),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,M2e),u.pixelOffsetScaleByDistance=Z.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,F2e),u.sizeInMeters=Z.getValueOrDefault(a._sizeInMeters,e,P2e),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,U2e),u.disableDepthTestDistance=Z.getValueOrUndefined(a._disableDepthTestDistance,e);const _=Z.getValueOrUndefined(a._imageSubRegion,e,z2e);l(_)&&u.setImageSubRegion(u._imageId,_)}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 pt.FAILED;const i=n.billboard;if(i.heightReference===Et.NONE)t.center=d.clone(i.position,t.center);else{if(!l(i._clampedPosition))return pt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,pt.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 Ue(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 mk(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 mk(r)):(hB(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],hB(s.get(r.id),r,a),s.remove(r.id)};function hB(e,t,n){l(e)&&(e.billboard=void 0,n.removeBillboard(t))}function _i(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(_i.prototype,{componentDatatype:{get:function(){return ee.FLOAT}},componentsPerAttribute:{get:function(){return 2}},normalize:{get:function(){return!1}}});_i.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 _i(e.near,e.far)};_i.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 Zt(e){e=A(e,A.EMPTY_OBJECT),this.start=l(e.start)?ne.clone(e.start):new ne,this.stop=l(e.stop)?ne.clone(e.stop):new ne,this.data=e.data,this.isStartIncluded=A(e.isStartIncluded,!0),this.isStopIncluded=A(e.isStopIncluded,!0)}Object.defineProperties(Zt.prototype,{isEmpty:{get:function(){const e=ne.compare(this.stop,this.start);return e<0||e===0&&(!this.isStartIncluded||!this.isStopIncluded)}}});const dg={start:void 0,stop:void 0,isStartIncluded:void 0,isStopIncluded:void 0,data:void 0};Zt.fromIso8601=function(e,t){b.typeOf.object("options",e),b.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=ne.fromIso8601(n[0]),o=ne.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):(dg.start=i,dg.stop=o,dg.isStartIncluded=r,dg.isStopIncluded=s,dg.data=a,new Zt(dg))};Zt.toIso8601=function(e,t){return b.typeOf.object("timeInterval",e),`${ne.toIso8601(e.start,t)}/${ne.toIso8601(e.stop,t)}`};Zt.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 Zt(e)};Zt.equals=function(e,t,n){return e===t||l(e)&&l(t)&&(e.isEmpty&&t.isEmpty||e.isStartIncluded===t.isStartIncluded&&e.isStopIncluded===t.isStopIncluded&&ne.equals(e.start,t.start)&&ne.equals(e.stop,t.stop)&&(e.data===t.data||l(n)&&n(e.data,t.data)))};Zt.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&&ne.equalsEpsilon(e.start,t.start,n)&&ne.equalsEpsilon(e.stop,t.stop,n)&&(e.data===t.data||l(i)&&i(e.data,t.data)))};Zt.intersect=function(e,t,n,i){if(b.typeOf.object("left",e),!l(t))return Zt.clone(Zt.EMPTY,n);const o=e.start,r=e.stop,s=t.start,a=t.stop,c=ne.greaterThanOrEquals(s,o)&&ne.greaterThanOrEquals(r,s),u=!c&&ne.lessThanOrEquals(s,o)&&ne.lessThanOrEquals(o,a);if(!c&&!u)return Zt.clone(Zt.EMPTY,n);const f=e.isStartIncluded,h=e.isStopIncluded,_=t.isStartIncluded,g=t.isStopIncluded,p=ne.lessThan(r,a);return l(n)||(n=new Zt),n.start=c?s:o,n.isStartIncluded=f&&_||!ne.equals(s,o)&&(c&&_||u&&f),n.stop=p?r:a,n.isStopIncluded=p?h:h&&g||!ne.equals(a,r)&&g,n.data=l(i)?i(e.data,t.data):e.data,n};Zt.contains=function(e,t){if(b.typeOf.object("timeInterval",e),b.typeOf.object("julianDate",t),e.isEmpty)return!1;const n=ne.compare(e.start,t);if(n===0)return e.isStartIncluded;const i=ne.compare(t,e.stop);return i===0?e.isStopIncluded:n<0&&i<0};Zt.prototype.clone=function(e){return Zt.clone(this,e)};Zt.prototype.equals=function(e,t){return Zt.equals(this,e,t)};Zt.prototype.equalsEpsilon=function(e,t,n){return Zt.equalsEpsilon(this,e,t,n)};Zt.prototype.toString=function(){return Zt.toIso8601(this)};Zt.EMPTY=Object.freeze(new Zt({start:new ne,stop:new ne,isStartIncluded:!1,isStopIncluded:!1}));const c$=Object.freeze(ne.fromIso8601("0000-01-01T00:00:00Z")),l$=Object.freeze(ne.fromIso8601("9999-12-31T24:00:00Z")),H2e=Object.freeze(new Zt({start:c$,stop:l$})),V2e={MINIMUM_VALUE:c$,MAXIMUM_VALUE:l$,MAXIMUM_INTERVAL:H2e},lt=V2e,k2e=`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
}
`,G2e=`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;
}
`,W2e=`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
}
`,j2e=`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;
}
`,q2e=`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
}
`,Y2e=`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 Ho(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=A(e.closed,!1),i=A(e.materialSupport,Ho.MaterialSupport.TEXTURED);this.material=l(e.material)?e.material:Fe.fromType(Fe.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,i.vertexShaderSource),this._fragmentShaderSource=A(e.fragmentShaderSource,i.fragmentShaderSource),this._renderState=fr.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(Ho.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}}});Ho.prototype.getFragmentShaderSource=fr.prototype.getFragmentShaderSource;Ho.prototype.isTranslucent=fr.prototype.isTranslucent;Ho.prototype.getRenderState=fr.prototype.getRenderState;Ho.MaterialSupport={BASIC:Object.freeze({vertexFormat:Ne.POSITION_AND_NORMAL,vertexShaderSource:j2e,fragmentShaderSource:W2e}),TEXTURED:Object.freeze({vertexFormat:Ne.POSITION_NORMAL_AND_ST,vertexShaderSource:Y2e,fragmentShaderSource:q2e}),ALL:Object.freeze({vertexFormat:Ne.ALL,vertexShaderSource:G2e,fragmentShaderSource:k2e})};function Jt(e){this._definitionChanged=new $e,this._color=void 0,this._colorSubscription=void 0,this.color=e}Object.defineProperties(Jt.prototype,{isConstant:{get:function(){return Z.isConstant(this._color)}},definitionChanged:{get:function(){return this._definitionChanged}},color:ge("color")});Jt.prototype.getType=function(e){return"Color"};Jt.prototype.getValue=function(e,t){return l(t)||(t={}),t.color=Z.getValueOrClonedDefault(this._color,e,U.WHITE,t.color),t};Jt.prototype.equals=function(e){return this===e||e instanceof Jt&&Z.equals(this._color,e._color)};const u$={TERRAIN:0,CESIUM_3D_TILE:1,BOTH:2};u$.NUMBER_OF_CLASSIFICATION_TYPES=3;const go=Object.freeze(u$);function Ll(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 is(e,t,n){b.typeOf.bool("extentsCulling",e),b.typeOf.bool("planarExtents",t),b.typeOf.object("appearance",n),this._projectionExtentDefines={eastMostYhighDefine:"",eastMostYlowDefine:"",westMostYhighDefine:"",westMostYlowDefine:""};const i=new pB;i.requiresTextureCoordinates=e,i.requiresEC=!n.flat;const o=new pB;if(o.requiresTextureCoordinates=e,n instanceof _n)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}is.prototype.createFragmentShader=function(e){b.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 _n&&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 _n||(o=t.material.shaderSource),new Ge({defines:i,sources:[o,dj]})};is.prototype.createPickFragmentShader=function(e){b.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 Ge({defines:n,sources:[dj],pickColorQualifier:"varying"})};is.prototype.createVertexShader=function(e,t,n,i){return b.defined("defines",e),b.typeOf.string("vertexShaderSource",t),b.typeOf.bool("columbusView2D",n),b.defined("mapProjection",i),f$(this._colorShaderDependencies,this._planarExtents,n,e,t,this._appearance,i,this._projectionExtentDefines)};is.prototype.createPickVertexShader=function(e,t,n,i){return b.defined("defines",e),b.typeOf.string("vertexShaderSource",t),b.typeOf.bool("columbusView2D",n),b.defined("mapProjection",i),f$(this._pickShaderDependencies,this._planarExtents,n,e,t,void 0,i,this._projectionExtentDefines)};const _k=new d,gk=new Ae,yk={high:0,low:0};function f$(e,t,n,i,o,r,s,a){const c=i.slice();if(a.eastMostYhighDefine===""){const u=gk;u.longitude=N.PI,u.latitude=0,u.height=0;const f=s.project(u,_k);let h=wn.encode(f.x,yk);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 _=gk;_.longitude=-N.PI,_.latitude=0,_.height=0;const g=s.project(_,_k);h=wn.encode(g.x,yk),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 _n&&c.push("PER_INSTANCE_COLOR"),e.requiresTextureCoordinates&&(c.push("TEXTURE_COORDINATES"),t||n||c.push("SPHERICAL"),n&&c.push("COLUMBUS_VIEW_2D")),new Ge({defines:c,sources:[o]})}function pB(){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(pB.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 Ak(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 $2e=[new j,new j,new j,new j];function d$(e,t){const n=$2e,i=j.unpack(t,0,n[0]),o=j.unpack(t,2,n[1]),r=j.unpack(t,4,n[2]);e.uMaxVmax=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[o.x,o.y,r.x,r.y]});const s=1/Ak(i,o,r),a=1/Ak(i,r,o);e.uvMinAndExtents=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[i.x,i.y,s,a]})}const h$=new Ae,p$=new d,X2e=new d,K2e=new d,$E={high:0,low:0};function m$(e,t,n){const i=h$;i.height=0,i.longitude=e.west,i.latitude=e.south;const o=t.project(i,p$);i.latitude=e.north;const r=t.project(i,X2e);i.longitude=e.east,i.latitude=e.south;const s=t.project(i,K2e),a=[0,0,0,0],c=[0,0,0,0];let u=wn.encode(o.x,$E);a[0]=u.high,c[0]=u.low,u=wn.encode(o.y,$E),a[1]=u.high,c[1]=u.low,u=wn.encode(r.y,$E),a[2]=u.high,c[2]=u.low,u=wn.encode(s.x,$E),a[3]=u.high,c[3]=u.low,n.planes2D_HIGH=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:a}),n.planes2D_LOW=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:c})}const J2e=new B,Q2e=new B,Ck=new d,Z2e=new Ae,e3e=[new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae];function t3e(e,t,n,i,o,r){const s=_e.center(e,Z2e);s.height=n;const a=Ae.toCartesian(s,t,Ck),c=tn.eastNorthUpToFixedFrame(a,t,J2e),u=B.inverse(c,Q2e),f=e.west,h=e.east,_=e.north,g=e.south,p=e3e;p[0].latitude=g,p[0].longitude=f,p[1].latitude=_,p[1].longitude=f,p[2].latitude=_,p[2].longitude=h,p[3].latitude=g,p[3].longitude=h;const y=(f+h)*.5,C=(_+g)*.5;p[4].latitude=g,p[4].longitude=y,p[5].latitude=_,p[5].longitude=y,p[6].latitude=C,p[6].longitude=f,p[7].latitude=C,p[7].longitude=h;let T=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=Ae.toCartesian(p[R],t,Ck);B.multiplyByPoint(u,F,F),F.z=0,T=Math.min(T,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=T,P.y=w,P.z=0,B.multiplyByPoint(c,P,P);const O=o;O.x=E,O.y=w,O.z=0,B.multiplyByPoint(c,O,O),d.subtract(O,P,o);const z=r;z.x=T,z.y=S,z.z=0,B.multiplyByPoint(c,z,z),d.subtract(z,P,r)}const n3e=new d,i3e=new d,o3e=new wn;is.getPlanarTextureCoordinateAttributes=function(e,t,n,i,o){b.typeOf.object("boundingRectangle",e),b.defined("textureCoordinateRotationPoints",t),b.typeOf.object("ellipsoid",n),b.typeOf.object("projection",i);const r=p$,s=n3e,a=i3e;t3e(e,n,A(o,0),r,s,a);const c={};d$(c,t);const u=wn.fromCartesian(r,o3e);return c.southWest_HIGH=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.high,[0,0,0])}),c.southWest_LOW=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(u.low,[0,0,0])}),c.eastward=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(s,[0,0,0])}),c.northward=new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:3,normalize:!1,value:d.pack(a,[0,0,0])}),m$(e,i,c),c};const r3e=new d;function Tk(e,t,n,i){const o=h$;o.latitude=e,o.longitude=t,o.height=0;const r=Ae.toCartesian(o,n,r3e),s=Math.sqrt(r.x*r.x+r.y*r.y),a=N.fastApproximateAtan2(s,r.z),c=N.fastApproximateAtan2(r.x,r.y);return i.x=a,i.y=c,i}const bk=new j;is.getSphericalExtentGeometryInstanceAttributes=function(e,t,n,i){b.typeOf.object("boundingRectangle",e),b.defined("textureCoordinateRotationPoints",t),b.typeOf.object("ellipsoid",n),b.typeOf.object("projection",i);const o=Tk(e.south,e.west,n,bk);let r=o.x,s=o.y;const a=Tk(e.north,e.east,n,bk);let c=a.x,u=a.y,f=0;s>u&&(f=N.PI-s,s=-N.PI,u+=f),r-=N.EPSILON5,s-=N.EPSILON5,c+=N.EPSILON5,u+=N.EPSILON5;const h=1/(u-s),_=1/(c-r),g={sphericalExtents:new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,value:[r,s,_,h]}),longitudeRotation:new Ll({componentDatatype:ee.FLOAT,componentsPerAttribute:1,normalize:!1,value:[f]})};return d$(g,t),m$(e,i,g),g};is.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)};is.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 s3e(e){return Math.max(e.width,e.height)>is.MAX_WIDTH_FOR_PLANAR_EXTENTS}is.shouldUseSphericalCoordinates=function(e){return b.typeOf.object("rectangle",e),s3e(e)};is.MAX_WIDTH_FOR_PLANAR_EXTENTS=N.toRadians(1);function Dp(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,go.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(Dp.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}}});Dp.isSupported=function(e){return e.context.stencilBuffer};function Kg(e,t){const n=t?ri.EQUAL:ri.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:e,frontFunction:n,frontOperation:{fail:ht.KEEP,zFail:ht.DECREMENT_WRAP,zPass:ht.KEEP},backFunction:n,backOperation:{fail:ht.KEEP,zFail:ht.INCREMENT_WRAP,zPass:ht.KEEP},reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Jm.LESS_OR_EQUAL},depthMask:!1}}function mB(e){return{stencilTest:{enabled:e,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND}}const a3e={stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function c3e(e,t,n,i){if(l(e._rsStencilDepthPass))return;const o=!e.debugShowShadowVolume;e._rsStencilDepthPass=Qe.fromCache(Kg(o,!1)),e._rsStencilDepthPass3DTiles=Qe.fromCache(Kg(o,!0)),e._rsColorPass=Qe.fromCache(mB(o)),e._rsPickPass=Qe.fromCache(a3e)}function l3e(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=Ge.replaceMain(s,"czm_non_compressed_main");const a=`void main()
{
${r} czm_non_compressed_main();
}`;return[i,o,s,a].join(`
`)}}function u3e(e,t){const n=t.context,i=e._primitive;let o=CAe;o=e._primitive._batchTable.getVertexShaderCallback()(o),o=Wt._appendDistanceDisplayConditionToShader(i,o),o=Wt._modifyShaderPosition(e,o,t.scene3DOnly),o=Wt._updateColorAttribute(i,o);const r=e._hasPlanarExtentsAttributes,s=r||e._hasSphericalExtentsAttribute;e._extruded&&(o=l3e(i,o));const a=e._extruded?"EXTRUDED_GEOMETRY":"";let c=new Ge({defines:[a],sources:[o]});const u=new Ge({sources:[xL]}),f=e._primitive._attributeLocations,h=new is(s,r,e.appearance);if(e._spStencil=hn.replaceCache({context:n,shaderProgram:e._spStencil,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f}),e._primitive.allowPicking){let p=Ge.createPickVertexShaderSource(o);p=Wt._appendShowToShader(i,p),p=Wt._updatePickColorAttribute(p);const y=h.createPickFragmentShader(!1),C=h.createPickVertexShader([a],p,!1,t.mapProjection);if(e._spPick=hn.replaceCache({context:n,shaderProgram:e._spPick,vertexShaderSource:C,fragmentShaderSource:y,attributeLocations:f}),s){let T=n.shaderCache.getDerivedShaderProgram(e._spPick,"2dPick");if(!l(T)){const E=h.createPickFragmentShader(!0),w=h.createPickVertexShader([a],p,!0,t.mapProjection);T=n.shaderCache.createDerivedShaderProgram(e._spPick,"2dPick",{vertexShaderSource:w,fragmentShaderSource:E,attributeLocations:f})}e._spPick2D=T}}else e._spPick=hn.fromCache({context:n,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});o=Wt._appendShowToShader(i,o),c=new Ge({defines:[a],sources:[o]}),e._sp=hn.replaceCache({context:n,shaderProgram:e._sp,vertexShaderSource:c,fragmentShaderSource:u,attributeLocations:f});const _=h.createFragmentShader(!1),g=h.createVertexShader([a],o,!1,t.mapProjection);if(e._spColor=hn.replaceCache({context:n,shaderProgram:e._spColor,vertexShaderSource:g,fragmentShaderSource:_,attributeLocations:f}),s){let p=n.shaderCache.getDerivedShaderProgram(e._spColor,"2dColor");if(!l(p)){const y=h.createFragmentShader(!0),C=h.createVertexShader([a],o,!0,t.mapProjection);p=n.shaderCache.createDerivedShaderProgram(e._spColor,"2dColor",{vertexShaderSource:C,fragmentShaderSource:y,attributeLocations:f})}e._spColor2D=p}}function f3e(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 dt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsStencilDepthPass,r.shaderProgram=e._sp,r.uniformMap=c,r.pass=Be.TERRAIN_CLASSIFICATION,s=dt.shallowClone(r,r.derivedCommands.tileset),s.renderState=e._rsStencilDepthPass3DTiles,s.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,r=t[o+1],l(r)||(r=t[o+1]=new dt({owner:e,primitiveType:n._primitiveType})),r.vertexArray=g,r.renderState=e._rsColorPass,r.shaderProgram=e._spColor,r.pass=Be.TERRAIN_CLASSIFICATION;const y=e.appearance.material;if(l(y)&&(c=sn(c,y._uniforms)),r.uniformMap=c,s=dt.shallowClone(r,r.derivedCommands.tileset),s.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,r.derivedCommands.tileset=s,u){let C=dt.shallowClone(r,r.derivedCommands.appearance2D);C.shaderProgram=e._spColor2D,r.derivedCommands.appearance2D=C,C=dt.shallowClone(s,s.derivedCommands.appearance2D),C.shaderProgram=e._spColor2D,s.derivedCommands.appearance2D=C}}const f=e._commandsIgnoreShow,h=e._spStencil;let _=0;i=f.length=i/2;for(let g=0;g<i;++g){const p=f[g]=dt.shallowClone(t[_],f[g]);p.shaderProgram=h,p.pass=Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,_+=2}}function d3e(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,f,h=0;const _=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 dt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsStencilDepthPass,u.shaderProgram=e._sp,u.uniformMap=_,u.pass=Be.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=dt.shallowClone(u,u.derivedCommands.tileset),f.renderState=e._rsStencilDepthPass3DTiles,f.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,u=t[c+1],l(u)||(u=t[c+1]=new dt({owner:e,primitiveType:i._primitiveType,pickOnly:!0})),u.vertexArray=p,u.renderState=e._rsPickPass,u.shaderProgram=e._spPick,u.uniformMap=_,u.pass=Be.TERRAIN_CLASSIFICATION,n&&(u.offset=a.offset,u.count=a.count),f=dt.shallowClone(u,u.derivedCommands.tileset),f.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,u.derivedCommands.tileset=f,g){let y=dt.shallowClone(u,u.derivedCommands.pick2D);y.shaderProgram=e._spPick2D,u.derivedCommands.pick2D=y,y=dt.shallowClone(f,f.derivedCommands.pick2D),y.shaderProgram=e._spPick2D,f.derivedCommands.pick2D=y}}}function h3e(e,t,n,i,o,r,s){f3e(e,r),d3e(e,s)}function Ek(e,t){return Math.floor(e%t/2)}function jP(e,t,n,i,o,r){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,e.debugShowBoundingVolume=r,t.commandList.push(e)}function xk(e,t,n,i,o){e.modelMatrix=n,e.boundingVolume=o,e.cull=i,t.commandList.push(e)}function p3e(e,t,n,i,o,r,s,a){const c=e._primitive;Wt._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 f=e.classificationType,h=f!==go.CESIUM_3D_TILE,_=f!==go.TERRAIN,g=t.passes;let p,y,C;if(g.render){const T=n.length;for(p=0;p<T;++p)y=u[Ek(p,T)],h&&(C=n[p],jP(C,t,o,r,y,s)),_&&(C=n[p].derivedCommands.tileset,jP(C,t,o,r,y,s));if(t.invertClassification){const E=e._commandsIgnoreShow,w=E.length;for(p=0;p<w;++p)y=u[p],C=E[p],jP(C,t,o,r,y,s)}}if(g.pick){const T=i.length,E=c._pickOffsets;for(p=0;p<T;++p){const w=E[Ek(p,T)];y=u[w.index],h&&(C=i[p],xk(C,t,o,r,y)),_&&(C=i[p].derivedCommands.tileset,xk(C,t,o,r,y))}}}Dp.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,f=!0,h,_=!1,g=!1;for(r>0&&(c=o[0].attributes,_=is.hasAttributesForSphericalExtents(c),g=is.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.");f=f&&l(y)&&an.equals(h,y)}if(!f&&!_&&!g)throw new x("All GeometryInstances must have the same color attribute except via GroundPrimitives");if(u&&!l(t)&&(t=new _n({flat:!0}),this.appearance=t),!u&&t instanceof _n)throw new x("PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances");if(l(t.material)&&!_&&!g)throw new x("Materials on ClassificationPrimitives are not supported except via GroundPrimitives");this._usePickOffsets=!_&&!g,this._hasSphericalExtentsAttribute=_,this._hasPlanarExtentsAttributes=g,this._hasPerColorAttribute=u;const p=new Array(r);for(s=0;s<r;++s)a=o[s],p[s]=new nn({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,C){n._createBoundingVolumeFunction(y,C)}),i._createRenderStatesFunction=function(y,C,T,E){c3e(n)},i._createShaderProgramFunction=function(y,C,T){u3e(n,C)},i._createCommandsFunction=function(y,C,T,E,w,S,P){h3e(n,void 0,void 0,!0,!1,S,P)},l(this._updateAndQueueCommandsFunction)?i._updateAndQueueCommandsFunction=function(y,C,T,E,w,S,P,O){n._updateAndQueueCommandsFunction(y,C,T,E,w,S,P,O)}:i._updateAndQueueCommandsFunction=function(y,C,T,E,w,S,P,O){p3e(n,C,T,E,w,S,P)},this._primitive=new Wt(i)}if(this.debugShowShadowVolume&&!this._debugShowShadowVolume&&this._ready?(this._debugShowShadowVolume=!0,this._rsStencilDepthPass=Qe.fromCache(Kg(!1,!1)),this._rsStencilDepthPass3DTiles=Qe.fromCache(Kg(!1,!0)),this._rsColorPass=Qe.fromCache(mB(!1))):!this.debugShowShadowVolume&&this._debugShowShadowVolume&&(this._debugShowShadowVolume=!1,this._rsStencilDepthPass=Qe.fromCache(Kg(!0,!1)),this._rsStencilDepthPass3DTiles=Qe.fromCache(Kg(!0,!0)),this._rsColorPass=Qe.fromCache(mB(!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 _n)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()})};Dp.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Dp.prototype.isDestroyed=function(){return!1};Dp.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,Ue(this)};const m3e={u_globeMinimumAltitude:function(){return 55e3}};function Fr(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 _n({flat:!0});break}}}this.appearance=t,this.geometryInstances=e.geometryInstances,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,go.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=Qi._defaultMaxTerrainHeight,this._minTerrainHeight=Qi._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:m3e}}Object.defineProperties(Fr.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}}});Fr.isSupported=Dp.isSupported;function wk(e){return function(t,n){const i=n.maximumRadius,o=i/Math.cos(t*.5)-i;return e._maxHeight+o}}function Sk(e){return function(t,n){return e._minHeight}}const _3e=new d,g3e=new d,y3e=new d,A3e=new Ae,C3e=new _e;function Cw(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 _=d.unpack(i,h,_3e),g=d.unpack(o,h,g3e),p=d.add(_,g,y3e),y=n.cartesianToCartographic(p,A3e),C=y.latitude,T=y.longitude;s=Math.min(s,C),a=Math.min(a,T),c=Math.max(c,C),u=Math.max(u,T)}const f=C3e;return f.north=c,f.south=s,f.east=u,f.west=a,f}function T3e(e,t,n){const i=Qi.getMinimumMaximumHeights(t,n);e._minTerrainHeight=i.minimumTerrainHeight,e._maxTerrainHeight=i.maximumTerrainHeight}function b3e(e,t,n){const i=t.mapProjection.ellipsoid,o=Cw(t,n),r=Bt.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);d.fromElements(a.center.z,a.center.x,a.center.y,a.center),e._boundingVolumes2D.push(a)}}function qP(e,t){return Math.floor(e%t/2)}function YP(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 vk(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 E3e(e,t,n,i,o,r,s,a){let c;t.mode===le.SCENE3D?c=e._boundingVolumes:c=e._boundingVolumes2D;const u=e.classificationType,f=u!==go.CESIUM_3D_TILE,h=u!==go.TERRAIN,_=t.passes,g=e._primitive;let p,y,C;if(_.render){const T=n.length;for(p=0;p<T;++p)y=c[qP(p,T)],f&&(C=n[p],YP(e,C,t,o,r,y,s)),h&&(C=n[p].derivedCommands.tileset,YP(e,C,t,o,r,y,s));if(t.invertClassification){const E=g._commandsIgnoreShow,w=E.length;for(p=0;p<w;++p)y=c[p],C=E[p],YP(e,C,t,o,r,y,s)}}if(_.pick){const T=i.length;let E;for(e._useFragmentCulling||(E=g._primitive._pickOffsets),p=0;p<T;++p){if(y=c[qP(p,T)],!e._useFragmentCulling){const w=E[qP(p,T)];y=c[w.index]}f&&(C=i[p],vk(e,C,t,o,r,y)),h&&(C=i[p].derivedCommands.tileset,vk(e,C,t,o,r,y))}}}Fr.initializeTerrainHeights=function(){return Qi.initialize()};Fr.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!Qi.initialized){if(!this.asynchronous)throw new x("For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve.");Fr.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 f,h;for(f=0;f<c;++f){o=a[f],r=o.geometry;const y=Cw(e,r);l(h)?l(y)&&_e.union(h,y,h):h=_e.clone(y);const C=o.id;if(l(C)&&l(y)){const T=Qi.getBoundingSphere(y,i);this._boundingSpheresKeys.push(C),this._boundingSpheres.push(T)}if(s=r.constructor,!l(s)||!l(s.createShadowVolume))throw new x("Not all of the geometry instances have GroundPrimitive support.")}T3e(this,h,i);const _=e.terrainExaggeration,g=e.terrainExaggerationRelativeHeight;this._minHeight=Wh.getHeight(this._minTerrainHeight,_,g),this._maxHeight=Wh.getHeight(this._maxTerrainHeight,_,g);const p=Fr._supportsMaterials(e.context);if(this._useFragmentCulling=p,p){let y,C=!0;for(f=0;f<c;++f)if(o=a[f],r=o.geometry,h=Cw(e,r),is.shouldUseSphericalCoordinates(h)){C=!1;break}for(f=0;f<c;++f){o=a[f],r=o.geometry,s=r.constructor;const T=Cw(e,r),E=r.textureCoordinateRotationPoints;C?y=is.getPlanarTextureCoordinateAttributes(T,E,i,e.mapProjection,this._maxHeight):y=is.getSphericalExtentGeometryInstanceAttributes(T,E,i,e.mapProjection);const w=o.attributes;for(const S in w)w.hasOwnProperty(S)&&(y[S]=w[S]);u[f]=new nn({geometry:s.createShadowVolume(r,Sk(this),wk(this)),attributes:y,id:o.id})}}else for(f=0;f<c;++f)o=a[f],r=o.geometry,s=r.constructor,u[f]=new nn({geometry:s.createShadowVolume(r,Sk(this),wk(this)),attributes:o.attributes,id:o.id});n.geometryInstances=u,n.appearance=this.appearance,n._createBoundingVolumeFunction=function(y,C){b3e(t,y,C)},n._updateAndQueueCommandsFunction=function(y,C,T,E,w,S,P,O){E3e(t,C,T,E,w,S,P)},this._primitive=new Dp(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()})};Fr.prototype.getBoundingSphere=function(e){const t=this._boundingSpheresKeys.indexOf(e);if(t!==-1)return this._boundingSpheres[t]};Fr.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};Fr.prototype.isDestroyed=function(){return!1};Fr.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Ue(this)};Fr._supportsMaterials=function(e){return e.depthTexture};Fr.supportsMaterials=function(e){return b.typeOf.object("scene",e),Fr._supportsMaterials(e.frameState.context)};function Ar(){x.throwInstantiationError()}Object.defineProperties(Ar.prototype,{isConstant:{get:x.throwInstantiationError},definitionChanged:{get:x.throwInstantiationError}});Ar.prototype.getType=x.throwInstantiationError;Ar.prototype.getValue=x.throwInstantiationError;Ar.prototype.equals=x.throwInstantiationError;Ar.getValue=function(e,t,n){let i;return l(t)&&(i=t.getType(e),l(i))?((!l(n)||n.type!==i)&&(n=Fe.fromType(i)),t.getValue(e,n.uniforms),n):((!l(n)||n.type!==Fe.ColorType)&&(n=Fe.fromType(Fe.ColorType)),U.clone(U.WHITE,n.uniforms.color),n)};function si(e,t,n){b.defined("geometryUpdater",e),b.defined("primitives",t),b.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}si.prototype._isHidden=function(e,t,n){return!e.isShowing||!e.isAvailable(n)||!Z.getValueOrDefault(t.show,n,!0)};si.prototype._setOptions=x.throwInstantiationError;si.prototype.update=function(e){b.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,f=u instanceof Jt;let h;const _=t._getIsClosed(c);if(f)h=new _n({closed:_,flat:n&&!t._supportsMaterialsforEntitiesOnTerrain});else{const g=Ar.getValue(e,u,this._material);this._material=g,h=new Ho({material:g,translucent:g.isTranslucent(),closed:_})}if(n)c.vertexFormat=_n.VERTEX_FORMAT,this._primitive=o.add(new Fr({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);f&&(h.translucent=g.attributes.color.value[3]!==255),this._primitive=i.add(new Wt({geometryInstances:g,appearance:h,asynchronous:!1,shadows:a}))}}if(!n&&l(s.outline)&&s.outline.getValue(e)){const u=this._geometryUpdater.createOutlineGeometryInstance(e),f=Z.getValueOrDefault(s.outlineWidth,e,1);this._outlinePrimitive=i.add(new Wt({geometryInstances:u,appearance:new _n({flat:!0,translucent:u.attributes.color.value[3]!==255,renderState:{lineWidth:t._scene.clampLineWidth(f)}}),asynchronous:!1,shadows:a}))}};si.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),pt.DONE):l(n)&&!n.ready||l(i)&&!i.ready?pt.PENDING:pt.FAILED};si.prototype.isDestroyed=function(){return!1};si.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),Ue(this)};const x3e={NONE:0,GEODESIC:1,RHUMB:2},xn=Object.freeze(x3e),Dk=N.EPSILON10;function Zs(e,t,n,i){if(b.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,f=0,h=-1;for(s=1;s<r;++s)c=e[s],t(a,c,Dk)?(l(u)||(u=e.slice(0,s),f=s-1,h=0),o&&i.push(s)):(l(u)&&(u.push(c),f=s,o&&(h=i.length)),a=c);return n&&t(e[0],e[r-1],Dk)&&(o&&(l(u)?i.splice(h,0,f):i.push(r-1)),l(u)?u.length-=1:u=e.slice(0,-1)),l(u)?u:e}const LM=[jo,Zn],w3e=LM.length,_$=Math.cos(N.toRadians(30)),Ik=Math.cos(N.toRadians(150)),g$=0,y$=1e3;function pd(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!==xn.GEODESIC&&e.arcType!==xn.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,xn.GEODESIC),this._ellipsoid=pe.WGS84,this._projectionIndex=0,this._workerName="createGroundPolylineGeometry",this._scene3DOnly=!1}Object.defineProperties(pd.prototype,{packedLength:{get:function(){return 1+this._positions.length*3+1+1+1+pe.packedLength+1+1}}});pd.setProjectionAndEllipsoid=function(e,t){let n=0;for(let i=0;i<w3e;i++)if(t instanceof LM[i]){n=i;break}e._projectionIndex=n,e._ellipsoid=t.ellipsoid};const S3e=new d,Pk=new d,Ok=new d;function _B(e,t,n,i,o){const r=fa(i,e,0,S3e),s=fa(i,e,n,Pk),a=fa(i,t,0,Ok),c=md(s,r,Pk),u=md(a,r,Ok);return d.cross(u,c,o),d.normalize(o,o)}const v3e=new Ae,D3e=new d,I3e=new d,P3e=new d;function $P(e,t,n,i,o,r,s,a,c,u,f){if(o===0)return;let h;r===xn.GEODESIC?h=new vd(e,t,s):r===xn.RHUMB&&(h=new ns(e,t,s));const _=h.surfaceDistance;if(_<o)return;const g=_B(e,t,i,s,P3e),p=Math.ceil(_/o),y=_/p;let C=y;const T=p-1;let E=a.length;for(let w=0;w<T;w++){const S=h.interpolateUsingSurfaceDistance(C,v3e),P=fa(s,S,n,D3e),O=fa(s,S,i,I3e);d.pack(g,a,E),d.pack(P,c,E),d.pack(O,u,E),f.push(S.latitude),f.push(S.longitude),E+=3,C+=y}}const XP=new Ae;function fa(e,t,n,i){return Ae.clone(t,XP),XP.height=n,Ae.toCartesian(XP,e,i)}pd.pack=function(e,t,n){b.typeOf.object("value",e),b.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];d.pack(a,t,i),i+=3}return t[i++]=e.granularity,t[i++]=e.loop?1:0,t[i++]=e.arcType,pe.pack(e._ellipsoid,t,i),i+=pe.packedLength,t[i++]=e._projectionIndex,t[i++]=e._scene3DOnly?1:0,t};pd.unpack=function(e,t,n){b.defined("array",e);let i=A(t,0);const o=e[i++],r=new Array(o);for(let _=0;_<o;_++)r[_]=d.unpack(e,i),i+=3;const s=e[i++],a=e[i++]===1,c=e[i++],u=pe.unpack(e,i);i+=pe.packedLength;const f=e[i++],h=e[i++]===1;return l(n)||(n=new pd({positions:r})),n._positions=r,n.granularity=s,n.loop=a,n.arcType=c,n._ellipsoid=u,n._projectionIndex=f,n._scene3DOnly=h,n};function md(e,t,n){return d.subtract(e,t,n),d.normalize(n,n),n}function Lk(e,t,n,i){return i=md(e,t,i),i=d.cross(i,n,i),i=d.normalize(i,i),i=d.cross(n,i,i),i}const O3e=new d,L3e=new d,B3e=new d,A$=new d,R3e=0,N3e=-1;function KP(e,t,n,i,o){const r=md(n,t,A$),s=Lk(e,t,r,O3e),a=Lk(i,t,r,L3e);if(N.equalsEpsilon(d.dot(s,a),N3e,N.EPSILON5))return o=d.cross(r,s,o),o=d.normalize(o,o),o;o=d.add(a,s,o),o=d.normalize(o,o);const c=d.cross(r,o,B3e);return d.dot(a,c)<R3e&&(o=d.negate(o,o)),o}const bS=St.fromPointNormal(d.ZERO,d.UNIT_Y),M3e=new d,F3e=new d,z3e=new d,U3e=new d,H3e=new d,XE=new d,KE=new Ae,Bk=new Ae,Rk=new Ae;pd.createGeometry=function(e){const t=!e._scene3DOnly;let n=e.loop;const i=e._ellipsoid,o=e.granularity,r=e.arcType,s=new LM[e._projectionIndex](i),a=g$,c=y$;let u,f;const h=e._positions,_=h.length;_===2&&(n=!1);let g,p,y,C;const T=new ns(void 0,void 0,i);let E,w,S;const P=[h[0]];for(f=0;f<_-1;f++)g=h[f],p=h[f+1],E=nr.lineSegmentPlane(g,p,bS,XE),l(E)&&!d.equalsEpsilon(E,g,N.EPSILON7)&&!d.equalsEpsilon(E,p,N.EPSILON7)&&(e.arcType===xn.GEODESIC?P.push(d.clone(E)):e.arcType===xn.RHUMB&&(S=i.cartesianToCartographic(E,KE).longitude,y=i.cartesianToCartographic(g,KE),C=i.cartesianToCartographic(p,Bk),T.setEndPoints(y,C),w=T.findIntersectionWithLongitude(S,Rk),E=i.cartographicToCartesian(w,XE),l(E)&&!d.equalsEpsilon(E,g,N.EPSILON7)&&!d.equalsEpsilon(E,p,N.EPSILON7)&&P.push(d.clone(E)))),P.push(p);n&&(g=h[_-1],p=h[0],E=nr.lineSegmentPlane(g,p,bS,XE),l(E)&&!d.equalsEpsilon(E,g,N.EPSILON7)&&!d.equalsEpsilon(E,p,N.EPSILON7)&&(e.arcType===xn.GEODESIC?P.push(d.clone(E)):e.arcType===xn.RHUMB&&(S=i.cartesianToCartographic(E,KE).longitude,y=i.cartesianToCartographic(g,KE),C=i.cartesianToCartographic(p,Bk),T.setEndPoints(y,C),w=T.findIntersectionWithLongitude(S,Rk),E=i.cartographicToCartesian(w,XE),l(E)&&!d.equalsEpsilon(E,g,N.EPSILON7)&&!d.equalsEpsilon(E,p,N.EPSILON7)&&P.push(d.clone(E)))));let O=P.length,z=new Array(O);for(f=0;f<O;f++){const q=Ae.fromCartesian(P[f],i);q.height=0,z[f]=q}if(z=Zs(z,Ae.equalsEpsilon),O=z.length,O<2)return;const R=[],F=[],H=[],v=[];let I=M3e,m=F3e,D=z3e,L=U3e,M=H3e;const V=z[0],k=z[1],W=z[O-1];for(I=fa(i,W,a,I),L=fa(i,k,a,L),m=fa(i,V,a,m),D=fa(i,V,c,D),n?M=KP(I,m,D,L,M):M=_B(V,k,c,i,M),d.pack(M,F,0),d.pack(m,H,0),d.pack(D,v,0),R.push(V.latitude),R.push(V.longitude),$P(V,k,a,c,o,r,i,F,H,v,R),f=1;f<O-1;++f){I=d.clone(m,I),m=d.clone(L,m);const q=z[f];fa(i,q,c,D),fa(i,z[f+1],a,L),KP(I,m,D,L,M),u=F.length,d.pack(M,F,u),d.pack(m,H,u),d.pack(D,v,u),R.push(q.latitude),R.push(q.longitude),$P(z[f],z[f+1],a,c,o,r,i,F,H,v,R)}const G=z[O-1],K=z[O-2];if(m=fa(i,G,a,m),D=fa(i,G,c,D),n){const q=z[0];I=fa(i,K,a,I),L=fa(i,q,a,L),M=KP(I,m,D,L,M)}else M=_B(K,G,c,i,M);if(u=F.length,d.pack(M,F,u),d.pack(m,H,u),d.pack(D,v,u),R.push(G.latitude),R.push(G.longitude),n){for($P(G,V,a,c,o,r,i,F,H,v,R),u=F.length,f=0;f<3;++f)F[u+f]=F[f],H[u+f]=H[f],v[u+f]=v[f];R.push(V.latitude),R.push(V.longitude)}return dze(n,s,H,v,F,R,t)};const V3e=new d,k3e=new J,G3e=new Ce;function Nk(e,t,n,i){const o=md(n,t,V3e),r=d.dot(o,e);if(r>_$||r<Ik){const s=md(i,n,A$),a=r<Ik?N.PI_OVER_TWO:-N.PI_OVER_TWO,c=Ce.fromAxisAngle(s,a,G3e),u=J.fromQuaternion(c,k3e);return J.multiplyByVector(u,e,e),!0}return!1}const Mk=new Ae,W3e=new d,Fk=new d;function UA(e,t,n,i,o){const r=Ae.toCartesian(t,e._ellipsoid,W3e);let s=d.add(r,n,Fk),a=!1;const c=e._ellipsoid;let u=c.cartesianToCartographic(s,Mk);Math.abs(t.longitude-u.longitude)>N.PI_OVER_TWO&&(a=!0,s=d.subtract(r,n,Fk),u=c.cartesianToCartographic(s,Mk)),u.height=0;const f=e.project(u,o);return o=d.subtract(f,i,o),o.z=0,o=d.normalize(o,o),a&&d.negate(o,o),o}const j3e=new d,zk=new d;function Uk(e,t,n,i,o,r){const s=d.subtract(t,e,j3e);d.normalize(s,s);const a=n-g$;let c=d.multiplyByScalar(s,a,zk);d.add(e,c,o);const u=i-y$;c=d.multiplyByScalar(s,u,zk),d.add(t,c,r)}const q3e=new d;function JE(e,t){const n=St.getPointDistance(bS,e),i=St.getPointDistance(bS,t);let o=q3e;N.equalsEpsilon(n,0,N.EPSILON2)?(o=md(t,e,o),d.multiplyByScalar(o,N.EPSILON2,o),d.add(e,o,e)):N.equalsEpsilon(i,0,N.EPSILON2)&&(o=md(e,t,o),d.multiplyByScalar(o,N.EPSILON2,o),d.add(t,o,t))}function Y3e(e,t){const n=Math.abs(e.longitude),i=Math.abs(t.longitude);if(N.equalsEpsilon(n,N.PI,N.EPSILON11)){const o=N.sign(t.longitude);return e.longitude=o*(n-N.EPSILON11),1}else if(N.equalsEpsilon(i,N.PI,N.EPSILON11)){const o=N.sign(e.longitude);return t.longitude=o*(i-N.EPSILON11),2}return 0}const C$=new Ae,T$=new Ae,Hk=new d,JP=new d,Vk=new d,kk=new d,$3e=new d,Gk=new d,X3e=[C$,T$],K3e=new _e,J3e=new d,Q3e=new d,Z3e=new d,eze=new d,tze=new d,nze=new d,QP=new d,ZP=new d,ize=new d,oze=new d,rze=new d,Wk=new d,sze=new d,aze=new d,cze=new wn,lze=new wn,jk=new d,uze=new d,qk=new d,fze=[new fe,new fe],b$=[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=b$.length;function dze(e,t,n,i,o,r,s){let a,c;const u=t._ellipsoid,f=n.length/3-1,h=f*8,_=h*4,g=f*36,p=h>65535?new Uint32Array(g):new Uint16Array(g),y=new Float64Array(h*3),C=new Float32Array(_),T=new Float32Array(_),E=new Float32Array(_),w=new Float32Array(_),S=new Float32Array(_);let P,O,z,R;s&&(P=new Float32Array(_),O=new Float32Array(_),z=new Float32Array(_),R=new Float32Array(h*2));const F=r.length/2;let H=0;const v=C$;v.height=0;const I=T$;I.height=0;let m=Hk,D=JP;if(s)for(c=0,a=1;a<F;a++)v.latitude=r[c],v.longitude=r[c+1],I.latitude=r[c+2],I.longitude=r[c+3],m=t.project(v,m),D=t.project(I,D),H+=d.distance(m,D),c+=2;const L=i.length/3;D=d.unpack(i,0,D);let M=0;for(c=3,a=1;a<L;a++)m=d.clone(D,m),D=d.unpack(i,c,D),M+=d.distance(m,D),c+=3;let V;c=3;let k=0,W=0,G=0,K=0,q=!1,te=d.unpack(n,0,kk),$=d.unpack(i,0,JP),X=d.unpack(o,0,Gk);if(e){const ie=d.unpack(n,n.length-6,Vk);Nk(X,ie,te,$)&&(X=d.negate(X,X))}let Y=0,ae=0,ue=0;for(a=0;a<f;a++){const ie=d.clone(te,Vk),de=d.clone($,Hk);let me=d.clone(X,$3e);q&&(me=d.negate(me,me)),te=d.unpack(n,c,kk),$=d.unpack(i,c,JP),X=d.unpack(o,c,Gk),q=Nk(X,ie,te,$),v.latitude=r[k],v.longitude=r[k+1],I.latitude=r[k+2],I.longitude=r[k+3];let Ee,xe,Pe,Te;if(s){const cn=Y3e(v,I);Ee=t.project(v,tze),xe=t.project(I,nze);const Vn=md(xe,Ee,jk);Vn.y=Math.abs(Vn.y),Pe=QP,Te=ZP,cn===0||d.dot(Vn,d.UNIT_Y)>_$?(Pe=UA(t,v,me,Ee,QP),Te=UA(t,I,X,xe,ZP)):cn===1?(Te=UA(t,I,X,xe,ZP),Pe.x=0,Pe.y=N.sign(v.longitude-Math.abs(I.longitude)),Pe.z=0):(Pe=UA(t,v,me,Ee,QP),Te.x=0,Te.y=N.sign(v.longitude-I.longitude),Te.z=0)}const Oe=d.distance(de,$),De=wn.fromCartesian(ie,cze),Me=d.subtract(te,ie,ize),ve=d.normalize(Me,Wk);let Ie=d.subtract(de,ie,oze);Ie=d.normalize(Ie,Ie);let Ve=d.cross(ve,Ie,Wk);Ve=d.normalize(Ve,Ve);let Le=d.cross(Ie,me,sze);Le=d.normalize(Le,Le);let _t=d.subtract($,te,rze);_t=d.normalize(_t,_t);let Tt=d.cross(X,_t,aze);Tt=d.normalize(Tt,Tt);const Ot=Oe/M,Tn=Y/M;let Sn=0,gn,on,Nt,yn=0,Cn=0;if(s){Sn=d.distance(Ee,xe),gn=wn.fromCartesian(Ee,lze),on=d.subtract(xe,Ee,jk),Nt=d.normalize(on,uze);const cn=Nt.x;Nt.x=Nt.y,Nt.y=-cn,yn=Sn/H,Cn=ae/H}for(V=0;V<8;V++){const cn=K+V*4,Vn=W+V*2,On=cn+3,rn=V<4?1:-1,gt=V===2||V===3||V===6||V===7?1:-1;d.pack(De.high,C,cn),C[On]=Me.x,d.pack(De.low,T,cn),T[On]=Me.y,d.pack(Le,E,cn),E[On]=Me.z,d.pack(Tt,w,cn),w[On]=Ot*rn,d.pack(Ve,S,cn);let ke=Tn*gt;ke===0&&gt<0&&(ke=9),S[On]=ke,s&&(P[cn]=gn.high.x,P[cn+1]=gn.high.y,P[cn+2]=gn.low.x,P[cn+3]=gn.low.y,z[cn]=-Pe.y,z[cn+1]=Pe.x,z[cn+2]=Te.y,z[cn+3]=-Te.x,O[cn]=on.x,O[cn+1]=on.y,O[cn+2]=Nt.x,O[cn+3]=Nt.y,R[Vn]=yn*rn,ke=Cn*gt,ke===0&&gt<0&&(ke=9),R[Vn+1]=ke)}const Ht=Z3e,Xt=eze,Mn=J3e,ti=Q3e,en=_e.fromCartographicArray(X3e,K3e),xi=Qi.getMinimumMaximumHeights(en,u),Yi=xi.minimumTerrainHeight,Pi=xi.maximumTerrainHeight;ue+=Yi,ue+=Pi,Uk(ie,de,Yi,Pi,Ht,Mn),Uk(te,$,Yi,Pi,Xt,ti);let Jn=d.multiplyByScalar(Ve,N.EPSILON5,qk);d.add(Ht,Jn,Ht),d.add(Xt,Jn,Xt),d.add(Mn,Jn,Mn),d.add(ti,Jn,ti),JE(Ht,Xt),JE(Mn,ti),d.pack(Ht,y,G),d.pack(Xt,y,G+3),d.pack(ti,y,G+6),d.pack(Mn,y,G+9),Jn=d.multiplyByScalar(Ve,-2*N.EPSILON5,qk),d.add(Ht,Jn,Ht),d.add(Xt,Jn,Xt),d.add(Mn,Jn,Mn),d.add(ti,Jn,ti),JE(Ht,Xt),JE(Mn,ti),d.pack(Ht,y,G+12),d.pack(Xt,y,G+15),d.pack(ti,y,G+18),d.pack(Mn,y,G+21),k+=2,c+=3,W+=16,G+=24,K+=32,Y+=Oe,ae+=Sn}c=0;let re=0;for(a=0;a<f;a++){for(V=0;V<Yk;V++)p[c+V]=b$[V]+re;re+=8,c+=Yk}const he=fze;fe.fromVertices(n,d.ZERO,3,he[0]),fe.fromVertices(i,d.ZERO,3,he[1]);const ce=fe.fromBoundingSpheres(he);ce.radius+=ue/(f*2);const Q={position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,normalize:!1,values:y}),startHiAndForwardOffsetX:rh(C),startLoAndForwardOffsetY:rh(T),startNormalAndForwardOffsetZ:rh(E),endNormalAndTextureCoordinateNormalizationX:rh(w),rightNormalAndTextureCoordinateNormalizationY:rh(S)};return s&&(Q.startHiLo2D=rh(P),Q.offsetAndRight2D=rh(O),Q.startEndNormals2D=rh(z),Q.texcoordNormalization2D=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,normalize:!1,values:R})),new Dt({attributes:Q,indices:p,boundingSphere:ce})}function rh(e){return new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:4,normalize:!1,values:e})}pd._projectNormal=UA;const hze=`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 gB=`${LT}
${hze}`;const pze=hq;un.isInternetExplorer()||(gB=`#define CLIP_POLYLINE
${gB}`);function Vs(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=Vs.VERTEX_FORMAT;this.material=void 0,this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,gB),this._fragmentShaderSource=A(e.fragmentShaderSource,pze),this._renderState=fr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(Vs.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}}});Vs.VERTEX_FORMAT=Ne.POSITION_ONLY;Vs.prototype.getFragmentShaderSource=fr.prototype.getFragmentShaderSource;Vs.prototype.isTranslucent=fr.prototype.isTranslucent;Vs.prototype.getRenderState=fr.prototype.getRenderState;const mze=`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 yB=`${LT}
${mze}`;const _ze=fj;un.isInternetExplorer()||(yB=`#define CLIP_POLYLINE
${yB}`);function _s(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.translucent,!0),n=!1,i=_s.VERTEX_FORMAT;this.material=l(e.material)?e.material:Fe.fromType(Fe.ColorType),this.translucent=t,this._vertexShaderSource=A(e.vertexShaderSource,yB),this._fragmentShaderSource=A(e.fragmentShaderSource,_ze),this._renderState=fr.getDefaultRenderState(t,n,e.renderState),this._closed=n,this._vertexFormat=i}Object.defineProperties(_s.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}}});_s.VERTEX_FORMAT=Ne.POSITION_AND_ST;_s.prototype.getFragmentShaderSource=fr.prototype.getFragmentShaderSource;_s.prototype.isTranslucent=fr.prototype.isTranslucent;_s.prototype.getRenderState=fr.prototype.getRenderState;function il(e){e=A(e,A.EMPTY_OBJECT),this.geometryInstances=e.geometryInstances,this._hasPerInstanceColors=!0;let t=e.appearance;l(t)||(t=new _s),this.appearance=t,this.show=A(e.show,!0),this.classificationType=A(e.classificationType,go.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=$k(!1),this._renderState3DTiles=$k(!0),this._renderStateMorph=Qe.fromCache({cull:{enabled:!0,face:Po.FRONT},depthTest:{enabled:!0},blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1})}Object.defineProperties(il.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}}});il.initializeTerrainHeights=function(){return Qi.initialize()};function gze(e,t,n){const i=t.context,o=e._primitive,r=o._attributeLocations;let s=o._batchTable.getVertexShaderCallback()(_Ae);s=Wt._appendShowToShader(o,s),s=Wt._appendDistanceDisplayConditionToShader(o,s),s=Wt._modifyShaderPosition(e,s,t.scene3DOnly);let a=o._batchTable.getVertexShaderCallback()(mAe);a=Wt._appendShowToShader(o,a),a=Wt._appendDistanceDisplayConditionToShader(o,a),a=Wt._modifyShaderPosition(e,a,t.scene3DOnly);let c=o._batchTable.getVertexShaderCallback()(hAe);const u=[`GLOBE_MINIMUM_ALTITUDE ${t.mapProjection.ellipsoid.minimumRadius.toFixed(1)}`];let f="",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")):f="PER_INSTANCE_COLOR",u.push(f);const _=e.debugShowShadowVolume?["DEBUG_SHOW_VOLUME",f]:[f],g=new Ge({defines:u,sources:[s]}),p=new Ge({defines:_,sources:[h,c]});e._sp=hn.replaceCache({context:i,shaderProgram:o._sp,vertexShaderSource:g,fragmentShaderSource:p,attributeLocations:r});let y=i.shaderCache.getDerivedShaderProgram(e._sp,"2dColor");if(!l(y)){const T=new Ge({defines:u.concat(["COLUMBUS_VIEW_2D"]),sources:[s]});y=i.shaderCache.createDerivedShaderProgram(e._sp,"2dColor",{context:i,shaderProgram:e._sp2D,vertexShaderSource:T,fragmentShaderSource:p,attributeLocations:r})}e._sp2D=y;let C=i.shaderCache.getDerivedShaderProgram(e._sp,"MorphColor");if(!l(C)){const T=new Ge({defines:u.concat([`MAX_TERRAIN_HEIGHT ${Qi._defaultMaxTerrainHeight.toFixed(1)}`]),sources:[a]});c=o._batchTable.getVertexShaderCallback()(pAe);const E=new Ge({defines:_,sources:[h,c]});C=i.shaderCache.createDerivedShaderProgram(e._sp,"MorphColor",{context:i,shaderProgram:e._spMorph,vertexShaderSource:T,fragmentShaderSource:E,attributeLocations:r})}e._spMorph=C}function $k(e){return Qe.fromCache({cull:{enabled:!0},blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:ri.EQUAL,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},backFunction:ri.EQUAL,backOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK}})}function yze(e,t,n,i,o,r){const s=e._primitive,a=s._va.length;o.length=a,r.length=a;const u=t instanceof Vs?{}:n._uniforms,f=s._batchTable.getUniformMapCallback()(u);for(let h=0;h<a;h++){const _=s._va[h];let g=o[h];l(g)||(g=o[h]=new dt({owner:e,primitiveType:s._primitiveType})),g.vertexArray=_,g.renderState=e._renderState,g.shaderProgram=e._sp,g.uniformMap=f,g.pass=Be.TERRAIN_CLASSIFICATION,g.pickId="czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";const p=dt.shallowClone(g,g.derivedCommands.tileset);p.renderState=e._renderState3DTiles,p.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,g.derivedCommands.tileset=p;const y=dt.shallowClone(g,g.derivedCommands.color2D);y.shaderProgram=e._sp2D,g.derivedCommands.color2D=y;const C=dt.shallowClone(p,p.derivedCommands.color2D);C.shaderProgram=e._sp2D,p.derivedCommands.color2D=C;const T=dt.shallowClone(g,g.derivedCommands.colorMorph);T.renderState=e._renderStateMorph,T.shaderProgram=e._spMorph,T.pickId="czm_batchTable_pickColor(v_batchId)",g.derivedCommands.colorMorph=T}}function Xk(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 Aze(e,t,n,i,o,r,s){const a=e._primitive;Wt._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,f=e.classificationType,h=f!==go.CESIUM_3D_TILE,_=f!==go.TERRAIN&&!u;let g;const p=t.passes;if(p.render||p.pick&&a.allowPicking){const y=n.length;for(let C=0;C<y;++C){const T=c[C];h&&(g=n[C],Xk(e,g,t,o,r,T,s)),_&&(g=n[C].derivedCommands.tileset,Xk(e,g,t,o,r,T,s))}}}il.prototype.update=function(e){if(!l(this._primitive)&&!l(this.geometryInstances))return;if(!Qi.initialized){if(!this.asynchronous)throw new x("For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve.");il.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 f in u)u.hasOwnProperty(f)&&(a[f]=u[f]);l(a.width)||(a.width=new Ll({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,value:[c.geometry.width]})),c.geometry._scene3DOnly=e.scene3DOnly,pd.setProjectionAndEllipsoid(c.geometry,e.mapProjection),s[t]=new nn({geometry:c.geometry,attributes:a,id:c.id,pickPrimitive:n})}i.geometryInstances=s,i.appearance=this.appearance,i._createShaderProgramFunction=function(c,u,f){gze(n,u,f)},i._createCommandsFunction=function(c,u,f,h,_,g,p){yze(n,u,f,h,g,p)},i._updateAndQueueCommandsFunction=function(c,u,f,h,_,g,p,y){Aze(n,u,f,h,_,g,p)},this._primitive=new Wt(i),this._primitive.readyPromise.then(this._completeLoad)}if(this.appearance instanceof Vs&&!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)};il.prototype.getGeometryInstanceAttributes=function(e){if(!l(this._primitive))throw new x("must call update before calling getGeometryInstanceAttributes");return this._primitive.getGeometryInstanceAttributes(e)};il.isSupported=function(e){return e.frameState.context.depthTexture};il.prototype.isDestroyed=function(){return!1};il.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,Ue(this)};const Cze=new j(1,1),Tze=!1,bze=U.WHITE;function Vy(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new $e,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(Vy.prototype,{isConstant:{get:function(){return Z.isConstant(this._image)&&Z.isConstant(this._repeat)}},definitionChanged:{get:function(){return this._definitionChanged}},image:ge("image"),repeat:ge("repeat"),color:ge("color"),transparent:ge("transparent")});Vy.prototype.getType=function(e){return"Image"};Vy.prototype.getValue=function(e,t){return l(t)||(t={}),t.image=Z.getValueOrUndefined(this._image,e),t.repeat=Z.getValueOrClonedDefault(this._repeat,e,Cze,t.repeat),t.color=Z.getValueOrClonedDefault(this._color,e,bze,t.color),Z.getValueOrDefault(this._transparent,e,Tze)&&(t.color.alpha=Math.min(.99,t.color.alpha)),t};Vy.prototype.equals=function(e){return this===e||e instanceof Vy&&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 Eze(e){if(e instanceof U)return new Jt(e);if(typeof e=="string"||e instanceof Re||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement){const t=new Vy;return t.image=e,t}throw new x(`Unable to infer material type: ${e}`)}function uc(e,t){return ge(e,t,Eze)}function XC(e){this._definitionChanged=new $e,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(XC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),dimensions:ge("dimensions"),heightReference:ge("heightReference"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});XC.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 XC(this)};XC.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 xze={FIXED:0,INERTIAL:1},ea=Object.freeze(xze);function Ip(){x.throwInstantiationError()}Object.defineProperties(Ip.prototype,{isConstant:{get:x.throwInstantiationError},definitionChanged:{get:x.throwInstantiationError},referenceFrame:{get:x.throwInstantiationError}});Ip.prototype.getValue=x.throwInstantiationError;Ip.prototype.getValueInReferenceFrame=x.throwInstantiationError;Ip.prototype.equals=x.throwInstantiationError;const eO=new J;Ip.convertToReferenceFrame=function(e,t,n,i,o){if(!l(t))return t;if(l(o)||(o=new d),n===i)return d.clone(t,o);let r=tn.computeIcrfToFixedMatrix(e,eO);if(l(r)||(r=tn.computeTemeToPseudoFixedMatrix(e,eO)),n===ea.INERTIAL)return J.multiplyByVector(r,t,o);if(n===ea.FIXED)return J.multiplyByVector(J.transpose(r,eO),t,o)};function _d(e,t){this._definitionChanged=new $e,this._value=d.clone(e),this._referenceFrame=A(t,ea.FIXED)}Object.defineProperties(_d.prototype,{isConstant:{get:function(){return!l(this._value)||this._referenceFrame===ea.FIXED}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){return this._referenceFrame}}});_d.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ea.FIXED,t)};_d.prototype.setValue=function(e,t){let n=!1;d.equals(this._value,e)||(n=!0,this._value=d.clone(e)),l(t)&&this._referenceFrame!==t&&(n=!0,this._referenceFrame=t),n&&this._definitionChanged.raiseEvent(this)};_d.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 Ip.convertToReferenceFrame(e,this._value,this._referenceFrame,t,n)};_d.prototype.equals=function(e){return this===e||e instanceof _d&&d.equals(this._value,e._value)&&this._referenceFrame===e._referenceFrame};function KC(e){this._definitionChanged=new $e,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(KC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),positions:ge("positions"),width:ge("width"),height:ge("height"),heightReference:ge("heightReference"),extrudedHeight:ge("extrudedHeight"),extrudedHeightReference:ge("extrudedHeightReference"),cornerType:ge("cornerType"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition"),classificationType:ge("classificationType"),zIndex:ge("zIndex")});KC.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 KC(this)};KC.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 wze(e){return e}function AB(e,t){return ge(e,t,wze)}function JC(e){this._definitionChanged=new $e,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(JC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),length:ge("length"),topRadius:ge("topRadius"),bottomRadius:ge("bottomRadius"),heightReference:ge("heightReference"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),numberOfVerticalLines:ge("numberOfVerticalLines"),slices:ge("slices"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});JC.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 JC(this)};JC.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 QC(e){this._definitionChanged=new $e,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(QC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),semiMajorAxis:ge("semiMajorAxis"),semiMinorAxis:ge("semiMinorAxis"),height:ge("height"),heightReference:ge("heightReference"),extrudedHeight:ge("extrudedHeight"),extrudedHeightReference:ge("extrudedHeightReference"),rotation:ge("rotation"),stRotation:ge("stRotation"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),numberOfVerticalLines:ge("numberOfVerticalLines"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition"),classificationType:ge("classificationType"),zIndex:ge("zIndex")});QC.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 QC(this)};QC.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 ZC(e){this._definitionChanged=new $e,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(ZC.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),radii:ge("radii"),innerRadii:ge("innerRadii"),minimumClock:ge("minimumClock"),maximumClock:ge("maximumClock"),minimumCone:ge("minimumCone"),maximumCone:ge("maximumCone"),heightReference:ge("heightReference"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),stackPartitions:ge("stackPartitions"),slicePartitions:ge("slicePartitions"),subdivisions:ge("subdivisions"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});ZC.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 ZC(this)};ZC.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 eT(e){this._definitionChanged=new $e,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(eT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),text:ge("text"),font:ge("font"),style:ge("style"),scale:ge("scale"),showBackground:ge("showBackground"),backgroundColor:ge("backgroundColor"),backgroundPadding:ge("backgroundPadding"),pixelOffset:ge("pixelOffset"),eyeOffset:ge("eyeOffset"),horizontalOrigin:ge("horizontalOrigin"),verticalOrigin:ge("verticalOrigin"),heightReference:ge("heightReference"),fillColor:ge("fillColor"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),translucencyByDistance:ge("translucencyByDistance"),pixelOffsetScaleByDistance:ge("pixelOffsetScaleByDistance"),scaleByDistance:ge("scaleByDistance"),distanceDisplayCondition:ge("distanceDisplayCondition"),disableDepthTestDistance:ge("disableDepthTestDistance")});eT.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 eT(this)};eT.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 Sze=new d(1,1,1),vze=d.ZERO,Dze=Ce.IDENTITY;function Xv(e,t,n){this.translation=d.clone(A(e,vze)),this.rotation=Ce.clone(A(t,Dze)),this.scale=d.clone(A(n,Sze))}Xv.prototype.equals=function(e){return this===e||l(e)&&d.equals(this.translation,e.translation)&&Ce.equals(this.rotation,e.rotation)&&d.equals(this.scale,e.scale)};const tO=new Xv;function tT(e){e=A(e,A.EMPTY_OBJECT),this._definitionChanged=new $e,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(tT.prototype,{isConstant:{get:function(){return Z.isConstant(this._translation)&&Z.isConstant(this._rotation)&&Z.isConstant(this._scale)}},definitionChanged:{get:function(){return this._definitionChanged}},translation:ge("translation"),rotation:ge("rotation"),scale:ge("scale")});tT.prototype.getValue=function(e,t){return l(t)||(t=new Xv),t.translation=Z.getValueOrClonedDefault(this._translation,e,tO.translation,t.translation),t.rotation=Z.getValueOrClonedDefault(this._rotation,e,tO.rotation,t.rotation),t.scale=Z.getValueOrClonedDefault(this._scale,e,tO.scale,t.scale),t};tT.prototype.equals=function(e){return this===e||e instanceof tT&&Z.equals(this._translation,e._translation)&&Z.equals(this._rotation,e._rotation)&&Z.equals(this._scale,e._scale)};function fc(e,t){this._propertyNames=[],this._definitionChanged=new $e,l(e)&&this.merge(e,t)}Object.defineProperties(fc.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}}});fc.prototype.hasProperty=function(e){return this._propertyNames.indexOf(e)!==-1};function Ize(e){return new Wo(e)}fc.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,ge(e,!0,A(n,Ize))),l(t)&&(this[e]=t),this._definitionChanged.raiseEvent(this)};fc.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)};fc.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};fc.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 Pze(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}fc.prototype.equals=function(e){return this===e||e instanceof fc&&Pze(this,e)};function E$(e){return new tT(e)}function Oze(e){return new fc(e,E$)}function Lze(e){return new fc(e)}function nT(e){this._definitionChanged=new $e,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(nT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),uri:ge("uri"),scale:ge("scale"),minimumPixelSize:ge("minimumPixelSize"),maximumScale:ge("maximumScale"),incrementallyLoadTextures:ge("incrementallyLoadTextures"),runAnimations:ge("runAnimations"),clampAnimations:ge("clampAnimations"),shadows:ge("shadows"),heightReference:ge("heightReference"),silhouetteColor:ge("silhouetteColor"),silhouetteSize:ge("silhouetteSize"),color:ge("color"),colorBlendMode:ge("colorBlendMode"),colorBlendAmount:ge("colorBlendAmount"),imageBasedLightingFactor:ge("imageBasedLightingFactor"),lightColor:ge("lightColor"),distanceDisplayCondition:ge("distanceDisplayCondition"),nodeTransformations:ge("nodeTransformations",void 0,Oze),articulations:ge("articulations",void 0,Lze),clippingPlanes:ge("clippingPlanes"),customShader:ge("customShader")});nT.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 nT(this)};nT.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 fc(t,E$)}const n=e.articulations;if(l(n)){const i=this.articulations;l(i)?i.merge(n):this.articulations=new fc(n)}};function iT(e){this._definitionChanged=new $e,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(iT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),uri:ge("uri"),maximumScreenSpaceError:ge("maximumScreenSpaceError")});iT.prototype.clone=function(e){return l(e)?(e.show=this.show,e.uri=this.uri,e.maximumScreenSpaceError=this.maximumScreenSpaceError,e):new iT(this)};iT.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 ky(e){this._definitionChanged=new $e,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(ky.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),leadTime:ge("leadTime"),trailTime:ge("trailTime"),width:ge("width"),resolution:ge("resolution"),material:uc("material"),distanceDisplayCondition:ge("distanceDisplayCondition")});ky.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 ky(this)};ky.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 oT(e){this._definitionChanged=new $e,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(oT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),plane:ge("plane"),dimensions:ge("dimensions"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});oT.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 oT(this)};oT.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 rT(e){this._definitionChanged=new $e,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(rT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),pixelSize:ge("pixelSize"),heightReference:ge("heightReference"),color:ge("color"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),scaleByDistance:ge("scaleByDistance"),translucencyByDistance:ge("translucencyByDistance"),distanceDisplayCondition:ge("distanceDisplayCondition"),disableDepthTestDistance:ge("disableDepthTestDistance")});rT.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 rT(this)};rT.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 Bze(e,t){this.positions=l(e)?e:[],this.holes=l(t)?t:[]}function Rze(e){return Array.isArray(e)&&(e=new Bze(e)),new Wo(e)}function sT(e){this._definitionChanged=new $e,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(sT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),hierarchy:ge("hierarchy",void 0,Rze),height:ge("height"),heightReference:ge("heightReference"),extrudedHeight:ge("extrudedHeight"),extrudedHeightReference:ge("extrudedHeightReference"),stRotation:ge("stRotation"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),perPositionHeight:ge("perPositionHeight"),closeTop:ge("closeTop"),closeBottom:ge("closeBottom"),arcType:ge("arcType"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition"),classificationType:ge("classificationType"),zIndex:ge("zIndex"),textureCoordinates:ge("textureCoordinates")});sT.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 sT(this)};sT.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 aT(e){this._definitionChanged=new $e,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(aT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),positions:ge("positions"),width:ge("width"),granularity:ge("granularity"),material:uc("material"),depthFailMaterial:uc("depthFailMaterial"),arcType:ge("arcType"),clampToGround:ge("clampToGround"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition"),classificationType:ge("classificationType"),zIndex:ge("zIndex")});aT.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 aT(this)};aT.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 cT(e){this._definitionChanged=new $e,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(cT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),positions:ge("positions"),shape:ge("shape"),cornerType:ge("cornerType"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});cT.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 cT(this)};cT.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 lT(e){this._definitionChanged=new $e,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(lT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),coordinates:ge("coordinates"),height:ge("height"),heightReference:ge("heightReference"),extrudedHeight:ge("extrudedHeight"),extrudedHeightReference:ge("extrudedHeightReference"),rotation:ge("rotation"),stRotation:ge("stRotation"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition"),classificationType:ge("classificationType"),zIndex:ge("zIndex")});lT.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 lT(this)};lT.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 uT(e){this._definitionChanged=new $e,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(uT.prototype,{definitionChanged:{get:function(){return this._definitionChanged}},show:ge("show"),positions:ge("positions"),minimumHeights:ge("minimumHeights"),maximumHeights:ge("maximumHeights"),granularity:ge("granularity"),fill:ge("fill"),material:uc("material"),outline:ge("outline"),outlineColor:ge("outlineColor"),outlineWidth:ge("outlineWidth"),shadows:ge("shadows"),distanceDisplayCondition:ge("distanceDisplayCondition")});uT.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 uT(this)};uT.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 Nze=new Ae;function Mze(e){return new _d(e)}function Fze(e){return ge(e,void 0,Mze)}function jr(e,t){return ge(e,void 0,function(n){return n instanceof t?n:new t(n)})}function Er(e){e=A(e,A.EMPTY_OBJECT);let t=e.id;l(t)||(t=Es()),this._availability=void 0,this._id=t,this._definitionChanged=new $e,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 CB(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)&&CB(r,r._children,n)}e._definitionChanged.raiseEvent(e,"isShowing",n,!n)}Object.defineProperties(Er.prototype,{availability:AB("availability"),id:{get:function(){return this._id}},definitionChanged:{get:function(){return this._definitionChanged}},name:AB("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&&CB(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&&CB(this,this._children,i),this._definitionChanged.raiseEvent(this,"parent",e,t)}},propertyNames:{get:function(){return this._propertyNames}},billboard:jr("billboard",$C),box:jr("box",XC),corridor:jr("corridor",KC),cylinder:jr("cylinder",JC),description:ge("description"),ellipse:jr("ellipse",QC),ellipsoid:jr("ellipsoid",ZC),label:jr("label",eT),model:jr("model",nT),tileset:jr("tileset",iT),orientation:ge("orientation"),path:jr("path",ky),plane:jr("plane",oT),point:jr("point",rT),polygon:jr("polygon",sT),polyline:jr("polyline",aT),polylineVolume:jr("polylineVolume",cT),properties:jr("properties",fc),position:Fze("position"),rectangle:jr("rectangle",lT),viewFrom:ge("viewFrom"),wall:jr("wall",uT)});Er.prototype.isAvailable=function(e){if(!l(e))throw new x("time is required.");const t=this._availability;return!l(t)||t.contains(e)};Er.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,AB(e,!0))};Er.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]};Er.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 x$=new J,w$=new d,S$=new Ce;Er.prototype.computeModelMatrix=function(e,t){b.typeOf.object("time",e);const n=Z.getValueOrUndefined(this._position,e,w$);if(!l(n))return;const i=Z.getValueOrUndefined(this._orientation,e,S$);return l(i)?t=B.fromRotationTranslation(J.fromQuaternion(i,x$),n,t):t=tn.eastNorthUpToFixedFrame(n,void 0,t),t};Er.prototype.computeModelMatrixForHeightReference=function(e,t,n,i,o){b.typeOf.object("time",e);const r=Z.getValueOrDefault(t,e,Et.NONE);let s=Z.getValueOrUndefined(this._position,e,w$);if(r===Et.NONE||!l(s)||d.equalsEpsilon(s,d.ZERO,N.EPSILON8))return this.computeModelMatrix(e,o);const a=i.cartesianToCartographic(s,Nze);r===Et.CLAMP_TO_GROUND?a.height=n:a.height+=n,s=i.cartographicToCartesian(a,s);const c=Z.getValueOrUndefined(this._orientation,e,S$);return l(c)?o=B.fromRotationTranslation(J.fromQuaternion(c,x$),s,o):o=tn.eastNorthUpToFixedFrame(s,void 0,o),o};Er.supportsMaterialsforEntitiesOnTerrain=function(e){return Fr.supportsMaterials(e)};Er.supportsPolylinesOnTerrain=function(e){return il.isSupported(e)};const zze=new Jt(U.WHITE),Uze=new Wo(!0),Hze=new Wo(!0),Vze=new Wo(!1),kze=new Wo(U.BLACK),Gze=new Wo(Co.DISABLED),Wze=new Wo(new Ut),jze=new Wo(go.BOTH);function Nn(e){b.defined("options.entity",e.entity),b.defined("options.scene",e.scene),b.defined("options.geometryOptions",e.geometryOptions),b.defined("options.geometryPropertyName",e.geometryPropertyName),b.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 $e,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=Er.supportsMaterialsforEntitiesOnTerrain(e.scene)}Object.defineProperties(Nn.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}}});Nn.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)};Nn.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)};Nn.prototype.createFillGeometryInstance=x.throwInstantiationError;Nn.prototype.createOutlineGeometryInstance=x.throwInstantiationError;Nn.prototype.isDestroyed=function(){return!1};Nn.prototype.destroy=function(){Ue(this)};Nn.prototype._isHidden=function(e,t){const n=t.show;return l(n)&&n.isConstant&&!n.getValue(lt.MINIMUM_VALUE)};Nn.prototype._isOnTerrain=function(e,t){return!1};Nn.prototype._getIsClosed=function(e){return!0};Nn.prototype._isDynamic=x.throwInstantiationError;Nn.prototype._setStaticOptions=x.throwInstantiationError;Nn.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(lt.MINIMUM_VALUE):!0,a=o.outline;let c=l(a);if(c&&a.isConstant&&(c=a.getValue(lt.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,zze),this._fillProperty=A(r,Hze),this._showProperty=A(u,Uze),this._showOutlineProperty=A(o.outline,Vze),this._outlineColorProperty=c?A(o.outlineColor,kze):void 0,this._shadowsProperty=A(o.shadows,Gze),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,Wze),this._classificationTypeProperty=A(o.classificationType,jze),this._fillEnabled=s;const f=this._isOnTerrain(e,o)&&(this._supportsMaterialsforEntitiesOnTerrain||this._materialProperty instanceof Jt);if(c&&f&&(Di(Di.geometryOutlines),c=!1),this._onTerrain=f,this._outlineEnabled=c,this._isDynamic(e,o))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{this._setStaticOptions(e,o),this._isClosed=this._getIsClosed(this._options);const h=o.outlineWidth;this._outlineWidth=l(h)?h.getValue(lt.MINIMUM_VALUE):1,this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};Nn.prototype.createDynamicUpdater=function(e,t){if(b.defined("primitives",e),b.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 $e,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 v$=new d,qze=new Ae;function F_(e,t,n,i){b.defined("scene",e),b.defined("positionProperty",t),this._scene=e,this._heightReference=n,this._extrudedHeightReference=i,this._positionProperty=t,this._position=new d,this._cartographicPosition=new Ae,this._normal=new d,this._definitionChanged=new $e,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(lt.MINIMUM_VALUE,v$);if(!l(r)||d.equals(r,d.ZERO)||!l(e.globe))return;this._position=d.clone(r,this._position),this._updateClamping(),this._normal=e.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal)}}Object.defineProperties(F_.prototype,{isConstant:{get:function(){return!1}},definitionChanged:{get:function(){return this._definitionChanged}}});F_.prototype._updateClamping=function(){l(this._removeCallbackFunc)&&this._removeCallbackFunc();const e=this._scene,t=e.globe,n=this._position;if(!l(t)||d.equals(n,d.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 f=i.cartesianToCartographic(u,qze);r._terrainHeight=f.height}else r._terrainHeight=u.x;r.definitionChanged.raiseEvent()}this._removeCallbackFunc=o.updateHeight(s,c)};F_.prototype.getValue=function(e,t){const n=Z.getValueOrDefault(this._heightReference,e,Et.NONE),i=Z.getValueOrDefault(this._extrudedHeightReference,e,Et.NONE);if(n===Et.NONE&&i!==Et.RELATIVE_TO_GROUND)return this._position=d.clone(d.ZERO,this._position),d.clone(d.ZERO,t);if(this._positionProperty.isConstant)return d.multiplyByScalar(this._normal,this._terrainHeight,t);const o=this._scene,r=this._positionProperty.getValue(e,v$);if(!l(r)||d.equals(r,d.ZERO)||!l(o.globe))return d.clone(d.ZERO,t);if(d.equalsEpsilon(this._position,r,N.EPSILON10))return d.multiplyByScalar(this._normal,this._terrainHeight,t);this._position=d.clone(r,this._position),this._updateClamping();const s=o.globe.ellipsoid.geodeticSurfaceNormal(r,this._normal);return d.multiplyByScalar(s,this._terrainHeight,t)};F_.prototype.isDestroyed=function(){return!1};F_.prototype.destroy=function(){return l(this._removeEventListener)&&this._removeEventListener(),l(this._removeModeListener)&&this._removeModeListener(),l(this._removeCallbackFunc)&&this._removeCallbackFunc(),Ue(this)};function BM(e,t,n,i){if(Nn.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 F_(this._scene,s,r)}}const D$=d.ZERO,I$=new d,Yze=new d,P$=new U;function $ze(e){this.id=e,this.vertexFormat=void 0,this.dimensions=void 0,this.offsetAttribute=void 0}function nc(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new $ze(e),geometryPropertyName:"box",observedPropertyNames:["availability","position","orientation","box"]}),this._onEntityPropertyChanged(e,"box",e.box,void 0)}l(Object.create)&&(nc.prototype=Object.create(Nn.prototype),nc.prototype.constructor=nc);Object.defineProperties(nc.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});nc.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=_i.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Jt){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,P$)),l(a)||(a=U.WHITE),s.color=an.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,D$,I$))),new nn({id:t,geometry:Mr.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:s})};nc.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,P$),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,D$,I$))),new nn({id:t,geometry:ac.fromDimensions(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.box.heightReference,this._options.dimensions.z*.5,this._scene.mapProjection.ellipsoid),attributes:r})};nc.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};nc.prototype._isHidden=function(e,t){return!l(t.dimensions)||!l(e.position)||Nn.prototype._isHidden.call(this,e,t)};nc.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.dimensions.isConstant||!Z.isConstant(t.outlineWidth)};nc.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Jt?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,i.dimensions=t.dimensions.getValue(lt.MINIMUM_VALUE,i.dimensions),i.offsetAttribute=n!==Et.NONE?fn.ALL:void 0};nc.prototype._onEntityPropertyChanged=BM;nc.DynamicGeometryUpdater=uy;function uy(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(uy.prototype=Object.create(si.prototype),uy.prototype.constructor=uy);uy.prototype._isHidden=function(e,t,n){const i=Z.getValueOrUndefined(e.position,n,Yze),o=this._options.dimensions;return!l(i)||!l(o)||si.prototype._isHidden.call(this,e,t,n)};uy.prototype._setOptions=function(e,t,n){const i=Z.getValueOrDefault(t.heightReference,n,Et.NONE),o=this._options;o.dimensions=Z.getValueOrUndefined(t.dimensions,n,o.dimensions),o.offsetAttribute=i!==Et.NONE?fn.ALL:void 0};function u0(e){e=A(e,A.EMPTY_OBJECT);const t=l(e.imageBasedLightingFactor)?j.clone(e.imageBasedLightingFactor):new j(1,1);b.typeOf.object("options.imageBasedLightingFactor",t),b.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.x",t.x,0),b.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.x",t.x,1),b.typeOf.number.greaterThanOrEquals("options.imageBasedLightingFactor.y",t.y,0),b.typeOf.number.lessThanOrEquals("options.imageBasedLightingFactor.y",t.y,1),this._imageBasedLightingFactor=t;const n=A(e.luminanceAtZenith,.2);b.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(u0.prototype,{imageBasedLightingFactor:{get:function(){return this._imageBasedLightingFactor},set:function(e){b.typeOf.object("imageBasedLightingFactor",e),b.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.x",e.x,0),b.typeOf.number.lessThanOrEquals("imageBasedLightingFactor.x",e.x,1),b.typeOf.number.greaterThanOrEquals("imageBasedLightingFactor.y",e.y,0),b.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 Xze(e,t){if(Xl.isSupported(t)){if(e._specularEnvironmentMapAtlas=e._specularEnvironmentMapAtlas&&e._specularEnvironmentMapAtlas.destroy(),l(e._specularEnvironmentMaps)){const n=new Xl(e._specularEnvironmentMaps);e._specularEnvironmentMapAtlas=n,n.readyPromise.then(function(){e._specularEnvironmentMapLoaded=!0}).catch(function(i){console.error(`Error loading specularEnvironmentMaps: ${i}`)})}e._shouldRegenerateShaders=!0}}u0.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&&(Xze(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)};u0.prototype.isDestroyed=function(){return!1};u0.prototype.destroy=function(){return this._specularEnvironmentMapAtlas=this._specularEnvironmentMapAtlas&&this._specularEnvironmentMapAtlas.destroy(),Ue(this)};function RM(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.metadata",e.metadata),this._metadata=e.metadata}Object.defineProperties(RM.prototype,{metadata:{get:function(){return this._metadata}}});function Xa(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),Xa.decode(e)}Xa.decodeWithTextDecoder=function(e){return new TextDecoder("utf-8").decode(e)};Xa.decodeWithFromCharCode=function(e){let t="";const n=Kze(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 iA(e,t,n){return t<=e&&e<=n}function Kze(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(iA(u,0,127)){s.push(u);continue}if(iA(u,194,223)){i=1,t=u&31;continue}if(iA(u,224,239)){u===224&&(o=160),u===237&&(r=159),i=2,t=u&15;continue}if(iA(u,240,244)){u===240&&(o=144),u===244&&(r=143),i=3,t=u&7;continue}throw new Se("String decoding failed.")}if(!iA(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"?Xa.decode=Xa.decodeWithTextDecoder:Xa.decode=Xa.decodeWithFromCharCode;function Kv(e,t){return t=A(t,0),Xa(e,t,Math.min(4,e.length))}function Od(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=Jze(this,i,o,r)}Object.defineProperties(Od.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 oA=Uint32Array.BYTES_PER_ELEMENT;function Jze(e,t,n,i){n=A(n,0);const o=new Uint8Array(t),r=new DataView(t);n+=oA;const s=r.getUint32(n,!0);if(s!==1)throw new Se(`Only Composite Tile version 1 is supported. Version ${s} is not.`);n+=oA,n+=oA;const a=r.getUint32(n,!0);n+=oA;const c=[],u=e._resource;let f=u.queryParameters.compositeIndex;l(f)?f=`${f}_`:f="";for(let h=0;h<a;++h){const _=Kv(o,n),g=r.getUint32(n+oA*2,!0),p=i[_],y=`${f}${h}`,C=u.getDerivedResource({queryParameters:{compositeIndex:y}});if(l(p)){const T=p(e._tileset,e._tile,C,t,n);e._contents.push(T),c.push(T.readyPromise)}else throw new Se(`Unknown tile content type, ${_}, inside Composite tile`);n+=g}return Promise.all(c).then(function(){return e})}Od.prototype.hasProperty=function(e,t){return!1};Od.prototype.getFeature=function(e){};Od.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};Od.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};Od.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};Od.prototype.isDestroyed=function(){return!1};Od.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Ue(this)};function Fa(e,t,n){return JSON.parse(Xa(e,t,n))}function po(e){b.typeOf.number("options.featuresLength",e.featuresLength),b.typeOf.object("options.owner",e.owner),this._id=Es();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,wt.maximumTextureSize),r=Math.ceil(t/wt.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(po.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}}});po.DEFAULT_COLOR_VALUE=U.WHITE;po.DEFAULT_SHOW_VALUE=!0;function O$(e){const t=e._textureDimensions;return t.x*t.y*4}function L$(e){if(!l(e._batchValues)){const t=O$(e),n=new Uint8Array(t).fill(255);e._batchValues=n}return e._batchValues}function B$(e){if(!l(e._showAlphaProperties)){const t=2*e._featuresLength,n=new Uint8Array(t).fill(255);e._showAlphaProperties=n}return e._showAlphaProperties}function YT(e,t){if(!l(e)||e<0||e>=t)throw new x(`batchId is required and between zero and featuresLength - 1 (${t}`-+").")}po.prototype.setShow=function(e,t){if(YT(e,this._featuresLength),b.typeOf.bool("show",t),t&&!l(this._showAlphaProperties))return;const n=B$(this),i=e*2,o=t?255:0;if(n[i]!==o){n[i]=o;const r=L$(this),s=e*4+3;r[s]=t?n[i+1]:0,this._batchValuesDirty=!0}};po.prototype.setAllShow=function(e){b.typeOf.bool("show",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setShow(n,e)};po.prototype.getShow=function(e){if(YT(e,this._featuresLength),!l(this._showAlphaProperties))return!0;const t=e*2;return this._showAlphaProperties[t]===255};const Qze=new Array(4);po.prototype.setColor=function(e,t){if(YT(e,this._featuresLength),b.typeOf.object("color",t),U.equals(t,po.DEFAULT_COLOR_VALUE)&&!l(this._batchValues))return;const n=t.toBytes(Qze),i=n[3],o=L$(this),r=e*4,s=B$(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 f=i!==255;f&&!c?++this._translucentFeaturesLength:!f&&c&&--this._translucentFeaturesLength,this._batchValuesDirty=!0,l(this._colorChangedCallback)&&this._colorChangedCallback(e,t)}};po.prototype.setAllColor=function(e){b.typeOf.object("color",e);const t=this._featuresLength;for(let n=0;n<t;++n)this.setColor(n,e)};po.prototype.getColor=function(e,t){if(YT(e,this._featuresLength),b.typeOf.object("result",t),!l(this._batchValues))return U.clone(po.DEFAULT_COLOR_VALUE,t);const n=this._batchValues,i=e*4,o=this._showAlphaProperties,r=e*2;return U.fromBytes(n[i],n[i+1],n[i+2],o[r+1],t)};po.prototype.getPickColor=function(e){return YT(e,this._featuresLength),this._pickIds[e]};function R$(e,t,n){const i=e._textureDimensions;return new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,source:{width:i.x,height:i.y,arrayBufferView:n},flipY:!1,sampler:Yn.NEAREST})}function Zze(e,t){const n=e._featuresLength;if(!l(e._pickTexture)&&n>0){const i=e._pickIds,o=O$(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 f=u.color,h=c*4;r[h]=U.floatToByte(f.red),r[h+1]=U.floatToByte(f.green),r[h+2]=U.floatToByte(f.blue),r[h+3]=U.floatToByte(f.alpha)}e._pickTexture=R$(e,t,r),l(a)&&(a.batchTableByteLength+=e._pickTexture.sizeInBytes)}}function eUe(e){const t=e._textureDimensions;e._batchTexture.copyFrom({source:{width:t.x,height:t.y,arrayBufferView:e._batchValues}})}po.prototype.update=function(e,t){const n=t.context;this._defaultTexture=n.defaultTexture;const i=t.passes;(i.pick||i.postProcess)&&Zze(this,n),this._batchValuesDirty&&(this._batchValuesDirty=!1,l(this._batchTexture)||(this._batchTexture=R$(this,n,this._batchValues),l(this._statistics)&&(this._statistics.batchTableByteLength+=this._batchTexture.sizeInBytes)),eUe(this))};po.prototype.isDestroyed=function(){return!1};po.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 Ue(this)};const tUe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},nUe={SCALAR:void 0,VEC2:j,VEC3:d,VEC4:oe,MAT2:at,MAT3:J,MAT4:B};function Um(e){const t=e.componentType;let n;typeof t=="string"?n=ee.fromName(t):n=t;const i=tUe[e.type],o=nUe[e.type];return{componentsPerAttribute:i,classType:o,createArrayBufferView:function(r,s,a){return ee.createArrayBufferView(n,r,s,i*a)}}}function df(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,b.typeOf.object("options.extension",e.extension),iUe(this,e.extension,e.binaryBody),aUe(this)}Object.defineProperties(df.prototype,{byteLength:{get:function(){return this._byteLength}}});function iUe(e,t,n){let i,o,r;const s=t.instancesLength,a=t.classes;let c=t.classIds,u=t.parentCounts,f=t.parentIds,h=s,_=0;l(c.byteOffset)&&(c.componentType=A(c.componentType,ee.UNSIGNED_SHORT),c.type=ln.SCALAR,r=Um(c),c=r.createArrayBufferView(n.buffer,n.byteOffset+c.byteOffset,s),_+=c.byteLength);let g;if(l(u)){for(l(u.byteOffset)&&(u.componentType=A(u.componentType,ee.UNSIGNED_SHORT),u.type=ln.SCALAR,r=Um(u),u=r.createArrayBufferView(n.buffer,n.byteOffset+u.byteOffset,s),_+=u.byteLength),g=new Uint16Array(s),h=0,i=0;i<s;++i)g[i]=h,h+=u[i];_+=g.byteLength}l(f)&&l(f.byteOffset)&&(f.componentType=A(f.componentType,ee.UNSIGNED_SHORT),f.type=ln.SCALAR,r=Um(f),f=r.createArrayBufferView(n.buffer,n.byteOffset+f.byteOffset,h),_+=f.byteLength);const p=a.length;for(i=0;i<p;++i){const T=a[i].length,E=a[i].instances,w=oUe(T,E,n);_+=rUe(w),a[i].instances=sn(w,E)}const y=new Array(p).fill(0),C=new Uint16Array(s);for(i=0;i<s;++i)o=c[i],C[i]=y[o],++y[o];_+=C.byteLength,e._classes=a,e._classIds=c,e._classIndexes=C,e._parentCounts=u,e._parentIndexes=g,e._parentIds=f,e._byteLength=_}function oUe(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 Se("componentType is required.");if(!l(c))throw new Se("type is required.");if(!l(n))throw new Se(`Property ${o} requires a batch table binary.`);const u=Um(r),f=u.componentsPerAttribute,h=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:_,componentCount:f,type:h}}}return i}function rUe(e){let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}const sUe=[];function aUe(e){const t=sUe;t.length=0;const i=e._classIds.length;for(let o=0;o<i;++o)N$(e,o,t)}function N$(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 f=0;f<c;++f){const h=o[u+f];h!==t&&N$(e,h,n)}n.pop(t)}const cUe=[],lUe=[];let uUe=0;function fUe(e,t,n){const i=e._classIds,o=e._parentCounts,r=e._parentIds,s=e._parentIndexes,a=i.length,c=cUe;c.length=Math.max(c.length,a);const u=++uUe,f=lUe;for(f.length=0,f.push(t);f.length>0;){if(t=f.pop(),c[t]===u)continue;c[t]=u;const h=n(e,t);if(l(h))return h;const _=o[t],g=s[t];for(let p=0;p<_;++p){const y=r[g+p];y!==t&&f.push(y)}}}function dUe(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 $T(e,t,n){const i=e._parentCounts,o=e._parentIds;if(l(o)){if(l(i))return fUe(e,t,n)}else return n(e,t);return dUe(e,t,n)}df.prototype.hasProperty=function(e,t){const n=$T(this,e,function(i,o){const r=i._classIds[o],s=i._classes[r].instances;if(l(s[t]))return!0});return l(n)};df.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};df.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,$T(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};df.prototype.getProperty=function(e,t){return $T(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)?hUe(a,s):ut(a[s],!0)})};function hUe(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}df.prototype.setProperty=function(e,t,n){const i=$T(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)?pUe(u,c,n):u[c]=ut(n,!0),!0}});return l(i)};function pUe(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}df.prototype.isClass=function(e,t){const n=$T(this,e,function(i,o){const r=i._classIds[o];if(i._classes[r].name===t)return!0});return l(n)};df.prototype.getClassName=function(e){const t=this._classIds[e];return this._classes[t].name};const mUe={HIGHLIGHT:0,REPLACE:1,MIX:2},Tw=Object.freeze(mUe),nO=po.DEFAULT_COLOR_VALUE,iO=po.DEFAULT_SHOW_VALUE;function gi(e,t,n,i,o){this.featuresLength=t;let r;l(n)&&(r=n.extensions),this._extensions=A(r,{});const s=_Ue(n);this._properties=s,this._batchTableHierarchy=gUe(this,n,i);const a=M$(t,s,i);this._binaryPropertiesByteLength=yUe(a),this._batchTableBinaryProperties=a,this._content=e,this._batchTexture=new po({featuresLength:t,colorChangedCallback:o,owner:e,statistics:e.tileset.statistics})}gi._deprecationWarning=Tp;Object.defineProperties(gi.prototype,{batchTableByteLength:{get:function(){let e=this._binaryPropertiesByteLength;return l(this._batchTableHierarchy)&&(e+=this._batchTableHierarchy.byteLength),e+=this._batchTexture.byteLength,e}}});function _Ue(e){const t={};if(!l(e))return t;for(const n in e)e.hasOwnProperty(n)&&n!=="HIERARCHY"&&n!=="extensions"&&n!=="extras"&&(t[n]=ut(e[n],!0));return t}function gUe(e,t,n){if(!l(t))return;let i=e._extensions["3DTILES_batch_table_hierarchy"];const o=t.HIERARCHY;if(l(o)&&(gi._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 df({extension:i,binaryBody:n})}function M$(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 Se("componentType is required.");if(!l(c))throw new Se("type is required.");if(!l(n))throw new Se(`Property ${o} requires a batch table binary.`);const u=Um(r),f=u.componentsPerAttribute,h=u.classType,_=u.createArrayBufferView(n.buffer,n.byteOffset+s,e);l(i)||(i={}),i[o]={typedArray:_,componentCount:f,type:h}}}return i}function yUe(e){if(!l(e))return 0;let t=0;for(const n in e)e.hasOwnProperty(n)&&(t+=e[n].typedArray.byteLength);return t}gi.getBinaryProperties=function(e,t,n){return M$(e,t,n)};gi.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};gi.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};gi.prototype.getShow=function(e){return this._batchTexture.getShow(e)};gi.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};gi.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};gi.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};gi.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};const AUe=new U;gi.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(nO),this.setAllShow(iO);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,AUe),nO):nO,s=l(e.show)?A(e.show.evaluate(o),iO):iO;this.setColor(i,r),this.setShow(i,s)}};function CUe(e,t){const n=e.typedArray,i=e.componentCount;return i===1?n[t]:e.type.unpack(n,t*i)}function TUe(e,t,n){const i=e.typedArray,o=e.componentCount;o===1?i[t]=n:e.type.pack(n,i,t*o)}function f0(e,t){if(!l(e)||e<0||e>=t)throw new x(`batchId is required and must be between zero and featuresLength - 1 (${t}`-+").")}gi.prototype.isClass=function(e,t){f0(e,this.featuresLength),b.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};gi.prototype.isExactClass=function(e,t){return b.typeOf.string("className",t),this.getExactClassName(e)===t};gi.prototype.getExactClassName=function(e){f0(e,this.featuresLength);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};gi.prototype.hasProperty=function(e,t){return f0(e,this.featuresLength),b.typeOf.string("name",t),l(this._properties[t])||l(this._batchTableHierarchy)&&this._batchTableHierarchy.hasProperty(e,t)};gi.prototype.hasPropertyBySemantic=function(){return!1};gi.prototype.getPropertyIds=function(e,t){f0(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};gi.prototype.getPropertyBySemantic=function(e,t){};gi.prototype.getProperty=function(e,t){if(f0(e,this.featuresLength),b.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const i=this._batchTableBinaryProperties[t];if(l(i))return CUe(i,e)}const n=this._properties[t];if(l(n))return ut(n[e],!0);if(l(this._batchTableHierarchy)){const i=this._batchTableHierarchy.getProperty(e,t);if(l(i))return i}};gi.prototype.setProperty=function(e,t,n){const i=this.featuresLength;if(f0(e,i),b.typeOf.string("name",t),l(this._batchTableBinaryProperties)){const r=this._batchTableBinaryProperties[t];if(l(r)){TUe(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]=ut(n,!0)};function bUe(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));
}
`}gi.prototype.getVertexShaderCallback=function(e,t,n){if(this.featuresLength===0)return;const i=this;return function(o){const r=F$(o,n,!1);let s;return wt.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}
${bUe(i)}${s}`}};function Kk(e,t){return e=Ge.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 EUe(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 f=e.charAt(u);if(f==="(")++s;else if(f===")"&&(--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 F$(e,t,n){if(!l(t))return Kk(e,n);let i=new RegExp(`(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${t};`);const o=e.match(i);if(!l(o))return Kk(e,n);const r=o[0],s=o[2];e=Ge.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 f=s==="vec3"?`vec4(${t}, 1.0)`:t,h=s==="vec3"?"tile_diffuse.xyz":"tile_diffuse";i=new RegExp(t,"g"),e=e.replace(i,h),u=` vec4 source = ${f};
tile_diffuse = tile_diffuse_final(source, tile_featureColor);
tile_main();
`}else s==="sampler2D"&&(e=EUe(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}gi.prototype.getFragmentShaderCallback=function(e,t,n){if(this.featuresLength!==0)return function(i){return i=F$(i,t,!0),wt.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}};gi.prototype.getClassificationFragmentShaderCallback=function(){if(this.featuresLength!==0)return function(e){return e=Ge.replaceMain(e,"tile_main"),wt.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 xUe(e){const t=e._content.tileset,n=t.colorBlendMode,i=t.colorBlendAmount;if(n===Tw.HIGHLIGHT)return 0;if(n===Tw.REPLACE)return 1;if(n===Tw.MIX)return N.clamp(i,N.EPSILON4,1);throw new x(`Invalid color blend mode "${n}".`)}gi.prototype.getUniformMapCallback=function(){if(this.featuresLength===0)return;const e=this;return function(t){return sn(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 xUe(e)},tile_pickTexture:function(){return e._batchTexture.pickTexture}})}};gi.prototype.getPickId=function(){return"texture2D(tile_pickTexture, tile_featureSt)"};const Dh={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};gi.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=wUe(this);for(let u=t;u<i;++u){const f=n[u];if(f.pass===Be.COMPUTE)continue;let h=f.derivedCommands.tileset;(!l(h)||f.dirty)&&(h={},f.derivedCommands.tileset=h,h.originalCommand=SUe(f),f.dirty=!1);const _=h.originalCommand;c!==Dh.ALL_OPAQUE&&f.pass!==Be.TRANSLUCENT&&(l(h.translucent)||(h.translucent=vUe(_))),c!==Dh.ALL_TRANSLUCENT&&f.pass!==Be.TRANSLUCENT&&(l(h.opaque)||(h.opaque=DUe(_)),a&&(r||(l(h.zback)||(h.zback=PUe(e.context,_)),s._backfaceCommands.push(h.zback)),(!l(h.stencil)||o._selectionDepth!==LUe(h.stencil))&&(f.renderState.depthMask?h.stencil=OUe(_,o._selectionDepth):h.stencil=h.opaque)));const g=a?h.stencil:h.opaque,p=h.translucent;f.pass!==Be.TRANSLUCENT?(c===Dh.ALL_OPAQUE&&(n[u]=g),c===Dh.ALL_TRANSLUCENT&&(n[u]=p),c===Dh.OPAQUE_AND_TRANSLUCENT&&(n[u]=g,n.push(p))):n[u]=_}};function wUe(e){const t=e._batchTexture.translucentFeaturesLength;return t===0?Dh.ALL_OPAQUE:t===e.featuresLength?Dh.ALL_TRANSLUCENT:Dh.OPAQUE_AND_TRANSLUCENT}function SUe(e){const t=dt.shallowClone(e),n=t.pass===Be.TRANSLUCENT;return t.uniformMap=l(t.uniformMap)?t.uniformMap:{},t.uniformMap.tile_translucentCommand=function(){return n},t}function vUe(e){const t=dt.shallowClone(e);return t.pass=Be.TRANSLUCENT,t.renderState=BUe(e.renderState),t}function DUe(e){const t=dt.shallowClone(e);return t.renderState=RUe(e.renderState),t}function IUe(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 PUe(e,t){const n=dt.shallowClone(t),i=ut(n.renderState,!0);i.cull.enabled=!0,i.cull.face=Po.FRONT,i.colorMask={red:!1,green:!1,blue:!1,alpha:!1},i.polygonOffset={enabled:!0,factor:5,units:5},i.stencilTest=Pt.setCesium3DTileBit(),i.stencilMask=Pt.CESIUM_3D_TILE_MASK,n.renderState=Qe.fromCache(i),n.castShadows=!1,n.receiveShadows=!1,n.uniformMap=ut(t.uniformMap);const o=new j(5,5);return n.uniformMap.u_polygonOffset=function(){return o},n.shaderProgram=IUe(e,t.shaderProgram),n}function OUe(e,t){const n=dt.shallowClone(e),i=ut(n.renderState,!0);return i.stencilTest.enabled=!0,i.stencilTest.mask=Pt.SKIP_LOD_MASK,i.stencilTest.reference=Pt.CESIUM_3D_TILE_MASK|t<<Pt.SKIP_LOD_BIT_SHIFT,i.stencilTest.frontFunction=ri.GREATER_OR_EQUAL,i.stencilTest.frontOperation.zPass=ht.REPLACE,i.stencilTest.backFunction=ri.GREATER_OR_EQUAL,i.stencilTest.backOperation.zPass=ht.REPLACE,i.stencilMask=Pt.CESIUM_3D_TILE_MASK|Pt.SKIP_LOD_MASK,n.renderState=Qe.fromCache(i),n}function LUe(e){return(e.renderState.stencilTest.reference&Pt.SKIP_LOD_MASK)>>>Pt.SKIP_LOD_BIT_SHIFT}function BUe(e){const t=ut(e,!0);return t.cull.enabled=!1,t.depthTest.enabled=!0,t.depthMask=!1,t.blending=Ii.ALPHA_BLEND,t.stencilTest=Pt.setCesium3DTileBit(),t.stencilMask=Pt.CESIUM_3D_TILE_MASK,Qe.fromCache(t)}function RUe(e){const t=ut(e,!0);return t.stencilTest=Pt.setCesium3DTileBit(),t.stencilMask=Pt.CESIUM_3D_TILE_MASK,Qe.fromCache(t)}gi.prototype.update=function(e,t){this._batchTexture.update(e,t)};gi.prototype.isDestroyed=function(){return!1};gi.prototype.destroy=function(){return this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),Ue(this)};function ES(e){this.offset=e.offset,this.count=e.count,this.color=e.color,this.batchIds=e.batchIds}class NUe{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 MUe{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 He{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+He.version}static addUnaryOp(t){return He.max_unop_len=Math.max(t.length,He.max_unop_len),He.unary_ops[t]=1,He}static addBinaryOp(t,n,i){return He.max_binop_len=Math.max(t.length,He.max_binop_len),He.binary_ops[t]=n,i?He.right_associative.add(t):He.right_associative.delete(t),He}static addIdentifierChar(t){return He.additional_identifier_chars.add(t),He}static addLiteral(t,n){return He.literals[t]=n,He}static removeUnaryOp(t){return delete He.unary_ops[t],t.length===He.max_unop_len&&(He.max_unop_len=He.getMaxKeyLen(He.unary_ops)),He}static removeAllUnaryOps(){return He.unary_ops={},He.max_unop_len=0,He}static removeIdentifierChar(t){return He.additional_identifier_chars.delete(t),He}static removeBinaryOp(t){return delete He.binary_ops[t],t.length===He.max_binop_len&&(He.max_binop_len=He.getMaxKeyLen(He.binary_ops)),He.right_associative.delete(t),He}static removeAllBinaryOps(){return He.binary_ops={},He.max_binop_len=0,He}static removeLiteral(t){return delete He.literals[t],He}static removeAllLiterals(){return He.literals={},He}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new He(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(n=>n.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return He.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!He.binary_ops[String.fromCharCode(t)]||He.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return He.isIdentifierStart(t)||He.isDecimalDigit(t)}throwError(t){const n=new Error(t+" at character "+this.index);throw n.index=this.index,n.description=t,n}runHook(t,n){if(He.hooks[t]){const i={context:this,node:n};return He.hooks.run(t,i),i.node}return n}searchHook(t){if(He.hooks[t]){const n={context:this};return He.hooks[t].find(function(i){return i.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let t=this.code;for(;t===He.SPACE_CODE||t===He.TAB_CODE||t===He.LF_CODE||t===He.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const t=this.gobbleExpressions(),n=t.length===1?t[0]:{type:He.COMPOUND,body:t};return this.runHook("after-all",n)}gobbleExpressions(t){let n=[],i,o;for(;this.index<this.expr.length;)if(i=this.code,i===He.SEMCOL_CODE||i===He.COMMA_CODE)this.index++;else if(o=this.gobbleExpression())n.push(o);else if(this.index<this.expr.length){if(i===t)break;this.throwError('Unexpected "'+this.char+'"')}return n}gobbleExpression(){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,He.max_binop_len),n=t.length;for(;n>0;){if(He.binary_ops.hasOwnProperty(t)&&(!He.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!He.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=n,t;t=t.substr(0,--n)}return!1}gobbleBinaryExpression(){let t,n,i,o,r,s,a,c,u;if(s=this.gobbleToken(),!s||(n=this.gobbleBinaryOp(),!n))return s;for(r={value:n,prec:He.binaryPrecedence(n),right_a:He.right_associative.has(n)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+n),o=[s,r,a];n=this.gobbleBinaryOp();){if(i=He.binaryPrecedence(n),i===0){this.index-=n.length;break}r={value:n,prec:i,right_a:He.right_associative.has(n)},u=n;const f=h=>r.right_a&&h.right_a?i>h.prec:i<=h.prec;for(;o.length>2&&f(o[o.length-2]);)a=o.pop(),n=o.pop().value,s=o.pop(),t={type:He.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:He.BINARY_EXP,operator:o[c-1].value,left:o[c-2],right:t},c-=2;return t}gobbleToken(){let t,n,i,o;if(this.gobbleSpaces(),o=this.searchHook("gobble-token"),o)return this.runHook("after-token",o);if(t=this.code,He.isDecimalDigit(t)||t===He.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===He.SQUOTE_CODE||t===He.DQUOTE_CODE)o=this.gobbleStringLiteral();else if(t===He.OBRACK_CODE)o=this.gobbleArray();else{for(n=this.expr.substr(this.index,He.max_unop_len),i=n.length;i>0;){if(He.unary_ops.hasOwnProperty(n)&&(!He.isIdentifierStart(this.code)||this.index+n.length<this.expr.length&&!He.isIdentifierPart(this.expr.charCodeAt(this.index+n.length)))){this.index+=i;const r=this.gobbleToken();return r||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:He.UNARY_EXP,operator:n,argument:r,prefix:!0})}n=n.substr(0,--i)}He.isIdentifierStart(t)?(o=this.gobbleIdentifier(),He.literals.hasOwnProperty(o.name)?o={type:He.LITERAL,value:He.literals[o.name],raw:o.name}:o.name===He.this_str&&(o={type:He.THIS_EXP})):t===He.OPAREN_CODE&&(o=this.gobbleGroup())}return o?(o=this.gobbleTokenProperty(o),this.runHook("after-token",o)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let n=this.code;for(;n===He.PERIOD_CODE||n===He.OBRACK_CODE||n===He.OPAREN_CODE||n===He.QUMARK_CODE;){let i;if(n===He.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==He.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),n=this.code}this.index++,n===He.OBRACK_CODE?(t={type:He.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},this.gobbleSpaces(),n=this.code,n!==He.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):n===He.OPAREN_CODE?t={type:He.CALL_EXP,arguments:this.gobbleArguments(He.CPAREN_CODE),callee:t}:(n===He.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:He.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),n=this.code}return t}gobbleNumericLiteral(){let t="",n,i;for(;He.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===He.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);He.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(n=this.char,n==="e"||n==="E"){for(t+=this.expr.charAt(this.index++),n=this.char,(n==="+"||n==="-")&&(t+=this.expr.charAt(this.index++));He.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);He.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,He.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===He.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===He.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:He.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="";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:He.LITERAL,value:t,raw:this.expr.substring(n,this.index)}}gobbleIdentifier(){let t=this.code,n=this.index;for(He.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,He.isIdentifierPart(t));)this.index++;return{type:He.IDENTIFIER,name:this.expr.slice(n,this.index)}}gobbleArguments(t){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===He.CPAREN_CODE&&o&&o>=n.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(r===He.COMMA_CODE){if(this.index++,o++,o!==n.length){if(t===He.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===He.CBRACK_CODE)for(let s=n.length;s<o;s++)n.push(null)}}else if(n.length!==o&&o!==0)this.throwError("Expected comma");else{const s=this.gobbleExpression();(!s||s.type===He.COMPOUND)&&this.throwError("Expected comma"),n.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),n}gobbleGroup(){this.index++;let t=this.gobbleExpressions(He.CPAREN_CODE);if(this.code===He.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:He.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:He.ARRAY_EXP,elements:this.gobbleArguments(He.CBRACK_CODE)}}}const FUe=new NUe;Object.assign(He,{hooks:FUe,plugins:new MUe(He),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});He.max_unop_len=He.getMaxKeyLen(He.unary_ops);He.max_binop_len=He.getMaxKeyLen(He.binary_ops);const Hm=e=>new He(e).parse(),zUe=Object.getOwnPropertyNames(He);zUe.forEach(e=>{Hm[e]===void 0&&e!=="prototype"&&(Hm[e]=He[e])});Hm.Jsep=He;const UUe="ConditionalExpression";var HUe={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:UUe,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 :")}})}};Hm.plugins.register(HUe);const VUe={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},st=Object.freeze(VUe);function Kl(e,t){b.typeOf.string("expression",e),this._expression=e,e=eHe(e,t),e=nHe(tHe(e)),Hm.addBinaryOp("=~",0),Hm.addBinaryOp("!~",0);let n;try{n=Hm(e)}catch(i){throw new Se(i)}this._runtimeAst=Wn(this,n)}Object.defineProperties(Kl.prototype,{expression:{get:function(){return this._expression}}});const Qt={arrayIndex:0,arrayArray:[[]],cartesian2Index:0,cartesian3Index:0,cartesian4Index:0,cartesian2Array:[new j],cartesian3Array:[new d],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 d),this.cartesian3Array[this.cartesian3Index++]},getCartesian4:function(){return this.cartesian4Index>=this.cartesian4Array.length&&this.cartesian4Array.push(new oe),this.cartesian4Array[this.cartesian4Index++]}};Kl.prototype.evaluate=function(e,t){Qt.reset();const n=this._runtimeAst.evaluate(e);return t instanceof U&&n instanceof oe?U.fromCartesian4(n,t):n instanceof j||n instanceof d||n instanceof oe?n.clone(t):n};Kl.prototype.evaluateColor=function(e,t){Qt.reset();const n=this._runtimeAst.evaluate(e);return U.fromCartesian4(n,t)};Kl.prototype.getShaderFunction=function(e,t,n,i){let o=this.getShaderExpression(t,n);return o=`${i} ${e}
{
return ${o};
}
`,o};Kl.prototype.getShaderExpression=function(e,t){return this._runtimeAst.getShaderExpression(e,t)};Kl.prototype.getVariables=function(){let e=[];return this._runtimeAst.getVariables(e),e=e.filter(function(t,n,i){return i.indexOf(t)===n}),e};const kUe=["!","-","+"],Jk=["+","-","*","/","%","===","!==",">",">=","<","<=","&&","||","!~","=~"],xS=/\${(.*?)}/g,GUe=/\\/g,WUe="@#%",jUe=/@#%/g,Jv=new U,Qv={abs:Pr(Math.abs),sqrt:Pr(Math.sqrt),cos:Pr(Math.cos),sin:Pr(Math.sin),tan:Pr(Math.tan),acos:Pr(Math.acos),asin:Pr(Math.asin),atan:Pr(Math.atan),radians:Pr(N.toRadians),degrees:Pr(N.toDegrees),sign:Pr(N.sign),floor:Pr(Math.floor),ceil:Pr(Math.ceil),round:Pr(Math.round),exp:Pr(Math.exp),exp2:Pr(YUe),log:Pr(Math.log),log2:Pr($Ue),fract:Pr(qUe),length:XUe,normalize:KUe},Zv={atan2:QE(Math.atan2,!1),pow:QE(Math.pow,!1),min:QE(Math.min,!0),max:QE(Math.max,!0),distance:JUe,dot:QUe,cross:ZUe},NM={clamp:Qk(N.clamp,!0),mix:Qk(N.lerp,!0)};function qUe(e){return e-Math.floor(e)}function YUe(e){return Math.pow(2,e)}function $Ue(e){return N.log2(e)}function Pr(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),Qt.getCartesian2());if(n instanceof d)return d.fromElements(e(n.x),e(n.y),e(n.z),Qt.getCartesian3());if(n instanceof oe)return oe.fromElements(e(n.x),e(n.y),e(n.z),e(n.w),Qt.getCartesian4());throw new Se(`Function "${t}" requires a vector or number argument. Argument is ${n}.`)}}function QE(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),Qt.getCartesian2());if(i instanceof d)return d.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),Qt.getCartesian3());if(i instanceof oe)return oe.fromElements(e(i.x,o),e(i.y,o),e(i.z,o),e(i.w,o),Qt.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),Qt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x),e(i.y,o.y),e(i.z,o.z),Qt.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),Qt.getCartesian4());throw new Se(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i} and ${o}.`)}}function Qk(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),Qt.getCartesian2());if(i instanceof d&&o instanceof d)return d.fromElements(e(i.x,o.x,r),e(i.y,o.y,r),e(i.z,o.z,r),Qt.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),Qt.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),Qt.getCartesian2());if(i instanceof d&&o instanceof d&&r instanceof d)return d.fromElements(e(i.x,o.x,r.x),e(i.y,o.y,r.y),e(i.z,o.z,r.z),Qt.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),Qt.getCartesian4());throw new Se(`Function "${n}" requires vector or number arguments of matching types. Arguments are ${i}, ${o}, and ${r}.`)}}function XUe(e,t){if(typeof t=="number")return Math.abs(t);if(t instanceof j)return j.magnitude(t);if(t instanceof d)return d.magnitude(t);if(t instanceof oe)return oe.magnitude(t);throw new Se(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function KUe(e,t){if(typeof t=="number")return 1;if(t instanceof j)return j.normalize(t,Qt.getCartesian2());if(t instanceof d)return d.normalize(t,Qt.getCartesian3());if(t instanceof oe)return oe.normalize(t,Qt.getCartesian4());throw new Se(`Function "${e}" requires a vector or number argument. Argument is ${t}.`)}function JUe(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 d&&n instanceof d)return d.distance(t,n);if(t instanceof oe&&n instanceof oe)return oe.distance(t,n);throw new Se(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function QUe(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 d&&n instanceof d)return d.dot(t,n);if(t instanceof oe&&n instanceof oe)return oe.dot(t,n);throw new Se(`Function "${e}" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)}function ZUe(e,t,n){if(t instanceof d&&n instanceof d)return d.cross(t,n,Qt.getCartesian3());throw new Se(`Function "${e}" requires vec3 arguments. Arguments are ${t} and ${n}.`)}function rt(e,t,n,i,o){this._type=e,this._value=t,this._left=n,this._right=i,this._test=o,this.evaluate=void 0,dHe(this)}function eHe(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 tHe(e){return e.replace(GUe,WUe)}function TB(e){return e.replace(jUe,"\\")}function nHe(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 Se("Unmatched {.");n+=`czm_${t.substr(i+2,a-(i+2))}`,t=t.substr(a+1),i=t.indexOf("${")}}return n+=t,n}function iHe(e){const t=typeof e.value;if(e.value===null)return new rt(st.LITERAL_NULL,null);if(t==="boolean")return new rt(st.LITERAL_BOOLEAN,e.value);if(t==="number")return new rt(st.LITERAL_NUMBER,e.value);if(t==="string")return e.value.indexOf("${")>=0?new rt(st.VARIABLE_IN_STRING,e.value):new rt(st.LITERAL_STRING,TB(e.value))}function oHe(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 Se(`${o} is not a function.`);return i===0?o==="test"?new rt(st.LITERAL_BOOLEAN,!1):new rt(st.LITERAL_NULL,null):(s=Wn(e,c),a=Wn(e,n[0]),new rt(st.FUNCTION_CALL,o,s,a))}else if(o==="toString")return r=Wn(e,c),new rt(st.FUNCTION_CALL,o,r);throw new Se(`Unexpected function call "${o}".`)}if(o=t.callee.name,o==="color"){if(i===0)return new rt(st.LITERAL_COLOR,o);if(r=Wn(e,n[0]),l(n[1])){const c=Wn(e,n[1]);return new rt(st.LITERAL_COLOR,o,[r,c])}return new rt(st.LITERAL_COLOR,o,[r])}else if(o==="rgb"||o==="hsl"){if(i<3)throw new Se(`${o} requires three arguments.`);return r=[Wn(e,n[0]),Wn(e,n[1]),Wn(e,n[2])],new rt(st.LITERAL_COLOR,o,r)}else if(o==="rgba"||o==="hsla"){if(i<4)throw new Se(`${o} requires four arguments.`);return r=[Wn(e,n[0]),Wn(e,n[1]),Wn(e,n[2]),Wn(e,n[3])],new rt(st.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]=Wn(e,n[c]);return new rt(st.LITERAL_VECTOR,o,r)}else{if(o==="isNaN"||o==="isFinite")return i===0?o==="isNaN"?new rt(st.LITERAL_BOOLEAN,!0):new rt(st.LITERAL_BOOLEAN,!1):(r=Wn(e,n[0]),new rt(st.UNARY,o,r));if(o==="isExactClass"||o==="isClass"){if(i<1||i>1)throw new Se(`${o} requires exactly one argument.`);return r=Wn(e,n[0]),new rt(st.UNARY,o,r)}else if(o==="getExactClassName"){if(i>0)throw new Se(`${o} does not take any argument.`);return new rt(st.UNARY,o)}else if(l(Qv[o])){if(i!==1)throw new Se(`${o} requires exactly one argument.`);return r=Wn(e,n[0]),new rt(st.UNARY,o,r)}else if(l(Zv[o])){if(i!==2)throw new Se(`${o} requires exactly two arguments.`);return s=Wn(e,n[0]),a=Wn(e,n[1]),new rt(st.BINARY,o,s,a)}else if(l(NM[o])){if(i!==3)throw new Se(`${o} requires exactly three arguments.`);s=Wn(e,n[0]),a=Wn(e,n[1]);const c=Wn(e,n[2]);return new rt(st.TERNARY,o,s,a,c)}else{if(o==="Boolean")return i===0?new rt(st.LITERAL_BOOLEAN,!1):(r=Wn(e,n[0]),new rt(st.UNARY,o,r));if(o==="Number")return i===0?new rt(st.LITERAL_NUMBER,0):(r=Wn(e,n[0]),new rt(st.UNARY,o,r));if(o==="String")return i===0?new rt(st.LITERAL_STRING,""):(r=Wn(e,n[0]),new rt(st.UNARY,o,r));if(o==="regExp")return rHe(e,t)}}throw new Se(`Unexpected function call "${o}".`)}function rHe(e,t){const n=t.arguments;if(n.length===0)return new rt(st.LITERAL_REGEX,new RegExp);const i=Wn(e,n[0]);let o;if(n.length>1){const r=Wn(e,n[1]);if(oO(i)&&oO(r)){try{o=new RegExp(TB(String(i._value)),r._value)}catch(s){throw new Se(s)}return new rt(st.LITERAL_REGEX,o)}return new rt(st.REGEX,i,r)}if(oO(i)){try{o=new RegExp(TB(String(i._value)))}catch(r){throw new Se(r)}return new rt(st.LITERAL_REGEX,o)}return new rt(st.REGEX,i)}function sHe(e){if(uHe(e.name)){const t=fHe(e.name);return t.substr(0,8)==="tiles3d_"?new rt(st.BUILTIN_VARIABLE,t):new rt(st.VARIABLE,t)}else{if(e.name==="NaN")return new rt(st.LITERAL_NUMBER,NaN);if(e.name==="Infinity")return new rt(st.LITERAL_NUMBER,1/0);if(e.name==="undefined")return new rt(st.LITERAL_UNDEFINED,void 0)}throw new Se(`${e.name} is not defined.`)}function aHe(e){const t=e.property.name;if(t==="PI")return new rt(st.LITERAL_NUMBER,Math.PI);if(t==="E")return new rt(st.LITERAL_NUMBER,Math.E)}function cHe(e){if(e.property.name==="POSITIVE_INFINITY")return new rt(st.LITERAL_NUMBER,Number.POSITIVE_INFINITY)}function lHe(e,t){if(t.object.name==="Math")return aHe(t);if(t.object.name==="Number")return cHe(t);let n;const i=Wn(e,t.object);return t.computed?(n=Wn(e,t.property),new rt(st.MEMBER,"brackets",i,n)):(n=new rt(st.LITERAL_STRING,t.property.name),new rt(st.MEMBER,"dot",i,n))}function oO(e){return e._type>=st.LITERAL_NULL}function uHe(e){return e.substr(0,4)==="czm_"}function fHe(e){return e.substr(4)}function Wn(e,t){let n,i,o,r;if(t.type==="Literal")n=iHe(t);else if(t.type==="CallExpression")n=oHe(e,t);else if(t.type==="Identifier")n=sHe(t);else if(t.type==="UnaryExpression"){i=t.operator;const s=Wn(e,t.argument);if(kUe.indexOf(i)>-1)n=new rt(st.UNARY,i,s);else throw new Se(`Unexpected operator "${i}".`)}else if(t.type==="BinaryExpression")if(i=t.operator,o=Wn(e,t.left),r=Wn(e,t.right),Jk.indexOf(i)>-1)n=new rt(st.BINARY,i,o,r);else throw new Se(`Unexpected operator "${i}".`);else if(t.type==="LogicalExpression")i=t.operator,o=Wn(e,t.left),r=Wn(e,t.right),Jk.indexOf(i)>-1&&(n=new rt(st.BINARY,i,o,r));else if(t.type==="ConditionalExpression"){const s=Wn(e,t.test);o=Wn(e,t.consequent),r=Wn(e,t.alternate),n=new rt(st.CONDITIONAL,"?",o,r,s)}else if(t.type==="MemberExpression")n=lHe(e,t);else if(t.type==="ArrayExpression"){const s=[];for(let a=0;a<t.elements.length;a++)s[a]=Wn(e,t.elements[a]);n=new rt(st.ARRAY,s)}else throw t.type==="Compound"?new Se("Provide exactly one expression."):new Se("Cannot parse expression.");return n}function dHe(e){e._type===st.CONDITIONAL?e.evaluate=e._evaluateConditional:e._type===st.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===st.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(Qv[e._value])&&(e.evaluate=pHe(e._value)):e._type===st.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(Zv[e._value])&&(e.evaluate=mHe(e._value)):e._type===st.TERNARY?e.evaluate=_He(e._value):e._type===st.MEMBER?e._value==="brackets"?e.evaluate=e._evaluateMemberBrackets:e.evaluate=e._evaluateMemberDot:e._type===st.ARRAY?e.evaluate=e._evaluateArray:e._type===st.VARIABLE?e.evaluate=e._evaluateVariable:e._type===st.VARIABLE_IN_STRING?e.evaluate=e._evaluateVariableString:e._type===st.LITERAL_COLOR?e.evaluate=e._evaluateLiteralColor:e._type===st.LITERAL_VECTOR?e.evaluate=e._evaluateLiteralVector:e._type===st.LITERAL_STRING?e.evaluate=e._evaluateLiteralString:e._type===st.REGEX?e.evaluate=e._evaluateRegExp:e._type===st.BUILTIN_VARIABLE?e._value==="tiles3d_tileset_time"&&(e.evaluate=hHe):e.evaluate=e._evaluateLiteral}function hHe(e){return l(e)?e.content.tileset.timeSinceLoad:0}function pHe(e){const t=Qv[e];return function(n){const i=this._left.evaluate(n);return t(e,i)}}function mHe(e){const t=Zv[e];return function(n){const i=this._left.evaluate(n),o=this._right.evaluate(n);return t(e,i,o)}}function _He(e){const t=NM[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 eD(e,t){if(l(e))return e.getPropertyInherited(t)}rt.prototype._evaluateLiteral=function(){return this._value};rt.prototype._evaluateLiteralColor=function(e){const t=Jv,n=this._left;if(this._value==="color")l(n)?n.length>1?(U.fromCssColorString(n[0].evaluate(e),t),t.alpha=n[1].evaluate(e)):U.fromCssColorString(n[0].evaluate(e),t):U.fromBytes(255,255,255,255,t);else if(this._value==="rgb")U.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;U.fromBytes(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),i,t)}else this._value==="hsl"?U.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),1,t):this._value==="hsla"&&U.fromHsl(n[0].evaluate(e),n[1].evaluate(e),n[2].evaluate(e),n[3].evaluate(e),t);return oe.fromColor(t,Qt.getCartesian4())};rt.prototype._evaluateLiteralVector=function(e){const t=Qt.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 d)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 Se(`${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 Se(`Invalid ${n} constructor. No valid arguments.`);if(r<s&&r>1)throw new Se(`Invalid ${n} constructor. Not enough arguments.`);if(r>s&&o>1)throw new Se(`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,Qt.getCartesian2());if(n==="vec3")return d.fromArray(t,0,Qt.getCartesian3());if(n==="vec4")return oe.fromArray(t,0,Qt.getCartesian4())};rt.prototype._evaluateLiteralString=function(){return this._value};rt.prototype._evaluateVariableString=function(e){let t=this._value,n=xS.exec(t);for(;n!==null;){const i=n[0],o=n[1];let r=eD(e,o);l(r)||(r=""),t=t.replace(i,r),n=xS.exec(t)}return t};rt.prototype._evaluateVariable=function(e){return eD(e,this._value)};function Vm(e){return e._value==="feature"}rt.prototype._evaluateMemberDot=function(e){if(Vm(this._left))return eD(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 d||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]};rt.prototype._evaluateMemberBrackets=function(e){if(Vm(this._left))return eD(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 d||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]};rt.prototype._evaluateArray=function(e){const t=[];for(let n=0;n<this._value.length;n++)t[n]=this._value[n].evaluate(e);return t};rt.prototype._evaluateNot=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Se(`Operator "!" requires a boolean argument. Argument is ${t}.`);return!t};rt.prototype._evaluateNegative=function(e){const t=this._left.evaluate(e);if(t instanceof j)return j.negate(t,Qt.getCartesian2());if(t instanceof d)return d.negate(t,Qt.getCartesian3());if(t instanceof oe)return oe.negate(t,Qt.getCartesian4());if(typeof t=="number")return-t;throw new Se(`Operator "-" requires a vector or number argument. Argument is ${t}.`)};rt.prototype._evaluatePositive=function(e){const t=this._left.evaluate(e);if(!(t instanceof j||t instanceof d||t instanceof oe||typeof t=="number"))throw new Se(`Operator "+" requires a vector or number argument. Argument is ${t}.`);return t};rt.prototype._evaluateLessThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Se(`Operator "<" requires number arguments. Arguments are ${t} and ${n}.`);return t<n};rt.prototype._evaluateLessThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Se(`Operator "<=" requires number arguments. Arguments are ${t} and ${n}.`);return t<=n};rt.prototype._evaluateGreaterThan=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Se(`Operator ">" requires number arguments. Arguments are ${t} and ${n}.`);return t>n};rt.prototype._evaluateGreaterThanOrEquals=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(typeof t!="number"||typeof n!="number")throw new Se(`Operator ">=" requires number arguments. Arguments are ${t} and ${n}.`);return t>=n};rt.prototype._evaluateOr=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Se(`Operator "||" requires boolean arguments. First argument is ${t}.`);if(t)return!0;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Se(`Operator "||" requires boolean arguments. Second argument is ${n}.`);return t||n};rt.prototype._evaluateAnd=function(e){const t=this._left.evaluate(e);if(typeof t!="boolean")throw new Se(`Operator "&&" requires boolean arguments. First argument is ${t}.`);if(!t)return!1;const n=this._right.evaluate(e);if(typeof n!="boolean")throw new Se(`Operator "&&" requires boolean arguments. Second argument is ${n}.`);return t&&n};rt.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,Qt.getCartesian2());if(n instanceof d&&t instanceof d)return d.add(t,n,Qt.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.add(t,n,Qt.getCartesian4());if(typeof t=="string"||typeof n=="string")return t+n;if(typeof t=="number"&&typeof n=="number")return t+n;throw new Se(`Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${t} and ${n}.`)};rt.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,Qt.getCartesian2());if(n instanceof d&&t instanceof d)return d.subtract(t,n,Qt.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.subtract(t,n,Qt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t-n;throw new Se(`Operator "-" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};rt.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,Qt.getCartesian2());if(n instanceof j&&typeof t=="number")return j.multiplyByScalar(n,t,Qt.getCartesian2());if(t instanceof j&&typeof n=="number")return j.multiplyByScalar(t,n,Qt.getCartesian2());if(n instanceof d&&t instanceof d)return d.multiplyComponents(t,n,Qt.getCartesian3());if(n instanceof d&&typeof t=="number")return d.multiplyByScalar(n,t,Qt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.multiplyByScalar(t,n,Qt.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.multiplyComponents(t,n,Qt.getCartesian4());if(n instanceof oe&&typeof t=="number")return oe.multiplyByScalar(n,t,Qt.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.multiplyByScalar(t,n,Qt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t*n;throw new Se(`Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${t} and ${n}.`)};rt.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,Qt.getCartesian2());if(t instanceof j&&typeof n=="number")return j.divideByScalar(t,n,Qt.getCartesian2());if(n instanceof d&&t instanceof d)return d.divideComponents(t,n,Qt.getCartesian3());if(t instanceof d&&typeof n=="number")return d.divideByScalar(t,n,Qt.getCartesian3());if(n instanceof oe&&t instanceof oe)return oe.divideComponents(t,n,Qt.getCartesian4());if(t instanceof oe&&typeof n=="number")return oe.divideByScalar(t,n,Qt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t/n;throw new Se(`Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${t} and ${n}.`)};rt.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,Qt.getCartesian2());if(n instanceof d&&t instanceof d)return d.fromElements(t.x%n.x,t.y%n.y,t.z%n.z,Qt.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,Qt.getCartesian4());if(typeof t=="number"&&typeof n=="number")return t%n;throw new Se(`Operator "%" requires vector or number arguments of matching types. Arguments are ${t} and ${n}.`)};rt.prototype._evaluateEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof j&&t instanceof j||n instanceof d&&t instanceof d||n instanceof oe&&t instanceof oe?t.equals(n):t===n};rt.prototype._evaluateNotEqualsStrict=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);return n instanceof j&&t instanceof j||n instanceof d&&t instanceof d||n instanceof oe&&t instanceof oe?!t.equals(n):t!==n};rt.prototype._evaluateConditional=function(e){const t=this._test.evaluate(e);if(typeof t!="boolean")throw new Se(`Conditional argument of conditional expression must be a boolean. Argument is ${t}.`);return t?this._left.evaluate(e):this._right.evaluate(e)};rt.prototype._evaluateNaN=function(e){return isNaN(this._left.evaluate(e))};rt.prototype._evaluateIsFinite=function(e){return isFinite(this._left.evaluate(e))};rt.prototype._evaluateIsExactClass=function(e){return l(e)?e.isExactClass(this._left.evaluate(e)):!1};rt.prototype._evaluateIsClass=function(e){return l(e)?e.isClass(this._left.evaluate(e)):!1};rt.prototype._evaluateGetExactClassName=function(e){if(l(e))return e.getExactClassName()};rt.prototype._evaluateBooleanConversion=function(e){return Boolean(this._left.evaluate(e))};rt.prototype._evaluateNumberConversion=function(e){return Number(this._left.evaluate(e))};rt.prototype._evaluateStringConversion=function(e){return String(this._left.evaluate(e))};rt.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 Se(o)}return i};rt.prototype._evaluateRegExpTest=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Se(`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)};rt.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 Se(`Operator "=~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};rt.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 Se(`Operator "!~" requires one RegExp argument and one string argument. Arguments are ${t} and ${n}.`)};rt.prototype._evaluateRegExpExec=function(e){const t=this._left.evaluate(e),n=this._right.evaluate(e);if(!(t instanceof RegExp&&typeof n=="string"))throw new Se(`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};rt.prototype._evaluateToString=function(e){const t=this._left.evaluate(e);if(t instanceof RegExp||t instanceof j||t instanceof d||t instanceof oe)return String(t);throw new Se(`Unexpected function call "${this._value}".`)};function Zk(e){const t=e._left,n=t.length;for(let a=0;a<n;++a)if(t[a]._type!==st.LITERAL_NUMBER)return;const i=t[0]._value,o=t[1]._value,r=t[2]._value,s=n===4?t[3]._value:1;return U.fromHsl(i,o,r,s,Jv)}function e4(e){const t=e._left,n=t.length;for(let o=0;o<n;++o)if(t[o]._type!==st.LITERAL_NUMBER)return;const i=Jv;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 Rh(e){return e%1===0?e.toFixed(1):e.toString()}function gHe(e){const t=Rh(e.red),n=Rh(e.green),i=Rh(e.blue);return`vec3(${t}, ${n}, ${i})`}function ZE(e){const t=Rh(e.red),n=Rh(e.green),i=Rh(e.blue),o=Rh(e.alpha);return`vec4(${t}, ${n}, ${i}, ${o})`}function t4(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 n4(e,t){return l(t[e])?t[e]:Kl.NULL_SENTINEL}Kl.NULL_SENTINEL="czm_infinity";rt.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=t4(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=t4(this._value,e,t,this));let u,f,h;switch(a){case st.VARIABLE:return Vm(this)?void 0:n4(c,e);case st.UNARY:if(c==="Boolean")return`bool(${o})`;if(c==="Number")return`float(${o})`;if(c==="round")return`floor(${o} + 0.5)`;if(l(Qv[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 Se(`Error generating style shader: "${c}" is not supported.`);return c+o;case st.BINARY:return c==="%"?`mod(${o}, ${r})`:c==="==="?`(${o} == ${r})`:c==="!=="?`(${o} != ${r})`:c==="atan2"?`atan(${o}, ${r})`:l(Zv[c])?`${c}(${o}, ${r})`:`(${o} ${c} ${r})`;case st.TERNARY:if(l(NM[c]))return`${c}(${o}, ${r}, ${s})`;break;case st.CONDITIONAL:return`(${s} ? ${o} : ${r})`;case st.MEMBER:return Vm(this._left)?n4(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 st.FUNCTION_CALL:throw new Se(`Error generating style shader: "${c}" is not supported.`);case st.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 Se("Error generating style shader: Invalid array length. Array length should be 2, 3, or 4.");case st.REGEX:throw new Se("Error generating style shader: Regular expressions are not supported.");case st.VARIABLE_IN_STRING:throw new Se("Error generating style shader: Converting a variable to a string is not supported.");case st.LITERAL_NULL:return Kl.NULL_SENTINEL;case st.LITERAL_BOOLEAN:return c?"true":"false";case st.LITERAL_NUMBER:return Rh(c);case st.LITERAL_STRING:if(l(n)&&n._type===st.MEMBER&&(c==="r"||c==="g"||c==="b"||c==="a"||c==="x"||c==="y"||c==="z"||c==="w"||Vm(n._left)))return c;if(i=U.fromCssColorString(c,Jv),l(i))return gHe(i);throw new Se("Error generating style shader: String literals are not supported.");case st.LITERAL_COLOR:if(u=o,c==="color"){if(l(u)){if(u.length>1){const _=u[0],g=u[1];return g!=="1.0"&&(t.translucent=!0),`vec4(${_}, ${g})`}}else return"vec4(1.0)";return`vec4(${u[0]}, 1.0)`}else{if(c==="rgb")return i=e4(this),l(i)?ZE(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=e4(this),l(i)?ZE(i):`vec4(${u[0]} / 255.0, ${u[1]} / 255.0, ${u[2]} / 255.0, ${u[3]})`;if(c==="hsl")return i=Zk(this),l(i)?ZE(i):`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), 1.0)`;if(c==="hsla")return i=Zk(this),l(i)?(i.alpha!==1&&(t.translucent=!0),ZE(i)):(u[3]!=="1.0"&&(t.translucent=!0),`vec4(czm_HSLToRGB(vec3(${u[0]}, ${u[1]}, ${u[2]})), ${u[3]})`)}break;case st.LITERAL_VECTOR:if(!l(o))throw new x("left should always be defined for type ExpressionNodeType.LITERAL_VECTOR");f=o.length,h=`${c}(`;for(let _=0;_<f;++_)h+=o[_],_<f-1&&(h+=", ");return h+=")",h;case st.LITERAL_REGEX:throw new Se("Error generating style shader: Regular expressions are not supported.");case st.LITERAL_UNDEFINED:return Kl.NULL_SENTINEL;case st.BUILTIN_VARIABLE:if(c==="tiles3d_tileset_time")return c}};rt.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 st.VARIABLE:Vm(this)||e.push(s);break;case st.VARIABLE_IN_STRING:for(a=xS.exec(s);a!==null;)e.push(a[1]),a=xS.exec(s);break;case st.LITERAL_STRING:l(t)&&t._type===st.MEMBER&&Vm(t._left)&&e.push(s);break}};function hf(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,d.ZERO),this._va=void 0,this._sp=void 0,this._spStencil=void 0,this._spPick=void 0,this._uniformMap=void 0,this._vaSwap=void 0,this._rsStencilDepthPass=void 0,this._rsStencilDepthPass3DTiles=void 0,this._rsColorPass=void 0,this._rsPickPass=void 0,this._rsWireframe=void 0,this._commands=[],this._commandsIgnoreShow=[],this._pickCommands=[],this._constantColor=U.clone(U.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,go.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(hf.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}}});const yHe={position:0,a_batchId:1};function AHe(e,t){if(l(e._va))return;const n=At.createVertexBuffer({context:t,typedArray:e._positions,usage:Ze.STATIC_DRAW}),i=At.createVertexBuffer({context:t,typedArray:e._vertexBatchIds,usage:Ze.STATIC_DRAW}),o=At.createIndexBuffer({context:t,typedArray:e._indices,usage:Ze.DYNAMIC_DRAW,indexDatatype:e._indices.BYTES_PER_ELEMENT===2?it.UNSIGNED_SHORT:it.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 to({context:t,attributes:r,indexBuffer:o}),t.webgl2&&(e._vaSwap=new to({context:t,attributes:r,indexBuffer:At.createIndexBuffer({context:t,sizeInBytes:o.sizeInBytes,usage:Ze.DYNAMIC_DRAW,indexDatatype:o.indexDatatype})})),e._batchedPositions=void 0,e._transferrableBatchIds=void 0,e._vertexBatchIds=void 0,e._verticesPromise=void 0}function CHe(e,t){if(l(e._sp))return;const n=e._batchTable,i=A(e._attributeLocations,yHe);let o=e._pickId;const r=e._vertexShaderSource;let s=e._fragmentShaderSource;if(l(r)){e._sp=hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i}),e._spStencil=e._sp,s=Ge.replaceMain(s,"czm_non_pick_main"),s=`${s}void main()
{
czm_non_pick_main();
gl_FragColor = ${o};
}
`,e._spPick=hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:i});return}const a=n.getVertexShaderCallback(!1,"a_batchId",void 0)(Qz);let c=n.getFragmentShaderCallback(!1,void 0,!0)(xL);o=n.getPickId();let u=new Ge({sources:[a]}),f=new Ge({defines:["VECTOR_TILE"],sources:[c]});e._sp=hn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),u=new Ge({sources:[Qz]}),f=new Ge({defines:["VECTOR_TILE"],sources:[xL]}),e._spStencil=hn.fromCache({context:t,vertexShaderSource:u,fragmentShaderSource:f,attributeLocations:i}),c=Ge.replaceMain(c,"czm_non_pick_main"),c=`${c}
void main()
{
czm_non_pick_main();
gl_FragColor = ${o};
}
`;const h=new Ge({sources:[a]}),_=new Ge({defines:["VECTOR_TILE"],sources:[c]});e._spPick=hn.fromCache({context:t,vertexShaderSource:h,fragmentShaderSource:_,attributeLocations:i})}function i4(e){const t=e?ri.EQUAL:ri.ALWAYS;return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:t,frontOperation:{fail:ht.KEEP,zFail:ht.DECREMENT_WRAP,zPass:ht.KEEP},backFunction:t,backOperation:{fail:ht.KEEP,zFail:ht.INCREMENT_WRAP,zPass:ht.KEEP},reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Jm.LESS_OR_EQUAL},depthMask:!1}}const THe={stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND},bHe={stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1};function EHe(e){l(e._rsStencilDepthPass)||(e._rsStencilDepthPass=Qe.fromCache(i4(!1)),e._rsStencilDepthPass3DTiles=Qe.fromCache(i4(!0)),e._rsColorPass=Qe.fromCache(THe),e._rsPickPass=Qe.fromCache(bHe))}const Qp=new B,o4=new d;function xHe(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,Qp),B.multiplyByPoint(Qp,e._center,o4),B.setTranslation(Qp,o4,Qp),B.multiply(o,Qp,Qp),Qp},u_highlightColor:function(){return e._highlightColor}};e._uniformMap=e._batchTable.getUniformMapCallback()(n)}function rO(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 f=r[u],h=s[f],_=i[h],g=o[h],p=new e.constructor(e.buffer,a*_,g);t.set(p,n),i[h]=n,n+=g}return n}function wHe(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=rO(n,s,0,i,o,a.batchIds,r);for(a.offset=0,a.count=u;t.length>0;){const f=t.pop();if(U.equals(f.color,a.color))u=rO(n,s,u,i,o,f.batchIds,r),a.batchIds=a.batchIds.concat(f.batchIds),a.count=u-a.offset;else{const h=u;u=rO(n,s,u,i,o,f.batchIds,r),f.offset=h,f.count=u-h,c.push(f),a=f}}e._va.indexBuffer.copyFromArrayView(s),e._indices=s,e._batchedIndices=c}function sO(e,t,n,i,o,r,s){const a=e.bytesPerIndex,c=r.length;for(let u=0;u<c;++u){const f=r[u],h=s[f],_=i[h],g=o[h];t.copyFromBuffer(e,_*a,n*a,g*a),i[h]=n,n+=g}return n}function SHe(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=sO(a,c,0,n,i,r.batchIds,o);for(r.offset=0,r.count=u;t.length>0;){const h=t.pop();if(U.equals(h.color,r.color))u=sO(a,c,u,n,i,h.batchIds,o),r.batchIds=r.batchIds.concat(h.batchIds),r.count=u-r.offset;else{const _=u;u=sO(a,c,u,n,i,h.batchIds,o),h.offset=_,h.count=u-_,s.push(h),r=h}}const f=e._va;e._va=e._vaSwap,e._vaSwap=f,e._batchedIndices=s}function vHe(e,t){return t.color.toRgba()-e.color.toRgba()}function DHe(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(vHe),t.webgl2?SHe(e,n):wHe(e,n),e._framesSinceLastRebatch=0,e._batchDirty=!1,e._pickCommandsDirty=!0,e._wireframeDirty=!0,!0}function IHe(e,t){const n=DHe(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),f=e._uniformMap,h=e._boundingVolume;for(let _=0;_<r;++_){const g=o[_].offset,p=o[_].count;let y=i[_*2];l(y)||(y=i[_*2]=new dt({owner:e})),y.vertexArray=a,y.modelMatrix=u,y.offset=g,y.count=p,y.renderState=e._rsStencilDepthPass,y.shaderProgram=c,y.uniformMap=f,y.boundingVolume=h,y.cull=!1,y.pass=Be.TERRAIN_CLASSIFICATION;const C=dt.shallowClone(y,y.derivedCommands.tileset);C.renderState=e._rsStencilDepthPass3DTiles,C.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,y.derivedCommands.tileset=C;let T=i[_*2+1];l(T)||(T=i[_*2+1]=new dt({owner:e})),T.vertexArray=a,T.modelMatrix=u,T.offset=g,T.count=p,T.renderState=e._rsColorPass,T.shaderProgram=c,T.uniformMap=f,T.boundingVolume=h,T.cull=!1,T.pass=Be.TERRAIN_CLASSIFICATION;const E=dt.shallowClone(T,T.derivedCommands.tileset);E.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,T.derivedCommands.tileset=E}e._commandsDirty=!0}function PHe(e,t){if(e.classificationType===go.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]=dt.shallowClone(n[a],i[c]);u.shaderProgram=o,u.pass=Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,a+=2}e._commandsDirty=!1}function OHe(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],f=e._indexCounts[c],h=l(e._boundingVolumes)?e._boundingVolumes[c]:e.boundingVolume;let _=n[c*2];l(_)||(_=n[c*2]=new dt({owner:e,pickOnly:!0})),_.vertexArray=i,_.modelMatrix=s,_.offset=u,_.count=f,_.renderState=e._rsStencilDepthPass,_.shaderProgram=o,_.uniformMap=a,_.boundingVolume=h,_.pass=Be.TERRAIN_CLASSIFICATION;const g=dt.shallowClone(_,_.derivedCommands.tileset);g.renderState=e._rsStencilDepthPass3DTiles,g.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,_.derivedCommands.tileset=g;let p=n[c*2+1];l(p)||(p=n[c*2+1]=new dt({owner:e,pickOnly:!0})),p.vertexArray=i,p.modelMatrix=s,p.offset=u,p.count=f,p.renderState=e._rsPickPass,p.shaderProgram=r,p.uniformMap=a,p.boundingVolume=h,p.pass=Be.TERRAIN_CLASSIFICATION;const y=dt.shallowClone(p,p.derivedCommands.tileset);y.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,p.derivedCommands.tileset=y}e._pickCommandsDirty=!1}hf.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)}};hf.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function LHe(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=U.WHITE}const r=e._batchedIndices;for(i=r.length,o=0;o<i;++o)r[o].color=U.clone(U.WHITE);e._updatingAllCommands=!1,e._batchDirty=!0}const BHe=new U,RHe=U.WHITE,NHe=!0,MHe=/\$/;hf.prototype.applyStyle=function(e,t){if(!l(e)){LHe(this,t);return}const n=e.color,i=n instanceof Kl&&!MHe.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,BHe):RHe,c.show=l(e.show)?e.show.evaluate(c):NHe}if(i){const a=this._batchedIndices;for(r=a.length,s=0;s<r;++s)a[s].color=U.clone(U.WHITE);this._updatingAllCommands=!1,this._batchDirty=!0}};hf.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 f;for(f=0;f<u;++f){const y=c[f].offset,C=c[f].count;if(s>=y&&s<y+C)break}c.push(new ES({color:U.clone(t),offset:s,count:a,batchIds:[e]}));const h=[],_=[],g=c[f].batchIds,p=g.length;for(let y=0;y<p;++y){const C=g[y];if(C===e)continue;const T=n[C];o[T]<s?h.push(C):_.push(C)}_.length!==0&&c.push(new ES({color:U.clone(c[f].color),offset:s+a,count:c[f].offset+c[f].count-(s+a),batchIds:_})),h.length!==0?(c[f].count=s-c[f].offset,c[f].batchIds=h):c.splice(f,1),this._batchDirty=!0};function r4(e,t,n,i){const o=e.classificationType,r=o!==go.CESIUM_3D_TILE,s=o!==go.TERRAIN,a=t.commandList;let c=n.length,u,f;for(f=0;f<c;++f)r&&(u=n[f],u.pass=Be.TERRAIN_CLASSIFICATION,a.push(u)),s&&(u=n[f].derivedCommands.tileset,u.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,a.push(u));if(!(!t.invertClassification||!l(i)))for(c=i.length,f=0;f<c;++f)a.push(i[f])}function FHe(e,t){const n=e.commandList,i=t.length;for(let o=0;o<i;o+=2){const r=t[o+1];r.pass=Be.OPAQUE,n.push(r)}}function zHe(e){let t=e.debugWireframe===e._debugWireframe;if(t=t&&!(e.debugWireframe&&e._wireframeDirty),t)return;l(e._rsWireframe)||(e._rsWireframe=Qe.fromCache({}));let n,i;e.debugWireframe?(n=e._rsWireframe,i=Je.LINES):(n=e._rsColorPass,i=Je.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}hf.prototype.update=function(e){const t=e.context;AHe(this,t),CHe(this,t),EHe(this),xHe(this,t);const n=e.passes;n.render&&(IHe(this,t),PHe(this,e),zHe(this),this._debugWireframe?FHe(e,this._commands):r4(this,e,this._commands,this._commandsIgnoreShow)),n.pick&&(OHe(this),r4(this,e,this._pickCommands))};hf.prototype.isDestroyed=function(){return!1};hf.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(),Ue(this)};function gs(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=d.clone(this._boundingVolume.center):this._center=d.clone(d.ZERO)),this._boundingVolumes=void 0,this._batchedIndices=void 0,this._indices=void 0,this._indexOffsets=void 0,this._indexCounts=void 0,this._positions=void 0,this._vertexBatchIds=void 0,this._batchIds=void 0,this._batchTableColors=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=jHe(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=go.BOTH}Object.defineProperties(gs.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}}});gs.packedBoxLength=B.packedLength+d.packedLength;gs.packedCylinderLength=B.packedLength+2;gs.packedEllipsoidLength=B.packedLength+d.packedLength;gs.packedSphereLength=d.packedLength+1;function UHe(e){const t=new Float64Array(B.packedLength+d.packedLength);let n=0;return d.pack(e._center,t,n),n+=d.packedLength,B.pack(e._modelMatrix,t,n),t}function HHe(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=U.unpack(t,n);n+=U.packedLength;const f=t[n++],h=t[n++],_=t[n++],g=new Array(_);for(let p=0;p<_;++p)g[p]=t[n++];a[c]=new ES({color:u,offset:f,count:h,batchIds:g})}return i}const VHe=new vi("createVectorTileGeometries",5),kHe=new U;function GHe(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,f=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 C=0;C<p;++C){const T=y.getColor(C,kHe);u[C]=T.toRgba()}f=e._packedBuffer=UHe(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,f.buffer);const _={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:f.buffer},g=e._verticesPromise=VHe.scheduleTask(_,h);return l(g)?g.then(function(p){const y=new Float64Array(p.packedBuffer);HHe(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 WHe(e){e._ready&&!l(e._primitive)&&(e._primitive=new hf({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)}gs.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};gs.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};gs.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};gs.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function jHe(e){return new Promise(function(t,n){e._update=function(i,o){const r=GHe(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(){WHe(i),t(i)}).catch(function(s){n(s)})}})}gs.prototype.update=function(e){this._update(this,e)};gs.prototype.isDestroyed=function(){return!1};gs.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Ue(this)};function Ld(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=$He(this,i,o)}Object.defineProperties(Ld.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 qHe(e){return function(t,n){l(e._geometries)&&e._geometries.updateCommands(t,n)}}function YHe(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),f=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(f>0&&l(e.SPHERE_BATCH_IDS)){const p=t.byteOffset+e.SPHERE_BATCH_IDS.byteOffset;r=new Uint16Array(t.buffer,p,f)}const h=l(n)||l(i)||l(o)||l(r),_=a>0&&!l(n)||c>0&&!l(i)||u>0&&!l(o)||f>0&&!l(r);if(h&&_)throw new Se("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)&&f>0)for(r=new Uint16Array(f),s=0;s<f;++s)r[s]=p++}return{boxes:n,cylinders:i,ellipsoids:o,spheres:r}}const Zp=Uint32Array.BYTES_PER_ELEMENT;function $He(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Zp;const r=o.getUint32(n,!0);if(r!==1)throw new Se(`Only Geometry tile version 1 is supported. Version ${r} is not.`);n+=Zp;const s=o.getUint32(n,!0);if(n+=Zp,s===0){e._readyPromise.resolve(e);return}const a=o.getUint32(n,!0);if(n+=Zp,a===0)throw new Se("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=Zp;const u=o.getUint32(n,!0);n+=Zp;const f=o.getUint32(n,!0);n+=Zp;const h=Fa(i,n,a);n+=a;const _=new Uint8Array(t,n,c);n+=c;let g,p;u>0&&(g=Fa(i,n,u),n+=u,f>0&&(p=new Uint8Array(t,n,f),p=new Uint8Array(p)));const y=A(h.BOXES_LENGTH,0),C=A(h.CYLINDERS_LENGTH,0),T=A(h.ELLIPSOIDS_LENGTH,0),E=A(h.SPHERES_LENGTH,0),w=y+C+T+E,S=new gi(e,w,g,p,qHe(e));if(e._batchTable=S,w===0)return;const P=e.tile.computedTransform;let O;l(h.RTC_CENTER)&&(O=d.unpack(h.RTC_CENTER),B.multiplyByPoint(P,O,O));const z=YHe(h,_);if(y>0||C>0||T>0||E>0){let R,F,H,v;if(y>0){const I=_.byteOffset+h.BOXES.byteOffset;R=new Float32Array(_.buffer,I,gs.packedBoxLength*y)}if(C>0){const I=_.byteOffset+h.CYLINDERS.byteOffset;F=new Float32Array(_.buffer,I,gs.packedCylinderLength*C)}if(T>0){const I=_.byteOffset+h.ELLIPSOIDS.byteOffset;H=new Float32Array(_.buffer,I,gs.packedEllipsoidLength*T)}if(E>0){const I=_.byteOffset+h.SPHERES.byteOffset;v=new Float32Array(_.buffer,I,gs.packedSphereLength*E)}return e._geometries=new gs({boxes:R,boxBatchIds:z.boxes,cylinders:F,cylinderBatchIds:z.cylinders,ellipsoids:H,ellipsoidBatchIds:z.ellipsoids,spheres:v,sphereBatchIds:z.spheres,center:O,modelMatrix:P,batchTable:S,boundingVolume:e.tile.boundingVolume.boundingVolume}),e._geometries.readyPromise.then(function(){return e})}return Promise.resolve(e)}function z$(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}}Ld.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Ld.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 z$(this),this._features[e]};Ld.prototype.applyDebugSettings=function(e,t){l(this._geometries)&&this._geometries.applyDebugSettings(e,t)};Ld.prototype.applyStyle=function(e){z$(this),l(this._geometries)&&this._geometries.applyStyle(e,this._features)};Ld.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)};Ld.prototype.isDestroyed=function(){return!1};Ld.prototype.destroy=function(){return this._geometries=this._geometries&&this._geometries.destroy(),this._batchTable=this._batchTable&&this._batchTable.destroy(),Ue(this)};const MM={};MM.encode2D=function(e,t,n){const i=Math.pow(2,e);if(b.typeOf.number("level",e),b.typeOf.number("x",t),b.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),U$(i,o,r,s);return c};MM.decode2D=function(e,t){if(b.typeOf.number("level",e),b.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)),U$(s,i,o,r),i.x+=s*o,i.y+=s*r,a/=BigInt(4);return[i.x,i.y]};function U$(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 s4=MM,Pp=30,XHe=1<<Pp,KHe=1<<Pp+1>>>0,FM=2*Pp+1,wh=4,H$=[],V$=[],JHe=[[0,1,3,2],[0,2,3,1],[3,2,0,1],[3,1,0,2]],Nh=1,Jg=2,ex=[Nh,0,0,Nh|Jg];function ji(e){if(!un.supportsBigInt())throw new Se("S2 required BigInt support");if(!l(e))throw new x("cell ID is required.");if(!ji.isValidId(e))throw new x("cell ID is invalid.");this._cellId=e,this._level=ji.getLevel(e)}ji.fromToken=function(e){if(b.typeOf.string("token",e),!ji.isValidToken(e))throw new x("token is invalid.");return new ji(ji.getIdFromToken(e))};ji.isValidId=function(e){return b.typeOf.bigint("cellId",e),!(e<=0||e>>BigInt(FM)>5||!(e&~e+BigInt(1)&BigInt("0x1555555555555555")))};ji.isValidToken=function(e){return b.typeOf.string("token",e),/^[0-9a-fA-F]{1,16}$/.test(e)?ji.isValidId(ji.getIdFromToken(e)):!1};ji.getIdFromToken=function(e){return b.typeOf.string("token",e),BigInt("0x"+e+"0".repeat(16-e.length))};ji.getTokenFromId=function(e){b.typeOf.bigint("cellId",e);const t=Math.floor(aVe(e)/4),n=e.toString(16).replace(/0*$/,"");return Array(17-t-n.length).join("0")+n};ji.getLevel=function(e){if(b.typeOf.bigint("cellId",e),!ji.isValidId(e))throw new x;let t=0;for(;e!==BigInt(0)&&!(e&BigInt(1));)t++,e=e>>BigInt(1);return Pp-(t>>1)};ji.prototype.getChild=function(e){if(b.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=W$(this._cellId)>>BigInt(2),n=this._cellId+BigInt(2*e+1-4)*t;return new ji(n)};ji.prototype.getParent=function(){if(this._level===0)throw new x("cannot get parent of root cell.");const e=W$(this._cellId)<<BigInt(2);return new ji(this._cellId&~e+BigInt(1)|e)};ji.prototype.getParentAtLevel=function(e){if(this._level===0||e<0||this._level<e)throw new x("cannot get parent at invalid level.");const t=rVe(e);return new ji(this._cellId&-t|t)};ji.prototype.getCenter=function(e){e=A(e,pe.WGS84);let t=QHe(this._cellId,this._level);t=d.normalize(t,t);const n=new Ae.fromCartesian(t,pe.UNIT_SPHERE);return Ae.toCartesian(n,e,new d)};ji.prototype.getVertex=function(e,t){if(b.typeOf.number("index",e),e<0||e>3)throw new x("vertex index must be in the range [0-3].");t=A(t,pe.WGS84);let n=ZHe(this._cellId,this._level,e);n=d.normalize(n,n);const i=new Ae.fromCartesian(n,pe.UNIT_SPHERE);return Ae.toCartesian(i,t,new d)};ji.fromFacePositionLevel=function(e,t,n){if(b.typeOf.bigint("position",t),e<0||e>5)throw new x("Invalid S2 Face (must be within 0-5)");if(n<0||n>Pp)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(FM-2*n).join("0"),a=BigInt(`0b${i}${r}${o}1${s}`);return new ji(a)};function QHe(e,t){const n=eVe(e,t);return tVe(n[0],n[1],n[2])}function ZHe(e,t,n){const i=k$(e),o=nVe([i[1],i[2]],t),r=n>>1&1;return G$(i[0],o[0][r^n&1],o[1][r])}function eVe(e,t){const n=k$(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,f=(r<<1)+c;return[i,u,f]}function k$(e){H$.length===0&&oVe();const t=Number(e>>BigInt(FM));let n=t&Nh;const i=(1<<wh)-1;let o=0,r=0;for(let s=7;s>=0;s--){const c=(1<<2*(s===7?Pp-7*wh:wh))-1;n+=Number(e>>BigInt(s*2*wh+1)&BigInt(c))<<2,n=V$[n];const u=s*wh;o+=n>>wh+2<<u,r+=(n>>2&i)<<u,n&=Nh|Jg}return[t,o,r]}function tVe(e,t,n){const i=a4(t),o=a4(n),r=wS(i),s=wS(o);return G$(e,r,s)}function G$(e,t,n){switch(e){case 0:return new d(1,t,n);case 1:return new d(-t,1,n);case 2:return new d(-t,-n,1);case 3:return new d(-1,-n,-t);case 4:return new d(n,-1,-t);default:return new d(n,t,-1)}}function wS(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function a4(e){return 1/KHe*e}function nVe(e,t){const n=[[],[]],i=iVe(t);for(let o=0;o<2;++o){const r=e[o]&-i,s=r+i;n[o][0]=wS(c4(r)),n[o][1]=wS(c4(s))}return n}function iVe(e){return 1<<Pp-e>>>0}function c4(e){return 1/XHe*e}function Mh(e,t,n,i,o,r){if(e===wh){const s=(t<<wh)+n;H$[(s<<2)+i]=(o<<2)+r,V$[(o<<2)+i]=(s<<2)+r}else{e++,t<<=1,n<<=1,o<<=2;const s=JHe[r];Mh(e,t+(s[0]>>1),n+(s[0]&1),i,o,r^ex[0]),Mh(e,t+(s[1]>>1),n+(s[1]&1),i,o+1,r^ex[1]),Mh(e,t+(s[2]>>1),n+(s[2]&1),i,o+2,r^ex[2]),Mh(e,t+(s[3]>>1),n+(s[3]&1),i,o+3,r^ex[3])}}function oVe(){Mh(0,0,0,0,0,0),Mh(0,0,0,Nh,0,Nh),Mh(0,0,0,Jg,0,Jg),Mh(0,0,0,Nh|Jg,0,Nh|Jg)}function W$(e){return e&~e+BigInt(1)}function rVe(e){return BigInt(1)<<BigInt(2*(Pp-e))}const sVe=[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 aVe(e){return sVe[(-e&e)%BigInt(67)]}function tr(e,t){return l(e)&&l(e.extensions)&&l(e.extensions[t])}function SS(e){const t=e.lengthBits;let n=e.availableCount;b.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 Se(`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=cVe(o,t))}this._lengthBits=t,this._availableCount=n,this._constant=i,this._bitstream=o}function cVe(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(SS.prototype,{lengthBits:{get:function(){return this._lengthBits}},availableCount:{get:function(){return this._availableCount}}});SS.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 pf(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataTable,n=e.class,i=e.entityId,o=e.propertyTableJson;b.typeOf.object("options.metadataTable",t),b.typeOf.object("options.class",n),b.typeOf.number("options.entityId",i),b.typeOf.object("options.propertyTableJson",o),this._class=n,this._metadataTable=t,this._entityId=i,this._extensions=o.extensions,this._extras=o.extras}Object.defineProperties(pf.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});pf.prototype.hasProperty=function(e){return this._metadataTable.hasProperty(e)};pf.prototype.hasPropertyBySemantic=function(e){return this._metadataTable.hasPropertyBySemantic(e)};pf.prototype.getPropertyIds=function(e){return this._metadataTable.getPropertyIds(e)};pf.prototype.getProperty=function(e){return this._metadataTable.getProperty(this._entityId,e)};pf.prototype.setProperty=function(e,t){return this._metadataTable.setProperty(this._entityId,e,t)};pf.prototype.getPropertyBySemantic=function(e){return this._metadataTable.getPropertyBySemantic(this._entityId,e)};pf.prototype.setPropertyBySemantic=function(e,t){return this._metadataTable.setPropertyBySemantic(this._entityId,e,t)};const bw={QUADTREE:"QUADTREE",OCTREE:"OCTREE"};bw.getBranchingFactor=function(e){switch(e){case bw.OCTREE:return 8;case bw.QUADTREE:return 4;default:throw new x("subdivisionScheme is not a valid value.")}};const Cr=Object.freeze(bw);function kt(){}Object.defineProperties(kt.prototype,{class:{get:function(){x.throwInstantiationError()}}});kt.prototype.hasProperty=function(e){x.throwInstantiationError()};kt.prototype.hasPropertyBySemantic=function(e){x.throwInstantiationError()};kt.prototype.getPropertyIds=function(e){x.throwInstantiationError()};kt.prototype.getProperty=function(e){x.throwInstantiationError()};kt.prototype.setProperty=function(e,t){x.throwInstantiationError()};kt.prototype.getPropertyBySemantic=function(e){x.throwInstantiationError()};kt.prototype.setPropertyBySemantic=function(e,t){x.throwInstantiationError()};kt.hasProperty=function(e,t,n){if(b.typeOf.string("propertyId",e),b.typeOf.object("properties",t),b.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))};kt.hasPropertyBySemantic=function(e,t,n){b.typeOf.string("semantic",e),b.typeOf.object("properties",t),b.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return!1;const o=i[e];return l(o)};kt.getPropertyIds=function(e,t,n){b.typeOf.object("properties",e),b.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};kt.getProperty=function(e,t,n){if(b.typeOf.string("propertyId",e),b.typeOf.object("properties",t),b.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=ut(i.default,!0),i.unpackVectorAndMatrixTypes(o,r);if(l(o))return o=i.normalize(o),o=i.applyValueTransform(o),i.unpackVectorAndMatrixTypes(o,r)};kt.setProperty=function(e,t,n,i){if(b.typeOf.string("propertyId",e),b.defined("value",t),b.typeOf.object("properties",n),b.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};kt.getPropertyBySemantic=function(e,t,n){b.typeOf.string("semantic",e),b.typeOf.object("properties",t),b.typeOf.object("classDefinition",n);const i=n.propertiesBySemantic;if(!l(i))return;const o=i[e];if(l(o))return kt.getProperty(o.id,t,n)};kt.setPropertyBySemantic=function(e,t,n,i){b.typeOf.string("semantic",e),b.defined("value",t),b.typeOf.object("properties",n),b.typeOf.object("classDefinition",i);const o=i.propertiesBySemantic;if(!l(o))return!1;const r=i.propertiesBySemantic[e];return l(r)?kt.setProperty(r.id,t,n,i):!1};function Bd(e){e=A(e,A.EMPTY_OBJECT);const t=e.subtreeMetadata,n=e.class;b.typeOf.object("options.subtreeMetadata",t),b.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(Bd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Bd.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};Bd.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};Bd.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};Bd.prototype.getProperty=function(e){return kt.getProperty(e,this._properties,this._class)};Bd.prototype.setProperty=function(e,t){return kt.setProperty(e,t,this._properties,this._class)};Bd.prototype.getPropertyBySemantic=function(e){return kt.getPropertyBySemantic(e,this._properties,this._class)};Bd.prototype.setPropertyBySemantic=function(e,t){return kt.setPropertyBySemantic(e,t,this._properties,this._class)};const ft={INT8:"INT8",UINT8:"UINT8",INT16:"INT16",UINT16:"UINT16",INT32:"INT32",UINT32:"UINT32",INT64:"INT64",UINT64:"UINT64",FLOAT32:"FLOAT32",FLOAT64:"FLOAT64"};ft.getMinimum=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:return-128;case ft.UINT8:return 0;case ft.INT16:return-32768;case ft.UINT16:return 0;case ft.INT32:return-2147483648;case ft.UINT32:return 0;case ft.INT64:return un.supportsBigInt()?BigInt("-9223372036854775808"):-Math.pow(2,63);case ft.UINT64:return un.supportsBigInt()?BigInt(0):0;case ft.FLOAT32:return-34028234663852886e22;case ft.FLOAT64:return-Number.MAX_VALUE}};ft.getMaximum=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:return 127;case ft.UINT8:return 255;case ft.INT16:return 32767;case ft.UINT16:return 65535;case ft.INT32:return 2147483647;case ft.UINT32:return 4294967295;case ft.INT64:return un.supportsBigInt()?BigInt("9223372036854775807"):Math.pow(2,63)-1;case ft.UINT64:return un.supportsBigInt()?BigInt("18446744073709551615"):Math.pow(2,64)-1;case ft.FLOAT32:return 34028234663852886e22;case ft.FLOAT64:return Number.MAX_VALUE}};ft.isIntegerType=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:case ft.UINT8:case ft.INT16:case ft.UINT16:case ft.INT32:case ft.UINT32:case ft.INT64:case ft.UINT64:return!0;default:return!1}};ft.isUnsignedIntegerType=function(e){switch(b.typeOf.string("type",e),e){case ft.UINT8:case ft.UINT16:case ft.UINT32:case ft.UINT64:return!0;default:return!1}};ft.isVectorCompatible=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:case ft.UINT8:case ft.INT16:case ft.UINT16:case ft.INT32:case ft.UINT32:case ft.FLOAT32:case ft.FLOAT64:return!0;default:return!1}};ft.normalize=function(e,t){if(typeof e!="number"&&typeof e!="bigint")throw new x("value must be a number or a BigInt");if(!ft.isIntegerType(t))throw new x("type must be an integer type");return Math.max(Number(e)/Number(ft.getMaximum(t)),-1)};ft.unnormalize=function(e,t){if(b.typeOf.number("value",e),!ft.isIntegerType(t))throw new x("type must be an integer type");const n=ft.getMaximum(t),i=ft.isUnsignedIntegerType(t)?0:-n;return e=N.sign(e)*Math.round(Math.abs(e)*Number(n)),(t===ft.INT64||t===ft.UINT64)&&un.supportsBigInt()&&(e=BigInt(e)),e>n?n:e<i?i:e};ft.applyValueTransform=function(e,t,n){return n*e+t};ft.unapplyValueTransform=function(e,t,n){return n===0?0:(e-t)/n};ft.getSizeInBytes=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:case ft.UINT8:return 1;case ft.INT16:case ft.UINT16:return 2;case ft.INT32:case ft.UINT32:return 4;case ft.INT64:case ft.UINT64:return 8;case ft.FLOAT32:return 4;case ft.FLOAT64:return 8}};ft.fromComponentDatatype=function(e){switch(b.typeOf.number("componentDatatype",e),e){case ee.BYTE:return ft.INT8;case ee.UNSIGNED_BYTE:return ft.UINT8;case ee.SHORT:return ft.INT16;case ee.UNSIGNED_SHORT:return ft.UINT16;case ee.INT:return ft.INT32;case ee.UNSIGNED_INT:return ft.UINT32;case ee.FLOAT:return ft.FLOAT32;case ee.DOUBLE:return ft.FLOAT64}};ft.toComponentDatatype=function(e){switch(b.typeOf.string("type",e),e){case ft.INT8:return ee.BYTE;case ft.UINT8:return ee.UNSIGNED_BYTE;case ft.INT16:return ee.SHORT;case ft.UINT16:return ee.UNSIGNED_SHORT;case ft.INT32:return ee.INT;case ft.UINT32:return ee.UNSIGNED_INT;case ft.FLOAT32:return ee.FLOAT;case ft.FLOAT64:return ee.DOUBLE}};const Vt=Object.freeze(ft),Xi={SCALAR:"SCALAR",VEC2:"VEC2",VEC3:"VEC3",VEC4:"VEC4",MAT2:"MAT2",MAT3:"MAT3",MAT4:"MAT4",BOOLEAN:"BOOLEAN",STRING:"STRING",ENUM:"ENUM"};Xi.isVectorType=function(e){switch(b.typeOf.string("type",e),e){case Xi.VEC2:case Xi.VEC3:case Xi.VEC4:return!0;default:return!1}};Xi.isMatrixType=function(e){switch(b.typeOf.string("type",e),e){case Xi.MAT2:case Xi.MAT3:case Xi.MAT4:return!0;default:return!1}};Xi.getComponentCount=function(e){switch(b.typeOf.string("type",e),e){case Xi.SCALAR:case Xi.STRING:case Xi.ENUM:case Xi.BOOLEAN:return 1;case Xi.VEC2:return 2;case Xi.VEC3:return 3;case Xi.VEC4:return 4;case Xi.MAT2:return 4;case Xi.MAT3:return 9;case Xi.MAT4:return 16;default:throw new x(`Invalid metadata type ${e}`)}};Xi.getMathType=function(e){switch(e){case Xi.VEC2:return j;case Xi.VEC3:return d;case Xi.VEC4:return oe;case Xi.MAT2:return at;case Xi.MAT3:return J;case Xi.MAT4:return B;default:return}};const It=Object.freeze(Xi);function Vr(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.type;b.typeOf.string("options.id",t),b.typeOf.string("options.type",n);const i=e.componentType,o=e.enumType,r=l(i)&&Vt.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=ut(e.min,!0),this._max=ut(e.max,!0),this._normalized=r;let s=ut(e.offset,!0),a=ut(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=ut(e.noData,!0),this._default=ut(e.default,!0),this._required=A(e.required,!0),this._extras=ut(e.extras,!0),this._extensions=ut(e.extensions,!0)}Vr.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.property;b.typeOf.string("options.id",t),b.typeOf.object("options.property",n),b.typeOf.string("options.property.type",n.type);const i=lVe(n),o=uVe(n,e.enums);let r;return l(i)?i?r=l(n.optional)?!n.optional:!0:r=A(n.required,!1):r=!1,new Vr({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(Vr.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 lVe(e){if(e.type==="ARRAY")return!0;const t=e.type;if(t===It.SCALAR||It.isMatrixType(t)||It.isVectorType(t))return!1;if(l(Vt[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 uVe(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===It.ENUM)return{type:n,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&i===It.ENUM)return{type:i,componentType:void 0,enumType:c,valueType:c.valueType,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===It.SCALAR||It.isMatrixType(n)||It.isVectorType(n))return{type:n,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(n===It.BOOLEAN||n===It.STRING)return{type:n,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(o&&(i===It.BOOLEAN||i===It.STRING))return{type:i,componentType:void 0,enumType:void 0,valueType:void 0,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l(i)&&l(Vt[i]))return{type:It.SCALAR,componentType:i,enumType:void 0,valueType:i,isArray:r,isVariableLengthArray:a,arrayLength:s};if(l(Vt[n]))return{type:It.SCALAR,componentType:n,enumType:void 0,valueType:n,isArray:r,isVariableLengthArray:a,arrayLength:s};throw new x(`unknown metadata type {type: ${n}, componentType: ${i})`)}Vr.prototype.normalize=function(e){return this._normalized?zM(e,this._valueType,Vt.normalize):e};Vr.prototype.unnormalize=function(e){return this._normalized?zM(e,this._valueType,Vt.unnormalize):e};Vr.prototype.applyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Vr.valueTransformInPlace(e,this._offset,this._scale,Vt.applyValueTransform)};Vr.prototype.unapplyValueTransform=function(e){return!this._hasValueTransform||this._isVariableLengthArray?e:Vr.valueTransformInPlace(e,this._offset,this._scale,Vt.unapplyValueTransform)};Vr.prototype.expandConstant=function(e,t){t=A(t,!1);const n=this._isArray,i=this._arrayLength,o=It.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)};Vr.prototype.handleNoData=function(e){const t=this._noData;if(!l(t))return e;if(!j$(e,t))return e};function j$(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(!j$(e[n],t[n]))return!1;return!0}Vr.prototype.unpackVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=It.getMathType(this._type),i=this._isArray,o=It.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};Vr.prototype.packVectorAndMatrixTypes=function(e,t){t=A(t,!1);const n=It.getMathType(this._type),i=this._isArray,o=It.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};Vr.prototype.validate=function(e){if(!(!l(e)&&l(this._default)))return this._required&&!l(e)?"required property must have a value":this._isArray?fVe(this,e):q$(this,e)};function fVe(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=q$(e,t[i]);if(l(o))return o}}function q$(e,t){const n=e._type,i=e._componentType,o=e._enumType,r=e._normalized;return It.isVectorType(n)?dVe(t,n,i):It.isMatrixType(n)?hVe(t,n,i):n===It.STRING?pVe(t):n===It.BOOLEAN?mVe(t):n===It.ENUM?_Ve(t,o):gVe(t,i,r)}function dVe(e,t,n){if(!Vt.isVectorCompatible(n))return`componentType ${n} is incompatible with vector type ${t}`;if(t===It.VEC2&&!(e instanceof j))return`vector value ${e} must be a Cartesian2`;if(t===It.VEC3&&!(e instanceof d))return`vector value ${e} must be a Cartesian3`;if(t===It.VEC4&&!(e instanceof oe))return`vector value ${e} must be a Cartesian4`}function hVe(e,t,n){if(!Vt.isVectorCompatible(n))return`componentType ${n} is incompatible with matrix type ${t}`;if(t===It.MAT2&&!(e instanceof at))return`matrix value ${e} must be a Matrix2`;if(t===It.MAT3&&!(e instanceof J))return`matrix value ${e} must be a Matrix3`;if(t===It.MAT4&&!(e instanceof B))return`matrix value ${e} must be a Matrix4`}function pVe(e){if(typeof e!="string")return vS(e,It.STRING)}function mVe(e){if(typeof e!="boolean")return vS(e,It.BOOLEAN)}function _Ve(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 gVe(e,t,n){const i=typeof e;switch(t){case Vt.INT8:case Vt.UINT8:case Vt.INT16:case Vt.UINT16:case Vt.INT32:case Vt.UINT32:case Vt.FLOAT32:case Vt.FLOAT64:return i!=="number"?vS(e,t):isFinite(e)?u4(e,t,n):f4(e,t);case Vt.INT64:case Vt.UINT64:return i!=="number"&&i!=="bigint"?vS(e,t):i==="number"&&!isFinite(e)?f4(e,t):u4(e,t,n)}}function vS(e,t){return`value ${e} does not match type ${t}`}function l4(e,t,n){let i=`value ${e} is out of range for type ${t}`;return n&&(i+=" (normalized)"),i}function u4(e,t,n){if(n){const i=Vt.isUnsignedIntegerType(t)?0:-1,o=1;return e<i||e>o?l4(e,t,n):void 0}if(e<Vt.getMinimum(t)||e>Vt.getMaximum(t))return l4(e,t,n)}function f4(e,t){return`value ${e} of type ${t} must be finite`}function zM(e,t,n){if(!Array.isArray(e))return n(e,t);for(let i=0;i<e.length;i++)e[i]=zM(e[i],t,n);return e}Vr.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]=Vr.valueTransformInPlace(e[o],t[o],n[o],i);return e};function XT(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.property,i=e.classProperty,o=e.bufferViews;b.typeOf.number.greaterThan("options.count",t,0),b.typeOf.object("options.property",n),b.typeOf.object("options.classProperty",i),b.typeOf.object("options.bufferViews",o);const r=i.type,s=i.isArray,a=i.isVariableLengthArray;let c=i.valueType;const u=i.enumType,f=r===It.STRING,h=r===It.BOOLEAN;let _=0,g;if(a){let v=A(n.arrayOffsetType,n.offsetType);v=A(Vt[v],Vt.UINT32);const I=A(n.arrayOffsets,n.arrayOffsetBufferView);g=new aO(o[I],v,t+1),_+=g.typedArray.byteLength}const p=It.getComponentCount(r);let y;a?y=g.get(t)-g.get(0):s?y=t*i.arrayLength:y=t;const C=p*y;let T;if(f){let v=A(n.stringOffsetType,n.offsetType);v=A(Vt[v],Vt.UINT32);const I=A(n.stringOffsets,n.stringOffsetBufferView);T=new aO(o[I],v,C+1),_+=T.typedArray.byteLength}(f||h)&&(c=Vt.UINT8);let E;f?E=T.get(C)-T.get(0):h?E=Math.ceil(C/8):E=C;const w=A(n.values,n.bufferView),S=new aO(o[w],c,E);_+=S.typedArray.byteLength;let P=n.offset,O=n.scale;const z=i.hasValueTransform||l(P)||l(O);P=A(P,i.offset),O=A(O,i.scale),P=d4(P),O=d4(O);let R,F;const H=this;f?R=function(v){return CVe(v,H._values,H._stringOffsets)}:h?(R=function(v){return TVe(v,H._values)},F=function(v,I){bVe(v,H._values,I)}):l(u)?(R=function(v){const I=H._values.get(v);return u.namesByValue[I]},F=function(v,I){const m=u.valuesByName[I];H._values.set(v,m)}):(R=function(v){return H._values.get(v)},F=function(v,I){H._values.set(v,I)}),this._arrayOffsets=g,this._stringOffsets=T,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=O,this._hasValueTransform=z,this._getValue=R,this._setValue=F,this._unpackedValues=void 0,this._extras=n.extras,this._extensions=n.extensions,this._byteLength=_}Object.defineProperties(XT.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}}});XT.prototype.get=function(e){Y$(this,e);let t=yVe(this,e);return t=this._classProperty.handleNoData(t),l(t)?(t=this._classProperty.normalize(t),t=PVe(this,t),this._classProperty.unpackVectorAndMatrixTypes(t)):(t=this._classProperty.default,this._classProperty.unpackVectorAndMatrixTypes(t))};XT.prototype.set=function(e,t){const n=this._classProperty;b.defined("value",t),Y$(this,e);const i=n.validate(t);if(l(i))throw new x(i);t=n.packVectorAndMatrixTypes(t),t=OVe(this,t),t=n.unnormalize(t),AVe(this,e,t)};XT.prototype.getTypedArray=function(){if(l(this._values))return this._values.typedArray};function d4(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 Y$(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 yVe(e,t){X$(e)&&K$(e);const n=e._classProperty,i=n.isArray,o=n.type,r=It.getComponentCount(o);if(l(e._unpackedValues)){const s=e._unpackedValues[t];return i?ut(s,!0):s}return!i&&r===1?e._getValue(t):$$(e,n,t)}function $$(e,t,n){let i,o;if(t.isVariableLengthArray){i=e._arrayOffsets.get(n),o=e._arrayOffsets.get(n+1)-i;const s=It.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 AVe(e,t,n){DVe(e,t,n)&&K$(e);const i=e._classProperty,o=i.isArray,r=i.type,s=It.getComponentCount(r);if(l(e._unpackedValues)){i.isArray&&(n=ut(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 f=A(i.arrayLength,1)*e._vectorComponentCount;a=t*f,c=f}for(let u=0;u<c;++u)e._setValue(a+u,n[u])}function CVe(e,t,n){const i=n.get(e),o=n.get(e+1)-i;return Xa(t.typedArray,i,o)}function TVe(e,t){const n=e>>3,i=e%8;return(t.typedArray[n]>>i&1)===1}function bVe(e,t,n){const i=e>>3,o=e%8;n?t.typedArray[i]|=1<<o:t.typedArray[i]&=~(1<<o)}function EVe(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 xVe(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 wVe(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 SVe(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 vVe(e){switch(e){case Vt.INT8:return ee.BYTE;case Vt.UINT8:return ee.UNSIGNED_BYTE;case Vt.INT16:return ee.SHORT;case Vt.UINT16:return ee.UNSIGNED_SHORT;case Vt.INT32:return ee.INT;case Vt.UINT32:return ee.UNSIGNED_INT;case Vt.FLOAT32:return ee.FLOAT;case Vt.FLOAT64:return ee.DOUBLE}}function X$(e){if(l(e._unpackedValues))return!1;const t=e._classProperty,n=t.type,i=t.valueType;return n===It.STRING||i===Vt.INT64&&!un.supportsBigInt64Array()||i===Vt.UINT64&&!un.supportsBigUint64Array()}function DVe(e,t,n){if(X$(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=IVe(e),e._arrayOffsets=void 0,e._stringOffsets=void 0,e._values=void 0}function IVe(e){const t=e._count,n=new Array(t),i=e._classProperty,o=i.isArray,r=i.type,s=It.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]=$$(e,i,a);return n}function PVe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Vr.valueTransformInPlace(t,e._offset,e._scale,Vt.applyValueTransform)}function OVe(e,t){const i=e._classProperty.isVariableLengthArray;return!e._hasValueTransform||i?t:Vr.valueTransformInPlace(t,e._offset,e._scale,Vt.unapplyValueTransform)}function aO(e,t,n){const i=this;let o,r,s;if(t===Vt.INT64)un.supportsBigInt()?un.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 xVe(a,i)}):(Di("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 EVe(a,i)});else if(t===Vt.UINT64)un.supportsBigInt()?un.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 SVe(a,i)}):(Di("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 wVe(a,i)});else{const a=vVe(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 wa(e){e=A(e,A.EMPTY_OBJECT);const t=e.count,n=e.class;b.typeOf.number.greaterThan("options.count",t,0),b.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 XT({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(wa.prototype,{count:{get:function(){return this._count}},class:{get:function(){return this._class}},byteLength:{get:function(){return this._byteLength}}});wa.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};wa.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};wa.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};wa.prototype.getProperty=function(e,t){b.typeOf.string("propertyId",t);const n=this._properties[t];let i;return l(n)?i=n.get(e):i=LVe(this._class,t),i};wa.prototype.setProperty=function(e,t,n){b.typeOf.string("propertyId",t);const i=this._properties[t];return l(i)?(i.set(e,n),!0):!1};wa.prototype.getPropertyBySemantic=function(e,t){b.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)};wa.prototype.setPropertyBySemantic=function(e,t,n){b.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};wa.prototype.getPropertyTypedArray=function(e){b.typeOf.string("propertyId",e);const t=this._properties[e];if(l(t))return t.getTypedArray()};wa.prototype.getPropertyTypedArrayBySemantic=function(e){b.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 LVe(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=ut(o,!0)),o=i.normalize(o),i.unpackVectorAndMatrixTypes(o)}}function ir(){}Object.defineProperties(ir.prototype,{promise:{get:function(){x.throwInstantiationError()}},cacheKey:{get:function(){x.throwInstantiationError()}}});ir.prototype.load=function(){x.throwInstantiationError()};ir.prototype.unload=function(){};ir.prototype.process=function(e){};ir.prototype.getError=function(e,t){b.typeOf.string("errorMessage",e),l(t)&&(e+=`
${t.message}`);const n=new Se(e);return l(t)&&(n.stack=`Original stack:
${t.stack}
Handler stack:
${n.stack}`),n};ir.prototype.isDestroyed=function(){return!1};ir.prototype.destroy=function(){return this.unload(),Ue(this)};const BVe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},Lt=Object.freeze(BVe);function zl(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=Lt.UNLOADED,this._promise=void 0}l(Object.create)&&(zl.prototype=Object.create(ir.prototype),zl.prototype.constructor=zl);Object.defineProperties(zl.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});zl.prototype.load=function(){return l(this._typedArray)?this._promise=Promise.resolve(this):this._promise=RVe(this),this._promise};function RVe(e){const t=e._resource;return e._state=Lt.LOADING,zl._fetchArrayBuffer(t).then(function(n){if(!e.isDestroyed())return e._typedArray=new Uint8Array(n),e._state=Lt.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Lt.FAILED;const i=`Failed to load external buffer: ${t.url}`;return Promise.reject(e.getError(i,n))})}zl._fetchArrayBuffer=function(e){return e.fetchArrayBuffer()};zl.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(_){n=_.instance,n.exports.__wasm_call_ctors(),n.exports.meshopt_encodeVertexVersion(0),n.exports.meshopt_encodeIndexVersion(1)});function o(_){for(var g=new Uint8Array(_.length),p=0;p<_.length;++p){var y=_.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var C=0,p=0;p<_.length;++p)g[C++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,C)}function r(_){if(!_)throw new Error("Assertion failed")}function s(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function a(_,g,p){var y=n.exports.sbrk,C=y(_.length*4),T=y(g*4),E=new Uint8Array(n.exports.memory.buffer),w=s(_);E.set(w,C),p&&p(C,C,_.length,g);var S=n.exports.meshopt_optimizeVertexFetchRemap(T,C,_.length,g);E=new Uint8Array(n.exports.memory.buffer);var P=new Uint32Array(g);new Uint8Array(P.buffer).set(E.subarray(T,T+g*4)),w.set(E.subarray(C,C+_.length*4)),y(C-y(0));for(var O=0;O<_.length;++O)_[O]=P[_[O]];return[P,S]}function c(_,g,p,y,C){var T=n.exports.sbrk,E=T(g),w=T(y*C),S=new Uint8Array(n.exports.memory.buffer);S.set(s(p),w);var P=_(E,g,w,y,C),O=new Uint8Array(P);return O.set(S.subarray(E,E+P)),T(E-T(0)),O}function u(_){for(var g=0,p=0;p<_.length;++p){var y=_[p];g=g<y?y:g}return g}function f(_,g){if(r(g==2||g==4),g==4)return new Uint32Array(_.buffer,_.byteOffset,_.byteLength/4);var p=new Uint16Array(_.buffer,_.byteOffset,_.byteLength/2);return new Uint32Array(p)}function h(_,g,p,y,C,T){var E=n.exports.sbrk,w=E(p*y),S=E(p*T),P=new Uint8Array(n.exports.memory.buffer);P.set(s(g),S),_(w,p,y,C,S);var O=new Uint8Array(p*y);return O.set(P.subarray(w,w+p*y)),E(w-E(0)),O}return{ready:i,supported:!0,reorderMesh:function(_,g,p){var y=g?p?n.exports.meshopt_optimizeVertexCacheStrip:n.exports.meshopt_optimizeVertexCache:void 0;return a(_,u(_)+1,y)},encodeVertexBuffer:function(_,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,_,g,p)},encodeIndexBuffer:function(_,g,p){r(p==2||p==4),r(g%3==0);var y=f(_,p),C=n.exports.meshopt_encodeIndexBufferBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexBuffer,C,y,g,4)},encodeIndexSequence:function(_,g,p){r(p==2||p==4);var y=f(_,p),C=n.exports.meshopt_encodeIndexSequenceBound(g,u(y)+1);return c(n.exports.meshopt_encodeIndexSequence,C,y,g,4)},encodeGltfBuffer:function(_,g,p,y){var C={ATTRIBUTES:this.encodeVertexBuffer,TRIANGLES:this.encodeIndexBuffer,INDICES:this.encodeIndexSequence};return r(C[y]),C[y](_,g,p)},encodeFilterOct:function(_,g,p,y){return r(p==4||p==8),r(y>=1&&y<=16),h(n.exports.meshopt_encodeFilterOct,_,g,p,y,16)},encodeFilterQuat:function(_,g,p,y){return r(p==8),r(y>=4&&y<=16),h(n.exports.meshopt_encodeFilterQuat,_,g,p,y,16)},encodeFilterExp:function(_,g,p,y){return r(p>0&&p%4==0),r(y>=1&&y<=24),h(n.exports.meshopt_encodeFilterExp,_,g,p,y,p)}}})();var NVe=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 _=new Uint8Array(h.length),g=0;g<h.length;++g){var p=h.charCodeAt(g);_[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)_[y++]=_[g]<60?i[_[g]]:(_[g]-60)*64+_[++g];return _.buffer.slice(0,y)}function c(h,_,g,p,y,C){var T=r.exports.sbrk,E=g+3&-4,w=T(E*p),S=T(y.length),P=new Uint8Array(r.exports.memory.buffer);P.set(y,S);var O=h(w,g,p,S,y.length);if(O==0&&C&&C(w,E,p),_.set(P.subarray(w,w+g*p)),T(w-T(0)),O!=0)throw new Error("Malformed buffer data: "+O)}var u={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},f={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:s,supported:!0,decodeVertexBuffer:function(h,_,g,p,y){c(r.exports.meshopt_decodeVertexBuffer,h,_,g,p,r.exports[u[y]])},decodeIndexBuffer:function(h,_,g,p){c(r.exports.meshopt_decodeIndexBuffer,h,_,g,p)},decodeIndexSequence:function(h,_,g,p){c(r.exports.meshopt_decodeIndexSequence,h,_,g,p)},decodeGltfBuffer:function(h,_,g,p,y,C){c(r.exports[f[y]],h,_,g,p,r.exports[u[C]])}}}();(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(_){n=_.instance,n.exports.__wasm_call_ctors()});function o(_){for(var g=new Uint8Array(_.length),p=0;p<_.length;++p){var y=_.charCodeAt(p);g[p]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}for(var C=0,p=0;p<_.length;++p)g[C++]=g[p]<60?t[g[p]]:(g[p]-60)*64+g[++p];return g.buffer.slice(0,C)}function r(_){if(!_)throw new Error("Assertion failed")}function s(_){return new Uint8Array(_.buffer,_.byteOffset,_.byteLength)}function a(_,g){var p=n.exports.sbrk,y=p(_.length*4),C=p(g*4),T=new Uint8Array(n.exports.memory.buffer),E=s(_);T.set(E,y);var w=n.exports.meshopt_optimizeVertexFetchRemap(C,y,_.length,g);T=new Uint8Array(n.exports.memory.buffer);var S=new Uint32Array(g);new Uint8Array(S.buffer).set(T.subarray(C,C+g*4)),E.set(T.subarray(y,y+_.length*4)),p(y-p(0));for(var P=0;P<_.length;++P)_[P]=S[_[P]];return[S,w]}function c(_){for(var g=0,p=0;p<_.length;++p){var y=_[p];g=g<y?y:g}return g}function u(_,g,p,y,C,T,E,w,S){var P=n.exports.sbrk,O=P(4),z=P(p*4),R=P(C*T),F=P(p*4),H=new Uint8Array(n.exports.memory.buffer);H.set(s(y),R),H.set(s(g),F);var v=_(z,F,p,R,C,T,E,w,S,O);H=new Uint8Array(n.exports.memory.buffer);var I=new Uint32Array(v);s(I).set(H.subarray(z,z+v*4));var m=new Float32Array(1);return s(m).set(H.subarray(O,O+4)),P(O-P(0)),[I,m[0]]}function f(_,g,p,y){var C=n.exports.sbrk,T=C(p*y),E=new Uint8Array(n.exports.memory.buffer);E.set(s(g),T);var w=_(T,p,y);return C(T-C(0)),w}var h={LockBorder:1};return{ready:i,supported:!0,compactMesh:function(_){r(_ instanceof Uint32Array||_ instanceof Int32Array||_ instanceof Uint16Array||_ instanceof Int16Array),r(_.length%3==0);var g=_.BYTES_PER_ELEMENT==4?_:new Uint32Array(_);return a(g,c(_)+1)},simplify:function(_,g,p,y,C,T){r(_ instanceof Uint32Array||_ instanceof Int32Array||_ instanceof Uint16Array||_ instanceof Int16Array),r(_.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<(T?T.length:0);++w)E|=h[T[w]];var S=_.BYTES_PER_ELEMENT==4?_:new Uint32Array(_),P=u(n.exports.meshopt_simplify,S,_.length,g,g.length,p*4,y,C,E);return P[0]=_ instanceof Uint32Array?P[0]:new _.constructor(P[0]),P},getScale:function(_,g){return r(_ instanceof Float32Array),r(_.length%g==0),f(n.exports.meshopt_simplifyScale,_,_.length,g*4)}}})();function ed(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;b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.number("options.bufferViewId",i),b.typeOf.object("options.gltfResource",o),b.typeOf.object("options.baseResource",r);const a=n.bufferViews[i];let c=a.buffer,u=a.byteOffset,f=a.byteLength,h=!1,_,g,p,y;if(tr(a,"EXT_meshopt_compression")){const T=a.extensions.EXT_meshopt_compression;c=T.buffer,u=A(T.byteOffset,0),f=T.byteLength,h=!0,_=T.byteStride,g=T.count,p=T.mode,y=A(T.filter,"NONE")}const C=n.buffers[c];this._hasMeshopt=h,this._meshoptByteStride=_,this._meshoptCount=g,this._meshoptMode=p,this._meshoptFilter=y,this._resourceCache=t,this._gltfResource=o,this._baseResource=r,this._buffer=C,this._bufferId=c,this._byteOffset=u,this._byteLength=f,this._cacheKey=s,this._bufferLoader=void 0,this._typedArray=void 0,this._state=Lt.UNLOADED,this._promise=void 0,this._process=function(T,E){}}l(Object.create)&&(ed.prototype=Object.create(ir.prototype),ed.prototype.constructor=ed);Object.defineProperties(ed.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},typedArray:{get:function(){return this._typedArray}}});ed.prototype.load=function(){const e=MVe(this);this._bufferLoader=e,this._state=Lt.LOADING;const t=this,n=new Promise(function(i){t._process=function(o,r){if(!o._hasMeshopt||!l(o._typedArray)||o._state!==Lt.PROCESSING)return;const s=o._meshoptCount,a=o._meshoptByteStride,c=new Uint8Array(s*a);NVe.decodeGltfBuffer(c,s,a,o._typedArray,o._meshoptMode,o._meshoptFilter),o._typedArray=c,o._state=Lt.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=Lt.PROCESSING,n):(t._state=Lt.READY,t)}).catch(function(i){if(t.isDestroyed())return;t.unload(),t._state=Lt.FAILED;const o="Failed to load buffer view";return Promise.reject(t.getError(o,i))}),this._promise};function MVe(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})}ed.prototype.process=function(e){return b.typeOf.object("frameState",e),this._process(this,e)};ed.prototype.unload=function(){l(this._bufferLoader)&&this._resourceCache.unload(this._bufferLoader),this._bufferLoader=void 0,this._typedArray=void 0};function Qr(){}Qr._maxDecodingConcurrency=Math.max(un.hardwareConcurrency-1,1);Qr._decoderTaskProcessor=void 0;Qr._taskProcessorReady=!1;Qr._getDecoderTaskProcessor=function(){if(!l(Qr._decoderTaskProcessor)){const e=new vi("decodeDraco",Qr._maxDecodingConcurrency);e.initWebAssemblyModule({modulePath:"ThirdParty/Workers/draco_decoder_nodejs.js",wasmBinaryFile:"ThirdParty/draco_decoder.wasm"}).then(function(){Qr._taskProcessorReady=!0}),Qr._decoderTaskProcessor=e}return Qr._decoderTaskProcessor};Qr.decodePointCloud=function(e){const t=Qr._getDecoderTaskProcessor();if(Qr._taskProcessorReady)return t.scheduleTask(e,[e.buffer.buffer])};Qr.decodeBufferView=function(e){const t=Qr._getDecoderTaskProcessor();if(Qr._taskProcessorReady)return t.scheduleTask(e,[e.array.buffer])};function td(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;b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.object("options.draco",i),b.typeOf.object("options.gltfResource",o),b.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=Lt.UNLOADED,this._promise=void 0,this._process=function(a,c){}}l(Object.create)&&(td.prototype=Object.create(ir.prototype),td.prototype.constructor=td);Object.defineProperties(td.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},decodedData:{get:function(){return this._decodedData}}});td.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=Lt.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,f=s._gltf.bufferViews,h=c.bufferView,_=f[h],g=c.attributes,p={array:new Uint8Array(s._bufferViewTypedArray),bufferView:_,compressedAttributes:g,dequantizeInShader:!0},y=Qr.decodeBufferView(p);l(y)&&(s._decodePromise=y.then(function(C){if(s.isDestroyed()){o();return}s.unload(),s._decodedData={indices:C.indexArray,vertexAttributes:C.attributeData},s._state=Lt.READY,o(s)}).catch(function(C){if(s.isDestroyed()){o();return}r(C)}))}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._bufferViewTypedArray=t.typedArray,n._state=Lt.PROCESSING,i}).catch(function(o){if(!n.isDestroyed())return FVe(n,o)}),this._promise};function FVe(e,t){e.unload(),e._state=Lt.FAILED;const n="Failed to load Draco";return Promise.reject(e.getError(n,t))}td.prototype.process=function(e){return b.typeOf.object("frameState",e),this._process(this,e)};td.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 zVe(e){const t=e.uint8Array,n=e.format,i=e.request,o=A(e.flipY,!1),r=A(e.skipColorSpaceConversion,!1);b.typeOf.object("uint8Array",t),b.typeOf.string("format",n);const s=new Blob([t],{type:n});let a;return Re.supportsImageBitmapOptions().then(function(c){return c?Promise.resolve(Re.createImageBitmapFromBlob(s,{flipY:o,premultiplyAlpha:!1,skipColorSpaceConversion:r})):(a=window.URL.createObjectURL(s),new Re({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 Uu(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;b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.number("options.imageId",i),b.typeOf.object("options.gltfResource",o),b.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=Lt.UNLOADED,this._promise=void 0}l(Object.create)&&(Uu.prototype=Object.create(ir.prototype),Uu.prototype.constructor=Uu);Object.defineProperties(Uu.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}}});Uu.prototype.load=function(){return l(this._bufferViewId)?(this._promise=UVe(this),this._promise):(this._promise=HVe(this),this._promise)};function J$(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 UVe(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoader=n,e._state=Lt.LOADING,n.promise.then(function(){if(e.isDestroyed())return;const i=n.typedArray;return kVe(i).then(function(o){if(e.isDestroyed())return;const r=J$(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Lt.READY,e})}).catch(function(i){if(!e.isDestroyed())return Q$(e,i,"Failed to load embedded image")})}function HVe(e){const t=e._baseResource,n=e._uri,i=t.getDerivedResource({url:n});return e._state=Lt.LOADING,WVe(i).then(function(o){if(e.isDestroyed())return;const r=J$(o);return e.unload(),e._image=r.image,e._mipLevels=r.mipLevels,e._state=Lt.READY,e}).catch(function(o){if(!e.isDestroyed())return Q$(e,o,`Failed to load image: ${n}`)})}function Q$(e,t,n){return e.unload(),e._state=Lt.FAILED,Promise.reject(e.getError(n,t))}function VVe(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 Se("Image format is not recognized")}function kVe(e){const t=VVe(e);if(t==="image/ktx2"){const n=new Uint8Array(e);return b_(n)}return Uu._loadImageFromTypedArray({uint8Array:e,format:t,flipY:!1,skipColorSpaceConversion:!0})}const GVe=/(^data:image\/ktx2)|(\.ktx2$)/i;function WVe(e){const t=e.getUrlComponent(!1,!0);return GVe.test(t)?b_(e):e.fetchImage({skipColorSpaceConversion:!0,preferImageBitmap:!0})}Uu.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};Uu._loadImageFromTypedArray=zVe;function nd(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),f=A(e.loadTypedArray,!1);if(b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.number("options.accessorId",i),b.typeOf.object("options.gltfResource",o),b.typeOf.object("options.baseResource",r),!u&&!f)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=f,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Lt.UNLOADED,this._promise=void 0,this._process=function(_,g){}}l(Object.create)&&(nd.prototype=Object.create(ir.prototype),nd.prototype.constructor=nd);Object.defineProperties(nd.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 jVe=new UM;nd.prototype.load=function(){let e;l(this._draco)?e=qVe(this):e=YVe(this);const t=this,n=new Promise(function(i){t._process=function(o,r){if(o._state===Lt.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=jVe;if(u.set(s,a,r.context),!r.jobScheduler.execute(u,Sl.BUFFER))return;c=u.buffer}else o._loadBuffer&&(c=Z$(s,a,r.context));o.unload(),o._buffer=c,o._typedArray=o._loadTypedArray?s:void 0,o._state=Lt.READY,i(o)}});return this._promise=e.then(function(){if(!t.isDestroyed())return n}).catch(function(i){if(!t.isDestroyed())return XVe(t,i)}),this._promise};function qVe(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Lt.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=Lt.PROCESSING,e})}function YVe(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=Lt.LOADING,e._bufferViewLoader=s,s.promise.then(function(){if(e.isDestroyed())return;const a=s.typedArray;return e._typedArray=$Ve(e,a),e._state=Lt.PROCESSING,e})}function $Ve(e,t){const n=e._gltf,i=e._accessorId,o=n.accessors[i],r=o.count,s=o.componentType,a=it.getSizeInBytes(s);let c=t.buffer,u=t.byteOffset+o.byteOffset;if(u%a!==0){const h=r*a,_=new Uint8Array(c,u,h);c=new Uint8Array(_).buffer,u=0,Tp("index-buffer-unaligned",`The index array is not aligned to a ${a}-byte boundary.`)}let f;return s===it.UNSIGNED_BYTE?f=new Uint8Array(c,u,r):s===it.UNSIGNED_SHORT?f=new Uint16Array(c,u,r):s===it.UNSIGNED_INT&&(f=new Uint32Array(c,u,r)),f}function XVe(e,t){e.unload(),e._state=Lt.FAILED;const n="Failed to load index buffer";return t=e.getError(n,t),Promise.reject(t)}function UM(){this.typedArray=void 0,this.indexDatatype=void 0,this.context=void 0,this.buffer=void 0}UM.prototype.set=function(e,t,n){this.typedArray=e,this.indexDatatype=t,this.context=n};UM.prototype.execute=function(){this.buffer=Z$(this.typedArray,this.indexDatatype,this.context)};function Z$(e,t,n){const i=At.createIndexBuffer({typedArray:e,context:n,usage:Ze.STATIC_DRAW,indexDatatype:t});return i.vertexArrayDestroyable=!1,i}nd.prototype.process=function(e){return b.typeOf.object("frameState",e),this._process(this,e)};nd.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 Bl(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 os(e,t){return l(e.extensionsUsed)&&e.extensionsUsed.indexOf(t)>=0}function ye(){}ye.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}}};ye.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}}};ye.topLevel=function(e,t,n){const i=e[t];return l(i)&&!Array.isArray(i)?ye.objectLegacy(i,n):ye.object(i,n)};ye.accessor=function(e,t){return ye.topLevel(e,"accessors",t)};ye.accessorWithSemantic=function(e,t,n){const i={};return ye.mesh(e,function(o){return ye.meshPrimitive(o,function(r){const s=ye.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:ye.meshPrimitiveTarget(r,function(a){return ye.meshPrimitiveTargetAttribute(a,function(c,u){if(u.indexOf(t)===0&&!l(i[c])){i[c]=!0;const f=n(c);if(l(f))return f}})})})})};ye.accessorContainingVertexAttributeData=function(e,t){const n={};return ye.mesh(e,function(i){return ye.meshPrimitive(i,function(o){const r=ye.meshPrimitiveAttribute(o,function(s){if(!l(n[s])){n[s]=!0;const a=t(s);if(l(a))return a}});return l(r)?r:ye.meshPrimitiveTarget(o,function(s){return ye.meshPrimitiveTargetAttribute(s,function(a){if(!l(n[a])){n[a]=!0;const c=t(a);if(l(c))return c}})})})})};ye.accessorContainingIndexData=function(e,t){const n={};return ye.mesh(e,function(i){return ye.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}})})};ye.animation=function(e,t){return ye.topLevel(e,"animations",t)};ye.animationChannel=function(e,t){const n=e.channels;return ye.object(n,t)};ye.animationSampler=function(e,t){const n=e.samplers;return ye.object(n,t)};ye.buffer=function(e,t){return ye.topLevel(e,"buffers",t)};ye.bufferView=function(e,t){return ye.topLevel(e,"bufferViews",t)};ye.camera=function(e,t){return ye.topLevel(e,"cameras",t)};ye.image=function(e,t){return ye.topLevel(e,"images",t)};ye.material=function(e,t){return ye.topLevel(e,"materials",t)};ye.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}};ye.mesh=function(e,t){return ye.topLevel(e,"meshes",t)};ye.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}}};ye.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}};ye.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}}};ye.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}};ye.node=function(e,t){return ye.topLevel(e,"nodes",t)};ye.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=ye.nodeInTree(e,u,n),l(c)))return c}}}};ye.nodeInScene=function(e,t,n){const i=t.nodes;if(l(i))return ye.nodeInTree(e,i,n)};ye.program=function(e,t){return os(e,"KHR_techniques_webgl")?ye.object(e.extensions.KHR_techniques_webgl.programs,t):ye.topLevel(e,"programs",t)};ye.sampler=function(e,t){return ye.topLevel(e,"samplers",t)};ye.scene=function(e,t){return ye.topLevel(e,"scenes",t)};ye.shader=function(e,t){return os(e,"KHR_techniques_webgl")?ye.object(e.extensions.KHR_techniques_webgl.shaders,t):ye.topLevel(e,"shaders",t)};ye.skin=function(e,t){return ye.topLevel(e,"skins",t)};ye.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}}};ye.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}};ye.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}};ye.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}};ye.technique=function(e,t){return os(e,"KHR_techniques_webgl")?ye.object(e.extensions.KHR_techniques_webgl.techniques,t):ye.topLevel(e,"techniques",t)};ye.texture=function(e,t){return ye.topLevel(e,"textures",t)};function KT(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 d0(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)*KT(t.type)}function KVe(e){ye.accessor(e,function(n){l(n.bufferView)&&(n.byteOffset=A(n.byteOffset,0))}),ye.bufferView(e,function(n){l(n.buffer)&&(n.byteOffset=A(n.byteOffset,0))}),ye.mesh(e,function(n){ye.meshPrimitive(n,function(i){if(i.mode=A(i.mode,se.TRIANGLES),!l(i.material)){l(e.materials)||(e.materials=[]);const o={name:"default"};i.material=Bl(e.materials,o)}})}),ye.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=d0(e,i),r.target=se.ARRAY_BUFFER}}),ye.accessorContainingIndexData(e,function(n){const o=e.accessors[n].bufferView;if(l(o)){const r=e.bufferViews[o];r.target=se.ELEMENT_ARRAY_BUFFER}}),ye.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)&&ye.materialValue(n,function(c){l(c.index)&&em(c)}),em(n.emissiveTexture),em(n.normalTexture),em(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),em(s.baseColorTexture),em(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),em(a.specularGlossinessTexture))}),ye.animation(e,function(n){ye.animationSampler(n,function(i){i.interpolation=A(i.interpolation,"LINEAR")})});const t=JVe(e);return ye.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])}),ye.sampler(e,function(n){n.wrapS=A(n.wrapS,se.REPEAT),n.wrapT=A(n.wrapT,se.REPEAT)}),l(e.scenes)&&!l(e.scene)&&(e.scene=0),e}function JVe(e){const t={};return ye.animation(e,function(n){ye.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 em(e){l(e)&&(e.texCoord=A(e.texCoord,0))}function HM(e){return ye.shader(e,function(t){tx(t)}),ye.buffer(e,function(t){tx(t)}),ye.image(e,function(t){tx(t)}),tx(e),e}function tx(e){e.extras=l(e.extras)?e.extras:{},e.extras._pipeline=l(e.extras._pipeline)?e.extras._pipeline:{}}function QVe(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 eX(e,t){const n=e.extensionsUsed;if(l(n)){const i=n.indexOf(t);i>=0&&n.splice(i,1),QVe(e,t),n.length===0&&delete e.extensionsUsed}}const ZVe=4;function eke(e){if(Kv(e)!=="glTF")throw new Se("File is not valid binary glTF");const n=tX(e,0,5),i=n[1];if(i!==1&&i!==2)throw new Se("Binary glTF version is not 1 or 2");return i===1?tke(e,n):nke(e,n)}function tX(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*ZVe,!0);return o}function tke(e,t){const n=t[2],i=t[3];if(t[4]!==0)throw new Se("Binary glTF scene format is not JSON");const r=20,s=r+i,a=Xa(e,r,i),c=JSON.parse(a);HM(c);const u=e.subarray(s,n),f=c.buffers;if(l(f)&&Object.keys(f).length>0){const h=A(f.binary_glTF,f.KHR_binary_glTF);l(h)&&(h.extras._pipeline.source=u,delete h.uri)}return eX(c,"KHR_binary_glTF"),c}function nke(e,t){const n=t[2];let i=12,o,r;for(;i<n;){const s=tX(e,i,2),a=s[0],c=s[1];i+=8;const u=e.subarray(i,i+a);if(i+=a,c===1313821514){const f=Xa(u);o=JSON.parse(f),HM(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 ike(e){return ye.shader(e,function(t){nx(t)}),ye.buffer(e,function(t){nx(t)}),ye.image(e,function(t){nx(t)}),nx(e),e}function nx(e){l(e.extras)&&(l(e.extras._pipeline)&&delete e.extras._pipeline,Object.keys(e.extras).length===0&&delete e.extras)}function JT(e,t){let n=e.extensionsUsed;l(n)||(n=[],e.extensionsUsed=n),Bl(n,t,!0)}function VM(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 kM(e,t){const n=e.bufferViews,i=e.buffers,o=t.bufferView,r=KT(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,_=t.count,g=d0(e,t);let p=t.byteOffset+c.byteOffset+h.byteOffset;const y=t.componentType,C=ee.getSizeInBytes(y),T=new DataView(h.buffer),E=new Array(r),w=VM(y);for(let S=0;S<_;S++){w(T,p,r,C,E);for(let P=0;P<r;P++){const O=E[P];s[P]=Math.min(s[P],O),a[P]=Math.max(a[P],O)}p+=g}return{min:s,max:a}}const oke=[se.FUNC_ADD,se.FUNC_ADD],rke=[se.ONE,se.ZERO,se.ONE,se.ZERO];function h4(e,t){const n=e.enable;return l(n)?n.indexOf(t)>-1:!1}const ske=[se.ZERO,se.ONE,se.SRC_COLOR,se.ONE_MINUS_SRC_COLOR,se.SRC_ALPHA,se.ONE_MINUS_SRC_ALPHA,se.DST_ALPHA,se.ONE_MINUS_DST_ALPHA,se.DST_COLOR,se.ONE_MINUS_DST_COLOR];function ake(e,t){if(!l(e))return t;for(let n=0;n<4;n++)if(ske.indexOf(e[n])===-1)return t;return e}function cke(e){const t={},n={},i=e.techniques;return l(i)&&(ye.technique(e,function(o,r){const s=o.states;if(l(s)){const a=n[r]={};if(h4(s,se.BLEND)){a.alphaMode="BLEND";const c=s.functions;l(c)&&(l(c.blendEquationSeparate)||l(c.blendFuncSeparate))&&(t[r]={blendEquation:A(c.blendEquationSeparate,oke),blendFactors:ake(c.blendFuncSeparate,rke)})}h4(s,se.CULL_FACE)||(a.doubleSided=!0),delete o.states}}),Object.keys(t).length>0&&(l(e.extensions)||(e.extensions={}),JT(e,"KHR_blend")),ye.material(e,function(o){if(l(o.technique)){const r=n[o.technique];ye.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 lke(e,t){let n=e.extensionsRequired;l(n)||(n=[],e.extensionsRequired=n),Bl(n,t,!0),JT(e,t)}function uke(e){const t=e.techniques,n={},i={},o={};if(l(t)){const r={programs:[],shaders:[],techniques:[]},s=e.glExtensionsUsed;delete e.glExtensionsUsed,ye.technique(e,function(a,c){const u={name:a.name,program:void 0,attributes:{},uniforms:{}};let f;if(ye.techniqueAttribute(a,function(h,_){f=a.parameters[h],u.attributes[_]={semantic:f.semantic}}),ye.techniqueUniform(a,function(h,_){f=a.parameters[h],u.uniforms[_]={count:f.count,node:f.node,type:f.type,semantic:f.semantic,value:f.value},l(n[c])||(n[c]={}),n[c][h]=_}),l(o[a.program]))u.program=o[a.program];else{const h=e.programs[a.program],_={name:h.name,fragmentShader:void 0,vertexShader:void 0,glExtensions:s},g=e.shaders[h.fragmentShader];_.fragmentShader=Bl(r.shaders,g,!0);const p=e.shaders[h.vertexShader];_.vertexShader=Bl(r.shaders,p,!0),u.program=Bl(r.programs,_),o[a.program]=u.program}i[c]=Bl(r.techniques,u)}),r.techniques.length>0&&(l(e.extensions)||(e.extensions={}),e.extensions.KHR_techniques_webgl=r,JT(e,"KHR_techniques_webgl"),lke(e,"KHR_techniques_webgl"))}return ye.material(e,function(r){if(l(r.technique)){const s={technique:i[r.technique]};ye.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 nX(e,t){b.typeOf.object("material",e),b.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 f=t(s.index,s);if(l(f))return f}if(l(a)&&l(a.index)){const f=t(a.index,a);if(l(f))return f}if(l(c)&&l(c.index)){const f=t(c.index,c);if(l(f))return f}if(l(u)&&l(u.index)){const f=t(u.index,u);if(l(f))return f}}}const i=ye.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 p4=["mesh","node","material","accessor","bufferView","buffer","texture","sampler","image"];function fke(e,t){return t=A(t,p4),p4.forEach(function(n){t.indexOf(n)>-1&&hke(e,n)}),e}const dke={accessor:"accessors",buffer:"buffers",bufferView:"bufferViews",image:"images",node:"nodes",material:"materials",mesh:"meshes",sampler:"samplers",texture:"textures"};function hke(e,t){const n=dke[t],i=e[n];if(l(i)){let o=0;const r=_f[t](e),s=i.length;for(let a=0;a<s;++a)r[a]||(mf[t](e,a-o),o++)}}function mf(){}mf.accessor=function(e,t){e.accessors.splice(t,1),ye.mesh(e,function(i){ye.meshPrimitive(i,function(o){ye.meshPrimitiveAttribute(o,function(s,a){s>t&&o.attributes[a]--}),ye.meshPrimitiveTarget(o,function(s){ye.meshPrimitiveTargetAttribute(s,function(a,c){a>t&&s[c]--})});const r=o.indices;l(r)&&r>t&&o.indices--})}),ye.skin(e,function(i){l(i.inverseBindMatrices)&&i.inverseBindMatrices>t&&i.inverseBindMatrices--}),ye.animation(e,function(i){ye.animationSampler(i,function(o){l(o.input)&&o.input>t&&o.input--,l(o.output)&&o.output>t&&o.output--})})};mf.buffer=function(e,t){e.buffers.splice(t,1),ye.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--})};mf.bufferView=function(e,t){if(e.bufferViews.splice(t,1),ye.accessor(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),ye.shader(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),ye.image(e,function(i){l(i.bufferView)&&i.bufferView>t&&i.bufferView--}),os(e,"KHR_draco_mesh_compression")&&ye.mesh(e,function(i){ye.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--})}),os(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(os(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 f=c[u];l(f.values)&&f.values>t&&f.values--,l(f.arrayOffsets)&&f.arrayOffsets>t&&f.arrayOffsets--,l(f.stringOffsets)&&f.stringOffsets>t&&f.stringOffsets--}}}}};mf.image=function(e,t){e.images.splice(t,1),ye.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})};mf.mesh=function(e,t){e.meshes.splice(t,1),ye.node(e,function(i){l(i.mesh)&&(i.mesh>t?i.mesh--:i.mesh===t&&delete i.mesh)})};mf.node=function(e,t){e.nodes.splice(t,1),ye.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})}),ye.animation(e,function(i){ye.animationChannel(i,function(o){l(o.target)&&l(o.target.node)&&o.target.node>t&&o.target.node--})}),ye.technique(e,function(i){ye.techniqueUniform(i,function(o){l(o.node)&&o.node>t&&o.node--})}),ye.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}))}),ye.scene(e,function(i){i.nodes=i.nodes.filter(function(o){return o!==t}).map(function(o){return o>t?o-1:o})})};mf.material=function(e,t){e.materials.splice(t,1),ye.mesh(e,function(i){ye.meshPrimitive(i,function(o){l(o.material)&&o.material>t&&o.material--})})};mf.sampler=function(e,t){e.samplers.splice(t,1),ye.texture(e,function(i){l(i.sampler)&&i.sampler>t&&--i.sampler})};mf.texture=function(e,t){if(e.textures.splice(t,1),ye.material(e,function(i){nX(i,function(o,r){r.index>t&&--r.index})}),os(e,"EXT_feature_metadata")){ye.mesh(e,function(r){ye.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 f=u.length;for(let h=0;h<f;++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 f=a[c].texture;f.index>t&&--f.index}}}}if(os(e,"EXT_mesh_features")&&ye.mesh(e,function(i){ye.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 f=a[u];l(f.texture)&&f.texture.index>t&&--f.texture.index}}}})}),os(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 f=c[u];f.index>t&&--f.index}}}}};function _f(){}_f.accessor=function(e){const t={};return ye.mesh(e,function(n){ye.meshPrimitive(n,function(i){ye.meshPrimitiveAttribute(i,function(r){t[r]=!0}),ye.meshPrimitiveTarget(i,function(r){ye.meshPrimitiveTargetAttribute(r,function(s){t[s]=!0})});const o=i.indices;l(o)&&(t[o]=!0)})}),ye.skin(e,function(n){l(n.inverseBindMatrices)&&(t[n.inverseBindMatrices]=!0)}),ye.animation(e,function(n){ye.animationSampler(n,function(i){l(i.input)&&(t[i.input]=!0),l(i.output)&&(t[i.output]=!0)})}),os(e,"EXT_mesh_gpu_instancing")&&ye.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};_f.buffer=function(e){const t={};return ye.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};_f.bufferView=function(e){const t={};if(ye.accessor(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),ye.shader(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),ye.image(e,function(n){l(n.bufferView)&&(t[n.bufferView]=!0)}),os(e,"KHR_draco_mesh_compression")&&ye.mesh(e,function(n){ye.meshPrimitive(n,function(i){l(i.extensions)&&l(i.extensions.KHR_draco_mesh_compression)&&(t[i.extensions.KHR_draco_mesh_compression.bufferView]=!0)})}),os(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(os(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};_f.image=function(e){const t={};return ye.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};_f.mesh=function(e){const t={};return ye.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 iX(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!iX(e,o,n)}).length===0}_f.node=function(e){const t={};return ye.skin(e,function(n){l(n.skeleton)&&(t[n.skeleton]=!0),ye.skinJoint(n,function(i){t[i]=!0})}),ye.animation(e,function(n){ye.animationChannel(n,function(i){l(i.target)&&l(i.target.node)&&(t[i.target.node]=!0)})}),ye.technique(e,function(n){ye.techniqueUniform(n,function(i){l(i.node)&&(t[i.node]=!0)})}),ye.node(e,function(n,i){iX(e,i,t)||(t[i]=!0)}),t};_f.material=function(e){const t={};return ye.mesh(e,function(n){ye.meshPrimitive(n,function(i){l(i.material)&&(t[i.material]=!0)})}),t};_f.texture=function(e){const t={};if(ye.material(e,function(n){nX(n,function(i){t[i]=!0})}),os(e,"EXT_feature_metadata")){ye.mesh(e,function(o){ye.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 f=0;f<u;++f){const _=c[f].featureIds.texture;t[_.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(os(e,"EXT_mesh_features")&&ye.mesh(e,function(n){ye.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)}}}})}),os(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};_f.sampler=function(e){const t={};return ye.texture(e,function(n){l(n.sampler)&&(t[n.sampler]=!0)}),t};function pke(e,t){const n={byteLength:t.length,extras:{_pipeline:{source:t}}},o={buffer:Bl(e.buffers,n),byteOffset:0,byteLength:t.length};return Bl(e.bufferViews,o)}function mke(e,t){const n=d0(e,t),i=ee.getSizeInBytes(t.componentType),o=KT(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 f=new DataView(c.buffer),h=new Array(o),_=VM(t.componentType);for(let g=0;g<r;++g){_(f,u,o,i,h);for(let p=0;p<o;++p)s[g*o+p]=h[p];u+=n}return s}function _ke(e){let t;return ye.accessorWithSemantic(e,"JOINTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===se.BYTE?ix(e,i,ee.UNSIGNED_BYTE):t!==se.UNSIGNED_BYTE&&t!==se.UNSIGNED_SHORT&&ix(e,i,ee.UNSIGNED_SHORT)}),ye.accessorWithSemantic(e,"WEIGHTS_0",function(n){const i=e.accessors[n];t=i.componentType,t===se.BYTE?ix(e,i,ee.UNSIGNED_BYTE):t===se.SHORT&&ix(e,i,ee.UNSIGNED_SHORT)}),e}function ix(e,t,n){const i=ee.createTypedArray(n,mke(e,t)),o=new Uint8Array(i.buffer);t.bufferView=pke(e,o),t.componentType=n,t.byteOffset=0}function bB(e,t){return eX(e,t),t==="CESIUM_RTC"&&gke(e),EB(e,t)}function gke(e){ye.technique(e,function(t){ye.techniqueUniform(t,function(n){n.semantic==="CESIUM_RTC_MODELVIEW"&&(n.semantic="MODELVIEW")})})}function EB(e,t){if(Array.isArray(e)){const n=e.length;for(let i=0;i<n;++i)EB(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)&&EB(e[o],t);return i}}const ox={.8:Eke,"1.0":Wke,"2.0":void 0};function yke(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(ox,i)||(l(i)&&(i=i.substring(0,3)),Object.prototype.hasOwnProperty.call(ox,i)||(i="1.0"));let o=ox[i];for(;l(o)&&i!==n;)o(e,t),i=e.asset.version,o=ox[i];return t.keepLegacyExtensions||(Yke(e),$ke(e)),e}function oX(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 Ake(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,se.TRIANGLES);a.mode=A(a.mode,c),delete a.primitive}}}}function Cke(e){const t=e.nodes,n=new d,i=new Ce;for(const o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const r=t[o];if(l(r.rotation)){const a=r.rotation;d.fromArray(a,0,n),Ce.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 Tke(e){const t=e.animations,n=e.accessors,i=e.bufferViews,o=e.buffers,r={},s=new d,a=new Ce;for(const c in t)if(Object.prototype.hasOwnProperty.call(t,c)){const u=t[c],f=u.channels,h=u.parameters,_=u.samplers;if(l(f)){const g=f.length;for(let p=0;p<g;++p){const y=f[p];if(y.target.path==="rotation"){const C=h[_[y.sampler].output];if(l(r[C]))continue;r[C]=!0;const T=n[C],E=i[T.bufferView],S=o[E.buffer].extras._pipeline.source,P=S.byteOffset+E.byteOffset+T.byteOffset,O=T.componentType,z=T.count,R=KT(T.type),F=T.count*R,H=ee.createArrayBufferView(O,S.buffer,P,F);for(let v=0;v<z;v++){const I=v*R;d.unpack(H,I,s);const m=H[I+3];Ce.fromAxisAngle(s,m,a),Ce.pack(a,H,I)}}}}}}function bke(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 Eke(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,oX(e),Ake(e),Cke(e),Tke(e),bke(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,JT(e,"KHR_materials_common")}}function xke(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 m4(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 wke(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]=m4(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]),ye.bufferView(e,function(s){l(s.buffer)&&(s.buffer=n.buffers[s.buffer])}),ye.accessor(e,function(s){l(s.bufferView)&&(s.bufferView=n.bufferViews[s.bufferView])}),ye.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}}),ye.program(e,function(s){l(s.vertexShader)&&(s.vertexShader=n.shaders[s.vertexShader]),l(s.fragmentShader)&&(s.fragmentShader=n.shaders[s.fragmentShader])}),ye.technique(e,function(s){l(s.program)&&(s.program=n.programs[s.program]),ye.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]})})}),ye.mesh(e,function(s){ye.meshPrimitive(s,function(a){l(a.indices)&&(a.indices=n.accessors[a.indices]),ye.meshPrimitiveAttribute(a,function(c,u){a.attributes[u]=n.accessors[c]}),l(a.material)&&(a.material=n.materials[a.material])})}),ye.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 f={mesh:n.meshes[c[t]]},h=Bl(e.nodes,f);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 f=e.skins[s.skin];f.skeleton=n.nodes[c[0]]}delete s.skeletons}l(s.jointName)&&delete s.jointName}),ye.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}}),ye.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]]}}),ye.animation(e,function(s){const a={};s.samplers=m4(s.samplers,a),ye.animationSampler(s,function(c){c.input=n.accessors[c.input],c.output=n.accessors[c.output]}),ye.animationChannel(s,function(c){c.sampler=a[c.sampler];const u=c.target;l(u)&&(u.node=n.nodes[u.id],delete u.id)})}),ye.material(e,function(s){l(s.technique)&&(s.technique=n.techniques[s.technique]),ye.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)&&ye.materialValue(c,function(u,f){typeof u=="string"&&(c.values[f]={index:n.textures[u]})})}}),ye.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}}),ye.texture(e,function(s){l(s.sampler)&&(s.sampler=n.samplers[s.sampler]),l(s.source)&&(s.source=n.images[s.source])})}function Ske(e){ye.animation(e,function(t){ye.animationSampler(t,function(n){delete n.name})})}function vke(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]}ye.node(e,function(t){l(t.children)&&t.children.length===0&&delete t.children})}function Dke(e){const t=e.asset;delete t.profile,delete t.premultipliedAlpha}const Ike={CESIUM_RTC:!0,KHR_materials_common:!0,WEB3D_quantized_attributes:!0};function Pke(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(Ike[o])&&e.extensionsRequired.push(o)}}}function Oke(e){ye.buffer(e,function(t){delete t.type})}function Lke(e){ye.texture(e,function(t){delete t.format,delete t.internalFormat,delete t.target,delete t.type})}function Bke(e){ye.mesh(e,function(t){ye.meshPrimitive(t,function(n){ye.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})}),ye.technique(e,function(t){ye.techniqueParameter(t,function(n){const i=n.semantic;l(i)&&(i==="TEXCOORD"?n.semantic="TEXCOORD_0":i==="COLOR"&&(n.semantic="COLOR_0"))})})}const Rke={POSITION:!0,NORMAL:!0,TANGENT:!0},Nke={COLOR:"COLOR",JOINT:"JOINTS",JOINTS:"JOINTS",TEXCOORD:"TEXCOORD",WEIGHT:"WEIGHTS",WEIGHTS:"WEIGHTS"};function Mke(e){const t={};ye.mesh(e,function(n){ye.meshPrimitive(n,function(i){ye.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 f=Nke[a];l(f)?(u=f+c,t[r]=u):l(Rke[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)}})}),ye.technique(e,function(n){ye.techniqueParameter(n,function(i){const o=t[i.semantic];l(o)&&(i.semantic=o)})})}function Fke(e){ye.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 xB(e,t){return l(t.byteStride)&&t.byteStride!==0?t.byteStride:d0(e,t)}function zke(e){ye.buffer(e,function(t){l(t.byteLength)||(t.byteLength=t.extras._pipeline.source.length)}),ye.accessor(e,function(t){const n=t.bufferView;if(l(n)){const i=e.bufferViews[n],o=xB(e,t),r=t.byteOffset+t.count*o;i.byteLength=Math.max(A(i.byteLength,0),r)}})}function Uke(e){let t,n,i;const o=e.bufferViews,r={};ye.accessorContainingVertexAttributeData(e,function(a){const c=e.accessors[a];l(c.bufferView)&&(r[c.bufferView]=!0)});const s={};ye.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(_,g){return _.byteOffset-g.byteOffset});let u=0,f=0;const h=c.length;for(t=0;t<h;++t){let _=c[t];const g=xB(e,_),p=_.byteOffset,y=_.count*g;delete _.byteStride;const C=t<h-1,T=C?xB(e,c[t+1]):void 0;if(g!==T){const E=ut(i,!0);r[a]&&(E.byteStride=g),E.byteOffset+=u,E.byteLength=p+y-u;const w=Bl(o,E);for(n=f;n<=t;++n)_=c[n],_.bufferView=w,_.byteOffset=_.byteOffset-u;u=C?c[t+1].byteOffset:void 0,f=t+1}}}fke(e,["accessor","bufferView","buffer"])}function Hke(e){ye.accessorWithSemantic(e,"POSITION",function(t){const n=e.accessors[t];if(!l(n.min)||!l(n.max)){const i=kM(e,n);n.min=i.min,n.max=i.max}})}function rX(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)||d.fromArray(e.translation).equals(d.ZERO))&&(!l(e.scale)||d.fromArray(e.scale).equals(new d(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 sX(e,t){ye.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}}}),ye.node(e,function(n,i){if(l(n.children)){const o=n.children.indexOf(t);o>-1&&(n.children.splice(o,1),rX(n)&&sX(e,i))}}),delete e.nodes[t]}function Vke(e){return ye.node(e,function(t,n){rX(t)&&sX(e,n)}),e}function kke(e){ye.animation(e,function(t){ye.animationSampler(t,function(n){const i=e.accessors[n.input];if(!l(i.min)||!l(i.max)){const o=kM(e,i);i.min=o.min,i.max=o.max}})})}function Gke(e){ye.accessor(e,function(t){if(l(t.min)||l(t.max)){const n=kM(e,t);l(t.min)&&(t.min=n.min),l(t.max)&&(t.max=n.max)}})}function Wke(e){e.asset=A(e.asset,{}),e.asset.version="2.0",oX(e),xke(e),Vke(e),wke(e),Ske(e),Dke(e),Pke(e),zke(e),Uke(e),Hke(e),kke(e),Gke(e),Oke(e),Lke(e),Bke(e),Mke(e),_ke(e),Fke(e),cke(e),uke(e),vke(e)}const jke=["u_tex","u_diffuse","u_emission"],qke=["u_diffuse"];function wB(e){e.pbrMetallicRoughness=l(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{},e.pbrMetallicRoughness.roughnessFactor=1,e.pbrMetallicRoughness.metallicFactor=0}function Ew(e){return l(e.index)}function xw(e){return Array.isArray(e)&&e.length===4}function aX(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 Yke(e){ye.material(e,function(t){ye.materialValue(t,function(n,i){jke.indexOf(i)!==-1&&Ew(n)?(wB(t),t.pbrMetallicRoughness.baseColorTexture=n):qke.indexOf(i)!==-1&&xw(n)&&(wB(t),t.pbrMetallicRoughness.baseColorFactor=aX(n))})}),bB(e,"KHR_techniques_webgl"),bB(e,"KHR_blend")}function $ke(e){ye.material(e,function(t){const n=A(t.extensions,A.EMPTY_OBJECT).KHR_materials_common;if(l(n)){n.technique==="CONSTANT"&&(JT(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,f=n.transparent;wB(t),l(r)&&(xw(r)?t.emissiveFactor=r.slice(0,3):Ew(r)&&(t.emissiveTexture=r)),l(s)&&(xw(s)?t.pbrMetallicRoughness.baseColorFactor=aX(s):Ew(s)&&(t.pbrMetallicRoughness.baseColorTexture=s)),l(u)&&(t.doubleSided=u),l(a)&&(xw(a)?t.emissiveFactor=a.slice(0,3):Ew(a)&&(t.emissiveTexture=a)),l(c)&&(l(t.pbrMetallicRoughness.baseColorFactor)?t.pbrMetallicRoughness.baseColorFactor[3]*=c:t.pbrMetallicRoughness.baseColorFactor=[1,1,1,c]),l(f)&&(t.alphaMode=f?"BLEND":"OPAQUE")}}),bB(e,"KHR_materials_common")}function id(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;b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltfResource",n),b.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=Lt.UNLOADED,this._promise=void 0}l(Object.create)&&(id.prototype=Object.create(ir.prototype),id.prototype.constructor=id);Object.defineProperties(id.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},gltf:{get:function(){return this._gltf}}});id.prototype.load=function(){this._state=Lt.LOADING;let e;l(this._gltfJson)?e=cX(this,this._gltfJson):l(this._typedArray)?e=lX(this,this._typedArray):e=Xke(this);const t=this;return this._promise=e.then(function(n){if(!t.isDestroyed())return t._gltf=n,t._state=Lt.READY,t}).catch(function(n){if(!t.isDestroyed())return Kke(t,n)}),this._promise};function Xke(e){return e._fetchGltf().then(function(t){if(e.isDestroyed())return;const n=new Uint8Array(t);return lX(e,n)})}function Kke(e,t){e.unload(),e._state=Lt.FAILED;const n=`Failed to load glTF: ${e._gltfResource.url}`;return Promise.reject(e.getError(n,t))}function Jke(e,t){if(l(t.asset)&&t.asset.version==="2.0"&&!os(t,"KHR_techniques_webgl")&&!os(t,"KHR_materials_common"))return Promise.resolve();const n=[];return ye.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(){yke(t)})}function Qke(e){const t=[];return ye.buffer(e,function(n){const i=n.uri;!l(n.extras._pipeline.source)&&l(i)&&pN(i)&&(delete n.uri,t.push(Re.fetchArrayBuffer(i).then(function(o){n.extras._pipeline.source=new Uint8Array(o)})))}),Promise.all(t)}function Zke(e,t){const n=[];return ye.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 cX(e,t){return HM(t),Qke(t).then(function(){return Jke(e,t)}).then(function(){return KVe(t),Zke(e,t)}).then(function(){return ike(t),t})}function lX(e,t){let n;return Kv(t)==="glTF"?n=eke(t):n=Fa(t),cX(e,n)}id.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};id.prototype._fetchGltf=function(){return this._gltfResource.fetchArrayBuffer()};const e4e={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"},DS=Object.freeze(e4e),so={};function t4e(){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 n4e(){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 i4e(){this.indexDatatype=void 0,this.count=void 0,this.buffer=void 0,this.typedArray=void 0}function o4e(){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 r4e(){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 s4e(){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 a4e(){this.attributes=[]}function c4e(){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 l4e(){this.attributes=[],this.featureIds=[],this.transformInWorldSpace=!1}function u4e(){this.index=void 0,this.joints=[],this.inverseBindMatrices=[]}function f4e(){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 d4e(){this.nodes=[]}const h4e={TRANSLATION:"translation",ROTATION:"rotation",SCALE:"scale",WEIGHTS:"weights"};function p4e(){this.input=[],this.interpolation=void 0,this.output=[]}function m4e(){this.node=void 0,this.path=void 0}function _4e(){this.sampler=void 0,this.target=void 0}function g4e(){this.name=void 0,this.samplers=[],this.channels=[]}function y4e(){this.name=void 0,this.type=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.initialValue=void 0}function A4e(){this.name=void 0,this.stages=[]}function uX(){this.credits=[]}function C4e(){this.asset=new uX,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 T4e(){this.texture=void 0,this.index=void 0,this.texCoord=0,this.transform=J.clone(J.IDENTITY),this.channels=void 0}function qh(){this.baseColorTexture=void 0,this.metallicRoughnessTexture=void 0,this.baseColorFactor=oe.clone(qh.DEFAULT_BASE_COLOR_FACTOR),this.metallicFactor=qh.DEFAULT_METALLIC_FACTOR,this.roughnessFactor=qh.DEFAULT_ROUGHNESS_FACTOR}qh.DEFAULT_BASE_COLOR_FACTOR=oe.ONE;qh.DEFAULT_METALLIC_FACTOR=1;qh.DEFAULT_ROUGHNESS_FACTOR=1;function km(){this.diffuseTexture=void 0,this.specularGlossinessTexture=void 0,this.diffuseFactor=oe.clone(km.DEFAULT_DIFFUSE_FACTOR),this.specularFactor=d.clone(km.DEFAULT_SPECULAR_FACTOR),this.glossinessFactor=km.DEFAULT_GLOSSINESS_FACTOR}km.DEFAULT_DIFFUSE_FACTOR=oe.ONE;km.DEFAULT_SPECULAR_FACTOR=d.ONE;km.DEFAULT_GLOSSINESS_FACTOR=1;function GM(){this.metallicRoughness=new qh,this.specularGlossiness=void 0,this.emissiveTexture=void 0,this.normalTexture=void 0,this.occlusionTexture=void 0,this.emissiveFactor=d.clone(GM.DEFAULT_EMISSIVE_FACTOR),this.alphaMode=DS.OPAQUE,this.alphaCutoff=.5,this.doubleSided=!1,this.unlit=!1}GM.DEFAULT_EMISSIVE_FACTOR=d.ZERO;so.Quantization=t4e;so.Attribute=n4e;so.Indices=i4e;so.FeatureIdAttribute=o4e;so.FeatureIdTexture=s4e;so.FeatureIdImplicitRange=r4e;so.MorphTarget=a4e;so.Primitive=c4e;so.Instances=l4e;so.Skin=u4e;so.Node=f4e;so.Scene=d4e;so.AnimatedPropertyType=Object.freeze(h4e);so.AnimationSampler=p4e;so.AnimationTarget=m4e;so.AnimationChannel=_4e;so.Animation=g4e;so.ArticulationStage=y4e;so.Articulation=A4e;so.Asset=uX;so.Components=C4e;so.TextureReader=T4e;so.MetallicRoughness=qh;so.SpecularGlossiness=km;so.Material=GM;const vt=so,tD={};tD.getImageIdFromTexture=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureId,i=e.supportedImageFormats;b.typeOf.object("options.gltf",t),b.typeOf.number("options.textureId",n),b.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};tD.createSampler=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.textureInfo,i=A(e.compressedTextureNoMipmap,!1);b.typeOf.object("options.gltf",t),b.typeOf.object("options.textureInfo",n);let o=Ei.REPEAT,r=Ei.REPEAT,s=An.LINEAR,a=Hr.LINEAR;const c=n.index,f=t.textures[c].sampler;if(l(f)){const g=t.samplers[f];o=A(g.wrapS,o),r=A(g.wrapT,r),s=A(g.minFilter,s),a=A(g.magFilter,a)}let h=!1;const _=n.extensions;return l(_)&&l(_.KHR_texture_transform)&&(h=!0),(i||h)&&s!==An.LINEAR&&s!==An.NEAREST&&(s===An.NEAREST_MIPMAP_NEAREST||s===An.NEAREST_MIPMAP_LINEAR?s=An.NEAREST:s=An.LINEAR),new Yn({wrapS:o,wrapT:r,minificationFilter:s,magnificationFilter:a})};const b4e=new j(1,1);tD.createModelTextureReader=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.textureInfo,n=e.channels,i=e.texture;b.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 f=l(s.scale)?j.unpack(s.scale):b4e;u=-u,r=new J(Math.cos(u)*f.x,-Math.sin(u)*f.y,c.x,Math.sin(u)*f.x,Math.cos(u)*f.y,c.y,0,0,1)}const a=new vt.TextureReader;return a.index=t.index,a.texture=i,a.texCoord=o,a.transform=r,a.channels=n,a};const r_=tD;function SB(e){const t=document.createElement("canvas");return t.width=N.nextPowerOfTwo(e.width),t.height=N.nextPowerOfTwo(e.height),t.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t.width,t.height),t}function od(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);b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.object("options.textureInfo",i),b.typeOf.object("options.gltfResource",o),b.typeOf.object("options.baseResource",r),b.typeOf.object("options.supportedImageFormats",s);const u=i.index,f=r_.getImageIdFromTexture({gltf:n,textureId:u,supportedImageFormats:s});this._resourceCache=t,this._gltf=n,this._textureInfo=i,this._imageId=f,this._gltfResource=o,this._baseResource=r,this._cacheKey=a,this._asynchronous=c,this._imageLoader=void 0,this._image=void 0,this._mipLevels=void 0,this._texture=void 0,this._state=Lt.UNLOADED,this._promise=void 0,this._process=function(h,_){}}l(Object.create)&&(od.prototype=Object.create(ir.prototype),od.prototype.constructor=od);Object.defineProperties(od.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},texture:{get:function(){return this._texture}}});const E4e=new WM;od.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=Lt.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=E4e;if(c.set(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context),!s.jobScheduler.execute(c,Sl.TEXTURE))return;a=c.texture}else a=fX(r._gltf,r._textureInfo,r._image,r._mipLevels,s.context);r.unload(),r._texture=a,r._state=Lt.READY,o(r)}});return this._promise=t.promise.then(function(){if(!n.isDestroyed())return n._image=t.image,n._mipLevels=t.mipLevels,n._state=Lt.PROCESSING,i}).catch(function(o){if(n.isDestroyed())return;n.unload(),n._state=Lt.FAILED;const r="Failed to load texture";return Promise.reject(n.getError(r,o))}),this._promise};function WM(){this.gltf=void 0,this.textureInfo=void 0,this.image=void 0,this.context=void 0,this.texture=void 0}WM.prototype.set=function(e,t,n,i,o){this.gltf=e,this.textureInfo=t,this.image=n,this.mipLevels=i,this.context=o};WM.prototype.execute=function(){this.texture=fX(this.gltf,this.textureInfo,this.image,this.mipLevels,this.context)};function fX(e,t,n,i,o){const r=n.internalFormat;let s=!1;nt.isCompressedFormat(r)&&!l(i)&&(s=!0);const a=r_.createSampler({gltf:e,textureInfo:t,compressedTextureNoMipmap:s}),c=a.minificationFilter,u=a.wrapS,f=a.wrapT,h=c===An.NEAREST_MIPMAP_NEAREST||c===An.NEAREST_MIPMAP_LINEAR||c===An.LINEAR_MIPMAP_NEAREST||c===An.LINEAR_MIPMAP_LINEAR,_=!l(r)&&h,g=_||u===Ei.REPEAT||u===Ei.MIRRORED_REPEAT||f===Ei.REPEAT||f===Ei.MIRRORED_REPEAT,p=!N.isPowerOfTwo(n.width)||!N.isPowerOfTwo(n.height),y=g&&p;let C;return l(r)?(!o.webgl2&&nt.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."),C=zt.create({context:o,source:{arrayBufferView:n.bufferView,mipLevels:i},width:n.width,height:n.height,pixelFormat:n.internalFormat,sampler:a})):(y&&(n=SB(n)),C=zt.create({context:o,source:n,sampler:a,flipY:!1,skipColorSpaceConversion:!0})),_&&C.generateMipmap(),C}od.prototype.process=function(e){return b.typeOf.object("frameState",e),this._process(this,e)};od.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 rd(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,f=A(e.asynchronous,!0),h=A(e.loadBuffer,!1),_=A(e.loadTypedArray,!1);if(b.typeOf.func("options.resourceCache",t),b.typeOf.object("options.gltf",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),!h&&!_)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=dX(s,a),y=l(a),C=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&&!C)throw new x("When options.draco is defined options.accessorId must also be defined.");p&&(b.typeOf.object("options.draco",s),b.typeOf.string("options.attributeSemantic",a),b.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=f,this._loadBuffer=h,this._loadTypedArray=_,this._bufferViewLoader=void 0,this._dracoLoader=void 0,this._quantization=void 0,this._typedArray=void 0,this._buffer=void 0,this._state=Lt.UNLOADED,this._promise=void 0,this._process=function(T,E){}}l(Object.create)&&(rd.prototype=Object.create(ir.prototype),rd.prototype.constructor=rd);Object.defineProperties(rd.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 dX(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}rd.prototype.load=function(){let e;dX(this._draco,this._attributeSemantic)?e=w4e(this):e=S4e(this);const t=this,n=new jM,i=new Promise(function(o){t._process=function(r,s){if(r._state===Lt.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,Sl.BUFFER))return;c=u.buffer}else r._loadBuffer&&(c=hX(a,s.context));r.unload(),r._buffer=c,r._typedArray=r._loadTypedArray?a:void 0,r._state=Lt.READY,o(r)}});return this._promise=e.then(function(){if(!t.isDestroyed())return i}).catch(function(o){if(!t.isDestroyed())return v4e(t,o)}),this._promise};function x4e(e,t,n,i){const r=(1<<e.quantizationBits)-1,s=1/r,a=new vt.Quantization;if(a.componentDatatype=t,a.octEncoded=e.octEncoded,a.octEncodedZXY=!0,a.type=i,a.octEncoded)a.type=ln.VEC2,a.normalizationRange=r;else{const c=ln.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 f=u.map(function(h){return h*s});a.quantizedVolumeStepSize=c.unpack(f)}}return a}function w4e(e){const n=e._resourceCache.loadDraco({gltf:e._gltf,draco:e._draco,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._dracoLoader=n,e._state=Lt.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,f=r.data.quantization;return l(f)&&(e._quantization=x4e(f,r.data.componentDatatype,r.data.componentsPerAttribute,c)),e._typedArray=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),e._state=Lt.PROCESSING,e})}function S4e(e){const n=e._resourceCache.loadBufferView({gltf:e._gltf,bufferViewId:e._bufferViewId,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._state=Lt.LOADING,e._bufferViewLoader=n,n.promise.then(function(){if(!e.isDestroyed())return e._typedArray=n.typedArray,e._state=Lt.PROCESSING,e})}function v4e(e,t){e.unload(),e._state=Lt.FAILED;const n="Failed to load vertex buffer";return t=e.getError(n,t),Promise.reject(t)}function jM(){this.typedArray=void 0,this.context=void 0,this.buffer=void 0}jM.prototype.set=function(e,t){this.typedArray=e,this.context=t};jM.prototype.execute=function(){this.buffer=hX(this.typedArray,this.context)};function hX(e,t){const n=At.createVertexBuffer({typedArray:e,context:t,usage:Ze.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}rd.prototype.process=function(e){return b.typeOf.object("frameState",e),this._process(this,e)};rd.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 up(e){e=A(e,A.EMPTY_OBJECT);const t=e.id;b.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=ut(e.extras,!0),this._extensions=ut(e.extensions,!0)}up.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.class;b.typeOf.string("options.id",t),b.typeOf.object("options.class",n);const i={};for(const o in n.properties)if(n.properties.hasOwnProperty(o)){const r=Vr.fromJson({id:o,property:n.properties[o],enums:e.enums});i[o]=r}return new up({id:t,name:n.name,description:n.description,properties:i,extras:n.extras,extensions:n.extensions})};Object.defineProperties(up.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}}});up.BATCH_TABLE_CLASS_NAME="_batchTable";function IS(e){e=A(e,A.EMPTY_OBJECT);const t=e.value,n=e.name;b.typeOf.number("options.value",t),b.typeOf.string("options.name",n),this._value=t,this._name=n,this._description=e.description,this._extras=ut(e.extras,!0),this._extensions=ut(e.extensions,!0)}IS.fromJson=function(e){return b.typeOf.object("value",e),new IS({value:e.value,name:e.name,description:e.description,extras:e.extras,extensions:e.extensions})};Object.defineProperties(IS.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 PS(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.values;b.typeOf.string("options.id",t),b.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,Vt.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=ut(e.extras,!0),this._extensions=ut(e.extensions,!0)}PS.fromJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.enum;b.typeOf.string("options.id",t),b.typeOf.object("options.enum",n);const i=n.values.map(function(o){return IS.fromJson(o)});return new PS({id:t,values:i,valueType:Vt[n.valueType],name:n.name,description:n.description,extras:n.extras,extensions:n.extensions})};Object.defineProperties(PS.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 fp(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=ut(e.extras,!0),this._extensions=ut(e.extensions,!0)}fp.fromJson=function(e){b.typeOf.object("schema",e);const t={};if(l(e.enums))for(const i in e.enums)e.enums.hasOwnProperty(i)&&(t[i]=PS.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]=up.fromJson({id:i,class:e.classes[i],enums:t}));return new fp({id:e.id,name:e.name,description:e.description,version:e.version,classes:n,enums:t,extras:e.extras,extensions:e.extensions})};Object.defineProperties(fp.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 Yh(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)?fp.fromJson(t):void 0,this._resource=n,this._cacheKey=i,this._state=Lt.UNLOADED,this._promise=void 0}l(Object.create)&&(Yh.prototype=Object.create(ir.prototype),Yh.prototype.constructor=Yh);Object.defineProperties(Yh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},schema:{get:function(){return this._schema}}});Yh.prototype.load=function(){return l(this._schema)?this._promise=Promise.resolve(this):this._promise=D4e(this),this._promise};function D4e(e){const t=e._resource;return e._state=Lt.LOADING,t.fetchJson().then(function(n){if(!e.isDestroyed())return e._schema=fp.fromJson(n),e._state=Lt.READY,e}).catch(function(n){if(e.isDestroyed())return;e._state=Lt.FAILED;const i=`Failed to load schema: ${t.url}`;return Promise.reject(e.getError(i,n))})}Yh.prototype.unload=function(){this._schema=void 0};const cu={};function QT(e){return PT(e.url)}function nD(e){let t=e.byteOffset,n=e.byteLength;if(tr(e,"EXT_meshopt_compression")){const i=e.extensions.EXT_meshopt_compression;t=A(i.byteOffset,0),n=i.byteLength}return`${t}-${t+n}`}function I4e(e,t){const n=t.byteOffset+e.byteOffset,i=e.componentType,o=e.type,r=e.count;return`${n}-${i}-${o}-${r}`}function pX(e){return QT(e)}function mX(e,t){return`${QT(e)}-buffer-id-${t}`}function ZT(e,t,n,i){if(l(e.uri)){const o=i.getDerivedResource({url:e.uri});return pX(o)}return mX(n,t)}function qM(e,t,n,i){const o=t.bufferView,r=e.bufferViews[o],s=r.buffer,a=e.buffers[s],c=ZT(a,s,n,i),u=nD(r);return`${c}-range-${u}`}function _X(e,t,n,i){const o=e.images[t],r=o.bufferView,s=o.uri;if(l(s)){const _=i.getDerivedResource({url:s});return QT(_)}const a=e.bufferViews[r],c=a.buffer,u=e.buffers[c],f=ZT(u,c,n,i),h=nD(a);return`${f}-range-${h}`}function P4e(e,t){const n=r_.createSampler({gltf:e,textureInfo:t});return`${n.wrapS}-${n.wrapT}-${n.minificationFilter}-${n.magnificationFilter}`}cu.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:${QT(n)}`};cu.getExternalBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;return b.typeOf.object("options.resource",t),`external-buffer:${pX(t)}`};cu.getEmbeddedBufferCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId;return b.typeOf.object("options.parentResource",t),b.typeOf.number("options.bufferId",n),`embedded-buffer:${mX(t,n)}`};cu.getGltfCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource;return b.typeOf.object("options.gltfResource",t),`gltf:${QT(t)}`};cu.getBufferViewCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;b.typeOf.object("options.gltf",t),b.typeOf.number("options.bufferViewId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o);const r=t.bufferViews[n];let s=r.buffer;const a=t.buffers[s];tr(r,"EXT_meshopt_compression")&&(s=r.extensions.EXT_meshopt_compression.buffer);const c=ZT(a,s,i,o),u=nD(r);return`buffer-view:${c}-range-${u}`};cu.getDracoCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;return b.typeOf.object("options.gltf",t),b.typeOf.object("options.draco",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),`draco:${qM(t,n,i,o)}`};cu.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),f=A(e.loadTypedArray,!1);b.typeOf.object("options.gltf",t),b.typeOf.object("options.gltfResource",n),b.typeOf.object("options.baseResource",i),b.typeOf.object("options.frameState",o);const h=l(r),_=O4e(s,a),g=l(a);if(h===_)throw new x("One of options.bufferViewId and options.draco must be defined.");if(_&&!g)throw new x("When options.draco is defined options.attributeSemantic must also be defined.");if(_&&(b.typeOf.object("options.draco",s),b.typeOf.string("options.attributeSemantic",a)),!u&&!f)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}`),f&&(p+="-typed-array"),l(s))return`vertex-buffer:${qM(t,s,n,i)}-draco-${a}${p}`;const y=t.bufferViews[r],C=y.buffer,T=t.buffers[C],E=ZT(T,C,n,i),w=nD(y);return`vertex-buffer:${E}-range-${w}${p}`};function O4e(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}cu.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(b.typeOf.object("options.gltf",t),b.typeOf.number("options.accessorId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),b.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:${qM(t,s,i,o)}-draco${u}`;const f=t.accessors[n],h=f.bufferView,_=t.bufferViews[h],g=_.buffer,p=t.buffers[g],y=ZT(p,g,i,o),C=I4e(f,_);return`index-buffer:${y}-accessor-${C}${u}`};cu.getImageCacheKey=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;return b.typeOf.object("options.gltf",t),b.typeOf.number("options.imageId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),`image:${_X(t,n,i,o)}`};cu.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;b.typeOf.object("options.gltf",t),b.typeOf.object("options.textureInfo",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),b.typeOf.object("options.supportedImageFormats",r),b.typeOf.object("options.frameState",s);const a=n.index,c=r_.getImageIdFromTexture({gltf:t,textureId:a,supportedImageFormats:r}),u=_X(t,c,i,o),f=P4e(t,n);return`texture:${u}-sampler-${f}-context-${s.context.id}`};const gf=cu;function eb(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}}eb.prototype.clear=function(){this.geometryByteLength=0,this.texturesByteLength=0,this._geometrySizes={},this._textureSizes={}};eb.prototype.addGeometryLoader=function(e){b.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]})};eb.prototype.addTextureLoader=function(e){b.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]})};eb.prototype.removeLoader=function(e){b.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 mt(){}mt.cacheEntries={};mt.statistics=new eb;function L4e(e){this.referenceCount=1,this.resourceLoader=e,this._statisticsPromise=void 0}mt.get=function(e){b.typeOf.string("cacheKey",e);const t=mt.cacheEntries[e];if(l(t))return++t.referenceCount,t.resourceLoader};mt.load=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resourceLoader;b.typeOf.object("options.resourceLoader",t);const n=t.cacheKey;if(b.typeOf.string("options.resourceLoader.cacheKey",n),l(mt.cacheEntries[n]))throw new x(`Resource with this cacheKey is already in the cache: ${n}`);mt.cacheEntries[n]=new L4e(t),t.load()};mt.unload=function(e){b.typeOf.object("resourceLoader",e);const t=e.cacheKey,n=mt.cacheEntries[t];if(!l(n))throw new x(`Resource is not in the cache: ${t}`);--n.referenceCount,n.referenceCount===0&&(mt.statistics.removeLoader(e),e.destroy(),delete mt.cacheEntries[t])};mt.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=gf.getSchemaCacheKey({schema:t,resource:n});let o=mt.get(i);return l(o)||(o=new Yh({schema:t,resource:n,cacheKey:i}),mt.load({resourceLoader:o})),o};mt.loadEmbeddedBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.parentResource,n=e.bufferId,i=e.typedArray;b.typeOf.object("options.parentResource",t),b.typeOf.number("options.bufferId",n);const o=gf.getEmbeddedBufferCacheKey({parentResource:t,bufferId:n});let r=mt.get(o);return l(r)||(b.typeOf.object("options.typedArray",i),r=new zl({typedArray:i,cacheKey:o}),mt.load({resourceLoader:r})),r};mt.loadExternalBuffer=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.resource;b.typeOf.object("options.resource",t);const n=gf.getExternalBufferCacheKey({resource:t});let i=mt.get(n);return l(i)||(i=new zl({resource:t,cacheKey:n}),mt.load({resourceLoader:i})),i};mt.loadGltfJson=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltfResource,n=e.baseResource,i=e.typedArray,o=e.gltfJson;b.typeOf.object("options.gltfResource",t),b.typeOf.object("options.baseResource",n);const r=gf.getGltfCacheKey({gltfResource:t});let s=mt.get(r);return l(s)||(s=new id({resourceCache:mt,gltfResource:t,baseResource:n,typedArray:i,gltfJson:o,cacheKey:r}),mt.load({resourceLoader:s})),s};mt.loadBufferView=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.bufferViewId,i=e.gltfResource,o=e.baseResource;b.typeOf.object("options.gltf",t),b.typeOf.number("options.bufferViewId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o);const r=gf.getBufferViewCacheKey({gltf:t,bufferViewId:n,gltfResource:i,baseResource:o});let s=mt.get(r);return l(s)||(s=new ed({resourceCache:mt,gltf:t,bufferViewId:n,gltfResource:i,baseResource:o,cacheKey:r}),mt.load({resourceLoader:s})),s};mt.loadDraco=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.draco,i=e.gltfResource,o=e.baseResource;b.typeOf.object("options.gltf",t),b.typeOf.object("options.draco",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o);const r=gf.getDracoCacheKey({gltf:t,draco:n,gltfResource:i,baseResource:o});let s=mt.get(r);return l(s)||(s=new td({resourceCache:mt,gltf:t,draco:n,gltfResource:i,baseResource:o,cacheKey:r}),mt.load({resourceLoader:s})),s};mt.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),f=A(e.dequantize,!1),h=A(e.loadBuffer,!1),_=A(e.loadTypedArray,!1);if(b.typeOf.object("options.gltf",t),b.typeOf.object("options.gltfResource",n),b.typeOf.object("options.baseResource",i),b.typeOf.object("options.frameState",o),!h&&!_)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const g=l(r),p=B4e(s,a),y=l(a),C=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&&!C)throw new x("When options.draco is defined options.haAccessorId must also be defined.");p&&(b.typeOf.object("options.draco",s),b.typeOf.string("options.attributeSemantic",a),b.typeOf.number("options.accessorId",c));const T=gf.getVertexBufferCacheKey({gltf:t,gltfResource:n,baseResource:i,frameState:o,bufferViewId:r,draco:s,attributeSemantic:a,dequantize:f,loadBuffer:h,loadTypedArray:_});let E=mt.get(T);if(l(E))return E;E=new rd({resourceCache:mt,gltf:t,gltfResource:n,baseResource:i,bufferViewId:r,draco:s,attributeSemantic:a,accessorId:c,cacheKey:T,asynchronous:u,dequantize:f,loadBuffer:h,loadTypedArray:_}),mt.load({resourceLoader:E});const w=mt.statistics.addGeometryLoader(E);return mt.cacheEntries[T]._statisticsPromise=w,E};function B4e(e,t){return l(e)&&l(e.attributes)&&l(e.attributes[t])}mt.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(b.typeOf.object("options.gltf",t),b.typeOf.number("options.accessorId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),b.typeOf.object("options.frameState",r),!c&&!u)throw new x("At least one of loadBuffer and loadTypedArray must be true.");const f=gf.getIndexBufferCacheKey({gltf:t,accessorId:n,gltfResource:i,baseResource:o,frameState:r,draco:s,loadBuffer:c,loadTypedArray:u});let h=mt.get(f);if(l(h))return h;h=new nd({resourceCache:mt,gltf:t,accessorId:n,gltfResource:i,baseResource:o,draco:s,cacheKey:f,asynchronous:a,loadBuffer:c,loadTypedArray:u}),mt.load({resourceLoader:h});const _=mt.statistics.addGeometryLoader(h);return mt.cacheEntries[f]._statisticsPromise=_,h};mt.loadImage=function(e){e=A(e,A.EMPTY_OBJECT);const t=e.gltf,n=e.imageId,i=e.gltfResource,o=e.baseResource;b.typeOf.object("options.gltf",t),b.typeOf.number("options.imageId",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o);const r=gf.getImageCacheKey({gltf:t,imageId:n,gltfResource:i,baseResource:o});let s=mt.get(r);return l(s)||(s=new Uu({resourceCache:mt,gltf:t,imageId:n,gltfResource:i,baseResource:o,cacheKey:r}),mt.load({resourceLoader:s})),s};mt.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);b.typeOf.object("options.gltf",t),b.typeOf.object("options.textureInfo",n),b.typeOf.object("options.gltfResource",i),b.typeOf.object("options.baseResource",o),b.typeOf.object("options.supportedImageFormats",r),b.typeOf.object("options.frameState",s);const c=gf.getTextureCacheKey({gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s});let u=mt.get(c);if(l(u))return u;u=new od({resourceCache:mt,gltf:t,textureInfo:n,gltfResource:i,baseResource:o,supportedImageFormats:r,cacheKey:c,asynchronous:a}),mt.load({resourceLoader:u});const f=mt.statistics.addTextureLoader(u);return mt.cacheEntries[c]._statisticsPromise=f,u};mt.clearForSpecs=function(){const e=[rd,nd,td,od,Uu,ed,zl,Yh,id];let t;const n=mt.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])}mt.statistics.clear()};function ra(e,t,n,i,o){if(b.typeOf.object("resource",e),l(t)===l(n))throw new x("One of json and subtreeView must be defined.");b.typeOf.object("implicitTileset",i),b.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=R4e(this,t,n,i)}Object.defineProperties(ra.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}}});ra.prototype.tileIsAvailableAtIndex=function(e){return this._tileAvailability.getBit(e)};ra.prototype.tileIsAvailableAtCoordinates=function(e){const t=this.getTileIndex(e);return this.tileIsAvailableAtIndex(t)};ra.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)};ra.prototype.contentIsAvailableAtCoordinates=function(e,t){const n=this.getTileIndex(e);return this.contentIsAvailableAtIndex(n,t)};ra.prototype.childSubtreeIsAvailableAtIndex=function(e){return this._childSubtreeAvailability.getBit(e)};ra.prototype.childSubtreeIsAvailableAtCoordinates=function(e){const t=this.getChildSubtreeIndex(e);return this.childSubtreeIsAvailableAtIndex(t)};ra.prototype.getLevelOffset=function(e){const t=this._branchingFactor;return(Math.pow(t,e)-1)/(t-1)};ra.prototype.getParentMortonIndex=function(e){let t=2;return this._subdivisionScheme===Cr.OCTREE&&(t=3),e>>t};function R4e(e,t,n,i){let o;l(t)?o={json:t,binary:void 0}:o=N4e(n);const r=o.json;e._subtreeJson=r;let s;if(tr(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 C=r.contentMetadata[y];a.push(r.propertyTables[C])}}let c;const u=i.metadataSchema,f=r.subtreeMetadata;if(l(f)){const p=f.class,y=u.classes[p];c=new Bd({subtreeMetadata:f,class:y})}e._metadata=c,e._tilePropertyTableJson=s,e._contentPropertyTableJsons=a;const h={constant:0};r.contentAvailabilityHeaders=[],tr(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 _=M4e(r.buffers),g=F4e(r.bufferViews,_);z4e(r,g),l(s)&&_4(s,g);for(let p=0;p<a.length;p++){const y=a[p];_4(y,g)}return U4e(e,_,o.binary).then(function(p){const y=V4e(g,p);return k4e(e,r,i,y),l(s)&&(G4e(e,i,y),j4e(e)),W4e(e,i,y),q4e(e),e})}function N4e(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=Fa(e,i,o);i+=o;const a=e.subarray(i,i+r);return{json:s,binary:a}}function M4e(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 F4e(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 z4e(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 _4(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 U4e(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=H4e(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 H4e(e,t){const i=e._resource.getDerivedResource({url:t.uri}),o=mt.loadExternalBuffer({resource:i});return e._bufferLoader=o,o.promise.then(function(r){return r.typedArray})}function V4e(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 k4e(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=tr(t,"3DTILES_metadata"),u=l(e._tilePropertyTableJson);let f=c||u;e._tileAvailability=cO(t.tileAvailability,i,s,f);const h=e._contentPropertyTableJsons.length>0;f=f||h;for(let _=0;_<t.contentAvailabilityHeaders.length;_++){const g=cO(t.contentAvailabilityHeaders[_],i,s,f);e._contentAvailabilityBitstreams.push(g)}e._childSubtreeAvailability=cO(t.childSubtreeAvailability,i,a)}function cO(e,t,n,i){if(l(e.constant))return new SS({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 SS({bitstream:o,lengthBits:n,availableCount:e.availableCount,computeAvailableCountEnabled:i})}function G4e(e,t,n){const i=e._tilePropertyTableJson,o=e._tileAvailability.availableCount,r=t.metadataSchema,s=i.class,a=r.classes[s];e._tileMetadataTable=new wa({class:a,count:o,properties:i.properties,bufferViews:n})}function W4e(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],f=o[a].availableCount,h=c.class,_=r.classes[h],g=new wa({class:_,count:f,properties:c.properties,bufferViews:n});s.push(g)}}function gX(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 j4e(e){const t=gX(e._tileAvailability);e._tileJumpBuffer=t}function q4e(e){const t=e._contentJumpBuffers,n=e._contentAvailabilityBitstreams;for(let i=0;i<n.length;i++){const o=n[i],r=gX(o);t.push(r)}}ra.prototype.getTileIndex=function(e){const t=e.level-this._implicitCoordinates.level;if(t<0||this._subtreeLevels<=t)throw new Se("level is out of bounds for this subtree");return e.getSubtreeCoordinates().getOffsetCoordinates(e).tileIndex};ra.prototype.getChildSubtreeIndex=function(e){if(e.level-this._implicitCoordinates.level!==this._implicitCoordinates.subtreeLevels)throw new Se("level is out of bounds for this subtree");return e.getParentSubtreeCoordinates().getOffsetCoordinates(e).mortonIndex};function Y4e(e,t){if(!l(e._tileMetadataTable))return;const n=e.getTileIndex(t);if(e._tileAvailability.getBit(n))return e._tileJumpBuffer[n]}function $4e(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]}ra.prototype.getTileMetadataView=function(e){const t=Y4e(this,e);if(!l(t))return;const n=this._tileMetadataTable;return new pf({class:n.class,metadataTable:n,entityId:t,propertyTableJson:this._tilePropertyTableJson})};ra.prototype.getContentMetadataView=function(e,t){const n=$4e(this,e,t);if(!l(n))return;const i=this._contentMetadataTables[t],o=this._contentPropertyTableJsons[t];return new pf({class:i.class,metadataTable:i,entityId:n,contentIndex:t,propertyTableJson:o})};ra.prototype.isDestroyed=function(){return!1};ra.prototype.destroy=function(){return l(this._bufferLoader)&&mt.unload(this._bufferLoader),Ue(this)};const X4e={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"},K4e=Object.freeze(X4e);function J4e(e){return b.typeOf.object("tileMetadata",e),{tile:{boundingVolume:g4("TILE",e),minimumHeight:y4("TILE",e),maximumHeight:A4("TILE",e)},content:{boundingVolume:g4("CONTENT",e),minimumHeight:y4("CONTENT",e),maximumHeight:A4("CONTENT",e)}}}function g4(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 y4(e,t){const n=`${e}_MINIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function A4(e,t){const n=`${e}_MAXIMUM_HEIGHT`;return t.getPropertyBySemantic(n)}function dc(e,t,n,i,o,r){if(b.defined("tile.implicitTileset",t.implicitTileset),b.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=Q4e(this,i,o,r)}Object.defineProperties(dc.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 Q4e(e,t,n,i){i=A(i,0);let o;l(n)&&(o=new Uint8Array(n,i));const r=new ra(e._resource,t,o,e._implicitTileset,e._implicitCoordinates);return e._implicitSubtree=r,r.readyPromise.then(function(){return Z4e(e,r),e})}function Z4e(e,t){const n=e._tile,i=e._implicitCoordinates.childIndex,o=tGe(e,t,n,i),r=e._tileset.statistics;n.children.push(o.rootTile),r.numberOfTilesTotal++;const s=eGe(e,t,o.bottomRow);for(let a=0;a<s.length;a++){const c=s[a],u=c.tile,f=uGe(e,u,c.childIndex);u.children.push(f),r.numberOfTilesTotal++}}function eGe(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 tGe(e,t,n,i){const s=C4(e,t,n,i,0,!0),a=e._tileset.statistics;let c=[s],u=[];const f=e._implicitTileset;for(let h=1;h<f.subtreeLevels;h++){const _=t.getLevelOffset(h),g=f.branchingFactor*c.length;for(let p=0;p<g;p++){const y=_+p;if(!t.tileIsAvailableAtIndex(y)){u.push(void 0);continue}const C=t.getParentMortonIndex(p),T=c[C],E=p%f.branchingFactor,w=C4(e,t,T,E,y);T.children.push(w),a.numberOfTilesTotal++,u.push(w)}c=u,u=[]}return{rootTile:s,bottomRow:c}}function yX(e,t,n){const i=K4e.TILE_GEOMETRIC_ERROR;return l(e)&&e.hasPropertyBySemantic(i)?e.getPropertyBySemantic(i):t.geometricError/Math.pow(2,n.level)}function C4(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,f;if(l(t.tilePropertyTableJson)){c=t.getTileMetadataView(a);const O=J4e(c);u=O.tile,f=O.content}const _=t.contentPropertyTableJsons.length;let g=!1;for(let O=0;O<_;O++)if(t.contentIsAvailableAtCoordinates(a,O)){g=!0;break}const p=oGe(s,a,i,r,n,u),y=[];for(let O=0;O<s.contentCount;O++){if(!t.contentIsAvailableAtIndex(o,O))continue;const F={uri:s.contentUriTemplates[O].getDerivedResource({templateValues:a.getTemplateValues()}).url},H=rGe(p,f);l(H)&&(F.boundingVolume=H),y.push(sn(F,s.contentHeaders[O]))}const C=yX(c,s,a),T={boundingVolume:p,geometricError:C,refine:s.refine,contents:y},E=!0,w=ut(s.tileHeader,E);delete w.boundingVolume,delete w.transform;const S=sn(T,w,E),P=EX(e,s.baseResource,S,n);return P.implicitCoordinates=a,P.implicitSubtree=t,P.metadata=c,P.hasImplicitContentMetadata=g,P}function OS(e,t){return l(e)&&l(t)&&(l(t.minimumHeight)||l(t.maximumHeight))&&(tr(e,"3DTILES_bounding_volume_S2")||l(e.region))}function vB(e,t){l(t)&&(tr(e,"3DTILES_bounding_volume_S2")?iGe(e.extensions["3DTILES_bounding_volume_S2"],t.minimumHeight,t.maximumHeight):l(e.region)&&nGe(e.region,t.minimumHeight,t.maximumHeight))}function nGe(e,t,n){l(t)&&(e[4]=t),l(n)&&(e[5]=n)}function iGe(e,t,n){l(t)&&(e.minimumHeight=t),l(n)&&(e.maximumHeight=n)}function oGe(e,t,n,i,o,r){let s;return!l(r)||!l(r.boundingVolume)||!OS(r.boundingVolume,r)&&OS(e.boundingVolume,r)?s=AX(e,t,n,A(i,!1),o):s=r.boundingVolume,vB(s,r),s}function rGe(e,t){let n;return l(t)&&(n=t.boundingVolume),OS(n,t)?vB(n,t):OS(e,t)&&(n=ut(e,!0),vB(n,t)),n}function AX(e,t,n,i,o){const r=e.boundingVolume;return tr(r,"3DTILES_bounding_volume_S2")?CX(i,o,n,t.level,t.x,t.y,t.z):l(r.region)?{region:bX(r.region,t.level,t.x,t.y,t.z)}:{box:TX(r.box,t.level,t.x,t.y,t.z)}}function CX(e,t,n,i,o,r,s){b.typeOf.bool("parentIsPlaceholderTile",e),b.typeOf.object("parentTile",t),b.typeOf.number("childIndex",n),b.typeOf.number("level",i),b.typeOf.number("x",o),b.typeOf.number("y",r),l(s)&&b.typeOf.number("z",s);const a=t._boundingVolume;if(e)return{extensions:{"3DTILES_bounding_volume_S2":{token:ji.getTokenFromId(a.s2Cell._cellId),minimumHeight:a.minimumHeight,maximumHeight:a.maximumHeight}}};const c=Number(t._boundingVolume.s2Cell._cellId>>BigInt(61)),u=c%2===0?s4.encode2D(i,o,r):s4.encode2D(i,r,o),f=ji.fromFacePositionLevel(c,BigInt(u),i);let h,_;if(l(s)){const g=(a.maximumHeight+a.minimumHeight)/2;h=n<4?a.minimumHeight:g,_=n<4?g:a.maximumHeight}else h=a.minimumHeight,_=a.maximumHeight;return{extensions:{"3DTILES_bounding_volume_S2":{token:ji.getTokenFromId(f._cellId),minimumHeight:h,maximumHeight:_}}}}const sGe=new d,aGe=new d,lO=new d,cGe=new J;function TX(e,t,n,i,o){if(b.typeOf.object("rootBox",e),b.typeOf.number("level",t),b.typeOf.number("x",n),b.typeOf.number("y",i),l(o)&&b.typeOf.number("z",o),t===0)return e;const r=d.unpack(e,0,aGe),s=J.unpack(e,3,cGe),a=Math.pow(2,-t),c=-1+(2*n+1)*a,u=-1+(2*i+1)*a;let f=0;const h=d.fromElements(a,a,1,sGe);l(o)&&(f=-1+(2*o+1)*a,h.z=a);let _=d.fromElements(c,u,f,lO);_=J.multiplyByVector(s,_,lO),_=d.add(_,r,lO);let g=J.clone(s);g=J.multiplyByScale(g,h,g);const p=new Array(12);return d.pack(_,p),J.pack(g,p,3),p}const lGe=new _e;function bX(e,t,n,i,o){if(b.typeOf.object("rootRegion",e),b.typeOf.number("level",t),b.typeOf.number("x",n),b.typeOf.number("y",i),l(o)&&b.typeOf.number("z",o),t===0)return e.slice();const r=_e.unpack(e,0,lGe),s=e[4],a=e[5],c=Math.pow(2,-t),u=c*r.width,f=N.negativePiToPi(r.west+n*u),h=N.negativePiToPi(f+u),_=c*r.height,g=N.negativePiToPi(r.south+i*_),p=N.negativePiToPi(g+_);let y=s,C=a;if(l(o)){const T=c*(a-s);y+=o*T,C=y+T}return[f,g,h,p,y,C]}function uGe(e,t,n){const i=e._implicitTileset,o=t.implicitCoordinates.getChildCoordinates(n),r=AX(i,o,n,!1,t),s=yX(void 0,i,o),a=i.subtreeUriTemplate.getDerivedResource({templateValues:o.getTemplateValues()}).url,c={boundingVolume:r,geometricError:s,refine:i.refine,contents:[{uri:a}]},u=EX(e,i.baseResource,c,t);return u.implicitTileset=i,u.implicitCoordinates=o,u}function EX(e,t,n,i){const o=e._tile.constructor;return new o(e._tileset,t,n,i)}dc.prototype.hasProperty=function(e,t){return!1};dc.prototype.getFeature=function(e){};dc.prototype.applyDebugSettings=function(e,t){};dc.prototype.applyStyle=function(e){};dc.prototype.update=function(e,t){};dc.prototype.isDestroyed=function(){return!1};dc.prototype.destroy=function(){return this._implicitSubtree=this._implicitSubtree&&this._implicitSubtree.destroy(),Ue(this)};dc._deriveBoundingBox=TX;dc._deriveBoundingRegion=bX;dc._deriveBoundingVolumeS2=CX;const fGe={NONE:0,REPEAT:1,MIRRORED_REPEAT:2},Wf=Object.freeze(fGe),HA={HIGHLIGHT:0,REPLACE:1,MIX:2};HA.getColorBlend=function(e,t){if(e===HA.HIGHLIGHT)return 0;if(e===HA.REPLACE)return 1;if(e===HA.MIX)return N.clamp(t,N.EPSILON4,1)};const iD=Object.freeze(HA),dGe={XTRANSLATE:"xTranslate",YTRANSLATE:"yTranslate",ZTRANSLATE:"zTranslate",XROTATE:"xRotate",YROTATE:"yRotate",ZROTATE:"zRotate",XSCALE:"xScale",YSCALE:"yScale",ZSCALE:"zScale",UNIFORMSCALE:"uniformScale"},El=Object.freeze(dGe),hGe={STEP:0,LINEAR:1,CUBICSPLINE:2},fy=Object.freeze(hGe),xX={};function z_(e){b.typeOf.number.greaterThan("options.count",e.count,0),b.typeOf.object("options.properties",e.properties),this._count=e.count,this._properties=ut(e.properties,!0)}z_.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,xX)};z_.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,xX,e)};z_.prototype.getProperty=function(e,t){if(b.typeOf.number("index",e),b.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 ut(n[e],!0)};z_.prototype.setProperty=function(e,t,n){if(b.typeOf.number("index",e),b.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]=ut(n,!0)};function dr(e){e=A(e,A.EMPTY_OBJECT),b.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(dr.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}}});dr.prototype.hasProperty=function(e,t){return b.typeOf.number("index",e),b.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))};dr.prototype.hasPropertyBySemantic=function(e,t){return b.typeOf.number("index",e),b.typeOf.string("semantic",t),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(t):!1};dr.prototype.propertyExists=function(e){return b.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))};dr.prototype.propertyExistsBySemantic=function(e){return b.typeOf.string("semantic",e),l(this._metadataTable)?this._metadataTable.hasPropertyBySemantic(e):!1};const uO=[];dr.prototype.getPropertyIds=function(e,t){return t=l(t)?t:[],t.length=0,l(this._metadataTable)&&t.push.apply(t,this._metadataTable.getPropertyIds(uO)),l(this._batchTableHierarchy)&&t.push.apply(t,this._batchTableHierarchy.getPropertyIds(e,uO)),l(this._jsonMetadataTable)&&t.push.apply(t,this._jsonMetadataTable.getPropertyIds(uO)),t};dr.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};dr.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 z_({count:this._count,properties:{}})),this._jsonMetadataTable.setProperty(e,t,n))};dr.prototype.getPropertyBySemantic=function(e,t){if(l(this._metadataTable))return this._metadataTable.getPropertyBySemantic(e,t)};dr.prototype.setPropertyBySemantic=function(e,t,n){return l(this._metadataTable)?this._metadataTable.setPropertyBySemantic(e,t,n):!1};dr.prototype.getPropertyTypedArray=function(e){if(b.typeOf.string("propertyId",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArray(e)};dr.prototype.getPropertyTypedArrayBySemantic=function(e){if(b.typeOf.string("semantic",e),l(this._metadataTable))return this._metadataTable.getPropertyTypedArrayBySemantic(e)};function YM(e,t){if(!l(e)||e<0||e>=t)throw new x(`featureId is required and must be between zero and featuresLength - 1 (${t}`-+").")}dr.prototype.isClass=function(e,t){YM(e,this.count),b.typeOf.string("className",t);const n=this._batchTableHierarchy;return l(n)?n.isClass(e,t):!1};dr.prototype.isExactClass=function(e,t){return YM(e,this.count),b.typeOf.string("className",t),this.getExactClassName(e)===t};dr.prototype.getExactClassName=function(e){YM(e,this.count);const t=this._batchTableHierarchy;if(l(t))return t.getClassName(e)};function tb(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty,i=e.textures;b.typeOf.object("options.property",t),b.typeOf.object("options.classProperty",n),b.typeOf.object("options.textures",i);const o=l(t.channels)?t.channels:[0],r=t,s=r_.createModelTextureReader({textureInfo:r,channels:_Ge(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(tb.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}}});tb.prototype.isGpuCompatible=function(){const e=this._classProperty,t=e.type,n=e.componentType;return e.isArray?!e.isVariableLengthArray&&e.arrayLength<=4&&t===It.SCALAR&&n===Vt.UINT8:It.isVectorType(t)||t===It.SCALAR?n===Vt.UINT8:!1};const pGe=[void 0,"float","vec2","vec3","vec4"],mGe=[void 0,"int","ivec2","ivec3","ivec4"];tb.prototype.getGlslType=function(){const e=this._classProperty;let t=It.getComponentCount(e.type);return e.isArray&&(t=e.arrayLength),e.normalized?pGe[t]:mGe[t]};tb.prototype.unpackInShader=function(e){return this._classProperty.normalized?e:`${this.getGlslType()}(255.0 * ${e})`};function _Ge(e){return e.map(function(t){return"rgba".charAt(t)}).join("")}function oD(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyTexture,n=e.class,i=e.textures;b.typeOf.object("options.propertyTexture",t),b.typeOf.object("options.class",n),b.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 tb({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(oD.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}}});oD.prototype.getProperty=function(e){return b.typeOf.string("propertyId",e),this._properties[e]};function wX(e){e=A(e,A.EMPTY_OBJECT);const t=e.property,n=e.classProperty;b.typeOf.object("options.property",t),b.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(wX.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 rD(e){e=A(e,A.EMPTY_OBJECT);const t=e.propertyAttribute,n=e.class;b.typeOf.object("options.propertyAttribute",t),b.typeOf.object("options.class",n);const i={};if(l(t.properties))for(const o in t.properties)t.properties.hasOwnProperty(o)&&(i[o]=new wX({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(rD.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}}});rD.prototype.getProperty=function(e){return b.typeOf.string("propertyId",e),this._properties[e]};function lu(e){e=A(e,A.EMPTY_OBJECT),b.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(lu.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}}});lu.prototype.getPropertyTable=function(e){return b.typeOf.number("propertyTableId",e),this._propertyTables[e]};lu.prototype.getPropertyTexture=function(e){return b.typeOf.number("propertyTextureId",e),this._propertyTextures[e]};lu.prototype.getPropertyAttribute=function(e){return b.typeOf.number("propertyAttributeId",e),this._propertyAttributes[e]};function gGe(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;b.typeOf.object("options.extension",t),b.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 wa({count:a.count,properties:a.properties,class:c,bufferViews:e.bufferViews});i.push(new dr({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 oD({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 rD({id:s,name:a.name,class:n.classes[a.class],propertyAttribute:a}))}return new lu({schema:n,propertyTables:i,propertyTextures:o,propertyAttributes:r,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function yGe(e){e=A(e,A.EMPTY_OBJECT);const t=e.extension,n=e.schema;b.typeOf.object("options.extension",t),b.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],f=new wa({count:c.count,properties:c.properties,class:u,bufferViews:e.bufferViews});o.push(new dr({id:a,count:c.count,metadataTable:f,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 oD({id:a,propertyTexture:AGe(c),class:n.classes[c.class],textures:e.textures}))}return new lu({schema:n,propertyTables:o,propertyTextures:s,statistics:t.statistics,extras:t.extras,extensions:t.extensions})}function AGe(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:CGe(o.channels),extras:o.extras,extensions:o.extensions};t.properties[i]=sn(o.texture,r,!0)}return t}function CGe(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 $h(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(b.typeOf.object("options.gltf",t),b.typeOf.object("options.gltfResource",o),b.typeOf.object("options.baseResource",r),b.typeOf.object("options.supportedImageFormats",s),b.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=Lt.UNLOADED,this._promise=void 0}l(Object.create)&&($h.prototype=Object.create(ir.prototype),$h.prototype.constructor=$h);Object.defineProperties($h.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){return this._cacheKey}},structuralMetadata:{get:function(){return this._structuralMetadata}}});$h.prototype.load=function(){const e=wGe(this),t=PGe(this),n=OGe(this);this._gltf=void 0,this._state=Lt.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=gGe({extension:i._extension,schema:a,bufferViews:r,textures:s}):i._structuralMetadata=yGe({extension:i._extensionLegacy,schema:a,bufferViews:r,textures:s}),i._state=Lt.READY,i}).catch(function(o){if(i.isDestroyed())return;i.unload(),i._state=Lt.FAILED;const r="Failed to load structural metadata";return Promise.reject(i.getError(r,o))})};function TGe(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 bGe(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 EGe(e){const t=e.propertyTables,n={};if(l(t))for(let i=0;i<t.length;i++){const o=t[i];TGe(o.properties,n)}return n}function xGe(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)&&bGe(r,n)}}return n}function wGe(e){let t;l(e._extension)?t=EGe(e._extension):t=xGe(e._extensionLegacy);const n=[],i={};for(const o in t)if(t.hasOwnProperty(o)){const r=mt.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 SX(e),o})}function SGe(e){const t={},n=e.propertyTextures;if(l(n))for(let i=0;i<n.length;i++){const r=n[i].properties;l(r)&&vGe(r,t)}return t}function vGe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const i=e[n];t[i.index]=i}}function DGe(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)&&IGe(r,t)}}return t}function IGe(e,t){for(const n in e)if(e.hasOwnProperty(n)){const o=e[n].texture;t[o.index]=o}}function PGe(e){let t;l(e._extension)?t=SGe(e._extension):t=DGe(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 f in t)if(t.hasOwnProperty(f)){const h=mt.loadTexture({gltf:n,textureInfo:t[f],gltfResource:i,baseResource:o,supportedImageFormats:r,frameState:s,asynchronous:a});c.push(h.promise),e._textureLoaders.push(h),u[f]=h}return Promise.all(c).then(function(){const f={};for(const h in u)if(u.hasOwnProperty(h)){const _=u[h];f[h]=_.texture}return f})}function OGe(e){const t=A(e._extension,e._extensionLegacy);let n;if(l(t.schemaUri)){const i=e._baseResource.getDerivedResource({url:t.schemaUri});n=mt.loadSchema({resource:i})}else n=mt.loadSchema({schema:t.schema});return e._schemaLoader=n,n.promise.then(function(i){return i.schema})}$h.prototype.process=function(e){if(b.typeOf.object("frameState",e),this._state!==Lt.LOADING)return;const t=this._textureLoaders,n=t.length;for(let i=0;i<n;++i)t[i].process(e)};function SX(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)mt.unload(t[i]);e._bufferViewLoaders.length=0}function LGe(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)mt.unload(t[i]);e._textureLoaders.length=0}$h.prototype.unload=function(){SX(this),LGe(this),l(this._schemaLoader)&&mt.unload(this._schemaLoader),this._schemaLoader=void 0,this._structuralMetadata=void 0};const In={POSITION:"POSITION",NORMAL:"NORMAL",TANGENT:"TANGENT",TEXCOORD:"TEXCOORD",COLOR:"COLOR",JOINTS:"JOINTS",WEIGHTS:"WEIGHTS",FEATURE_ID:"_FEATURE_ID"};function BGe(e){switch(e){case In.POSITION:return"positionMC";case In.NORMAL:return"normalMC";case In.TANGENT:return"tangentMC";case In.TEXCOORD:return"texCoord";case In.COLOR:return"color";case In.JOINTS:return"joints";case In.WEIGHTS:return"weights";case In.FEATURE_ID:return"featureId";default:throw new x("semantic is not a valid value.")}}In.hasSetIndex=function(e){switch(b.typeOf.string("semantic",e),e){case In.POSITION:case In.NORMAL:case In.TANGENT:return!1;case In.TEXCOORD:case In.COLOR:case In.JOINTS:case In.WEIGHTS:case In.FEATURE_ID:return!0;default:throw new x("semantic is not a valid value.")}};In.fromGltfSemantic=function(e){b.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"POSITION":return In.POSITION;case"NORMAL":return In.NORMAL;case"TANGENT":return In.TANGENT;case"TEXCOORD":return In.TEXCOORD;case"COLOR":return In.COLOR;case"JOINTS":return In.JOINTS;case"WEIGHTS":return In.WEIGHTS;case"_FEATURE_ID":return In.FEATURE_ID}};In.fromPntsSemantic=function(e){switch(b.typeOf.string("pntsSemantic",e),e){case"POSITION":case"POSITION_QUANTIZED":return In.POSITION;case"RGBA":case"RGB":case"RGB565":return In.COLOR;case"NORMAL":case"NORMAL_OCT16P":return In.NORMAL;case"BATCH_ID":return In.FEATURE_ID;default:throw new x("pntsSemantic is not a valid value.")}};In.getGlslType=function(e){switch(b.typeOf.string("semantic",e),e){case In.POSITION:case In.NORMAL:case In.TANGENT:return"vec3";case In.TEXCOORD:return"vec2";case In.COLOR:return"vec4";case In.JOINTS:return"ivec4";case In.WEIGHTS:return"vec4";case In.FEATURE_ID:return"int";default:throw new x("semantic is not a valid value.")}};In.getVariableName=function(e,t){b.typeOf.string("semantic",e);let n=BGe(e);return l(t)&&(n+=`_${t}`),n};const bt=Object.freeze(In);function $t(){}$t.getFailedLoadFunction=function(e,t,n){return function(i){let o=`Failed to load ${t}: ${n}`;l(i)&&(o+=`
${i.message}`);const r=new Se(o);return l(i)&&(r.stack=`Original stack:
${i.stack}
Handler stack:
${r.stack}`),Promise.reject(r)}};$t.getNodeTransform=function(e){return l(e.matrix)?e.matrix:B.fromTranslationQuaternionRotationScale(l(e.translation)?e.translation:d.ZERO,l(e.rotation)?e.rotation:Ce.IDENTITY,l(e.scale)?e.scale:d.ONE)};$t.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}};$t.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}};$t.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}};$t.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};$t.getAttributeInfo=function(e){const t=e.semantic,n=e.setIndex;let i,o=!1;l(t)?(i=bt.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=ln.getGlslType(s);r&&(a="vec4");const c=l(e.quantization);let u;return c&&(u=r?"vec4":ln.getGlslType(e.quantization.type)),{attribute:e,isQuantized:c,variableName:i,hasSemantic:o,glslType:a,quantizedGlslType:u}};const RGe=new d,NGe=new d;$t.getPositionMinMax=function(e,t,n){const i=$t.getAttributeBySemantic(e,"POSITION");let o=i.max,r=i.min;return l(n)&&l(t)&&(r=d.add(r,t,NGe),o=d.add(o,n,RGe)),{min:r,max:o}};$t.getAxisCorrectionMatrix=function(e,t,n){return n=B.clone(B.IDENTITY,n),e===Jr.Y?n=B.clone(Jr.Y_UP_TO_Z_UP,n):e===Jr.X&&(n=B.clone(Jr.X_UP_TO_Z_UP,n)),t===Jr.Z&&(n=B.multiplyTransformation(n,Jr.Z_UP_TO_X_UP,n)),n};const MGe=new J;$t.getCullFace=function(e,t){if(!Je.isTriangles(t))return Po.BACK;const n=B.getMatrix3(e,MGe);return J.determinant(n)<0?Po.FRONT:Po.BACK};$t.sanitizeGlslIdentifier=function(e){let t=e.replaceAll(/[^A-Za-z0-9]+/g,"_");return t=t.replace(/^gl_/,""),/^\d/.test(t)&&(t=`_${t}`),t};$t.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};$t.checkSupportedExtensions=function(e){const t=e.length;for(let n=0;n<t;n++){const i=e[n];if(!$t.supportedExtensions[i])throw new Se(`Unsupported glTF Extension: ${i}`)}};const Rg={TRANSLATION:"TRANSLATION",ROTATION:"ROTATION",SCALE:"SCALE",FEATURE_ID:"_FEATURE_ID"};Rg.fromGltfSemantic=function(e){b.typeOf.string("gltfSemantic",e);let t=e;const i=/^(\w+)_\d+$/.exec(e);switch(i!==null&&(t=i[1]),t){case"TRANSLATION":return Rg.TRANSLATION;case"ROTATION":return Rg.ROTATION;case"SCALE":return Rg.SCALE;case"_FEATURE_ID":return Rg.FEATURE_ID}};const ks=Object.freeze(Rg),FGe=65534,zGe=255;function nb(e){e=A(e,A.EMPTY_OBJECT);const t=e.triangleIndices,n=e.outlineIndices,i=e.originalVertexCount;b.typeOf.object("options.triangleIndices",t),b.typeOf.object("options.outlineIndices",n),b.typeOf.number("options.originalVertexCount",i),this._triangleIndices=t,this._originalVertexCount=i,this._edges=new vX(n,i),this._outlineCoordinatesTypedArray=void 0,this._extraVertices=[],UGe(this)}Object.defineProperties(nb.prototype,{updatedTriangleIndices:{get:function(){return this._triangleIndices}},outlineCoordinates:{get:function(){return this._outlineCoordinatesTypedArray}}});function UGe(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],f=t[a+2];const h=n.hasEdge(c,u),_=n.hasEdge(u,f),g=n.hasEdge(f,c);let p=T4(i,c,u,f,h,_,g);for(;l(p);){let y=s[p];if(!l(y)){y=r+o.length;let C=p;for(;C>=r;)C=o[C-r];o.push(C),s[p]=y}y>FGe&&(t instanceof Uint16Array||t instanceof Uint8Array)?t=new Uint32Array(t):y>zGe&&t instanceof Uint8Array&&(t=new Uint16Array(t)),p===c?(c=y,t[a]=y):p===u?(u=y,t[a+1]=y):(f=y,t[a+2]=y),p=T4(i,c,u,f,h,_,g)}}e._triangleIndices=t,e._outlineCoordinatesTypedArray=new Float32Array(i)}function T4(e,t,n,i,o,r,s){const a=s?1:0,c=o?1:0,u=0,f=fO(e,t,a,c,u);if(f===0)return t;const h=0,_=o?1:0,g=r?1:0,p=fO(e,n,h,_,g);if(p===0)return n;const y=s?1:0,C=0,T=r?1:0,E=fO(e,i,y,C,T);if(E===0)return i;const w=f&p&E;let S,P,O;if(w&1<<0)S=0,P=1,O=2;else if(w&1<<1)S=0,O=1,P=2;else if(w&1<<2)P=0,S=1,O=2;else if(w&1<<3)P=0,O=1,S=2;else if(w&1<<4)O=0,S=1,P=2;else if(w&1<<5)O=0,P=1,S=2;else{const H=dO(f),v=dO(p),I=dO(E);return H<v&&H<I?t:v<I?n:i}const z=t*3;e[z+S]=a,e[z+P]=c,e[z+O]=u;const R=n*3;e[R+S]=h,e[R+P]=_,e[R+O]=g;const F=i*3;e[F+S]=y,e[F+P]=C,e[F+O]=T}function fO(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 dO(e){return(e&1)+(e>>1&1)+(e>>2&1)+(e>>3&1)+(e>>4&1)+(e>>5&1)}nb.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 f=0;f<i;f++)s[u+f]=s[c+f]}return s};nb.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,wt.maximumTextureSize);let i=n;const o=b4(i),r=[];for(;i>1;)i>>=1,r.push(b4(i));const s=new zt({context:e,source:{arrayBufferView:o,mipLevels:r},width:n,height:1,pixelFormat:nt.LUMINANCE,sampler:new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:An.LINEAR_MIPMAP_LINEAR,magnificationFilter:Hr.LINEAR})});return t.outlineTexture=s,s};function b4(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 vX(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)}}vX.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 DX(e){b.typeOf.object("attribute",e),this.attribute=e,this.loadBuffer=!1,this.loadTypedArray=!1}function HGe(e){b.typeOf.object("indices",e),this.indices=e,this.loadBuffer=!1,this.loadTypedArray=!1}function h0(e){b.typeOf.object("primitive",e),this.primitive=e,this.attributePlans=[],this.indicesPlan=void 0,this.needsOutlines=!1,this.outlineIndices=void 0}h0.prototype.postProcess=function(e){this.needsOutlines&&(VGe(this),GGe(this,e))};function VGe(e){const t=e.primitive,n=t.indices,i=t.attributes[0].count,o=new nb({triangleIndices:n.typedArray,outlineIndices:e.outlineIndices,originalVertexCount:i});n.typedArray=o.updatedTriangleIndices,n.indexDatatype=it.fromTypedArray(n.typedArray);const r=kGe(o.outlineCoordinates),s=new DX(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 f=a[u].attribute;f.typedArray=o.updateAttribute(f.typedArray)}}function kGe(e){const t=new vt.Attribute;return t.name="_OUTLINE_COORDINATES",t.typedArray=e,t.componentDatatype=ee.FLOAT,t.type=ln.VEC3,t.normalized=!1,t.count=e.length/3,t}function GGe(e,t){WGe(e.attributePlans,t),l(e.indicesPlan)&&jGe(e.indicesPlan,t)}function WGe(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=At.createVertexBuffer({typedArray:s,context:t,usage:Ze.STATIC_DRAW});a.vertexArrayDestroyable=!1,r.buffer=a}o.loadTypedArray||(r.typedArray=void 0)}}function jGe(e,t){const n=e.indices;if(e.loadBuffer){const i=At.createIndexBuffer({typedArray:n.typedArray,context:t,usage:Ze.STATIC_DRAW,indexDatatype:n.indexDatatype});n.buffer=i,i.vertexArrayDestroyable=!1}e.loadTypedArray||(n.typedArray=void 0)}h0.AttributeLoadPlan=DX;h0.IndicesLoadPlan=HGe;function qGe(e){e=A(e,A.EMPTY_OBJECT),this.webp=A(e.webp,!1),this.basis=A(e.basis,!1)}const YGe=vt.Attribute,$Ge=vt.Indices,IX=vt.FeatureIdAttribute,PX=vt.FeatureIdTexture,OX=vt.FeatureIdImplicitRange,XGe=vt.MorphTarget,KGe=vt.Primitive,JGe=vt.Instances,QGe=vt.Skin,ZGe=vt.Node,e5e=vt.AnimatedPropertyType,t5e=vt.AnimationSampler,n5e=vt.AnimationTarget,i5e=vt.AnimationChannel,o5e=vt.Animation,r5e=vt.ArticulationStage,s5e=vt.Articulation,a5e=vt.Asset,c5e=vt.Scene,l5e=vt.Components,u5e=vt.MetallicRoughness,f5e=vt.SpecularGlossiness,d5e=vt.Material,co={NOT_LOADED:0,LOADING:1,LOADED:2,PROCESSING:3,POST_PROCESSING:4,PROCESSED:5,READY:6,FAILED:7,UNLOADED:8};function Ul(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,Jr.Y),c=A(e.forwardAxis,Jr.Z),u=A(e.loadAttributesAsTypedArray,!1),f=A(e.loadAttributesFor2D,!1),h=A(e.loadIndicesForWireframe,!1),_=A(e.loadPrimitiveOutline,!0),g=A(e.loadForClassification,!1),p=A(e.renameBatchIdSemantic,!1);b.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=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=_,this._loadForClassification=g,this._renameBatchIdSemantic=p,this._hasKhrMeshQuantization=!1,this._sortedPropertyTableIds=void 0,this._sortedFeatureTextureIds=void 0,this._gltfJsonLoader=void 0,this._state=co.NOT_LOADED,this._textureState=co.NOT_LOADED,this._promise=void 0,this._texturesLoadedPromise=void 0,this._process=function(y,C){},this._processTextures=function(y,C){},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)&&(Ul.prototype=Object.create(ir.prototype),Ul.prototype.constructor=Ul);Object.defineProperties(Ul.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},texturesLoadedPromise:{get:function(){return this._texturesLoadedPromise}}});Ul.prototype.load=function(){const e=mt.loadGltfJson({gltfResource:this._gltfResource,baseResource:this._baseResource,typedArray:this._typedArray,gltfJson:this._gltfJson});this._gltfJsonLoader=e,this._state=co.LOADING,this._textureState=co.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(!un.supportsWebP.initialized){un.supportsWebP.initialize();return}if(c._state===co.LOADED){c._state=co.PROCESSING;const f=new qGe({webp:un.supportsWebP(),basis:u.context.supportsBasis});let h;l(c._gltfJsonLoader)?h=c._gltfJsonLoader.gltf:h=c._gltfJson,c8e(c,h,f,u,r,a),l(c._gltfJsonLoader)&&c._releaseGltfJson&&(mt.unload(c._gltfJsonLoader),c._gltfJsonLoader=void 0)}c._state===co.PROCESSING&&h5e(c,u),c._state===co.POST_PROCESSING&&(p5e(c,u.context),c._state=co.PROCESSED),c._state===co.PROCESSED&&(HX(c),c._typedArray=void 0,c._state=co.READY,o(c))},t._processTextures=function(c,u){if(c._textureState===co.LOADED&&(c._textureState=co.PROCESSING),c._textureState===co.PROCESSING){let f;const h=c._textureLoaders,_=h.length;for(f=0;f<_;++f)h[f].process(u)}c._textureState===co.PROCESSED&&(c._textureState=co.READY,s(c))}})});return this._promise=e.promise.then(function(){if(!t.isDestroyed())return t._state=co.LOADED,t._textureState=co.LOADED,i}).catch(function(o){if(!t.isDestroyed())return t._state=co.FAILED,t._textureState=co.FAILED,E4(t,o)}),this._texturesLoadedPromise=n.catch(function(o){if(!t.isDestroyed())return t._textureState=co.FAILED,E4(t,o)}),this._promise};function E4(e,t){e.unload();const n="Failed to load glTF";return t=e.getError(n,t),Promise.reject(t)}function h5e(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 p5e(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&&m5e(e,r)}}function m5e(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)}Ul.prototype.process=function(e){b.typeOf.object("frameState",e),this._process(this,e),this._processTextures(this,e)};function _5e(e,t,n,i,o,r,s,a){const u=t.accessors[n].bufferView,f=mt.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(f),f}function g5e(e,t,n,i,o,r,s){const a=mt.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 y5e(e,t,n){const i=mt.loadBufferView({gltf:t,bufferViewId:n,gltfResource:e._gltfResource,baseResource:e._baseResource});return e._bufferViewLoaders.push(i),i}function LX(e,t,n){let i=t.byteOffset;const o=d0(e,t),r=t.count,s=KT(t.type),a=t.componentType,c=ee.getSizeInBytes(a),u=c*s,f=r*s;if(o===u)return n=new Uint8Array(n),ee.createArrayBufferView(a,n.buffer,n.byteOffset+i,f);const h=ee.createTypedArray(a,f),_=new DataView(n.buffer),g=new Array(s),p=VM(t.componentType);i=n.byteOffset+i;for(let y=0;y<r;++y){p(_,i,s,c,g);for(let C=0;C<s;++C)h[y*s+C]=g[C];i+=o}return h}function A5e(e,t){const n=e.type;if(n===ln.SCALAR)return t.fill(0);const i=ln.getMathType(n);return t.fill(i.clone(i.ZERO))}function C5e(e,t,n,i){const o=e.type,r=e.count;if(o===ln.SCALAR)for(let s=0;s<r;s++)n[s]=t[s];else if(o===ln.VEC4&&i)for(let s=0;s<r;s++)n[s]=Ce.unpack(t,s*4);else{const s=ln.getMathType(o),a=ln.getNumberOfComponents(o);for(let c=0;c<r;c++)n[c]=s.unpack(t,c*a)}return n}function LS(e,t,n,i){const o=t.accessors[n],r=o.count,s=new Array(r),a=o.bufferView;if(l(a)){const u=y5e(e,t,a).promise.then(function(f){if(e.isDestroyed())return;const h=f.typedArray,_=LX(t,o,h);i=A(i,!1),C5e(o,_,s,i)});return e._loaderPromises.push(u),s}return A5e(o,s)}function Gc(e,t){if(l(t))return e===Number?t[0]:e.unpack(t)}function T5e(e){return e===Number?0:new e}function b5e(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 E5e={VEC2:new j(-1,-1),VEC3:new d(-1,-1,-1),VEC4:new oe(-1,-1,-1,-1)};function x5e(e,t){const n=b5e(e.componentDatatype),i=E5e[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 w5e(e,t,n){const i=e.decodeMatrix,o=Gc(n,e.decodedMin),r=Gc(n,e.decodedMax);l(o)&&l(r)&&(t.min=o,t.max=r);const s=new vt.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 d(i[12],i[13],i[14]),s.quantizedVolumeStepSize=new d(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 S5e(e,t,n,i,o,r){const s=e.accessors[t],a=ln.getMathType(s.type),c=A(s.normalized,!1),u=new YGe;u.name=n,u.semantic=i,u.setIndex=o,u.constant=T5e(a),u.componentDatatype=s.componentType,u.normalized=c,u.count=s.count,u.type=s.type,u.min=Gc(a,s.min),u.max=Gc(a,s.max),u.byteOffset=s.byteOffset,u.byteStride=d0(e,s),tr(s,"WEB3D_quantized_attributes")&&w5e(s.extensions.WEB3D_quantized_attributes,u,a);const f=u.semantic===bt.POSITION||u.semantic===bt.NORMAL||u.semantic===bt.TANGENT||u.semantic===bt.TEXCOORD;return r&&c&&f&&x5e(u,a),u}function BX(e){const n=/^\w+_(\d+)$/.exec(e);if(n!==null)return parseInt(n[1])}const v5e={gltfSemantic:void 0,renamedSemantic:void 0,modelSemantic:void 0};function $M(e,t,n){let i=n;e._renameBatchIdSemantic&&(n==="_BATCHID"||n==="BATCHID")&&(i="_FEATURE_ID_0");const o=t.fromGltfSemantic(i),r=v5e;return r.gltfSemantic=n,r.renamedSemantic=i,r.modelSemantic=o,r}function D5e(e){const t=e===bt.POSITION,n=e===bt.FEATURE_ID,i=e===bt.TEXCOORD;return t||n||i}function I5e(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 P5e(e,t,n,i,o,r){if(o&&(n.buffer=i.buffer),r){const s=i.typedArray;n.typedArray=LX(e,t,s),o||(n.byteOffset=0,n.byteStride=void 0)}}function RX(e,t,n,i,o,r,s,a){const c=t.accessors[n],u=c.bufferView,f=i.gltfSemantic,h=i.renamedSemantic,_=i.modelSemantic,g=l(_)?BX(h):void 0,y=S5e(t,n,f,_,g,e._hasKhrMeshQuantization);if(!l(o)&&!l(u))return y;const T=_5e(e,t,n,f,o,r,s,a).promise.then(function(E){e.isDestroyed()||(l(o)&&l(o.attributes)&&l(o.attributes[f])?I5e(y,E,r,s):P5e(t,c,y,E,r,s))});return e._loaderPromises.push(T),y}function NX(e,t,n,i,o,r,s,a){const c=i.modelSemantic,u=c===bt.POSITION,f=c===bt.FEATURE_ID,h=u&&!r&&e._loadAttributesFor2D&&!a.scene3DOnly,_=e._loadForClassification&&f,g=e._loadAttributesAsTypedArray,p=!g,y=g||h||_,E=RX(e,t,n,i,o,s?!1:p,s?!0:y,a),w=new h0.AttributeLoadPlan(E);return w.loadBuffer=p,w.loadTypedArray=y,w}function O5e(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=$M(e,ks,o),u=c.modelSemantic,f=u===ks.TRANSLATION||u===ks.ROTATION||u===ks.SCALE,h=u===ks.TRANSLATION,_=e._loadAttributesAsTypedArray||s&&f||!r.context.instancedArrays,g=!_,p=e._loadAttributesFor2D&&!r.scene3DOnly;return RX(e,t,n,c,void 0,g,_||h&&(!a||p),r)}function L5e(e,t,n,i,o,r,s){const a=t.accessors[n],c=a.bufferView;if(!l(i)&&!l(c))return;const u=new $Ge;u.count=a.count;const f=e._loadAttributesAsTypedArray,h=e._loadIndicesForWireframe&&!s.context.webgl2,_=e._loadForClassification&&o,p=!f,y=f||h||_,w=g5e(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 h0.IndicesLoadPlan(u);return S.loadBuffer=p,S.loadTypedArray=y,S}function Rf(e,t,n,i,o,r){const s=r_.getImageIdFromTexture({gltf:t,textureId:n.index,supportedImageFormats:i});if(!l(s))return;const a=mt.loadTexture({gltf:t,textureInfo:n,gltfResource:e._gltfResource,baseResource:e._baseResource,supportedImageFormats:i,frameState:o,asynchronous:e._asynchronous});e._textureLoaders.push(a);const c=r_.createModelTextureReader({textureInfo:n}),u=a.promise.then(function(f){e.isUnloaded()||e.isDestroyed()||(c.texture=f.texture,l(r)&&(c.texture.sampler=r))});return e._texturesPromises.push(u),c}function B5e(e,t,n,i,o){const r=new d5e,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 f5e;r.specularGlossiness=u,l(a.diffuseTexture)&&(u.diffuseTexture=Rf(e,t,a.diffuseTexture,i,o)),l(a.specularGlossinessTexture)&&l(a.specularGlossinessTexture)&&(u.specularGlossinessTexture=Rf(e,t,a.specularGlossinessTexture,i,o)),u.diffuseFactor=Gc(oe,a.diffuseFactor),u.specularFactor=Gc(d,a.specularFactor),u.glossinessFactor=a.glossinessFactor,r.pbrSpecularGlossiness=a}else if(l(c)){const u=new u5e;l(c.baseColorTexture)&&(u.baseColorTexture=Rf(e,t,c.baseColorTexture,i,o)),l(c.metallicRoughnessTexture)&&(u.metallicRoughnessTexture=Rf(e,t,c.metallicRoughnessTexture,i,o)),u.baseColorFactor=Gc(oe,c.baseColorFactor),u.metallicFactor=c.metallicFactor,u.roughnessFactor=c.roughnessFactor,r.metallicRoughness=u}return l(n.emissiveTexture)&&(r.emissiveTexture=Rf(e,t,n.emissiveTexture,i,o)),l(n.normalTexture)&&!e._loadForClassification&&(r.normalTexture=Rf(e,t,n.normalTexture,i,o)),l(n.occlusionTexture)&&(r.occlusionTexture=Rf(e,t,n.occlusionTexture,i,o)),r.emissiveFactor=Gc(d,n.emissiveFactor),r.alphaMode=n.alphaMode,r.alphaCutoff=n.alphaCutoff,r.doubleSided=n.doubleSided,r}function MX(e,t){const n=new IX;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 FX(e,t,n,i){const o=new IX,r=e.featureIds;return o.featureCount=n,o.propertyTableId=t,o.setIndex=BX(r.attribute),o.positionalLabel=i,o}function zX(e,t){const n=new OX;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 UX(e,t,n,i){const o=new OX,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 R5e(e,t,n,i,o,r){const s=new PX;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=Rf(e,t,a,i,o,Yn.NEAREST);const u=(l(a.channels)?a.channels:[0]).map(function(f){return"rgba".charAt(f)}).join("");return s.textureReader.channels=u,s}function N5e(e,t,n,i,o,r,s,a){const c=new PX,u=n.featureIds,f=u.texture;return c.featureCount=s,c.propertyTableId=i,c.textureReader=Rf(e,t,f,o,r,Yn.NEAREST),c.textureReader.channels=u.channels,c.positionalLabel=a,c}function M5e(e,t,n,i,o,r){const s=new XGe,a=void 0,c=!1;for(const u in n)if(n.hasOwnProperty(u)){const f=n[u],h=$M(e,bt,u),_=NX(e,t,f,h,a,c,i,r);s.attributes.push(_.attribute),o.attributePlans.push(_)}return s}function F5e(e,t,n,i,o,r){const s=new KGe,a=new h0(s);e._primitiveLoadPlans.push(a);const c=n.material;l(c)&&(s.material=B5e(e,t,t.materials[c],o,r));const u=A(n.extensions,A.EMPTY_OBJECT);let f=!1;const h=u.CESIUM_primitive_outline;e._loadPrimitiveOutline&&l(h)&&(f=!0,a.needsOutlines=!0,a.outlineIndices=z5e(e,t,h));const _=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=$M(e,bt,z),H=F.modelSemantic;if(_&&!D5e(H))continue;H===bt.FEATURE_ID&&(p=!0);const v=NX(e,t,R,F,g,i,f,r);a.attributePlans.push(v),s.attributes.push(v.attribute)}}const C=n.targets;if(l(C)&&!_){const z=C.length;for(let R=0;R<z;++R)s.morphTargets.push(M5e(e,t,C[R],f,a,r))}const T=n.indices;if(l(T)){const z=L5e(e,t,T,g,p,f,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)?U5e(e,t,s,w,o,r):P&&H5e(e,t,s,S,o,r),l(E)?V5e(s,E):P&&k5e(e,s,S);const O=n.mode;if(_&&O!==Je.TRIANGLES)throw new Se("Only triangle meshes can be used for classification.");return s.primitiveType=O,s}function z5e(e,t,n){const i=n.indices;return LS(e,t,i,!1)}function U5e(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 f;l(c.texture)?f=R5e(e,t,c,o,r,u):l(c.attribute)?f=MX(c,u):f=zX(c,u),n.featureIds.push(f)}}function H5e(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 f=c.length;for(let h=0;h<f;++h){const _=c[h],g=_.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,C=`featureId_${a}`;a++;let T;l(_.featureIds.attribute)?T=FX(_,p,y,C):T=UX(_,p,y,C),n.featureIds.push(T)}}const u=i.featureIdTextures;if(l(u)){const f=u.length;for(let h=0;h<f;++h){const _=u[h],g=_.featureTable,p=e._sortedPropertyTableIds.indexOf(g),y=s[g].count,C=`featureId_${a}`;a++;const T=N5e(e,t,_,p,o,r,y,C);n.featureIds.push(T)}}}function V5e(e,t){l(t)&&(l(t.propertyTextures)&&(e.propertyTextureIds=t.propertyTextures),l(t.propertyAttributes)&&(e.propertyAttributeIds=t.propertyAttributes))}function k5e(e,t,n){l(n.featureTextures)&&(t.propertyTextureIds=n.featureTextures.map(function(i){return e._sortedFeatureTextureIds.indexOf(i)}))}function G5e(e,t,n,i){const o=n.EXT_mesh_gpu_instancing,r=new JGe,s=o.attributes;if(l(s)){for(const f in s)if(s.hasOwnProperty(f)){const h=s[f];r.attributes.push(O5e(e,t,h,s,f,i))}}const a=A(o.extensions,A.EMPTY_OBJECT),c=n.EXT_instance_features,u=a.EXT_feature_metadata;return l(c)?W5e(r,c):l(u)&&j5e(t,r,u,e._sortedPropertyTableIds),r}function W5e(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=MX(o,r):s=zX(o,r),e.featureIds.push(s)}}function j5e(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,f=i.indexOf(u),h=o[u].count,_=`instanceFeatureId_${a}`;let g;l(c.featureIds.attribute)?g=FX(c,f,h,_):g=UX(c,f,h,_),t.featureIds.push(g)}}}function q5e(e,t,n,i,o){const r=new ZGe;r.name=n.name,r.matrix=Gc(B,n.matrix),r.translation=Gc(d,n.translation),r.rotation=Gc(Ce,n.rotation),r.scale=Gc(d,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 Se("Models with the EXT_mesh_gpu_instancing extension cannot be used for classification.");r.instances=G5e(e,t,s,o)}l(c)&&(r.articulationName=c.articulationName);const u=n.mesh;if(l(u)){const f=t.meshes[u],h=f.primitives,_=h.length;for(let C=0;C<_;++C)r.primitives.push(F5e(e,t,h[C],l(r.instances),i,o));const g=A(n.weights,f.weights),y=r.primitives[0].morphTargets.length;r.morphWeights=l(g)?g.slice():new Array(y).fill(0)}return r}function Y5e(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=q5e(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 $5e(e,t,n,i){const o=new QGe,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=LS(e,t,c):o.inverseBindMatrices=new Array(s).fill(B.IDENTITY),o}function X5e(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=$5e(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 K5e(e,t,n,i,o,r){const s=new $h({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 J5e(e,t,n){const i=new t5e,o=n.input;i.input=LS(e,t,o);const r=n.interpolation;i.interpolation=A(fy[r],fy.LINEAR);const s=n.output;return i.output=LS(e,t,s,!0),i}function Q5e(e,t){const n=new n5e,i=e.node;if(!l(i))return;n.node=t[i];const o=e.path.toUpperCase();return n.path=e5e[o],n}function Z5e(e,t,n){const i=new i5e,o=e.sampler;return i.sampler=t[o],i.target=Q5e(e.target,n),i}function e8e(e,t,n,i){let o;const r=new o5e;r.name=n.name;const s=n.samplers,a=s.length,c=new Array(a);for(o=0;o<a;o++){const _=J5e(e,t,s[o]);_.index=o,c[o]=_}const u=n.channels,f=u.length,h=new Array(f);for(o=0;o<f;o++)h[o]=Z5e(u[o],c,i);return r.samplers=c,r.channels=h,r}function t8e(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=e8e(e,t,t.animations[s],n);a.index=s,r[s]=a}return r}function n8e(e){const t=new r5e;t.name=e.name;const n=e.type.toUpperCase();return t.type=El[n],t.minimumValue=e.minimumValue,t.maximumValue=e.maximumValue,t.initialValue=e.initialValue,t}function i8e(e){const t=new s5e;t.name=e.name;const n=e.stages,i=n.length,o=new Array(i);for(let r=0;r<i;r++){const s=n8e(n[r]);o[r]=s}return t.stages=o,t}function o8e(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=i8e(i[s]);r[s]=a}return r}function r8e(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 s8e(e,t){const n=new c5e,i=r8e(e);return n.nodes=i.map(function(o){return t[o]}),n}const a8e=new d;function c8e(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 Se(`Failed to load ${P}:
Unsupported glTF version: ${s}`)}const a=t.extensionsRequired;l(a)&&($t.checkSupportedExtensions(a),e._hasKhrMeshQuantization=a.includes("KHR_mesh_quantization"));const c=A(t.extensions,A.EMPTY_OBJECT),u=c.EXT_structural_metadata,f=c.EXT_feature_metadata,h=c.CESIUM_RTC;if(l(f)){const P=f.featureTables,O=f.featureTextures,z=l(P)?P:[],R=l(O)?O:[];e._sortedPropertyTableIds=Object.keys(z).sort(),e._sortedFeatureTextureIds=Object.keys(R).sort()}const _=Y5e(e,t,n,i),g=X5e(e,t,_),p=t8e(e,t,_),y=o8e(t),C=s8e(t,_),T=new l5e,E=new a5e,w=t.asset.copyright;if(l(w)){const P=w.split(";").map(function(O){return new Kn(O.trim())});E.credits=P}if(T.asset=E,T.scene=C,T.nodes=_,T.skins=g,T.animations=p,T.articulations=y,T.upAxis=e._upAxis,T.forwardAxis=e._forwardAxis,l(h)){const P=d.fromArray(h.center,0,a8e);T.transform=B.fromTranslation(P,T.transform)}if(e._components=T,l(u)||l(f)){const O=K5e(e,t,u,f,n,i).promise.then(function(z){e.isDestroyed()||(T.structuralMetadata=z.structuralMetadata)});e._loaderPromises.push(O)}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=co.POST_PROCESSING)}).catch(o),Promise.all(e._texturesPromises).then(function(){e.isDestroyed()||(e._textureState=co.PROCESSED)}).catch(r)}function l8e(e){const t=e._textureLoaders,n=t.length;for(let i=0;i<n;++i)mt.unload(t[i]);e._textureLoaders.length=0}function HX(e){const t=e._bufferViewLoaders,n=t.length;for(let i=0;i<n;++i)mt.unload(t[i]);e._bufferViewLoaders.length=0}function u8e(e){const t=e._geometryLoaders,n=t.length;for(let i=0;i<n;++i)mt.unload(t[i]);e._geometryLoaders.length=0}function f8e(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 d8e(e){l(e._structuralMetadataLoader)&&(e._structuralMetadataLoader.destroy(),e._structuralMetadataLoader=void 0)}Ul.prototype.isUnloaded=function(){return this._state===co.UNLOADED};Ul.prototype.unload=function(){l(this._gltfJsonLoader)&&mt.unload(this._gltfJsonLoader),this._gltfJsonLoader=void 0,l8e(this),HX(this),u8e(this),f8e(this),d8e(this),this._components=void 0,this._typedArray=void 0,this._state=co.UNLOADED};const h8e=`#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 Op(){this._framebuffer=new En({colorAttachmentsLength:2,depth:!0,supportsDepthTexture:!0}),this._drawCommand=void 0,this._clearCommand=void 0,this._strength=1,this._radius=1}Object.defineProperties(Op.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 p8e(e){e._framebuffer.destroy(),e._drawCommand=void 0,e._clearCommand=void 0}const hO=new j;function m8e(e,t){const n=new Ge({defines:["LOG_DEPTH_WRITE"],sources:[h8e]}),i={u_pointCloud_colorGBuffer:function(){return e.colorGBuffer},u_pointCloud_depthGBuffer:function(){return e.depthGBuffer},u_distanceAndEdlStrength:function(){return hO.x=e._radius,hO.y=e._strength,hO}},o=Qe.fromCache({blending:Ii.ALPHA_BLEND,depthMask:!0,depthTest:{enabled:!0},stencilTest:Pt.setCesium3DTileBit(),stencilMask:Pt.CESIUM_3D_TILE_MASK});e._drawCommand=t.createViewportQuadCommand(n,{uniformMap:i,renderState:o,pass:Be.CESIUM_3D_TILE,owner:e}),e._clearCommand=new Ji({framebuffer:e.framebuffer,color:new U(0,0,0,0),depth:1,renderState:Qe.fromCache(),pass:Be.CESIUM_3D_TILE,owner:e})}function _8e(e,t){const n=t.drawingBufferWidth,i=t.drawingBufferHeight;e._framebuffer.update(t,n,i),m8e(e,t)}function VX(e){return e.drawBuffers&&e.fragmentDepth}Op.isSupported=VX;function g8e(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=Ge.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}Op.prototype.update=function(e,t,n,i){if(!VX(e.context))return;this._strength=n.eyeDomeLightingStrength,this._radius=n.eyeDomeLightingRadius*e.pixelRatio,_8e(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!==Je.POINTS||u.pass===Be.TRANSLUCENT)continue;let f,h,_=u.derivedCommands.pointCloudProcessor;l(_)&&(f=_.command,h=_.originalShaderProgram),(!l(f)||u.dirty||h!==u.shaderProgram||f.framebuffer!==this.framebuffer)&&(f=dt.shallowClone(u,f),f.framebuffer=this.framebuffer,f.shaderProgram=g8e(e.context,u.shaderProgram),f.castShadows=!1,f.receiveShadows=!1,l(_)||(_={command:f,originalShaderProgram:u.shaderProgram},u.derivedCommands.pointCloudProcessor=_),_.originalShaderProgram=u.shaderProgram),r[o]=f}const a=this._clearCommand,c=this._drawCommand;c.boundingVolume=i,r.push(c),r.push(a)};Op.prototype.isDestroyed=function(){return!1};Op.prototype.destroy=function(){return p8e(this),Ue(this)};function ib(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)}ib.isSupported=function(e){return Op.isSupported(e.context)};const Qg={};Qg._deprecationWarning=Tp;const Pf=Uint32Array.BYTES_PER_ELEMENT;Qg.parse=function(e,t){const n=A(t,0);b.defined("arrayBuffer",e),t=n;const i=new Uint8Array(e),o=new DataView(e);t+=Pf;const r=o.getUint32(t,!0);if(r!==1)throw new Se(`Only Batched 3D Model version 1 is supported. Version ${r} is not.`);t+=Pf;const s=o.getUint32(t,!0);t+=Pf;let a=o.getUint32(t,!0);t+=Pf;let c=o.getUint32(t,!0);t+=Pf;let u=o.getUint32(t,!0);t+=Pf;let f=o.getUint32(t,!0);t+=Pf;let h;u>=570425344?(t-=Pf*2,h=a,u=c,f=0,a=0,c=0,Qg._deprecationWarning("b3dm-legacy-header","This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel.")):f>=570425344&&(t-=Pf,h=u,u=a,f=c,a=0,c=0,Qg._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 _;a===0?_={BATCH_LENGTH:A(h,0)}:(_=Fa(i,t,a),t+=a);const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=Fa(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));const C=n+s-t;if(C===0)throw new Se("glTF byte length must be greater than 0.");let T;return t%4===0?T=new Uint8Array(e,t,C):(Qg._deprecationWarning("b3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),T=new Uint8Array(i.subarray(t,t+C))),{batchLength:h,featureTableJson:_,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:T}};const y8e=Qg;function Lp(e,t){this.json=e,this.buffer=t,this._cachedTypedArrays={},this.featuresLength=0}function kX(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 A8e(e,t,n,i){const o=e._cachedTypedArrays;let r=o[t];return l(r)||(r=ee.createTypedArray(n,i),o[t]=r),r}Lp.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),kX(this,e,t,n,1,i.byteOffset)):i};Lp.prototype.hasProperty=function(e){return l(this.json[e])};Lp.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)),kX(this,e,t,n,this.featuresLength,i.byteOffset)):A8e(this,e,t,i)};Lp.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 U_(e){b.typeOf.number("options.count",e.count),b.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=C8e(n);let a;l(s.jsonProperties)&&(a=new z_({count:t,properties:s.jsonProperties}));let c;l(s.hierarchy)&&(c=new df({extension:s.hierarchy,binaryBody:i}));const u=up.BATCH_TABLE_CLASS_NAME,f=s.binaryProperties;let h,_,g;if(o){const C=b8e(t,u,f,i,r);g=C.transcodedSchema,_=[new rD({propertyAttribute:C.propertyAttributeJson,class:C.transcodedClass})]}else{const C=T8e(t,u,f,i);g=C.transcodedSchema;const T=C.featureTableJson;h=new wa({count:T.count,properties:T.properties,class:C.transcodedClass,bufferViews:C.bufferViewsTypedArrays}),_=[]}const p=[];if(l(h)||l(a)||l(c)){const C=new dr({id:0,name:"Batch Table",count:t,metadataTable:h,jsonMetadataTable:a,batchTableHierarchy:c});p.push(C)}const y={schema:g,propertyTables:p,propertyAttributes:_,extensions:s.extensions,extras:s.extras};return new lu(y)}function C8e(e){const t=e.HIERARCHY,n=e.extras,i=e.extensions;let o;l(t)?(U_._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 T8e(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 Se(`Property ${h} requires a batch table binary.`);const _=n[h],g=Um(_);r[h]={bufferView:a},o[h]=GX(_),s[a]=g.createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e),a++}const c={classes:{}};c.classes[t]={properties:o};const u=fp.fromJson(c);return{featureTableJson:{class:t,count:e,properties:r},bufferViewsTypedArrays:s,transcodedSchema:u,transcodedClass:u.classes[t]}}function b8e(e,t,n,i,o){const r={},s={};let a=0;for(const h in n){if(!n.hasOwnProperty(h))continue;const _=n[h];if(!l(i)&&!l(_.typedArray))throw new Se(`Property ${h} requires a batch table binary.`);let g=$t.sanitizeGlslIdentifier(h);(g===""||r.hasOwnProperty(g))&&(g=`property_${a}`,a++);const p=GX(_);p.name=h,r[g]=p;let y=g.toUpperCase();y.startsWith("_")||(y=`_${y}`);let C=_.typedArray;l(C)||(C=Um(_).createArrayBufferView(i.buffer,i.byteOffset+_.byteOffset,e));const T=new vt.Attribute;T.name=y,T.count=e,T.type=_.type;const E=ee.fromTypedArray(C);(E===ee.INT||E===ee.UNSIGNED_INT||E===ee.DOUBLE)&&(U_._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.`),C=new Float32Array(C)),T.componentDatatype=ee.fromTypedArray(C),T.typedArray=C,o.push(T),s[g]={attribute:y}}const c={classes:{}};c.classes[t]={properties:r};const u=fp.fromJson(c);return{class:t,propertyAttributeJson:{properties:s},transcodedSchema:u,transcodedClass:u.classes[t]}}function GX(e){const t=E8e(e.componentType);return{type:e.type,componentType:t}}function E8e(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"}}U_._deprecationWarning=Tp;U_._oneTimeWarning=Di;const Gm={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,FAILED:4},x8e=vt.FeatureIdAttribute;function Xh(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,Jr.Y),u=A(e.forwardAxis,Jr.X),f=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadAttributesFor2D,!1),_=A(e.loadIndicesForWireframe,!1),g=A(e.loadPrimitiveOutline,!0),p=A(e.loadForClassification,!1);b.typeOf.object("options.b3dmResource",t),b.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=f,this._loadAttributesFor2D=h,this._loadIndicesForWireframe=_,this._loadPrimitiveOutline=g,this._loadForClassification=p,this._state=Gm.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)&&(Xh.prototype=Object.create(ir.prototype),Xh.prototype.constructor=Xh);Object.defineProperties(Xh.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Xh.prototype.load=function(){const e=y8e.parse(this._arrayBuffer,this._byteOffset);let t=e.batchLength;const n=e.featureTableJson,i=e.featureTableBinary,o=e.batchTableJson,r=e.batchTableBinary,s=new Lp(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(d.fromArray(a))),this._batchTable={json:o,binary:r};const c=new Ul({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=Gm.LOADING;const u=this;return c.load(),this._promise=c.promise.then(function(){if(u.isDestroyed())return;const f=c.components;return f.transform=B.multiplyTransformation(u._transform,f.transform,f.transform),S8e(u,f),u._components=f,u._arrayBuffer=void 0,u._state=Gm.READY,u}).catch(function(f){if(!u.isDestroyed())return w8e(u,f)}),this._promise};function w8e(e,t){e.unload(),e._state=Gm.FAILED;const n="Failed to load b3dm";return t=e.getError(n,t),Promise.reject(t)}Xh.prototype.process=function(e){b.typeOf.object("frameState",e),this._state===Gm.LOADING&&(this._state=Gm.PROCESSING),this._state===Gm.PROCESSING&&this._gltfLoader.process(e)};function S8e(e,t){const n=e._batchTable,i=e._batchLength;if(i===0)return;let o;if(l(n.json))o=U_({count:i,batchTable:n.json,binaryBody:n.binary});else{const a=new dr({name:up.BATCH_TABLE_CLASS_NAME,count:i});o=new lu({schema:{},propertyTables:[a]})}const r=t.scene.nodes,s=r.length;for(let a=0;a<s;a++)WX(r[a]);t.structuralMetadata=o}function WX(e){const t=e.children.length;for(let i=0;i<t;i++)WX(e.children[i]);const n=e.primitives.length;for(let i=0;i<n;i++){const o=e.primitives[i],r=$t.getAttributeBySemantic(o,bt.FEATURE_ID);if(l(r)){r.setIndex=0;const s=new x8e;s.propertyTableId=0,s.setIndex=0,s.positionalLabel="featureId_0",o.featureIds.push(s)}}}Xh.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),this._components=void 0,this._arrayBuffer=void 0};function Kh(e){e=A(e,A.EMPTY_OBJECT),b.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)&&(Kh.prototype=Object.create(ir.prototype),Kh.prototype.constructor=Kh);Object.defineProperties(Kh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});Kh.prototype.load=function(){const e=this,t=new Promise(function(n){e._process=function(i,o){l(i._components)||(i._components=U8e(i._geoJson,o),i._geoJson=void 0,n(i))}});return this._promise=t,t};Kh.prototype.process=function(e){b.typeOf.object("frameState",e),this._process(this,e)};function v8e(){this.lines=void 0,this.points=void 0,this.properties=void 0}function D8e(){this.features=[]}function XM(e){const t=e[0],n=e[1],i=A(e[2],0);return new d(t,n,i)}function KM(e){const t=e.length,n=new Array(t);for(let o=0;o<t;o++)n[o]=XM(e[o]);return[n]}function I8e(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=KM(e[i])[0];return n}function jX(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=KM(e[i])[0];return n}function P8e(e){const t=e.length,n=[];for(let i=0;i<t;i++)Array.prototype.push.apply(n,jX(e[i]));return n}function O8e(e){return[XM(e)]}function L8e(e){const t=e.length,n=new Array(t);for(let i=0;i<t;i++)n[i]=XM(e[i]);return n}const B8e={LineString:KM,MultiLineString:I8e,MultiPolygon:P8e,Polygon:jX,MultiPoint:L8e,Point:O8e},R8e={LineString:Je.LINES,MultiLineString:Je.LINES,MultiPolygon:Je.LINES,Polygon:Je.LINES,MultiPoint:Je.POINTS,Point:Je.POINTS};function qX(e,t){if(!l(e.geometry))return;const n=e.geometry.type,i=B8e[n],o=R8e[n],r=e.geometry.coordinates;if(!l(i)||!l(r))return;const s=new v8e;o===Je.LINES?s.lines=i(r):o===Je.POINTS&&(s.points=i(r)),s.properties=e.properties,t.features.push(s)}function N8e(e,t){const n=e.features,i=n.length;for(let o=0;o<i;o++)qX(n[o],t)}const M8e={FeatureCollection:N8e,Feature:qX},BS=new d;function F8e(e,t,n){let i=0,o=0;const r=e.length;for(let F=0;F<r;F++){const H=e[F];if(l(H.lines)){const v=H.lines.length;for(let I=0;I<v;I++){const m=H.lines[I];i+=m.length,o+=(m.length-1)*2}}}const s=new Float32Array(i*3),a=new Float32Array(i),c=it.createTypedArray(i,o),u=it.fromTypedArray(c),f=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let _=0,g=0;for(let F=0;F<r;F++){const H=e[F];if(!l(H.lines))continue;const v=H.lines.length;for(let I=0;I<v;I++){const m=H.lines[I],D=m.length;for(let L=0;L<D;L++){const M=m[L],V=d.fromDegrees(M.x,M.y,M.z,pe.WGS84,BS),k=B.multiplyByPoint(t,V,BS);d.minimumByComponent(f,k,f),d.maximumByComponent(h,k,h),d.pack(k,s,_*3),a[_]=F,L<D-1&&(c[g*2]=_,c[g*2+1]=_+1,g++),_++}}}const p=At.createVertexBuffer({typedArray:s,context:n.context,usage:Ze.STATIC_DRAW});p.vertexArrayDestroyable=!1;const y=At.createVertexBuffer({typedArray:a,context:n.context,usage:Ze.STATIC_DRAW});y.vertexArrayDestroyable=!1;const C=At.createIndexBuffer({typedArray:c,context:n.context,usage:Ze.STATIC_DRAW,indexDatatype:u});C.vertexArrayDestroyable=!1;const T=new vt.Attribute;T.semantic=bt.POSITION,T.componentDatatype=ee.FLOAT,T.type=ln.VEC3,T.count=i,T.min=f,T.max=h,T.buffer=p;const E=new vt.Attribute;E.semantic=bt.FEATURE_ID,E.setIndex=0,E.componentDatatype=ee.FLOAT,E.type=ln.SCALAR,E.count=i,E.buffer=y;const w=[T,E],S=new vt.Material;S.unlit=!0;const P=new vt.Indices;P.indexDatatype=u,P.count=c.length,P.buffer=C;const O=new vt.FeatureIdAttribute;O.featureCount=r,O.propertyTableId=0,O.setIndex=0,O.positionalLabel="featureId_0";const z=[O],R=new vt.Primitive;return R.attributes=w,R.indices=P,R.featureIds=z,R.primitiveType=Je.LINES,R.material=S,R}function z8e(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 d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),c=new d(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 O=0;O<P;O++){const z=S.points[O],R=d.fromDegrees(z.x,z.y,z.z,pe.WGS84,BS),F=B.multiplyByPoint(t,R,BS);d.minimumByComponent(a,F,a),d.maximumByComponent(c,F,c),d.pack(F,r,u*3),s[u]=w,u++}}const f=At.createVertexBuffer({typedArray:r,context:n.context,usage:Ze.STATIC_DRAW});f.vertexArrayDestroyable=!1;const h=At.createVertexBuffer({typedArray:s,context:n.context,usage:Ze.STATIC_DRAW});h.vertexArrayDestroyable=!1;const _=new vt.Attribute;_.semantic=bt.POSITION,_.componentDatatype=ee.FLOAT,_.type=ln.VEC3,_.count=i,_.min=a,_.max=c,_.buffer=f;const g=new vt.Attribute;g.semantic=bt.FEATURE_ID,g.setIndex=0,g.componentDatatype=ee.FLOAT,g.type=ln.SCALAR,g.count=i,g.buffer=h;const p=[_,g],y=new vt.Material;y.unlit=!0;const C=new vt.FeatureIdAttribute;C.featureCount=o,C.propertyTableId=0,C.setIndex=0,C.positionalLabel="featureId_0";const T=[C],E=new vt.Primitive;return E.attributes=p,E.featureIds=T,E.primitiveType=Je.POINTS,E.material=y,E}function U8e(e,t){const n=new D8e,i=M8e[e.type];l(i)&&i(e,n);const o=n.features,r=o.length;if(r===0)throw new Se("GeoJSON must have at least one feature");const s={};for(let F=0;F<r;F++){const H=o[F],v=A(H.properties,A.EMPTY_OBJECT);for(const I in v)v.hasOwnProperty(I)&&(l(s[I])||(s[I]=new Array(r)))}for(let F=0;F<r;F++){const H=o[F];for(const v in s)if(s.hasOwnProperty(v)){const I=A(H.properties[v],"");s[v][F]=I}}const a=new z_({count:r,properties:s}),u=[new dr({id:0,count:r,jsonMetadataTable:a})],f=fp.fromJson({}),h=new lu({schema:f,propertyTables:u}),_=new d(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),g=new d(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);let p=!1,y=!1;for(let F=0;F<r;F++){const H=o[F];if(l(H.lines)){p=!0;const v=H.lines.length;for(let I=0;I<v;I++){const m=H.lines[I],D=m.length;for(let L=0;L<D;L++)d.minimumByComponent(_,m[L],_),d.maximumByComponent(g,m[L],g)}}if(l(H.points)){y=!0;const v=H.points.length;for(let I=0;I<v;I++){const m=H.points[I];d.minimumByComponent(_,m,_),d.maximumByComponent(g,m,g)}}}const C=d.midpoint(_,g,new d),T=d.fromDegrees(C.x,C.y,C.z,pe.WGS84,new d),E=tn.eastNorthUpToFixedFrame(T,pe.WGS84,new B),w=B.inverseTransformation(E,new B),S=[];p&&S.push(F8e(o,w,t)),y&&S.push(z8e(o,w,t));const P=new vt.Node;P.index=0,P.primitives=S;const O=[P],z=new vt.Scene;z.nodes=O;const R=new vt.Components;return R.scene=z,R.nodes=O,R.transform=E,R.structuralMetadata=h,R}Kh.prototype.unload=function(){this._components=void 0};const RS={};RS._deprecationWarning=Tp;const sh=Uint32Array.BYTES_PER_ELEMENT;RS.parse=function(e,t){b.defined("arrayBuffer",e);const n=A(t,0);t=n;const i=new Uint8Array(e),o=new DataView(e);t+=sh;const r=o.getUint32(t,!0);if(r!==1)throw new Se(`Only Instanced 3D Model version 1 is supported. Version ${r} is not.`);t+=sh;const s=o.getUint32(t,!0);t+=sh;const a=o.getUint32(t,!0);if(a===0)throw new Se("featureTableJsonByteLength is zero, the feature table must be defined.");t+=sh;const c=o.getUint32(t,!0);t+=sh;const u=o.getUint32(t,!0);t+=sh;const f=o.getUint32(t,!0);t+=sh;const h=o.getUint32(t,!0);if(h!==1&&h!==0)throw new Se(`Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${h} is not.`);t+=sh;const _=Fa(i,t,a);t+=a;const g=new Uint8Array(e,t,c);t+=c;let p,y;u>0&&(p=Fa(i,t,u),t+=u,f>0&&(y=new Uint8Array(e,t,f),y=new Uint8Array(y),t+=f));const C=n+s-t;if(C===0)throw new Se("glTF byte length must be greater than 0.");let T;return t%4===0?T=new Uint8Array(e,t,C):(RS._deprecationWarning("i3dm-glb-unaligned","The embedded glb is not aligned to a 4-byte boundary."),T=new Uint8Array(i.subarray(t,t+C))),{gltfFormat:h,featureTableJson:_,featureTableBinary:g,batchTableJson:p,batchTableBinary:y,gltf:T}};const H8e=RS,Rl={NOT_LOADED:0,LOADING:1,PROCESSING:2,POST_PROCESSING:3,READY:4,FAILED:5,UNLOADED:6},rx=vt.Attribute,V8e=vt.FeatureIdAttribute,YX=vt.Instances;function sd(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,Jr.Y),u=A(e.forwardAxis,Jr.X),f=A(e.loadAttributesAsTypedArray,!1),h=A(e.loadIndicesForWireframe,!1),_=A(e.loadPrimitiveOutline,!0);b.typeOf.object("options.i3dmResource",t),b.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=f,this._loadIndicesForWireframe=h,this._loadPrimitiveOutline=_,this._state=Rl.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)&&(sd.prototype=Object.create(ir.prototype),sd.prototype.constructor=sd);Object.defineProperties(sd.prototype,{promise:{get:function(){return this._promise}},texturesLoadedPromise:{get:function(){return this._gltfLoader.texturesLoadedPromise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}}});sd.prototype.load=function(){const e=H8e.parse(this._arrayBuffer,this._byteOffset),t=e.featureTableJson,n=e.featureTableBinary,i=e.batchTableJson,o=e.batchTableBinary,r=e.gltfFormat,s=new Lp(t,n);this._featureTable=s;const a=s.getGlobalProperty("INSTANCES_LENGTH");if(s.featuresLength=a,!l(a))throw new Se("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(d.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=Xa(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 f=new Ul(u);this._gltfLoader=f,this._state=Rl.LOADING,f.load();const h=this,_=new Promise(function(g){h._process=function(p,y){p._gltfLoader.process(y)},h._postProcess=function(p,y){const T=p._gltfLoader.components;T.transform=B.multiplyTransformation(p._transform,T.transform,T.transform),j8e(p,T,y),G8e(p,T),p._components=T,p._arrayBuffer=void 0,p._state=Rl.READY,g(p)}});return this._promise=f.promise.then(function(){if(!h.isDestroyed())return h._state=Rl.POST_PROCESSING,_}).catch(function(g){if(!h.isDestroyed())return k8e(h,g)}),this._promise};function k8e(e,t){e.unload(),e._state=Rl.FAILED;const n="Failed to load i3dm";return t=e.getError(n,t),Promise.reject(t)}sd.prototype.process=function(e){b.typeOf.object("frameState",e),this._state===Rl.LOADING&&(this._state=Rl.PROCESSING),this._state===Rl.PROCESSING&&this._process(this,e),this._state===Rl.POST_PROCESSING&&this._postProcess(this,e)};function G8e(e,t){const n=e._batchTable,i=e._instancesLength;if(i===0)return;let o;if(l(n.json))o=U_({count:i,batchTable:n.json,binaryBody:n.binary});else{const r=new dr({name:up.BATCH_TABLE_CLASS_NAME,count:i});o=new lu({schema:{},propertyTables:[r]})}t.structuralMetadata=o}const sx=new d,DB=new Array(4),W8e=new B;function j8e(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"),f=Y8e(o);let h;c&&(h=new Float32Array(4*r));let _;u&&(_=new Float32Array(3*r));const g=new Float32Array(r),p=d.unpackArray(f);let y=new d;const C=new d,T=new d,E=new d,w=new J,S=new Ce,P=new Array(4),O=new d,z=new Array(3),R=new B;if(!l(s)){const k=fe.fromPoints(p);for(i=0;i<p.length;i++)d.subtract(p[i],k.center,sx),f[3*i+0]=sx.x,f[3*i+1]=sx.y,f[3*i+2]=sx.z;const W=B.fromTranslation(k.center,W8e);t.transform=B.multiplyTransformation(W,t.transform,t.transform)}for(i=0;i<r;i++){y=d.clone(p[i]),l(s)&&d.add(y,d.unpack(s),y),c&&($8e(o,a,i,S,y,T,C,E,w,R),Ce.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&&(X8e(o,i,O),d.pack(O,z,0),_[3*i+0]=z[0],_[3*i+1]=z[1],_[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 YX;F.transformInWorldSpace=!0;const H=e._buffers,v=new rx;if(v.name="Instance Translation",v.semantic=ks.TRANSLATION,v.componentDatatype=ee.FLOAT,v.type=ln.VEC3,v.count=r,v.typedArray=f,!c){const k=At.createVertexBuffer({context:n.context,typedArray:f,usage:Ze.STATIC_DRAW});k.vertexArrayDestroyable=!1,H.push(k),v.buffer=k}if(F.attributes.push(v),c){const k=new rx;k.name="Instance Rotation",k.semantic=ks.ROTATION,k.componentDatatype=ee.FLOAT,k.type=ln.VEC4,k.count=r,k.typedArray=h,F.attributes.push(k)}if(u){const k=new rx;if(k.name="Instance Scale",k.semantic=ks.SCALE,k.componentDatatype=ee.FLOAT,k.type=ln.VEC3,k.count=r,c)k.typedArray=_;else{const W=At.createVertexBuffer({context:n.context,typedArray:_,usage:Ze.STATIC_DRAW});W.vertexArrayDestroyable=!1,H.push(W),k.buffer=W}F.attributes.push(k)}const I=new rx;I.name="Instance Feature ID",I.setIndex=0,I.semantic=ks.FEATURE_ID,I.componentDatatype=ee.FLOAT,I.type=ln.SCALAR,I.count=r;const m=At.createVertexBuffer({context:n.context,typedArray:g,usage:Ze.STATIC_DRAW});m.vertexArrayDestroyable=!1,H.push(m),I.buffer=m,F.attributes.push(I);const D=new V8e;D.propertyTableId=0,D.setIndex=0,D.positionalLabel="instanceFeatureId_0",F.featureIds.push(D);const L=t.nodes,M=L.length;let V=!1;for(i=0;i<M;i++){const k=L[i];k.primitives.length>0&&(k.instances=V?q8e(F):F,V=!0)}}function q8e(e){const t=new YX;t.transformInWorldSpace=e.transformInWorldSpace;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=ut(n[o],!1);t.attributes.push(r)}return t.featureIds=e.featureIds,t}function Y8e(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 Se("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 Se("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 Se("Either POSITION or POSITION_QUANTIZED must be defined for each instance.")}const x4=new Array(4);function $8e(e,t,n,i,o,r,s,a,c,u){const f=e.getProperty("NORMAL_UP",ee.FLOAT,3,n,DB),h=e.getProperty("NORMAL_RIGHT",ee.FLOAT,3,n,x4);let _=!1;if(l(f)){if(!l(h))throw new Se("To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined.");d.unpack(f,0,r),d.unpack(h,0,s),_=!0}else{const g=e.getProperty("NORMAL_UP_OCT32P",ee.UNSIGNED_SHORT,2,n,DB),p=e.getProperty("NORMAL_RIGHT_OCT32P",ee.UNSIGNED_SHORT,2,n,x4);if(l(g)){if(!l(p))throw new Se("To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined.");oi.octDecodeInRange(g[0],g[1],65535,r),oi.octDecodeInRange(p[0],p[1],65535,s),_=!0}else t?(tn.eastNorthUpToFixedFrame(o,pe.WGS84,u),B.getMatrix3(u,c)):J.clone(J.IDENTITY,c)}_&&(d.cross(s,r,a),d.normalize(a,a),J.setColumn(c,0,s,c),J.setColumn(c,1,r,c),J.setColumn(c,2,a,c)),Ce.fromRotationMatrix(c,i)}function X8e(e,t,n){n=d.fromElements(1,1,1,n);const i=e.getProperty("SCALE",ee.FLOAT,1,t);l(i)&&d.multiplyByScalar(n,i,n);const o=e.getProperty("SCALE_NON_UNIFORM",ee.FLOAT,3,t,DB);l(o)&&(n.x*=o[0],n.y*=o[1],n.z*=o[2])}function K8e(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}sd.prototype.isUnloaded=function(){return this._state===Rl.UNLOADED};sd.prototype.unload=function(){l(this._gltfLoader)&&this._gltfLoader.unload(),K8e(this),this._components=void 0,this._arrayBuffer=void 0,this._state=Rl.UNLOADED};const J8e={STOPPED:0,ANIMATING:1},Ng=Object.freeze(J8e);function ro(){this.times=void 0,this.points=void 0,x.throwInstantiationError()}ro.getPointType=function(e){if(typeof e=="number")return Number;if(e instanceof d)return d;if(e instanceof Ce)return Ce;throw new x("point must be a Cartesian3, Quaternion, or Number.")};ro.prototype.evaluate=x.throwInstantiationError;ro.prototype.findTimeInterval=function(e,t){const n=this.times,i=n.length;if(b.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};ro.prototype.wrapTime=function(e){b.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};ro.prototype.clampTime=function(e){b.typeOf.number("time",e);const t=this.times;return N.clamp(e,t[0],t[t.length-1])};function p0(e){this._value=e,this._valueType=ro.getPointType(e)}Object.defineProperties(p0.prototype,{value:{get:function(){return this._value}}});p0.prototype.findTimeInterval=function(e){throw new x("findTimeInterval cannot be called on a ConstantSpline.")};p0.prototype.wrapTime=function(e){return b.typeOf.number("time",e),0};p0.prototype.clampTime=function(e){return b.typeOf.number("time",e),0};p0.prototype.evaluate=function(e,t){b.typeOf.number("time",e);const n=this._value,i=this._valueType;return i===Number?n:i.clone(n,t)};function Bp(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=ro.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(Bp.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});Bp.prototype.findTimeInterval=ro.prototype.findTimeInterval;Bp.prototype.wrapTime=ro.prototype.wrapTime;Bp.prototype.clampTime=ro.prototype.clampTime;Bp.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 d),d.lerp(n[o],n[o+1],r,t))};const $X={};$X.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 d,s[a]=new d;o[0]=n[0]/t[0],r[0]=d.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]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],c,r[a]);for(c=1/(t[a]-o[a-1]*e[a-1]),r[a]=d.subtract(i[a],d.multiplyByScalar(r[a-1],e[a-1],r[a]),r[a]),r[a]=d.multiplyByScalar(r[a],c,r[a]),s[s.length-1]=r[r.length-1],a=s.length-2;a>=0;--a)s[a]=d.subtract(r[a],d.multiplyByScalar(s[a+1],o[a],s[a]),s[a]);return s};const XX=$X,KX=[],JX=[],QX=[],ZX=[];function Q8e(e,t,n){const i=KX,o=QX,r=JX,s=ZX;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 d),d.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 d),d.subtract(e[a+1],e[a-1],c),d.multiplyByScalar(c,3,c);return i[a]=0,o[a]=1,r[a]=4,c=s[a],l(c)||(c=s[a]=new d),d.subtract(e[a+1],e[a-1],c),d.multiplyByScalar(c,3,c),r[a+1]=1,c=s[a+1],l(c)||(c=s[a+1]=new d),d.clone(n,c),XX.solve(i,r,o,s)}function Z8e(e){const t=KX,n=QX,i=JX,o=ZX;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 d),d.subtract(e[1],e[0],s),d.multiplyByScalar(s,3,s),r=1;r<t.length;++r)t[r]=n[r]=1,i[r]=4,s=o[r],l(s)||(s=o[r]=new d),d.subtract(e[r+1],e[r-1],s),d.multiplyByScalar(s,3,s);return i[r]=2,s=o[r],l(s)||(s=o[r]=new d),d.subtract(e[r],e[r-1],s),d.multiplyByScalar(s,3,s),XX.solve(t,i,n,o)}function za(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=ro.getPointType(t[0]),this._pointType!==ro.getPointType(i[0])||this._pointType!==ro.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(za.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}}});za.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 za({times:t,points:n,inTangents:r,outTangents:o})};za.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 Bp({points:n,times:t});const i=Z8e(n),o=i.slice(0,i.length-1),r=i.slice(1,i.length);return new za({times:t,points:n,inTangents:r,outTangents:o})};za.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=ro.getPointType(n[0]);if(r!==ro.getPointType(i)||r!==ro.getPointType(o))throw new x("firstTangent and lastTangent must be of the same type as points.");if(n.length<3)return new Bp({points:n,times:t});const s=Q8e(n,i,o),a=s.slice(0,s.length-1),c=s.slice(1,s.length);return new za({times:t,points:n,inTangents:c,outTangents:a})};za.hermiteCoefficientMatrix=new B(2,-3,0,1,-2,3,0,0,1,-2,1,0,1,-1,0,0);za.prototype.findTimeInterval=ro.prototype.findTimeInterval;const e6e=new oe,hg=new d;za.prototype.wrapTime=ro.prototype.wrapTime;za.prototype.clampTime=ro.prototype.clampTime;za.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=e6e;u.z=c,u.y=c*c,u.x=u.y*c,u.w=1;const f=B.multiplyByVector(za.hermiteCoefficientMatrix,u,u);f.z*=a,f.w*=a;const h=this._pointType;return h===Number?n[s]*f.x+n[s+1]*f.y+r[s]*f.z+o[s]*f.w:(l(t)||(t=new h),t=h.multiplyByScalar(n[s],f.x,t),h.multiplyByScalar(n[s+1],f.y,hg),h.add(t,hg,t),h.multiplyByScalar(r[s],f.z,hg),h.add(t,hg,t),h.multiplyByScalar(o[s],f.w,hg),h.add(t,hg,t))};function m0(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=ro.getPointType(t[0]),this._lastTimeIndex=0}Object.defineProperties(m0.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});m0.prototype.findTimeInterval=ro.prototype.findTimeInterval;m0.prototype.wrapTime=ro.prototype.wrapTime;m0.prototype.clampTime=ro.prototype.clampTime;m0.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 t6e(e){const t=e.points,n=e.times;return function(i,o){l(o)||(o=new Ce);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 Ce.fastSlerp(a,c,s,o)}}function _0(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=t6e(this),this._lastTimeIndex=0}Object.defineProperties(_0.prototype,{times:{get:function(){return this._times}},points:{get:function(){return this._points}}});_0.prototype.findTimeInterval=ro.prototype.findTimeInterval;_0.prototype.wrapTime=ro.prototype.wrapTime;_0.prototype.clampTime=ro.prototype.clampTime;_0.prototype.evaluate=function(e,t){return this._evaluateFunction(e,t)};const Pm=vt.AnimatedPropertyType;function JM(e){e=A(e,A.EMPTY_OBJECT);const t=e.channel,n=e.runtimeAnimation,i=e.runtimeNode;b.typeOf.object("options.channel",t),b.typeOf.object("options.runtimeAnimation",n),b.typeOf.object("options.runtimeNode",i),this._channel=t,this._runtimeAnimation=n,this._runtimeNode=i,this._splines=[],this._path=void 0,o6e(this)}Object.defineProperties(JM.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 n6e(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 za({times:e,points:n,inTangents:i,outTangents:o})}function w4(e,t,n,i){if(e.length===1&&t.length===1)return new p0(t[0]);switch(n){case fy.STEP:return new m0({times:e,points:t});case fy.CUBICSPLINE:return n6e(e,t);case fy.LINEAR:return i===Pm.ROTATION?new _0({times:e,points:t}):new Bp({times:e,points:t})}}function i6e(e,t,n,i,o){const r=[];if(i===Pm.WEIGHTS){const a=t.length/o;let c,u;for(c=0;c<o;c++){const f=new Array(a);let h=c;if(n===fy.CUBICSPLINE)for(u=0;u<a;u+=3)f[u]=t[h],f[u+1]=t[h+o],f[u+2]=t[h+2*o],h+=o*3;else for(u=0;u<a;u++)f[u]=t[h],h+=o;r.push(w4(e,f,n,i))}}else r.push(w4(e,t,n,i));return r}let IB;function o6e(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,f=i6e(i,o,r,a,u);switch(e._splines=f,e._path=a,a){case Pm.TRANSLATION:case Pm.SCALE:IB=new d;break;case Pm.ROTATION:IB=new Ce;break;case Pm.WEIGHTS:break}}JM.prototype.animate=function(e){const t=this._splines,n=this._path,i=this._runtimeAnimation.model,o=this._runtimeNode;if(n===Pm.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,IB)}}};function QM(e,t,n){this._animation=t,this._name=t.name,this._runtimeChannels=void 0,this._startTime=ne.clone(n.startTime),this._delay=A(n.delay,0),this._stopTime=ne.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,Wf.NONE),this._animationTime=n.animationTime,this._prevAnimationDelta=void 0,this.start=new $e,this.update=new $e,this.stop=new $e,this._state=Ng.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,r6e(this)}Object.defineProperties(QM.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 r6e(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],f=u.target;if(!l(f))continue;const h=f.node.index,_=i._runtimeNodes[h],g=new JM({channel:u,runtimeAnimation:e,runtimeNode:_}),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}QM.prototype.animate=function(e){const t=this._runtimeChannels,n=t.length;for(let i=0;i<n;i++)t[i].animate(e)};function Rd(e){this.animationAdded=new $e,this.animationRemoved=new $e,this.animateWhilePaused=!1,this._model=e,this._runtimeAnimations=[],this._previousTime=void 0}Object.defineProperties(Rd.prototype,{length:{get:function(){return this._runtimeAnimations.length}},model:{get:function(){return this._model}}});function PB(e,t,n){const i=e._model,o=new QM(i,t,n);return e._runtimeAnimations.push(o),e.animationAdded.raiseEvent(i,o),o}Rd.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 PB(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 PB(this,n[i],e)};Rd.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=PB(this,n[r],e);i.push(s)}return i};Rd.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};Rd.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])};Rd.prototype.contains=function(e){return l(e)?this._runtimeAnimations.indexOf(e)!==-1:!1};Rd.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 ax=[];function s6e(e,t,n){return function(){e.animationRemoved.raiseEvent(t,n)}}Rd.prototype.update=function(e){const t=this._runtimeAnimations;let n=t.length;if(n===0)return this._previousTime=void 0,!1;if(!this.animateWhilePaused&&ne.equals(e.time,this._previousTime))return!1;this._previousTime=ne.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=ne.addSeconds(A(a.startTime,o),a.delay,new ne)),l(a._duration)||(a._duration=a.localStopTime*(1/a.multiplier));const c=a._computedStartTime,u=a._duration,f=a.stopTime,h=ne.lessThanOrEquals(c,o),_=l(f)&&ne.greaterThan(o,f);let g=0;if(u!==0){const C=ne.secondsDifference(_?f:o,c);g=l(a._animationTime)?a._animationTime(u,C):C/u}const p=a.loop===Wf.REPEAT||a.loop===Wf.MIRRORED_REPEAT,y=(h||p&&!l(a.startTime))&&(g<=1||p)&&!_;if(g===a._prevAnimationDelta){const C=a._state===Ng.STOPPED;if(y!==C)continue}if(a._prevAnimationDelta=g,y||a._state===Ng.ANIMATING){if(y&&a._state===Ng.STOPPED&&(a._state=Ng.ANIMATING,a.start.numberOfListeners>0&&e.afterRender.push(a._raiseStartEvent)),a.loop===Wf.REPEAT)g=g-Math.floor(g);else if(a.loop===Wf.MIRRORED_REPEAT){const T=Math.floor(g),E=g-T;g=T%2===1?1-E:E}a.reverse&&(g=1-g);let C=g*u*a.multiplier;C=N.clamp(C,a.localStartTime,a.localStopTime),a.animate(C),a.update.numberOfListeners>0&&(a._updateEventTime=C,e.afterRender.push(a._raiseUpdateEvent)),i=!0,y||(a._state=Ng.STOPPED,a.stop.numberOfListeners>0&&e.afterRender.push(a._raiseStopEvent),a.removeOnStop&&ax.push(a))}}n=ax.length;for(let s=0;s<n;++s){const a=ax[s];t.splice(t.indexOf(a),1),e.afterRender.push(s6e(this,r,a))}return ax.length=0,i};function H_(e){this._model=e.model,this._featureTable=e.featureTable,this._featureId=e.featureId,this._color=void 0}Object.defineProperties(H_.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 U),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}}});H_.prototype.hasProperty=function(e){return this._featureTable.hasProperty(this._featureId,e)};H_.prototype.getProperty=function(e){return this._featureTable.getProperty(this._featureId,e)};H_.prototype.getPropertyInherited=function(e){return this._featureTable.hasPropertyBySemantic(this._featureId,e)?this._featureTable.getPropertyBySemantic(this._featureId,e):this._featureTable.getProperty(this._featureId,e)};H_.prototype.getPropertyIds=function(e){return this._featureTable.getPropertyIds(e)};H_.prototype.setProperty=function(e,t){return this._featureTable.setProperty(this._featureId,e,t)};const VA={ALL_OPAQUE:0,ALL_TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2};VA.getStyleCommandsNeeded=function(e,t){return t===0?VA.ALL_OPAQUE:t===e?VA.ALL_TRANSLUCENT:VA.OPAQUE_AND_TRANSLUCENT};const fT=Object.freeze(VA),Ch={GLTF:"GLTF",TILE_GLTF:"TILE_GLTF",TILE_B3DM:"B3DM",TILE_I3DM:"I3DM",TILE_PNTS:"PNTS",TILE_GEOJSON:"TILE_GEOJSON"};Ch.is3DTiles=function(e){switch(b.typeOf.string("modelType",e),e){case Ch.TILE_GLTF:case Ch.TILE_B3DM:case Ch.TILE_I3DM:case Ch.TILE_PNTS:case Ch.TILE_GEOJSON:return!0;case Ch.GLTF:return!1;default:throw new x("modelType is not a valid value.")}};const ta=Object.freeze(Ch);function Yo(e){const t=e.model,n=e.propertyTable;b.typeOf.object("propertyTable",n),b.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=fT.ALL_OPAQUE,a6e(this)}Object.defineProperties(Yo.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 a6e(e){const t=e._model,n=ta.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 H_({model:t,featureId:o,featureTable:e});e._features=r,e._featuresLength=i,e._batchTexture=new po({featuresLength:i,owner:e,statistics:n?t.content.tileset.statistics:void 0})}Yo.prototype.update=function(e){this._styleCommandsNeededDirty=!1,this._batchTexture.update(void 0,e);const t=fT.getStyleCommandsNeeded(this._featuresLength,this._batchTexture.translucentFeaturesLength);this._styleCommandsNeeded!==t&&(this._styleCommandsNeededDirty=!0,this._styleCommandsNeeded=t)};Yo.prototype.setShow=function(e,t){this._batchTexture.setShow(e,t)};Yo.prototype.setAllShow=function(e){this._batchTexture.setAllShow(e)};Yo.prototype.getShow=function(e){return this._batchTexture.getShow(e)};Yo.prototype.setColor=function(e,t){this._batchTexture.setColor(e,t)};Yo.prototype.setAllColor=function(e){this._batchTexture.setAllColor(e)};Yo.prototype.getColor=function(e,t){return this._batchTexture.getColor(e,t)};Yo.prototype.getPickColor=function(e){return this._batchTexture.getPickColor(e)};Yo.prototype.getFeature=function(e){return this._features[e]};Yo.prototype.hasProperty=function(e,t){return this._propertyTable.hasProperty(e,t)};Yo.prototype.hasPropertyBySemantic=function(e,t){return this._propertyTable.hasPropertyBySemantic(e,t)};Yo.prototype.getProperty=function(e,t){return this._propertyTable.getProperty(e,t)};Yo.prototype.getPropertyBySemantic=function(e,t){return this._propertyTable.getPropertyBySemantic(e,t)};Yo.prototype.getPropertyIds=function(e){return this._propertyTable.getPropertyIds(e)};Yo.prototype.setProperty=function(e,t,n){return this._propertyTable.setProperty(e,t,n)};Yo.prototype.isClass=function(e,t){return this._propertyTable.isClass(e,t)};Yo.prototype.isExactClass=function(e,t){return this._propertyTable.isExactClass(e,t)};Yo.prototype.getExactClassName=function(e){return this._propertyTable.getExactClassName(e)};const c6e=new U;Yo.prototype.applyStyle=function(e){if(!l(e)){this.setAllColor(po.DEFAULT_COLOR_VALUE),this.setAllShow(po.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,c6e),po.DEFAULT_COLOR_VALUE):po.DEFAULT_COLOR_VALUE,o=l(e.show)?A(e.show.evaluate(n),po.DEFAULT_SHOW_VALUE):po.DEFAULT_SHOW_VALUE;this.setColor(t,i),this.setShow(t,o)}};Yo.prototype.isDestroyed=function(){return!1};Yo.prototype.destroy=function(e){this._batchTexture=this._batchTexture&&this._batchTexture.destroy(),Ue(this)};const l6e=`#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;
}
`,u6e=`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 ZM(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;b.typeOf.object("options.command",t),b.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!==go.CESIUM_3D_TILE,this._classifies3DTiles=o!==go.TERRAIN,this._useDebugWireframe=i._enableDebugWireframe&&i.debugWireframe,this._pickId=n.pickId,this._commandListTerrain=[],this._commandList3DTiles=[],this._commandListIgnoreShow=[],this._commandListDebugWireframe=[],this._commandListTerrainPicking=[],this._commandList3DTilesPicking=[],p6e(this)}function f6e(e){return{colorMask:{red:!1,green:!1,blue:!1,alpha:!1},stencilTest:{enabled:!0,frontFunction:e,frontOperation:{fail:ht.KEEP,zFail:ht.DECREMENT_WRAP,zPass:ht.KEEP},backFunction:e,backOperation:{fail:ht.KEEP,zFail:ht.INCREMENT_WRAP,zPass:ht.KEEP},reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!0,func:Jm.LESS_OR_EQUAL},depthMask:!1}}const d6e={stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1,blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND},h6e={stencilTest:{enabled:!0,frontFunction:ri.NOT_EQUAL,frontOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},backFunction:ri.NOT_EQUAL,backOperation:{fail:ht.ZERO,zFail:ht.ZERO,zPass:ht.ZERO},reference:0,mask:Pt.CLASSIFICATION_MASK},stencilMask:Pt.CLASSIFICATION_MASK,depthTest:{enabled:!1},depthMask:!1},eK=[];function p6e(e){const t=e._command,n=eK;if(e._useDebugWireframe){t.pass=Be.OPAQUE,n.length=0,n.push(t),e._commandListDebugWireframe=pC(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=Be.TERRAIN_CLASSIFICATION,s=OB(t,r),a=S4(t,r);n.length=0,n.push(s,a),e._commandListTerrain=pC(e,n,e._commandListTerrain),o&&(e._commandListTerrainPicking=v4(e,n,e._commandListTerrainPicking))}if(e._classifies3DTiles){const r=Be.CESIUM_3D_TILE_CLASSIFICATION,s=OB(t,r),a=S4(t,r);n.length=0,n.push(s,a),e._commandList3DTiles=pC(e,n,e._commandList3DTiles),o&&(e._commandList3DTilesPicking=v4(e,n,e._commandList3DTilesPicking))}}function pC(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],f=r[c];for(let h=0;h<a;h++){const _=t[h],g=dt.shallowClone(_);g.count=u,g.offset=f,n.push(g)}}return n}function OB(e,t){const n=dt.shallowClone(e);n.cull=!1,n.pass=t;const i=t===Be.TERRAIN_CLASSIFICATION?ri.ALWAYS:ri.EQUAL,o=f6e(i);return n.renderState=Qe.fromCache(o),n}function S4(e,t){const n=dt.shallowClone(e);return n.cull=!1,n.pass=t,n.renderState=Qe.fromCache(d6e),n}const m6e=[];function v4(e,t,n){const i=Qe.fromCache(h6e),o=t[0],r=t[1],s=dt.shallowClone(o);s.cull=!0,s.pickOnly=!0;const a=dt.shallowClone(r);a.cull=!0,a.pickOnly=!0,a.renderState=i,a.pickId=e._pickId;const c=m6e;return c.length=0,c.push(s,a),pC(e,c,n)}Object.defineProperties(ZM.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}}});ZM.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=Be.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,r=OB(this._command,o),s=eK;s.length=0,s.push(r),this._commandListIgnoreShow=pC(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 sD(e){e=A(e,A.EMPTY_OBJECT);const t=e.command,n=e.primitiveRenderResources;b.typeOf.object("options.command",t),b.typeOf.object("options.primitiveRenderResources",n);const i=n.model;this._model=i;const o=n.runtimePrimitive;this._runtimePrimitive=o;const r=t.pass===Be.TRANSLUCENT,a=!o.primitive.material.doubleSided&&!r,c=n.hasSilhouette,u=!r&&!c,f=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=f,this._needsSilhouetteCommands=h,this._originalCommand=void 0,this._translucentCommand=void 0,this._skipLodBackfaceCommand=void 0,this._skipLodStencilCommand=void 0,this._silhouetteModelCommand=void 0,this._silhouetteColorCommand=void 0,this._derivedCommands=[],this._has2DCommands=!1,_6e(this)}function Uf(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}Uf.clone=function(e){return new Uf({command:e.command,updateShadows:e.updateShadows,updateBackFaceCulling:e.updateBackFaceCulling,updateCullFace:e.updateCullFace,updateDebugShowBoundingVolume:e.updateDebugShowBoundingVolume,is2D:e.is2D,derivedCommand2D:e.derivedCommand2D})};function _6e(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 Uf({command:t,updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0,is2D:!1}),o.push(e._originalCommand),e._needsTranslucentCommand&&(e._translucentCommand=new Uf({command:E6e(t),updateShadows:!0,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!0}),o.push(e._translucentCommand)),e._needsSkipLevelOfDetailCommands&&(e._skipLodBackfaceCommand=new Uf({command:I6e(t),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:i,updateDebugShowBoundingVolume:!1}),e._skipLodStencilCommand=new Uf({command:P6e(t),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),o.push(e._skipLodBackfaceCommand),o.push(e._skipLodStencilCommand)),e._needsSilhouetteCommands&&(e._silhouetteModelCommand=new Uf({command:x6e(t,n),updateShadows:!0,updateBackFaceCulling:i,updateCullFace:i,updateDebugShowBoundingVolume:!0}),e._silhouetteColorCommand=new Uf({command:w6e(t,n),updateShadows:!1,updateBackFaceCulling:!1,updateCullFace:!1,updateDebugShowBoundingVolume:!1}),o.push(e._silhouetteModelCommand),o.push(e._silhouetteColorCommand))}Object.defineProperties(sD.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,y6e(this)}},backFaceCulling:{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,A6e(this))}},cullFace:{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,C6e(this))}},debugShowBoundingVolume:{get:function(){return this._debugShowBoundingVolume},set:function(e){this._debugShowBoundingVolume!==e&&(this._debugShowBoundingVolume=e,T6e(this))}}});function g6e(e,t){const n=e._modelMatrix;e._modelMatrix2D=B.clone(n,e._modelMatrix2D),e._modelMatrix2D[13]-=N.sign(n[13])*2*N.PI*t.mapProjection.ellipsoid.maximumRadius,e._boundingVolume2D=fe.transform(e.runtimePrimitive.boundingSphere,e._modelMatrix2D,e._boundingVolume2D)}function y6e(e){const t=e.shadows,n=Co.castShadows(t),i=Co.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 A6e(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=ut(s.renderState,!0);a.cull.enabled=t,s.renderState=Qe.fromCache(a)}}}function C6e(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=ut(s.renderState,!0);a.cull.face=t,s.renderState=Qe.fromCache(a)}}}function T6e(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}}}sD.prototype.pushCommands=function(e,t){const n=tK(this,e);n&&!this._has2DCommands&&(b6e(this),this._has2DCommands=!0,this._modelMatrix2DDirty=!0),this._modelMatrix2DDirty&&(g6e(this,e),this._modelMatrix2DDirty=!1);const i=this.model.styleCommandsNeeded;if(!(this._needsTranslucentCommand&&l(i)&&(i!==fT.ALL_OPAQUE&&Mg(t,this._translucentCommand,n),i===fT.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||Mg(r._backfaceCommands,this._skipLodBackfaceCommand,n),S6e(this,s,n),Mg(t,this._skipLodStencilCommand,n);return}}if(this._needsSilhouetteCommands){Mg(t,this._silhouetteModelCommand,n);return}return Mg(t,this._originalCommand,n),t}};sD.prototype.pushSilhouetteCommands=function(e,t){const n=tK(this,e);return Mg(t,this._silhouetteColorCommand,n),t};function Mg(e,t,n){e.push(t.command),n&&e.push(t.derivedCommand2D.command)}function tK(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*N.PI;return o<s&&r>s||o<-s&&r>-s}function pg(e,t){if(!l(t))return;const n=Uf.clone(t),i=dt.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 b6e(e){pg(e,e._originalCommand),pg(e,e._translucentCommand),pg(e,e._skipLodBackfaceCommand),pg(e,e._skipLodStencilCommand),pg(e,e._silhouetteModelCommand),pg(e,e._silhouetteColorCommand)}function E6e(e){const t=dt.shallowClone(e);t.pass=Be.TRANSLUCENT;const n=ut(e.renderState,!0);return n.cull.enabled=!1,n.depthMask=!1,n.blending=Ii.ALPHA_BLEND,t.renderState=Qe.fromCache(n),t}function x6e(e,t){const n=t._silhouetteId%255,i=dt.shallowClone(e),o=ut(e.renderState,!0);return o.stencilTest={enabled:!0,frontFunction:se.ALWAYS,backFunction:se.ALWAYS,reference:n,mask:-1,frontOperation:{fail:se.KEEP,zFail:se.KEEP,zPass:se.REPLACE},backOperation:{fail:se.KEEP,zFail:se.KEEP,zPass:se.REPLACE}},t.isInvisible()&&(o.colorMask={red:!1,green:!1,blue:!1,alpha:!1}),i.renderState=Qe.fromCache(o),i}function w6e(e,t){const n=t._silhouetteId%255,i=dt.shallowClone(e),o=ut(e.renderState,!0);o.cull.enabled=!1,(e.pass===Be.TRANSLUCENT||t.silhouetteColor.alpha<1)&&(i.pass=Be.TRANSLUCENT,o.depthMask=!1,o.blending=Ii.ALPHA_BLEND),o.stencilTest={enabled:!0,frontFunction:se.NOTEQUAL,backFunction:se.NOTEQUAL,reference:n,mask:-1,frontOperation:{fail:se.KEEP,zFail:se.KEEP,zPass:se.KEEP},backOperation:{fail:se.KEEP,zFail:se.KEEP,zPass:se.KEEP}};const s=ut(e.uniformMap);return s.model_silhouettePass=function(){return!0},i.renderState=Qe.fromCache(o),i.uniformMap=s,i.castShadows=!1,i.receiveShadows=!1,i}function S6e(e,t,n){const i=e._skipLodStencilCommand,o=i.command,r=t._selectionDepth,s=v6e(o);if(r!==s){const a=D6e(r),c=ut(o.renderState,!0);c.stencilTest.reference=a,o.renderState=Qe.fromCache(c),n&&(i.derivedCommand2D.renderState=c)}}function v6e(e){return(e.renderState.stencilTest.reference&Pt.SKIP_LOD_MASK)>>>Pt.SKIP_LOD_BIT_SHIFT}function D6e(e){return Pt.CESIUM_3D_TILE_MASK|e<<Pt.SKIP_LOD_BIT_SHIFT}function I6e(e){const t=dt.shallowClone(e),n=ut(e.renderState,!0);n.cull.enabled=!0,n.cull.face=Po.FRONT,n.colorMask={red:!1,green:!1,blue:!1,alpha:!1},n.polygonOffset={enabled:!0,factor:5,units:5};const i=ut(t.uniformMap),o=new j(5,5);return i.u_polygonOffset=function(){return o},t.renderState=Qe.fromCache(n),t.uniformMap=i,t.castShadows=!1,t.receiveShadows=!1,t}function P6e(e){const t=dt.shallowClone(e),n=ut(e.renderState,!0);return n.stencilTest.enabled=!0,n.stencilTest.mask=Pt.SKIP_LOD_MASK,n.stencilTest.reference=Pt.CESIUM_3D_TILE_MASK,n.stencilTest.frontFunction=ri.GREATER_OR_EQUAL,n.stencilTest.frontOperation.zPass=ht.REPLACE,n.stencilTest.backFunction=ri.GREATER_OR_EQUAL,n.stencilTest.backOperation.zPass=ht.REPLACE,n.stencilMask=Pt.CESIUM_3D_TILE_MASK|Pt.SKIP_LOD_MASK,t.renderState=Qe.fromCache(n),t}function O6e(e,t){const n=e.shaderBuilder;n.addVertexLines(u6e),n.addFragmentLines(l6e);const i=L6e(e),o=new to({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 f,h;if(!u&&!t.scene3DOnly&&r._projectTo2D)f=B.multiplyTransformation(c._computedModelMatrix,e.runtimeNode.computedTransform,new B),h=e.runtimePrimitive.boundingSphere2D;else{const E=u?c._computedModelMatrix:c._computedModelMatrix2D;f=B.multiplyTransformation(E,e.runtimeNode.computedTransform,new B),h=fe.transform(e.boundingSphere,f,e.boundingSphere)}let _=ut(Qe.fromCache(e.renderStateOptions),!0);_.cull.face=$t.getCullFace(f,e.primitiveType),_=Qe.fromCache(_);const g=l(r.classificationType),p=g?!1:Co.castShadows(r.shadows),y=g?!1:Co.receiveShadows(r.shadows),C=g?void 0:e.pickId,T=new dt({boundingVolume:h,modelMatrix:f,uniformMap:e.uniformMap,renderState:_,vertexArray:o,shaderProgram:s,cull:r.cull,pass:a,count:e.count,owner:r,pickId:C,instanceCount:e.instanceCount,primitiveType:e.primitiveType,debugShowBoundingVolume:r.debugShowBoundingVolume,castShadows:p,receiveShadows:y});return g?new ZM({primitiveRenderResources:e,command:T}):new sD({primitiveRenderResources:e,command:T})}function L6e(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 nK={name:"TilesetPipelineStage"};nK.process=function(e,t,n){if(t.hasSkipLevelOfDetail(n)){e.shaderBuilder.addDefine("POLYGON_OFFSET",void 0,we.FRAGMENT);const r={u_polygonOffset:function(){return j.ZERO}};e.uniformMap=sn(r,e.uniformMap),e.hasSkipLevelOfDetail=!0}const i=e.renderStateOptions;i.stencilTest=Pt.setCesium3DTileBit(),i.stencilMask=Pt.CESIUM_3D_TILE_MASK};const B6e=nK,R6e=`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
}`,iK={name:"ImageBasedLightingPipelineStage"};iK.process=function(e,t,n){const i=t.imageBasedLighting,o=e.shaderBuilder;o.addDefine("USE_IBL_LIGHTING",void 0,we.FRAGMENT),o.addUniform("vec2","model_iblFactor",we.FRAGMENT),Xl.isSupported(n.context)&&((i.useSphericalHarmonics||i.useSpecularEnvironmentMaps||i.enabled)&&o.addUniform("mat3","model_iblReferenceFrameMatrix",we.FRAGMENT),l(i.sphericalHarmonicCoefficients)?(o.addDefine("DIFFUSE_IBL",void 0,we.FRAGMENT),o.addDefine("CUSTOM_SPHERICAL_HARMONICS",void 0,we.FRAGMENT),o.addUniform("vec3","model_sphericalHarmonicCoefficients[9]",we.FRAGMENT)):i.useDefaultSphericalHarmonics&&o.addDefine("DIFFUSE_IBL",void 0,we.FRAGMENT),l(i.specularEnvironmentMapAtlas)&&i.specularEnvironmentMapAtlas.ready?(o.addDefine("SPECULAR_IBL",void 0,we.FRAGMENT),o.addDefine("CUSTOM_SPECULAR_IBL",void 0,we.FRAGMENT),o.addUniform("sampler2D","model_specularEnvironmentMaps",we.FRAGMENT),o.addUniform("vec2","model_specularEnvironmentMapsSize",we.FRAGMENT),o.addUniform("float","model_specularEnvironmentMapsMaximumLOD",we.FRAGMENT)):t.useDefaultSpecularMaps&&o.addDefine("SPECULAR_IBL",void 0,we.FRAGMENT)),l(i.luminanceAtZenith)&&(o.addDefine("USE_SUN_LUMINANCE",void 0,we.FRAGMENT),o.addUniform("float","model_luminanceAtZenith",we.FRAGMENT)),o.addFragmentLines(R6e);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=sn(r,e.uniformMap)};const N6e=iK,M6e=N.EPSILON16;function eF(e){e=A(e,A.EMPTY_OBJECT);const t=e.stage,n=e.runtimeArticulation;b.typeOf.object("options.stage",t),b.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(eF.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){b.typeOf.number("value",e),e=N.clamp(e,this.minimumValue,this.maximumValue),N.equalsEpsilon(this._currentValue,e,M6e)||(this._currentValue=e,this.runtimeArticulation._dirty=!0)}}});const F6e=new d,pO=new J;eF.prototype.applyStageToMatrix=function(e){b.typeOf.object("result",e);const t=this.type,n=this.currentValue,i=F6e;let o;switch(t){case El.XROTATE:o=J.fromRotationX(N.toRadians(n),pO),e=B.multiplyByMatrix3(e,o,e);break;case El.YROTATE:o=J.fromRotationY(N.toRadians(n),pO),e=B.multiplyByMatrix3(e,o,e);break;case El.ZROTATE:o=J.fromRotationZ(N.toRadians(n),pO),e=B.multiplyByMatrix3(e,o,e);break;case El.XTRANSLATE:i.x=n,i.y=0,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case El.YTRANSLATE:i.x=0,i.y=n,i.z=0,e=B.multiplyByTranslation(e,i,e);break;case El.ZTRANSLATE:i.x=0,i.y=0,i.z=n,e=B.multiplyByTranslation(e,i,e);break;case El.XSCALE:i.x=n,i.y=1,i.z=1,e=B.multiplyByScale(e,i,e);break;case El.YSCALE:i.x=1,i.y=n,i.z=1,e=B.multiplyByScale(e,i,e);break;case El.ZSCALE:i.x=1,i.y=1,i.z=n,e=B.multiplyByScale(e,i,e);break;case El.UNIFORMSCALE:e=B.multiplyByUniformScale(e,n,e);break}return e};function aD(e){e=A(e,A.EMPTY_OBJECT);const t=e.articulation,n=e.sceneGraph;b.typeOf.object("options.articulation",t),b.typeOf.object("options.sceneGraph",n),this._articulation=t,this._sceneGraph=n,this._name=t.name,this._runtimeStages=[],this._runtimeStagesByName={},this._runtimeNodes=[],this._dirty=!0,z6e(this)}Object.defineProperties(aD.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 z6e(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 eF({stage:a,runtimeArticulation:e});o.push(c);const u=a.name;r[u]=c}}aD.prototype.setArticulationStage=function(e,t){const n=this._runtimeStagesByName[e];l(n)&&(n.currentValue=t)};const U6e=new B,H6e=new B;aD.prototype.apply=function(){if(!this._dirty)return;this._dirty=!1;let e=B.clone(B.IDENTITY,U6e),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,H6e);s.transform=a}};const V6e=`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;
}`,Fg={name:"ModelColorPipelineStage",COLOR_UNIFORM_NAME:"model_color",COLOR_BLEND_UNIFORM_NAME:"model_colorBlend"};Fg.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_COLOR",void 0,we.FRAGMENT),i.addFragmentLines(V6e);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=Be.TRANSLUCENT),i.addUniform("vec4",Fg.COLOR_UNIFORM_NAME,we.FRAGMENT),o[Fg.COLOR_UNIFORM_NAME]=function(){return t.color},i.addUniform("float",Fg.COLOR_BLEND_UNIFORM_NAME,we.FRAGMENT),o[Fg.COLOR_BLEND_UNIFORM_NAME]=function(){return iD.getColorBlend(t.colorBlendMode,t.colorBlendAmount)},e.uniformMap=sn(o,e.uniformMap)};const LB=Fg,k6e=`#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;
}
}
`,oK={name:"ModelClippingPlanesPipelineStage"},G6e=new j;oK.process=function(e,t,n){const i=t.clippingPlanes,o=n.context,r=e.shaderBuilder;r.addDefine("HAS_CLIPPING_PLANES",void 0,we.FRAGMENT),r.addDefine("CLIPPING_PLANES_LENGTH",i.length,we.FRAGMENT),i.unionClippingRegions&&r.addDefine("UNION_CLIPPING_REGIONS",void 0,we.FRAGMENT),Ao.useFloatTexture(o)&&r.addDefine("USE_CLIPPING_PLANES_FLOAT_TEXTURE",void 0,we.FRAGMENT);const s=Ao.getTextureResolution(i,o,G6e);r.addDefine("CLIPPING_PLANES_TEXTURE_WIDTH",s.x,we.FRAGMENT),r.addDefine("CLIPPING_PLANES_TEXTURE_HEIGHT",s.y,we.FRAGMENT),r.addUniform("sampler2D","model_clippingPlanes",we.FRAGMENT),r.addUniform("vec4","model_clippingPlanesEdgeStyle",we.FRAGMENT),r.addUniform("mat4","model_clippingPlanesMatrix",we.FRAGMENT),r.addFragmentLines(k6e);const a={model_clippingPlanes:function(){return i.texture},model_clippingPlanesEdgeStyle:function(){const c=U.clone(i.edgeColor);return c.alpha=i.edgeWidth,c},model_clippingPlanesMatrix:function(){return t._clippingPlanesMatrix}};e.uniformMap=sn(a,e.uniformMap)};const W6e=oK;function rK(e,t){b.typeOf.object("model",e),b.typeOf.object("runtimeNode",t),this._model=e,this._runtimeNode=t}Object.defineProperties(rK.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 j6e=`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
`,q6e=`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
}
`,Y6e=`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
}
`,cx=new B,$6e=new B,X6e=new B,sK={name:"InstancingPipelineStage",_getInstanceTransformsAsMatrices:fK,_transformsToTypedArray:BB};sK.process=function(e,t,n){const i=t.instances,o=i.attributes[0].count,r=e.shaderBuilder;r.addDefine("HAS_INSTANCING"),r.addVertexLines(j6e);const s=e.model,a=s.sceneGraph,c=e.runtimeNode,u=n.mode!==le.SCENE3D&&!n.scene3DOnly&&s._projectTo2D,f=[];a9e(e,n,i,f,u),u9e(e,n,i,f);const h={};if(i.transformInWorldSpace?(r.addDefine("USE_LEGACY_INSTANCING",void 0,we.VERTEX),r.addUniform("mat4","u_instance_modifiedModelView",we.VERTEX),r.addUniform("mat4","u_instance_nodeTransform",we.VERTEX),h.u_instance_modifiedModelView=function(){let _=B.multiplyTransformation(s.modelMatrix,a.components.transform,cx);return u?B.multiplyTransformation(n.context.uniformState.view3D,_,cx):(n.mode!==le.SCENE3D&&(_=tn.basisTo2D(n.mapProjection,_,cx)),B.multiplyTransformation(n.context.uniformState.view,_,cx))},h.u_instance_nodeTransform=function(){return B.multiplyTransformation(a.axisCorrectionMatrix,c.computedTransform,$6e)},r.addVertexLines(Y6e)):r.addVertexLines(q6e),u){r.addDefine("USE_2D_INSTANCING",void 0,we.VERTEX),r.addUniform("mat4","u_modelView2D",we.VERTEX);const _=n.context,g=B.fromTranslation(c.instancingReferencePoint2D,new B);h.u_modelView2D=function(){return B.multiplyTransformation(_.uniformState.view,g,X6e)}}e.uniformMap=sn(h,e.uniformMap),e.instanceCount=o,e.attributes.push.apply(e.attributes,f)};const mC=new B,K6e=new d;function J6e(e,t,n,i,o){let r=B.multiplyTransformation(t,e,mC);return r=B.multiplyTransformation(r,n,mC),o=tn.basisTo2D(i.mapProjection,r,o),o}function Q6e(e,t,n,i,o){const r=B.fromTranslation(e,mC);let s=B.multiplyTransformation(t,r,mC);s=B.multiplyTransformation(s,n,mC);const a=B.getTranslation(s,K6e);return o=lr.computeActualWgs84Position(i,a,o),o}function aK(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 cK=new B,lK=new B,Z6e=new B,e9e=new d;function t9e(e,t,n,i){const o=cK,r=lK;aK(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const f=e[u],h=J6e(f,o,r,n,Z6e),_=B.getTranslation(h,e9e),g=d.subtract(_,a,_);i[u]=B.setTranslation(h,g,i[u])}return i}function n9e(e,t,n,i){const o=cK,r=lK;aK(t,o,r);const a=t.runtimeNode.instancingReferencePoint2D,c=e.length;for(let u=0;u<c;u++){const f=e[u],h=Q6e(f,o,r,n,f);i[u]=d.subtract(h,a,i[u])}return i}const i9e=new d,o9e=new d;function uK(e,t){const n=e.runtimeNode,i=e.model.sceneGraph.computedModelMatrix,o=B.multiplyByPoint(i,n.instancingTranslationMin,i9e),r=lr.computeActualWgs84Position(t,o,o),s=B.multiplyByPoint(i,n.instancingTranslationMax,o9e),a=lr.computeActualWgs84Position(t,s,s);n.instancingReferencePoint2D=d.lerp(r,a,.5,new d)}function BB(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 r9e(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 d;new Ce;new d;function fK(e,t,n){const i=new Array(t),o=$t.getAttributeBySemantic(e,ks.TRANSLATION),r=$t.getAttributeBySemantic(e,ks.ROTATION),s=$t.getAttributeBySemantic(e,ks.SCALE),a=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),c=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),u=l(o),f=l(r),h=l(s),_=u?o.typedArray:new Float32Array(t*3);let g=f?r.typedArray:new Float32Array(t*4);f&&r.normalized&&(g=oi.dequantize(g,r.componentDatatype,r.type,t));let p;h?p=s.typedArray:(p=new Float32Array(t*3),p.fill(1));for(let C=0;C<t;C++){const T=new d(_[C*3],_[C*3+1],_[C*3+2]);d.maximumByComponent(a,T,a),d.minimumByComponent(c,T,c);const E=new Ce(g[C*4],g[C*4+1],g[C*4+2],f?g[C*4+3]:1),w=new d(p[C*3],p[C*3+1],p[C*3+2]),S=B.fromTranslationQuaternionRotationScale(T,E,w,new B);i[C]=S}const y=n.runtimeNode;return y.instancingTranslationMin=c,y.instancingTranslationMax=a,u&&(o.typedArray=void 0),f&&(r.typedArray=void 0),h&&(s.typedArray=void 0),i}function s9e(e,t,n){const i=new Array(t),o=e.typedArray,r=new d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(let c=0;c<t;c++){const u=new d(o[c*3],o[c*3+1],o[c*3+2]);i[c]=u,d.minimumByComponent(r,u,r),d.maximumByComponent(s,u,s)}const a=n.runtimeNode;return a.instancingTranslationMin=r,a.instancingTranslationMax=s,e.typedArray=void 0,i}function RB(e,t){const n=At.createVertexBuffer({context:t.context,typedArray:e,usage:Ze.STATIC_DRAW});return n.vertexArrayDestroyable=!1,n}function a9e(e,t,n,i,o){const r=$t.getAttributeBySemantic(n,ks.ROTATION);l(r)?c9e(e,n,i,t,o):l9e(e,n,i,t,o)}function c9e(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 f,h=c.instancingTransformsBuffer;if(!l(h)){f=fK(t,s,e);const y=BB(f);h=RB(y,i),a._modelResources.push(h),c.instancingTransformsBuffer=h}if(D4(e,h,n,u),!o)return;const _=ut(i);_.mode=le.COLUMBUS_VIEW,uK(e,_);let g=c.instancingTransformsBuffer2D;if(!l(g)){const y=t9e(f,e,_,f),C=BB(y);g=RB(C,i),a._modelResources.push(g),c.instancingTransformsBuffer2D=g}D4(e,g,n,"Transform2D")}function l9e(e,t,n,i,o){const r=e.shaderBuilder,s=e.runtimeNode,a=$t.getAttributeBySemantic(t,ks.TRANSLATION),c=$t.getAttributeBySemantic(t,ks.SCALE);if(l(c)){r.addDefine("HAS_INSTANCE_SCALE");const T="Scale";mO(e,c.buffer,c.byteOffset,c.byteStride,n,T)}if(!l(a))return;let u;const f=a.typedArray;l(f)?u=s9e(a,a.count,e):l(s.instancingTranslationMin)||(s.instancingTranslationMin=a.min,s.instancingTranslationMax=a.max),r.addDefine("HAS_INSTANCE_TRANSLATION");const h="Translation";if(mO(e,a.buffer,a.byteOffset,a.byteStride,n,h),!o)return;const _=ut(i);_.mode=le.COLUMBUS_VIEW,uK(e,_);let g=s.instancingTranslationBuffer2D;if(!l(g)){const T=n9e(u,e,_,u),E=r9e(T);g=RB(E,i),e.model._modelResources.push(g),s.instancingTranslationBuffer2D=g}mO(e,g,0,void 0,n,"Translation2D")}function D4(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 mO(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 u9e(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===ks.FEATURE_ID&&(a.setIndex>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=a.setIndex+1),i.push({index:e.attributeIndex++,vertexBuffer:a.buffer,componentsPerAttribute:ln.getNumberOfComponents(a.type),componentDatatype:a.componentDatatype,normalize:!1,offsetInBytes:a.byteOffset,strideInBytes:a.byteStride,instanceDivisor:1}),r.addAttribute("float",`a_instanceFeatureId_${a.setIndex}`))}}const f9e=sK,tF={};tF.name="ModelMatrixUpdateStage";tF.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;dK(e,t,o,e.transformToRoot),e._transformDirty=!1}};function dK(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=$t.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),dK(a,t,n,i),a._transformDirty=!1}}const d9e=tF,hK={name:"NodeStatisticsPipelineStage",_countInstancingAttributes:pK,_countGeneratedBuffers:mK};hK.process=function(e,t,n){const i=e.model.statistics,o=t.instances,r=e.runtimeNode;pK(i,o),mK(i,r)};function pK(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 mK(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 h9e=hK;function g0(e){e=A(e,A.EMPTY_OBJECT);const t=e.node,n=e.transform,i=e.transformToRoot,o=e.sceneGraph,r=e.children;b.typeOf.object("options.node",t),b.typeOf.object("options.transform",n),b.typeOf.object("options.transformToRoot",i),b.typeOf.object("options.sceneGraph",o),b.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,p9e(this)}Object.defineProperties(g0.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;d.equals(n,e)||(t.translation=d.clone(e,t.translation),_O(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;Ce.equals(n,e)||(t.rotation=Ce.clone(e,t.rotation),_O(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;d.equals(n,e)||(t.scale=d.clone(e,t.scale),_O(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 p9e(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 Xv(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 _O(e,t){e._transformDirty=!0,e._transform=B.fromTranslationRotationScale(t,e._transform)}g0.prototype.getChild=function(e){if(b.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]]};g0.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(f9e),t.push(h9e),n.push(d9e)};g0.prototype.updateComputedTransform=function(){this._computedTransform=B.multiply(this._transformToRoot,this._transform,this._computedTransform)};g0.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 _K={name:"AlphaPipelineStage"};_K.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===Be.TRANSLUCENT&&(r.cull.enabled=!1,r.depthMask=!1,r.blending=Ii.ALPHA_BLEND);const s=e.shaderBuilder,a=e.uniformMap;l(i.alphaCutoff)&&(s.addDefine("ALPHA_MODE_MASK",void 0,we.FRAGMENT),s.addUniform("float","u_alphaCutoff",we.FRAGMENT),a.u_alphaCutoff=function(){return i.alphaCutoff})};const m9e=_K,gK={name:"BatchTexturePipelineStage"};gK.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=sn(o,e.uniformMap)};const _9e=gK,yK={name:"ClassificationPipelineStage"};yK.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_CLASSIFICATION",void 0,we.BOTH);const o=e.runtimePrimitive;l(o.batchLengths)||g9e(t,o)};function g9e(e,t){const n=$t.getAttributeBySemantic(e,bt.POSITION);if(!l(n))throw new Se("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=$t.getAttributeBySemantic(e,bt.FEATURE_ID,0);if(!l(a)){t.batchLengths=[s],t.batchOffsets=[0];return}const c=a.typedArray;a.typedArray=void 0;const u=[],f=[0],h=r?i[0]:0;let _=c[h],g=0;for(let y=1;y<s;y++){const C=r?i[y]:y,T=c[C];if(T!==_){const E=y-g,w=y;u.push(E),f.push(w),g=w,_=T}}const p=s-g;u.push(p),t.batchLengths=u,t.batchOffsets=f}const y9e=yK,A9e=`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
}
`,C9e=`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;
}
`,AK={name:"CPUStylingPipelineStage"};AK.process=function(e,t,n){const i=e.model,o=e.shaderBuilder;o.addVertexLines(A9e),o.addFragmentLines(C9e),o.addDefine("USE_CPU_STYLING",void 0,we.BOTH),l(i.color)||(o.addUniform("float",LB.COLOR_BLEND_UNIFORM_NAME,we.FRAGMENT),e.uniformMap[LB.COLOR_BLEND_UNIFORM_NAME]=function(){return iD.getColorBlend(i.colorBlendMode,i.colorBlendAmount)}),o.addUniform("bool","model_commandTranslucent",we.BOTH),e.uniformMap.model_commandTranslucent=function(){return e.alphaOptions.pass===Be.TRANSLUCENT}};const T9e=AK,CK={MODIFY_MATERIAL:"MODIFY_MATERIAL",REPLACE_MATERIAL:"REPLACE_MATERIAL"};CK.getDefineName=function(e){return`CUSTOM_SHADER_${e}`};const nF=Object.freeze(CK),b9e=`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;
}
`,E9e=`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);
}
`,x9e=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
}
`,w9e=`void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes)
{
initializeFeatureIds(featureIds, attributes);
initializeFeatureIdAliases(featureIds);
setFeatureIdVaryings();
}
`,Qn={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()"};Qn.process=function(e,t,n){const i=e.shaderBuilder;S9e(i);const o=e.runtimeNode.node.instances;l(o)&&v9e(e,o,n),D9e(e,t,n),i.addVertexLines(w9e),i.addFragmentLines(x9e)};function S9e(e){e.addStruct(Qn.STRUCT_ID_FEATURE_IDS_VS,Qn.STRUCT_NAME_FEATURE_IDS,we.VERTEX),e.addStruct(Qn.STRUCT_ID_FEATURE_IDS_FS,Qn.STRUCT_NAME_FEATURE_IDS,we.FRAGMENT),e.addFunction(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,Qn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,we.VERTEX),e.addFunction(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,Qn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,we.FRAGMENT),e.addFunction(Qn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,Qn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,we.VERTEX),e.addFunction(Qn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,Qn.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,we.FRAGMENT),e.addFunction(Qn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,Qn.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,we.VERTEX)}function v9e(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 vt.FeatureIdAttribute?I9e(e,s,a):TK(e,s,a,o,1,n);const c=s.label;l(c)&&bK(e,a,c,we.BOTH)}}function D9e(e,t,n){const i=t.featureIds,r=$t.getAttributeBySemantic(t,bt.POSITION).count;for(let s=0;s<i.length;s++){const a=i[s],c=a.positionalLabel;let u=we.BOTH;a instanceof vt.FeatureIdAttribute?P9e(e,a,c):a instanceof vt.FeatureIdImplicitRange?TK(e,a,c,r,void 0,n):(O9e(e,a,c,s,n),u=we.FRAGMENT);const f=a.label;l(f)&&bK(e,c,f,u)}}function I9e(e,t,n){const i=e.shaderBuilder;i.addStructField(Qn.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Qn.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(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[c]),i.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[u]),i.addVarying("float",a),i.addFunctionLines(Qn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${a} = ${s};`])}function P9e(e,t,n){const i=e.shaderBuilder;i.addStructField(Qn.STRUCT_ID_FEATURE_IDS_VS,"int",n),i.addStructField(Qn.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(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,s),i.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,s)}function TK(e,t,n,i,o,r){L9e(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(Qn.STRUCT_ID_FEATURE_IDS_VS,"int",n),s.addStructField(Qn.STRUCT_ID_FEATURE_IDS_FS,"int",n),s.addFunctionLines(Qn.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,[`${c} = ${a};`]),s.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,[`featureIds.${n} = int(czm_round(${a}));`]),s.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[`featureIds.${n} = int(czm_round(${c}));`])}function O9e(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(Qn.STRUCT_ID_FEATURE_IDS_FS,"int",n),u.addUniform("sampler2D",r,we.FRAGMENT);const f=`v_texCoord_${a.texCoord}`,h=`texture2D(${r}, ${f}).${c}`,_=`featureIds.${n} = czm_unpackUint(${h});`;u.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,[_])}function bK(e,t,n,i){const o=e.shaderBuilder,r=we.includesVertexShader(i);r&&o.addStructField(Qn.STRUCT_ID_FEATURE_IDS_VS,"int",n),o.addStructField(Qn.STRUCT_ID_FEATURE_IDS_FS,"int",n);const s=[`featureIds.${n} = featureIds.${t};`];r&&o.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,s),o.addFunctionLines(Qn.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,s)}function L9e(e,t,n,i,o){const r=e.model;let s,a;if(l(t.repeat)){const u=B9e(t,n);s=At.createVertexBuffer({context:o.context,typedArray:u,usage:Ze.STATIC_DRAW}),s.vertexArrayDestroyable=!1,r._pipelineResources.push(s);const f=!1;r.statistics.addBuffer(s,f)}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 B9e(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 iF=Qn,R9e=`void metadataStage(
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
}
`,N9e=`void metadataStage(
out Metadata metadata,
out MetadataClass metadataClass,
out MetadataStatistics metadataStatistics,
ProcessedAttributes attributes
)
{
initializeMetadata(metadata, metadataClass, metadataStatistics, attributes);
setMetadataVaryings();
}
`,jn={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"}]};jn.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=M9e(r.propertyAttributes,t,a),u=z9e(r.propertyTextures,a),f=c.concat(u);H9e(i,f),G9e(i),i.addVertexLines(N9e),i.addFragmentLines(R9e);for(let _=0;_<c.length;_++){const g=c[_];W9e(e,g)}for(let _=0;_<u.length;_++){const g=u[_];q9e(e,g)}};function M9e(e,t,n){return l(e)?e.flatMap(i=>F9e(i,t,n)):[]}function F9e(e,t,n){const{getAttributeByName:i,getAttributeInfo:o,sanitizeGlslIdentifier:r}=$t,s=e.class.id,a=n==null?void 0:n.classes[s],c=Object.entries(e.properties),u=new Array(c.length);for(let f=0;f<c.length;f++){const[h,_]=c[f],g=i(t,_.attribute),{glslType:p,variableName:y}=o(g);u[f]={metadataVariable:r(h),property:_,type:_.classProperty.type,glslType:p,variableName:y,propertyStatistics:a==null?void 0:a.properties[h],shaderDestination:we.BOTH}}return u}function z9e(e,t){return l(e)?e.flatMap(n=>U9e(n,t)):[]}function U9e(e,t){const{sanitizeGlslIdentifier:n}=$t,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:we.FRAGMENT}}return s}function H9e(e,t){const n=new Set,i=new Set;for(let a=0;a<t.length;a++){const{type:c,glslType:u,propertyStatistics:f}=t[a];n.add(u),l(f)&&c!==It.ENUM&&i.add(u)}const o=jn.METADATA_CLASS_FIELDS;for(const a of n){const c=`${a}MetadataClass`;s(c,a,o)}const r=jn.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,we.BOTH);for(let f=0;f<u.length;f++){const{shaderName:h}=u[f],_=u[f].type==="float"?k9e(c):c;e.addStructField(a,_,h)}}}const V9e={int:"float",ivec2:"vec2",ivec3:"vec3",ivec4:"vec4"};function k9e(e){const t=V9e[e];return l(t)?t:e}function G9e(e){e.addStruct(jn.STRUCT_ID_METADATA_VS,jn.STRUCT_NAME_METADATA,we.VERTEX),e.addStruct(jn.STRUCT_ID_METADATA_FS,jn.STRUCT_NAME_METADATA,we.FRAGMENT),e.addStruct(jn.STRUCT_ID_METADATA_CLASS_VS,jn.STRUCT_NAME_METADATA_CLASS,we.VERTEX),e.addStruct(jn.STRUCT_ID_METADATA_CLASS_FS,jn.STRUCT_NAME_METADATA_CLASS,we.FRAGMENT),e.addStruct(jn.STRUCT_ID_METADATA_STATISTICS_VS,jn.STRUCT_NAME_METADATA_STATISTICS,we.VERTEX),e.addStruct(jn.STRUCT_ID_METADATA_STATISTICS_FS,jn.STRUCT_NAME_METADATA_STATISTICS,we.FRAGMENT),e.addFunction(jn.FUNCTION_ID_INITIALIZE_METADATA_VS,jn.FUNCTION_SIGNATURE_INITIALIZE_METADATA,we.VERTEX),e.addFunction(jn.FUNCTION_ID_INITIALIZE_METADATA_FS,jn.FUNCTION_SIGNATURE_INITIALIZE_METADATA,we.FRAGMENT),e.addFunction(jn.FUNCTION_ID_SET_METADATA_VARYINGS,jn.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,we.VERTEX)}function W9e(e,t){j9e(e,t),EK(e.shaderBuilder,t),xK(e.shaderBuilder,t)}function j9e(e,t){const{shaderBuilder:n}=e,{metadataVariable:i,property:o,glslType:r}=t,s=SK({valueExpression:`attributes.${t.variableName}`,renderResources:e,glslType:r,metadataVariable:i,shaderDestination:we.BOTH,property:o});n.addStructField(jn.STRUCT_ID_METADATA_VS,r,i),n.addStructField(jn.STRUCT_ID_METADATA_FS,r,i);const a=`metadata.${i} = ${s};`;n.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_VS,[a]),n.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_FS,[a])}function q9e(e,t){Y9e(e,t),EK(e.shaderBuilder,t),xK(e.shaderBuilder,t)}function Y9e(e,t){const{shaderBuilder:n,uniformMap:i}=e,{metadataVariable:o,glslType:r,property:s}=t,{texCoord:a,channels:c,index:u,texture:f}=s.textureReader,h=`u_propertyTexture_${u}`;i.hasOwnProperty(h)||(n.addUniform("sampler2D",h,we.FRAGMENT),i[h]=()=>f),n.addStructField(jn.STRUCT_ID_METADATA_FS,r,o);const _=`attributes.texCoord_${a}`,g=`texture2D(${h}, ${_}).${c}`,p=s.unpackInShader(g),y=SK({valueExpression:p,renderResources:e,glslType:r,metadataVariable:o,shaderDestination:we.FRAGMENT,property:s}),C=`metadata.${o} = ${y};`;n.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_FS,[C])}function EK(e,t){const{classProperty:n}=t.property,{metadataVariable:i,glslType:o,shaderDestination:r}=t,s=wK(jn.METADATA_CLASS_FIELDS,n,`metadataClass.${i}`,o),a=`${o}MetadataClass`;e.addStructField(jn.STRUCT_ID_METADATA_CLASS_FS,a,i),e.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_FS,s),we.includesVertexShader(r)&&(e.addStructField(jn.STRUCT_ID_METADATA_CLASS_VS,a,i),e.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_VS,s))}function xK(e,t){const{propertyStatistics:n}=t;if(!l(n))return;const{metadataVariable:i,type:o,glslType:r}=t;if(o===It.ENUM)return;const s=jn.METADATA_STATISTICS_FIELDS,a=`metadataStatistics.${i}`,c=wK(s,n,a,r),u=`${r}MetadataStatistics`;e.addStructField(jn.STRUCT_ID_METADATA_STATISTICS_FS,u,i),e.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_FS,c),we.includesVertexShader(t.shaderDestination)&&(e.addStructField(jn.STRUCT_ID_METADATA_STATISTICS_VS,u,i),e.addFunctionLines(jn.FUNCTION_ID_INITIALIZE_METADATA_VS,c))}function wK(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 SK(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:f,scale:h}=n;return a[o]=()=>f,a[r]=()=>h,`czm_valueTransform(${o}, ${r}, ${t})`}const Wm=jn,$9e={INHERIT:0,OPAQUE:1,TRANSLUCENT:2},NB=Object.freeze($9e),Xr={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:Di};Xr.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===NB.TRANSLUCENT?r.pass=Be.TRANSLUCENT:o.translucencyMode===NB.OPAQUE&&(r.pass=void 0);const s=nWe(o,t);if(!s.customShaderEnabled)return;if(sWe(i,o,s),s.shouldComputePositionWC&&i.addDefine("COMPUTE_POSITION_WC_CUSTOM_SHADER",void 0,we.BOTH),l(o.vertexShaderText)&&i.addDefine("HAS_CUSTOM_VERTEX_SHADER",void 0,we.VERTEX),l(o.fragmentShaderText)){i.addDefine("HAS_CUSTOM_FRAGMENT_SHADER",void 0,we.FRAGMENT);const u=nF.getDefineName(o.mode);i.addDefine(u,void 0,we.FRAGMENT)}const a=o.uniforms;for(const u in a)if(a.hasOwnProperty(u)){const f=a[u];i.addUniform(f.type,u)}const c=o.varyings;for(const u in c)if(c.hasOwnProperty(u)){const f=c[u];i.addVarying(f,u)}e.uniformMap=sn(e.uniformMap,o.uniformMap)};function X9e(e){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=$t.getAttributeInfo(i);t[o.variableName]=o}return t}const K9e={position:"vec3",normal:"vec3",tangent:"vec3",bitangent:"vec3",texCoord:"vec2",color:"vec4",joints:"ivec4",weights:"vec4"},J9e={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 vK(e){let t=e.replace(/_[0-9]+$/,"");t=t.replace(/(MC|EC)$/,"");const n=K9e[t],i=J9e[t];if(l(n))return{attributeField:[n,e],value:i}}function Q9e(e,t,n){const i=DK(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 f=0;f<r.length;f++){s=r[f];const h=vK(s);if(!l(h)){Xr._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 Z9e(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 eWe(e,t,n){const i=DK(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 _=[o[s].glslType,s];c.push(_),a=`fsInput.attributes.${s} = attributes.${s};`,u.push(a)}for(let h=0;h<r.length;h++){s=r[h];const _=vK(s);if(!l(_)){Xr._oneTimeWarning("CustomShaderPipelineStage.incompatiblePrimitiveFS",`Primitive is missing attribute ${s}, disabling custom fragment shader.`);return}c.push(_.attributeField),a=`fsInput.attributes.${s} = ${_.value};`,u.push(a)}const f=Z9e(e);n.enabled=!0,n.attributeFields=c.concat(f.attributeFields),n.initializationLines=f.initializationLines.concat(u)}const tWe={positionWC:!0,positionEC:!0};function DK(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(tWe.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 nWe(e,t){const n={enabled:!1},i={enabled:!1},o=X9e(t.attributes);l(e.vertexShaderText)&&Q9e(e,o,n),l(e.fragmentShaderText)&&eWe(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 iWe(e,t){let n,i=Xr.STRUCT_ID_ATTRIBUTES_VS;e.addStruct(i,Xr.STRUCT_NAME_ATTRIBUTES,we.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=Xr.STRUCT_ID_VERTEX_INPUT,e.addStruct(i,Xr.STRUCT_NAME_VERTEX_INPUT,we.VERTEX),e.addStructField(i,Xr.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,iF.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,Wm.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,Wm.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,Wm.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const r=Xr.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;e.addFunction(r,Xr.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,we.VERTEX);const s=t.initializationLines;e.addFunctionLines(r,s)}function oWe(e,t){let n,i=Xr.STRUCT_ID_ATTRIBUTES_FS;e.addStruct(i,Xr.STRUCT_NAME_ATTRIBUTES,we.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=Xr.STRUCT_ID_FRAGMENT_INPUT,e.addStruct(i,Xr.STRUCT_NAME_FRAGMENT_INPUT,we.FRAGMENT),e.addStructField(i,Xr.STRUCT_NAME_ATTRIBUTES,"attributes"),e.addStructField(i,iF.STRUCT_NAME_FEATURE_IDS,"featureIds"),e.addStructField(i,Wm.STRUCT_NAME_METADATA,"metadata"),e.addStructField(i,Wm.STRUCT_NAME_METADATA_CLASS,"metadataClass"),e.addStructField(i,Wm.STRUCT_NAME_METADATA_STATISTICS,"metadataStatistics");const c=Xr.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;e.addFunction(c,Xr.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,we.FRAGMENT);const u=t.initializationLines;e.addFunctionLines(c,u)}const rWe=[];function sWe(e,t,n){const i=n.vertexLines,o=rWe;i.enabled&&(iWe(e,i),o.length=0,o.push("#line 0",t.vertexShaderText,b9e),e.addVertexLines(o));const r=n.fragmentLines;r.enabled&&(oWe(e,r),o.length=0,o.push("#line 0",t.fragmentShaderText,E9e),e.addFragmentLines(o))}const aWe=Xr,_C={name:"DequantizationPipelineStage",FUNCTION_ID_DEQUANTIZATION_STAGE_VS:"dequantizationStage",FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS:"void dequantizationStage(inout ProcessedAttributes attributes)"};_C.process=function(e,t,n){const i=e.shaderBuilder,o=e.model,r=l(o.classificationType);i.addDefine("USE_DEQUANTIZATION",void 0,we.VERTEX),i.addFunction(_C.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,_C.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,we.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 f=c.semantic===bt.POSITION,h=c.semantic===bt.TEXCOORD;if(r&&!f&&!h)continue;const _=$t.getAttributeInfo(c);lWe(i,_),cWe(e,_)}};function cWe(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,we.VERTEX),i[s]=function(){return r.normalizationRange}}else{const s=`model_quantizedVolumeOffset_${o}`,a=`model_quantizedVolumeStepSize_${o}`,c=t.glslType;n.addUniform(c,s,we.VERTEX),n.addUniform(c,a,we.VERTEX);let u=r.quantizedVolumeOffset,f=r.quantizedVolumeStepSize;/^color_\d+$/.test(o)&&(u=I4(u,0),f=I4(f,1)),i[s]=function(){return u},i[a]=function(){return f}}}function I4(e,t){return e instanceof oe?e:new oe(e.x,e.y,e.z,t)}function lWe(e,t){const n=t.variableName,i=t.attribute.quantization;let o;i.octEncoded?o=uWe(n,i):o=fWe(n),e.addFunctionLines(_C.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,[o])}function uWe(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 fWe(e){const t=`attributes.${e}`,n=`a_quantized_${e}`,i=`model_quantizedVolumeOffset_${e}`,o=`model_quantizedVolumeStepSize_${e}`;return`${t} = ${i} + ${n} * ${o};`}const dWe=_C,hWe=`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);
}
`,pWe=`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;
}
`,P4=`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
}
`,gC={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)"};gC.process=function(e,t,n){const i=e.shaderBuilder;e.hasPropertyTable=!0;const o=e.model,r=e.runtimeNode.node,s=mWe(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),_We(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===we.BOTH&&i.addVertexLines(P4),i.addFragmentLines(P4)};function O4(e){return e instanceof vt.FeatureIdTexture?"HAS_SELECTED_FEATURE_ID_TEXTURE":"HAS_SELECTED_FEATURE_ID_ATTRIBUTE"}function L4(e){return e instanceof vt.FeatureIdTexture?we.FRAGMENT:we.BOTH}function mWe(e,t,n){let i,o;return l(t.instances)&&(o=$t.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(o))?(i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:L4(o),featureIdDefine:O4(o)}):(o=$t.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),i=A(o.label,o.positionalLabel),{featureIds:o,variableName:i,shaderDestination:L4(o),featureIdDefine:O4(o)})}function _We(e){e.addStructField(gC.STRUCT_ID_SELECTED_FEATURE,"int","id"),e.addStructField(gC.STRUCT_ID_SELECTED_FEATURE,"vec2","st"),e.addStructField(gC.STRUCT_ID_SELECTED_FEATURE,"vec4","color")}const MB=gC,Lr={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)"};Lr.process=function(e,t,n){const i=e.shaderBuilder,o=e.model;i.addStruct(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"ProcessedAttributes",we.VERTEX),i.addStruct(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"ProcessedAttributes",we.FRAGMENT),i.addStruct(MB.STRUCT_ID_SELECTED_FEATURE,MB.STRUCT_NAME_SELECTED_FEATURE,we.BOTH),i.addFunction(Lr.FUNCTION_ID_INITIALIZE_ATTRIBUTES,Lr.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,we.VERTEX),i.addVarying("vec3","v_positionWC"),i.addVarying("vec3","v_positionEC"),i.addStructField(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionWC"),i.addStructField(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","positionEC"),i.addFunction(Lr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,Lr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,we.VERTEX),i.addFunction(Lr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,Lr.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,we.FRAGMENT),o.type===ta.TILE_PNTS&&i.addDefine("HAS_SRGB_COLOR",void 0,we.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 f=0;f<u;f++){const h=t.attributes[f],_=ln.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===bt.POSITION;let p;_>1?(p=e.attributeIndex,e.attributeIndex+=_):g&&!c?p=0:p=e.attributeIndex++,gWe(e,h,p,_,s,a)}SWe(i,t.attributes),t.primitiveType===Je.POINTS&&i.addDefine("PRIMITIVE_TYPE_POINTS"),i.addVertexLines(pWe),i.addFragmentLines(hWe)};function gWe(e,t,n,i,o,r){const s=e.shaderBuilder,a=$t.getAttributeInfo(t),c=o&&!r;i>1?CWe(e,t,n,i):AWe(e,t,n,c),bWe(s,a,c),TWe(s,a),l(t.semantic)&&yWe(s,t),EWe(s,a,o),xWe(s,a,c),wWe(s,a)}function yWe(e,t){const n=t.semantic,i=t.setIndex;switch(n){case bt.NORMAL:e.addDefine("HAS_NORMALS");break;case bt.TANGENT:e.addDefine("HAS_TANGENTS");break;case bt.FEATURE_ID:e.addDefine(`HAS${n}_${i}`);break;case bt.TEXCOORD:case bt.COLOR:e.addDefine(`HAS_${n}_${i}`)}}function AWe(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===bt.FEATURE_ID&&c>=e.featureIdVertexAttributeSetIndex&&(e.featureIdVertexAttributeSetIndex=c+1);const u=a===bt.POSITION,f=u?0:n,h=ln.getNumberOfComponents(r),_={index:f,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(_),!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 CWe(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=ln.getNumberOfComponents(r)/i,f=ee.getSizeInBytes(s),h=u*f,_=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:_,normalize:a};e.attributes.push(y)}}function TWe(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 bWe(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===bt.POSITION;a?e.setPositionAttribute(s,r):e.addAttribute(s,r),a&&n&&e.addAttribute("vec3","a_position2D")}function EWe(e,t,n){const i=Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,o=Lr.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 xWe(e,t,n){const i=Lr.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 wWe(e,t){const n=t.attribute.semantic,i=t.attribute.setIndex;if(l(n)&&!l(i))return;let o=Lr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;const r=t.variableName;let s=`v_${r} = attributes.${r};`;e.addFunctionLines(o,[s]),o=Lr.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,s=`attributes.${r} = v_${r};`,e.addFunctionLines(o,[s])}function SWe(e,t){let n=!1,i=!1;for(let o=0;o<t.length;o++){const r=t[o];r.semantic===bt.NORMAL?n=!0:r.semantic===bt.TANGENT&&(i=!0)}!n||!i||(e.addDefine("HAS_BITANGENTS"),e.addVarying("vec3","v_bitangentEC"),e.addStructField(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,"vec3","bitangentMC"),e.addStructField(Lr.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,"vec3","bitangentEC"))}const vWe=Lr,DWe=`#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;
}
`,IWe={UNLIT:0,PBR:1},NS=Object.freeze(IWe),IK={name:"LightingPipelineStage"};IK.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,we.FRAGMENT),o.addUniform("vec3","model_lightColorHdr",we.FRAGMENT);const s=e.uniformMap;s.model_lightColorHdr=function(){return n.lightColor}}i.lightingModel===NS.PBR?o.addDefine("LIGHTING_PBR",void 0,we.FRAGMENT):o.addDefine("LIGHTING_UNLIT",void 0,we.FRAGMENT),o.addFragmentLines(DWe)};const PWe=IK,OWe=`// 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
}
`,LWe=vt.Material,gO=vt.MetallicRoughness,yO=vt.SpecularGlossiness,PK={name:"MaterialPipelineStage",_processTexture:Jh,_processTextureTransform:OK};PK.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,f=n.context.defaultNormalTexture,h=n.context.defaultEmissiveTexture;BWe(i,a,c,u,f,h,s),l(i.specularGlossiness)?RWe(i,a,c,u,s):NWe(i,a,c,u,s);const _=$t.getAttributeBySemantic(t,bt.NORMAL),g=e.lightingOptions;i.unlit||!_||r?g.lightingModel=NS.UNLIT:g.lightingModel=NS.PBR;const p=o.backFaceCulling&&!i.doubleSided;e.renderStateOptions.cull.enabled=p;const y=e.alphaOptions;i.alphaMode===DS.BLEND?y.pass=Be.TRANSLUCENT:i.alphaMode===DS.MASK&&(y.alphaCutoff=i.alphaCutoff),c.addFragmentLines(OWe),i.doubleSided&&c.addDefine("HAS_DOUBLE_SIDED_MATERIAL",void 0,we.BOTH)};function OK(e,t,n,i,o){const r=`HAS_${o}_TEXTURE_TRANSFORM`;e.addDefine(r,void 0,we.FRAGMENT);const s=`${i}Transform`;e.addUniform("mat3",s,we.FRAGMENT),t[s]=function(){return n.transform}}function Jh(e,t,n,i,o,r){e.addUniform("sampler2D",i,we.FRAGMENT),t[i]=function(){return A(n.texture,r)};const s=`HAS_${o}_TEXTURE`;e.addDefine(s,void 0,we.FRAGMENT);const c=`v_texCoord_${n.texCoord}`,u=`TEXCOORD_${o}`;e.addDefine(u,c,we.FRAGMENT);const f=n.transform;l(f)&&!J.equals(f,J.IDENTITY)&&OK(e,t,n,i,o)}function BWe(e,t,n,i,o,r,s){const a=e.emissiveTexture;l(a)&&!s&&Jh(n,t,a,"u_emissiveTexture","EMISSIVE",r);const c=e.emissiveFactor;l(c)&&!d.equals(c,LWe.DEFAULT_EMISSIVE_FACTOR)&&(n.addUniform("vec3","u_emissiveFactor",we.FRAGMENT),t.u_emissiveFactor=function(){return e.emissiveFactor},n.addDefine("HAS_EMISSIVE_FACTOR",void 0,we.FRAGMENT));const u=e.normalTexture;l(u)&&!s&&Jh(n,t,u,"u_normalTexture","NORMAL",o);const f=e.occlusionTexture;l(f)&&!s&&Jh(n,t,f,"u_occlusionTexture","OCCLUSION",i)}function RWe(e,t,n,i,o){const r=e.specularGlossiness;n.addDefine("USE_SPECULAR_GLOSSINESS",void 0,we.FRAGMENT);const s=r.diffuseTexture;l(s)&&!o&&Jh(n,t,s,"u_diffuseTexture","DIFFUSE",i);const a=r.diffuseFactor;l(a)&&!oe.equals(a,yO.DEFAULT_DIFFUSE_FACTOR)&&(n.addUniform("vec4","u_diffuseFactor",we.FRAGMENT),t.u_diffuseFactor=function(){return r.diffuseFactor},n.addDefine("HAS_DIFFUSE_FACTOR",void 0,we.FRAGMENT));const c=r.specularGlossinessTexture;l(c)&&!o&&Jh(n,t,c,"u_specularGlossinessTexture","SPECULAR_GLOSSINESS",i);const u=r.specularFactor;l(u)&&!d.equals(u,yO.DEFAULT_SPECULAR_FACTOR)&&(n.addUniform("vec3","u_specularFactor",we.FRAGMENT),t.u_specularFactor=function(){return r.specularFactor},n.addDefine("HAS_SPECULAR_FACTOR",void 0,we.FRAGMENT));const f=r.glossinessFactor;l(f)&&f!==yO.DEFAULT_GLOSSINESS_FACTOR&&(n.addUniform("float","u_glossinessFactor",we.FRAGMENT),t.u_glossinessFactor=function(){return r.glossinessFactor},n.addDefine("HAS_GLOSSINESS_FACTOR",void 0,we.FRAGMENT))}function NWe(e,t,n,i,o){const r=e.metallicRoughness;n.addDefine("USE_METALLIC_ROUGHNESS",void 0,we.FRAGMENT);const s=r.baseColorTexture;l(s)&&!o&&Jh(n,t,s,"u_baseColorTexture","BASE_COLOR",i);const a=r.baseColorFactor;l(a)&&!oe.equals(a,gO.DEFAULT_BASE_COLOR_FACTOR)&&(n.addUniform("vec4","u_baseColorFactor",we.FRAGMENT),t.u_baseColorFactor=function(){return r.baseColorFactor},n.addDefine("HAS_BASE_COLOR_FACTOR",void 0,we.FRAGMENT));const c=r.metallicRoughnessTexture;l(c)&&!o&&Jh(n,t,c,"u_metallicRoughnessTexture","METALLIC_ROUGHNESS",i);const u=r.metallicFactor;l(u)&&u!==gO.DEFAULT_METALLIC_FACTOR&&(n.addUniform("float","u_metallicFactor",we.FRAGMENT),t.u_metallicFactor=function(){return r.metallicFactor},n.addDefine("HAS_METALLIC_FACTOR",void 0,we.FRAGMENT));const f=r.roughnessFactor;l(f)&&f!==gO.DEFAULT_ROUGHNESS_FACTOR&&(n.addUniform("float","u_roughnessFactor",we.FRAGMENT),t.u_roughnessFactor=function(){return r.roughnessFactor},n.addDefine("HAS_ROUGHNESS_FACTOR",void 0,we.FRAGMENT))}const MWe=PK,FWe=`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
}`,ds={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)"};ds.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_MORPH_TARGETS",void 0,we.VERTEX),GWe(n);const i=t.morphTargets.length;for(let a=0;a<i;a++){const c=t.morphTargets[a].attributes,u=c.length;for(let f=0;f<u;f++){const h=c[f],_=h.semantic;_!==bt.POSITION&&_!==bt.NORMAL&&_!==bt.TANGENT||(UWe(e,h,e.attributeIndex,a),e.attributeIndex++)}}WWe(n);const r=e.runtimeNode.morphWeights.length;n.addUniform("float",`u_morphWeights[${r}]`,we.VERTEX),n.addVertexLines(FWe);const s={u_morphWeights:function(){return e.runtimeNode.morphWeights}};e.uniformMap=sn(s,e.uniformMap)};const zWe={attributeString:void 0,functionId:void 0};function UWe(e,t,n,i){const o=e.shaderBuilder;HWe(e,t,n);const r=VWe(t,zWe);kWe(o,r,i)}function HWe(e,t,n){const i={index:n,value:l(t.buffer)?void 0:t.constant,vertexBuffer:t.buffer,componentsPerAttribute:ln.getNumberOfComponents(t.type),componentDatatype:t.componentDatatype,offsetInBytes:t.byteOffset,strideInBytes:t.byteStride,normalize:t.normalized};e.attributes.push(i)}function VWe(e,t){switch(e.semantic){case bt.POSITION:t.attributeString="Position",t.functionId=ds.FUNCTION_ID_GET_MORPHED_POSITION;break;case bt.NORMAL:t.attributeString="Normal",t.functionId=ds.FUNCTION_ID_GET_MORPHED_NORMAL;break;case bt.TANGENT:t.attributeString="Tangent",t.functionId=ds.FUNCTION_ID_GET_MORPHED_TANGENT;break}return t}function kWe(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 GWe(e){e.addFunction(ds.FUNCTION_ID_GET_MORPHED_POSITION,ds.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,we.VERTEX);const t="vec3 morphedPosition = position;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_POSITION,[t]),e.addFunction(ds.FUNCTION_ID_GET_MORPHED_NORMAL,ds.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,we.VERTEX);const n="vec3 morphedNormal = normal;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_NORMAL,[n]),e.addFunction(ds.FUNCTION_ID_GET_MORPHED_TANGENT,ds.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,we.VERTEX);const i="vec3 morphedTangent = tangent;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}function WWe(e){const t="return morphedPosition;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_POSITION,[t]);const n="return morphedNormal;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_NORMAL,[n]);const i="return morphedTangent;";e.addFunctionLines(ds.FUNCTION_ID_GET_MORPHED_TANGENT,[i])}const jWe=ds,LK={name:"PickingPipelineStage"};LK.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)qWe(e,t,a);else if(l(a))YWe(e,i);else{const c=BK(e),u=i.createPickId(c);s._pipelineResources.push(u),s._pickIds.push(u),r.addUniform("vec4","czm_pickColor",we.FRAGMENT);const f=e.uniformMap;f.czm_pickColor=function(){return u.color},e.pickId="czm_pickColor"}};function BK(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(ta.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 qWe(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=$t.getFeatureIdsByLabel(n.featureIds,a),o=r.propertyTableId):(r=$t.getFeatureIdsByLabel(t.featureIds,s),o=r.propertyTableId);const c=i.featureTables[o];e.shaderBuilder.addUniform("sampler2D","model_pickTexture",we.FRAGMENT);const f=c.batchTexture;e.uniformMap.model_pickTexture=function(){return A(f.pickTexture,f.defaultTexture)},e.pickId="((selectedFeature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, selectedFeature.st) : vec4(0.0))"}function YWe(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 _=BK(e,h),g=t.createPickId(_);s.push(g),i[h]=g;const p=g.color;o[h*4+0]=U.floatToByte(p.red),o[h*4+1]=U.floatToByte(p.green),o[h*4+2]=U.floatToByte(p.blue),o[h*4+3]=U.floatToByte(p.alpha)}r._pickIds=i;const a=At.createVertexBuffer({context:t,typedArray:o,usage:Ze.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 f=e.shaderBuilder;f.addDefine("USE_PICKING",void 0,we.BOTH),f.addAttribute("vec4","a_pickColor"),f.addVarying("vec4","v_pickColor"),e.pickId="v_pickColor"}const $We=LK,XWe=`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`,KWe=new oe,RK={name:"PointCloudStylingPipelineStage"};RK.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=eje(a),C=tje(r,y);nje(i,C);const E=ije(C).indexOf("normalMC")>=0,w=$t.getAttributeBySemantic(t,bt.NORMAL);if(E&&!w)throw new Se("Style references the NORMAL semantic but the point cloud does not have normals");i.addDefine("COMPUTE_POSITION_WC_STYLE",void 0,we.VERTEX),C.styleTranslucent&&(e.alphaOptions.pass=Be.TRANSLUCENT)}const f=o.pointCloudShading;f.attenuation&&i.addDefine("HAS_POINT_CLOUD_ATTENUATION",void 0,we.VERTEX),f.backFaceCulling&&i.addDefine("HAS_POINT_CLOUD_BACK_FACE_CULLING",void 0,we.VERTEX);let h,_,g;ta.is3DTiles(o.type)&&(_=!0,h=o.content,g=h.tile.refine===Aa.ADD),i.addUniform("vec4","model_pointCloudParameters",we.VERTEX),i.addVertexLines(XWe);const p=e.uniformMap;p.model_pointCloudParameters=function(){const y=KWe;let C=1;_&&(C=g?5:h.tileset.maximumScreenSpaceError),y.x=A(f.maximumAttenuation,C),y.x*=n.pixelRatio;const T=JWe(e,t,f,h);y.y=T*f.geometricErrorScale;const E=n.context,w=n.camera.frustum;let S;return n.mode===le.SCENE2D||w instanceof Ft?S=Number.POSITIVE_INFINITY:S=E.drawingBufferHeight/n.camera.frustum.sseDenominator,y.z=S,_&&(y.w=h.tileset.timeSinceLoad),y}};const B4=new d;function JWe(e,t,n,i){if(l(i)){const f=i.tile.geometricError;if(f>0)return f}if(l(n.baseResolution))return n.baseResolution;const o=$t.getAttributeBySemantic(t,bt.POSITION),r=o.count,s=e.runtimeNode.transform;let a=d.subtract(o.max,o.min,B4);a=B.multiplyByPointAsVector(s,a,B4);const c=a.x*a.y*a.z;return N.cbrt(c/r)}const QWe={colorStyleFunction:void 0,showStyleFunction:void 0,pointSizeStyleFunction:void 0,styleTranslucent:!1},ZWe={POSITION:"attributes.positionMC",POSITION_ABSOLUTE:"v_positionWC",COLOR:"attributes.color_0",NORMAL:"attributes.normalMC"};function eje(e){const t=ut(ZWe);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 tje(e,t){const n=QWe,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 nje(e,t){const n=t.colorStyleFunction;l(n)&&(e.addDefine("HAS_POINT_CLOUD_COLOR_STYLE",void 0,we.BOTH),e.addVertexLines(n),e.addVarying("vec4","v_pointCloudColor"));const i=t.showStyleFunction;l(i)&&(e.addDefine("HAS_POINT_CLOUD_SHOW_STYLE",void 0,we.VERTEX),e.addVertexLines(i));const o=t.pointSizeStyleFunction;l(o)&&(e.addDefine("HAS_POINT_CLOUD_POINT_SIZE_STYLE",void 0,we.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 ije(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 oje=RK,rje=`void primitiveOutlineStage() {
v_outlineCoordinates = a_outlineCoordinates;
}
`,sje=`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);
}
`,NK={name:"PrimitiveOutlinePipelineStage"};NK.process=function(e,t,n){const i=e.shaderBuilder,o=e.uniformMap;i.addDefine("HAS_PRIMITIVE_OUTLINE",void 0,we.BOTH),i.addAttribute("vec3","a_outlineCoordinates"),i.addVarying("vec3","v_outlineCoordinates");const r=t.outlineCoordinates,s={index:e.attributeIndex++,vertexBuffer:r.buffer,componentsPerAttribute:ln.getNumberOfComponents(r.type),componentDatatype:r.componentDatatype,offsetInBytes:r.byteOffset,strideInBytes:r.byteStride,normalize:r.normalized};e.attributes.push(s),i.addUniform("sampler2D","model_outlineTexture",we.FRAGMENT);const a=nb.createTexture(n.context);o.model_outlineTexture=function(){return a};const c=e.model;i.addUniform("vec4","model_outlineColor",we.FRAGMENT),o.model_outlineColor=function(){return c.outlineColor},i.addUniform("bool","model_showOutline",we.FRAGMENT),o.model_showOutline=function(){return c.showOutline},i.addVertexLines(rje),i.addFragmentLines(sje)};const aje=NK,MK={name:"PrimitiveStatisticsPipelineStage",_countGeometry:FK,_count2DPositions:zK,_countMorphTargetAttributes:UK,_countMaterialTextures:HK,_countFeatureIdTextures:VK,_countBinaryMetadata:kK};MK.process=function(e,t,n){const i=e.model,o=i.statistics;FK(o,t),zK(o,e.runtimePrimitive),UK(o,t),HK(o,t.material),VK(o,t.featureIds),kK(o,i)};function FK(e,t){const n=l(t.indices)?t.indices.count:$t.getAttributeBySemantic(t,"POSITION").count,i=t.primitiveType;i===Je.POINTS?e.pointsLength+=n:Je.isTriangles(i)&&(e.trianglesLength+=cje(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 f=l(u.typedArray);e.addBuffer(u.buffer,f)}}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 cje(e,t){switch(e){case Je.TRIANGLES:return t/3;case Je.TRIANGLE_STRIP:case Je.TRIANGLE_FAN:return Math.max(t-2,0);default:return 0}}function zK(e,t){const n=t.positionBuffer2D;l(n)&&e.addBuffer(n,!0)}function UK(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 HK(e,t){const n=lje(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 lje(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 VK(e,t){const n=t.length;for(let i=0;i<n;i++){const o=t[i];if(o instanceof vt.FeatureIdTexture){const r=o.textureReader;l(r.texture)&&e.addTexture(r.texture)}}}function kK(e,t){const n=t.structuralMetadata;l(n)&&(uje(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 uje(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 fje=MK,dje=new B,hje=new B,GK={name:"SceneMode2DPipelineStage"};GK.process=function(e,t,n){const i=$t.getAttributeBySemantic(t,bt.POSITION),o=e.shaderBuilder,r=e.model,s=r.sceneGraph.computedModelMatrix,a=e.runtimeNode.computedTransform,c=B.multiplyTransformation(s,a,dje),u=_je(e,c,n),f=e.runtimePrimitive;f.boundingSphere2D=u;const h=e.runtimeNode.node.instances;if(l(h))return;if(l(i.typedArray)){const y=Aje(i,c,u,n);f.positionBuffer2D=y,r._modelResources.push(y),i.typedArray=void 0}o.addDefine("USE_2D_POSITIONS",void 0,we.VERTEX),o.addUniform("mat4","u_modelView2D",we.VERTEX);const _=B.fromTranslation(u.center,new B),g=n.context,p={u_modelView2D:function(){return B.multiplyTransformation(g.uniformState.view,_,hje)}};e.uniformMap=sn(p,e.uniformMap)};const pje=new d,mje=new d;function _je(e,t,n){const i=B.multiplyByPoint(t,e.positionMin,pje),o=lr.computeActualWgs84Position(n,i,i),r=B.multiplyByPoint(t,e.positionMax,mje),s=lr.computeActualWgs84Position(n,r,r);return fe.fromCornerPoints(o,s,new fe)}const WK=new d;function gje(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=d.fromArray(e,s,WK),c=d.multiplyComponents(a,r,a),u=d.add(c,o,c);i[s]=u.x,i[s+1]=u.y,i[s+2]=u.z}return i}function yje(e,t,n,i){let o;l(e.quantization)?o=gje(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=d.fromArray(o,c,WK);if(isNaN(u.x)||isNaN(u.y)||isNaN(u.z))continue;const f=B.multiplyByPoint(t,u,u),h=lr.computeActualWgs84Position(i,f,f),_=d.subtract(h,n,h);o[c]=_.x,o[c+1]=_.y,o[c+2]=_.z}return o}function Aje(e,t,n,i){const o=ut(i);o.mode=le.COLUMBUS_VIEW;const r=n.center,s=yje(e,t,r,o),a=At.createVertexBuffer({context:i.context,typedArray:s,usage:Ze.STATIC_DRAW});return a.vertexArrayDestroyable=!1,a}const Cje=GK,Tje=`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
}`,wm={name:"SkinningPipelineStage",FUNCTION_ID_GET_SKINNING_MATRIX:"getSkinningMatrix",FUNCTION_SIGNATURE_GET_SKINNING_MATRIX:"mat4 getSkinningMatrix()"};wm.process=function(e,t){const n=e.shaderBuilder;n.addDefine("HAS_SKINNING",void 0,we.VERTEX),Eje(n,t);const i=e.runtimeNode,o=i.computedJointMatrices;n.addUniform("mat4",`u_jointMatrices[${o.length}]`,we.VERTEX),n.addVertexLines(Tje);const r={u_jointMatrices:function(){return i.computedJointMatrices}};e.uniformMap=sn(r,e.uniformMap)};function bje(e){let t=-1;const n=e.attributes,i=n.length;for(let o=0;o<i;o++){const r=n[o];(r.semantic===bt.JOINTS||r.semantic===bt.WEIGHTS)&&(t=Math.max(t,r.setIndex))}return t}function Eje(e,t){e.addFunction(wm.FUNCTION_ID_GET_SKINNING_MATRIX,wm.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,we.VERTEX);const n="mat4 skinnedMatrix = mat4(0);";e.addFunctionLines(wm.FUNCTION_ID_GET_SKINNING_MATRIX,[n]);let i,o;const r=["x","y","z","w"],s=bje(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(wm.FUNCTION_ID_GET_SKINNING_MATRIX,[u])}const a="return skinnedMatrix;";e.addFunctionLines(wm.FUNCTION_ID_GET_SKINNING_MATRIX,[a])}const xje=wm,oF={};function wje(e){const t=it.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 Sje(e,t){const n=t.length,i=it.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 vje(e){const t=e-2,n=2+t*4,i=it.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 Dje(e,t){const i=t.length-2,o=2+i*4,r=it.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],f=t[a+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=c}return r}function Ije(e){const t=e-2,n=2+t*4,i=it.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 Pje(e,t){const i=t.length-2,o=2+i*4,r=it.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],f=t[c+2];r[s++]=u,r[s++]=f,r[s++]=f,r[s++]=a}return r}oF.createWireframeIndices=function(e,t,n){const i=l(n);if(e===Je.TRIANGLES)return i?Sje(t,n):wje(t);if(e===Je.TRIANGLE_STRIP)return i?Dje(t,n):vje(t);if(e===Je.TRIANGLE_FAN)return i?Pje(t,n):Ije(t)};oF.getWireframeIndicesCount=function(e,t){return e===Je.TRIANGLES?t*2:e===Je.TRIANGLE_STRIP||e===Je.TRIANGLE_FAN?2+(t-2)*4:t};const jK=oF,qK={name:"WireframePipelineStage"};qK.process=function(e,t,n){e.shaderBuilder.addDefine("HAS_WIREFRAME",void 0,we.FRAGMENT);const o=e.model,r=Oje(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=Je.LINES,e.count=jK.getWireframeIndicesCount(a,c)};function Oje(e,t,n){const o=$t.getAttributeBySemantic(e,bt.POSITION).count,r=n.context.webgl2;let s;if(l(t)){const f=t.buffer,h=t.count;l(f)&&r?(s=f.sizeInBytes===h?new Uint8Array(h):it.createTypedArray(o,h),f.getBufferData(s)):s=t.typedArray}const a=e.primitiveType,c=jK.createWireframeIndices(a,o,s),u=it.fromSizeInBytes(c.BYTES_PER_ELEMENT);return At.createIndexBuffer({context:n.context,typedArray:c,usage:Ze.STATIC_DRAW,indexDatatype:u})}const Lje=qK;function YK(e){e=A(e,A.EMPTY_OBJECT);const t=e.primitive,n=e.node,i=e.model;b.typeOf.object("options.primitive",t),b.typeOf.object("options.node",n),b.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=[]}YK.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,f=l(n.morphTargets)&&n.morphTargets.length>0,h=l(i.skin),_=l(r),p=!(_&&l(r.fragmentShaderText))||r.mode!==nF.REPLACE_MATERIAL,y=$t.hasQuantizedAttributes(n.attributes),C=o.debugWireframe&&Je.isTriangles(n.primitiveType)&&(o._enableDebugWireframe||a),T=o.pointCloudShading,E=l(T)&&T.attenuation,w=l(T)&&T.backFaceCulling,S=n.primitiveType===Je.POINTS&&(l(s)||E||w),P=o._enableShowOutline&&l(n.outlineCoordinates),O=Bje(o,i,n),z=l(o.classificationType);u&&t.push(Cje),t.push(vWe),C&&t.push(Lje),z&&t.push(y9e),f&&t.push(jWe),h&&t.push(xje),S&&t.push(oje),y&&t.push(dWe),p&&t.push(MWe),t.push(iF),t.push(Wm),O.hasPropertyTable&&(t.push(MB),t.push(_9e),t.push(T9e)),_&&t.push(aWe),t.push(PWe),o.allowPicking&&t.push($We),P&&t.push(aje),t.push(m9e),t.push(fje)};function Bje(e,t,n){let i;return l(t.instances)&&(i=$t.getFeatureIdsByLabel(t.instances.featureIds,e.instanceFeatureIdLabel),l(i))?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:(i=$t.getFeatureIdsByLabel(n.featureIds,e.featureIdLabel),l(i)?{hasFeatureIds:!0,hasPropertyTable:l(i.propertyTableId)}:{hasFeatureIds:!1,hasPropertyTable:!1})}function rF(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.skin",e.skin),b.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=[],Rje(this)}Object.defineProperties(rF.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 Rje(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,f=r[u];s.push(f);const h=n[c],_=$K(f,h,new B);a.push(_)}}function $K(e,t,n){const i=B.multiplyTransformation(e.transformToRoot,e.transform,n);return n=B.multiplyTransformation(i,t,n),n}rF.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]=$K(i,o,e[n])}};function Nje(){this.pass=void 0,this.alphaCutoff=void 0}function Mje(e){b.typeOf.object("model",e),this.shaderBuilder=new oa,this.model=e,this.uniformMap={},this.alphaOptions=new Nje,this.renderStateOptions=Qe.getState(Qe.fromCache({depthTest:{enabled:!0,func:Jm.LESS_OR_EQUAL}})),this.hasSilhouette=!1,this.hasSkipLevelOfDetail=!1}const Fje=`void silhouetteStage(inout vec4 color) {
if(model_silhouettePass) {
color = czm_gammaCorrect(model_silhouetteColor);
}
}`,zje=`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
}
`,MS={name:"ModelSilhouettePipelineStage"};MS.silhouettesLength=0;MS.process=function(e,t,n){l(t._silhouetteId)||(t._silhouetteId=++MS.silhouettesLength);const i=e.shaderBuilder;i.addDefine("HAS_SILHOUETTE",void 0,we.BOTH),i.addVertexLines(zje),i.addFragmentLines(Fje),i.addUniform("vec4","model_silhouetteColor",we.FRAGMENT),i.addUniform("float","model_silhouetteSize",we.VERTEX),i.addUniform("bool","model_silhouettePass",we.BOTH);const o={model_silhouetteColor:function(){return t.silhouetteColor},model_silhouetteSize:function(){return t.silhouetteSize},model_silhouettePass:function(){return!1}};e.uniformMap=sn(o,e.uniformMap),e.hasSilhouette=!0};const Uje=MS,Hje=`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
}
`,ww={name:"ModelSplitterPipelineStage",SPLIT_DIRECTION_UNIFORM_NAME:"model_splitDirection"};ww.process=function(e,t,n){const i=e.shaderBuilder;i.addDefine("HAS_MODEL_SPLITTER",void 0,we.FRAGMENT),i.addFragmentLines(Hje);const o={};i.addUniform("float",ww.SPLIT_DIRECTION_UNIFORM_NAME,we.FRAGMENT),o[ww.SPLIT_DIRECTION_UNIFORM_NAME]=function(){return t.splitDirection},e.uniformMap=sn(o,e.uniformMap)};const Vje=ww;function kje(e,t){b.typeOf.object("modelRenderResources",e),b.typeOf.object("runtimeNode",t),this.model=e.model,this.shaderBuilder=e.shaderBuilder.clone(),this.uniformMap=ut(e.uniformMap),this.alphaOptions=ut(e.alphaOptions),this.renderStateOptions=ut(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 Gje(e){e=A(e,A.EMPTY_OBJECT),this.lightingModel=A(e.lightingModel,NS.UNLIT)}function Wje(e,t){b.typeOf.object("nodeRenderResources",e),b.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=ut(e.uniformMap),this.alphaOptions=ut(e.alphaOptions),this.renderStateOptions=ut(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:$t.getAttributeBySemantic(n,"POSITION").count,this.hasPropertyTable=!1,this.indices=n.indices,this.wireframeIndexBuffer=void 0,this.primitiveType=n.primitiveType;const i=$t.getPositionMinMax(n,this.runtimeNode.instancingTranslationMin,this.runtimeNode.instancingTranslationMax);this.positionMin=d.clone(i.min,new d),this.positionMax=d.clone(i.max,new d),this.boundingSphere=fe.fromCornerPoints(this.positionMin,this.positionMax,new fe),this.lightingOptions=new Gje,this.pickId=void 0}function Ac(e){e=A(e,A.EMPTY_OBJECT);const t=e.modelComponents;b.typeOf.object("options.model",e.model),b.typeOf.object("options.modelComponents",t),this._model=e.model,this._components=t,this._pipelineStages=[],this._updateStages=[],this._runtimeNodes=[],this._rootNodes=[],this._skinnedNodes=[],this._runtimeSkins=[],this.modelPipelineStages=[],this._boundingSphere=void 0,this._boundingSphere2D=void 0,this._computedModelMatrix=B.clone(B.IDENTITY),this._computedModelMatrix2D=B.clone(B.IDENTITY),this._axisCorrectionMatrix=$t.getAxisCorrectionMatrix(t.upAxis,t.forwardAxis,new B),this._runtimeArticulations={},jje(this)}Object.defineProperties(Ac.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 jje(e){const t=e._components,n=t.scene,o=e._model.modelMatrix;XK(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 aD({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,_=B.IDENTITY;for(let E=0;E<h;E++){const w=n.nodes[E],S=KK(e,w,_);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 rF({skin:w,sceneGraph:e}))}const C=e._skinnedNodes,T=C.length;for(let E=0;E<T;E++){const w=C[E],S=e._runtimeNodes[w],O=c[w].skin.index;S._runtimeSkin=p[O],S.updateJointMatrices()}e.applyArticulations()}function XK(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 qje=new d;function Yje(e,t){const n=e._computedModelMatrix,i=B.getTranslation(n,qje);if(!d.equals(i,d.ZERO))e._computedModelMatrix2D=tn.basisTo2D(t.mapProjection,n,e._computedModelMatrix2D);else{const o=e.boundingSphere.center,r=tn.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 KK(e,t,n){const i=[],o=$t.getNodeTransform(t),r=t.children.length;for(let f=0;f<r;f++){const h=t.children[f],_=B.multiplyTransformation(n,o,new B),g=KK(e,h,_);i.push(g)}const s=new g0({node:t,transform:o,transformToRoot:n,children:i,sceneGraph:e}),a=t.primitives.length;for(let f=0;f<a;f++)s.runtimePrimitives.push(new YK({primitive:t.primitives[f],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 f=e._model,h=new rK(f,s);f._nodesByName[u]=h}return c}const $je=new d,Xje=new d,Kje=new d,Jje=new d;Ac.prototype.buildDrawCommands=function(e){const t=this._model,n=new Mje(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=d.fromElements(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,$je),c=d.fromElements(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,Xje);for(o=0;o<this._runtimeNodes.length;o++){const u=this._runtimeNodes[o];if(!l(u))continue;u.configurePipeline();const f=u.pipelineStages,h=new kje(n,u);for(r=0;r<f.length;r++)f[r].process(h,u.node,e);const _=u.computedTransform;for(r=0;r<u.runtimePrimitives.length;r++){const g=u.runtimePrimitives[r];g.configurePipeline(e);const p=g.pipelineStages,y=new Wje(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 C=B.multiplyByPoint(_,y.positionMin,Kje),T=B.multiplyByPoint(_,y.positionMax,Jje);d.minimumByComponent(a,C,a),d.maximumByComponent(c,T,c);const E=O6e(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};Ac.prototype.configurePipeline=function(e){const t=this.modelPipelineStages;t.length=0;const n=this._model;l(n.color)&&t.push(LB),!l(n.classificationType)&&(n.imageBasedLighting.enabled&&t.push(N6e),n.isClippingEnabled()&&t.push(W6e),n.hasSilhouette(e)&&t.push(Uje),l(n.splitDirection)&&n.splitDirection!==w_.NONE&&t.push(Vje),ta.is3DTiles(n.type)&&t.push(B6e))};Ac.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)}}};Ac.prototype.updateModelMatrix=function(e,t){XK(this,e),t.mode!==le.SCENE3D&&Yje(this,t);const n=this._rootNodes;for(let i=0;i<n.length;i++){const o=this._runtimeNodes[n[i]];o._transformDirty=!0}};Ac.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 JK(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);JK(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 cD(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];JK(e,c,t,n,i)}}const Qje={backFaceCulling:void 0};Ac.prototype.updateBackFaceCulling=function(e){const t=Qje;t.backFaceCulling=e,cD(this,!1,Zje,t)};function Zje(e,t){const n=e.drawCommand;n.backFaceCulling=t.backFaceCulling}const eqe={shadowMode:void 0};Ac.prototype.updateShadows=function(e){const t=eqe;t.shadowMode=e,cD(this,!1,tqe,t)};function tqe(e,t){const n=e.drawCommand;n.shadows=t.shadowMode}const nqe={debugShowBoundingVolume:void 0};Ac.prototype.updateShowBoundingVolume=function(e){const t=nqe;t.debugShowBoundingVolume=e,cD(this,!1,iqe,t)};function iqe(e,t){const n=e.drawCommand;n.debugShowBoundingVolume=t.debugShowBoundingVolume}const QK=[],oqe={frameState:void 0,hasSilhouette:void 0};Ac.prototype.pushDrawCommands=function(e){const t=QK;t.length=0;const n=oqe;n.hasSilhouette=this._model.hasSilhouette(e),n.frameState=e,cD(this,!0,rqe,n),e.commandList.push.apply(e.commandList,t)};function rqe(e,t){const n=t.frameState,i=t.hasSilhouette,o=n.passes,r=QK,s=e.drawCommand;s.pushCommands(n,n.commandList),i&&!o.pick&&s.pushSilhouetteCommands(n,r)}Ac.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)};Ac.prototype.applyArticulations=function(){const e=this._runtimeArticulations;for(const t in e)e.hasOwnProperty(t)&&e[t].apply()};function y0(){this.pointsLength=0,this.trianglesLength=0,this.geometryByteLength=0,this.texturesByteLength=0,this.propertyTablesByteLength=0,this._bufferIdSet={},this._textureIdSet={},this._batchTextureIdMap=new xt}Object.defineProperties(y0.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}}});y0.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()};y0.prototype.addBuffer=function(e,t){if(b.typeOf.object("buffer",e),b.typeOf.bool("hasCpuCopy",t),!this._bufferIdSet.hasOwnProperty(e._id)){const n=t?2:1;this.geometryByteLength+=e.sizeInBytes*n}this._bufferIdSet[e._id]=!0};y0.prototype.addTexture=function(e){b.typeOf.object("texture",e),this._textureIdSet.hasOwnProperty(e._id)||(this.texturesByteLength+=e.sizeInBytes),this._textureIdSet[e._id]=!0};y0.prototype.addBatchTexture=function(e){b.typeOf.object("batchTexture",e),this._batchTextureIdMap.contains(e._id)||this._batchTextureIdMap.set(e._id,e)};const ZK={},tm=Uint32Array.BYTES_PER_ELEMENT;ZK.parse=function(e,t){t=A(t,0),b.defined("arrayBuffer",e);const n=new Uint8Array(e),i=new DataView(e);t+=tm;const o=i.getUint32(t,!0);if(o!==1)throw new Se(`Only Point Cloud tile version 1 is supported. Version ${o} is not.`);t+=tm,t+=tm;const r=i.getUint32(t,!0);if(r===0)throw new Se("Feature table must have a byte length greater than zero");t+=tm;const s=i.getUint32(t,!0);t+=tm;const a=i.getUint32(t,!0);t+=tm;const c=i.getUint32(t,!0);t+=tm;const u=Fa(n,t,r);t+=r;const f=new Uint8Array(e,t,s);t+=s;let h,_;a>0&&(h=Fa(n,t,a),t+=a,c>0&&(_=new Uint8Array(e,t,c),t+=c));const g=new Lp(u,f),p=g.getGlobalProperty("POINTS_LENGTH");if(g.featuresLength=p,!l(p))throw new Se("Feature table global property: POINTS_LENGTH must be defined");let y=g.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(y)&&(y=d.unpack(y));const C=sqe(g,h);if(C.rtcCenter=y,C.pointsLength=p,!C.hasPositions){const T=aqe(g);C.positions=T,C.hasPositions=C.hasPositions||l(T)}if(!C.hasPositions)throw new Se("Either POSITION or POSITION_QUANTIZED must be defined.");if(!C.hasNormals){const T=lqe(g);C.normals=T,C.hasNormals=C.hasNormals||l(T)}if(!C.hasColors){const T=cqe(g);C.colors=T,C.hasColors=C.hasColors||l(T),C.hasConstantColor=l(C.constantColor),C.isTranslucent=l(T)&&T.isTranslucent}if(!C.hasBatchIds){const T=uqe(g);C.batchIds=T,C.hasBatchIds=C.hasBatchIds||l(T)}if(C.hasBatchIds){const T=g.getGlobalProperty("BATCH_LENGTH");if(!l(T))throw new Se("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");C.batchLength=T}return l(_)&&(_=new Uint8Array(_),C.batchTableJson=h,C.batchTableBinary=_),C};function sqe(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,f,h,_;if(l(s)){o=s.properties;const p=s.byteOffset,y=s.byteLength;if(!l(o)||!l(p)||!l(y))throw new Se("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),f=l(o.NORMAL),h=l(o.BATCH_ID),_=l(o.RGBA)}let g;return l(i)&&(g={buffer:i,featureTableProperties:o,batchTableProperties:r,properties:sn(o,r),dequantizeInShader:!0}),{draco:g,hasPositions:c,hasColors:u,isTranslucent:_,hasNormals:f,hasBatchIds:h}}function aqe(e){const t=e.json;let n;if(l(t.POSITION))return n=e.getPropertyArray("POSITION",ee.FLOAT,3),{name:bt.POSITION,semantic:bt.POSITION,typedArray:n,isQuantized:!1,componentDatatype:ee.FLOAT,type:ln.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 Se("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 Se("Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");return{name:bt.POSITION,semantic:bt.POSITION,typedArray:n,isQuantized:!0,componentDatatype:ee.FLOAT,type:ln.VEC3,quantizedRange:o,quantizedVolumeOffset:d.unpack(r),quantizedVolumeScale:d.unpack(i),quantizedComponentDatatype:ee.UNSIGNED_SHORT,quantizedType:ln.VEC3}}}function cqe(e){const t=e.json;let n;if(l(t.RGBA))return n=e.getPropertyArray("RGBA",ee.UNSIGNED_BYTE,4),{name:bt.COLOR,semantic:bt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.UNSIGNED_BYTE,type:ln.VEC4,normalized:!0,isRGB565:!1,isTranslucent:!0};if(l(t.RGB))return n=e.getPropertyArray("RGB",ee.UNSIGNED_BYTE,3),{name:"COLOR",semantic:bt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.UNSIGNED_BYTE,type:ln.VEC3,normalized:!0,isRGB565:!1,isTranslucent:!1};if(l(t.RGB565))return n=e.getPropertyArray("RGB565",ee.UNSIGNED_SHORT,1),{name:"COLOR",semantic:bt.COLOR,setIndex:0,typedArray:n,componentDatatype:ee.FLOAT,type:ln.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=U.fromBytes(i[0],i[1],i[2],o),s=o<255;return{name:bt.COLOR,semantic:bt.COLOR,setIndex:0,constantColor:r,componentDatatype:ee.FLOAT,type:ln.VEC4,isQuantized:!1,isTranslucent:s}}}function lqe(e){const t=e.json;let n;if(l(t.NORMAL))return n=e.getPropertyArray("NORMAL",ee.FLOAT,3),{name:bt.NORMAL,semantic:bt.NORMAL,typedArray:n,octEncoded:!1,octEncodedZXY:!1,componentDatatype:ee.FLOAT,type:ln.VEC3};if(l(t.NORMAL_OCT16P)){n=e.getPropertyArray("NORMAL_OCT16P",ee.UNSIGNED_BYTE,2);const i=8;return{name:bt.NORMAL,semantic:bt.NORMAL,typedArray:n,octEncoded:!0,octEncodedZXY:!1,quantizedRange:(1<<i)-1,quantizedType:ln.VEC2,quantizedComponentDatatype:ee.UNSIGNED_BYTE,componentDatatype:ee.FLOAT,type:ln.VEC3}}}function uqe(e){const t=e.json;if(l(t.BATCH_ID)){const n=e.getPropertyArray("BATCH_ID",ee.UNSIGNED_SHORT,1);return{name:bt.FEATURE_ID,semantic:bt.FEATURE_ID,setIndex:0,typedArray:n,componentDatatype:ee.fromTypedArray(n),type:ln.SCALAR}}}const eJ=ZK,fqe=vt.Components,dqe=vt.Scene,hqe=vt.Node,pqe=vt.Primitive,mqe=vt.Attribute,R4=vt.Quantization,_qe=vt.FeatureIdAttribute,gqe=vt.Material,yqe=vt.MetallicRoughness;function Qh(e){e=A(e,A.EMPTY_OBJECT);const t=e.arrayBuffer,n=A(e.byteOffset,0);b.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=Lt.UNLOADED,this._buffers=[],this._components=void 0,this._transform=B.IDENTITY}l(Object.create)&&(Qh.prototype=Object.create(ir.prototype),Qh.prototype.constructor=Qh);Object.defineProperties(Qh.prototype,{promise:{get:function(){return this._promise}},cacheKey:{get:function(){}},components:{get:function(){return this._components}},transform:{get:function(){return this._transform}}});Qh.prototype.load=function(){this._parsedContent=eJ.parse(this._arrayBuffer,this._byteOffset),this._state=Lt.PROCESSING;const e=this;this._promise=new Promise(function(t,n){e._process=function(i){if(e._state===Lt.PROCESSING){if(l(e._decodePromise))return;const o=Aqe(e,i.context);l(o)&&o.then(t).catch(n)}}})};Qh.prototype.process=function(e){this._process(e)};function Aqe(e,t){const i=e._parsedContent.draco;let o;if(l(i)?o=Qr.decodePointCloud(i,t):o=Promise.resolve(),!!l(o))return e._decodePromise=o,o.then(function(r){if(!e.isDestroyed())return l(r)&&Cqe(e,i,r),Oqe(e,t),e._state=Lt.READY,e}).catch(function(r){e.unload(),e._state=Lt.FAILED;const s="Failed to load Draco pnts";return Promise.reject(e.getError(s,r))})}function Cqe(e,t,n){e._state=Lt.READY;const i=e._parsedContent;let o;if(l(n.POSITION)){if(o={name:"POSITION",semantic:bt.POSITION,typedArray:n.POSITION.array,componentDatatype:ee.FLOAT,type:ln.VEC3,isQuantized:!1},l(n.POSITION.data.quantization)){const a=n.POSITION.data.quantization,c=a.range,u=d.fromElements(c,c,c),f=d.unpack(a.minValues),h=(1<<a.quantizationBits)-1;o.isQuantized=!0,o.quantizedRange=h,o.quantizedVolumeOffset=f,o.quantizedVolumeScale=u,o.quantizedComponentDatatype=h<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT,o.quantizedType=ln.VEC3}i.positions=o}if(l(n.NORMAL)){if(o={name:"NORMAL",semantic:bt.NORMAL,typedArray:n.NORMAL.array,componentDatatype:ee.FLOAT,type:ln.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=ln.VEC2}i.normals=o}if(l(n.RGBA)?i.colors={name:"COLOR",semantic:bt.COLOR,setIndex:0,typedArray:n.RGBA.array,componentDatatype:ee.UNSIGNED_BYTE,type:ln.VEC4,normalized:!0,isTranslucent:!0}:l(n.RGB)&&(i.colors={name:"COLOR",semantic:bt.COLOR,setIndex:0,typedArray:n.RGB.array,componentDatatype:ee.UNSIGNED_BYTE,type:ln.VEC3,normalized:!0,isTranslucent:!1}),l(n.BATCH_ID)){const a=n.BATCH_ID.array;i.batchIds={name:"_FEATURE_ID",semantic:bt.FEATURE_ID,setIndex:0,typedArray:a,componentDatatype:ee.fromTypedArray(a),type:ln.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:Tqe(u.componentsPerAttribute),componentType:bqe(u.componentDatatype),typedArray:c.array}}i.batchTableJson=r}function Tqe(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 bqe(e){switch(e){case se.BYTE:return"BYTE";case se.UNSIGNED_BYTE:return"UNSIGNED_BYTE";case se.SHORT:return"SHORT";case se.UNSIGNED_SHORT:return"UNSIGNED_SHORT";case se.INT:return"INT";case se.UNSIGNED_INT:return"UNSIGNED_INT";case se.DOUBLE:return"DOUBLE";case se.FLOAT:return"FLOAT";default:throw new x("value is not a valid WebGL constant")}}function rA(e,t,n){let i=t.typedArray,o;if(t.octEncoded&&(o=new R4,o.octEncoded=t.octEncoded,o.octEncodedZXY=t.octEncodedZXY,o.normalizationRange=t.quantizedRange,o.type=t.quantizedType,o.componentDatatype=t.quantizedComponentDatatype),t.isQuantized){o=new R4;const a=t.quantizedRange;o.normalizationRange=a,o.quantizedVolumeOffset=d.ZERO;const c=t.quantizedVolumeScale;o.quantizedVolumeDimensions=c,o.quantizedVolumeStepSize=d.divideByScalar(c,a,new d),o.componentDatatype=t.quantizedComponentDatatype,o.type=t.quantizedType}const r=new mqe;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=oi.decodeRGB565(i)),l(t.constantColor)){const a=new Array(4);r.constant=U.pack(t.constantColor,a)}else{const a=At.createVertexBuffer({typedArray:i,context:n,usage:Ze.STATIC_DRAW});a.vertexArrayDestroyable=!1,e._buffers.push(a),r.buffer=a}const s=e._loadAttributesFor2D;return r.semantic===bt.POSITION&&s&&(r.typedArray=i),r}let N4,lx;function Eqe(e){if(!l(lx)){N4=new gv(0),lx=new Array(e);for(let t=0;t<e;++t)lx[t]=N4.random()}return lx}const xqe=new d,wqe=new d,Sqe=new d;function vqe(e){const t=e.typedArray,n=20,i=t.length/3,o=Math.min(i,n),r=Eqe(n),s=Number.MAX_VALUE,a=-Number.MAX_VALUE;let c=d.fromElements(s,s,s,xqe),u=d.fromElements(a,a,a,wqe),f,h,_;if(e.isQuantized)c=d.ZERO,u=e.quantizedVolumeScale;else for(f=0;f<o;++f)h=Math.floor(r[f]*i),_=d.unpack(t,h*3,Sqe),d.minimumByComponent(c,_,c),d.maximumByComponent(u,_,u);e.min=d.clone(c),e.max=d.clone(u)}const Dqe={name:bt.COLOR,semantic:bt.COLOR,setIndex:0,constantColor:U.DARKGRAY,componentDatatype:ee.FLOAT,type:ln.VEC4,isQuantized:!1,isTranslucent:!1};function Iqe(e,t,n){const i=[];let o;const r=t.positions;return l(r)&&(vqe(r),o=rA(e,r,n),o.count=t.pointsLength,i.push(o)),l(t.normals)&&(o=rA(e,t.normals,n),i.push(o)),l(t.colors)?(o=rA(e,t.colors,n),i.push(o)):(o=rA(e,Dqe,n),i.push(o)),l(t.batchIds)&&(o=rA(e,t.batchIds,n),i.push(o)),i}function Pqe(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 U_({count:s,batchTable:e.batchTableJson,binaryBody:o,parseAsPropertyAttributes:r,customAttributeOutput:t})}return new lu({schema:{},propertyTables:[]})}function Oqe(e,t){const n=e._parsedContent,i=new yqe;i.metallicFactor=0,i.roughnessFactor=.9;const o=new gqe;o.metallicRoughness=i;const r=n.colors;l(r)&&r.isTranslucent&&(o.alphaMode=DS.BLEND);const s=!l(n.normals);o.unlit=s;const a=new pqe;if(a.attributes=Iqe(e,n,t),a.primitiveType=Je.POINTS,a.material=o,l(n.batchIds)){const g=new _qe;g.propertyTableId=0,g.setIndex=0,g.positionalLabel="featureId_0",a.featureIds.push(g)}const c=new hqe;c.index=0,c.primitives=[a];const u=new dqe;u.nodes=[c],u.upAxis=Jr.Z,u.forwardAxis=Jr.X;const f=new fqe;f.scene=u,f.nodes=[c];const h=[];f.structuralMetadata=Pqe(n,h),h.length>0&&Lqe(e,a,h,t),l(n.rtcCenter)&&(f.transform=B.multiplyByTranslation(f.transform,n.rtcCenter,f.transform));const _=n.positions;l(_)&&_.isQuantized&&(f.transform=B.multiplyByTranslation(f.transform,_.quantizedVolumeOffset,f.transform)),e._components=f,e._parsedContent=void 0,e._arrayBuffer=void 0}function Lqe(e,t,n,i){const o=t.attributes,r=n.length;for(let s=0;s<r;s++){const a=n[s],c=At.createVertexBuffer({typedArray:a.typedArray,context:i,usage:Ze.STATIC_DRAW});c.vertexArrayDestroyable=!1,e._buffers.push(c),a.buffer=c,a.typedArray=void 0,o.push(a)}t.propertyAttributeIds=[0]}Qh.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 ui(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.loader",e.loader),b.typeOf.object("options.resource",e.resource),this._loader=e.loader,this._resource=e.resource,this.type=A(e.type,ta.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 Rd(this),this._clampAnimations=A(e.clampAnimations,!0),this._userAnimationDirty=!1,this._id=e.id,this._idDirty=!1,this._color=U.clone(e.color),this._colorBlendMode=A(e.colorBlendMode,iD.HIGHLIGHT),this._colorBlendAmount=A(e.colorBlendAmount,.5);const t=A(e.silhouetteColor,U.RED);this._silhouetteColor=U.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,Be.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,Et.NONE),this._heightDirty=this._heightReference!==Et.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 ib(e.pointCloudShading);this._pointCloudShading=r,this._attenuation=r.attenuation,this._pointCloudBackFaceCulling=r.backFaceCulling;const s=e.clippingPlanes;l(s)&&s.owner===void 0?Ao.setOwner(s,this,"_clippingPlanes"):this._clippingPlanes=s,this._clippingPlanesState=0,this._clippingPlanesMatrix=B.clone(B.IDENTITY),this._lightColor=d.clone(e.lightColor),this._imageBasedLighting=l(e.imageBasedLighting)?e.imageBasedLighting:new u0,this._shouldDestroyImageBasedLighting=!l(e.imageBasedLighting),this._backFaceCulling=A(e.backFaceCulling,!0),this._backFaceCullingDirty=!1,this._shadows=A(e.shadows,Co.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===ta.GLTF&&Di("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 Kn(a)),this._credit=a,this._resourceCredits=[],this._gltfCredits=[],this._showCreditsOnScreen=A(e.showCreditsOnScreen,!1),this._showCreditsOnScreenDirty=!0,this._splitDirection=A(e.splitDirection,w_.NONE),this._enableShowOutline=A(e.enableShowOutline,!0),this.showOutline=A(e.showOutline,!0),this.outlineColor=A(e.outlineColor,U.BLACK),this._classificationType=e.classificationType,this._statistics=new y0,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=Nqe(this),this._sceneGraph=void 0,this._nodesByName={},this.pickObject=e.pickObject}function Bqe(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 Yo({model:e,propertyTable:s});n.push(a)}return n}function Rqe(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=$t.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=$t.getFeatureIdsByLabel(c.featureIds,n);if(l(u))return u.propertyTableId}if(t._featureTables.length===1)return 0}function FB(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 Nqe(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 Se("Failed to load model.")}const c=a.structuralMetadata;l(c)&&c.propertyTableCount>0&&Bqe(e,c);const u=new Ac({model:e,modelComponents:a});e._sceneGraph=u,e._gltfCredits=u.components.asset.credits;const f=e._resource.credits;if(l(f)){const h=f.length;for(let _=0;_<h;_++)e._resourceCredits.push(f[_])}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($t.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($t.getFailedLoadFunction(e,"model",n))}Object.defineProperties(ui.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){b.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=Ut.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){FB(e,this._color)&&this.resetDrawCommands(),this._color=U.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(!U.equals(e,this._silhouetteColor)){const t=FB(e,this._silhouetteColor);this._silhouetteDirty=this._silhouetteDirty||t}this._silhouetteColor=U.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 nJ(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===ta.GLTF&&Di("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}`),b.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}`),b.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&&(Ao.setOwner(e,this,"_clippingPlanes"),this.resetDrawCommands())}},lightColor:{get:function(){return this._lightColor},set:function(e){l(e)!==l(this._lightColor)&&this.resetDrawCommands(),this._lightColor=d.clone(e,this._lightColor)}},imageBasedLighting:{get:function(){return this._imageBasedLighting},set:function(e){b.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}}});ui.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 b.typeOf.string("name",e),this._nodesByName[e]};ui.prototype.setArticulationStage=function(e,t){if(b.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)};ui.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()};ui.prototype.makeStyleDirty=function(){this._styleDirty=!0};ui.prototype.resetDrawCommands=function(){this._drawCommandsBuilt=!1};const Mqe=new B,Fqe=new J,zqe=new B;ui.prototype.update=function(e){if(Uqe(this,e),Hqe(this,e),Vqe(this,e),!this._resourcesLoaded||e.mode===le.MORPHING)return;kqe(this),Gqe(this),Wqe(this,e),jqe(this),qqe(this,e),Yqe(this,e),$qe(this,e),Xqe(this,e),this._defaultTexture=e.context.defaultTexture,Kqe(this,e),Jqe(this,e),Qqe(this),Zqe(this,e),n7e(this,e);const t=this;if(!t._ready){t._completeLoad(t,e);return}t7e(this),i7e(this,e),o7e(this),r7e(this,e)};function Uqe(e,t){(!e._resourcesLoaded||!e._texturesLoaded)&&e._loader.process(t)}function Hqe(e,t){l(e._customShader)&&e._customShader.update(t)}function Vqe(e,t){e._imageBasedLighting.update(t),e._imageBasedLighting.shouldRegenerateShaders&&e.resetDrawCommands()}function kqe(e){if(!e._featureTableIdDirty)return;e._featureTableIdDirty=!1;const t=e._sceneGraph.components,n=t.structuralMetadata;l(n)&&n.propertyTableCount>0&&(e.featureTableId=Rqe(t,e),e._styleDirty=!0,e.resetDrawCommands())}function Gqe(e){e._styleDirty&&(e.applyStyle(e._style),e._styleDirty=!1)}function Wqe(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&&tJ(e)}function tJ(e){const t=e.featureTables[e.featureTableId];e._styleCommandsNeeded=fT.getStyleCommandsNeeded(t.featuresLength,t.batchTexture.translucentFeaturesLength)}function jqe(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 qqe(e,t){e._silhouetteDirty&&(iJ(t)&&e.resetDrawCommands(),e._silhouetteDirty=!1)}function Yqe(e,t){const n=e.hasSkipLevelOfDetail(t);n!==e._skipLevelOfDetail&&(e.resetDrawCommands(),e._skipLevelOfDetail=n)}function $qe(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 Xqe(e,t){t.mode!==e._sceneMode&&(e._projectTo2D?e.resetDrawCommands():e._updateModelMatrix=!0,e._sceneMode=t.mode)}function Kqe(e,t){e._drawCommandsBuilt||(e.destroyPipelineResources(),e._sceneGraph.buildDrawCommands(t),e._drawCommandsBuilt=!0)}function Jqe(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 Pu=new d,Sw=new Ae;function Qqe(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===Et.NONE){if(e.heightReference!==Et.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;Pu.x=o[12],Pu.y=o[13],Pu.z=o[14];const r=i.cartesianToCartographic(Pu);l(e._clampedModelMatrix)||(e._clampedModelMatrix=B.clone(o,new B));const s=n._surface;e._removeUpdateHeightCallback=s.updateHeight(r,M4(e,i,r));const a=n.getHeight(r);if(l(a)){const c=M4(e,i,r);Ae.clone(r,Sw),Sw.height=a,i.cartographicToCartesian(Sw,Pu),c(Pu)}e._heightDirty=!1,e._updateModelMatrix=!0}function Zqe(e,t){if(!e._updateModelMatrix&&e._minimumPixelSize===0)return;const n=l(e._clampedModelMatrix)?e._clampedModelMatrix:e.modelMatrix;nJ(e,n),e7e(e,n,t)}function nJ(e,t){e._clampedScale=l(e._maximumScale)?Math.min(e._scale,e._maximumScale):e._scale,e._boundingSphere.center=d.multiplyByScalar(e._sceneGraph.boundingSphere.center,e._clampedScale,e._boundingSphere.center),e._boundingSphere.radius=e._initialRadius*e._clampedScale,e._boundingSphere=fe.transform(e._boundingSphere,t,e._boundingSphere)}function e7e(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,Pu),e._sceneMode!==le.SCENE3D&&lr.computeActualWgs84Position(n,Pu,Pu);const s=e._boundingSphere.radius,a=s7e(Pu,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 t7e(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 n7e(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=Fqe,a=Mqe;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=zqe;s=B.multiply(o.uniformState.view3D,i,s),s=B.multiply(s,e._clippingPlanes.modelMatrix,s),e._clippingPlanesMatrix=B.inverseTranspose(s,e._clippingPlanesMatrix)}}function i7e(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 o7e(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 r7e(e,t){const n=c7e(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&&(l7e(e,t),e._sceneGraph.pushDrawCommands(t))}const TO=new fe;function s7e(e,t,n){return TO.center=e,TO.radius=t,n.camera.getPixelSize(TO,n.context.drawingBufferWidth,n.context.drawingBufferHeight)}function M4(e,t,n){return function(i){if(e.heightReference===Et.RELATIVE_TO_GROUND){const r=t.cartesianToCartographic(i,Sw);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 a7e=new d;function c7e(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,a7e);lr.computeActualWgs84Position(t,s,s),r=d.distanceSquared(s,t.camera.positionWC)}return r>=i&&r<=o}function l7e(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])}ui.prototype.isTranslucent=function(){const e=this.color;return l(e)&&e.alpha>0&&e.alpha<1};ui.prototype.isInvisible=function(){const e=this.color;return l(e)&&e.alpha===0};function iJ(e){return e.context.stencilBuffer}ui.prototype.hasSilhouette=function(e){return iJ(e)&&this._silhouetteSize>0&&this._silhouetteColor.alpha>0&&!l(this._classificationType)};function u7e(e){return e.context.stencilBuffer}ui.prototype.hasSkipLevelOfDetail=function(e){if(!ta.is3DTiles(this.type))return!1;const n=this._content.tileset;return u7e(e)&&n.skipLevelOfDetail};ui.prototype.isClippingEnabled=function(){const e=this._clippingPlanes;return l(e)&&e.enabled&&e.length!==0};ui.prototype.isDestroyed=function(){return!1};ui.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,Ue(this)};ui.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};ui.prototype.destroyModelResources=function(){const e=this._modelResources;for(let t=0;t<e.length;t++)e[t].destroy();this._modelResources.length=0};ui.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=Re.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=Re.createIfNeeded(t);const r=new Ul(n),a=l(e.content)?ta.TILE_GLTF:ta.GLTF,c=ob(r,a,e);return c.resource=n.gltfResource,new ui(c)};ui.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 Xh(t),i=ob(n,ta.TILE_B3DM,e);return new ui(i)};ui.fromPnts=function(e){const t={arrayBuffer:e.arrayBuffer,byteOffset:e.byteOffset,loadAttributesFor2D:e.projectTo2D},n=new Qh(t),i=ob(n,ta.TILE_PNTS,e);return new ui(i)};ui.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 sd(t),i=ob(n,ta.TILE_I3DM,e);return new ui(i)};ui.fromGeoJson=function(e){const t={geoJson:e.geoJson},n=new Kh(t),i=ob(n,ta.TILE_GEOJSON,e);return new ui(i)};ui.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):U.clone(U.WHITE,this._color),this._show=i?e.show.evaluate(void 0):!0,FB(t,this._color)&&this.resetDrawCommands()};ui.prototype.applyStyle=function(e){const t=this.type===ta.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),tJ(this)):(this.applyColorAndShow(e),this._styleCommandsNeeded=void 0)};function ob(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 Io(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(Io.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}}});Io.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)};Io.prototype.hasProperty=function(e,t){const n=this._model,i=n.featureTableId;return l(i)?n.featureTables[i].hasProperty(e,t):!1};Io.prototype.applyDebugSettings=function(e,t){t=e?t:U.WHITE,this.featuresLength===0?this._model.color=t:l(this.batchTable)&&this.batchTable.setAllColor(t)};Io.prototype.applyStyle=function(e){this._model.style=e};Io.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)};Io.prototype.isDestroyed=function(){return!1};Io.prototype.destroy=function(){return this._model=this._model&&this._model.destroy(),Ue(this)};Io.fromGltf=function(e,t,n,i){const o=new Io(e,t,n),s=rb(e,t,o,{gltf:i,basePath:n}),a=e.vectorClassificationOnly?void 0:e.classificationType;s.classificationType=a;const c=ui.fromGltf(s);return o._model=c,o._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:Wf.REPEAT}),u}),o};Io.fromB3dm=function(e,t,n,i,o){const r=new Io(e,t,n),a=rb(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=e.vectorClassificationOnly?void 0:e.classificationType;a.classificationType=c;const u=ui.fromB3dm(a);return r._model=u,r._readyPromise=u.readyPromise.then(function(f){return f.activeAnimations.addAll({loop:Wf.REPEAT}),f}),r};Io.fromI3dm=function(e,t,n,i,o){const r=new Io(e,t,n),a=rb(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=ui.fromI3dm(a);return r._model=c,r._readyPromise=c.readyPromise.then(function(u){return u.activeAnimations.addAll({loop:Wf.REPEAT}),u}),r};Io.fromPnts=function(e,t,n,i,o){const r=new Io(e,t,n),a=rb(e,t,r,{arrayBuffer:i,byteOffset:o,resource:n}),c=ui.fromPnts(a);return r._model=c,r._readyPromise=c.readyPromise,r};Io.fromGeoJson=function(e,t,n,i){const o=new Io(e,t,n),s=rb(e,t,o,{geoJson:i,resource:n}),a=ui.fromGeoJson(s);return o._model=a,o._readyPromise=a.readyPromise,o};function rb(e,t,n,i){const o={cull:!1,releaseGltfJson:!0,opaquePass:Be.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 sn(i,o)}function Nd(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=f7e(this,i)}Object.defineProperties(Nd.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 f7e(e,t){return e._tileset.loadTileset(e._resource,t,e._tile),Promise.resolve(e)}Nd.prototype.hasProperty=function(e,t){return!1};Nd.prototype.getFeature=function(e){};Nd.prototype.applyDebugSettings=function(e,t){};Nd.prototype.applyStyle=function(e){};Nd.prototype.update=function(e,t){};Nd.prototype.isDestroyed=function(){return!1};Nd.prototype.destroy=function(){return Ue(this)};function Rt(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=Mt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Mt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");o=Mt.clone(o)}if(l(r)){if(r.far<=r.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Ut.clone(r)}this._show=A(e.show,!0),this._position=d.clone(A(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._pixelOffset=j.clone(A(e.pixelOffset,j.ZERO)),this._translate=new j(0,0),this._eyeOffset=d.clone(A(e.eyeOffset,d.ZERO)),this._heightReference=A(e.heightReference,Et.NONE),this._verticalOrigin=A(e.verticalOrigin,Si.CENTER),this._horizontalOrigin=A(e.horizontalOrigin,Ta.CENTER),this._scale=A(e.scale,1),this._color=U.clone(A(e.color,U.WHITE)),this._rotation=A(e.rotation,0),this._alignedAxis=d.clone(A(e.alignedAxis,d.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=Es()),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=U.clone(A(e.outlineColor,U.BLACK)),this._outlineWidth=A(e.outlineWidth,0),this._updateClamping()}const F4=Rt.SHOW_INDEX=0,vw=Rt.POSITION_INDEX=1,oJ=Rt.PIXEL_OFFSET_INDEX=2,d7e=Rt.EYE_OFFSET_INDEX=3,h7e=Rt.HORIZONTAL_ORIGIN_INDEX=4,p7e=Rt.VERTICAL_ORIGIN_INDEX=5,m7e=Rt.SCALE_INDEX=6,Dw=Rt.IMAGE_INDEX_INDEX=7,z4=Rt.COLOR_INDEX=8,_7e=Rt.ROTATION_INDEX=9,g7e=Rt.ALIGNED_AXIS_INDEX=10,y7e=Rt.SCALE_BY_DISTANCE_INDEX=11,A7e=Rt.TRANSLUCENCY_BY_DISTANCE_INDEX=12,C7e=Rt.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX=13,T7e=Rt.DISTANCE_DISPLAY_CONDITION=14,b7e=Rt.DISABLE_DEPTH_DISTANCE=15;Rt.TEXTURE_COORDINATE_BOUNDS=16;const U4=Rt.SDF_INDEX=17;Rt.NUMBER_OF_PROPERTIES=18;function $i(e,t){const n=e._billboardCollection;l(n)&&(n._updateBillboard(e,t),e._dirty=!0)}Object.defineProperties(Rt.prototype,{show:{get:function(){return this._show},set:function(e){b.typeOf.bool("value",e),this._show!==e&&(this._show=e,$i(this,F4))}},position:{get:function(){return this._position},set:function(e){b.typeOf.object("value",e);const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),this._updateClamping(),$i(this,vw))}},heightReference:{get:function(){return this._heightReference},set:function(e){b.typeOf.number("value",e);const t=this._heightReference;e!==t&&(this._heightReference=e,this._updateClamping(),$i(this,vw))}},pixelOffset:{get:function(){return this._pixelOffset},set:function(e){b.typeOf.object("value",e);const t=this._pixelOffset;j.equals(t,e)||(j.clone(e,t),$i(this,oJ))}},scaleByDistance:{get:function(){return this._scaleByDistance},set:function(e){if(l(e)&&(b.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._scaleByDistance;Mt.equals(t,e)||(this._scaleByDistance=Mt.clone(e,t),$i(this,y7e))}},translucencyByDistance:{get:function(){return this._translucencyByDistance},set:function(e){if(l(e)&&(b.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._translucencyByDistance;Mt.equals(t,e)||(this._translucencyByDistance=Mt.clone(e,t),$i(this,A7e))}},pixelOffsetScaleByDistance:{get:function(){return this._pixelOffsetScaleByDistance},set:function(e){if(l(e)&&(b.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");const t=this._pixelOffsetScaleByDistance;Mt.equals(t,e)||(this._pixelOffsetScaleByDistance=Mt.clone(e,t),$i(this,C7e))}},eyeOffset:{get:function(){return this._eyeOffset},set:function(e){b.typeOf.object("value",e);const t=this._eyeOffset;d.equals(t,e)||(d.clone(e,t),$i(this,d7e))}},horizontalOrigin:{get:function(){return this._horizontalOrigin},set:function(e){b.typeOf.number("value",e),this._horizontalOrigin!==e&&(this._horizontalOrigin=e,$i(this,h7e))}},verticalOrigin:{get:function(){return this._verticalOrigin},set:function(e){b.typeOf.number("value",e),this._verticalOrigin!==e&&(this._verticalOrigin=e,$i(this,p7e))}},scale:{get:function(){return this._scale},set:function(e){b.typeOf.number("value",e),this._scale!==e&&(this._scale=e,$i(this,m7e))}},color:{get:function(){return this._color},set:function(e){b.typeOf.object("value",e);const t=this._color;U.equals(t,e)||(U.clone(e,t),$i(this,z4))}},rotation:{get:function(){return this._rotation},set:function(e){b.typeOf.number("value",e),this._rotation!==e&&(this._rotation=e,$i(this,_7e))}},alignedAxis:{get:function(){return this._alignedAxis},set:function(e){b.typeOf.object("value",e);const t=this._alignedAxis;d.equals(t,e)||(d.clone(e,t),$i(this,g7e))}},width:{get:function(){return A(this._width,this._imageWidth)},set:function(e){l(e)&&b.typeOf.number("value",e),this._width!==e&&(this._width=e,$i(this,Dw))}},height:{get:function(){return A(this._height,this._imageHeight)},set:function(e){l(e)&&b.typeOf.number("value",e),this._height!==e&&(this._height=e,$i(this,Dw))}},sizeInMeters:{get:function(){return this._sizeInMeters},set:function(e){b.typeOf.bool("value",e),this._sizeInMeters!==e&&(this._sizeInMeters=e,$i(this,z4))}},distanceDisplayCondition:{get:function(){return this._distanceDisplayCondition},set:function(e){if(!Ut.equals(e,this._distanceDisplayCondition)){if(l(e)&&(b.typeOf.object("value",e),e.far<=e.near))throw new x("far distance must be greater than near distance.");this._distanceDisplayCondition=Ut.clone(e,this._distanceDisplayCondition),$i(this,T7e)}}},disableDepthTestDistance:{get:function(){return this._disableDepthTestDistance},set:function(e){if(l(e)&&(b.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,$i(this,b7e))}},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 Re?this.setImage(e.url,e):l(e.src)?this.setImage(e.src,e):this.setImage(Es(),e):(this._imageIndex=-1,this._imageSubRegion=void 0,this._imageId=void 0,this._image=void 0,this._imageIndexPromise=void 0,$i(this,Dw))}},ready:{get:function(){return this._imageIndex!==-1}},_clampedPosition:{get:function(){return this._actualClampedPosition},set:function(e){this._actualClampedPosition=d.clone(e,this._actualClampedPosition),$i(this,vw)}},clusterShow:{get:function(){return this._clusterShow},set:function(e){this._clusterShow!==e&&(this._clusterShow=e,$i(this,F4))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;U.equals(t,e)||(U.clone(e,t),$i(this,U4))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){this._outlineWidth!==e&&(this._outlineWidth=e,$i(this,U4))}}});Rt.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this._pickPrimitive,collection:this._collection,id:this._id})),this._pickId};Rt.prototype._updateClamping=function(){Rt._updateClamping(this._billboardCollection,this)};const kA=new Ae,H4=new d;Rt._updateClamping=function(e,t){const n=e._scene;if(!l(n)||!l(n.globe)){if(t._heightReference!==Et.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===Et.NONE||a)&&l(t._removeCallbackFunc)&&(t._removeCallbackFunc(),t._removeCallbackFunc=void 0,t._clampedPosition=void 0),t._heightReference===Et.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===Et.RELATIVE_TO_GROUND)if(t._mode===le.SCENE3D){const _=o.cartesianToCartographic(h,kA);_.height+=c.height,o.cartographicToCartesian(_,h)}else h.x+=c.height;t._clampedPosition=d.clone(h,t._clampedPosition)}t._removeCallbackFunc=r.updateHeight(c,u),Ae.clone(c,kA);const f=i.getHeight(c);l(f)&&(kA.height=f),o.cartographicToCartesian(kA,H4),u(H4)};Rt.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||!qe.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,$i(r,Dw)}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})};Rt.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())};Rt.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&&qe.equals(this._imageSubRegion,t)||(this._imageIndex=-1,this._imageId=e,this._imageSubRegion=qe.clone(t),l(this._billboardCollection._textureAtlas)&&this._loadImage())};Rt.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),$i(this,oJ))};Rt.prototype._getActualPosition=function(){return l(this._clampedPosition)?this._clampedPosition:this._actualPosition};Rt.prototype._setActualPosition=function(e){l(this._clampedPosition)||d.clone(e,this._actualPosition),$i(this,vw)};const V4=new oe;Rt._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,V4),lr.computeActualWgs84Position(n,V4))};const rJ=new d;Rt._computeScreenSpacePosition=function(e,t,n,i,o,r){const s=B.multiplyByPoint(e,t,rJ),a=lr.wgs84WithEyeOffsetToWindowCoordinates(o,s,n,r);if(l(a))return j.add(a,i,a),a};const ux=new j(0,0);Rt.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,ux),j.add(ux,this._translate,ux);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,kA);o=a.cartographicToCartesian(c,rJ),i=B.IDENTITY}return Rt._computeScreenSpacePosition(i,o,this._eyeOffset,ux,e,t)};Rt.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===Ta.RIGHT?s-=i:e.horizontalOrigin===Ta.CENTER&&(s-=i*.5);let a=t.y;return e.verticalOrigin===Si.BOTTOM||e.verticalOrigin===Si.BASELINE?a-=o:e.verticalOrigin===Si.CENTER&&(a-=o*.5),l(n)||(n=new qe),n.x=s,n.y=a,n.width=i,n.height=o,n};Rt.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&d.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&&qe.equals(this._imageSubRegion,e._imageSubRegion)&&U.equals(this._color,e._color)&&j.equals(this._pixelOffset,e._pixelOffset)&&j.equals(this._translate,e._translate)&&d.equals(this._eyeOffset,e._eyeOffset)&&Mt.equals(this._scaleByDistance,e._scaleByDistance)&&Mt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Mt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Ut.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};Rt.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 E7e={OPAQUE:0,TRANSLUCENT:1,OPAQUE_AND_TRANSLUCENT:2},zo=Object.freeze(E7e),x7e={FONT_SIZE:48,PADDING:10,RADIUS:8,CUTOFF:.25},Ka=Object.freeze(x7e);function Hf(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 w7e=new j(16,16);function $u(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.borderWidthInPixels,1),n=A(e.initialSize,w7e);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,nt.RGBA),this._borderWidthInPixels=t,this._textureCoordinates=[],this._guid=Es(),this._idHash={},this._indexHash={},this._initialSize=n,this._root=void 0}Object.defineProperties($u.prototype,{borderWidthInPixels:{get:function(){return this._borderWidthInPixels}},textureCoordinates:{get:function(){return this._textureCoordinates}},texture:{get:function(){return l(this._texture)||(this._texture=new zt({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 S7e(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),f=s/c,h=a/u,_=new Hf(new j(s+r,r),new j(c,a)),g=new Hf(new j,new j(c,a),e._root,_),p=new Hf(new j(r,a+r),new j(c,u)),y=new Hf(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*=f,w.y*=h,w.width*=f,w.height*=h)}const C=new zt({context:e._context,width:c,height:u,pixelFormat:e._pixelFormat}),T=new zr({context:n,colorTextures:[e._texture],destroyAttachments:!1});T._bind(),C.copyFromFramebuffer(0,0,0,0,c,u),T._unBind(),T.destroy(),e._texture=e._texture&&e._texture.destroy(),e._texture=C,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 zt({context:e._context,width:s,height:a,pixelFormat:e._pixelFormat}),e._root=new Hf(new j(r,r),new j(s,a))}}function Iw(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 Hf(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 Hf(new j(a,t.bottomLeft.y),new j(t.topRight.x,t.topRight.y)))}else{t.childNode1=new Hf(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 Hf(new j(t.bottomLeft.x,a),new j(t.topRight.x,t.topRight.y)))}return Iw(e,t.childNode1,n)}return Iw(e,t.childNode1,n)||Iw(e,t.childNode2,n)}}function sJ(e,t,n){const i=Iw(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,f=s/o,h=a/r;e._textureCoordinates[n]=new qe(c,u,f,h),e._texture.copyFrom({source:t,xOffset:i.bottomLeft.x,yOffset:i.bottomLeft.y})}else S7e(e,t),sJ(e,t,n);e._guid=Es()}function aJ(e,t){if(!l(e)||e.isDestroyed())return-1;const n=e.numberOfImages;return sJ(e,t,n),n}$u.prototype.getImageIndex=function(e){if(!l(e))throw new x("id is required.");return this._indexHash[e]};$u.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=aJ(this,t),this._idHash[e]=Promise.resolve(n),this._indexHash[e]=n),n};$u.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 Re)&&(t=Re.createIfNeeded(t).fetchImage());const i=this;return n=Promise.resolve(t).then(function(o){const r=aJ(i,o);return i._indexHash[e]=r,r}),this._idHash[e]=n,n};$u.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 Se(`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,f=c.y+t.y/s,h=t.width/r,_=t.height/s;return i._textureCoordinates.push(new qe(u,f,h,_)),i._guid=Es(),a})};$u.prototype.isDestroyed=function(){return!1};$u.prototype.destroy=function(){return this._texture=this._texture&&this._texture.destroy(),Ue(this)};const v7e=Rt.SHOW_INDEX,yC=Rt.POSITION_INDEX,cJ=Rt.PIXEL_OFFSET_INDEX,lJ=Rt.EYE_OFFSET_INDEX,D7e=Rt.HORIZONTAL_ORIGIN_INDEX,I7e=Rt.VERTICAL_ORIGIN_INDEX,P7e=Rt.SCALE_INDEX,sA=Rt.IMAGE_INDEX_INDEX,uJ=Rt.COLOR_INDEX,O7e=Rt.ROTATION_INDEX,L7e=Rt.ALIGNED_AXIS_INDEX,fJ=Rt.SCALE_BY_DISTANCE_INDEX,dJ=Rt.TRANSLUCENCY_BY_DISTANCE_INDEX,hJ=Rt.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX,pJ=Rt.DISTANCE_DISPLAY_CONDITION,B7e=Rt.DISABLE_DEPTH_DISTANCE,R7e=Rt.TEXTURE_COORDINATE_BOUNDS,mJ=Rt.SDF_INDEX,sF=Rt.NUMBER_OF_PROPERTIES;let Ni;const N7e={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},M7e={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 na(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(sF),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,zo.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=le.SCENE3D,this._buffersUsage=[Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW],this._highlightColor=U.clone(U.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(na.prototype,{length:{get:function(){return aF(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 _J(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}na.prototype.add=function(e){const t=new Rt(e,this);return t._index=this._billboards.length,this._billboards.push(t),this._createVertexArray=!0,t};na.prototype.remove=function(e){return this.contains(e)?(this._billboards[e._index]=void 0,this._billboardsRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};na.prototype.removeAll=function(){_J(this._billboards),this._billboards=[],this._billboardsToUpdate=[],this._billboardsToUpdateIndex=0,this._billboardsRemoved=!1,this._createVertexArray=!0};function aF(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}}na.prototype._updateBillboard=function(e,t){e._dirty||(this._billboardsToUpdate[this._billboardsToUpdateIndex++]=e),++this._propertiesChanged[t]};na.prototype.contains=function(e){return l(e)&&e._billboardCollection===this};na.prototype.get=function(e){return b.typeOf.number("index",e),aF(this),this._billboards[e]};let bO;function F7e(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=At.createIndexBuffer({context:e,typedArray:o,usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT}),n.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferBatched=n,n}function z7e(e){let t=e.cache.billboardCollection_indexBufferInstanced;return l(t)||(t=At.createIndexBuffer({context:e,typedArray:new Uint16Array([0,1,2,0,2,3]),usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_indexBufferInstanced=t),t}function U7e(e){let t=e.cache.billboardCollection_vertexBufferInstanced;return l(t)||(t=At.createVertexBuffer({context:e,typedArray:new Float32Array([0,0,1,0,1,1,0,1]),usage:Ze.STATIC_DRAW}),t.vertexArrayDestroyable=!1,e.cache.billboardCollection_vertexBufferInstanced=t),t}na.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<sF;++i){const o=n[i]===0?Ze.STATIC_DRAW:Ze.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function H7e(e,t,n,i,o,r){const s=[{index:Ni.positionHighAndScale,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[yC]},{index:Ni.positionLowAndRotation,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[yC]},{index:Ni.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[cJ]},{index:Ni.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[dJ]},{index:Ni.compressedAttribute2,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[uJ]},{index:Ni.eyeOffset,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[lJ]},{index:Ni.scaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[fJ]},{index:Ni.pixelOffsetScaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[hJ]},{index:Ni.compressedAttribute3,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[pJ]},{index:Ni.textureCoordinateBoundsOrLabelTranslate,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[R7e]}];i&&s.push({index:Ni.direction,componentsPerAttribute:2,componentDatatype:ee.FLOAT,vertexBuffer:U7e(e)}),l(o)&&s.push({index:Ni.a_batchId,componentsPerAttribute:1,componentDatatype:ee.FLOAT,bufferUsage:Ze.STATIC_DRAW}),r&&s.push({index:Ni.sdf,componentsPerAttribute:2,componentDatatype:ee.FLOAT,usage:n[mJ]});const a=i?t:4*t;return new br(e,s,a,i)}const EO=new wn;function gJ(e,t,n,i,o){let r;const s=i[Ni.positionHighAndScale],a=i[Ni.positionLowAndRotation],c=o._getActualPosition();e._mode===le.SCENE3D&&(fe.expand(e._baseVolume,c,e._baseVolume),e._boundingVolumeDirty=!0),wn.fromCartesian(c,EO);const u=o.scale,f=o.rotation;f!==0&&(e._shaderRotation=!0),e._maxScale=Math.max(e._maxScale,u);const h=EO.high,_=EO.low;e._instanced?(r=o._index,s(r,h.x,h.y,h.z,u),a(r,_.x,_.y,_.z,f)):(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,_.x,_.y,_.z,f),a(r+1,_.x,_.y,_.z,f),a(r+2,_.x,_.y,_.z,f),a(r+3,_.x,_.y,_.z,f))}const Bc=new j,Dc=32768,dy=65536,xO=4096,Hu=256,V7e=128,k7e=32,G7e=8,yJ=4,W7e=1/256,AJ=0,CJ=2,TJ=3,bJ=1;function EJ(e,t,n,i,o){let r;const s=i[Ni.compressedAttribute0],a=o.pixelOffset,c=a.x,u=a.y,f=o._translate,h=f.x,_=f.y;e._maxPixelOffset=Math.max(e._maxPixelOffset,Math.abs(c+h),Math.abs(-u+_));const g=o.horizontalOrigin;let p=o._verticalOrigin,y=o.show&&o.clusterShow;o.color.alpha===0&&(y=!1),p===Si.BASELINE&&(p=Si.BOTTOM),e._allHorizontalCenter=e._allHorizontalCenter&&g===Ta.CENTER,e._allVerticalCenter=e._allVerticalCenter&&p===Si.CENTER;let C=0,T=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}`);C=V.x,T=V.y,E=V.width,w=V.height}const P=C+E,O=T+w;let z=Math.floor(N.clamp(c,-Dc,Dc)+Dc)*V7e;z+=(g+1)*k7e,z+=(p+1)*G7e,z+=(y?1:0)*yJ;let R=Math.floor(N.clamp(u,-Dc,Dc)+Dc)*Hu,F=Math.floor(N.clamp(h,-Dc,Dc)+Dc)*Hu;const H=(N.clamp(_,-Dc,Dc)+Dc)*W7e,v=Math.floor(H),I=Math.floor((H-v)*Hu);R+=v,F+=I,Bc.x=C,Bc.y=T;const m=oi.compressTextureCoordinates(Bc);Bc.x=P;const D=oi.compressTextureCoordinates(Bc);Bc.y=O;const L=oi.compressTextureCoordinates(Bc);Bc.x=C;const M=oi.compressTextureCoordinates(Bc);e._instanced?(r=o._index,s(r,z,R,F,m)):(r=o._index*4,s(r+0,z+AJ,R,F,m),s(r+1,z+CJ,R,F,D),s(r+2,z+TJ,R,F,L),s(r+3,z+bJ,R,F,M))}function xJ(e,t,n,i,o){let r;const s=i[Ni.compressedAttribute1],a=o.alignedAxis;d.equals(a,d.ZERO)||(e._shaderAlignedAxis=!0);let c=0,u=1,f=1,h=1;const _=o.translucencyByDistance;l(_)&&(c=_.near,u=_.nearValue,f=_.far,h=_.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,C=Math.round(A(o.width,y*g));e._maxSize=Math.max(e._maxSize,C);let T=N.clamp(C,0,dy),E=0;Math.abs(d.magnitudeSquared(a)-1)<N.EPSILON6&&(E=oi.octEncodeFloat(a)),u=N.clamp(u,0,1),u=u===1?255:u*255|0,T=T*Hu+u,h=N.clamp(h,0,1),h=h===1?255:h*255|0,E=E*Hu+h,e._instanced?(r=o._index,s(r,T,E,c,f)):(r=o._index*4,s(r+0,T,E,c,f),s(r+1,T,E,c,f),s(r+2,T,E,c,f),s(r+3,T,E,c,f))}function zB(e,t,n,i,o){let r;const s=i[Ni.compressedAttribute2],a=o.color,c=l(e._batchTable)?U.WHITE:o.getPickId(t.context).color,u=o.sizeInMeters?1:0,f=Math.abs(d.magnitudeSquared(o.alignedAxis)-1)<N.EPSILON6?1:0;e._allSizedInMeters=e._allSizedInMeters&&u===1;let h=0;const _=o._imageIndex;if(_!==-1){const z=n[_];if(!l(z))throw new x(`Invalid billboard image index: ${_}`);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 C=p*yJ+y;let T=U.floatToByte(a.red),E=U.floatToByte(a.green),w=U.floatToByte(a.blue);const S=T*dy+E*Hu+w;T=U.floatToByte(c.red),E=U.floatToByte(c.green),w=U.floatToByte(c.blue);const P=T*dy+E*Hu+w;let O=U.floatToByte(a.alpha)*dy+U.floatToByte(c.alpha)*Hu;O+=u*2+f,e._instanced?(r=o._index,s(r,S,P,O,C)):(r=o._index*4,s(r+0,S,P,O,C),s(r+1,S,P,O,C),s(r+2,S,P,O,C),s(r+3,S,P,O,C))}function UB(e,t,n,i,o){let r;const s=i[Ni.eyeOffset],a=o.eyeOffset;let c=a.z;if(o._heightReference!==Et.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,f=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,f=g.height}Bc.x=u,Bc.y=f;const _=oi.compressTextureCoordinates(Bc);r=o._index,s(r,a.x,a.y,c,_)}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 wJ(e,t,n,i,o){let r;const s=i[Ni.scaleByDistance];let a=0,c=1,u=1,f=1;const h=o.scaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,f=h.farValue,(c!==1||f!==1)&&(e._shaderScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,f)):(r=o._index*4,s(r+0,a,c,u,f),s(r+1,a,c,u,f),s(r+2,a,c,u,f),s(r+3,a,c,u,f))}function SJ(e,t,n,i,o){let r;const s=i[Ni.pixelOffsetScaleByDistance];let a=0,c=1,u=1,f=1;const h=o.pixelOffsetScaleByDistance;l(h)&&(a=h.near,c=h.nearValue,u=h.far,f=h.farValue,(c!==1||f!==1)&&(e._shaderPixelOffsetScaleByDistance=!0)),e._instanced?(r=o._index,s(r,a,c,u,f)):(r=o._index*4,s(r+0,a,c,u,f),s(r+1,a,c,u,f),s(r+2,a,c,u,f),s(r+3,a,c,u,f))}function vJ(e,t,n,i,o){let r;const s=i[Ni.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 f=o.disableDepthTestDistance;const h=o.heightReference===Et.CLAMP_TO_GROUND&&t.context.depthTexture;l(f)||(f=h?5e3:0),f*=f,(h||f>0)&&(e._shaderDisableDepthDistance=!0,f===Number.POSITIVE_INFINITY&&(f=-1));let _,g;if(l(o._labelDimensions))g=o._labelDimensions.x,_=o._labelDimensions.y;else{let T=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}`);T=P.height,E=P.width}_=Math.round(A(o.height,e._textureAtlas.texture.dimensions.y*T));const S=e._textureAtlas.texture.width;g=Math.round(A(o.width,S*E))}const p=Math.floor(N.clamp(g,0,xO)),y=Math.floor(N.clamp(_,0,xO)),C=p*xO+y;e._instanced?(r=o._index,s(r,a,c,f,C)):(r=o._index*4,s(r+0,a,c,f,C),s(r+1,a,c,f,C),s(r+2,a,c,f,C),s(r+3,a,c,f,C))}function DJ(e,t,n,i,o){if(o.heightReference===Et.CLAMP_TO_GROUND){const p=e._scene,y=t.context,C=t.globeTranslucencyState.translucent,T=l(p.globe)&&p.globe.depthTestAgainstTerrain;e._shaderClampToGround=y.depthTexture&&!C&&T}let r;const s=i[Ni.textureCoordinateBoundsOrLabelTranslate];if(wt.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,f=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,f=p.height}const _=a+u,g=c+f;e._instanced?(r=o._index,s(r,a,c,_,g)):(r=o._index*4,s(r+0,a,c,_,g),s(r+1,a,c,_,g),s(r+2,a,c,_,g),s(r+3,a,c,_,g))}function j7e(e,t,n,i,o){if(!l(e._batchTable))return;const r=i[Ni.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 IJ(e,t,n,i,o){if(!e._sdf)return;let r;const s=i[Ni.sdf],a=o.outlineColor,c=o.outlineWidth,u=U.floatToByte(a.red),f=U.floatToByte(a.green),h=U.floatToByte(a.blue),_=u*dy+f*Hu+h,g=c/Ka.RADIUS,p=U.floatToByte(a.alpha)*dy+U.floatToByte(g)*Hu;e._instanced?(r=o._index,s(r,_,p)):(r=o._index*4,s(r+0,_+AJ,p),s(r+1,_+CJ,p),s(r+2,_+TJ,p),s(r+3,_+bJ,p))}function q7e(e,t,n,i,o){gJ(e,t,n,i,o),EJ(e,t,n,i,o),xJ(e,t,n,i,o),zB(e,t,n,i,o),UB(e,t,n,i,o),wJ(e,t,n,i,o),SJ(e,t,n,i,o),vJ(e,t,n,i,o),DJ(e,t,n,i,o),j7e(e,t,n,i,o),IJ(e,t,n,i,o)}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],f=u.position,h=Rt._computeActualPosition(u,f,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):fe.expand(s,h,s))}r&&fe.fromPoints(a,s)}function Y7e(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)&&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._billboardsToUpdateIndex,t,r,!1)}function $7e(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 X7e(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=Be.OVERLAY,i}const K7e=[];na.prototype.update=function(e){if(aF(this),!this.show)return;let t=this._billboards,n=t.length;const i=e.context;this._instanced=i.instancedArrays,Ni=this._instanced?M7e:N7e,bO=this._instanced?z7e:F7e;let o=this._textureAtlas;if(!l(o)){o=this._textureAtlas=new $u({context:i});for(let R=0;R<n;++R)t[R]._loadImage()}const r=o.textureCoordinates;if(r.length===0)return;Y7e(this,e),t=this._billboards,n=t.length;const s=this._billboardsToUpdate,a=this._billboardsToUpdateIndex,c=this._propertiesChanged,u=o.guid,f=this._createVertexArray||this._textureAtlasGUID!==u;this._textureAtlasGUID=u;let h;const _=e.passes,g=_.pick;if(f||!g&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let R=0;R<sF;++R)c[R]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=H7e(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,q7e(this,e,r,h,F)}this._vaf.commit(bO(i))}this._billboardsToUpdateIndex=0}else if(a>0){const R=K7e;R.length=0,(c[yC]||c[O7e]||c[P7e])&&R.push(gJ),(c[sA]||c[cJ]||c[D7e]||c[I7e]||c[v7e])&&(R.push(EJ),this._instanced&&R.push(UB)),(c[sA]||c[L7e]||c[dJ])&&(R.push(xJ),R.push(zB)),(c[sA]||c[uJ])&&R.push(zB),c[lJ]&&R.push(UB),c[fJ]&&R.push(wJ),c[hJ]&&R.push(SJ),(c[pJ]||c[B7e]||c[sA]||c[yC])&&R.push(vJ),(c[sA]||c[yC])&&R.push(DJ),c[mJ]&&R.push(IJ);const F=R.length;if(h=this._vaf.writers,a/n>.1){for(let H=0;H<a;++H){const v=s[H];v._dirty=!1;for(let I=0;I<F;++I)R[I](this,e,r,h,v)}this._vaf.commit(bO(i))}else{for(let H=0;H<a;++H){const v=s[H];v._dirty=!1;for(let I=0;I<F;++I)R[I](this,e,r,h,v);this._instanced?this._vaf.subCommit(v._index,1):this._vaf.subCommit(v._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),$7e(this,e,p);const C=this._blendOption!==this.blendOption;if(this._blendOption=this.blendOption,C){this._blendOption===zo.OPAQUE||this._blendOption===zo.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Qe.fromCache({depthTest:{enabled:!0,func:se.LESS},depthMask:!0}):this._rsOpaque=void 0;const R=this._blendOption===zo.TRANSLUCENT;this._blendOption===zo.TRANSLUCENT||this._blendOption===zo.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Qe.fromCache({depthTest:{enabled:!0,func:R?se.LEQUAL:se.LESS},depthMask:R,blending:Ii.ALPHA_BLEND}):this._rsTranslucent=void 0}this._shaderDisableDepthDistance=this._shaderDisableDepthDistance||e.minimumDisableDepthTestDistance!==0;let T,E,w,S,P;const O=wt.maximumVertexTextureImageUnits>0;if(C||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){T=eAe,E=Z0e,P=[],l(this._batchTable)&&(P.push("VECTOR_TILE"),T=this._batchTable.getVertexShaderCallback(!1,"a_batchId",void 0)(T),E=this._batchTable.getFragmentShaderCallback(!1,void 0)(E)),w=new Ge({defines:P,sources:[T]}),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&&(O?w.defines.push("VERTEX_DEPTH_CHECK"):w.defines.push("FRAGMENT_DEPTH_CHECK"));const R=1-Ka.CUTOFF;this._sdf&&w.defines.push("SDF");const F=l(this._batchTable)?"VECTOR_TILE":"";this._blendOption===zo.OPAQUE_AND_TRANSLUCENT&&(S=new Ge({defines:["OPAQUE",F],sources:[E]}),this._shaderClampToGround&&(O?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=hn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Ni}),S=new Ge({defines:["TRANSLUCENT",F],sources:[E]}),this._shaderClampToGround&&(O?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=hn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Ni})),this._blendOption===zo.OPAQUE&&(S=new Ge({defines:[F],sources:[E]}),this._shaderClampToGround&&(O?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=hn.replaceCache({context:i,shaderProgram:this._sp,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Ni})),this._blendOption===zo.TRANSLUCENT&&(S=new Ge({defines:[F],sources:[E]}),this._shaderClampToGround&&(O?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=hn.replaceCache({context:i,shaderProgram:this._spTranslucent,vertexShaderSource:w,fragmentShaderSource:S,attributeLocations:Ni})),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(_.render||_.pick){const R=this._colorCommands,F=this._blendOption===zo.OPAQUE,H=this._blendOption===zo.OPAQUE_AND_TRANSLUCENT,v=this._vaf.va,I=v.length;let m=this._uniforms,D;l(this._batchTable)?(m=this._batchTable.getUniformMapCallback()(m),D=this._batchTable.getPickId()):D="v_pickColor",R.length=I;const L=H?I*2:I;for(let M=0;M<L;++M){let V=R[M];l(V)||(V=R[M]=new dt);const k=F||H&&M%2===0;V.pass=k||!H?Be.OPAQUE:Be.TRANSLUCENT,V.owner=this;const W=H?Math.floor(M/2):M;V.boundingVolume=p,V.modelMatrix=y,V.count=v[W].indicesCount,V.shaderProgram=k?this._sp:this._spTranslucent,V.uniformMap=m,V.vertexArray=v[W].va,V.renderState=k?this._rsOpaque:this._rsTranslucent,V.debugShowBoundingVolume=this.debugShowBoundingVolume,V.pickId=D,this._instanced&&(V.count=6,V.instanceCount=n),z.push(V)}this.debugShowTextureAtlas&&(l(this.debugCommand)||(this.debugCommand=X7e(this,e.context)),z.push(this.debugCommand))}};na.prototype.isDestroyed=function(){return!1};na.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(),_J(this._billboards),Ue(this)};function PJ(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 Zo(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),zg(this)}const J7e=new Ae;Object.defineProperties(Zo.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=U.clone(e,this._color),zg(this)}},pointSize:{get:function(){return this._pointSize},set:function(e){this._pointSize=e,zg(this)}},pointOutlineColor:{get:function(){return this._pointOutlineColor},set:function(e){this._pointOutlineColor=U.clone(e,this._pointOutlineColor),zg(this)}},pointOutlineWidth:{get:function(){return this._pointOutlineWidth},set:function(e){this._pointOutlineWidth=e,zg(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,J7e);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=U.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&&zg(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}}});Zo.defaultColor=U.WHITE;Zo.defaultPointOutlineColor=U.BLACK;Zo.defaultPointOutlineWidth=0;Zo.defaultPointSize=8;function zg(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,Zo.defaultColor),i=A(e._pointOutlineColor,Zo.defaultPointOutlineColor),o=A(e._pointOutlineWidth,Zo.defaultPointOutlineWidth),r=A(e._pointSize,Zo.defaultPointSize),s=e._billboardColor,a=e._billboardOutlineColor,c=e._billboardOutlineWidth,u=e._billboardSize;if(U.equals(n,s)&&U.equals(i,a)&&o===c&&r===u)return;e._billboardColor=U.clone(n,e._billboardColor),e._billboardOutlineColor=U.clone(i,e._billboardOutlineColor),e._billboardOutlineWidth=o,e._billboardSize=r;const f=n.alpha,h=n.toCssColorString(),_=i.toCssColorString(),g=JSON.stringify([h,r,_,o]);t.setImage(g,PJ(f,h,_,o,r))}Zo.prototype.hasProperty=function(e){return this._content.batchTable.hasProperty(this._batchId,e)};Zo.prototype.getPropertyIds=function(e){return this._content.batchTable.getPropertyIds(this._batchId,e)};Zo.prototype.getProperty=function(e){return this._content.batchTable.getProperty(this._batchId,e)};Zo.prototype.getPropertyInherited=function(e){return as.getPropertyInherited(this._content,this._batchId,e)};Zo.prototype.setProperty=function(e,t){this._content.batchTable.setProperty(this._batchId,e,t),this._content.featurePropertiesDirty=!0};Zo.prototype.isExactClass=function(e){return this._content.batchTable.isExactClass(this._batchId,e)};Zo.prototype.isClass=function(e){return this._content.batchTable.isClass(this._batchId,e)};Zo.prototype.getExactClassName=function(){return this._content.batchTable.getExactClassName(this._batchId)};function Q7e(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,f=r.width+u|0,h=3*a,_=h/2;c.width=f,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,_)),o&&(g.fillStyle="black",g.fillText(t,u/2,_));const p=g.getImageData(0,0,f,h).data,y=p.length,C=f*4;let T,E,w,S;for(T=0;T<y;++T)if(p[T]!==255){w=T/C|0;break}for(T=y-1;T>=0;--T)if(p[T]!==255){S=T/C|0;break}let P=-1;for(T=0;T<f&&P===-1;++T)for(E=0;E<h;++E){const O=T*4+E*C;if(p[O]!==255||p[O+1]!==255||p[O+2]!==255||p[O+3]!==255){P=T;break}}return{width:r.width,height:S-w,ascent:_-w,descent:S-_,minx:P-u/2}}return{width:r.width,height:0,ascent:0,descent:0,minx:0}}let nm;function Z7e(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,U.TRANSPARENT),a=A(t.padding,0),c=a*2,u=document.createElement("canvas");u.width=1,u.height=1,u.style.font=n;const f=u.getContext("2d");l(nm)||(l(f.imageSmoothingEnabled)?nm="imageSmoothingEnabled":l(f.mozImageSmoothingEnabled)?nm="mozImageSmoothingEnabled":l(f.webkitImageSmoothingEnabled)?nm="webkitImageSmoothingEnabled":l(f.msImageSmoothingEnabled)&&(nm="msImageSmoothingEnabled")),f.font=n,f.lineJoin="round",f.lineWidth=r,f[nm]=!1,u.style.visibility="hidden",document.body.appendChild(u);const h=Q7e(f,e,n,i,o);u.dimensions=h,document.body.removeChild(u),u.style.visibility="";const _=-h.minx,g=Math.ceil(h.width)+_+c,p=h.height+c,y=p-h.ascent+a,C=p-y+c;if(u.width=g,u.height=p,f.font=n,f.lineJoin="round",f.lineWidth=r,f[nm]=!1,s!==U.TRANSPARENT&&(f.fillStyle=s.toCssColorString(),f.fillRect(0,0,u.width,u.height)),i){const T=A(t.strokeColor,U.BLACK);f.strokeStyle=T.toCssColorString(),f.strokeText(e,_+a,C)}if(o){const T=A(t.fillColor,U.WHITE);f.fillStyle=T.toCssColorString(),f.fillText(e,_+a,C)}return u}var eYe=tYe,AC=1e20;function tYe(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,f,h,_,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?f=t.stride:f=Math.floor(e.length/r/s)}else window.HTMLCanvasElement&&e instanceof window.HTMLCanvasElement?(_=e,h=_.getContext("2d"),r=_.width,s=_.height,g=h.getImageData(0,0,r,s),c=g.data,f=4):window.CanvasRenderingContext2D&&e instanceof window.CanvasRenderingContext2D?(_=e.canvas,h=e,r=_.width,s=_.height,g=h.getImageData(0,0,r,s),c=g.data,f=4):window.ImageData&&e instanceof window.ImageData&&(g=e,r=e.width,s=e.height,c=g.data,f=4);if(a=Math.max(r,s),window.Uint8ClampedArray&&c instanceof window.Uint8ClampedArray||window.Uint8Array&&c instanceof window.Uint8Array)for(u=c,c=Array(r*s),p=0,y=Math.floor(u.length/f);p<y;p++)c[p]=u[p*f+o]/255;else if(f!==1)throw Error("Raw data can have only 1 value per pixel");var C=Array(r*s),T=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 O=c[p];C[p]=O===1?0:O===0?AC:Math.pow(Math.max(0,.5-O),2),T[p]=O===1?AC:O===0?0:Math.pow(Math.max(0,O-.5),2)}k4(C,r,s,E,w,P,S),k4(T,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-((C[p]-T[p])/i+n),0),1);return z}function k4(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(G4(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(G4(i,o,r,s,t),a=0;a<t;a++)e[c*t+a]=Math.sqrt(o[a])}}function G4(e,t,n,i,o){n[0]=0,i[0]=-AC,i[1]=+AC;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]=+AC}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 nYe={FILL:0,OUTLINE:1,FILL_AND_OUTLINE:2},Nl=Object.freeze(nYe),W4={};let j4=0;const iYe=256,oYe=new U(.165,.165,.165,.8),rYe=new j(7,5),rr=Object.freeze({LTR:0,RTL:1,WEAK:2,BRACKETS:3});function im(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._rebindAllGlyphs=!0}function aA(e){!e._rebindAllGlyphs&&!e._repositionAllGlyphs&&e._labelCollection._labelsToUpdate.push(e),e._repositionAllGlyphs=!0}function cA(e,t){return document.defaultView.getComputedStyle(e,null).getPropertyValue(t)}function OJ(e){let t=W4[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(cA(n,"line-height"));isNaN(i)&&(i=void 0),t={family:cA(n,"font-family"),size:cA(n,"font-size").replace("px",""),style:cA(n,"font-style"),weight:cA(n,"font-weight"),lineHeight:i},document.body.removeChild(n),j4<iYe&&(W4[e._font]=t,j4++)}e._fontFamily=t.family,e._fontSize=t.size,e._fontStyle=t.style,e._fontWeight=t.weight,e._lineHeight=t.lineHeight}function Jl(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=Mt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near.");i=Mt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");o=Mt.clone(o)}if(l(r)){if(r.far<=r.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");r=Ut.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=U.clone(A(e.fillColor,U.WHITE)),this._outlineColor=U.clone(A(e.outlineColor,U.BLACK)),this._outlineWidth=A(e.outlineWidth,1),this._showBackground=A(e.showBackground,!1),this._backgroundColor=U.clone(A(e.backgroundColor,oYe)),this._backgroundPadding=j.clone(A(e.backgroundPadding,rYe)),this._style=A(e.style,Nl.FILL),this._verticalOrigin=A(e.verticalOrigin,Si.BASELINE),this._horizontalOrigin=A(e.horizontalOrigin,Ta.LEFT),this._pixelOffset=j.clone(A(e.pixelOffset,j.ZERO)),this._eyeOffset=d.clone(A(e.eyeOffset,d.ZERO)),this._position=d.clone(A(e.position,d.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,Et.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,OJ(this),this._updateClamping()}Object.defineProperties(Jl.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(!d.equals(t,e)){d.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),aA(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=Jl.enableRightToLeftDetection?fYe(t):t,im(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,im(this),OJ(this))}},fillColor:{get:function(){return this._fillColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._fillColor;U.equals(t,e)||(U.clone(e,t),im(this))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;U.equals(t,e)||(U.clone(e,t),im(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,im(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,im(this))}},backgroundColor:{get:function(){return this._backgroundColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._backgroundColor;if(!U.equals(t,e)){U.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),aA(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,im(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(!Mt.equals(t,e)){this._translucencyByDistance=Mt.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(!Mt.equals(t,e)){this._pixelOffsetScaleByDistance=Mt.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(!Mt.equals(t,e)){this._scaleByDistance=Mt.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(!d.equals(t,e)){d.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,aA(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),aA(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),aA(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(!Ut.equals(e,this._distanceDisplayCondition)){this._distanceDisplayCondition=Ut.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=d.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)}}}});Jl.prototype._updateClamping=function(){Rt._updateClamping(this._labelCollection,this)};Jl.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 Rt._computeScreenSpacePosition(i,o,this._eyeOffset,this._pixelOffset,e,t)};Jl.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===Si.BOTTOM||e.verticalOrigin===Si.BASELINE?o-=s:e.verticalOrigin===Si.CENTER&&(o-=s*.5);else{i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;let u=0,f=0;const h=e._glyphs,_=h.length;for(let g=0;g<_;++g){const p=h[g],y=p.billboard;if(!l(y))continue;const C=t.x+y._translate.x;let T=t.y-y._translate.y;const E=p.dimensions.width*a,w=p.dimensions.height*a;e.verticalOrigin===Si.BOTTOM||e.verticalOrigin===Si.BASELINE?T-=w:e.verticalOrigin===Si.CENTER&&(T-=w*.5),e._verticalOrigin===Si.TOP?T+=Ka.PADDING*a:(e._verticalOrigin===Si.BOTTOM||e._verticalOrigin===Si.BASELINE)&&(T-=Ka.PADDING*a),i=Math.min(i,C),o=Math.min(o,T),u=Math.max(u,C+E),f=Math.max(f,T+w)}r=u-i,s=f-o}return l(n)||(n=new qe),n.x=i,n.y=o,n.width=r,n.height=s,n};Jl.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&&d.equals(this._position,e._position)&&U.equals(this._fillColor,e._fillColor)&&U.equals(this._outlineColor,e._outlineColor)&&U.equals(this._backgroundColor,e._backgroundColor)&&j.equals(this._backgroundPadding,e._backgroundPadding)&&j.equals(this._pixelOffset,e._pixelOffset)&&d.equals(this._eyeOffset,e._eyeOffset)&&Mt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Mt.equals(this._pixelOffsetScaleByDistance,e._pixelOffsetScaleByDistance)&&Mt.equals(this._scaleByDistance,e._scaleByDistance)&&Ut.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance&&this._id===e._id};Jl.prototype.isDestroyed=function(){return!1};Jl.enableRightToLeftDetection=!1;function sYe(e,t){const n=/[a-zA-Z0-9]/,i=/[()[\]{}<>]/,o=[];let r="",s=rr.LTR,a="";const c=e.length;for(let u=0;u<c;++u){const f=e.charAt(u);t.test(f)?a=rr.RTL:n.test(f)?a=rr.LTR:i.test(f)?a=rr.BRACKETS:a=rr.WEAK,u===0&&(s=a),s===a&&a!==rr.BRACKETS?r+=f:(r!==""&&o.push({Type:s,Word:r}),s=a,r=f)}return o.push({Type:a,Word:r}),o}function aYe(e){return e.split("").reverse().join("")}function lA(e,t,n){return e.slice(0,t)+n+e.slice(t)}function cYe(e){switch(e){case"(":return")";case")":return"(";case"[":return"]";case"]":return"[";case"{":return"}";case"}":return"{";case"<":return">";case">":return"<"}}const lYe="א-ת",uYe="؀-ۿݐ-ݿࢠ-ࣿ",q4=new RegExp(`[${lYe}${uYe}]`);function fYe(e){const t=e.split(`
`);let n="";for(let i=0;i<t.length;i++){const o=t[i],r=q4.test(o.charAt(0)),s=sYe(o,q4);let a=0,c="";for(let u=0;u<s.length;++u){const f=s[u],h=f.Type===rr.BRACKETS?cYe(f.Word):aYe(f.Word);r?f.Type===rr.RTL?(c=h+c,a=0):f.Type===rr.LTR?(c=lA(c,a,f.Word),a+=f.Word.length):(f.Type===rr.WEAK||f.Type===rr.BRACKETS)&&(f.Type===rr.WEAK&&s[u-1].Type===rr.BRACKETS?c=h+c:s[u-1].Type===rr.RTL?(c=h+c,a=0):s.length>u+1?s[u+1].Type===rr.RTL?(c=h+c,a=0):(c=lA(c,a,f.Word),a+=f.Word.length):c=lA(c,0,h)):f.Type===rr.RTL?c=lA(c,a,h):f.Type===rr.LTR?(c+=f.Word,a=c.length):(f.Type===rr.WEAK||f.Type===rr.BRACKETS)&&(u>0&&s[u-1].Type===rr.RTL?s.length>u+1?s[u+1].Type===rr.RTL?c=lA(c,a,h):(c+=f.Word,a=c.length):c+=f.Word:(c+=f.Word,a=c.length))}n+=c,i<t.length-1&&(n+=`
`)}return n}var HB={},dYe={get exports(){return HB},set exports(e){HB=e}};(function(e){function t(){var n=0,i=1,o=2,r=3,s=4,a=5,c=6,u=7,f=8,h=9,_=10,g=11,p=12,y=13,C=14,T=15,E=16,w=17,S=0,P=1,O=2,z=3,R=4;function F(m,D){return 55296<=m.charCodeAt(D)&&m.charCodeAt(D)<=56319&&56320<=m.charCodeAt(D+1)&&m.charCodeAt(D+1)<=57343}function H(m,D){D===void 0&&(D=0);var L=m.charCodeAt(D);if(55296<=L&&L<=56319&&D<m.length-1){var M=L,V=m.charCodeAt(D+1);return 56320<=V&&V<=57343?(M-55296)*1024+(V-56320)+65536:M}if(56320<=L&&L<=57343&&D>=1){var M=m.charCodeAt(D-1),V=L;return 55296<=M&&M<=56319?(M-55296)*1024+(V-56320)+65536:V}return L}function v(m,D,L){var M=[m].concat(D).concat([L]),V=M[M.length-2],k=L,W=M.lastIndexOf(C);if(W>1&&M.slice(1,W).every(function(q){return q==r})&&[r,y,w].indexOf(m)==-1)return O;var G=M.lastIndexOf(s);if(G>0&&M.slice(1,G).every(function(q){return q==s})&&[p,s].indexOf(V)==-1)return M.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==C&&D.every(function(q){return q==r})?O:P;if(k==o||k==n||k==i)return P;if(V==c&&(k==c||k==u||k==h||k==_))return S;if((V==h||V==u)&&(k==u||k==f))return S;if((V==_||V==f)&&k==f)return S;if(k==r||k==T)return S;if(k==a)return S;if(V==p)return S;var K=M.indexOf(r)!=-1?M.lastIndexOf(r)-1:M.length-2;return[y,w].indexOf(M[K])!=-1&&M.slice(K+1,-1).every(function(q){return q==r})&&k==C||V==T&&[E,w].indexOf(k)!=-1?S:D.indexOf(s)!=-1?O:V==s&&k==s?S:P}this.nextBreak=function(m,D){if(D===void 0&&(D=0),D<0)return 0;if(D>=m.length-1)return m.length;for(var L=I(H(m,D)),M=[],V=D+1;V<m.length;V++)if(!F(m,V-1)){var k=I(H(m,V));if(v(L,M,k))return V;M.push(k)}return m.length},this.splitGraphemes=function(m){for(var D=[],L=0,M;(M=this.nextBreak(m,L))<m.length;)D.push(m.slice(L,M)),L=M;return L<m.length&&D.push(m.slice(L)),D},this.iterateGraphemes=function(m){var D=0,L={next:function(){var M,V;return(V=this.nextBreak(m,D))<m.length?(M=m.slice(D,V),D=V,{value:M,done:!1}):D<m.length?(M=m.slice(D),D=m.length,{value:M,done:!1}):{value:void 0,done:!0}}.bind(this)};return typeof Symbol<"u"&&Symbol.iterator&&(L[Symbol.iterator]=function(){return L}),L},this.countGraphemes=function(m){for(var D=0,L=0,M;(M=this.nextBreak(m,L))<m.length;)L=M,D++;return L<m.length&&D++,D};function I(m){return 1536<=m&&m<=1541||m==1757||m==1807||m==2274||m==3406||m==69821||70082<=m&&m<=70083||m==72250||72326<=m&&m<=72329||m==73030?p:m==13?n:m==10?i:0<=m&&m<=9||11<=m&&m<=12||14<=m&&m<=31||127<=m&&m<=159||m==173||m==1564||m==6158||m==8203||8206<=m&&m<=8207||m==8232||m==8233||8234<=m&&m<=8238||8288<=m&&m<=8292||m==8293||8294<=m&&m<=8303||55296<=m&&m<=57343||m==65279||65520<=m&&m<=65528||65529<=m&&m<=65531||113824<=m&&m<=113827||119155<=m&&m<=119162||m==917504||m==917505||917506<=m&&m<=917535||917632<=m&&m<=917759||918e3<=m&&m<=921599?o:768<=m&&m<=879||1155<=m&&m<=1159||1160<=m&&m<=1161||1425<=m&&m<=1469||m==1471||1473<=m&&m<=1474||1476<=m&&m<=1477||m==1479||1552<=m&&m<=1562||1611<=m&&m<=1631||m==1648||1750<=m&&m<=1756||1759<=m&&m<=1764||1767<=m&&m<=1768||1770<=m&&m<=1773||m==1809||1840<=m&&m<=1866||1958<=m&&m<=1968||2027<=m&&m<=2035||2070<=m&&m<=2073||2075<=m&&m<=2083||2085<=m&&m<=2087||2089<=m&&m<=2093||2137<=m&&m<=2139||2260<=m&&m<=2273||2275<=m&&m<=2306||m==2362||m==2364||2369<=m&&m<=2376||m==2381||2385<=m&&m<=2391||2402<=m&&m<=2403||m==2433||m==2492||m==2494||2497<=m&&m<=2500||m==2509||m==2519||2530<=m&&m<=2531||2561<=m&&m<=2562||m==2620||2625<=m&&m<=2626||2631<=m&&m<=2632||2635<=m&&m<=2637||m==2641||2672<=m&&m<=2673||m==2677||2689<=m&&m<=2690||m==2748||2753<=m&&m<=2757||2759<=m&&m<=2760||m==2765||2786<=m&&m<=2787||2810<=m&&m<=2815||m==2817||m==2876||m==2878||m==2879||2881<=m&&m<=2884||m==2893||m==2902||m==2903||2914<=m&&m<=2915||m==2946||m==3006||m==3008||m==3021||m==3031||m==3072||3134<=m&&m<=3136||3142<=m&&m<=3144||3146<=m&&m<=3149||3157<=m&&m<=3158||3170<=m&&m<=3171||m==3201||m==3260||m==3263||m==3266||m==3270||3276<=m&&m<=3277||3285<=m&&m<=3286||3298<=m&&m<=3299||3328<=m&&m<=3329||3387<=m&&m<=3388||m==3390||3393<=m&&m<=3396||m==3405||m==3415||3426<=m&&m<=3427||m==3530||m==3535||3538<=m&&m<=3540||m==3542||m==3551||m==3633||3636<=m&&m<=3642||3655<=m&&m<=3662||m==3761||3764<=m&&m<=3769||3771<=m&&m<=3772||3784<=m&&m<=3789||3864<=m&&m<=3865||m==3893||m==3895||m==3897||3953<=m&&m<=3966||3968<=m&&m<=3972||3974<=m&&m<=3975||3981<=m&&m<=3991||3993<=m&&m<=4028||m==4038||4141<=m&&m<=4144||4146<=m&&m<=4151||4153<=m&&m<=4154||4157<=m&&m<=4158||4184<=m&&m<=4185||4190<=m&&m<=4192||4209<=m&&m<=4212||m==4226||4229<=m&&m<=4230||m==4237||m==4253||4957<=m&&m<=4959||5906<=m&&m<=5908||5938<=m&&m<=5940||5970<=m&&m<=5971||6002<=m&&m<=6003||6068<=m&&m<=6069||6071<=m&&m<=6077||m==6086||6089<=m&&m<=6099||m==6109||6155<=m&&m<=6157||6277<=m&&m<=6278||m==6313||6432<=m&&m<=6434||6439<=m&&m<=6440||m==6450||6457<=m&&m<=6459||6679<=m&&m<=6680||m==6683||m==6742||6744<=m&&m<=6750||m==6752||m==6754||6757<=m&&m<=6764||6771<=m&&m<=6780||m==6783||6832<=m&&m<=6845||m==6846||6912<=m&&m<=6915||m==6964||6966<=m&&m<=6970||m==6972||m==6978||7019<=m&&m<=7027||7040<=m&&m<=7041||7074<=m&&m<=7077||7080<=m&&m<=7081||7083<=m&&m<=7085||m==7142||7144<=m&&m<=7145||m==7149||7151<=m&&m<=7153||7212<=m&&m<=7219||7222<=m&&m<=7223||7376<=m&&m<=7378||7380<=m&&m<=7392||7394<=m&&m<=7400||m==7405||m==7412||7416<=m&&m<=7417||7616<=m&&m<=7673||7675<=m&&m<=7679||m==8204||8400<=m&&m<=8412||8413<=m&&m<=8416||m==8417||8418<=m&&m<=8420||8421<=m&&m<=8432||11503<=m&&m<=11505||m==11647||11744<=m&&m<=11775||12330<=m&&m<=12333||12334<=m&&m<=12335||12441<=m&&m<=12442||m==42607||42608<=m&&m<=42610||42612<=m&&m<=42621||42654<=m&&m<=42655||42736<=m&&m<=42737||m==43010||m==43014||m==43019||43045<=m&&m<=43046||43204<=m&&m<=43205||43232<=m&&m<=43249||43302<=m&&m<=43309||43335<=m&&m<=43345||43392<=m&&m<=43394||m==43443||43446<=m&&m<=43449||m==43452||m==43493||43561<=m&&m<=43566||43569<=m&&m<=43570||43573<=m&&m<=43574||m==43587||m==43596||m==43644||m==43696||43698<=m&&m<=43700||43703<=m&&m<=43704||43710<=m&&m<=43711||m==43713||43756<=m&&m<=43757||m==43766||m==44005||m==44008||m==44013||m==64286||65024<=m&&m<=65039||65056<=m&&m<=65071||65438<=m&&m<=65439||m==66045||m==66272||66422<=m&&m<=66426||68097<=m&&m<=68099||68101<=m&&m<=68102||68108<=m&&m<=68111||68152<=m&&m<=68154||m==68159||68325<=m&&m<=68326||m==69633||69688<=m&&m<=69702||69759<=m&&m<=69761||69811<=m&&m<=69814||69817<=m&&m<=69818||69888<=m&&m<=69890||69927<=m&&m<=69931||69933<=m&&m<=69940||m==70003||70016<=m&&m<=70017||70070<=m&&m<=70078||70090<=m&&m<=70092||70191<=m&&m<=70193||m==70196||70198<=m&&m<=70199||m==70206||m==70367||70371<=m&&m<=70378||70400<=m&&m<=70401||m==70460||m==70462||m==70464||m==70487||70502<=m&&m<=70508||70512<=m&&m<=70516||70712<=m&&m<=70719||70722<=m&&m<=70724||m==70726||m==70832||70835<=m&&m<=70840||m==70842||m==70845||70847<=m&&m<=70848||70850<=m&&m<=70851||m==71087||71090<=m&&m<=71093||71100<=m&&m<=71101||71103<=m&&m<=71104||71132<=m&&m<=71133||71219<=m&&m<=71226||m==71229||71231<=m&&m<=71232||m==71339||m==71341||71344<=m&&m<=71349||m==71351||71453<=m&&m<=71455||71458<=m&&m<=71461||71463<=m&&m<=71467||72193<=m&&m<=72198||72201<=m&&m<=72202||72243<=m&&m<=72248||72251<=m&&m<=72254||m==72263||72273<=m&&m<=72278||72281<=m&&m<=72283||72330<=m&&m<=72342||72344<=m&&m<=72345||72752<=m&&m<=72758||72760<=m&&m<=72765||m==72767||72850<=m&&m<=72871||72874<=m&&m<=72880||72882<=m&&m<=72883||72885<=m&&m<=72886||73009<=m&&m<=73014||m==73018||73020<=m&&m<=73021||73023<=m&&m<=73029||m==73031||92912<=m&&m<=92916||92976<=m&&m<=92982||94095<=m&&m<=94098||113821<=m&&m<=113822||m==119141||119143<=m&&m<=119145||119150<=m&&m<=119154||119163<=m&&m<=119170||119173<=m&&m<=119179||119210<=m&&m<=119213||119362<=m&&m<=119364||121344<=m&&m<=121398||121403<=m&&m<=121452||m==121461||m==121476||121499<=m&&m<=121503||121505<=m&&m<=121519||122880<=m&&m<=122886||122888<=m&&m<=122904||122907<=m&&m<=122913||122915<=m&&m<=122916||122918<=m&&m<=122922||125136<=m&&m<=125142||125252<=m&&m<=125258||917536<=m&&m<=917631||917760<=m&&m<=917999?r:127462<=m&&m<=127487?s:m==2307||m==2363||2366<=m&&m<=2368||2377<=m&&m<=2380||2382<=m&&m<=2383||2434<=m&&m<=2435||2495<=m&&m<=2496||2503<=m&&m<=2504||2507<=m&&m<=2508||m==2563||2622<=m&&m<=2624||m==2691||2750<=m&&m<=2752||m==2761||2763<=m&&m<=2764||2818<=m&&m<=2819||m==2880||2887<=m&&m<=2888||2891<=m&&m<=2892||m==3007||3009<=m&&m<=3010||3014<=m&&m<=3016||3018<=m&&m<=3020||3073<=m&&m<=3075||3137<=m&&m<=3140||3202<=m&&m<=3203||m==3262||3264<=m&&m<=3265||3267<=m&&m<=3268||3271<=m&&m<=3272||3274<=m&&m<=3275||3330<=m&&m<=3331||3391<=m&&m<=3392||3398<=m&&m<=3400||3402<=m&&m<=3404||3458<=m&&m<=3459||3536<=m&&m<=3537||3544<=m&&m<=3550||3570<=m&&m<=3571||m==3635||m==3763||3902<=m&&m<=3903||m==3967||m==4145||4155<=m&&m<=4156||4182<=m&&m<=4183||m==4228||m==6070||6078<=m&&m<=6085||6087<=m&&m<=6088||6435<=m&&m<=6438||6441<=m&&m<=6443||6448<=m&&m<=6449||6451<=m&&m<=6456||6681<=m&&m<=6682||m==6741||m==6743||6765<=m&&m<=6770||m==6916||m==6965||m==6971||6973<=m&&m<=6977||6979<=m&&m<=6980||m==7042||m==7073||7078<=m&&m<=7079||m==7082||m==7143||7146<=m&&m<=7148||m==7150||7154<=m&&m<=7155||7204<=m&&m<=7211||7220<=m&&m<=7221||m==7393||7410<=m&&m<=7411||m==7415||43043<=m&&m<=43044||m==43047||43136<=m&&m<=43137||43188<=m&&m<=43203||43346<=m&&m<=43347||m==43395||43444<=m&&m<=43445||43450<=m&&m<=43451||43453<=m&&m<=43456||43567<=m&&m<=43568||43571<=m&&m<=43572||m==43597||m==43755||43758<=m&&m<=43759||m==43765||44003<=m&&m<=44004||44006<=m&&m<=44007||44009<=m&&m<=44010||m==44012||m==69632||m==69634||m==69762||69808<=m&&m<=69810||69815<=m&&m<=69816||m==69932||m==70018||70067<=m&&m<=70069||70079<=m&&m<=70080||70188<=m&&m<=70190||70194<=m&&m<=70195||m==70197||70368<=m&&m<=70370||70402<=m&&m<=70403||m==70463||70465<=m&&m<=70468||70471<=m&&m<=70472||70475<=m&&m<=70477||70498<=m&&m<=70499||70709<=m&&m<=70711||70720<=m&&m<=70721||m==70725||70833<=m&&m<=70834||m==70841||70843<=m&&m<=70844||m==70846||m==70849||71088<=m&&m<=71089||71096<=m&&m<=71099||m==71102||71216<=m&&m<=71218||71227<=m&&m<=71228||m==71230||m==71340||71342<=m&&m<=71343||m==71350||71456<=m&&m<=71457||m==71462||72199<=m&&m<=72200||m==72249||72279<=m&&m<=72280||m==72343||m==72751||m==72766||m==72873||m==72881||m==72884||94033<=m&&m<=94078||m==119142||m==119149?a:4352<=m&&m<=4447||43360<=m&&m<=43388?c:4448<=m&&m<=4519||55216<=m&&m<=55238?u:4520<=m&&m<=4607||55243<=m&&m<=55291?f:m==44032||m==44060||m==44088||m==44116||m==44144||m==44172||m==44200||m==44228||m==44256||m==44284||m==44312||m==44340||m==44368||m==44396||m==44424||m==44452||m==44480||m==44508||m==44536||m==44564||m==44592||m==44620||m==44648||m==44676||m==44704||m==44732||m==44760||m==44788||m==44816||m==44844||m==44872||m==44900||m==44928||m==44956||m==44984||m==45012||m==45040||m==45068||m==45096||m==45124||m==45152||m==45180||m==45208||m==45236||m==45264||m==45292||m==45320||m==45348||m==45376||m==45404||m==45432||m==45460||m==45488||m==45516||m==45544||m==45572||m==45600||m==45628||m==45656||m==45684||m==45712||m==45740||m==45768||m==45796||m==45824||m==45852||m==45880||m==45908||m==45936||m==45964||m==45992||m==46020||m==46048||m==46076||m==46104||m==46132||m==46160||m==46188||m==46216||m==46244||m==46272||m==46300||m==46328||m==46356||m==46384||m==46412||m==46440||m==46468||m==46496||m==46524||m==46552||m==46580||m==46608||m==46636||m==46664||m==46692||m==46720||m==46748||m==46776||m==46804||m==46832||m==46860||m==46888||m==46916||m==46944||m==46972||m==47e3||m==47028||m==47056||m==47084||m==47112||m==47140||m==47168||m==47196||m==47224||m==47252||m==47280||m==47308||m==47336||m==47364||m==47392||m==47420||m==47448||m==47476||m==47504||m==47532||m==47560||m==47588||m==47616||m==47644||m==47672||m==47700||m==47728||m==47756||m==47784||m==47812||m==47840||m==47868||m==47896||m==47924||m==47952||m==47980||m==48008||m==48036||m==48064||m==48092||m==48120||m==48148||m==48176||m==48204||m==48232||m==48260||m==48288||m==48316||m==48344||m==48372||m==48400||m==48428||m==48456||m==48484||m==48512||m==48540||m==48568||m==48596||m==48624||m==48652||m==48680||m==48708||m==48736||m==48764||m==48792||m==48820||m==48848||m==48876||m==48904||m==48932||m==48960||m==48988||m==49016||m==49044||m==49072||m==49100||m==49128||m==49156||m==49184||m==49212||m==49240||m==49268||m==49296||m==49324||m==49352||m==49380||m==49408||m==49436||m==49464||m==49492||m==49520||m==49548||m==49576||m==49604||m==49632||m==49660||m==49688||m==49716||m==49744||m==49772||m==49800||m==49828||m==49856||m==49884||m==49912||m==49940||m==49968||m==49996||m==50024||m==50052||m==50080||m==50108||m==50136||m==50164||m==50192||m==50220||m==50248||m==50276||m==50304||m==50332||m==50360||m==50388||m==50416||m==50444||m==50472||m==50500||m==50528||m==50556||m==50584||m==50612||m==50640||m==50668||m==50696||m==50724||m==50752||m==50780||m==50808||m==50836||m==50864||m==50892||m==50920||m==50948||m==50976||m==51004||m==51032||m==51060||m==51088||m==51116||m==51144||m==51172||m==51200||m==51228||m==51256||m==51284||m==51312||m==51340||m==51368||m==51396||m==51424||m==51452||m==51480||m==51508||m==51536||m==51564||m==51592||m==51620||m==51648||m==51676||m==51704||m==51732||m==51760||m==51788||m==51816||m==51844||m==51872||m==51900||m==51928||m==51956||m==51984||m==52012||m==52040||m==52068||m==52096||m==52124||m==52152||m==52180||m==52208||m==52236||m==52264||m==52292||m==52320||m==52348||m==52376||m==52404||m==52432||m==52460||m==52488||m==52516||m==52544||m==52572||m==52600||m==52628||m==52656||m==52684||m==52712||m==52740||m==52768||m==52796||m==52824||m==52852||m==52880||m==52908||m==52936||m==52964||m==52992||m==53020||m==53048||m==53076||m==53104||m==53132||m==53160||m==53188||m==53216||m==53244||m==53272||m==53300||m==53328||m==53356||m==53384||m==53412||m==53440||m==53468||m==53496||m==53524||m==53552||m==53580||m==53608||m==53636||m==53664||m==53692||m==53720||m==53748||m==53776||m==53804||m==53832||m==53860||m==53888||m==53916||m==53944||m==53972||m==54e3||m==54028||m==54056||m==54084||m==54112||m==54140||m==54168||m==54196||m==54224||m==54252||m==54280||m==54308||m==54336||m==54364||m==54392||m==54420||m==54448||m==54476||m==54504||m==54532||m==54560||m==54588||m==54616||m==54644||m==54672||m==54700||m==54728||m==54756||m==54784||m==54812||m==54840||m==54868||m==54896||m==54924||m==54952||m==54980||m==55008||m==55036||m==55064||m==55092||m==55120||m==55148||m==55176?h:44033<=m&&m<=44059||44061<=m&&m<=44087||44089<=m&&m<=44115||44117<=m&&m<=44143||44145<=m&&m<=44171||44173<=m&&m<=44199||44201<=m&&m<=44227||44229<=m&&m<=44255||44257<=m&&m<=44283||44285<=m&&m<=44311||44313<=m&&m<=44339||44341<=m&&m<=44367||44369<=m&&m<=44395||44397<=m&&m<=44423||44425<=m&&m<=44451||44453<=m&&m<=44479||44481<=m&&m<=44507||44509<=m&&m<=44535||44537<=m&&m<=44563||44565<=m&&m<=44591||44593<=m&&m<=44619||44621<=m&&m<=44647||44649<=m&&m<=44675||44677<=m&&m<=44703||44705<=m&&m<=44731||44733<=m&&m<=44759||44761<=m&&m<=44787||44789<=m&&m<=44815||44817<=m&&m<=44843||44845<=m&&m<=44871||44873<=m&&m<=44899||44901<=m&&m<=44927||44929<=m&&m<=44955||44957<=m&&m<=44983||44985<=m&&m<=45011||45013<=m&&m<=45039||45041<=m&&m<=45067||45069<=m&&m<=45095||45097<=m&&m<=45123||45125<=m&&m<=45151||45153<=m&&m<=45179||45181<=m&&m<=45207||45209<=m&&m<=45235||45237<=m&&m<=45263||45265<=m&&m<=45291||45293<=m&&m<=45319||45321<=m&&m<=45347||45349<=m&&m<=45375||45377<=m&&m<=45403||45405<=m&&m<=45431||45433<=m&&m<=45459||45461<=m&&m<=45487||45489<=m&&m<=45515||45517<=m&&m<=45543||45545<=m&&m<=45571||45573<=m&&m<=45599||45601<=m&&m<=45627||45629<=m&&m<=45655||45657<=m&&m<=45683||45685<=m&&m<=45711||45713<=m&&m<=45739||45741<=m&&m<=45767||45769<=m&&m<=45795||45797<=m&&m<=45823||45825<=m&&m<=45851||45853<=m&&m<=45879||45881<=m&&m<=45907||45909<=m&&m<=45935||45937<=m&&m<=45963||45965<=m&&m<=45991||45993<=m&&m<=46019||46021<=m&&m<=46047||46049<=m&&m<=46075||46077<=m&&m<=46103||46105<=m&&m<=46131||46133<=m&&m<=46159||46161<=m&&m<=46187||46189<=m&&m<=46215||46217<=m&&m<=46243||46245<=m&&m<=46271||46273<=m&&m<=46299||46301<=m&&m<=46327||46329<=m&&m<=46355||46357<=m&&m<=46383||46385<=m&&m<=46411||46413<=m&&m<=46439||46441<=m&&m<=46467||46469<=m&&m<=46495||46497<=m&&m<=46523||46525<=m&&m<=46551||46553<=m&&m<=46579||46581<=m&&m<=46607||46609<=m&&m<=46635||46637<=m&&m<=46663||46665<=m&&m<=46691||46693<=m&&m<=46719||46721<=m&&m<=46747||46749<=m&&m<=46775||46777<=m&&m<=46803||46805<=m&&m<=46831||46833<=m&&m<=46859||46861<=m&&m<=46887||46889<=m&&m<=46915||46917<=m&&m<=46943||46945<=m&&m<=46971||46973<=m&&m<=46999||47001<=m&&m<=47027||47029<=m&&m<=47055||47057<=m&&m<=47083||47085<=m&&m<=47111||47113<=m&&m<=47139||47141<=m&&m<=47167||47169<=m&&m<=47195||47197<=m&&m<=47223||47225<=m&&m<=47251||47253<=m&&m<=47279||47281<=m&&m<=47307||47309<=m&&m<=47335||47337<=m&&m<=47363||47365<=m&&m<=47391||47393<=m&&m<=47419||47421<=m&&m<=47447||47449<=m&&m<=47475||47477<=m&&m<=47503||47505<=m&&m<=47531||47533<=m&&m<=47559||47561<=m&&m<=47587||47589<=m&&m<=47615||47617<=m&&m<=47643||47645<=m&&m<=47671||47673<=m&&m<=47699||47701<=m&&m<=47727||47729<=m&&m<=47755||47757<=m&&m<=47783||47785<=m&&m<=47811||47813<=m&&m<=47839||47841<=m&&m<=47867||47869<=m&&m<=47895||47897<=m&&m<=47923||47925<=m&&m<=47951||47953<=m&&m<=47979||47981<=m&&m<=48007||48009<=m&&m<=48035||48037<=m&&m<=48063||48065<=m&&m<=48091||48093<=m&&m<=48119||48121<=m&&m<=48147||48149<=m&&m<=48175||48177<=m&&m<=48203||48205<=m&&m<=48231||48233<=m&&m<=48259||48261<=m&&m<=48287||48289<=m&&m<=48315||48317<=m&&m<=48343||48345<=m&&m<=48371||48373<=m&&m<=48399||48401<=m&&m<=48427||48429<=m&&m<=48455||48457<=m&&m<=48483||48485<=m&&m<=48511||48513<=m&&m<=48539||48541<=m&&m<=48567||48569<=m&&m<=48595||48597<=m&&m<=48623||48625<=m&&m<=48651||48653<=m&&m<=48679||48681<=m&&m<=48707||48709<=m&&m<=48735||48737<=m&&m<=48763||48765<=m&&m<=48791||48793<=m&&m<=48819||48821<=m&&m<=48847||48849<=m&&m<=48875||48877<=m&&m<=48903||48905<=m&&m<=48931||48933<=m&&m<=48959||48961<=m&&m<=48987||48989<=m&&m<=49015||49017<=m&&m<=49043||49045<=m&&m<=49071||49073<=m&&m<=49099||49101<=m&&m<=49127||49129<=m&&m<=49155||49157<=m&&m<=49183||49185<=m&&m<=49211||49213<=m&&m<=49239||49241<=m&&m<=49267||49269<=m&&m<=49295||49297<=m&&m<=49323||49325<=m&&m<=49351||49353<=m&&m<=49379||49381<=m&&m<=49407||49409<=m&&m<=49435||49437<=m&&m<=49463||49465<=m&&m<=49491||49493<=m&&m<=49519||49521<=m&&m<=49547||49549<=m&&m<=49575||49577<=m&&m<=49603||49605<=m&&m<=49631||49633<=m&&m<=49659||49661<=m&&m<=49687||49689<=m&&m<=49715||49717<=m&&m<=49743||49745<=m&&m<=49771||49773<=m&&m<=49799||49801<=m&&m<=49827||49829<=m&&m<=49855||49857<=m&&m<=49883||49885<=m&&m<=49911||49913<=m&&m<=49939||49941<=m&&m<=49967||49969<=m&&m<=49995||49997<=m&&m<=50023||50025<=m&&m<=50051||50053<=m&&m<=50079||50081<=m&&m<=50107||50109<=m&&m<=50135||50137<=m&&m<=50163||50165<=m&&m<=50191||50193<=m&&m<=50219||50221<=m&&m<=50247||50249<=m&&m<=50275||50277<=m&&m<=50303||50305<=m&&m<=50331||50333<=m&&m<=50359||50361<=m&&m<=50387||50389<=m&&m<=50415||50417<=m&&m<=50443||50445<=m&&m<=50471||50473<=m&&m<=50499||50501<=m&&m<=50527||50529<=m&&m<=50555||50557<=m&&m<=50583||50585<=m&&m<=50611||50613<=m&&m<=50639||50641<=m&&m<=50667||50669<=m&&m<=50695||50697<=m&&m<=50723||50725<=m&&m<=50751||50753<=m&&m<=50779||50781<=m&&m<=50807||50809<=m&&m<=50835||50837<=m&&m<=50863||50865<=m&&m<=50891||50893<=m&&m<=50919||50921<=m&&m<=50947||50949<=m&&m<=50975||50977<=m&&m<=51003||51005<=m&&m<=51031||51033<=m&&m<=51059||51061<=m&&m<=51087||51089<=m&&m<=51115||51117<=m&&m<=51143||51145<=m&&m<=51171||51173<=m&&m<=51199||51201<=m&&m<=51227||51229<=m&&m<=51255||51257<=m&&m<=51283||51285<=m&&m<=51311||51313<=m&&m<=51339||51341<=m&&m<=51367||51369<=m&&m<=51395||51397<=m&&m<=51423||51425<=m&&m<=51451||51453<=m&&m<=51479||51481<=m&&m<=51507||51509<=m&&m<=51535||51537<=m&&m<=51563||51565<=m&&m<=51591||51593<=m&&m<=51619||51621<=m&&m<=51647||51649<=m&&m<=51675||51677<=m&&m<=51703||51705<=m&&m<=51731||51733<=m&&m<=51759||51761<=m&&m<=51787||51789<=m&&m<=51815||51817<=m&&m<=51843||51845<=m&&m<=51871||51873<=m&&m<=51899||51901<=m&&m<=51927||51929<=m&&m<=51955||51957<=m&&m<=51983||51985<=m&&m<=52011||52013<=m&&m<=52039||52041<=m&&m<=52067||52069<=m&&m<=52095||52097<=m&&m<=52123||52125<=m&&m<=52151||52153<=m&&m<=52179||52181<=m&&m<=52207||52209<=m&&m<=52235||52237<=m&&m<=52263||52265<=m&&m<=52291||52293<=m&&m<=52319||52321<=m&&m<=52347||52349<=m&&m<=52375||52377<=m&&m<=52403||52405<=m&&m<=52431||52433<=m&&m<=52459||52461<=m&&m<=52487||52489<=m&&m<=52515||52517<=m&&m<=52543||52545<=m&&m<=52571||52573<=m&&m<=52599||52601<=m&&m<=52627||52629<=m&&m<=52655||52657<=m&&m<=52683||52685<=m&&m<=52711||52713<=m&&m<=52739||52741<=m&&m<=52767||52769<=m&&m<=52795||52797<=m&&m<=52823||52825<=m&&m<=52851||52853<=m&&m<=52879||52881<=m&&m<=52907||52909<=m&&m<=52935||52937<=m&&m<=52963||52965<=m&&m<=52991||52993<=m&&m<=53019||53021<=m&&m<=53047||53049<=m&&m<=53075||53077<=m&&m<=53103||53105<=m&&m<=53131||53133<=m&&m<=53159||53161<=m&&m<=53187||53189<=m&&m<=53215||53217<=m&&m<=53243||53245<=m&&m<=53271||53273<=m&&m<=53299||53301<=m&&m<=53327||53329<=m&&m<=53355||53357<=m&&m<=53383||53385<=m&&m<=53411||53413<=m&&m<=53439||53441<=m&&m<=53467||53469<=m&&m<=53495||53497<=m&&m<=53523||53525<=m&&m<=53551||53553<=m&&m<=53579||53581<=m&&m<=53607||53609<=m&&m<=53635||53637<=m&&m<=53663||53665<=m&&m<=53691||53693<=m&&m<=53719||53721<=m&&m<=53747||53749<=m&&m<=53775||53777<=m&&m<=53803||53805<=m&&m<=53831||53833<=m&&m<=53859||53861<=m&&m<=53887||53889<=m&&m<=53915||53917<=m&&m<=53943||53945<=m&&m<=53971||53973<=m&&m<=53999||54001<=m&&m<=54027||54029<=m&&m<=54055||54057<=m&&m<=54083||54085<=m&&m<=54111||54113<=m&&m<=54139||54141<=m&&m<=54167||54169<=m&&m<=54195||54197<=m&&m<=54223||54225<=m&&m<=54251||54253<=m&&m<=54279||54281<=m&&m<=54307||54309<=m&&m<=54335||54337<=m&&m<=54363||54365<=m&&m<=54391||54393<=m&&m<=54419||54421<=m&&m<=54447||54449<=m&&m<=54475||54477<=m&&m<=54503||54505<=m&&m<=54531||54533<=m&&m<=54559||54561<=m&&m<=54587||54589<=m&&m<=54615||54617<=m&&m<=54643||54645<=m&&m<=54671||54673<=m&&m<=54699||54701<=m&&m<=54727||54729<=m&&m<=54755||54757<=m&&m<=54783||54785<=m&&m<=54811||54813<=m&&m<=54839||54841<=m&&m<=54867||54869<=m&&m<=54895||54897<=m&&m<=54923||54925<=m&&m<=54951||54953<=m&&m<=54979||54981<=m&&m<=55007||55009<=m&&m<=55035||55037<=m&&m<=55063||55065<=m&&m<=55091||55093<=m&&m<=55119||55121<=m&&m<=55147||55149<=m&&m<=55175||55177<=m&&m<=55203?_:m==9757||m==9977||9994<=m&&m<=9997||m==127877||127938<=m&&m<=127940||m==127943||127946<=m&&m<=127948||128066<=m&&m<=128067||128070<=m&&m<=128080||m==128110||128112<=m&&m<=128120||m==128124||128129<=m&&m<=128131||128133<=m&&m<=128135||m==128170||128372<=m&&m<=128373||m==128378||m==128400||128405<=m&&m<=128406||128581<=m&&m<=128583||128587<=m&&m<=128591||m==128675||128692<=m&&m<=128694||m==128704||m==128716||129304<=m&&m<=129308||129310<=m&&m<=129311||m==129318||129328<=m&&m<=129337||129341<=m&&m<=129342||129489<=m&&m<=129501?y:127995<=m&&m<=127999?C:m==8205?T:m==9792||m==9794||9877<=m&&m<=9878||m==9992||m==10084||m==127752||m==127806||m==127859||m==127891||m==127908||m==127912||m==127979||m==127981||m==128139||128187<=m&&m<=128188||m==128295||m==128300||m==128488||m==128640||m==128658?E:128102<=m&&m<=128105?w:g}return this}e.exports&&(e.exports=t)})(dYe);const hYe=HB;function pYe(){this.textureInfo=void 0,this.dimensions=void 0,this.billboard=void 0}function mYe(e,t,n){this.labelCollection=e,this.index=t,this.dimensions=n}const _Ye=1.2,LJ="ID_WHITE_PIXEL",VB=new j(4,4),gYe=new qe(1,1,1,1);function yYe(e){const t=document.createElement("canvas");t.width=VB.x,t.height=VB.y;const n=t.getContext("2d");n.fillStyle="#fff",n.fillRect(0,0,t.width,t.height),e.addImage(LJ,t)}const Ic={};function AYe(e,t,n,i,o,r,s){return Ic.font=t,Ic.fillColor=n,Ic.strokeColor=i,Ic.strokeWidth=o,Ic.padding=Ka.PADDING,s===Si.CENTER?Ic.textBaseline="middle":s===Si.TOP?Ic.textBaseline="top":Ic.textBaseline="bottom",Ic.fill=r===Nl.FILL||r===Nl.FILL_AND_OUTLINE,Ic.stroke=r===Nl.OUTLINE||r===Nl.FILL_AND_OUTLINE,Ic.backgroundColor=U.BLACK,Z7e(e,Ic)}function kB(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 CYe(e,t,n,i){i.index=e.addImageSync(t,n)}const TYe=new hYe;function bYe(e,t){const n=t._renderedText,i=TYe.splitGraphemes(n),o=i.length,r=t._glyphs,s=r.length;let a,c,u;if(t._relativeSize=t._fontSize/Ka.FONT_SIZE,o<s)for(c=o;c<s;++c)kB(e,r[c]);r.length=o;const f=t._showBackground&&n.split(`
`).join("").length>0;let h=t._backgroundBillboard;const _=e._backgroundBillboardCollection;f?(l(h)||(h=_.add({collection:e,image:LJ,imageSubRegion:gYe}),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=Ta.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)&&(_.remove(h),t._backgroundBillboard=h=void 0);const g=e._glyphTextureCache;for(u=0;u<o;++u){const p=i[u],y=t._verticalOrigin,C=JSON.stringify([p,t._fontFamily,t._fontStyle,t._fontWeight,+y]);let T=g[C];if(!l(T)){const E=`${t._fontStyle} ${t._fontWeight} ${Ka.FONT_SIZE}px ${t._fontFamily}`,w=AYe(p,E,U.WHITE,U.WHITE,0,Nl.FILL,y);if(T=new mYe(e,-1,w.dimensions),g[C]=T,w.width>0&&w.height>0){const S=eYe(w,{cutoff:Ka.CUTOFF,radius:Ka.RADIUS}),P=w.getContext("2d"),O=w.width,z=w.height,R=P.getImageData(0,0,O,z);for(let F=0;F<O;F++)for(let H=0;H<z;H++){const v=H*O+F,I=S[v]*255,m=v*4;R.data[m+0]=I,R.data[m+1]=I,R.data[m+2]=I,R.data[m+3]=I}P.putImageData(R,0,0),p!==" "&&CYe(e._textureAtlas,C,w,T)}}if(a=r[u],l(a)?T.index===-1?kB(e,a):l(a.textureInfo)&&(a.textureInfo=void 0):(a=new pYe,r[u]=a),a.textureInfo=T,a.dimensions=T.dimensions,T.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=Ta.LEFT,E.verticalOrigin=t._verticalOrigin,E.heightReference=t._heightReference,E.scale=t.totalScale,E.pickPrimitive=t,E.id=t._id,E.image=C,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===Nl.FILL_AND_OUTLINE?(E.color=t._fillColor,E.outlineWidth=t.outlineWidth):t.style===Nl.FILL?(E.color=t._fillColor,E.outlineWidth=0):t.style===Nl.OUTLINE&&(E.color=U.TRANSPARENT,E.outlineWidth=t.outlineWidth)}}t._repositionAllGlyphs=!0}function Y4(e,t,n){return t===Ta.CENTER?-e/2:t===Ta.RIGHT?-(e+n.x):n.x}const ao=new j,EYe=new j;function xYe(e){const t=e._glyphs,n=e._renderedText;let i,o,r=0,s=0;const a=[];let c=Number.NEGATIVE_INFINITY,u=0,f=1,h;const _=t.length,g=e._backgroundBillboard,p=j.clone(l(g)?e._backgroundPadding:j.ZERO,EYe);for(p.x/=e._relativeSize,p.y/=e._relativeSize,h=0;h<_;++h)n.charAt(h)===`
`?(a.push(r),++f,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<_-1&&(r+=t[h+1].dimensions.minx),s=Math.max(s,r));a.push(r);const y=u+c,C=e.totalScale,T=e._horizontalOrigin,E=e._verticalOrigin;let w=0,S=a[w],P=Y4(S,T,p);const O=(l(e._lineHeight)?e._lineHeight:_Ye*e._fontSize)/e._relativeSize,z=O*(f-1);let R=s,F=y+z;l(g)&&(R+=p.x*2,F+=p.y*2,g._labelHorizontalOrigin=T),ao.x=P*C,ao.y=0;let H=!0,v=0;for(h=0;h<_;++h)if(n.charAt(h)===`
`)++w,v+=O,S=a[w],P=Y4(S,T,p),ao.x=P*C,H=!0;else if(i=t[h],o=i.dimensions,E===Si.TOP?(ao.y=o.height-u-p.y,ao.y+=Ka.PADDING):E===Si.CENTER?ao.y=(z+o.height-u)/2:E===Si.BASELINE?(ao.y=z,ao.y-=Ka.PADDING):(ao.y=z+c+p.y,ao.y-=Ka.PADDING),ao.y=(ao.y-o.descent-v)*C,H&&(ao.x-=Ka.PADDING*C,H=!1),l(i.billboard)&&(i.billboard._setTranslate(ao),i.billboard._labelDimensions.x=R,i.billboard._labelDimensions.y=F,i.billboard._labelHorizontalOrigin=T),h<_-1){const I=t[h+1];ao.x+=(o.width-o.minx+I.dimensions.minx)*C}if(l(g)&&n.split(`
`).join("").length>0&&(T===Ta.CENTER?P=-s/2-p.x:T===Ta.RIGHT?P=-(s+p.x*2):P=0,ao.x=P*C,E===Si.TOP?ao.y=y-u-c:E===Si.CENTER?ao.y=(y-u)/2-c:E===Si.BASELINE?ao.y=-p.y-c:ao.y=0,ao.y=ao.y*C,g.width=R,g.height=F,g._setTranslate(ao),g._labelTranslate=j.clone(ao,g._labelTranslate)),e.heightReference===Et.CLAMP_TO_GROUND)for(h=0;h<_;++h){i=t[h];const I=i.billboard;l(I)&&(I._labelTranslate=j.clone(ao,I._labelTranslate))}}function BJ(e,t){const n=t._glyphs;for(let i=0,o=n.length;i<o;++i)kB(e,n[i]);l(t._backgroundBillboard)&&(e._backgroundBillboardCollection.remove(t._backgroundBillboard),t._backgroundBillboard=void 0),t._labelCollection=void 0,l(t._removeCallbackFunc)&&t._removeCallbackFunc(),Ue(t)}function Cc(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 na({scene:this._scene}),this._backgroundBillboardCollection.destroyTextureAtlas=!1,this._billboardCollection=new na({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=U.clone(U.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,zo.OPAQUE_AND_TRANSLUCENT)}Object.defineProperties(Cc.prototype,{length:{get:function(){return this._labels.length}}});Cc.prototype.add=function(e){const t=new Jl(e,this);return this._labels.push(t),this._labelsToUpdate.push(t),t};Cc.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),BJ(this,e),!0}return!1};Cc.prototype.removeAll=function(){const e=this._labels;for(let t=0,n=e.length;t<n;++t)BJ(this,e[t]);e.length=0};Cc.prototype.contains=function(e){return l(e)&&e._labelCollection===this};Cc.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._labels[e]};Cc.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 $u({context:i}),t.textureAtlas=this._textureAtlas),l(this._backgroundTextureAtlas)||(this._backgroundTextureAtlas=new $u({context:i,initialSize:VB}),n.textureAtlas=this._backgroundTextureAtlas,yYe(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&&(bYe(this,a),a._rebindAllGlyphs=!1),a._repositionAllGlyphs&&(xYe(a),a._repositionAllGlyphs=!1);const u=a._glyphs.length-c;this._totalGlyphCount+=u}const r=n.length>0?zo.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)};Cc.prototype.isDestroyed=function(){return!1};Cc.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(),Ue(this)};const ba={};ba.numberOfPoints=function(e,t,n){const i=d.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 wYe=new Ae;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,wYe).height}return i};const SYe=new B,vYe=new d,$4=new d,DYe=new St(d.UNIT_X,0),X4=new d,IYe=new St(d.UNIT_X,0),PYe=new d,OYe=new d,cF=[];function RJ(e,t,n){const i=cF;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 lD=new Ae,FS=new Ae,dp=new d,lF=new d,LYe=new d,SO=new vd;let uA=new ns;function BYe(e,t,n,i,o,r,s,a){const c=i.scaleToGeodeticSurface(e,lF),u=i.scaleToGeodeticSurface(t,LYe),f=ba.numberOfPoints(e,t,n),h=i.cartesianToCartographic(c,lD),_=i.cartesianToCartographic(u,FS),g=RJ(f,o,r);SO.setEndPoints(h,_);const p=SO.surfaceDistance/f;let y=a;h.height=o;let C=i.cartographicToCartesian(h,dp);d.pack(C,s,y),y+=3;for(let T=1;T<f;T++){const E=SO.interpolateUsingSurfaceDistance(T*p,FS);E.height=g[T],C=i.cartographicToCartesian(E,dp),d.pack(C,s,y),y+=3}return y}function RYe(e,t,n,i,o,r,s,a){const c=i.cartesianToCartographic(e,lD),u=i.cartesianToCartographic(t,FS),f=ba.numberOfPointsRhumbLine(c,u,n);c.height=0,u.height=0;const h=RJ(f,o,r);uA.ellipsoid.equals(i)||(uA=new ns(void 0,void 0,i)),uA.setEndPoints(c,u);const _=uA.surfaceDistance/f;let g=a;c.height=o;let p=i.cartographicToCartesian(c,dp);d.pack(p,s,g),g+=3;for(let y=1;y<f;y++){const C=uA.interpolateUsingSurfaceDistance(y*_,FS);C.height=h[y],p=i.cartographicToCartesian(C,dp),d.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,SYe),r=B.multiplyByPoint(o,d.ZERO,vYe),s=d.normalize(B.multiplyByPointAsVector(o,d.UNIT_Y,$4),$4),a=St.fromPointNormal(r,s,DYe),c=d.normalize(B.multiplyByPointAsVector(o,d.UNIT_X,X4),X4),u=St.fromPointNormal(r,c,IYe);let f=1;n.push(d.clone(e[0]));let h=n[0];const _=e.length;for(let g=1;g<_;++g){const p=e[g];if(St.getPointDistance(u,h)<0||St.getPointDistance(u,p)<0){const y=nr.lineSegmentPlane(h,p,a,PYe);if(l(y)){const C=d.multiplyByScalar(s,5e-9,OYe);St.getPointDistance(a,h)<0&&d.negate(C,C),n.push(d.add(y,C,new d)),i.push(f+1),d.negate(C,C),n.push(d.add(y,C,new d)),f=1}}n.push(d.clone(e[g])),f++,h=p}i.push(f)}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,pe.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],lF);if(o=r?o[0]:o,o!==0){const C=i.geodeticSurfaceNormal(y,dp);d.multiplyByScalar(C,o,C),d.add(y,C,y)}return[y.x,y.y,y.z]}let s=e.minDistance;if(!l(s)){const y=A(e.granularity,N.RADIANS_PER_DEGREE);s=N.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,f=new Array(u);let h=0;for(c=0;c<n-1;c++){const y=t[c],C=t[c+1],T=r?o[c]:o,E=r?o[c+1]:o;h=BYe(y,C,s,i,T,E,f,h)}cF.length=0;const _=t[n-1],g=i.cartesianToCartographic(_,lD);g.height=r?o[n-1]:o;const p=i.cartographicToCartesian(g,dp);return d.pack(p,f,u-3),f};const K4=new Ae,NYe=new Ae;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,pe.WGS84);let o=A(e.height,0);const r=Array.isArray(o);if(n<1)return[];if(n===1){const T=i.scaleToGeodeticSurface(t[0],lF);if(o=r?o[0]:o,o!==0){const E=i.geodeticSurfaceNormal(T,dp);d.multiplyByScalar(E,o,E),d.add(T,E,T)}return[T.x,T.y,T.z]}const s=A(e.granularity,N.RADIANS_PER_DEGREE);let a=0,c,u=i.cartesianToCartographic(t[0],K4),f;for(c=0;c<n-1;c++)f=i.cartesianToCartographic(t[c+1],NYe),a+=ba.numberOfPointsRhumbLine(u,f,s),u=Ae.clone(f,K4);const h=(a+1)*3,_=new Array(h);let g=0;for(c=0;c<n-1;c++){const T=t[c],E=t[c+1],w=r?o[c]:o,S=r?o[c+1]:o;g=RYe(T,E,s,i,w,S,_,g)}cF.length=0;const p=t[n-1],y=i.cartesianToCartographic(p,lD);y.height=r?o[n-1]:o;const C=i.cartographicToCartesian(y,dp);return d.pack(C,_,h-3),_};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]=d.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]=d.unpack(t,o*3);return i};const sr=ba;function vr(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=Fe.fromType(Fe.ColorType,{color:new U(1,1,1,1)}));let n=e.positions;l(n)||(n=[]),this._positions=n,this._actualPositions=Zs(n,d.equalsEpsilon),this._loop&&this._actualPositions.length>2&&(this._actualPositions===this._positions&&(this._actualPositions=n.slice()),this._actualPositions.push(d.clone(this._actualPositions[0]))),this._length=this._actualPositions.length,this._id=e.id;let i;l(t)&&(i=B.clone(t.modelMatrix)),this._modelMatrix=i,this._segments=sr.wrapLongitude(this._actualPositions,i),this._actualLength=void 0,this._propertiesChanged=new Uint32Array(MJ),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 NJ=vr.POSITION_INDEX=0,MYe=vr.SHOW_INDEX=1,FYe=vr.WIDTH_INDEX=2,zYe=vr.MATERIAL_INDEX=3,CC=vr.POSITION_SIZE_INDEX=4,UYe=vr.DISTANCE_DISPLAY_CONDITION=5,MJ=vr.NUMBER_OF_PROPERTIES=6;function Nf(e,t){++e._propertiesChanged[t];const n=e._polylineCollection;l(n)&&(n._updatePolyline(e,t),e._dirty=!0)}Object.defineProperties(vr.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,Nf(this,MYe))}},positions:{get:function(){return this._positions},set:function(e){if(!l(e))throw new x("value is required.");let t=Zs(e,d.equalsEpsilon);this._loop&&t.length>2&&(t===e&&(t=e.slice()),t.push(d.clone(t[0]))),(this._actualPositions.length!==t.length||this._actualPositions.length!==this._length)&&Nf(this,CC),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),Nf(this,NJ),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,Nf(this,zYe))}},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,Nf(this,FYe))}},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&&!d.equals(t[0],t[t.length-1])&&(t.length===this._positions.length&&(this._actualPositions=t=this._positions.slice()),t.push(d.clone(t[0]))):t.length>2&&d.equals(t[0],t[t.length-1])&&(t.length-1===this._positions.length?this._actualPositions=this._positions:t.pop()),this._loop=e,Nf(this,CC)}}},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.");Ut.equals(e,this._distanceDisplayCondition)||(this._distanceDisplayCondition=Ut.clone(e,this._distanceDisplayCondition),Nf(this,UYe))}}});vr.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[NJ]>0||this._propertiesChanged[CC]>0;if((!B.equals(e,this._modelMatrix)||i)&&(this._segments=sr.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)Nf(this,CC);else{const o=n.length;for(let r=0;r<o;++r)if(n[r]!==this._segments.lengths[r]){Nf(this,CC);break}}};vr.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._polylineCollection,id:this._id})),this._pickId};vr.prototype._clean=function(){this._dirty=!1;const e=this._propertiesChanged;for(let t=0;t<MJ-1;++t)e[t]=0};vr.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._material=this._material&&this._material.destroy(),this._polylineCollection=void 0};const HYe=vr.SHOW_INDEX,VYe=vr.WIDTH_INDEX,GB=vr.POSITION_INDEX,kYe=vr.MATERIAL_INDEX,J4=vr.POSITION_SIZE_INDEX,GYe=vr.DISTANCE_DISPLAY_CONDITION,FJ=vr.NUMBER_OF_PROPERTIES,La={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 Ha(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(FJ),this._polylines=[],this._polylineBuckets={},this._positionBufferUsage={bufferUsage:Ze.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=U.clone(U.WHITE);const t=this;this._uniformMap={u_highlightColor:function(){return t._highlightColor}}}Object.defineProperties(Ha.prototype,{length:{get:function(){return uF(this),this._polylines.length}}});Ha.prototype.add=function(e){const t=new vr(e,this);return t._index=this._polylines.length,this._polylines.push(t),this._createVertexArray=!0,this._createBatchTable=!0,t};Ha.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};Ha.prototype.removeAll=function(){fF(this),kJ(this),this._polylineBuckets={},this._polylinesRemoved=!1,this._polylines.length=0,this._polylinesToUpdate.length=0,this._createVertexArray=!0};Ha.prototype.contains=function(e){return l(e)&&e._polylineCollection===this};Ha.prototype.get=function(e){if(!l(e))throw new x("index is required.");return uF(this),this._polylines[e]};function WYe(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 sf(t,n,e._polylines.length)}const zJ=new wn,UJ=new oe,HJ=new j;Ha.prototype.update=function(e){if(uF(this),this._polylines.length===0||!this.show)return;KYe(this,e);const t=e.context,n=e.mapProjection;let i,o=this._propertiesChanged;if(this._createBatchTable){if(wt.maximumVertexTextureImageUnits===0)throw new Se("Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero.");WYe(this,t),this._createBatchTable=!1}if(this._createVertexArray||qYe(this))eG(this,t,n);else if(this._polylinesUpdated){const c=this._polylinesToUpdate;if(this._mode!==le.SCENE3D){const u=c.length;for(let f=0;f<u;++f)i=c[f],i.update()}if(o[J4]||o[kYe])eG(this,t,n);else{const u=c.length,f=this._polylineBuckets;for(let h=0;h<u;++h){i=c[h],o=i._propertiesChanged;const _=i._bucket;let g=0;for(const p in f)if(f.hasOwnProperty(p)){if(f[p]===_){o[GB]&&_.writeUpdate(g,i,this._positionBuffer,n);break}g+=f[p].lengthOfPositions}if((o[HYe]||o[VYe])&&this._batchTable.setBatchedAttribute(i._index,0,new j(i._width,i._show)),this._batchTable.attributes.length>2){if(o[GB]||o[J4]){const p=e.mode===le.SCENE2D?i._boundingVolume2D:i._boundingVolumeWC,y=wn.fromCartesian(p.center,zJ),C=oe.fromElements(y.low.x,y.low.y,y.low.z,p.radius,UJ);this._batchTable.setBatchedAttribute(i._index,2,y.high),this._batchTable.setBatchedAttribute(i._index,3,C)}if(o[GYe]){const p=HJ;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<FJ;++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=Qe.fromCache({depthMask:a,depthTest:{enabled:a}})),(!l(this._translucentRS)||this._translucentRS.depthTest.enabled!==a)&&(this._translucentRS=Qe.fromCache({blending:Ii.ALPHA_BLEND,depthMask:!a,depthTest:{enabled:a}})),this._batchTable.update(e),s.render||s.pick){const c=this._colorCommands;jYe(this,e,c,r)}};const fA=new fe,Q4=new fe;function jYe(e,t,n,i){const o=t.context,r=t.commandList,s=n.length;let a=0,c=!0;const u=e._vertexArrays,f=e.debugShowBoundingVolume,_=e._batchTable.getUniformMapCallback(),g=u.length;for(let p=0;p<g;++p){const y=u[p],C=y.buckets,T=C.length;for(let E=0;E<T;++E){const w=C[E];let S=w.offset;const P=w.bucket.shaderProgram,O=w.bucket.polylines,z=O.length;let R,F,H=0,v,I;for(let m=0;m<z;++m){const D=O[m],L=$Ye(D._material);if(L!==R){if(l(R)&&H>0){const W=F.isTranslucent();a>=s?(v=new dt({owner:e}),n.push(v)):v=n[a],++a,I=sn(_(F._uniforms),e._uniformMap),v.boundingVolume=fe.clone(fA,v.boundingVolume),v.modelMatrix=i,v.shaderProgram=P,v.vertexArray=y.va,v.renderState=W?e._translucentRS:e._opaqueRS,v.pass=W?Be.TRANSLUCENT:Be.OPAQUE,v.debugShowBoundingVolume=f,v.pickId="v_pickColor",v.uniformMap=I,v.count=H,v.offset=S,S+=H,H=0,c=!0,r.push(v)}F=D._material,F.update(o),R=L}const M=D._locatorBuckets,V=M.length;for(let W=0;W<V;++W){const G=M[W];G.locator===w&&(H+=G.count)}let k;t.mode===le.SCENE3D?k=D._boundingVolumeWC:t.mode===le.COLUMBUS_VIEW?k=D._boundingVolume2D:t.mode===le.SCENE2D?l(D._boundingVolume2D)&&(k=fe.clone(D._boundingVolume2D,Q4),k.center.x=0):l(D._boundingVolumeWC)&&l(D._boundingVolume2D)&&(k=fe.union(D._boundingVolumeWC,D._boundingVolume2D,Q4)),c?(c=!1,fe.clone(k,fA)):fe.union(k,fA,fA)}l(R)&&H>0&&(a>=s?(v=new dt({owner:e}),n.push(v)):v=n[a],++a,I=sn(_(F._uniforms),e._uniformMap),v.boundingVolume=fe.clone(fA,v.boundingVolume),v.modelMatrix=i,v.shaderProgram=P,v.vertexArray=y.va,v.renderState=F.isTranslucent()?e._translucentRS:e._opaqueRS,v.pass=F.isTranslucent()?Be.TRANSLUCENT:Be.OPAQUE,v.debugShowBoundingVolume=f,v.pickId="v_pickColor",v.uniformMap=I,v.count=H,v.offset=S,c=!0,r.push(v)),R=void 0}}n.length=a}Ha.prototype.isDestroyed=function(){return!1};Ha.prototype.destroy=function(){return VJ(this),fF(this),kJ(this),this._batchTable=this._batchTable&&this._batchTable.destroy(),Ue(this)};function qYe(e){let t=!1;const n=e._propertiesChanged,i=e._positionBufferUsage;return n[GB]?(i.bufferUsage!==Ze.STREAM_DRAW&&(t=!0,i.bufferUsage=Ze.STREAM_DRAW),i.frameCount=100):i.bufferUsage!==Ze.STATIC_DRAW&&(i.frameCount===0?(t=!0,i.bufferUsage=Ze.STATIC_DRAW):i.frameCount--),t}const Z4=[0,0,0];function eG(e,t,n){e._createVertexArray=!1,fF(e),VJ(e),XYe(e);const i=[[]];let o=i[0];const r=e._batchTable,s=e._useHighlightColor,a=[0];let c=0;const u=[[]];let f=0;const h=e._polylineBuckets;let _,g;for(_ in h)h.hasOwnProperty(_)&&(g=h[_],g.updateShader(t,r,s),f+=g.lengthOfPositions);if(f>0){const p=e._mode,y=new Float32Array(6*f*3),C=new Float32Array(f*4);let T,E=0,w=0,S=0;for(_ in h)if(h.hasOwnProperty(_)){g=h[_],g.write(y,C,E,w,S,r,t,n),p===le.MORPHING&&(l(T)||(T=new Float32Array(6*f*3)),g.writeForMorph(T,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,O=Ze.STATIC_DRAW;e._positionBuffer=At.createVertexBuffer({context:t,typedArray:y,usage:P});let z;l(T)&&(z=At.createVertexBuffer({context:t,typedArray:T,usage:P})),e._texCoordExpandAndBatchIndexBuffer=At.createVertexBuffer({context:t,typedArray:C,usage:O});const R=3*Float32Array.BYTES_PER_ELEMENT,F=4*Float32Array.BYTES_PER_ELEMENT;let H=0;const v=i.length;for(let I=0;I<v;++I)if(o=i[I],o.length>0){const m=new Uint16Array(o),D=At.createIndexBuffer({context:t,typedArray:m,usage:Ze.STATIC_DRAW,indexDatatype:it.UNSIGNED_SHORT});H+=a[I];const L=6*(I*(R*N.SIXTY_FOUR_KILOBYTES)-H*R),M=R+L,V=R+M,k=R+V,W=R+k,G=R+W,K=I*(F*N.SIXTY_FOUR_KILOBYTES)-H*F,q=[{index:La.position3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:L,strideInBytes:6*R},{index:La.position3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:M,strideInBytes:6*R},{index:La.position2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:L,strideInBytes:6*R},{index:La.position2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:M,strideInBytes:6*R},{index:La.prevPosition3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:La.prevPosition3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:La.prevPosition2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:V,strideInBytes:6*R},{index:La.prevPosition2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:k,strideInBytes:6*R},{index:La.nextPosition3DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:W,strideInBytes:6*R},{index:La.nextPosition3DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:G,strideInBytes:6*R},{index:La.nextPosition2DHigh,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:W,strideInBytes:6*R},{index:La.nextPosition2DLow,componentsPerAttribute:3,componentDatatype:ee.FLOAT,offsetInBytes:G,strideInBytes:6*R},{index:La.texCoordExpandAndBatchIndex,componentsPerAttribute:4,componentDatatype:ee.FLOAT,vertexBuffer:e._texCoordExpandAndBatchIndexBuffer,offsetInBytes:K}];let te,$,X,Y;p===le.SCENE3D?($=e._positionBuffer,te="vertexBuffer",X=Z4,Y="value"):p===le.SCENE2D||p===le.COLUMBUS_VIEW?($=Z4,te="value",X=e._positionBuffer,Y="vertexBuffer"):($=z,te="vertexBuffer",X=e._positionBuffer,Y="vertexBuffer"),q[0][te]=$,q[1][te]=$,q[2][Y]=X,q[3][Y]=X,q[4][te]=$,q[5][te]=$,q[6][Y]=X,q[7][Y]=X,q[8][te]=$,q[9][te]=$,q[10][Y]=X,q[11][Y]=X;const ae=new to({context:t,attributes:q,indexBuffer:D});e._vertexArrays.push({va:ae,buckets:u[I]})}}}function YYe(e,t){return t instanceof zt?t.id:t}const fx=[];function $Ye(e){const t=Fe._uniformList[e.type],n=t.length;fx.length=2*n;let i=0;for(let o=0;o<n;++o){const r=t[o];fx[i]=r,fx[i+1]=e._uniforms[r](),i+=2}return`${e.type}:${JSON.stringify(fx,YYe)}`}function XYe(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 yf(c,t,n)),u.addPolyline(a)}}}function KYe(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 uF(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 fF(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 VJ(e){const t=e._vertexArrays.length;for(let n=0;n<t;++n)e._vertexArrays[n].va.destroy();e._vertexArrays.length=0}Ha.prototype._updatePolyline=function(e,t){this._polylinesUpdated=!0,e._dirty||this._polylinesToUpdate.push(e),++this._propertiesChanged[t]};function kJ(e){const t=e._polylines,n=t.length;for(let i=0;i<n;++i)t[i].isDestroyed||t[i]._destroy()}function vO(e,t,n){this.count=e,this.offset=t,this.bucket=n}function yf(e,t,n){this.polylines=[],this.lengthOfPositions=0,this.material=e,this.shaderProgram=void 0,this.mode=t,this.modelMatrix=n}yf.prototype.addPolyline=function(e){this.polylines.push(e),e._actualLength=this.getPolylinePositionsLength(e),this.lengthOfPositions+=e._actualLength,e._bucket=this};yf.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"),un.isInternetExplorer()||i.push("CLIP_POLYLINE");const o=new Ge({defines:i,sources:[`varying vec4 v_pickColor;
`,this.material.shaderSource,fj]}),r=t.getVertexShaderCallback()(gAe),s=new Ge({defines:i,sources:[LT,r]});this.shaderProgram=hn.fromCache({context:e,vertexShaderSource:s,fragmentShaderSource:o,attributeLocations:La})};function GJ(e){return d.dot(d.UNIT_X,e._boundingVolume.center)<0||e._boundingVolume.intersectPlane(St.ORIGIN_ZX_PLANE)===mn.INTERSECTING}yf.prototype.getPolylinePositionsLength=function(e){let t;if(this.mode===le.SCENE3D||!GJ(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 mr=new d,Fc=new d,zc=new d,zS=new d,JYe=new oe,QYe=new j;yf.prototype.write=function(e,t,n,i,o,r,s,a){const c=this.mode,u=a.ellipsoid.maximumRadius*N.PI,f=this.polylines,h=f.length;for(let _=0;_<h;++_){const g=f[_],p=g.width,y=g.show&&p>0,C=g._index,T=this.getSegments(g,a),E=T.positions,w=T.lengths,S=E.length,P=g.getPickId(s).color;let O=0,z=0,R;for(let V=0;V<S;++V){V===0?g._loop?R=E[S-2]:(R=zS,d.subtract(E[0],E[1],R),d.add(E[0],R,R)):R=E[V-1],d.clone(R,Fc),d.clone(E[V],mr),V===S-1?g._loop?R=E[1]:(R=zS,d.subtract(E[S-1],E[S-2],R),d.add(E[S-1],R,R)):R=E[V+1],d.clone(R,zc);const k=w[O];V===z+k&&(z+=k,++O);const W=V-z===0,G=V===z+w[O]-1;c===le.SCENE2D&&(Fc.z=0,mr.z=0,zc.z=0),(c===le.SCENE2D||c===le.MORPHING)&&(W||G)&&u-Math.abs(mr.x)<1&&((mr.x<0&&Fc.x>0||mr.x>0&&Fc.x<0)&&d.clone(mr,Fc),(mr.x<0&&zc.x>0||mr.x>0&&zc.x<0)&&d.clone(mr,zc));const K=W?2:0,q=G?2:4;for(let te=K;te<q;++te){wn.writeElements(mr,e,n),wn.writeElements(Fc,e,n+6),wn.writeElements(zc,e,n+12);const $=te-2<0?-1:1;t[o]=V/(S-1),t[o+1]=2*(te%2)-1,t[o+2]=$,t[o+3]=C,n+=6*3,o+=4}}const F=JYe;F.x=U.floatToByte(P.red),F.y=U.floatToByte(P.green),F.z=U.floatToByte(P.blue),F.w=U.floatToByte(P.alpha);const H=QYe;H.x=p,H.y=y?1:0;const v=c===le.SCENE2D?g._boundingVolume2D:g._boundingVolumeWC,I=wn.fromCartesian(v.center,zJ),m=I.high,D=oe.fromElements(I.low.x,I.low.y,I.low.z,v.radius,UJ),L=HJ;L.x=0,L.y=Number.MAX_VALUE;const M=g.distanceDisplayCondition;l(M)&&(L.x=M.near,L.y=M.far),r.setBatchedAttribute(C,0,H),r.setBatchedAttribute(C,1,F),r.attributes.length>2&&(r.setBatchedAttribute(C,2,m),r.setBatchedAttribute(C,3,D),r.setBatchedAttribute(C,4,L))}};const ZYe=new d,e$e=new d,t$e=new d,tG=new d;yf.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 f=0,h=0;for(let _=0;_<u;++_){let g;_===0?s._loop?g=a[u-2]:(g=tG,d.subtract(a[0],a[1],g),d.add(a[0],g,g)):g=a[_-1],g=B.multiplyByPoint(n,g,e$e);const p=B.multiplyByPoint(n,a[_],ZYe);let y;_===u-1?s._loop?y=a[1]:(y=tG,d.subtract(a[u-1],a[u-2],y),d.add(a[u-1],y,y)):y=a[_+1],y=B.multiplyByPoint(n,y,t$e);const C=c[f];_===h+C&&(h+=C,++f);const T=_-h===0,E=_===h+c[f]-1,w=T?2:0,S=E?2:4;for(let P=w;P<S;++P)wn.writeElements(p,e,t),wn.writeElements(g,e,t+6),wn.writeElements(y,e,t+12),t+=6*3}}};const n$e=new Array(1);yf.prototype.updateIndices=function(e,t,n,i){let o=n.length-1,r=new vO(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,f=u.length;for(let h=0;h<f;++h){const _=u[h];_._locatorBuckets=[];let g;if(this.mode===le.SCENE3D){g=n$e;const y=_._actualPositions.length;if(y>0)g[0]=y;else continue}else g=_._segments.lengths;const p=g.length;if(p>0){let y=0;for(let C=0;C<p;++C){const T=g[C]-1;for(let E=0;E<T;++E)c+4>N.SIXTY_FOUR_KILOBYTES&&(_._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 vO(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}_._locatorBuckets.push({locator:r,count:y}),c+4>N.SIXTY_FOUR_KILOBYTES&&(t.push(0),a=[],e.push(a),c=0,r.count=s,i=0,s=0,r=new vO(0,0,this),n[++o]=[r])}_._clean()}return r.count=s,i};yf.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 mg={positions:void 0,lengths:void 0},nG=new Array(1),i$e=new d,o$e=new Ae;yf.prototype.getSegments=function(e,t){let n=e._actualPositions;if(this.mode===le.SCENE3D)return nG[0]=n.length,mg.positions=n,mg.lengths=nG,mg;GJ(e)&&(n=e._segments.positions);const i=t.ellipsoid,o=[],r=this.modelMatrix,s=n.length;let a,c=i$e;for(let u=0;u<s;++u)a=n[u],c=B.multiplyByPoint(r,a,c),o.push(t.project(i.cartesianToCartographic(c,o$e)));if(o.length>0){e._boundingVolume2D=fe.fromPoints(o,e._boundingVolume2D);const u=e._boundingVolume2D.center;e._boundingVolume2D.center=new d(u.z,u.x,u.y)}return mg.positions=o,mg.lengths=e._segments.lengths,mg};let iG;yf.prototype.writeUpdate=function(e,t,n,i){const o=this.mode,r=i.ellipsoid.maximumRadius*N.PI;let s=t._actualLength;if(s){e+=this.getPolylineStartIndex(t);let a=iG;const c=6*s*3;!l(a)||a.length<c?a=iG=new Float32Array(c):a.length>c&&(a=new Float32Array(a.buffer,0,c));const u=this.getSegments(t,i),f=u.positions,h=u.lengths;let _=0,g=0,p=0,y;s=f.length;for(let C=0;C<s;++C){C===0?t._loop?y=f[s-2]:(y=zS,d.subtract(f[0],f[1],y),d.add(f[0],y,y)):y=f[C-1],d.clone(y,Fc),d.clone(f[C],mr),C===s-1?t._loop?y=f[1]:(y=zS,d.subtract(f[s-1],f[s-2],y),d.add(f[s-1],y,y)):y=f[C+1],d.clone(y,zc);const T=h[g];C===p+T&&(p+=T,++g);const E=C-p===0,w=C===p+h[g]-1;o===le.SCENE2D&&(Fc.z=0,mr.z=0,zc.z=0),(o===le.SCENE2D||o===le.MORPHING)&&(E||w)&&r-Math.abs(mr.x)<1&&((mr.x<0&&Fc.x>0||mr.x>0&&Fc.x<0)&&d.clone(mr,Fc),(mr.x<0&&zc.x>0||mr.x>0&&zc.x<0)&&d.clone(mr,zc));const S=E?2:0,P=w?2:4;for(let O=S;O<P;++O)wn.writeElements(mr,a,_),wn.writeElements(Fc,a,_+6),wn.writeElements(zc,a,_+12),_+=6*3}n.copyFromArrayView(a,6*3*Float32Array.BYTES_PER_ELEMENT*e)}};function Rp(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 na({batchTable:e.batchTable}),this._labelCollection=new Cc({batchTable:e.batchTable}),this._polylineCollection=new Ha,this._polylineCollection._useHighlightColor=!0,this._verticesPromise=void 0,this._packedBuffer=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=_$e(this)}Object.defineProperties(Rp.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 r$e(e,t){const n=e._rectangle,i=e._minHeight,o=e._maxHeight,r=2+_e.packedLength+pe.packedLength,s=new Float64Array(r);let a=0;return s[a++]=i,s[a++]=o,_e.pack(n,s,a),a+=_e.packedLength,pe.pack(t,s,a),s}const s$e=new vi("createVectorTilePoints",5),a$e=new d;function c$e(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=r$e(e,t));const o=[n.buffer,i.buffer],r={positions:n.buffer,packedBuffer:i.buffer},s=e._verticesPromise=s$e.scheduleTask(r,o);return l(s)?s.then(function(a){e._positions=new Float64Array(a.positions);const c=e._billboardCollection,u=e._labelCollection,f=e._polylineCollection;n=e._positions;const h=e._batchIds,_=n.length/3;for(let g=0;g<_;++g){const p=h[g],y=d.unpack(n,g*3,a$e),C=c.add();C.position=y,C._batchIndex=p;const T=u.add();T.text=" ",T.position=y,T._batchIndex=p;const E=f.add();E.positions=[d.clone(y),d.clone(y)]}e._positions=void 0,e._packedBuffer=void 0,e._ready=!0}):void 0}}Rp.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),f=i.get(a),h=o.get(a);t[c]=new Zo(e,c,u,f,h)}};Rp.prototype.applyDebugSettings=function(e,t){e?(U.clone(t,this._billboardCollection._highlightColor),U.clone(t,this._labelCollection._highlightColor),U.clone(t,this._polylineCollection._highlightColor)):(U.clone(U.WHITE,this._billboardCollection._highlightColor),U.clone(U.WHITE,this._labelCollection._highlightColor),U.clone(U.WHITE,this._polylineCollection._highlightColor))};function l$e(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=Zo.defaultPointSize,s.color=Zo.defaultColor,s.pointOutlineColor=Zo.defaultPointOutlineColor,s.pointOutlineWidth=Zo.defaultPointOutlineWidth,s.labelColor=U.WHITE,s.labelOutlineColor=U.WHITE,s.labelOutlineWidth=1,s.font="30px sans-serif",s.labelStyle=Nl.FILL,s.labelText=void 0,s.backgroundColor=new U(.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=U.WHITE,s.image=void 0,s.disableDepthTestDistance=0,s.horizontalOrigin=Ta.CENTER,s.verticalOrigin=Si.CENTER,s.labelHorizontalOrigin=Ta.RIGHT,s.labelVerticalOrigin=Si.BASELINE}}const u$e=new U,f$e=new U,d$e=new U,h$e=new U,p$e=new U,m$e=new U,dA=new Mt,hA=new Mt,DO=new Ut;Rp.prototype.applyStyle=function(e,t){if(!l(e)){l$e(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,u$e)),l(e.pointOutlineColor)&&(s.pointOutlineColor=e.pointOutlineColor.evaluateColor(s,f$e)),l(e.pointOutlineWidth)&&(s.pointOutlineWidth=e.pointOutlineWidth.evaluate(s)),l(e.labelColor)&&(s.labelColor=e.labelColor.evaluateColor(s,d$e)),l(e.labelOutlineColor)&&(s.labelOutlineColor=e.labelOutlineColor.evaluateColor(s,h$e)),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,p$e)),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);dA.near=a.x,dA.nearValue=a.y,dA.far=a.z,dA.farValue=a.w,s.scaleByDistance=dA}else s.scaleByDistance=void 0;if(l(e.translucencyByDistance)){const a=e.translucencyByDistance.evaluate(s);hA.near=a.x,hA.nearValue=a.y,hA.far=a.z,hA.farValue=a.w,s.translucencyByDistance=hA}else s.translucencyByDistance=void 0;if(l(e.distanceDisplayCondition)){const a=e.distanceDisplayCondition.evaluate(s);DO.near=a.x,DO.far=a.y,s.distanceDisplayCondition=DO}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,m$e)),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 _$e(e){return new Promise(function(t,n){e._update=function(i,o){const r=c$e(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)})}})}Rp.prototype.update=function(e){this._update(this,e)};Rp.prototype.isDestroyed=function(){return!1};Rp.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(),Ue(this)};function Md(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,pe.WGS84),this._minimumHeight=e.minimumHeight,this._maximumHeight=e.maximumHeight,this._polygonMinimumHeights=e.polygonMinimumHeights,this._polygonMaximumHeights=e.polygonMaximumHeights,this._center=A(e.center,d.ZERO),this._rectangle=e.rectangle,this._center=void 0,this._boundingVolume=e.boundingVolume,this._boundingVolumes=void 0,this._batchedIndices=void 0,this._ready=!1,this._update=function(t,n){},this._readyPromise=E$e(this),this._verticesPromise=void 0,this._primitive=void 0,this.debugWireframe=!1,this.forceRebatch=!1,this.classificationType=go.BOTH}Object.defineProperties(Md.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 g$e(e){const t=new Float64Array(3+d.packedLength+pe.packedLength+_e.packedLength);let n=0;return t[n++]=e._indices.BYTES_PER_ELEMENT,t[n++]=e._minimumHeight,t[n++]=e._maximumHeight,d.pack(e._center,t,n),n+=d.packedLength,pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,_e.pack(e._rectangle,t,n),t}function y$e(e,t){let n=1;const i=t[n++],o=e._boundingVolumes=new Array(i);for(let a=0;a<i;++a)o[a]=Bt.unpack(t,n),n+=Bt.packedLength;const r=t[n++],s=e._batchedIndices=new Array(r);for(let a=0;a<r;++a){const c=U.unpack(t,n);n+=U.packedLength;const u=t[n++],f=t[n++],h=t[n++],_=new Array(h);for(let g=0;g<h;++g)_[g]=t[n++];s[a]=new ES({color:c,offset:u,count:f,batchIds:_})}}const A$e=new vi("createVectorTilePolygons",5),C$e=new U;function T$e(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(_e.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 C=g.getColor(y,C$e);s[y]=C.toRgba()}a=e._packedBuffer=g$e(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 f=e._polygonMinimumHeights,h=e._polygonMaximumHeights;l(f)&&l(h)&&(f=f.slice(),h=h.slice(),c.push(f.buffer,h.buffer),u.minimumHeights=f,u.maximumHeights=h);const _=e._verticesPromise=A$e.scheduleTask(u,c);return l(_)?_.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];y$e(e,p),e._indices=it.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 b$e(e){e._ready&&!l(e._primitive)&&(e._primitive=new hf({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)}Md.prototype.createFeatures=function(e,t){this._primitive.createFeatures(e,t)};Md.prototype.applyDebugSettings=function(e,t){this._primitive.applyDebugSettings(e,t)};Md.prototype.applyStyle=function(e,t){this._primitive.applyStyle(e,t)};Md.prototype.updateCommands=function(e,t){this._primitive.updateCommands(e,t)};function E$e(e){return new Promise(function(t,n){e._update=function(i,o){const r=T$e(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(){b$e(i),t(i)}).catch(function(s){n(s)})}})}Md.prototype.update=function(e){this._update(this,e)};Md.prototype.isDestroyed=function(){return!1};Md.prototype.destroy=function(){return this._primitive=this._primitive&&this._primitive.destroy(),Ue(this)};function ol(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,pe.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=U.clone(U.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=F$e(this),this._verticesPromise=void 0}Object.defineProperties(ol.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function x$e(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+_e.packedLength+pe.packedLength+d.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,_e.pack(t,a,c),c+=_e.packedLength,pe.pack(o,a,c),c+=pe.packedLength,d.pack(r,a,c),a}const w$e=new vi("createVectorTilePolylines",5),Ug={previousPosition:0,currentPosition:1,nextPosition:2,expandAndWidth:3,a_batchId:4};function S$e(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=x$e(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=w$e.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._currentPositions=new Float32Array(f.currentPositions),e._previousPositions=new Float32Array(f.previousPositions),e._nextPositions=new Float32Array(f.nextPositions),e._expandAndWidth=new Float32Array(f.expandAndWidth),e._vertexBatchIds=new Uint16Array(f.batchIds);const h=f.indexDatatype;e._indices=h===it.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function v$e(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=At.createVertexBuffer({context:t,typedArray:i,usage:Ze.STATIC_DRAW}),f=At.createVertexBuffer({context:t,typedArray:n,usage:Ze.STATIC_DRAW}),h=At.createVertexBuffer({context:t,typedArray:o,usage:Ze.STATIC_DRAW}),_=At.createVertexBuffer({context:t,typedArray:r,usage:Ze.STATIC_DRAW}),g=At.createVertexBuffer({context:t,typedArray:s,usage:Ze.STATIC_DRAW}),p=At.createIndexBuffer({context:t,typedArray:a,usage:Ze.STATIC_DRAW,indexDatatype:a.BYTES_PER_ELEMENT===2?it.UNSIGNED_SHORT:it.UNSIGNED_INT}),y=[{index:Ug.previousPosition,vertexBuffer:u,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:Ug.currentPosition,vertexBuffer:f,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:Ug.nextPosition,vertexBuffer:h,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:Ug.expandAndWidth,vertexBuffer:_,componentDatatype:ee.FLOAT,componentsPerAttribute:2},{index:Ug.a_batchId,vertexBuffer:g,componentDatatype:ee.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new to({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 pA=new B,oG=new d;function D$e(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return B.clone(n,pA),B.multiplyByPoint(pA,e._center,oG),B.setTranslation(pA,oG,pA),pA},u_highlightColor:function(){return e._highlightColor}})}function I$e(e){if(l(e._rs))return;const t={enabled:!0,factor:-5,units:-5};e._rs=Qe.fromCache({blending:Ii.ALPHA_BLEND,depthMask:!1,depthTest:{enabled:!0},polygonOffset:t})}const P$e=`uniform vec4 u_highlightColor;
void main()
{
gl_FragColor = u_highlightColor;
}
`;function O$e(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(PAe),o=n.getFragmentShaderCallback(!1,void 0,!1)(P$e),r=new Ge({defines:["VECTOR_TILE",un.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[LT,i]}),s=new Ge({defines:["VECTOR_TILE"],sources:[o]});e._sp=hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:Ug})}function L$e(e,t){if(!l(e._command)){const n=e._batchTable.getUniformMapCallback()(e._uniformMap);e._command=new dt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:n,boundingVolume:e._boundingVolume,pass:Be.TRANSLUCENT,pickId:e._batchTable.getPickId()})}t.commandList.push(e._command)}ol.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 f=new Float64Array(c*3);for(r=0;r<a;++r)if(n[r]===t){const h=o[r],_=o[r+1]-h;for(s=0;s<_;++s){const g=(h+s)*3;f[u++]=i[g],f[u++]=i[g+1],f[u++]=i[g+2]}}return f};ol.prototype.getPositions=function(e){return ol.getPolylinePositions(this,e)};ol.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)}};ol.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function B$e(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=U.WHITE}}const R$e=new U,N$e=U.WHITE,M$e=!0;ol.prototype.applyStyle=function(e,t){if(!l(e)){B$e(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,R$e):N$e,s.show=l(e.show)?e.show.evaluate(s):M$e}};function F$e(e){return new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=S$e(i);if(D$e(i,r),O$e(i,r),I$e(i),i._ready){const a=o.passes;(a.render||a.pick)&&L$e(i,o)}l(s)&&s.then(function(){v$e(i,r),t()}).catch(function(a){n(a)})}})}ol.prototype.update=function(e){this._update(this,e)};ol.prototype.isDestroyed=function(){return!1};ol.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),Ue(this)};function Fd(e){this._positions=e.positions,this._widths=e.widths,this._counts=e.counts,this._batchIds=e.batchIds,this._ellipsoid=A(e.ellipsoid,pe.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(Qi._defaultMinTerrainHeight,Qi._defaultMaxTerrainHeight),this._boundingVolume=Bt.fromRectangle(e.rectangle,Qi._defaultMinTerrainHeight,Qi._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=U.clone(U.WHITE),this._highlightColor=this._constantColor,this._trianglesLength=0,this._geometryByteLength=0,this._ready=!1,this._update=function(t,n){},this._readyPromise=J$e(this),this._verticesPromise=void 0}Object.defineProperties(Fd.prototype,{trianglesLength:{get:function(){return this._trianglesLength}},geometryByteLength:{get:function(){return this._geometryByteLength}},readyPromise:{get:function(){return this._readyPromise}}});function z$e(e,t,n){const i=Qi.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;Bt.fromRectangle(c,o,r,n,a)}function U$e(e){const t=e._rectangle,n=e._minimumHeight,i=e._maximumHeight,o=e._ellipsoid,r=e._center,s=2+_e.packedLength+pe.packedLength+d.packedLength,a=new Float64Array(s);let c=0;return a[c++]=n,a[c++]=i,_e.pack(t,a,c),c+=_e.packedLength,pe.pack(o,a,c),c+=pe.packedLength,d.pack(r,a,c),a}const H$e=new vi("createVectorTileClampedPolylines"),Th={startEllipsoidNormal:0,endEllipsoidNormal:1,startPositionAndHeight:2,endPositionAndHeight:3,startFaceNormalAndVertexCorner:4,endFaceNormalAndHalfWidth:5,a_batchId:6};function V$e(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=U$e(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=H$e.scheduleTask(c,a);return l(u)?u.then(function(f){e._keepDecodedPositions&&(e._decodedPositions=new Float64Array(f.decodedPositions),e._decodedPositionOffsets=new Uint32Array(f.decodedPositionOffsets)),e._startEllipsoidNormals=new Float32Array(f.startEllipsoidNormals),e._endEllipsoidNormals=new Float32Array(f.endEllipsoidNormals),e._startPositionAndHeights=new Float32Array(f.startPositionAndHeights),e._startFaceNormalAndVertexCornerIds=new Float32Array(f.startFaceNormalAndVertexCornerIds),e._endPositionAndHeights=new Float32Array(f.endPositionAndHeights),e._endFaceNormalAndHalfWidths=new Float32Array(f.endFaceNormalAndHalfWidths),e._vertexBatchIds=new Uint16Array(f.vertexBatchIds);const h=f.indexDatatype;e._indices=h===it.UNSIGNED_SHORT?new Uint16Array(f.indices):new Uint32Array(f.indices),e._ready=!0}):void 0}}function k$e(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 f=n.byteLength+i.byteLength;f+=o.byteLength+r.byteLength,f+=s.byteLength+a.byteLength,f+=c.byteLength+u.byteLength,e._trianglesLength=u.length/3,e._geometryByteLength=f;const h=At.createVertexBuffer({context:t,typedArray:n,usage:Ze.STATIC_DRAW}),_=At.createVertexBuffer({context:t,typedArray:i,usage:Ze.STATIC_DRAW}),g=At.createVertexBuffer({context:t,typedArray:o,usage:Ze.STATIC_DRAW}),p=At.createVertexBuffer({context:t,typedArray:r,usage:Ze.STATIC_DRAW}),y=At.createVertexBuffer({context:t,typedArray:s,usage:Ze.STATIC_DRAW}),C=At.createVertexBuffer({context:t,typedArray:a,usage:Ze.STATIC_DRAW}),T=At.createVertexBuffer({context:t,typedArray:c,usage:Ze.STATIC_DRAW}),E=At.createIndexBuffer({context:t,typedArray:u,usage:Ze.STATIC_DRAW,indexDatatype:u.BYTES_PER_ELEMENT===2?it.UNSIGNED_SHORT:it.UNSIGNED_INT}),w=[{index:Th.startEllipsoidNormal,vertexBuffer:h,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:Th.endEllipsoidNormal,vertexBuffer:_,componentDatatype:ee.FLOAT,componentsPerAttribute:3},{index:Th.startPositionAndHeight,vertexBuffer:g,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:Th.endPositionAndHeight,vertexBuffer:p,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:Th.startFaceNormalAndVertexCorner,vertexBuffer:y,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:Th.endFaceNormalAndHalfWidth,vertexBuffer:C,componentDatatype:ee.FLOAT,componentsPerAttribute:4},{index:Th.a_batchId,vertexBuffer:T,componentDatatype:ee.UNSIGNED_SHORT,componentsPerAttribute:1}];e._va=new to({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 mA=new B,rG=new d;function G$e(e,t){l(e._uniformMap)||(e._uniformMap={u_modifiedModelView:function(){const n=t.uniformState.view;return B.clone(n,mA),B.multiplyByPoint(mA,e._center,rG),B.setTranslation(mA,rG,mA),mA},u_highlightColor:function(){return e._highlightColor},u_minimumMaximumVectorHeights:function(){return e._minimumMaximumVectorHeights}})}function sG(e){return Qe.fromCache({cull:{enabled:!0,face:Po.FRONT},blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND,depthMask:!1,stencilTest:{enabled:e,frontFunction:ri.EQUAL,frontOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},backFunction:ri.EQUAL,backOperation:{fail:ht.KEEP,zFail:ht.KEEP,zPass:ht.KEEP},reference:Pt.CESIUM_3D_TILE_MASK,mask:Pt.CESIUM_3D_TILE_MASK}})}function W$e(e){l(e._rs)||(e._rs=sG(!1),e._rs3DTiles=sG(!0))}function j$e(e,t){if(l(e._sp))return;const n=e._batchTable,i=n.getVertexShaderCallback(!1,"a_batchId",void 0)(IAe),o=n.getFragmentShaderCallback(!1,void 0,!0)(DAe),r=new Ge({defines:["VECTOR_TILE",un.isInternetExplorer()?"":"CLIP_POLYLINE"],sources:[LT,i]}),s=new Ge({defines:["VECTOR_TILE"],sources:[o]});e._sp=hn.fromCache({context:t,vertexShaderSource:r,fragmentShaderSource:s,attributeLocations:Th})}function q$e(e,t){let n=e._command;if(!l(e._command)){const o=e._batchTable.getUniformMapCallback()(e._uniformMap);n=e._command=new dt({owner:e,vertexArray:e._va,renderState:e._rs,shaderProgram:e._sp,uniformMap:o,boundingVolume:e._boundingVolume,pass:Be.TERRAIN_CLASSIFICATION,pickId:e._batchTable.getPickId()});const r=dt.shallowClone(n,n.derivedCommands.tileset);r.renderState=e._rs3DTiles,r.pass=Be.CESIUM_3D_TILE_CLASSIFICATION,n.derivedCommands.tileset=r}const i=e._classificationType;(i===go.TERRAIN||i===go.BOTH)&&t.commandList.push(n),(i===go.CESIUM_3D_TILE||i===go.BOTH)&&t.commandList.push(n.derivedCommands.tileset)}Fd.prototype.getPositions=function(e){return ol.getPolylinePositions(this,e)};Fd.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)}};Fd.prototype.applyDebugSettings=function(e,t){this._highlightColor=e?t:this._constantColor};function Y$e(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=U.WHITE}}const $$e=new U,X$e=U.WHITE,K$e=!0;Fd.prototype.applyStyle=function(e,t){if(!l(e)){Y$e(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,$$e):X$e,s.show=l(e.show)?e.show.evaluate(s):K$e}};function J$e(e){return Qi.initialize().then(function(){return z$e(e,e._rectangle,e._ellipsoid),new Promise(function(t,n){e._update=function(i,o){const r=o.context,s=V$e(i);if(G$e(i,r),j$e(i,r),W$e(i),i._ready){const a=o.passes;(a.render||a.pick)&&q$e(i,o)}l(s)&&s.then(function(){k$e(i,r),t(i)}).catch(function(a){n(a)})}})})}Fd.prototype.update=function(e){this._update(this,e)};Fd.prototype.isDestroyed=function(){return!1};Fd.prototype.destroy=function(){return this._va=this._va&&this._va.destroy(),this._sp=this._sp&&this._sp.destroy(),Ue(this)};const IO=32767,Q$e=new Ae,Z$e=new d;function eXe(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);oi.zigZagDeltaDecode(s,a,c);const u=new Float64Array(e.length);for(let f=0;f<r;++f){const h=s[f],_=a[f],g=c[f],p=N.lerp(t.west,t.east,h/IO),y=N.lerp(t.south,t.north,_/IO),C=N.lerp(n,i,g/IO),T=Ae.fromRadians(p,y,C,Q$e),E=o.cartographicToCartesian(T,Z$e);d.pack(E,u,f*3)}return u}function Af(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,rXe(this,i,o)}Object.defineProperties(Af.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 tXe(e){return function(t,n){l(e._polygons)&&e._polygons.updateCommands(t,n)}}function nXe(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 _=t.byteOffset+e.POLYGON_BATCH_IDS.byteOffset;n=new Uint16Array(t.buffer,_,s)}if(a>0&&l(e.POLYLINE_BATCH_IDS)){const _=t.byteOffset+e.POLYLINE_BATCH_IDS.byteOffset;i=new Uint16Array(t.buffer,_,a)}if(c>0&&l(e.POINT_BATCH_IDS)){const _=t.byteOffset+e.POINT_BATCH_IDS.byteOffset;o=new Uint16Array(t.buffer,_,c)}const u=l(n)||l(i)||l(o),f=s>0&&!l(n)||a>0&&!l(i)||c>0&&!l(o);if(u&&f)throw new Se("If one group of batch ids is defined, then all batch ids must be defined.");if(!l(n)&&!l(i)&&!l(o)){let _=0;if(!l(n)&&s>0)for(n=new Uint16Array(s),r=0;r<s;++r)n[r]=_++;if(!l(i)&&a>0)for(i=new Uint16Array(a),r=0;r<a;++r)i[r]=_++;if(!l(o)&&c>0)for(o=new Uint16Array(c),r=0;r<c;++r)o[r]=_++}return{polygons:n,polylines:i,points:o}}const Cl=Uint32Array.BYTES_PER_ELEMENT;function iXe(e){return new ol(e)}function oXe(e){return new Fd(e)}function rXe(e,t,n){n=A(n,0);const i=new Uint8Array(t),o=new DataView(t);n+=Cl;const r=o.getUint32(n,!0);if(r!==1)throw new Se(`Only Vector tile version 1 is supported. Version ${r} is not.`);n+=Cl;const s=o.getUint32(n,!0);if(n+=Cl,s===0)return Promise.resolve(e);const a=o.getUint32(n,!0);if(n+=Cl,a===0)throw new Se("Feature table must have a byte length greater than zero");const c=o.getUint32(n,!0);n+=Cl;const u=o.getUint32(n,!0);n+=Cl;const f=o.getUint32(n,!0);n+=Cl;const h=o.getUint32(n,!0);n+=Cl;const _=o.getUint32(n,!0);n+=Cl;const g=o.getUint32(n,!0);n+=Cl;const p=o.getUint32(n,!0);n+=Cl;const y=Fa(i,n,a);n+=a;const C=new Uint8Array(t,n,c);n+=c;let T,E;u>0&&(T=Fa(i,n,u),n+=u,f>0&&(E=new Uint8Array(t,n,f),E=new Uint8Array(E),n+=f));const w=A(y.POLYGONS_LENGTH,0),S=A(y.POLYLINES_LENGTH,0),P=A(y.POINTS_LENGTH,0),O=w+S+P,z=new gi(e,O,T,E,tXe(e));if(e._batchTable=z,O===0)return;const R=new Lp(y,C),F=R.getGlobalProperty("REGION");if(!l(F))throw new Se("Feature table global property: REGION must be defined");const H=_e.unpack(F),v=F[4],I=F[5],m=e._tile.computedTransform;let D=R.getGlobalProperty("RTC_CENTER",ee.FLOAT,3);l(D)?(D=d.unpack(D),B.multiplyByPoint(m,D,D)):(D=_e.center(H),D.height=N.lerp(v,I,.5),D=pe.WGS84.cartographicToCartesian(D));const L=nXe(y,C);if(n+=(4-n%4)%4,w>0){R.featuresLength=w;const M=A(R.getPropertyArray("POLYGON_COUNTS",ee.UNSIGNED_INT,1),R.getPropertyArray("POLYGON_COUNT",ee.UNSIGNED_INT,1));if(!l(M))throw new Se("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 Se("Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0");const k=M.reduce(function($,X){return $+X*2},0),W=V.reduce(function($,X){return $+X},0),G=new Uint32Array(t,n,W);n+=h;const K=new Uint16Array(t,n,k);n+=_;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 Md({positions:K,counts:M,indexCounts:V,indices:G,minimumHeight:v,maximumHeight:I,polygonMinimumHeights:q,polygonMaximumHeights:te,center:D,rectangle:H,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:z,batchIds:L.polygons,modelMatrix:m})}if(S>0){R.featuresLength=S;const M=A(R.getPropertyArray("POLYLINE_COUNTS",ee.UNSIGNED_INT,1),R.getPropertyArray("POLYLINE_COUNT",ee.UNSIGNED_INT,1));if(!l(M))throw new Se("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=M.reduce(function(te,$){return te+$*3},0),W=new Uint16Array(t,n,k);n+=g;const G=e._tileset,K=G.examineVectorLinesFunction;if(l(K)){const te=eXe(new Uint16Array(W),H,v,I,pe.WGS84);sXe(te,M,L.polylines,z,e.url,K)}let q=iXe;l(G.classificationType)&&(q=oXe),e._polylines=q({positions:W,widths:V,counts:M,batchIds:L.polylines,minimumHeight:v,maximumHeight:I,center:D,rectangle:H,boundingVolume:e.tile.boundingVolume.boundingVolume,batchTable:z,classificationType:G.classificationType,keepDecodedPositions:G.vectorKeepDecodedPositions})}if(P>0){const M=new Uint16Array(t,n,P*3);n+=p,e._points=new Rp({positions:M,batchIds:L.points,minimumHeight:v,maximumHeight:I,rectangle:H,batchTable:z})}return Promise.resolve(e)}function dF(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}}Af.prototype.hasProperty=function(e,t){return this._batchTable.hasProperty(e,t)};Af.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)||dF(this),this._features[e]};Af.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)};Af.prototype.applyStyle=function(e){l(this._features)||dF(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)};Af.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)||dF(this),this._batchTable.update(e,t))};Af.prototype.getPolylinePositions=function(e){const t=this._polylines;if(l(t))return t.getPositions(e)};Af.prototype.isDestroyed=function(){return!1};Af.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(),Ue(this)};function sXe(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,f=e.slice(a,a+u);a+=u,r(f,n[c],o,i)}}const WJ={b3dm:function(e,t,n,i,o){return Io.fromB3dm(e,t,n,i,o)},pnts:function(e,t,n,i,o){return Io.fromPnts(e,t,n,i,o)},i3dm:function(e,t,n,i,o){return Io.fromI3dm(e,t,n,i,o)},cmpt:function(e,t,n,i,o){return new Od(e,t,n,i,o,WJ)},externalTileset:function(e,t,n,i){return new Nd(e,t,n,i)},geom:function(e,t,n,i,o){return new Ld(e,t,n,i,o)},vctr:function(e,t,n,i,o){return new Af(e,t,n,i,o)},subt:function(e,t,n,i,o){return new dc(e,t,n,void 0,i,o)},subtreeJson:function(e,t,n,i){return new dc(e,t,n,i)},glb:function(e,t,n,i,o){if(i.byteLength<12)throw new Se("Invalid glb content");const a=new DataView(i,o).getUint32(8,!0),c=new Uint8Array(i,o,a);return Io.fromGltf(e,t,n,c)},gltf:function(e,t,n,i){return Io.fromGltf(e,t,n,i)},geoJson:function(e,t,n,i){return Io.fromGeoJson(e,t,n,i)}},jJ=WJ,aXe={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Lo=Object.freeze(aXe),xl={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"};xl.isBinaryFormat=function(e){switch(e){case xl.BATCHED_3D_MODEL:case xl.INSTANCED_3D_MODEL:case xl.COMPOSITE:case xl.POINT_CLOUD:case xl.VECTOR:case xl.GEOMETRY:case xl.IMPLICIT_SUBTREE:case xl.VOXEL_BINARY:case xl.GLTF_BINARY:return!0;default:return!1}};const Na=Object.freeze(xl);function Xu(e,t){this._tileset=e,this._tile=t,this.featurePropertiesDirty=!1}Object.defineProperties(Xu.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")}}});Xu.prototype.hasProperty=function(e,t){return!1};Xu.prototype.getFeature=function(e){};Xu.prototype.applyDebugSettings=function(e,t){};Xu.prototype.applyStyle=function(e){};Xu.prototype.update=function(e,t){};Xu.prototype.isDestroyed=function(){return!1};Xu.prototype.destroy=function(){return Ue(this)};function zd(e){e=A(e,A.EMPTY_OBJECT);const t=e.content,n=e.class;b.typeOf.object("options.content",t),b.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(zd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});zd.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};zd.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};zd.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};zd.prototype.getProperty=function(e){return kt.getProperty(e,this._properties,this._class)};zd.prototype.setProperty=function(e,t){return kt.setProperty(e,t,this._properties,this._class)};zd.prototype.getPropertyBySemantic=function(e){return kt.getPropertyBySemantic(e,this._properties,this._class)};zd.prototype.setPropertyBySemantic=function(e,t){return kt.setPropertyBySemantic(e,t,this._properties,this._class)};function uD(e,t){const n=tr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){uD._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 zd({content:n,class:o})}}uD._oneTimeWarning=Di;function qJ(e,t){const n=e.metadataExtension;if(!l(n))return;const i=n.groups,o=tr(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 Ud(e){e=A(e,A.EMPTY_OBJECT);const t=e.tile,n=e.class;b.typeOf.object("options.tile",t),b.typeOf.object("options.class",n),this._class=n,this._properties=t.properties,this._extensions=t.extensions,this._extras=t.extras}Object.defineProperties(Ud.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Ud.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};Ud.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};Ud.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};Ud.prototype.getProperty=function(e){return kt.getProperty(e,this._properties,this._class)};Ud.prototype.setProperty=function(e,t){return kt.setProperty(e,t,this._properties,this._class)};Ud.prototype.getPropertyBySemantic=function(e){return kt.getPropertyBySemantic(e,this._properties,this._class)};Ud.prototype.setPropertyBySemantic=function(e,t){return kt.setPropertyBySemantic(e,t,this._properties,this._class)};function hF(e,t){const n=tr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t.metadata;if(!l(n))return;if(!l(e.schema)){hF._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 Ud({tile:n,class:o})}}hF._oneTimeWarning=Di;function YJ(e){const t=new Uint8Array(e);let n=Kv(t);if(n==="glTF"&&(n="glb"),Na.isBinaryFormat(n))return{contentType:n,binaryPayload:t};const i=cXe(t);if(l(i.root))return{contentType:Na.EXTERNAL_TILESET,jsonPayload:i};if(l(i.asset))return{contentType:Na.GLTF,jsonPayload:i};if(l(i.tileAvailability))return{contentType:Na.IMPLICIT_SUBTREE_JSON,jsonPayload:i};if(l(i.type))return{contentType:Na.GEOJSON,jsonPayload:i};if(l(i.voxelTable))return{contentType:Na.VOXEL_JSON,jsonPayload:i};throw new Se("Invalid tile content.")}function cXe(e){let t;try{t=Fa(e)}catch{throw new Se("Invalid tile content.")}return t}function uu(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=ci.getServerKey(a.getUrlComponent());this._innerContentResources[s]=a,this._serverKeys[s]=c}this._contentsFetchedPromise=void 0}Object.defineProperties(uu.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 WB(e,t){e._requestsInFlight+=t,e.tileset.statistics.numberOfPendingRequests+=t}function lXe(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)}uu.prototype.requestInnerContents=function(){if(!uXe(this._serverKeys))return this._serverKeys.length;const e=this._innerContentHeaders;WB(this,e.length);for(let t=0;t<e.length;t++)this._arrayFetchPromises[t]=fXe(this,t,this._cancelCount,this._tile._contentState);return this._contentsFetchedPromise=dXe(this),0};function uXe(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)&&!ci.serverHasOpenSlots(n,t[n]))return!1;return ci.heapHasOpenSlots(e.length)}function fXe(e,t,n,i){const o=e._innerContentResources[t].clone(),r=e.tile,s=function(){return r._priority},a=e._serverKeys[t],c=new ju({throttle:!0,throttleByServer:!0,type:C_.TILES3D,priorityFunction:s,serverKey:a});o.request=c,e._requests[t]=c;const u=o.fetchArrayBuffer();return l(u)?u.then(function(f){if(!(n<e._cancelCount))return WB(e,-1),f}).catch(function(f){if(!(n<e._cancelCount)){if(o.request.state===yo.CANCELLED){lXe(e,i);return}WB(e,-1),$J(e,t,f)}}):Promise.resolve(void 0)}function dXe(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 hXe(e,o,r)});e._contentsCreated=!0,e._contents=i.filter(l)})}function hXe(e,t,n){const i=YJ(t);if(i.contentType===Na.EXTERNAL_TILESET){const h=new Se("External tilesets are disallowed inside multiple contents");return $J(e,n,h)}e._disableSkipLevelOfDetail=e._disableSkipLevelOfDetail||i.contentType===Na.GEOMETRY||i.contentType===Na.VECTOR;const o=e._tileset,r=e._innerContentResources[n],s=e._tile;let a;const c=jJ[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,_=s.implicitCoordinates;a.metadata=h.getContentMetadataView(_,n)}else s.hasImplicitContent||(a.metadata=uD(o,u));const f=qJ(o,u);return l(f)&&(a.group=new RM({metadata:f})),a}function $J(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}`))}uu.prototype.cancelRequests=function(){for(let e=0;e<this._requests.length;e++){const t=this._requests[e];l(t)&&t.cancel()}};uu.prototype.hasProperty=function(e,t){return!1};uu.prototype.getFeature=function(e){};uu.prototype.applyDebugSettings=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].applyDebugSettings(e,t)};uu.prototype.applyStyle=function(e){const t=this._contents,n=t.length;for(let i=0;i<n;++i)t[i].applyStyle(e)};uu.prototype.update=function(e,t){const n=this._contents,i=n.length;for(let o=0;o<i;++o)n[o].update(e,t)};uu.prototype.isDestroyed=function(){return!1};uu.prototype.destroy=function(){const e=this._contents,t=e.length;for(let n=0;n<t;++n)e[n].destroy();return Ue(this)};const sb={},pXe=new d,XJ=new d,KJ=new d,JJ=new d,QJ=new Bt;sb.validOutline=function(e){b.defined("positions",e);const n=Bt.fromPoints(e,QJ).halfAxes,i=J.getColumn(n,0,XJ),o=J.getColumn(n,1,KJ),r=J.getColumn(n,2,JJ),s=d.magnitude(i),a=d.magnitude(o),c=d.magnitude(r);return!(s===0&&(a===0||c===0)||a===0&&c===0)};sb.computeProjectTo2DArguments=function(e,t,n,i){b.defined("positions",e),b.defined("centerResult",t),b.defined("planeAxis1Result",n),b.defined("planeAxis2Result",i);const o=Bt.fromPoints(e,QJ),r=o.halfAxes,s=J.getColumn(r,0,XJ),a=J.getColumn(r,1,KJ),c=J.getColumn(r,2,JJ),u=d.magnitude(s),f=d.magnitude(a),h=d.magnitude(c),_=Math.min(u,f,h);if(u===0&&(f===0||h===0)||f===0&&h===0)return!1;let g,p;return(_===f||_===h)&&(g=s),_===u?g=a:_===h&&(p=a),(_===u||_===f)&&(p=c),d.normalize(g,n),d.normalize(p,i),d.clone(o.center,t),!0};function ZJ(e,t,n,i,o){const r=d.subtract(e,t,pXe),s=d.dot(n,r),a=d.dot(i,r);return j.fromElements(s,a,o)}sb.createProjectPointsTo2DFunction=function(e,t,n){return function(i){const o=new Array(i.length);for(let r=0;r<i.length;r++)o[r]=ZJ(i[r],e,t,n);return o}};sb.createProjectPointTo2DFunction=function(e,t,n){return function(i,o){return ZJ(i,e,t,n,o)}};const Pw=sb,ho={};ho.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};ho.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};ho.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]=ho.unpackPolygonHierarchy(e,t,n),t=s[a].startingIndex,delete s[a].startingIndex;return{positions:r,holes:s,startingIndex:t}};const om=new j;function eQ(e,t,n,i){return j.subtract(t,e,om),j.multiplyByScalar(om,n/i,om),j.add(e,om,om),[om.x,om.y]}const ah=new d;function mXe(e,t,n,i){return d.subtract(t,e,ah),d.multiplyByScalar(ah,n/i,ah),d.add(e,ah,ah),[ah.x,ah.y,ah.z]}ho.subdivideLineCount=function(e,t,n){const o=d.distance(e,t)/n,r=Math.max(0,Math.ceil(N.log2(o)));return Math.pow(2,r)};const pF=new Ae,mF=new Ae,_Xe=new Ae,gXe=new d,aG=new ns;ho.subdivideRhumbLineCount=function(e,t,n,i){const o=e.cartesianToCartographic(t,pF),r=e.cartesianToCartographic(n,mF),a=new ns(o,r,e).surfaceDistance/i,c=Math.max(0,Math.ceil(N.log2(a)));return Math.pow(2,c)};ho.subdivideTexcoordLine=function(e,t,n,i,o,r){const s=ho.subdivideLineCount(n,i,o),a=j.distance(e,t),c=a/s,u=r;u.length=s*2;let f=0;for(let h=0;h<s;h++){const _=eQ(e,t,h*c,a);u[f++]=_[0],u[f++]=_[1]}return u};ho.subdivideLine=function(e,t,n,i){const o=ho.subdivideLineCount(e,t,n),r=d.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 f=mXe(e,t,u*s,r);a[c++]=f[0],a[c++]=f[1],a[c++]=f[2]}return a};ho.subdivideTexcoordRhumbLine=function(e,t,n,i,o,r,s){const a=n.cartesianToCartographic(i,pF),c=n.cartesianToCartographic(o,mF);aG.setEndPoints(a,c);const u=aG.surfaceDistance/r,f=Math.max(0,Math.ceil(N.log2(u))),h=Math.pow(2,f),_=j.distance(e,t),g=_/h,p=s;p.length=h*2;let y=0;for(let C=0;C<h;C++){const T=eQ(e,t,C*g,_);p[y++]=T[0],p[y++]=T[1]}return p};ho.subdivideRhumbLine=function(e,t,n,i,o){const r=e.cartesianToCartographic(t,pF),s=e.cartesianToCartographic(n,mF),a=new ns(r,s,e),c=a.surfaceDistance/i,u=Math.max(0,Math.ceil(N.log2(c))),f=Math.pow(2,u),h=a.surfaceDistance/f;l(o)||(o=[]);const _=o;_.length=f*3;let g=0;for(let p=0;p<f;p++){const y=a.interpolateUsingSurfaceDistance(p*h,_Xe),C=e.cartographicToCartesian(y,gXe);_[g++]=C.x,_[g++]=C.y,_[g++]=C.z}return _};const yXe=new d,AXe=new d,CXe=new d,TXe=new d;ho.scaleToGeodeticHeightExtruded=function(e,t,n,i,o){i=A(i,pe.WGS84);const r=yXe;let s=AXe;const a=CXe;let c=TXe;if(l(e)&&l(e.attributes)&&l(e.attributes.position)){const u=e.attributes.position.values,f=u.length/2;for(let h=0;h<f;h+=3)d.fromArray(u,h,a),i.geodeticSurfaceNormal(a,r),c=i.scaleToGeodeticSurface(a,c),s=d.multiplyByScalar(r,n,s),s=d.add(c,s,s),u[h+f]=s.x,u[h+1+f]=s.y,u[h+2+f]=s.z,o&&(c=d.clone(a,c)),s=d.multiplyByScalar(r,t,s),s=d.add(c,s,s),u[h]=s.x,u[h+1]=s.y,u[h+2]=s.z}return e};ho.polygonOutlinesFromHierarchy=function(e,t,n){const i=[],o=new af;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=Zs(u,d.equalsEpsilon,!0),u.length<3)continue;const f=c.holes?c.holes.length:0;for(r=0;r<f;r++){const h=c.holes[r];let _=h.positions;if(t)for(a=_.length,s=0;s<a;++s)n.scaleToGeodeticSurface(_[s],_[s]);if(_=Zs(_,d.equalsEpsilon,!0),_.length<3)continue;i.push(_);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};ho.polygonsFromHierarchy=function(e,t,n,i,o){const r=[],s=[],a=new af;for(a.enqueue(e);a.length!==0;){const c=a.dequeue();let u=c.positions;const f=c.holes;let h,_;if(i)for(_=u.length,h=0;h<_;h++)o.scaleToGeodeticSurface(u[h],u[h]);if(t||(u=Zs(u,d.equalsEpsilon,!0)),u.length<3)continue;let g=n(u);if(!l(g))continue;const p=[];let y=Wi.computeWindingOrder2D(g);y===el.CLOCKWISE&&(g.reverse(),u=u.slice().reverse());let C=u.slice();const T=l(f)?f.length:0,E=[];let w;for(h=0;h<T;h++){const S=f[h];let P=S.positions;if(i)for(_=P.length,w=0;w<_;++w)o.scaleToGeodeticSurface(P[w],P[w]);if(t||(P=Zs(P,d.equalsEpsilon,!0)),P.length<3)continue;const O=n(P);if(!l(O))continue;y=Wi.computeWindingOrder2D(O),y===el.CLOCKWISE&&(O.reverse(),P=P.slice().reverse()),E.push(P),p.push(C.length),C=C.concat(P),g=g.concat(O);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:C,positions2D:g,holes:p})}return{hierarchy:r,polygons:s}};const bXe=new j,EXe=new d,xXe=new Ce,wXe=new J;ho.computeBoundingRectangle=function(e,t,n,i,o){const r=Ce.fromAxisAngle(e,i,xXe),s=J.fromQuaternion(r,wXe);let a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.POSITIVE_INFINITY,f=Number.NEGATIVE_INFINITY;const h=n.length;for(let _=0;_<h;++_){const g=d.clone(n[_],EXe);J.multiplyByVector(s,g,g);const p=t(g,bXe);l(p)&&(a=Math.min(a,p.x),c=Math.max(c,p.x),u=Math.min(u,p.y),f=Math.max(f,p.y))}return o.x=a,o.y=u,o.width=c-a,o.height=f-u,o};ho.createGeometryFromPositions=function(e,t,n,i,o,r,s){let a=Wi.triangulate(t.positions2D,t.holes);a.length<3&&(a=[0,1,2]);const c=t.positions,u=l(n),f=u?n.positions:void 0;if(o){const h=c.length,_=new Array(h*3);let g=0;for(let C=0;C<h;C++){const T=c[C];_[g++]=T.x,_[g++]=T.y,_[g++]=T.z}const p={attributes:{position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:_})},indices:a,primitiveType:Je.TRIANGLES};u&&(p.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:j.packArray(f)}));const y=new Dt(p);return r.normal?Ri.computeNormal(y):y}if(s===xn.GEODESIC)return Wi.computeSubdivision(e,c,a,f,i);if(s===xn.RHUMB)return Wi.computeRhumbLineSubdivision(e,c,a,f,i)};const cG=[],lG=[],SXe=new d,vXe=new d;ho.computeWallGeometry=function(e,t,n,i,o,r){let s,a,c,u,f,h,_,g,p,y=e.length,C=0,T=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],f=e[(c+1)%y],s[C]=s[C+a]=u.x,++C,s[C]=s[C+a]=u.y,++C,s[C]=s[C+a]=u.z,++C,s[C]=s[C+a]=f.x,++C,s[C]=s[C+a]=f.y,++C,s[C]=s[C+a]=f.z,++C,E&&(h=w[c],_=w[(c+1)%y],g[T]=g[T+p]=h.x,++T,g[T]=g[T+p]=h.y,++T,g[T]=g[T+p]=_.x,++T,g[T]=g[T+p]=_.y,++T);else{const R=N.chordLength(i,n.maximumRadius);let F=0;if(r===xn.GEODESIC)for(c=0;c<y;c++)F+=ho.subdivideLineCount(e[c],e[(c+1)%y],R);else if(r===xn.RHUMB)for(c=0;c<y;c++)F+=ho.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],f=e[(c+1)%y];let H,v;E&&(h=w[c],_=w[(c+1)%y]),r===xn.GEODESIC?(H=ho.subdivideLine(u,f,R,lG),E&&(v=ho.subdivideTexcoordLine(h,_,u,f,R,cG))):r===xn.RHUMB&&(H=ho.subdivideRhumbLine(n,u,f,R,lG),E&&(v=ho.subdivideTexcoordRhumbLine(h,_,n,u,f,R,cG)));const I=H.length;for(let m=0;m<I;++m,++C)s[C]=H[m],s[C+a]=H[m];if(s[C]=f.x,s[C+a]=f.x,++C,s[C]=f.y,s[C+a]=f.y,++C,s[C]=f.z,s[C+a]=f.z,++C,E){const m=v.length;for(let D=0;D<m;++D,++T)g[T]=v[D],g[T+p]=v[D];g[T]=_.x,g[T+p]=_.x,++T,g[T]=_.y,g[T+p]=_.y,++T}}}y=s.length;const S=it.createTypedArray(y/3,y-e.length*6);let P=0;for(y/=6,c=0;c<y;c++){const R=c,F=R+1,H=R+y,v=H+1;u=d.fromArray(s,R*3,SXe),f=d.fromArray(s,F*3,vXe),!d.equalsEpsilon(u,f,N.EPSILON10,N.EPSILON10)&&(S[P++]=R,S[P++]=H,S[P++]=F,S[P++]=F,S[P++]=H,S[P++]=v)}const O={attributes:new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:s})}),indices:S,primitiveType:Je.TRIANGLES};return E&&(O.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:g})),new Dt(O)};const Rn=ho;function DXe(e){const t=e.length,n=new Float64Array(t*3),i=it.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 Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:n})});return new Dt({attributes:s,indices:i,primitiveType:Je.LINES})}function qa(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy;b.defined("options.polygonHierarchy",t),this._polygonHierarchy=t,this._workerName="createCoplanarPolygonOutlineGeometry",this.packedLength=Rn.computeHierarchyPackedLength(t,d)+1}qa.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),b.defined("options.positions",e.positions);const t={polygonHierarchy:{positions:e.positions}};return new qa(t)};qa.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),n=Rn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),t[n]=e.packedLength,t};const IXe={polygonHierarchy:{}};qa.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=Rn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=e[t];return l(n)||(n=new qa(IXe)),n._polygonHierarchy=i,n.packedLength=o,n};qa.createGeometry=function(e){const t=e._polygonHierarchy;let n=t.positions;if(n=Zs(n,d.equalsEpsilon,!0),n.length<3||!Pw.validOutline(n))return;const o=Rn.polygonOutlinesFromHierarchy(t,!1);if(o.length===0)return;const r=[];for(let c=0;c<o.length;c++){const u=new nn({geometry:DXe(o[c])});r.push(u)}const s=Ri.combineInstances(r)[0],a=fe.fromPoints(t.positions);return new Dt({attributes:s.attributes,indices:s.indices,primitiveType:s.primitiveType,boundingSphere:a})};let dx=new Ae;function ab(e){b.typeOf.object("options",e),b.typeOf.string("options.token",e.token);const t=ji.fromToken(e.token),n=A(e.minimumHeight,0),i=A(e.maximumHeight,0),o=A(e.ellipsoid,pe.WGS84);this.s2Cell=t,this.minimumHeight=n,this.maximumHeight=i,this.ellipsoid=o;const r=zXe(t,n,i,o);this._boundingPlanes=r;const s=kXe(r);this._vertices=s,this._edgeNormals=new Array(6),this._edgeNormals[0]=FO(r[0],s.slice(0,4));let a;for(a=0;a<4;a++)this._edgeNormals[0][a]=d.negate(this._edgeNormals[0][a],this._edgeNormals[0][a]);for(this._edgeNormals[1]=FO(r[1],s.slice(4,8)),a=0;a<4;a++)this._edgeNormals[2+a]=FO(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();dx=o.cartesianToCartographic(c,dx),dx.height=(i+n)/2,this.center=o.cartographicToCartesian(dx,c),this._boundingSphere=fe.fromPoints(s)}const PXe=new d,OXe=new Ae,LXe=new d,BXe=new Ae,RXe=new d,NXe=new d,MXe=new d,FXe=new d;function zXe(e,t,n,i){const o=new Array(6),r=e.getCenter(),s=i.geodeticSurfaceNormal(r,PXe),a=i.cartesianToCartographic(r,OXe);a.height=n;const c=i.cartographicToCartesian(a,LXe),u=St.fromPointNormal(c,s);o[0]=u;let f=0,h;const _=[];let g,p;for(h=0;h<4;h++){g=e.getVertex(h),_[h]=g,p=i.cartesianToCartographic(g,BXe),p.height=t;const C=St.getPointDistance(u,i.cartographicToCartesian(p,RXe));C<f&&(f=C)}const y=St.clone(u);for(y.normal=d.negate(y.normal,y.normal),y.distance=y.distance*-1+f,o[1]=y,h=0;h<4;h++){g=_[h];const C=_[(h+1)%4],T=i.geodeticSurfaceNormal(g,NXe),E=d.subtract(C,g,FXe);let w=d.cross(E,T,MXe);w=d.normalize(w,w),o[2+h]=St.fromPointNormal(g,w)}return o}let rm=new d,sm=new d,am=new d,PO=new d,OO=new d,LO=new d;const UXe=new d,HXe=new d,VXe=new d;let BO=new d,RO=new d,NO=new d,ch=new d;const Cu=new J;function uG(e,t,n){rm=e.normal,sm=t.normal,am=n.normal,PO=d.multiplyByScalar(e.normal,-e.distance,PO),OO=d.multiplyByScalar(t.normal,-t.distance,OO),LO=d.multiplyByScalar(n.normal,-n.distance,LO),BO=d.multiplyByScalar(d.cross(sm,am,UXe),d.dot(PO,rm),BO),RO=d.multiplyByScalar(d.cross(am,rm,HXe),d.dot(OO,sm),RO),NO=d.multiplyByScalar(d.cross(rm,sm,VXe),d.dot(LO,am),NO),Cu[0]=rm.x,Cu[1]=sm.x,Cu[2]=am.x,Cu[3]=rm.y,Cu[4]=sm.y,Cu[5]=am.y,Cu[6]=rm.z,Cu[7]=sm.z,Cu[8]=am.z;const i=J.determinant(Cu);return ch=d.add(BO,RO,ch),ch=d.add(ch,NO,ch),new d(ch.x/i,ch.y/i,ch.z/i)}function kXe(e){const t=new Array(8);for(let n=0;n<4;n++)t[n]=uG(e[0],e[2+(n+3)%4],e[2+n%4]),t[n+4]=uG(e[1],e[2+(n+3)%4],e[2+n%4]);return t}let MO=new d,_g=new d;function FO(e,t){const n=[];for(let i=0;i<4;i++)MO=d.subtract(t[(i+1)%4],t[i],MO),_g=d.cross(e.normal,MO,_g),_g=d.normalize(_g,_g),n[i]=d.clone(_g);return n}Object.defineProperties(ab.prototype,{boundingVolume:{get:function(){return this}},boundingSphere:{get:function(){return this._boundingSphere}}});const zO=new d;ab.prototype.distanceToCamera=function(e){b.defined("frameState",e);const t=e.camera.positionWC,n=[],i=[];let o;St.getPointDistance(this._boundingPlanes[0],t)>0?(n.push(0),i.push(this._planeVertices[0]),o=this._edgeNormals[0]):St.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,St.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=UO(St.projectPointOntoPlane(c,t,zO),i[0],c,o),d.distance(a,t);if(n.length===2){if(n[0]===0){const _=[this._vertices[4*n[0]+(n[1]-2)],this._vertices[4*n[0]+(n[1]-2+1)%4]];return a=tQ(t,_[0],_[1]),d.distance(a,t)}let f=Number.MAX_VALUE,h;for(r=0;r<2;r++)c=this._boundingPlanes[n[r]],a=UO(St.projectPointOntoPlane(c,t,zO),i[r],c,this._edgeNormals[n[r]]),h=d.distanceSquared(a,t),h<f&&(f=h);return Math.sqrt(f)}else if(n.length>3)return a=UO(St.projectPointOntoPlane(this._boundingPlanes[1],t,zO),this._planeVertices[1],this._boundingPlanes[1],this._edgeNormals[1]),d.distance(a,t);const u=n[1]===2&&n[2]===5?0:1;return n[0]===0?d.distance(t,this._vertices[(n[1]-2+u)%4]):d.distance(t,this._vertices[4+(n[1]-2+u)%4])};const GXe=new d,WXe=new d;function tQ(e,t,n){const i=d.subtract(n,t,GXe),o=d.subtract(e,t,WXe);let r=d.dot(i,o);if(r<=0)return t;const s=d.dot(i,i);return r>=s?n:(r=r/s,new d((1-r)*t.x+r*n.x,(1-r)*t.y+r*n.y,(1-r)*t.z+r*n.z))}const jXe=new St(d.UNIT_X,0);function UO(e,t,n,i){let o=Number.MAX_VALUE,r,s,a;for(let c=0;c<t.length;c++){const u=St.fromPointNormal(t[c],i[c],jXe);St.getPointDistance(u,e)<0||(a=tQ(e,t[c],t[(c+1)%4]),r=d.distance(e,a),r<o&&(o=r,s=a))}return l(s)?s:e}ab.prototype.intersectPlane=function(e){b.defined("plane",e);let t=0,n=0;for(let i=0;i<this._vertices.length;i++)d.dot(e.normal,this._vertices[i])+e.distance<0?n++:t++;return t===this._vertices.length?mn.INSIDE:n===this._vertices.length?mn.OUTSIDE:mn.INTERSECTING};ab.prototype.createDebugVolume=function(e){b.defined("color",e);const t=new B.clone(B.IDENTITY),n=new qa({polygonHierarchy:{positions:this._planeVertices[0]}}),i=qa.createGeometry(n),o=new nn({geometry:i,id:"outline",modelMatrix:t,attributes:{color:an.fromColor(e)}}),r=new qa({polygonHierarchy:{positions:this._planeVertices[1]}}),s=qa.createGeometry(r),a=new nn({geometry:s,id:"outline",modelMatrix:t,attributes:{color:an.fromColor(e)}}),c=[];for(let u=0;u<4;u++){const f=new qa({polygonHierarchy:{positions:this._planeVertices[2+u]}}),h=qa.createGeometry(f);c[u]=new nn({geometry:h,id:"outline",modelMatrix:t,attributes:{color:an.fromColor(e)}})}return new Wt({geometryInstances:[c[0],c[1],c[2],c[3],a,o],appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})};function Hd(e,t){t===0&&(t=N.EPSILON7),this._boundingSphere=new fe(e,t)}Object.defineProperties(Hd.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}}});Hd.prototype.distanceToCamera=function(e){b.defined("frameState",e);const t=this._boundingSphere;return Math.max(0,d.distance(t.center,e.camera.positionWC)-t.radius)};Hd.prototype.intersectPlane=function(e){return b.defined("plane",e),fe.intersectPlane(this._boundingSphere,e)};Hd.prototype.update=function(e,t){d.clone(e,this._boundingSphere.center),this._boundingSphere.radius=t};Hd.prototype.createDebugVolume=function(e){b.defined("color",e);const t=new op({radius:this.radius}),n=B.fromTranslation(this.center,new B.clone(B.IDENTITY)),i=new nn({geometry:t,id:"outline",modelMatrix:n,attributes:{color:an.fromColor(e)}});return new Wt({geometryInstances:i,appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})};const qXe=new d,YXe=new d,$Xe=new d,XXe=new d;function _m(e,t,n){n=d.cross(e,t,n);const i=d.magnitude(n);return d.multiplyByScalar(n,N.EPSILON7/i,n)}function HO(e,t){const n=d.normalize(e,XXe),i=d.equalsEpsilon(n,d.UNIT_X,N.EPSILON6)?d.UNIT_Y:d.UNIT_X;return _m(e,i,t)}function nQ(e){let t=J.getColumn(e,0,qXe),n=J.getColumn(e,1,YXe),i=J.getColumn(e,2,$Xe);const o=d.equals(t,d.ZERO),r=d.equals(n,d.ZERO),s=d.equals(i,d.ZERO);return!o&&!r&&!s?e:o&&r&&s?(e[0]=N.EPSILON7,e[4]=N.EPSILON7,e[8]=N.EPSILON7,e):(o&&!r&&!s?t=_m(n,i,t):!o&&r&&!s?n=_m(t,i,n):!o&&!r&&s?i=_m(n,t,i):o?r?s||(t=HO(i,t),n=_m(i,t,n)):(t=HO(n,t),i=_m(n,t,i)):(n=HO(t,n),i=_m(n,t,i)),J.setColumn(e,0,t,e),J.setColumn(e,1,n,e),J.setColumn(e,2,i,e),e)}function Ql(e,t){t=nQ(t),this._orientedBoundingBox=new Bt(e,t),this._boundingSphere=fe.fromOrientedBoundingBox(this._orientedBoundingBox)}Object.defineProperties(Ql.prototype,{boundingVolume:{get:function(){return this._orientedBoundingBox}},boundingSphere:{get:function(){return this._boundingSphere}}});Ql.prototype.distanceToCamera=function(e){return b.defined("frameState",e),Math.sqrt(this._orientedBoundingBox.distanceSquaredTo(e.camera.positionWC))};Ql.prototype.intersectPlane=function(e){return b.defined("plane",e),this._orientedBoundingBox.intersectPlane(e)};Ql.prototype.update=function(e,t){d.clone(e,this._orientedBoundingBox.center),t=nQ(t),J.clone(t,this._orientedBoundingBox.halfAxes),fe.fromOrientedBoundingBox(this._orientedBoundingBox,this._boundingSphere)};Ql.prototype.createDebugVolume=function(e){b.defined("color",e);const t=new ac({minimum:new d(-1,-1,-1),maximum:new d(1,1,1)}),n=B.fromRotationTranslation(this.boundingVolume.halfAxes,this.boundingVolume.center),i=new nn({geometry:t,id:"outline",modelMatrix:n,attributes:{color:an.fromColor(e)}});return new Wt({geometryInstances:i,appearance:new _n({translucent:!1,flat:!0}),asynchronous:!1})};function Zi(e,t,n,i){this._tileset=e,this._header=n;const o=l(n.contents),r=o&&n.contents.length>1||tr(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 f;l(s)&&l(s.boundingVolume)&&(f=this.createBoundingVolume(s.boundingVolume,c)),this._contentBoundingVolume=f,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,Zi._deprecationWarning("geometricErrorUndefined","Required property geometricError is undefined for this tile. Using parent's geometric error instead.")),this.updateGeometricErrorScale();let _;l(n.refine)?((n.refine==="replace"||n.refine==="add")&&Zi._deprecationWarning("lowercase-refine",`This tile uses a lowercase refine "${n.refine}". Instead use "${n.refine.toUpperCase()}".`),_=n.refine.toUpperCase()==="REPLACE"?Aa.REPLACE:Aa.ADD):l(i)?_=i.refine:_=Aa.REPLACE,this.refine=_,this.children=[],this.parent=i;let g,p=!1,y,C,T;if(t=Re.createIfNeeded(t),r)y=Lo.UNLOADED,C=t.clone();else if(l(s)){let P=s.uri;l(s.url)&&(Zi._deprecationWarning("contentUrl",'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'),P=s.url),P===""?(Zi._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 Xu(e,this),p=!0,y=Lo.READY):(y=Lo.UNLOADED,C=t.getDerivedResource({url:P}),T=ci.getServerKey(C.getUrlComponent()))}else g=new Xu(e,this),p=!0,y=Lo.READY;this._content=g,this._contentResource=C,this._contentState=y,this._contentReadyToProcessPromise=void 0,this._contentReadyPromise=void 0,this._expiredContent=void 0,this._serverKey=T,this.hasEmptyContent=p,this.hasTilesetContent=!1,this.hasImplicitContent=!1,this.hasImplicitContentMetadata=!1,this.hasMultipleContents=r,this.metadata=hF(e,n),this.cacheNode=void 0;const E=n.expire;let w,S;l(E)&&(w=E.duration,l(E.date)&&(S=ne.fromIso8601(E.date))),this.expireDuration=w,this.expireDate=S,this.lastStyleTime=0,this._optimChildrenWithinParent=Xg.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=U.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 ne,this._commandsLength=0,this._color=void 0,this._colorDirty=!1,this._request=void 0}Zi._deprecationWarning=Tp;Object.defineProperties(Zi.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 U),U.clone(this._color)},set:function(e){this._color=U.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===Lo.READY}},contentUnloaded:{get:function(){return this._contentState===Lo.UNLOADED}},contentExpired:{get:function(){return this._contentState===Lo.EXPIRED}},contentFailed:{get:function(){return this._contentState===Lo.FAILED}},contentReadyToProcessPromise:{get:function(){return this._contentReadyToProcessPromise}},contentReadyPromise:{get:function(){return this._contentReadyPromise}},commandsLength:{get:function(){return this._commandsLength}}});const lh=new d;function KXe(e,t){const n=e._tileset,i=t.camera,o=e.boundingSphere,r=o.radius,s=d.multiplyByScalar(i.directionWC,e._centerZDepth,lh),a=d.add(i.positionWC,s,lh),c=d.subtract(a,o.center,lh);if(d.magnitude(c)>r){const w=d.normalize(c,lh),S=d.multiplyByScalar(w,r,lh),P=d.add(o.center,S,lh),O=d.subtract(P,i.positionWC,lh),z=d.normalize(O,lh);e._foveatedFactor=1-Math.abs(d.dot(i.directionWC,z))}else e._foveatedFactor=0;const h=e.refine===Aa.REPLACE,_=n._skipLevelOfDetail;if(h&&!_||!n.foveatedScreenSpaceError||n.foveatedConeSize===1||e._priorityProgressiveResolution&&h&&_||n._pass===Ys.PRELOAD_FLIGHT||n._pass===Ys.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,C=N.clamp((e._foveatedFactor-p)/y,0,1),T=n.foveatedInterpolationCallback(n.foveatedMinimumScreenSpaceErrorRelaxation,n.maximumScreenSpaceError,C),E=e._screenSpaceError===0&&l(e.parent)?e.parent._screenSpaceError*.5:e._screenSpaceError;return n.maximumScreenSpaceError-T<=E}const iQ=new ne;Zi.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,f=u.drawingBufferWidth,h=u.drawingBufferHeight*o;let _;if(e.mode===le.SCENE2D||c instanceof Ft){l(c._offCenterFrustum)&&(c=c._offCenterFrustum);const g=Math.max(c.top-c.bottom,c.right-c.left)/Math.max(f,h);_=s/g}else{const g=Math.max(this._distanceToCamera,N.EPSILON7),p=a.frustum.sseDenominator;if(_=s*h/(g*p),i.dynamicScreenSpaceError){const y=i._dynamicScreenSpaceErrorComputedDensity,C=i.dynamicScreenSpaceErrorFactor,T=N.fog(g,y)*C;_-=T}}return _/=e.pixelRatio,_};function JXe(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 QXe(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}Zi.prototype.updateVisibility=function(e){const t=this.parent,n=this._tileset,i=l(t)?t.computedTransform:n.modelMatrix,o=l(t)?t._visibilityPlaneMask:Ko.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!==Ko.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(e),this._priorityReverseScreenSpaceError=QXe(n,this),this._priorityProgressiveResolution=JXe(n,this),this.priorityDeferred=KXe(this,e)};Zi.prototype.updateExpiration=function(){if(l(this.expireDate)&&this.contentReady&&!this.hasEmptyContent&&!this.hasMultipleContents){const e=ne.now(iQ);ne.lessThan(this.expireDate,e)&&(this._contentState=Lo.EXPIRED,this._expiredContent=this._content)}};function ZXe(e){if(l(e.expireDuration)){const t=ne.now(iQ);ne.addSeconds(t,e.expireDuration,t),l(e.expireDate)?ne.lessThan(e.expireDate,t)&&ne.clone(t,e.expireDate):e.expireDate=ne.clone(t)}}function eKe(e){return function(){return e._priority}}Zi.prototype.requestContent=function(){return this.hasEmptyContent?0:this.hasMultipleContents?tKe(this):nKe(this)};function tKe(e){let t=e._content;const n=e._tileset;if(!l(t)){const r=tr(e._header,"3DTILES_multiple_contents")?e._header.extensions["3DTILES_multiple_contents"]:e._header;t=new uu(n,e,e._contentResource.clone(),r),e._content=t}const i=t.requestInnerContents();if(i>0)return i;e._contentState=Lo.LOADING;const o=t.contentsFetchedPromise.then(function(){if(!(e._contentState!==Lo.LOADING||!l(t.readyPromise))){if(e.isDestroyed()){VO(e,n);return}return e._contentState=Lo.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()){VO(e,n);return}return e._selectedFrame=0,e.lastStyleTime=0,ne.now(e._loadTimestamp),e._contentState=Lo.READY,r}}).catch(function(r){VO(e,n)}),0}function VO(e,t,n){e._contentState===Lo.PROCESSING&&--t.statistics.numberOfTilesProcessing,e._contentState=Lo.FAILED}function nKe(e){const t=e._contentResource.clone(),n=e.contentExpired;n&&t.setQueryParameters({expired:e.expireDate.toString()});const i=new ju({throttle:!0,throttleByServer:!0,type:C_.TILES3D,priorityFunction:eKe(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=Lo.LOADING,++s.statistics.numberOfPendingRequests;const a=o.then(function(c){if(e.isDestroyed()){kO(e,s);return}const u=iKe(e,c);return n&&(e.expireDate=void 0),e._content=u,e._contentState=Lo.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()){kO(e,s);return}return ZXe(e),e._selectedFrame=0,e.lastStyleTime=0,ne.now(e._loadTimestamp),e._contentState=Lo.READY,c}}).catch(function(c){return i.state===yo.CANCELLED?(e._contentState=r,--s.statistics.numberOfPendingRequests,++s.statistics.numberOfAttemptedRequests,Promise.reject("Cancelled")):(kO(e,s),Promise.reject(c))}),0}function kO(e,t){e._contentState===Lo.PROCESSING?--t.statistics.numberOfTilesProcessing:--t.statistics.numberOfPendingRequests,e._contentState=Lo.FAILED}function iKe(e,t){const n=YJ(t),i=e._tileset;i._disableSkipLevelOfDetail=i._disableSkipLevelOfDetail||n.contentType===Na.GEOMETRY||n.contentType===Na.VECTOR,(n.contentType===Na.IMPLICIT_SUBTREE||n.contentType===Na.IMPLICIT_SUBTREE_JSON)&&(e.hasImplicitContent=!0),n.contentType===Na.EXTERNAL_TILESET&&(e.hasTilesetContent=!0);let o;const r=jJ[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=uD(i,s));const a=qJ(i,s);return l(a)&&(o.group=new RM({metadata:a})),o}Zi.prototype.cancelRequests=function(){this.hasMultipleContents?this._content.cancelRequests():this._request.cancel()};Zi.prototype.unloadContent=function(){this.hasEmptyContent||this.hasTilesetContent||this.hasImplicitContent||(this._content=this._content&&this._content.destroy(),this._contentState=Lo.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 oQ=new fe;function _F(e,t){if(t.mode!==le.SCENE3D&&!l(e._boundingVolume2D)){const n=e._boundingVolume.boundingSphere,i=fe.projectTo2D(n,t.mapProjection,oQ);e._boundingVolume2D=new Hd(i.center,i.radius)}return t.mode!==le.SCENE3D?e._boundingVolume2D:e._boundingVolume}function oKe(e,t){if(t.mode!==le.SCENE3D&&!l(e._contentBoundingVolume2D)){const n=e._contentBoundingVolume.boundingSphere,i=fe.projectTo2D(n,t.mapProjection,oQ);e._contentBoundingVolume2D=new Hd(i.center,i.radius)}return t.mode!==le.SCENE3D?e._contentBoundingVolume2D:e._contentBoundingVolume}Zi.prototype.visibility=function(e,t){const n=e.cullingVolume,i=_F(this,e),o=this._tileset,r=o.clippingPlanes;if(l(r)&&r.enabled){const s=r.computeIntersectionWithBoundingVolume(i,o.clippingPlanesOriginMatrix);if(this._isClipped=s!==mn.INSIDE,s===mn.OUTSIDE)return Ko.MASK_OUTSIDE}return n.computeVisibilityWithPlaneMask(i,t)};Zi.prototype.contentVisibility=function(e){if(!l(this._contentBoundingVolume)||this._visibilityPlaneMask===Ko.MASK_INSIDE)return mn.INSIDE;const t=e.cullingVolume,n=oKe(this,e),i=this._tileset,o=i.clippingPlanes;if(l(o)&&o.enabled){const r=o.computeIntersectionWithBoundingVolume(n,i.clippingPlanesOriginMatrix);if(this._isClipped=r!==mn.INSIDE,r===mn.OUTSIDE)return mn.OUTSIDE}return t.computeVisibility(n)};Zi.prototype.distanceToTile=function(e){return _F(this,e).distanceToCamera(e)};const rKe=new d;Zi.prototype.distanceToTileCenter=function(e){const n=_F(this,e).boundingVolume,i=d.subtract(n.center,e.camera.positionWC,rKe);return d.dot(e.camera.directionWC,i)};Zi.prototype.insideViewerRequestVolume=function(e){const t=this._viewerRequestVolume;return!l(t)||t.distanceToCamera(e)===0};const rQ=new J,sQ=new d,sKe=new J,aQ=new d,cQ=new _e,aKe=new Bt,jB=new B;function cKe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],aQ),o=J.fromArray(e,3,sKe);i=B.multiplyByPoint(t,i,i);const r=B.getMatrix3(t,rQ);return o=J.multiply(r,o,o),l(n)?(n.update(i,o),n):new Ql(i,o)}function lKe(e,t,n,i){const o=_e.unpack(e,0,cQ),r=e[4],s=e[5],a=Bt.fromRectangle(o,r,s,pe.WGS84,aKe);let c=a.center,u=a.halfAxes;t=B.multiplyTransformation(t,B.inverseTransformation(n,jB),jB),c=B.multiplyByPoint(t,c,c);const f=B.getMatrix3(t,rQ);return u=J.multiply(f,u,u),l(i)&&i instanceof Ql?(i.update(c,u),i):new Ql(c,u)}function uKe(e,t,n,i){if(!B.equalsEpsilon(t,n,N.EPSILON8))return lKe(e,t,n,i);if(l(i))return i;const o=_e.unpack(e,0,cQ);return new qu({rectangle:o,minimumHeight:e[4],maximumHeight:e[5]})}function fKe(e,t,n){let i=d.fromElements(e[0],e[1],e[2],aQ),o=e[3];i=B.multiplyByPoint(t,i,i);const r=B.getScale(t,sQ),s=d.maximumComponent(r);return o*=s,l(n)?(n.update(i,o),n):new Hd(i,o)}Zi.prototype.createBoundingVolume=function(e,t,n){if(!l(e))throw new Se("boundingVolume must be defined");if(tr(e,"3DTILES_bounding_volume_S2"))return new ab(e.extensions["3DTILES_bounding_volume_S2"]);if(l(e.box))return cKe(e.box,t,n);if(l(e.region))return uKe(e.region,t,this._initialTransform,n);if(l(e.sphere))return fKe(e.sphere,t,n);throw new Se("boundingVolume must contain a sphere, region, or box")};Zi.prototype.updateTransform=function(e){e=A(e,B.IDENTITY);const t=B.multiply(e,this.transform,jB);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()};Zi.prototype.updateGeometricErrorScale=function(){const e=B.getScale(this.computedTransform,sQ),t=d.maximumComponent(e);this.geometricError=this._geometricError*t};function dKe(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=U.DARKGRAY:u=U.WHITE:u=U.YELLOW,l(e._debugBoundingVolume)||(e._debugBoundingVolume=e._boundingVolume.createDebugVolume(u)),e._debugBoundingVolume.update(n);const f=e._debugBoundingVolume.getGeometryInstanceAttributes("outline");f.color=an.toValue(u,f.color)}else!s&&l(e._debugBoundingVolume)&&(e._debugBoundingVolume=e._debugBoundingVolume.destroy());t.debugShowContentBoundingVolume&&o?(l(e._debugContentBoundingVolume)||(e._debugContentBoundingVolume=e._contentBoundingVolume.createDebugVolume(U.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(U.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=U.WHITE),e._colorDirty&&(e._colorDirty=!1,e._content.applyDebugSettings(!0,e._color)),c&&t.makeStyleDirty()}function hKe(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 pKe(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)}Zi.prototype.update=function(e,t,n){const i=t.commandList.length;pKe(this,e),dKe(this,e,t,n),hKe(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===Be.TRANSLUCENT;a.depthForTranslucentClassification=c}this.clippingPlanesDirty=!1};const fG=[];Zi.prototype.process=function(e,t){const n=t.commandList;t.commandList=fG,this._content.update(e,t),fG.length=0,t.commandList=n};function dG(e,t,n){const i=e*Math.pow(10,t);return parseInt(i)*Math.pow(10,n)}function hx(e,t,n){return Math.max(N.normalize(e,t,n)-N.EPSILON7,0)}Zi.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,f=c+u,h=r,_=Math.pow(10,f),g=f+h,p=r,y=Math.pow(10,g),C=g+p,T=Math.pow(10,C);let E=hx(this._depth,n.depth,i.depth);E=t?1-E:E;const S=!e._skipLevelOfDetail&&this.refine===Aa.REPLACE?hx(this._priorityHolder._distanceToCamera,n.distance,i.distance):hx(this._priorityReverseScreenSpaceError,n.reverseScreenSpaceError,i.reverseScreenSpaceError),P=dG(S,a,s),O=this._priorityProgressiveResolution?0:_,z=hx(this._priorityHolder._foveatedFactor,n.foveatedFactor,i.foveatedFactor),R=dG(z,u,c),F=this.priorityDeferred?y:0,H=e._pass===Ys.PRELOAD_FLIGHT?0:T;this._priority=E+P+O+R+F+H};Zi.prototype.isDestroyed=function(){return!1};Zi.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(),Ue(this)};function Ku(e){e=A(e,A.EMPTY_OBJECT);const t=e.id,n=e.group,i=e.class;b.typeOf.object("options.group",n),b.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(Ku.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}}});Ku.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};Ku.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};Ku.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};Ku.prototype.getProperty=function(e){return kt.getProperty(e,this._properties,this._class)};Ku.prototype.setProperty=function(e,t){return kt.setProperty(e,t,this._properties,this._class)};Ku.prototype.getPropertyBySemantic=function(e){return kt.getPropertyBySemantic(e,this._properties,this._class)};Ku.prototype.setPropertyBySemantic=function(e,t){return kt.setPropertyBySemantic(e,t,this._properties,this._class)};function Vd(e){e=A(e,A.EMPTY_OBJECT);const t=e.tileset,n=e.class;b.typeOf.object("options.tileset",t),b.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(Vd.prototype,{class:{get:function(){return this._class}},extras:{get:function(){return this._extras}},extensions:{get:function(){return this._extensions}}});Vd.prototype.hasProperty=function(e){return kt.hasProperty(e,this._properties,this._class)};Vd.prototype.hasPropertyBySemantic=function(e){return kt.hasPropertyBySemantic(e,this._properties,this._class)};Vd.prototype.getPropertyIds=function(e){return kt.getPropertyIds(this._properties,this._class,e)};Vd.prototype.getProperty=function(e){return kt.getProperty(e,this._properties,this._class)};Vd.prototype.setProperty=function(e,t){return kt.setProperty(e,t,this._properties,this._class)};Vd.prototype.getPropertyBySemantic=function(e){return kt.getPropertyBySemantic(e,this._properties,this._class)};Vd.prototype.setPropertyBySemantic=function(e,t){return kt.setPropertyBySemantic(e,t,this._properties,this._class)};function lQ(e){e=A(e,A.EMPTY_OBJECT);const t=e.metadataJson,n=e.schema;b.typeOf.object("options.metadataJson",t),b.typeOf.object("options.schema",n);const i=A(t.metadata,t.tileset);let o;l(i)&&(o=new Vd({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 f=a[u];s.push(new Ku({group:f,class:n.classes[f.class]}))}}else if(l(a)){r=Object.keys(a).sort();const c=r.length;for(let u=0;u<c;u++){const f=r[u];if(a.hasOwnProperty(f)){const h=a[f];s.push(new Ku({id:f,group:a[f],class:n.classes[h.class]}))}}}this._schema=n,this._groups=s,this._groupIds=r,this._tileset=o,this._statistics=t.statistics,this._extras=t.extras,this._extensions=t.extensions}Object.defineProperties(lQ.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 uQ={},mKe=new d;uQ.checkChildrenWithinParent=function(e){b.typeOf.object("tile",e);const t=e.children,n=t.length,i=e.boundingVolume;if(i instanceof Ql||i instanceof qu){const o=i._orientedBoundingBox;e._optimChildrenWithinParent=Xg.USE_OPTIMIZATION;for(let r=0;r<n;++r){const a=t[r].boundingVolume;if(!(a instanceof Ql||a instanceof qu)){e._optimChildrenWithinParent=Xg.SKIP_OPTIMIZATION;break}const c=a._orientedBoundingBox,u=d.subtract(c.center,o.center,mKe),f=d.magnitude(u);d.divideByScalar(u,f,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),_=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<=_+f){e._optimChildrenWithinParent=Xg.SKIP_OPTIMIZATION;break}}}return e._optimChildrenWithinParent===Xg.USE_OPTIMIZATION};const _Ke=uQ;function cb(){this.head=void 0,this.tail=void 0,this._length=0}Object.defineProperties(cb.prototype,{length:{get:function(){return this._length}}});function gKe(e,t,n){this.item=e,this.previous=t,this.next=n}cb.prototype.add=function(e){const t=new gKe(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 fQ(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}cb.prototype.remove=function(e){l(e)&&(fQ(this,e),--this._length)};cb.prototype.splice=function(e,t){if(e===t)return;fQ(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 V_(){this._list=new cb,this._sentinel=this._list.add(),this._trimTiles=!1}V_.prototype.reset=function(){this._list.splice(this._list.tail,this._sentinel)};V_.prototype.touch=function(e){const t=e.cacheNode;l(t)&&this._list.splice(this._sentinel,t)};V_.prototype.add=function(e){l(e.cacheNode)||(e.cacheNode=this._list.add(e))};V_.prototype.unloadTile=function(e,t,n){const i=t.cacheNode;l(i)&&(this._list.remove(i),t.cacheNode=void 0,n(e,t))};V_.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)}};V_.prototype.trim=function(){this._trimTiles=!0};function fD(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 qB(e,t){let n;return t==="_loadTimestamp"?n=ne.toDate(e).getTime():n=e,n}fD.prototype.setReferenceMinimumMaximum=function(e,t,n){this._referenceMinimum[n]=qB(e,n),this._referenceMaximum[n]=qB(t,n)};function yKe(e,t){const n=e.tilePropertyName;if(l(n)){const i=qB(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 GO=[new U(.1,.1,.1,1),new U(.153,.278,.878,1),new U(.827,.231,.49,1),new U(.827,.188,.22,1),new U(1,.592,.259,1),new U(1,.843,0,1)];fD.prototype.colorize=function(e,t){const n=this.tilePropertyName;if(!l(n)||!e.contentAvailable||e._selectedFrame!==t.frameNumber)return;const i=yKe(this,e),o=this._previousMinimum,r=this._previousMaximum;if(o===Number.MAX_VALUE||r===-Number.MAX_VALUE)return;const s=r-o+N.EPSILON7,c=N.clamp(i-o,0,s)/s,u=GO.length-1,f=c*u,h=Math.floor(f),_=Math.ceil(f),g=f-h,p=GO[h],y=GO[_],C=U.clone(U.WHITE);C.red=N.lerp(p.red,y.red,g),C.green=N.lerp(p.green,y.green,g),C.blue=N.lerp(p.blue,y.blue,g),e._debugColor=C};fD.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 Vu(){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}Vu.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 dD(e,t,n,i){const o=t.innerContents,r=t.pointsLength,s=t.trianglesLength,a=t.featuresLength,c=t.geometryByteLength,u=t.texturesByteLength,f=t.batchTableByteLength;if(i?(e.numberOfFeaturesLoaded+=n?-a:a,e.numberOfPointsLoaded+=n?-r:r,e.geometryByteLength+=n?-c:c,e.texturesByteLength+=n?-u:u,e.batchTableByteLength+=n?-f:f):(e.numberOfFeaturesSelected+=n?-a:a,e.numberOfPointsSelected+=n?-r:r,e.numberOfTrianglesSelected+=n?-s:s),l(o)){const h=o.length;for(let _=0;_<h;++_)dD(e,o[_],n,i)}}Vu.prototype.incrementSelectionCounts=function(e){dD(this,e,!1,!1)};Vu.prototype.incrementLoadCounts=function(e){dD(this,e,!1,!0)};Vu.prototype.decrementLoadCounts=function(e){dD(this,e,!0,!0)};Vu.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 lb(){this._style=void 0,this._styleDirty=!1,this._lastStyleTime=0}Object.defineProperties(lb.prototype,{style:{get:function(){return this._style},set:function(e){e!==this._style&&(this._style=e,this._styleDirty=!0)}}});lb.prototype.makeDirty=function(){this._styleDirty=!0};lb.prototype.resetDirty=function(){this._styleDirty=!1};lb.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 AKe(e,t,n){const i=tr(t,"3DTILES_implicit_tiling")?t.extensions["3DTILES_implicit_tiling"]:t.implicitTiling;b.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)&&!tr(o,"3DTILES_bounding_volume_S2")&&!tr(o,"3DTILES_bounding_volume_cylinder"))throw new Se("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 Re({url:i.subtrees.uri}),this.contentUriTemplates=[],this.contentHeaders=[];const r=CKe(t);for(let s=0;s<r.length;s++){const a=r[s];this.contentHeaders.push(ut(a,!0));const c=new Re({url:a.uri});this.contentUriTemplates.push(c)}this.contentCount=this.contentHeaders.length,this.tileHeader=TKe(t),this.subdivisionScheme=Cr[i.subdivisionScheme],this.branchingFactor=Cr.getBranchingFactor(this.subdivisionScheme),this.subtreeLevels=i.subtreeLevels,l(i.availableLevels)?this.availableLevels=i.availableLevels:this.availableLevels=i.maximumLevel+1}function CKe(e){if(tr(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 TKe(e){const t=ut(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 ub={};function hG(e){return e=(e^e<<8)&16711935,e=(e^e<<4)&252645135,e=(e^e<<2)&858993459,e=(e^e<<1)&1431655765,e}function WO(e){return e=(e^e<<16)&50331903,e=(e^e<<8)&50393103,e=(e^e<<4)&51130563,e=(e^e<<2)&153391689,e}function pG(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 jO(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}ub.encode2D=function(e,t){if(b.typeOf.number("x",e),b.typeOf.number("y",t),e<0||e>65535||t<0||t>65535)throw new x("inputs must be 16-bit unsigned integers");return(hG(e)|hG(t)<<1)>>>0};ub.decode2D=function(e,t){if(b.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]=pG(e),t[1]=pG(e>>1),t};ub.encode3D=function(e,t,n){if(b.typeOf.number("x",e),b.typeOf.number("y",t),b.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 WO(e)|WO(t)<<1|WO(n)<<2};ub.decode3D=function(e,t){if(b.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]=jO(e),t[1]=jO(e>>1),t[2]=jO(e>>2),t};const US=ub;function eo(e){if(b.typeOf.string("options.subdivisionScheme",e.subdivisionScheme),b.typeOf.number("options.subtreeLevels",e.subtreeLevels),b.typeOf.number("options.level",e.level),b.typeOf.number("options.x",e.x),b.typeOf.number("options.y",e.y),e.subdivisionScheme===Cr.OCTREE&&b.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===Cr.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===Cr.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===Cr.OCTREE&&(this.z=e.z)}Object.defineProperties(eo.prototype,{childIndex:{get:function(){let e=0;return e|=this.x&1,e|=(this.y&1)<<1,this.subdivisionScheme===Cr.OCTREE&&(e|=(this.z&1)<<2),e}},mortonIndex:{get:function(){return this.subdivisionScheme===Cr.OCTREE?US.encode3D(this.x,this.y,this.z):US.encode2D(this.x,this.y)}},tileIndex:{get:function(){const e=this.subdivisionScheme===Cr.OCTREE?((1<<3*this.level)-1)/7:((1<<2*this.level)-1)/3,t=this.mortonIndex;return e+t}}});function gF(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")}eo.prototype.getDescendantCoordinates=function(e){b.typeOf.object("offsetCoordinates",e),gF(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===Cr.OCTREE){const o=(this.z<<e.level)+e.z;return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i,z:o})}return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:n,y:i})};eo.prototype.getAncestorCoordinates=function(e){if(b.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===Cr.OCTREE){const r=Math.floor(this.z/t);return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};eo.prototype.getOffsetCoordinates=function(e){if(b.typeOf.object("descendantCoordinates",e),!this.isEqual(e)&&!this.isAncestor(e))throw new x("this is not an ancestor of descendant");gF(this,e);const t=e.level-this.level,n=1<<t,i=e.x%n,o=e.y%n;if(this.subdivisionScheme===Cr.OCTREE){const r=e.z%n;return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o,z:r})}return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:t,x:i,y:o})};eo.prototype.getChildCoordinates=function(e){b.typeOf.number("childIndex",e);const t=Cr.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===Cr.OCTREE){const r=2*this.z+Math.floor(e/4)%2;return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o,z:r})}return new eo({subdivisionScheme:this.subdivisionScheme,subtreeLevels:this.subtreeLevels,level:n,x:i,y:o})};eo.prototype.getSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels)};eo.prototype.getParentSubtreeCoordinates=function(){return this.getAncestorCoordinates(this.level%this.subtreeLevels+this.subtreeLevels)};eo.prototype.isAncestor=function(e){b.typeOf.object("descendantCoordinates",e),gF(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===Cr.OCTREE){const s=e.z>>t,a=this.z===s;return o&&r&&a}return o&&r};eo.prototype.isEqual=function(e){return b.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===Cr.OCTREE?this.z===e.z:!0)};eo.prototype.isImplicitTilesetRoot=function(){return this.level===0};eo.prototype.isSubtreeRoot=function(){return this.level%this.subtreeLevels===0};eo.prototype.isBottomOfSubtree=function(){return this.level%this.subtreeLevels===this.subtreeLevels-1};eo.prototype.getTemplateValues=function(){const e={level:this.level,x:this.x,y:this.y};return this.subdivisionScheme===Cr.OCTREE&&(e.z=this.z),e};const mG=[0,0,0];eo.fromMortonIndex=function(e,t,n,i){let o;return e===Cr.OCTREE?(o=US.decode3D(i,mG),new eo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1],z:o[2]})):(o=US.decode2D(i,mG),new eo({subdivisionScheme:e,subtreeLevels:t,level:n,x:o[0],y:o[1]}))};eo.fromTileIndex=function(e,t,n){let i,o,r;return e===Cr.OCTREE?(i=Math.floor(N.log2(7*n+1)/3),o=((1<<3*i)-1)/7,r=n-o):(i=Math.floor(N.log2(3*n+1)/2),o=((1<<2*i)-1)/3,r=n-o),eo.fromMortonIndex(e,t,i,r)};function xr(e){e=A(e,A.EMPTY_OBJECT),b.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 V_,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 Js,this._maximumScreenSpaceError=A(e.maximumScreenSpaceError,16),this._maximumMemoryUsage=A(e.maximumMemoryUsage,512),this._styleEngine=new lb,this._styleApplied=!1,this._modelMatrix=l(e.modelMatrix)?B.clone(e.modelMatrix):B.clone(B.IDENTITY),this._statistics=new Vu,this._statisticsLast=new Vu,this._statisticsPerPass=new Array(Ys.NUMBER_OF_PASSES);for(let r=0;r<Ys.NUMBER_OF_PASSES;++r)this._statisticsPerPass[r]=new Vu;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 fD(e.debugHeatmapTilePropertyName),this.cullRequestsWhileMoving=A(e.cullRequestsWhileMoving,!0),this._cullRequestsWhileMoving=!1,this.cullRequestsWhileMovingMultiplier=A(e.cullRequestsWhileMovingMultiplier,60),this.progressiveResolutionHeightFraction=N.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,pe.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,N.lerp),this.foveatedTimeDelay=A(e.foveatedTimeDelay,.2),this.dynamicScreenSpaceErrorDensity=.00278,this.dynamicScreenSpaceErrorFactor=4,this.dynamicScreenSpaceErrorHeightFalloff=.25,this._dynamicScreenSpaceErrorComputedDensity=0,this.shadows=A(e.shadows,Co.ENABLED),this.show=A(e.show,!0),this.colorBlendMode=Tw.HIGHLIGHT,this.colorBlendAmount=.5,this._pointCloudShading=new ib(e.pointCloudShading),this._pointCloudEyeDomeLighting=new Op,this.loadProgress=new $e,this.allTilesLoaded=new $e,this.initialTilesLoaded=new $e,this.tileLoad=new $e,this.tileUnload=new $e,this.tileFailed=new $e,this.tileVisible=new $e,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 u0,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,U.BLACK),this.splitDirection=A(e.splitDirection,w_.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&&Di("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=Re.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,xr.loadJson(o)}).then(function(r){if(!i.isDestroyed())return bKe(i,r)}).then(function(r){if(i.isDestroyed())return;i._root=i.loadTileset(o,r);const s=l(r.asset.gltfUpAxis)?Jr.fromName(r.asset.gltfUpAxis):Jr.Y,a=A(e.modelUpAxis,s),c=A(e.modelForwardAxis,Jr.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 f=u.extras;if(l(f)&&l(f.cesium)&&l(f.cesium.credits)){const p=f.cesium.credits;let y=i._credits;l(y)||(y=[],i._credits=y);for(let C=0;C<p.length;++C){const T=p[C];y.push(new Kn(T.html,i._showCreditsOnScreen))}}const _=i._root.createBoundingVolume(r.root.boundingVolume,B.IDENTITY).boundingSphere.center,g=i._ellipsoid.cartesianToCartographic(_);return l(g)&&g.height>Qi._defaultMinTerrainHeight&&(i._initialClippingPlanesOriginMatrix=tn.eastNorthUpToFixedFrame(_)),i._clippingPlanesOriginMatrix=B.clone(i._initialClippingPlanesOriginMatrix),i})}Object.defineProperties(xr.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){Ao.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 Tp("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){b.typeOf.number.greaterThanOrEquals("maximumScreenSpaceError",e,0),this._maximumScreenSpaceError=e}},maximumMemoryUsage:{get:function(){return this._maximumMemoryUsage},set:function(e){b.typeOf.number.greaterThanOrEquals("value",e,0),this._maximumMemoryUsage=e}},pointCloudShading:{get:function(){return this._pointCloudShading},set:function(e){b.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){b.typeOf.number.greaterThanOrEquals("foveatedConeSize",e,0),b.typeOf.number.lessThanOrEquals("foveatedConeSize",e,1),this._foveatedConeSize=e}},foveatedMinimumScreenSpaceErrorRelaxation:{get:function(){return this._foveatedMinimumScreenSpaceErrorRelaxation},set:function(e){b.typeOf.number.greaterThanOrEquals("foveatedMinimumScreenSpaceErrorRelaxation",e,0),b.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){b.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}`),b.typeOf.string("value",e),this._featureIdLabel=e}},instanceFeatureIdLabel:{get:function(){return this._instanceFeatureIdLabel},set:function(e){typeof e=="number"&&(e=`instanceFeatureId_${e}`),b.typeOf.string("value",e),this._instanceFeatureIdLabel=e}}});xr.loadJson=function(e){return Re.createIfNeeded(e).fetchJson()};xr.prototype.makeStyleDirty=function(){this._styleEngine.makeDirty()};xr.prototype.loadTileset=function(e,t,n){const i=t.asset;if(!l(i))throw new Se("Tileset must have an asset property.");if(i.version!=="0.0"&&i.version!=="1.0"&&i.version!=="1.1")throw new Se("The tileset must be 3D Tiles version 0.0, 1.0, or 1.1");l(t.extensionsRequired)&&xr.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=_G(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===Aa.ADD;const u=c._header.children;if(l(u)){const f=u.length;for(let h=0;h<f;++h){const _=u[h],g=_G(this,e,_,c);c.children.push(g),g._depth=c._depth+1,a.push(g)}}this._cullWithChildrenBounds&&_Ke.checkChildrenWithinParent(c)}return s};function _G(e,t,n,i){if(l(n.implicitTiling)||tr(n,"3DTILES_implicit_tiling")){const r=e.schema,s=new AKe(t,n,r),a=new eo({subdivisionScheme:s.subdivisionScheme,subtreeLevels:s.subtreeLevels,level:0,x:0,y:0,z:0}),c=s.subtreeUriTemplate.getDerivedResource({templateValues:a.getTemplateValues()}).url,f=ut(n,!0);f.contents=[{uri:c}],delete f.content,delete f.extensions;const h=new Zi(e,t,f,i);return h.implicitTileset=s,h.implicitCoordinates=a,h}return new Zi(e,t,n,i)}function bKe(e,t){const n=tr(t,"3DTILES_metadata")?t.extensions["3DTILES_metadata"]:t;let i;if(l(n.schemaUri)){const o=e._resource.getDerivedResource({url:n.schemaUri});i=mt.loadSchema({resource:o})}else if(l(n.schema))i=mt.loadSchema({schema:n.schema});else return Promise.resolve(t);return e._schemaLoader=i,i.promise.then(function(o){return e._metadataExtension=new lQ({schema:o.schema,metadataJson:n}),t})}const gG=new d,EKe=new Ae,xKe=new B,wKe=new d,SKe=new d,vKe=new d;function DKe(e,t){let n,i,o,r,s;const a=t.camera,c=e._root,u=c.contentBoundingVolume;if(u instanceof qu)n=d.normalize(a.positionWC,gG),i=a.directionWC,o=a.positionCartographic.height,r=u.minimumHeight,s=u.maximumHeight;else{const T=B.inverseTransformation(c.computedTransform,xKe),E=t.mapProjection.ellipsoid,w=u.boundingVolume,S=B.multiplyByPoint(T,w.center,wKe);if(d.magnitude(S)>E.minimumRadius){const P=Ae.fromCartesian(S,E,EKe);n=d.normalize(a.positionWC,gG),i=a.directionWC,o=a.positionCartographic.height,r=0,s=P.height*2}else{const P=B.multiplyByPoint(T,a.positionWC,SKe);if(n=d.UNIT_Z,i=B.multiplyByPointAsVector(T,a.directionWC,vKe),i=d.normalize(i,i),o=P.z,u instanceof Ql){const O=c._header.boundingVolume.box[11];r=S.z-O,s=S.z+O}else if(u instanceof Hd){const O=w.radius;r=S.z-O,s=S.z+O}}}const f=e.dynamicScreenSpaceErrorHeightFalloff,h=r+(s-r)*f,_=s,g=N.clamp((o-h)/(_-h),0,1);let y=1-Math.abs(d.dot(i,n));y=y*(1-g);let C=e.dynamicScreenSpaceErrorDensity;C*=y,e._dynamicScreenSpaceErrorComputedDensity=C}function IKe(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?VKe(e,t):(n.decrementLoadCounts(t.content),--n.numberOfTilesWithContentReady)),e._requestedTilesInFlight.push(t),t.contentReadyToProcessPromise.then(BKe(e,t)).catch(function(r){}),t.contentReadyPromise.then(NKe(e,t)).catch(RKe(e,t))}function PKe(e,t){return e._priority-t._priority}xr.prototype.postPassesUpdate=function(e){this.ready&&(OKe(this,e),GKe(this,e),this._cache.unloadTiles(this,hQ),this._styleApplied&&this._styleEngine.resetDirty(),this._styleApplied=!1)};xr.prototype.prePassesUpdate=function(e){if(!this.ready)return;FKe(this,e);const t=this._clippingPlanes;this._clippingPlanesOriginMatrixDirty=!0,l(t)&&t.enabled&&t.update(e),l(this._loadTimestamp)||(this._loadTimestamp=ne.clone(e.time)),this._timeSinceLoad=Math.max(ne.secondsDifference(e.time,this._loadTimestamp)*1e3,0),this._skipLevelOfDetail=this.skipLevelOfDetail&&!l(this._classificationType)&&!this._disableSkipLevelOfDetail&&!this._allTilesAdditive,this.dynamicScreenSpaceError&&DKe(this,e),e.newFrame&&this._cache.reset()};function OKe(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!==Lo.LOADING){++i;continue}else if(a){s.cancelRequests(),++i;continue}i>0&&(n[r-i]=s)}n.length-=i}function LKe(e,t){const n=e._requestedTiles,i=n.length;n.sort(PKe);for(let o=0;o<i;++o)IKe(e,n[o])}function BKe(e,t){return function(){e._processingQueue.push(t),++e._statistics.numberOfTilesProcessing}}function RKe(e,t){return function(n){if(t._contentState!==Lo.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 NKe(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 MKe(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!==Lo.PROCESSING){++i;continue}i>0&&(t[o-i]=r)}t.length-=i}function FKe(e,t){MKe(e);const n=e._processingQueue,i=n.length;for(let o=0;o<i;++o)n[o].process(e,t)}const px=new d,zKe={maximumFractionDigits:3};function yG(e){const t=e/1048576;return t<1?t.toLocaleString(void 0,zKe):Math.round(t).toLocaleString()}function qO(e){const t=e.boundingVolume.boundingVolume,n=t.halfAxes,i=t.radius;let o=d.clone(t.center,px);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=d.normalize(t.center,px);r=d.multiplyByScalar(r,.75*i,px),o=d.add(r,t.center,px)}return o}function YO(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: ${yG(e.content.texturesByteLength)}`,i+=`
Geometry Memory: ${yG(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 UKe(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:qO(e.debugPickedTile),u=YO(e.debugPickedTile,e,c);u.pixelOffset=new j(15,-15)}}else{for(n=0;n<r;++n)i=o[n],YO(i,e,qO(i));for(n=0;n<a;++n)i=s[n],(i.hasTilesetContent||i.hasImplicitContent)&&YO(i,e,qO(i))}e._tileDebugLabels.update(t)}function HKe(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,f=u.length,h=e.tileVisible;let _,g;const p=e._skipLevelOfDetail&&e._hasMixedContent&&t.context.stencilBuffer&&c>0;e._backfaceCommands.length=0,p&&(l(e._stencilClearCommand)||(e._stencilClearCommand=new Ji({stencil:0,pass:Be.CESIUM_3D_TILE,renderState:Qe.fromCache({stencilMask:Pt.SKIP_LOD_MASK})})),r.push(e._stencilClearCommand));const y=r.length;for(_=0;_<c;++_)g=a[_],i&&h.raiseEvent(g),g.update(e,t,n),o.incrementSelectionCounts(g.content),++o.selected;for(_=0;_<f;++_)g=u[_],g.update(e,t,n);let C=r.length-y;if(e._backfaceCommands.trim(),p){const T=e._backfaceCommands.values,E=T.length;for(r.length+=E,_=C-1;_>=0;--_)r[y+E+_]=r[y+_];for(_=0;_<E;++_)r[y+_]=T[_]}C=r.length-s,o.numberOfCommands=C,i&&e.pointCloudShading.attenuation&&e.pointCloudShading.eyeDomeLighting&&C>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 Cc),UKe(e,t)):e._tileDebugLabels=e._tileDebugLabels&&e._tileDebugLabels.destroy())}const dQ=[];function VKe(e,t){const n=t,i=dQ;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&&(kKe(e,t),--e._statistics.numberOfTilesTotal)}n.children=[]}function hQ(e,t){e.tileUnload.raiseEvent(t),e._statistics.decrementLoadCounts(t.content),--e._statistics.numberOfTilesWithContentReady,t.unloadContent()}function kKe(e,t){e._cache.unloadTile(e,t,hQ),t.destroy()}xr.prototype.trimLoadedTiles=function(){this._cache.trim()};function GKe(e,t){const n=e._statistics,i=e._statisticsLast,o=n.numberOfPendingRequests,r=n.numberOfTilesProcessing,s=i.numberOfPendingRequests,a=i.numberOfTilesProcessing;Vu.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 WKe(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 jKe(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 qKe(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,WKe(e),jKe(e,t),e._cullRequestsWhileMoving=e.cullRequestsWhileMoving&&!e._modelMatrixChanged;const s=i.traversal.selectTiles(e,t);if(i.requestTiles&&LKe(e),HKe(e,t,i),Vu.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 f=a[u];f.showOnScreen=e._showCreditsOnScreen,t.creditDisplay.addCredit(f)}}}return s}xr.prototype.update=function(e){this.updateForPass(e,e.tilesetPassState)};xr.prototype.updateForPass=function(e,t){b.typeOf.object("frameState",e),b.typeOf.object("tilesetPassState",t);const n=t.pass;if(n===Ys.PRELOAD&&(!this.preloadWhenHidden||this.show)||n===Ys.PRELOAD_FLIGHT&&(!this.preloadFlightDestinations||!this.show&&!this.preloadWhenHidden)||n===Ys.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=Ys.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 f=this._statisticsPerPass[n];(this.show||a)&&(this._pass=n,t.ready=qKe(this,e,f,s)),a&&(c.length=u),e.commandList=i,e.camera=o,e.cullingVolume=r};xr.prototype.hasExtension=function(e){return l(this._extensionsUsed)?this._extensionsUsed.indexOf(e)>-1:!1};xr.prototype.isDestroyed=function(){return!1};xr.prototype.destroy=function(){if(this._tileDebugLabels=this._tileDebugLabels&&this._tileDebugLabels.destroy(),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),l(this._schemaLoader)&&mt.unload(this._schemaLoader),l(this._root)){const e=dQ;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,Ue(this)};xr.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};xr.checkSupportedExtensions=function(e){for(let t=0;t<e.length;t++)if(!xr.supportedExtensions[e[t]])throw new Se(`Unsupported 3D Tiles Extension: ${e[t]}`)};const YKe=new B;function hp(e,t){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(hp.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._tilesetHash={},this._entitiesToVisualize=new xt,this._onCollectionChanged(t,t.values,[],[])}hp.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 f=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0);let h;if(f&&(h=s.computeModelMatrix(e,YKe),c=Re.createIfNeeded(Z.getValueOrUndefined(a._uri,e))),!f){l(u)&&(u.tilesetPrimitive.show=!1);continue}let _=l(u)?u.tilesetPrimitive:void 0;(!l(_)||c.url!==u.url)&&(l(_)&&(i.removeAndDestroy(_),delete n[s.id]),_=new xr({url:c}),_.id=s,i.add(_),u={tilesetPrimitive:_,url:c.url,loadFail:!1},n[s.id]=u,$Ke(_,s,n)),_.show=!0,l(h)&&(_.modelMatrix=h),_.maximumScreenSpaceError=Z.getValueOrDefault(a.maximumScreenSpaceError,e,_.maximumScreenSpaceError)}return!0};hp.prototype.isDestroyed=function(){return!1};hp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(hp.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._tilesetHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)YB(this,e[i],t,n);return Ue(this)};hp.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 pt.FAILED;const i=n.tilesetPrimitive;return!l(i)||!i.show?pt.FAILED:i.ready?(fe.clone(i.boundingSphere,t),pt.DONE):pt.PENDING};hp.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):(YB(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],YB(this,r,a,c),s.remove(r.id)};function YB(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.tilesetPrimitive),delete n[t.id])}function $Ke(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}const AG={id:void 0};function fb(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 ia(e){this._owner=e,this._entities=new xt,this._addedEntities=new xt,this._removedEntities=new xt,this._changedEntities=new xt,this._suspendCount=0,this._collectionChanged=new $e,this._id=Es(),this._show=!0,this._firing=!1,this._refire=!1}ia.prototype.suspendEvents=function(){this._suspendCount++};ia.prototype.resumeEvents=function(){if(this._suspendCount===0)throw new x("resumeEvents can not be called before suspendEvents.");this._suspendCount--,fb(this)};Object.defineProperties(ia.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}}});ia.prototype.computeAvailability=function(){let e=lt.MAXIMUM_VALUE,t=lt.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;ne.lessThan(a,e)&&!a.equals(lt.MINIMUM_VALUE)&&(e=a),ne.greaterThan(c,t)&&!c.equals(lt.MAXIMUM_VALUE)&&(t=c)}}return lt.MAXIMUM_VALUE.equals(e)&&(e=lt.MINIMUM_VALUE),lt.MINIMUM_VALUE.equals(t)&&(t=lt.MAXIMUM_VALUE),new Zt({start:e,stop:t})};ia.prototype.add=function(e){if(!l(e))throw new x("entity is required.");e instanceof Er||(e=new Er(e));const t=e.id,n=this._entities;if(n.contains(t))throw new Se(`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(ia.prototype._onEntityDefinitionChanged,this),fb(this),e};ia.prototype.remove=function(e){return l(e)?this.removeById(e.id):!1};ia.prototype.contains=function(e){if(!l(e))throw new x("entity is required");return this._entities.get(e.id)===e};ia.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(ia.prototype._onEntityDefinitionChanged,this),fb(this),!0):!1};ia.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(ia.prototype._onEntityDefinitionChanged,this),o.set(a,s))}e.removeAll(),i.removeAll(),this._changedEntities.removeAll(),fb(this)};ia.prototype.getById=function(e){if(!l(e))throw new x("id is required.");return this._entities.get(e)};ia.prototype.getOrCreateEntity=function(e){if(!l(e))throw new x("id is required.");let t=this._entities.get(e);return l(t)||(AG.id=e,t=new Er(AG),this.add(t)),t};ia.prototype._onEntityDefinitionChanged=function(e){const t=e.id;this._addedEntities.contains(t)||this._changedEntities.set(t,e),fb(this)};function Cf(){this._removalFunctions=[]}Cf.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)}};Cf.prototype.removeAll=function(){const e=this._removalFunctions;for(let t=0,n=e.length;t<n;++t)e[t]();e.length=0};function yF(e,t){return ne.compare(e.start,t.start)}function To(e){if(this._intervals=[],this._changedEvent=new $e,l(e)){const t=e.length;for(let n=0;n<t;n++)this.addInterval(e[n])}}Object.defineProperties(To.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}}});To.prototype.equals=function(e,t){if(this===e)return!0;if(!(e instanceof To))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(!Zt.equals(n[r],i[r],t))return!1;return!0};To.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._intervals[e]};To.prototype.removeAll=function(){this._intervals.length>0&&(this._intervals.length=0,this._changedEvent.raiseEvent(this))};To.prototype.findIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t]:void 0};To.prototype.findDataForIntervalContainingDate=function(e){const t=this.indexOf(e);return t>=0?this._intervals[t].data:void 0};To.prototype.contains=function(e){return this.indexOf(e)>=0};const $O=new Zt;To.prototype.indexOf=function(e){if(!l(e))throw new x("date is required");const t=this._intervals;$O.start=e,$O.stop=e;let n=Cs(t,$O,yF);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&&Zt.contains(t[n-1],e)?n-1:~n)};To.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]}};To.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||ne.greaterThan(e.start,n[n.length-1].stop)){n.push(e),this._changedEvent.raiseEvent(this);return}let i=Cs(n,e,yF);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=ne.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)?(ne.greaterThan(e.stop,n[i-1].stop)?e=new Zt({start:n[i-1].start,stop:e.stop,isStartIncluded:n[i-1].isStartIncluded,isStopIncluded:e.isStopIncluded,data:e.data}):e=new Zt({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=ne.compare(n[i-1].stop,e.stop),(o>0||o===0&&n[i-1].isStopIncluded&&!e.isStopIncluded)&&n.splice(i,0,new Zt({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 Zt({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=ne.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 Zt({start:e.start,stop:ne.greaterThan(n[i].stop,e.stop)?n[i].stop:e.stop,isStartIncluded:e.isStartIncluded,isStopIncluded:ne.greaterThan(n[i].stop,e.stop)?n[i].isStopIncluded:e.isStopIncluded,data:e.data}),n.splice(i,1);else if(n[i]=new Zt({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)};To.prototype.removeInterval=function(e){if(!l(e))throw new x("interval is required");if(e.isEmpty)return!1;const t=this._intervals;let n=Cs(t,e,yF);n<0&&(n=~n);let i=!1;for(n>0&&(ne.greaterThan(t[n-1].stop,e.start)||t[n-1].stop.equals(e.start)&&t[n-1].isStopIncluded&&e.isStartIncluded)&&(i=!0,(ne.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 Zt({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 Zt({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 Zt({start:t[n].start,stop:t[n].start,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data})),++n);n<t.length&&ne.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 Zt({start:t[n].start,stop:t[n].stop,isStartIncluded:!0,isStopIncluded:t[n].isStopIncluded,data:t[n].data})):t[n]=new Zt({start:e.stop,stop:e.stop,isStartIncluded:!0,isStopIncluded:!0,data:t[n].data}):t.splice(n,1)),n<t.length&&(ne.greaterThan(e.stop,t[n].start)||e.stop.equals(t[n].start)&&e.isStopIncluded&&t[n].isStartIncluded)&&(i=!0,t[n]=new Zt({start:e.stop,stop:t[n].stop,isStartIncluded:!e.isStopIncluded,isStopIncluded:t[n].isStopIncluded,data:t[n].data})),i&&this._changedEvent.raiseEvent(this),i};To.prototype.intersect=function(e,t,n){if(!l(e))throw new x("other is required.");const i=new To;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(ne.lessThan(c.stop,u.start))++o;else if(ne.lessThan(u.stop,c.start))++r;else{if(l(n)||l(t)&&t(c.data,u.data)||!l(t)&&u.data===c.data){const f=Zt.intersect(c,u,new Zt,n);f.isEmpty||i.addInterval(f,t)}ne.lessThan(c.stop,u.stop)||c.stop.equals(u.stop)&&!c.isStopIncluded&&u.isStopIncluded?++o:++r}}return i};To.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 To);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,f=0;a&&(++f,u=new Zt({start:lt.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 _=n[h];const g=n[h+1];u=new Zt({start:_,stop:g,isStartIncluded:t.length===f?r:!0,isStopIncluded:h===i-2?s:!1}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u),_=g}return c&&(u=new Zt({start:n[i-1],stop:lt.MAXIMUM_VALUE,isStartIncluded:!s,isStopIncluded:!0}),u.data=l(o)?o(u,t.length):t.length,t.addInterval(u)),t};const Os=new IT,_A=[0,31,28,31,30,31,30,31,31,30,31,30,31];function $B(e,t,n){l(n)||(n=new ne),ne.toGregorianDate(e,Os);let i=Os.millisecond+t.millisecond,o=Os.second+t.second,r=Os.minute+t.minute,s=Os.hour+t.hour,a=Os.day+t.day,c=Os.month+t.month,u=Os.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),_A[2]=tS(u)?29:28;a>_A[c]||c>=13;)a>_A[c]&&(a-=_A[c],++c),c>=13&&(--c,u+=Math.floor(c/12),c=c%12,++c),_A[2]=tS(u)?29:28;return Os.millisecond=i,Os.second=o,Os.minute=r,Os.hour=s,Os.day=a,Os.month=c,Os.year=u,ne.fromGregorianDate(Os,n)}const XKe=new ne,KKe=/P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;function pQ(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(KKe);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"),ne.toGregorianDate(ne.fromIso8601(e,XKe),t);return t.year||t.month||t.day||t.hour||t.minute||t.second||t.millisecond}const TC=new IT;To.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=ne.fromIso8601(n[0]),o=ne.fromIso8601(n[1]),r=[];if(!pQ(n[2],TC))r.push(i,o);else{let s=ne.clone(i);for(r.push(s);ne.compare(s,o)<0;)s=$B(s,TC),ne.compare(o,s)<=0&&ne.clone(o,s),r.push(s)}return To.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};To.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 To.fromJulianDateArray({julianDates:e.iso8601Dates.map(function(n){return ne.fromIso8601(n)}),isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};To.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)(pQ(i[u],TC)||u===0)&&(o&&l(a)?s=$B(a,TC):s=$B(n,TC),r.push(s),a=s);return To.fromJulianDateArray({julianDates:r,isStartIncluded:e.isStartIncluded,isStopIncluded:e.isStopIncluded,leadingInterval:e.leadingInterval,trailingInterval:e.trailingInterval,dataCallback:e.dataCallback},t)};function JKe(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 s_(){this._eventHelper=new Cf,this._definitionChanged=new $e,this._intervals=new To,this._intervals.changedEvent.addEventListener(s_.prototype._intervalsChanged,this)}Object.defineProperties(s_.prototype,{isConstant:{get:function(){return this._intervals.isEmpty}},definitionChanged:{get:function(){return this._definitionChanged}},intervals:{get:function(){return this._intervals}}});s_.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)};s_.prototype.equals=function(e){return this===e||e instanceof s_&&this._intervals.equals(e._intervals,Z.equals)};s_.prototype._intervalsChanged=function(){JKe(this,this._eventHelper,this._definitionChanged,this._intervals),this._definitionChanged.raiseEvent(this)};function pp(e){this._referenceFrame=A(e,ea.FIXED),this._definitionChanged=new $e,this._composite=new s_,this._composite.definitionChanged.addEventListener(pp.prototype._raiseDefinitionChanged,this)}Object.defineProperties(pp.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}}});pp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ea.FIXED,t)};pp.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)};pp.prototype.equals=function(e){return this===e||e instanceof pp&&this._referenceFrame===e._referenceFrame&&this._composite.equals(e._composite,Z.equals)};pp.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const QKe={ROUNDED:0,MITERED:1,BEVELED:2},Jo=Object.freeze(QKe),qr=[new d,new d],ZKe=new d,eJe=new d,tJe=new d,nJe=new d,iJe=new d,oJe=new d,rJe=new d,sJe=new d,aJe=new d,Hg=new d,mx=new d,dT={};let XO=new Ae;function cJe(e,t){const n=new Array(e.length);for(let i=0;i<e.length;i++){const o=e[i];XO=t.cartesianToCartographic(o,XO),n[i]=XO.height,e[i]=t.scaleToGeodeticSurface(o,o)}return n}function KO(e,t,n,i){const o=e[0],r=e[1],s=d.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 _=t+u*h;c[u]=_}return c[0]=t,c.push(n),c}const HS=new d,VS=new d;function lJe(e,t,n,i){const o=new ss(n,i),r=o.projectPointOntoPlane(d.add(n,e,HS),HS),s=o.projectPointOntoPlane(d.add(n,t,VS),VS),a=j.angleBetween(r,s);return s.x*r.y-s.y*r.x>=0?-a:a}const uJe=new d(-1,0,0);let cm=new B;const fJe=new B;let JO=new J;const dJe=J.IDENTITY.clone(),hJe=new d,pJe=new oe,CG=new d;function Vf(e,t,n,i,o,r,s,a){let c=hJe,u=pJe;cm=tn.eastNorthUpToFixedFrame(e,o,cm),c=B.multiplyByPointAsVector(cm,uJe,c),c=d.normalize(c,c);const f=lJe(c,t,e,o);JO=J.fromRotationZ(f,JO),CG.z=r,cm=B.multiplyTransformation(cm,B.fromRotationTranslation(JO,CG,fJe),cm);const h=dJe;h[0]=s;for(let _=0;_<a;_++)for(let g=0;g<n.length;g+=3)u=d.fromArray(n,g,u),u=J.multiplyByVector(h,u,u),u=B.multiplyByPoint(cm,u,u),i.push(u.x,u.y,u.z);return i}const mJe=new d;function QO(e,t,n,i,o,r,s){for(let a=0;a<e.length;a+=3){const c=d.fromArray(e,a,mJe);i=Vf(c,t,n,i,o,r[a/3],s,1)}return i}function _Je(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,f=a.y-s;i[o++]=u,i[o++]=0,i[o++]=f,i[o++]=u,i[o++]=0,i[o++]=f}return a=e[0],i[o++]=a.x-r,i[o++]=0,i[o++]=a.y-s,i}function 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 bG=new Ce,EG=new d,xG=new J;function wG(e,t,n,i,o,r,s,a,c,u){const f=d.angleBetween(d.subtract(t,e,Hg),d.subtract(n,e,mx)),h=i===Jo.BEVELED?0:Math.ceil(f/N.toRadians(5));let _;o?_=J.fromQuaternion(Ce.fromAxisAngle(d.negate(e,Hg),f/(h+1),bG),xG):_=J.fromQuaternion(Ce.fromAxisAngle(e,f/(h+1),bG),xG);let g,p;if(t=d.clone(t,EG),h>0){const y=u?2:1;for(let C=0;C<h;C++)t=J.multiplyByVector(_,t,t),g=d.subtract(t,e,Hg),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(t,mx),s=Vf(p,g,a,s,r,c,1,y)}else g=d.subtract(t,e,Hg),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(t,mx),s=Vf(p,g,a,s,r,c,1,1),n=d.clone(n,EG),g=d.subtract(n,e,Hg),g=d.normalize(g,g),o||(g=d.negate(g,g)),p=r.scaleToGeodeticSurface(n,mx),s=Vf(p,g,a,s,r,c,1,1);return s}dT.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};dT.angleIsGreaterThanPi=function(e,t,n,i){const o=new ss(n,i),r=o.projectPointOntoPlane(d.add(n,e,HS),HS),s=o.projectPointOntoPlane(d.add(n,t,VS),VS);return s.x*r.y-s.y*r.x>=0};const gJe=new d,yJe=new d;dT.computePositions=function(e,t,n,i,o){const r=i._ellipsoid,s=cJe(e,r),a=i._granularity,c=i._cornerType,u=o?_Je(t,n):TG(t,n),f=o?TG(t,n):void 0,h=n.height/2,_=n.width/2;let g=e.length,p=[],y=o?[]:void 0,C=ZKe,T=eJe,E=tJe,w=nJe,S=iJe,P=oJe,O=rJe,z=sJe,R=aJe,F=e[0],H=e[1];w=r.geodeticSurfaceNormal(F,w),C=d.subtract(H,F,C),C=d.normalize(C,C),z=d.cross(w,C,z),z=d.normalize(z,z);let v=s[0],I=s[1];o&&(y=Vf(F,z,f,y,r,v+h,1,1)),R=d.clone(F,R),F=H,T=d.negate(C,T);let m,D;for(let V=1;V<g-1;V++){const k=o?2:1;if(H=e[V+1],F.equals(H)){Di("Positions are too close and are considered equivalent with rounding error.");continue}C=d.subtract(H,F,C),C=d.normalize(C,C),E=d.add(C,T,E),E=d.normalize(E,E),w=r.geodeticSurfaceNormal(F,w);const W=d.multiplyByScalar(w,d.dot(C,w),gJe);d.subtract(C,W,W),d.normalize(W,W);const G=d.multiplyByScalar(w,d.dot(T,w),yJe);if(d.subtract(T,G,G),d.normalize(G,G),!N.equalsEpsilon(Math.abs(d.dot(W,G)),1,N.EPSILON7)){E=d.cross(E,w,E),E=d.cross(w,E,E),E=d.normalize(E,E);const q=1/Math.max(.25,d.magnitude(d.cross(E,T,Hg))),te=dT.angleIsGreaterThanPi(C,T,F,r);te?(S=d.add(F,d.multiplyByScalar(E,q*_,E),S),P=d.add(S,d.multiplyByScalar(z,_,P),P),qr[0]=d.clone(R,qr[0]),qr[1]=d.clone(P,qr[1]),m=KO(qr,v+h,I+h,a),D=sr.generateArc({positions:qr,granularity:a,ellipsoid:r}),p=QO(D,z,u,p,r,m,1),z=d.cross(w,C,z),z=d.normalize(z,z),O=d.add(S,d.multiplyByScalar(z,_,O),O),c===Jo.ROUNDED||c===Jo.BEVELED?wG(S,P,O,c,te,r,p,u,I+h,o):(E=d.negate(E,E),p=Vf(F,E,u,p,r,I+h,q,k)),R=d.clone(O,R)):(S=d.add(F,d.multiplyByScalar(E,q*_,E),S),P=d.add(S,d.multiplyByScalar(z,-_,P),P),qr[0]=d.clone(R,qr[0]),qr[1]=d.clone(P,qr[1]),m=KO(qr,v+h,I+h,a),D=sr.generateArc({positions:qr,granularity:a,ellipsoid:r}),p=QO(D,z,u,p,r,m,1),z=d.cross(w,C,z),z=d.normalize(z,z),O=d.add(S,d.multiplyByScalar(z,-_,O),O),c===Jo.ROUNDED||c===Jo.BEVELED?wG(S,P,O,c,te,r,p,u,I+h,o):p=Vf(F,E,u,p,r,I+h,q,k),R=d.clone(O,R)),T=d.negate(C,T)}else p=Vf(R,z,u,p,r,v+h,1,1),R=F;v=I,I=s[V+1],F=H}qr[0]=d.clone(R,qr[0]),qr[1]=d.clone(F,qr[1]),m=KO(qr,v+h,I+h,a),D=sr.generateArc({positions:qr,granularity:a,ellipsoid:r}),p=QO(D,z,u,p,r,m,1),o&&(y=Vf(F,z,f,y,r,I+h,1,1)),g=p.length;const L=o?g+y.length:g,M=new Float64Array(L);return M.set(p),o&&M.set(y,g),M};const hT=dT,AF={},hy=new d,mQ=new d,AJe=new d,SG=new d,la=[new d,new d],_Q=new d,gQ=new d,yQ=new d,CJe=new d,TJe=new d,bJe=new d,EJe=new d,xJe=new d,wJe=new d,SJe=new d,vG=new Ce,DG=new J;function kS(e,t,n,i,o){const r=d.angleBetween(d.subtract(t,e,hy),d.subtract(n,e,mQ)),s=i===Jo.BEVELED?1:Math.ceil(r/N.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(Ce.fromAxisAngle(d.negate(e,hy),r/s,vG),DG):u=J.fromQuaternion(Ce.fromAxisAngle(e,r/s,vG),DG);let f=0;t=d.clone(t,hy);for(let h=0;h<s;h++)t=J.multiplyByVector(u,t,t),c[f++]=t.x,c[f++]=t.y,c[f++]=t.z;return c}function vJe(e){let t=_Q,n=gQ,i=yQ,o=e[1];n=d.fromArray(e[1],o.length-3,n),i=d.fromArray(e[0],0,i),t=d.midpoint(n,i,t);const r=kS(t,n,i,Jo.ROUNDED,!1),s=e.length-1,a=e[s-1];o=e[s],n=d.fromArray(a,a.length-3,n),i=d.fromArray(o,0,i),t=d.midpoint(n,i,t);const c=kS(t,n,i,Jo.ROUNDED,!1);return[r,c]}function IG(e,t,n,i){let o=hy;return i||(t=d.negate(t,t)),o=d.add(e,t,o),[o.x,o.y,o.z,n.x,n.y,n.z]}function ZO(e,t,n,i){const o=new Array(e.length),r=new Array(e.length),s=d.multiplyByScalar(t,n,hy),a=d.negate(s,mQ);let c=0,u=e.length-1;for(let f=0;f<e.length;f+=3){const h=d.fromArray(e,f,AJe),_=d.add(h,a,SG);o[c++]=_.x,o[c++]=_.y,o[c++]=_.z;const g=d.add(h,s,SG);r[u--]=g.z,r[u--]=g.y,r[u--]=g.x}return i.push(o,r),i}AF.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 DJe=new d,IJe=new d;AF.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=_Q,c=gQ,u=yQ,f=CJe,h=TJe,_=bJe,g=EJe,p=xJe,y=wJe,C=SJe,T=[];const E=s?[]:void 0,w=s?[]:void 0;let S=n[0],P=n[1];c=d.normalize(d.subtract(P,S,c),c),a=i.geodeticSurfaceNormal(S,a),f=d.normalize(d.cross(a,c,f),f),s&&(E.push(f.x,f.y,f.z),w.push(a.x,a.y,a.z)),g=d.clone(S,g),S=P,u=d.negate(c,u);let O;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=d.normalize(d.subtract(P,S,c),c),h=d.normalize(d.add(c,u,h),h);const v=d.multiplyByScalar(a,d.dot(c,a),DJe);d.subtract(c,v,v),d.normalize(v,v);const I=d.multiplyByScalar(a,d.dot(u,a),IJe);if(d.subtract(u,I,I),d.normalize(I,I),!N.equalsEpsilon(Math.abs(d.dot(v,I)),1,N.EPSILON7)){h=d.cross(h,a,h),h=d.cross(a,h,h),h=d.normalize(h,h);const D=o/Math.max(.25,d.magnitude(d.cross(h,u,hy))),L=hT.angleIsGreaterThanPi(c,u,S,i);h=d.multiplyByScalar(h,D,h),L?(p=d.add(S,h,p),C=d.add(p,d.multiplyByScalar(f,o,C),C),y=d.add(p,d.multiplyByScalar(f,o*2,y),y),la[0]=d.clone(g,la[0]),la[1]=d.clone(C,la[1]),O=sr.generateArc({positions:la,granularity:t,ellipsoid:i}),T=ZO(O,f,o,T),s&&(E.push(f.x,f.y,f.z),w.push(a.x,a.y,a.z)),_=d.clone(y,_),f=d.normalize(d.cross(a,c,f),f),y=d.add(p,d.multiplyByScalar(f,o*2,y),y),g=d.add(p,d.multiplyByScalar(f,o,g),g),r===Jo.ROUNDED||r===Jo.BEVELED?z.push({leftPositions:kS(p,_,y,r,L)}):z.push({leftPositions:IG(S,d.negate(h,h),y,L)})):(y=d.add(S,h,y),C=d.add(y,d.negate(d.multiplyByScalar(f,o,C),C),C),p=d.add(y,d.negate(d.multiplyByScalar(f,o*2,p),p),p),la[0]=d.clone(g,la[0]),la[1]=d.clone(C,la[1]),O=sr.generateArc({positions:la,granularity:t,ellipsoid:i}),T=ZO(O,f,o,T),s&&(E.push(f.x,f.y,f.z),w.push(a.x,a.y,a.z)),_=d.clone(p,_),f=d.normalize(d.cross(a,c,f),f),p=d.add(y,d.negate(d.multiplyByScalar(f,o*2,p),p),p),g=d.add(y,d.negate(d.multiplyByScalar(f,o,g),g),g),r===Jo.ROUNDED||r===Jo.BEVELED?z.push({rightPositions:kS(y,_,p,r,L)}):z.push({rightPositions:IG(S,h,p,L)})),u=d.negate(c,u)}S=P}a=i.geodeticSurfaceNormal(S,a),la[0]=d.clone(g,la[0]),la[1]=d.clone(S,la[1]),O=sr.generateArc({positions:la,granularity:t,ellipsoid:i}),T=ZO(O,f,o,T),s&&(E.push(f.x,f.y,f.z),w.push(a.x,a.y,a.z));let H;return r===Jo.ROUNDED&&(H=vJe(T)),{positions:T,corners:z,lefts:E,normals:w,endPositions:H}};const wi=AF,AQ=new d,CQ=new d,Ow=new d,Lw=new d,PJe=new d,TQ=new d,Sh=new d,gg=new d;function bQ(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function Tl(e,t,n,i,o,r){const s=e.normals,a=e.tangents,c=e.bitangents,u=d.normalize(d.cross(n,t,Sh),Sh);r.normal&&wi.addAttribute(s,t,i,o),r.tangent&&wi.addAttribute(a,u,i,o),r.bitangent&&wi.addAttribute(c,n,i,o)}function EQ(e,t,n){const i=e.positions,o=e.corners,r=e.endPositions,s=e.lefts,a=e.normals,c=new Ui;let u,f=0,h=0,_,g=0,p;for(_=0;_<i.length;_+=2)p=i[_].length-3,f+=p,g+=p*2,h+=i[_+1].length-3;for(f+=3,h+=3,_=0;_<o.length;_++){u=o[_];const Y=o[_].leftPositions;l(Y)?(p=Y.length,f+=p,g+=p):(p=o[_].rightPositions.length,h+=p,g+=p)}const y=l(r);let C;y&&(C=r[0].length-3,f+=C,h+=C,C/=3,g+=C*6);const T=f+h,E=new Float64Array(T),w=t.normal?new Float32Array(T):void 0,S=t.tangent?new Float32Array(T):void 0,P=t.bitangent?new Float32Array(T):void 0,O={normals:w,tangents:S,bitangents:P};let z=0,R=T-1,F,H,v,I,m=AQ,D=CQ,L,M;const V=C/2,k=it.createTypedArray(T/3,g);let W=0;if(y){M=Ow,L=Lw;const Y=r[0];for(m=d.fromArray(a,0,m),D=d.fromArray(s,0,D),_=0;_<V;_++)M=d.fromArray(Y,(V-1-_)*3,M),L=d.fromArray(Y,(V+_)*3,L),wi.addAttribute(E,L,z),wi.addAttribute(E,M,void 0,R),Tl(O,m,D,z,R,t),H=z/3,I=H+1,F=(R-2)/3,v=F-1,k[W++]=F,k[W++]=H,k[W++]=v,k[W++]=v,k[W++]=H,k[W++]=I,z+=3,R-=3}let G=0,K=0,q=i[G++],te=i[G++];E.set(q,z),E.set(te,R-te.length+1),D=d.fromArray(s,K,D);let $,X;for(p=te.length-3,_=0;_<p;_+=3)$=n.geodeticSurfaceNormal(d.fromArray(q,_,Sh),Sh),X=n.geodeticSurfaceNormal(d.fromArray(te,p-_,gg),gg),m=d.normalize(d.add($,X,m),m),Tl(O,m,D,z,R,t),H=z/3,I=H+1,F=(R-2)/3,v=F-1,k[W++]=F,k[W++]=H,k[W++]=v,k[W++]=v,k[W++]=H,k[W++]=I,z+=3,R-=3;for($=n.geodeticSurfaceNormal(d.fromArray(q,p,Sh),Sh),X=n.geodeticSurfaceNormal(d.fromArray(te,p,gg),gg),m=d.normalize(d.add($,X,m),m),K+=3,_=0;_<o.length;_++){let Y;u=o[_];const ae=u.leftPositions,ue=u.rightPositions;let re,he,ce=TQ,Q=Ow,ie=Lw;if(m=d.fromArray(a,K,m),l(ae)){for(Tl(O,m,D,void 0,R,t),R-=3,re=I,he=v,Y=0;Y<ae.length/3;Y++)ce=d.fromArray(ae,Y*3,ce),k[W++]=re,k[W++]=he-Y-1,k[W++]=he-Y,wi.addAttribute(E,ce,void 0,R),Q=d.fromArray(E,(he-Y-1)*3,Q),ie=d.fromArray(E,re*3,ie),D=d.normalize(d.subtract(Q,ie,D),D),Tl(O,m,D,void 0,R,t),R-=3;ce=d.fromArray(E,re*3,ce),Q=d.subtract(d.fromArray(E,he*3,Q),ce,Q),ie=d.subtract(d.fromArray(E,(he-Y)*3,ie),ce,ie),D=d.normalize(d.add(Q,ie,D),D),Tl(O,m,D,z,void 0,t),z+=3}else{for(Tl(O,m,D,z,void 0,t),z+=3,re=v,he=I,Y=0;Y<ue.length/3;Y++)ce=d.fromArray(ue,Y*3,ce),k[W++]=re,k[W++]=he+Y,k[W++]=he+Y+1,wi.addAttribute(E,ce,z),Q=d.fromArray(E,re*3,Q),ie=d.fromArray(E,(he+Y)*3,ie),D=d.normalize(d.subtract(Q,ie,D),D),Tl(O,m,D,z,void 0,t),z+=3;ce=d.fromArray(E,re*3,ce),Q=d.subtract(d.fromArray(E,(he+Y)*3,Q),ce,Q),ie=d.subtract(d.fromArray(E,he*3,ie),ce,ie),D=d.normalize(d.negate(d.add(ie,Q,D),D),D),Tl(O,m,D,void 0,R,t),R-=3}for(q=i[G++],te=i[G++],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,D=d.fromArray(s,K,D),Y=0;Y<te.length;Y+=3)$=n.geodeticSurfaceNormal(d.fromArray(q,Y,Sh),Sh),X=n.geodeticSurfaceNormal(d.fromArray(te,p-Y,gg),gg),m=d.normalize(d.add($,X,m),m),Tl(O,m,D,z,R,t),I=z/3,H=I-1,v=(R-2)/3,F=v+1,k[W++]=F,k[W++]=H,k[W++]=v,k[W++]=v,k[W++]=H,k[W++]=I,z+=3,R-=3;z-=3,R+=3}if(m=d.fromArray(a,a.length-3,m),Tl(O,m,D,z,R,t),y){z+=3,R-=3,M=Ow,L=Lw;const Y=r[1];for(_=0;_<V;_++)M=d.fromArray(Y,(C-_-1)*3,M),L=d.fromArray(Y,_*3,L),wi.addAttribute(E,M,void 0,R),wi.addAttribute(E,L,z),Tl(O,m,D,z,R,t),I=z/3,H=I-1,v=(R-2)/3,F=v+1,k[W++]=F,k[W++]=H,k[W++]=v,k[W++]=v,k[W++]=H,k[W++]=I,z+=3,R-=3}if(c.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:E}),t.st){const Y=new Float32Array(T/3*2);let ae,ue,re=0;if(y){f/=3,h/=3;const he=Math.PI/(C+1);ue=1/(f-C+1),ae=1/(h-C+1);let ce;const Q=C/2;for(_=Q+1;_<C+1;_++)ce=N.PI_OVER_TWO+he*_,Y[re++]=ae*(1+Math.cos(ce)),Y[re++]=.5*(1+Math.sin(ce));for(_=1;_<h-C+1;_++)Y[re++]=_*ae,Y[re++]=0;for(_=C;_>Q;_--)ce=N.PI_OVER_TWO-_*he,Y[re++]=1-ae*(1+Math.cos(ce)),Y[re++]=.5*(1+Math.sin(ce));for(_=Q;_>0;_--)ce=N.PI_OVER_TWO-he*_,Y[re++]=1-ue*(1+Math.cos(ce)),Y[re++]=.5*(1+Math.sin(ce));for(_=f-C;_>0;_--)Y[re++]=_*ue,Y[re++]=1;for(_=1;_<Q+1;_++)ce=N.PI_OVER_TWO+he*_,Y[re++]=ue*(1+Math.cos(ce)),Y[re++]=.5*(1+Math.sin(ce))}else{for(f/=3,h/=3,ue=1/(f-1),ae=1/(h-1),_=0;_<h;_++)Y[re++]=_*ae,Y[re++]=0;for(_=f;_>0;_--)Y[re++]=(_-1)*ue,Y[re++]=1}c.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:Y})}return t.normal&&(c.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:O.normals})),t.tangent&&(c.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:O.tangents})),t.bitangent&&(c.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:O.bitangents})),{attributes:c,indices:k}}function OJe(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 f=t.normal?new Float32Array(s*6):void 0,h=t.tangent?new Float32Array(s*6):void 0,_=t.bitangent?new Float32Array(s*6):void 0;let g=AQ,p=CQ,y=Ow,C=Lw,T=PJe,E=TQ,w=c;for(u=0;u<s;u+=3){const S=w+c;g=d.fromArray(n,u,g),p=d.fromArray(n,u+s,p),y=d.fromArray(n,(u+3)%s,y),p=d.subtract(p,g,p),y=d.subtract(y,g,y),C=d.normalize(d.cross(p,y,C),C),t.normal&&(wi.addAttribute(f,C,S),wi.addAttribute(f,C,S+3),wi.addAttribute(f,C,w),wi.addAttribute(f,C,w+3)),(t.tangent||t.bitangent)&&(E=d.fromArray(i,u,E),t.bitangent&&(wi.addAttribute(_,E,S),wi.addAttribute(_,E,S+3),wi.addAttribute(_,E,w),wi.addAttribute(_,E,w+3)),t.tangent&&(T=d.normalize(d.cross(E,C,T),T),wi.addAttribute(h,T,S),wi.addAttribute(h,T,S+3),wi.addAttribute(h,T,w),wi.addAttribute(h,T,w+3))),w+=6}if(t.normal){for(f.set(i),u=0;u<s;u+=3)f[u+s]=-i[u],f[u+s+1]=-i[u+1],f[u+s+2]=-i[u+2];e.normal.values=f}else e.normal=void 0;if(t.bitangent?(_.set(o),_.set(o,s),e.bitangent.values=_):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 f=e.st.values,h=new Float32Array(a*6);h.set(f),h.set(f,a);let _=a*2;for(let g=0;g<2;g++){for(h[_++]=f[0],h[_++]=f[1],u=2;u<a;u+=2){const p=f[u],y=f[u+1];h[_++]=p,h[_++]=y,h[_++]=p,h[_++]=y}h[_++]=f[0],h[_++]=f[1]}e.st.values=h}return e}function e1(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 LJe(e,t){const n=new Ne({position:t.position,normal:t.normal||t.bitangent||e.shadowVolume,tangent:t.tangent,bitangent:t.normal||t.bitangent,st:t.st}),i=e.ellipsoid,o=wi.computePositions(e),r=EQ(o,n,i),s=e.height,a=e.extrudedHeight;let c=r.attributes;const u=r.indices;let f=c.position.values,h=f.length;const _=new Float64Array(h*6);let g=new Float64Array(h);g.set(f);let p=new Float64Array(h*4);f=Wi.scaleToGeodeticHeight(f,s,i),p=e1(f,0,p),g=Wi.scaleToGeodeticHeight(g,a,i),p=e1(g,h*2,p),_.set(f),_.set(g,h),_.set(p,h*2),c.position.values=_,c=OJe(c,t);let y;const C=h/3;if(e.shadowVolume){const F=c.normal.values;h=F.length;let H=new Float32Array(h*6);for(y=0;y<h;y++)F[y]=-F[y];H.set(F,h),H=e1(F,h*4,H),c.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:H}),t.normal||(c.normal=void 0)}if(l(e.offsetAttribute)){let F=new Uint8Array(C*6);if(e.offsetAttribute===fn.TOP)F=F.fill(1,0,C).fill(1,C*2,C*4);else{const H=e.offsetAttribute===fn.NONE?0:1;F=F.fill(H)}c.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:F})}const T=u.length,E=C+C,w=it.createTypedArray(_.length/3,T*2+E*3);w.set(u);let S=T;for(y=0;y<T;y+=3){const F=u[y],H=u[y+1],v=u[y+2];w[S++]=v+C,w[S++]=H+C,w[S++]=F+C}let P,O,z,R;for(y=0;y<E;y+=2)P=y+E,O=P+E,z=P+1,R=O+1,w[S++]=P,w[S++]=O,w[S++]=z,w[S++]=z,w[S++]=O,w[S++]=R;return{attributes:c,indices:w}}const PG=new d,gA=new d,Uc=new Ae;function OG(e,t,n,i,o,r){const s=d.subtract(t,e,PG);d.normalize(s,s);const a=n.geodeticSurfaceNormal(e,gA),c=d.cross(s,a,PG);d.multiplyByScalar(c,i,c);let u=o.latitude,f=o.longitude,h=r.latitude,_=r.longitude;d.add(e,c,gA),n.cartesianToCartographic(gA,Uc);let g=Uc.latitude,p=Uc.longitude;u=Math.min(u,g),f=Math.min(f,p),h=Math.max(h,g),_=Math.max(_,p),d.subtract(e,c,gA),n.cartesianToCartographic(gA,Uc),g=Uc.latitude,p=Uc.longitude,u=Math.min(u,g),f=Math.min(f,p),h=Math.max(h,g),_=Math.max(_,p),o.latitude=u,o.longitude=f,r.latitude=h,r.longitude=_}const Pc=new d,yA=new d,Da=new Ae,Ia=new Ae;function xQ(e,t,n,i,o){e=bQ(e,t);const r=Zs(e,d.equalsEpsilon),s=r.length;if(s<2||n<=0)return new _e;const a=n*.5;Da.latitude=Number.POSITIVE_INFINITY,Da.longitude=Number.POSITIVE_INFINITY,Ia.latitude=Number.NEGATIVE_INFINITY,Ia.longitude=Number.NEGATIVE_INFINITY;let c,u;if(i===Jo.ROUNDED){const _=r[0];d.subtract(_,r[1],Pc),d.normalize(Pc,Pc),d.multiplyByScalar(Pc,a,Pc),d.add(_,Pc,yA),t.cartesianToCartographic(yA,Uc),c=Uc.latitude,u=Uc.longitude,Da.latitude=Math.min(Da.latitude,c),Da.longitude=Math.min(Da.longitude,u),Ia.latitude=Math.max(Ia.latitude,c),Ia.longitude=Math.max(Ia.longitude,u)}for(let _=0;_<s-1;++_)OG(r[_],r[_+1],t,a,Da,Ia);const f=r[s-1];d.subtract(f,r[s-2],Pc),d.normalize(Pc,Pc),d.multiplyByScalar(Pc,a,Pc),d.add(f,Pc,yA),OG(f,yA,t,a,Da,Ia),i===Jo.ROUNDED&&(t.cartesianToCartographic(yA,Uc),c=Uc.latitude,u=Uc.longitude,Da.latitude=Math.min(Da.latitude,c),Da.longitude=Math.min(Da.longitude,u),Ia.latitude=Math.max(Ia.latitude,c),Ia.longitude=Math.max(Ia.longitude,u));const h=l(o)?o:new _e;return h.north=Ia.latitude,h.south=Da.latitude,h.east=Ia.longitude,h.west=Da.longitude,h}function Zl(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;b.defined("options.positions",t),b.defined("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=pe.clone(A(e.ellipsoid,pe.WGS84)),this._vertexFormat=Ne.clone(A(e.vertexFormat,Ne.DEFAULT)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,Jo.ROUNDED),this._granularity=A(e.granularity,N.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*d.packedLength+pe.packedLength+Ne.packedLength+7}Zl.pack=function(e,t,n){b.defined("value",e),b.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+=d.packedLength)d.pack(i[r],t,n);return pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.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 wQ=pe.clone(pe.UNIT_SPHERE),SQ=new Ne,Of={positions:void 0,ellipsoid:wQ,vertexFormat:SQ,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,shadowVolume:void 0,offsetAttribute:void 0};Zl.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let p=0;p<i;++p,t+=d.packedLength)o[p]=d.unpack(e,t);const r=pe.unpack(e,t,wQ);t+=pe.packedLength;const s=Ne.unpack(e,t,SQ);t+=Ne.packedLength;const a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t++]===1,g=e[t];return l(n)?(n._positions=o,n._ellipsoid=pe.clone(r,n._ellipsoid),n._vertexFormat=Ne.clone(s,n._vertexFormat),n._width=a,n._height=c,n._extrudedHeight=u,n._cornerType=f,n._granularity=h,n._shadowVolume=_,n._offsetAttribute=g===-1?void 0:g,n):(Of.positions=o,Of.width=a,Of.height=c,Of.extrudedHeight=u,Of.cornerType=f,Of.granularity=h,Of.shadowVolume=_,Of.offsetAttribute=g===-1?void 0:g,new Zl(Of))};Zl.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.positions,i=e.width;b.defined("options.positions",n),b.defined("options.width",i);const o=A(e.ellipsoid,pe.WGS84),r=A(e.cornerType,Jo.ROUNDED);return xQ(n,o,i,r,t)};Zl.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=bQ(t,i);const o=Zs(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!N.equalsEpsilon(r,s,0,N.EPSILON2),c=e._vertexFormat,u={ellipsoid:i,positions:o,width:n,cornerType:e._cornerType,granularity:e._granularity,saveAttributes:!0};let f;if(a)u.height=r,u.extrudedHeight=s,u.shadowVolume=e._shadowVolume,u.offsetAttribute=e._offsetAttribute,f=LJe(u,c);else{const g=wi.computePositions(u);if(f=EQ(g,c,i),f.attributes.position.values=Wi.scaleToGeodeticHeight(f.attributes.position.values,r,i),l(e._offsetAttribute)){const p=e._offsetAttribute===fn.NONE?0:1,y=f.attributes.position.values.length,C=new Uint8Array(y/3).fill(p);f.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:C})}}const h=f.attributes,_=fe.fromVertices(h.position.values,void 0,3);return c.position||(f.attributes.position.values=void 0),new Dt({attributes:h,indices:f.indices,primitiveType:Je.TRIANGLES,boundingSphere:_,offsetAttribute:e._offsetAttribute})};Zl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new Zl({positions:e._positions,width:e._width,cornerType:e._cornerType,ellipsoid:o,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ne.POSITION_ONLY,shadowVolume:!0})};Object.defineProperties(Zl.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=xQ(this._positions,this._ellipsoid,this._width,this._cornerType)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return[0,0,0,1,1,0]}}});const LG=new d,BG=new d,BJe=new d;function RJe(e,t){for(let n=0;n<e.length;n++)e[n]=t.scaleToGeodeticSurface(e[n],e[n]);return e}function vQ(e,t){const n=[],i=e.positions,o=e.corners,r=e.endPositions,s=new Ui;let a,c=0,u=0,f,h=0,_;for(f=0;f<i.length;f+=2)_=i[f].length-3,c+=_,h+=_/3*4,u+=i[f+1].length-3;for(c+=3,u+=3,f=0;f<o.length;f++){a=o[f];const L=o[f].leftPositions;l(L)?(_=L.length,c+=_,h+=_/3*2):(_=o[f].rightPositions.length,u+=_,h+=_/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,C=new Float64Array(y);let T=0,E=y-1,w,S,P,O,z,R;const F=p/2,H=it.createTypedArray(y/3,h+4);let v=0;if(H[v++]=T/3,H[v++]=(E-2)/3,g){n.push(T/3),R=LG,z=BG;const L=r[0];for(f=0;f<F;f++)R=d.fromArray(L,(F-1-f)*3,R),z=d.fromArray(L,(F+f)*3,z),wi.addAttribute(C,z,T),wi.addAttribute(C,R,void 0,E),S=T/3,O=S+1,w=(E-2)/3,P=w-1,H[v++]=w,H[v++]=P,H[v++]=S,H[v++]=O,T+=3,E-=3}let I=0,m=i[I++],D=i[I++];for(C.set(m,T),C.set(D,E-D.length+1),_=D.length-3,n.push(T/3,(E-2)/3),f=0;f<_;f+=3)S=T/3,O=S+1,w=(E-2)/3,P=w-1,H[v++]=w,H[v++]=P,H[v++]=S,H[v++]=O,T+=3,E-=3;for(f=0;f<o.length;f++){let L;a=o[f];const M=a.leftPositions,V=a.rightPositions;let k,W=BJe;if(l(M)){for(E-=3,k=P,n.push(O),L=0;L<M.length/3;L++)W=d.fromArray(M,L*3,W),H[v++]=k-L-1,H[v++]=k-L,wi.addAttribute(C,W,void 0,E),E-=3;n.push(k-Math.floor(M.length/6)),t===Jo.BEVELED&&n.push((E-2)/3+1),T+=3}else{for(T+=3,k=O,n.push(P),L=0;L<V.length/3;L++)W=d.fromArray(V,L*3,W),H[v++]=k+L,H[v++]=k+L+1,wi.addAttribute(C,W,T),T+=3;n.push(k+Math.floor(V.length/6)),t===Jo.BEVELED&&n.push(T/3-1),E-=3}for(m=i[I++],D=i[I++],m.splice(0,3),D.splice(D.length-3,3),C.set(m,T),C.set(D,E-D.length+1),_=D.length-3,L=0;L<D.length;L+=3)O=T/3,S=O-1,P=(E-2)/3,w=P+1,H[v++]=w,H[v++]=P,H[v++]=S,H[v++]=O,T+=3,E-=3;T-=3,E+=3,n.push(T/3,(E-2)/3)}if(g){T+=3,E-=3,R=LG,z=BG;const L=r[1];for(f=0;f<F;f++)R=d.fromArray(L,(p-f-1)*3,R),z=d.fromArray(L,f*3,z),wi.addAttribute(C,R,void 0,E),wi.addAttribute(C,z,T),O=T/3,S=O-1,P=(E-2)/3,w=P+1,H[v++]=w,H[v++]=P,H[v++]=S,H[v++]=O,T+=3,E-=3;n.push(T/3)}else n.push(T/3,(E-2)/3);return H[v++]=T/3,H[v++]=(E-2)/3,s.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:C}),{attributes:s,indices:H,wallIndices:n}}function NJe(e){const t=e.ellipsoid,n=wi.computePositions(e),i=vQ(n,e.cornerType),o=i.wallIndices,r=e.height,s=e.extrudedHeight,a=i.attributes,c=i.indices;let u=a.position.values,f=u.length,h=new Float64Array(f);h.set(u);const _=new Float64Array(f*2);if(u=Wi.scaleToGeodeticHeight(u,r,t),h=Wi.scaleToGeodeticHeight(h,s,t),_.set(u),_.set(h,f),a.position.values=_,f/=3,l(e.offsetAttribute)){let w=new Uint8Array(f*2);if(e.offsetAttribute===fn.TOP)w=w.fill(1,0,f);else{const S=e.offsetAttribute===fn.NONE?0:1;w=w.fill(S)}a.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:w})}let g;const p=c.length,y=it.createTypedArray(_.length/3,(p+o.length)*2);y.set(c);let C=p;for(g=0;g<p;g+=2){const w=c[g],S=c[g+1];y[C++]=w+f,y[C++]=S+f}let T,E;for(g=0;g<o.length;g++)T=o[g],E=T+f,y[C++]=T,y[C++]=E;return{attributes:a,indices:y}}function pT(e){e=A(e,A.EMPTY_OBJECT);const t=e.positions,n=e.width;b.typeOf.object("options.positions",t),b.typeOf.number("options.width",n);const i=A(e.height,0),o=A(e.extrudedHeight,i);this._positions=t,this._ellipsoid=pe.clone(A(e.ellipsoid,pe.WGS84)),this._width=n,this._height=Math.max(i,o),this._extrudedHeight=Math.min(i,o),this._cornerType=A(e.cornerType,Jo.ROUNDED),this._granularity=A(e.granularity,N.RADIANS_PER_DEGREE),this._offsetAttribute=e.offsetAttribute,this._workerName="createCorridorOutlineGeometry",this.packedLength=1+t.length*d.packedLength+pe.packedLength+6}pT.pack=function(e,t,n){b.typeOf.object("value",e),b.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+=d.packedLength)d.pack(i[r],t,n);return pe.pack(e._ellipsoid,t,n),n+=pe.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 DQ=pe.clone(pe.UNIT_SPHERE),uh={positions:void 0,ellipsoid:DQ,width:void 0,height:void 0,extrudedHeight:void 0,cornerType:void 0,granularity:void 0,offsetAttribute:void 0};pT.unpack=function(e,t,n){b.typeOf.object("array",e),t=A(t,0);const i=e[t++],o=new Array(i);for(let _=0;_<i;++_,t+=d.packedLength)o[_]=d.unpack(e,t);const r=pe.unpack(e,t,DQ);t+=pe.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t];return l(n)?(n._positions=o,n._ellipsoid=pe.clone(r,n._ellipsoid),n._width=s,n._height=a,n._extrudedHeight=c,n._cornerType=u,n._granularity=f,n._offsetAttribute=h===-1?void 0:h,n):(uh.positions=o,uh.width=s,uh.height=a,uh.extrudedHeight=c,uh.cornerType=u,uh.granularity=f,uh.offsetAttribute=h===-1?void 0:h,new pT(uh))};pT.createGeometry=function(e){let t=e._positions;const n=e._width,i=e._ellipsoid;t=RJe(t,i);const o=Zs(t,d.equalsEpsilon);if(o.length<2||n<=0)return;const r=e._height,s=e._extrudedHeight,a=!N.equalsEpsilon(r,s,0,N.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=NJe(c);else{const _=wi.computePositions(c);if(u=vQ(_,c.cornerType),u.attributes.position.values=Wi.scaleToGeodeticHeight(u.attributes.position.values,r,i),l(e._offsetAttribute)){const g=u.attributes.position.values.length,p=e._offsetAttribute===fn.NONE?0:1,y=new Uint8Array(g/3).fill(p);u.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}}const f=u.attributes,h=fe.fromVertices(f.position.values,void 0,3);return new Dt({attributes:f,indices:u.indices,primitiveType:Je.LINES,boundingSphere:h,offsetAttribute:e._offsetAttribute})};const MJe=new Wo(0);function Yt(e){Nn.call(this,e),this._zIndex=0,this._terrainOffsetProperty=void 0}l(Object.create)&&(Yt.prototype=Object.create(Nn.prototype),Yt.prototype.constructor=Yt);Object.defineProperties(Yt.prototype,{zIndex:{get:function(){return this._zIndex}},terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});Yt.prototype._isOnTerrain=function(e,t){return this._fillEnabled&&!l(t.height)&&!l(t.extrudedHeight)&&Fr.isSupported(this._scene)};Yt.prototype._getIsClosed=function(e){const t=e.height,n=e.extrudedHeight;return t===0||l(n)&&n!==t};Yt.prototype._computeCenter=x.throwInstantiationError;Yt.prototype._onEntityPropertyChanged=function(e,t,n,i){if(Nn.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))&&Di(Di.geometryZIndex),this._zIndex=A(o.zIndex,MJe),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 F_(this._scene,a,r,s)}};Yt.prototype.destroy=function(){l(this._terrainOffsetProperty)&&(this._terrainOffsetProperty.destroy(),this._terrainOffsetProperty=void 0),Nn.prototype.destroy.call(this)};Yt.getGeometryHeight=function(e,t){if(b.defined("heightReference",t),!l(e)){t!==Et.NONE&&Di(Di.geometryHeightReference);return}return t!==Et.CLAMP_TO_GROUND?e:0};Yt.getGeometryExtrudedHeight=function(e,t){if(b.defined("extrudedHeightReference",t),!l(e)){t!==Et.NONE&&Di(Di.geometryExtrudedHeightReference);return}return t!==Et.CLAMP_TO_GROUND?e:Yt.CLAMP_TO_GROUND};Yt.CLAMP_TO_GROUND="clamp";Yt.computeGeometryOffsetAttribute=function(e,t,n,i){(!l(e)||!l(t))&&(t=Et.NONE),(!l(n)||!l(i))&&(i=Et.NONE);let o=0;if(t!==Et.NONE&&o++,i===Et.RELATIVE_TO_GROUND&&o++,o===2)return fn.ALL;if(o===1)return fn.TOP};const IQ=new U,PQ=d.ZERO,OQ=new d,LQ=new _e;function FJe(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 Hl(e,t){Yt.call(this,{entity:e,scene:t,geometryOptions:new FJe(e),geometryPropertyName:"corridor",observedPropertyNames:["availability","corridor"]}),this._onEntityPropertyChanged(e,"corridor",e.corridor,void 0)}l(Object.create)&&(Hl.prototype=Object.create(Yt.prototype),Hl.prototype.constructor=Hl);Hl.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:_i.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Jt){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,IQ)),l(o)||(o=U.WHITE),i.color=an.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,PQ,OQ))),new nn({id:t,geometry:new Zl(this._options),attributes:i})};Hl.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,IQ),o={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0};return l(this._options.offsetAttribute)&&(o.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,PQ,OQ))),new nn({id:t,geometry:new pT(this._options),attributes:o})};Hl.prototype._computeCenter=function(e,t){const n=Z.getValueOrUndefined(this._entity.corridor.positions,e);if(!(!l(n)||n.length===0))return d.clone(n[Math.floor(n.length/2)],t)};Hl.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.width)||Nn.prototype._isHidden.call(this,e,t)};Hl.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 Jt)};Hl.prototype._setStaticOptions=function(e,t){let n=Z.getValueOrUndefined(t.height,lt.MINIMUM_VALUE);const i=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE);let o=Z.getValueOrUndefined(t.extrudedHeight,lt.MINIMUM_VALUE);const r=Z.getValueOrDefault(t.extrudedHeightReference,lt.MINIMUM_VALUE,Et.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof Jt?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(lt.MINIMUM_VALUE,s.positions),s.width=t.width.getValue(lt.MINIMUM_VALUE),s.granularity=Z.getValueOrUndefined(t.granularity,lt.MINIMUM_VALUE),s.cornerType=Z.getValueOrUndefined(t.cornerType,lt.MINIMUM_VALUE),s.offsetAttribute=Yt.computeGeometryOffsetAttribute(n,i,o,r),s.height=Yt.getGeometryHeight(n,i),o=Yt.getGeometryExtrudedHeight(o,r),o===Yt.CLAMP_TO_GROUND&&(o=Qi.getMinimumMaximumHeights(Zl.computeRectangle(s,LQ)).minimumTerrainHeight),s.extrudedHeight=o};Hl.DynamicGeometryUpdater=py;function py(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(py.prototype=Object.create(si.prototype),py.prototype.constructor=py);py.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.positions)||!l(i.width)||si.prototype._isHidden.call(this,e,t,n)};py.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,Et.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,Et.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=Yt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Yt.getGeometryHeight(o,r),s=Yt.getGeometryExtrudedHeight(s,a),s===Yt.CLAMP_TO_GROUND&&(s=Qi.getMinimumMaximumHeights(Zl.computeRectangle(i,LQ)).minimumTerrainHeight),i.extrudedHeight=s};function hD(){x.throwInstantiationError()}Object.defineProperties(hD.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}});hD.prototype.update=function(e){x.throwInstantiationError()};hD.setLoading=function(e,t){e._isLoading!==t&&(t?e._entityCollection.suspendEvents():e._entityCollection.resumeEvents(),e._isLoading=t,e._loading.raiseEvent(e,t))};function ei(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=Mt.clone(n)}if(l(i)){if(i.far<=i.near)throw new x("scaleByDistance.far must be greater than scaleByDistance.near.");i=Mt.clone(i)}if(l(o)){if(o.far<=o.near)throw new x("distanceDisplayCondition.far must be greater than distanceDisplayCondition.near.");o=Ut.clone(o)}this._show=A(e.show,!0),this._position=d.clone(A(e.position,d.ZERO)),this._actualPosition=d.clone(this._position),this._color=U.clone(A(e.color,U.WHITE)),this._outlineColor=U.clone(A(e.outlineColor,U.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 RG=ei.SHOW_INDEX=0,BQ=ei.POSITION_INDEX=1,zJe=ei.COLOR_INDEX=2,UJe=ei.OUTLINE_COLOR_INDEX=3,HJe=ei.OUTLINE_WIDTH_INDEX=4,VJe=ei.PIXEL_SIZE_INDEX=5,kJe=ei.SCALE_BY_DISTANCE_INDEX=6,GJe=ei.TRANSLUCENCY_BY_DISTANCE_INDEX=7,WJe=ei.DISTANCE_DISPLAY_CONDITION_INDEX=8,jJe=ei.DISABLE_DEPTH_DISTANCE_INDEX=9;ei.NUMBER_OF_PROPERTIES=10;function Oc(e,t){const n=e._pointPrimitiveCollection;l(n)&&(n._updatePointPrimitive(e,t),e._dirty=!0)}Object.defineProperties(ei.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,Oc(this,RG))}},position:{get:function(){return this._position},set:function(e){if(!l(e))throw new x("value is required.");const t=this._position;d.equals(t,e)||(d.clone(e,t),d.clone(e,this._actualPosition),Oc(this,BQ))}},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;Mt.equals(t,e)||(this._scaleByDistance=Mt.clone(e,t),Oc(this,kJe))}},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;Mt.equals(t,e)||(this._translucencyByDistance=Mt.clone(e,t),Oc(this,GJe))}},pixelSize:{get:function(){return this._pixelSize},set:function(e){if(!l(e))throw new x("value is required.");this._pixelSize!==e&&(this._pixelSize=e,Oc(this,VJe))}},color:{get:function(){return this._color},set:function(e){if(!l(e))throw new x("value is required.");const t=this._color;U.equals(t,e)||(U.clone(e,t),Oc(this,zJe))}},outlineColor:{get:function(){return this._outlineColor},set:function(e){if(!l(e))throw new x("value is required.");const t=this._outlineColor;U.equals(t,e)||(U.clone(e,t),Oc(this,UJe))}},outlineWidth:{get:function(){return this._outlineWidth},set:function(e){if(!l(e))throw new x("value is required.");this._outlineWidth!==e&&(this._outlineWidth=e,Oc(this,HJe))}},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");Ut.equals(this._distanceDisplayCondition,e)||(this._distanceDisplayCondition=Ut.clone(e,this._distanceDisplayCondition),Oc(this,WJe))}},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,Oc(this,jJe)}}},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,Oc(this,RG))}}});ei.prototype.getPickId=function(e){return l(this._pickId)||(this._pickId=e.createPickId({primitive:this,collection:this._collection,id:this._id})),this._pickId};ei.prototype._getActualPosition=function(){return this._actualPosition};ei.prototype._setActualPosition=function(e){d.clone(e,this._actualPosition),Oc(this,BQ)};const NG=new oe;ei._computeActualPosition=function(e,t,n){return t.mode===le.SCENE3D?e:(B.multiplyByPoint(n,e,NG),lr.computeActualWgs84Position(t,NG))};const MG=new oe;ei._computeScreenSpacePosition=function(e,t,n,i){const o=B.multiplyByVector(e,oe.fromElements(t.x,t.y,t.z,1,MG),MG);return lr.wgs84ToWindowCoordinates(n,o,i)};ei.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=ei._computeScreenSpacePosition(i,this._actualPosition,e,t);if(l(o))return o.y=e.canvas.clientHeight-o.y,o};ei.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 qe),n.x=r,n.y=s,n.width=a,n.height=c,n};ei.prototype.equals=function(e){return this===e||l(e)&&this._id===e._id&&d.equals(this._position,e._position)&&U.equals(this._color,e._color)&&this._pixelSize===e._pixelSize&&this._outlineWidth===e._outlineWidth&&this._show===e._show&&U.equals(this._outlineColor,e._outlineColor)&&Mt.equals(this._scaleByDistance,e._scaleByDistance)&&Mt.equals(this._translucencyByDistance,e._translucencyByDistance)&&Ut.equals(this._distanceDisplayCondition,e._distanceDisplayCondition)&&this._disableDepthTestDistance===e._disableDepthTestDistance};ei.prototype._destroy=function(){this._pickId=this._pickId&&this._pickId.destroy(),this._pointPrimitiveCollection=void 0};const qJe=ei.SHOW_INDEX,XB=ei.POSITION_INDEX,RQ=ei.COLOR_INDEX,YJe=ei.OUTLINE_COLOR_INDEX,$Je=ei.OUTLINE_WIDTH_INDEX,XJe=ei.PIXEL_SIZE_INDEX,NQ=ei.SCALE_BY_DISTANCE_INDEX,MQ=ei.TRANSLUCENCY_BY_DISTANCE_INDEX,FQ=ei.DISTANCE_DISPLAY_CONDITION_INDEX,KJe=ei.DISABLE_DEPTH_DISTANCE_INDEX,CF=ei.NUMBER_OF_PROPERTIES,zs={positionHighAndSize:0,positionLowAndOutline:1,compressedAttribute0:2,compressedAttribute1:3,scaleByDistance:4,distanceDisplayConditionAndDisableDepth:5};function Tc(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(CF),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,zo.OPAQUE_AND_TRANSLUCENT),this._blendOption=void 0,this._mode=le.SCENE3D,this._maxTotalPointSize=1,this._buffersUsage=[Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW,Ze.STATIC_DRAW];const t=this;this._uniforms={u_maxTotalPointSize:function(){return t._maxTotalPointSize}}}Object.defineProperties(Tc.prototype,{length:{get:function(){return TF(this),this._pointPrimitives.length}}});function zQ(e){const t=e.length;for(let n=0;n<t;++n)e[n]&&e[n]._destroy()}Tc.prototype.add=function(e){const t=new ei(e,this);return t._index=this._pointPrimitives.length,this._pointPrimitives.push(t),this._createVertexArray=!0,t};Tc.prototype.remove=function(e){return this.contains(e)?(this._pointPrimitives[e._index]=null,this._pointPrimitivesRemoved=!0,this._createVertexArray=!0,e._destroy(),!0):!1};Tc.prototype.removeAll=function(){zQ(this._pointPrimitives),this._pointPrimitives=[],this._pointPrimitivesToUpdate=[],this._pointPrimitivesToUpdateIndex=0,this._pointPrimitivesRemoved=!1,this._createVertexArray=!0};function TF(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}}Tc.prototype._updatePointPrimitive=function(e,t){e._dirty||(this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++]=e),++this._propertiesChanged[t]};Tc.prototype.contains=function(e){return l(e)&&e._pointPrimitiveCollection===this};Tc.prototype.get=function(e){if(!l(e))throw new x("index is required.");return TF(this),this._pointPrimitives[e]};Tc.prototype.computeNewBuffersUsage=function(){const e=this._buffersUsage;let t=!1;const n=this._propertiesChanged;for(let i=0;i<CF;++i){const o=n[i]===0?Ze.STATIC_DRAW:Ze.STREAM_DRAW;t=t||e[i]!==o,e[i]=o}return t};function JJe(e,t,n){return new br(e,[{index:zs.positionHighAndSize,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[XB]},{index:zs.positionLowAndShow,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[XB]},{index:zs.compressedAttribute0,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[RQ]},{index:zs.compressedAttribute1,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[MQ]},{index:zs.scaleByDistance,componentsPerAttribute:4,componentDatatype:ee.FLOAT,usage:n[NQ]},{index:zs.distanceDisplayConditionAndDisableDepth,componentsPerAttribute:3,componentDatatype:ee.FLOAT,usage:n[FQ]}],t)}const t1=new wn;function UQ(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),wn.fromCartesian(r,t1);const s=i.pixelSize,a=i.outlineWidth;e._maxPixelSize=Math.max(e._maxPixelSize,s+a);const c=n[zs.positionHighAndSize],u=t1.high;c(o,u.x,u.y,u.z,s);const f=n[zs.positionLowAndOutline],h=t1.low;f(o,h.x,h.y,h.z,a)}const _x=65536,GA=256;function HQ(e,t,n,i){const o=i._index,r=i.color,s=i.getPickId(t).color,a=i.outlineColor;let c=U.floatToByte(r.red),u=U.floatToByte(r.green),f=U.floatToByte(r.blue);const h=c*_x+u*GA+f;c=U.floatToByte(a.red),u=U.floatToByte(a.green),f=U.floatToByte(a.blue);const _=c*_x+u*GA+f;c=U.floatToByte(s.red),u=U.floatToByte(s.green),f=U.floatToByte(s.blue);const g=c*_x+u*GA+f,p=U.floatToByte(r.alpha)*_x+U.floatToByte(a.alpha)*GA+U.floatToByte(s.alpha),y=n[zs.compressedAttribute0];y(o,h,_,g,p)}function VQ(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 f=i.show&&i.clusterShow;i.color.alpha===0&&i.outlineColor.alpha===0&&(f=!1),s=N.clamp(s,0,1),s=s===1?255:s*255|0;const h=(f?1:0)*GA+s;c=N.clamp(c,0,1),c=c===1?255:c*255|0;const _=c,g=n[zs.compressedAttribute1];g(o,h,_,r,a)}function kQ(e,t,n,i){const o=i._index,r=n[zs.scaleByDistance];let s=0,a=1,c=1,u=1;const f=i.scaleByDistance;l(f)&&(s=f.near,a=f.nearValue,c=f.far,u=f.farValue,(a!==1||u!==1)&&(e._shaderScaleByDistance=!0)),r(o,s,a,c,u)}function GQ(e,t,n,i){const o=i._index,r=n[zs.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 QJe(e,t,n,i){UQ(e,t,n,i),HQ(e,t,n,i),VQ(e,t,n,i),kQ(e,t,n,i),GQ(e,t,n,i)}function n1(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],f=u.position,h=ei._computeActualPosition(f,i,o);l(h)&&(u._setActualPosition(h),r?a.push(h):fe.expand(s,h,s))}r&&fe.fromPoints(a,s)}function ZJe(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)&&n1(e,i,i.length,t,r,!0)):n===le.MORPHING?n1(e,i,i.length,t,r,!0):(n===le.SCENE2D||n===le.COLUMBUS_VIEW)&&n1(e,o,e._pointPrimitivesToUpdateIndex,t,r,!1)}function eQe(e,t,n){const o=t.camera.getPixelSize(n,t.context.drawingBufferWidth,t.context.drawingBufferHeight)*e._maxPixelSize;n.radius+=o}const tQe=[];Tc.prototype.update=function(e){if(TF(this),!this.show)return;this._maxTotalPointSize=wt.maximumAliasedPointSize,ZJe(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,f=u.pick;if(s||!f&&this.computeNewBuffersUsage()){this._createVertexArray=!1;for(let P=0;P<CF;++P)r[P]=0;if(this._vaf=this._vaf&&this._vaf.destroy(),n>0){this._vaf=JJe(c,n,this._buffersUsage),a=this._vaf.writers;for(let P=0;P<n;++P){const O=this._pointPrimitives[P];O._dirty=!1,QJe(this,c,a,O)}this._vaf.commit()}this._pointPrimitivesToUpdateIndex=0}else if(o>0){const P=tQe;P.length=0,(r[XB]||r[$Je]||r[XJe])&&P.push(UQ),(r[RQ]||r[YJe])&&P.push(HQ),(r[qJe]||r[MQ])&&P.push(VQ),r[NQ]&&P.push(kQ),(r[FQ]||r[KJe])&&P.push(GQ);const O=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<O;++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<O;++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,_=B.IDENTITY;e.mode===le.SCENE3D?(_=this.modelMatrix,h=fe.clone(this._baseVolumeWC,this._boundingVolume)):h=fe.clone(this._baseVolume2D,this._boundingVolume),eQe(this,e,h);const g=this._blendOption!==this.blendOption;this._blendOption=this.blendOption,g&&(this._blendOption===zo.OPAQUE||this._blendOption===zo.OPAQUE_AND_TRANSLUCENT?this._rsOpaque=Qe.fromCache({depthTest:{enabled:!0,func:se.LEQUAL},depthMask:!0}):this._rsOpaque=void 0,this._blendOption===zo.TRANSLUCENT||this._blendOption===zo.OPAQUE_AND_TRANSLUCENT?this._rsTranslucent=Qe.fromCache({depthTest:{enabled:!0,func:se.LEQUAL},depthMask:!1,blending:Ii.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 Ge({sources:[dAe]}),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===zo.OPAQUE_AND_TRANSLUCENT&&(y=new Ge({defines:["OPAQUE"],sources:[nE]}),this._sp=hn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:zs}),y=new Ge({defines:["TRANSLUCENT"],sources:[nE]}),this._spTranslucent=hn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:zs})),this._blendOption===zo.OPAQUE&&(y=new Ge({sources:[nE]}),this._sp=hn.replaceCache({context:c,shaderProgram:this._sp,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:zs})),this._blendOption===zo.TRANSLUCENT&&(y=new Ge({sources:[nE]}),this._spTranslucent=hn.replaceCache({context:c,shaderProgram:this._spTranslucent,vertexShaderSource:p,fragmentShaderSource:y,attributeLocations:zs})),this._compiledShaderScaleByDistance=this._shaderScaleByDistance,this._compiledShaderTranslucencyByDistance=this._shaderTranslucencyByDistance,this._compiledShaderDistanceDisplayCondition=this._shaderDistanceDisplayCondition,this._compiledShaderDisableDepthDistance=this._shaderDisableDepthDistance);let C,T,E,w;const S=e.commandList;if(u.render||f){const P=this._colorCommands,O=this._blendOption===zo.OPAQUE,z=this._blendOption===zo.OPAQUE_AND_TRANSLUCENT;C=this._vaf.va,T=C.length,P.length=T;const R=z?T*2:T;for(w=0;w<R;++w){const F=O||z&&w%2===0;E=P[w],l(E)||(E=P[w]=new dt),E.primitiveType=Je.POINTS,E.pass=F||!z?Be.OPAQUE:Be.TRANSLUCENT,E.owner=this;const H=z?Math.floor(w/2):w;E.boundingVolume=h,E.modelMatrix=_,E.shaderProgram=F?this._sp:this._spTranslucent,E.uniformMap=this._uniforms,E.vertexArray=C[H].va,E.renderState=F?this._rsOpaque:this._rsTranslucent,E.debugShowBoundingVolume=this.debugShowBoundingVolume,E.pickId="v_pickColor",S.push(E)}}};Tc.prototype.isDestroyed=function(){return!1};Tc.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(),zQ(this._pointPrimitives),Ue(this)};function KB(e,t,n,i,o,r){if(o-i<=n)return;const s=i+o>>1;WQ(e,t,s,i,o,r%2),KB(e,t,n,i,s-1,r+1),KB(e,t,n,s+1,o,r+1)}function WQ(e,t,n,i,o,r){for(;o>i;){if(o-i>600){const u=o-i+1,f=n-i+1,h=Math.log(u),_=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*_*(u-_)/u)*(f-u/2<0?-1:1),p=Math.max(i,Math.floor(n-f*_/u+g)),y=Math.min(o,Math.floor(n+(u-f)*_/u+g));WQ(e,t,n,p,y,r)}const s=t[2*n+r];let a=i,c=o;for(AA(e,t,i,n),t[2*o+r]>s&&AA(e,t,i,o);a<c;){for(AA(e,t,a,c),a++,c--;t[2*a+r]<s;)a++;for(;t[2*c+r]>s;)c--}t[2*i+r]===s?AA(e,t,i,c):(c++,AA(e,t,c,o)),c<=n&&(i=c+1),n<=c&&(o=c-1)}}function AA(e,t,n,i){i1(e,n,i),i1(t,2*n,2*i),i1(t,2*n+1,2*i+1)}function i1(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function nQe(e,t,n,i,o,r,s){const a=[0,e.length-1,0],c=[];let u,f;for(;a.length;){const h=a.pop(),_=a.pop(),g=a.pop();if(_-g<=s){for(let C=g;C<=_;C++)u=t[2*C],f=t[2*C+1],u>=n&&u<=o&&f>=i&&f<=r&&c.push(e[C]);continue}const p=Math.floor((g+_)/2);u=t[2*p],f=t[2*p+1],u>=n&&u<=o&&f>=i&&f<=r&&c.push(e[p]);const y=(h+1)%2;(h===0?n<=u:i<=f)&&(a.push(g),a.push(p-1),a.push(y)),(h===0?o>=u:r>=f)&&(a.push(p+1),a.push(_),a.push(y))}return c}function iQe(e,t,n,i,o,r){const s=[0,e.length-1,0],a=[],c=o*o;for(;s.length;){const u=s.pop(),f=s.pop(),h=s.pop();if(f-h<=r){for(let C=h;C<=f;C++)FG(t[2*C],t[2*C+1],n,i)<=c&&a.push(e[C]);continue}const _=Math.floor((h+f)/2),g=t[2*_],p=t[2*_+1];FG(g,p,n,i)<=c&&a.push(e[_]);const y=(u+1)%2;(u===0?n-o<=g:i-o<=p)&&(s.push(h),s.push(_-1),s.push(y)),(u===0?n+o>=g:i+o>=p)&&(s.push(_+1),s.push(f),s.push(y))}return a}function FG(e,t,n,i){const o=e-n,r=t-i;return o*o+r*r}const oQe=e=>e[0],rQe=e=>e[1];class sQe{constructor(t,n=oQe,i=rQe,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]);KB(a,c,o,0,a.length-1,0)}range(t,n,i,o){return nQe(this.ids,this.coords,t,n,i,o,this.nodeSize)}within(t,n,i){return iQe(this.ids,this.coords,t,n,i,this.nodeSize)}}function fu(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 $e,this.show=A(e.show,!0)}function aQe(e){return e.coord.x}function cQe(e){return e.coord.y}function zG(e,t){e.x-=t,e.y-=t,e.width+=t*2,e.height+=t*2}const lQe=new qe;function UG(e,t,n,i,o){if(l(e._labelCollection)&&i._clusterLabels?o=Jl.getScreenSpaceBoundingBox(e,t,o):l(e._billboardCollection)&&i._clusterBillboards?o=Rt.getScreenSpaceBoundingBox(e,t,o):l(e._pointPrimitiveCollection)&&i._clusterPoints&&(o=ei.getScreenSpaceBoundingBox(e,t,o)),zG(o,n),i._clusterLabels&&!l(e._labelCollection)&&l(e.id)&&jQ(i,e.id.id)&&l(e.id._label)){const r=i._collectionIndicesByEntity[e.id.id].labelIndex,s=i._labelCollection.get(r),a=Jl.getScreenSpaceBoundingBox(s,t,lQe);zG(a,n),o=qe.union(o,a,o)}return o}function uQe(e,t){if(e.clusterShow=!0,!l(e._labelCollection)&&l(e.id)&&jQ(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 HG(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 jQ(e,t){return l(e)&&l(e._collectionIndicesByEntity[t])&&l(e._collectionIndicesByEntity[t].labelIndex)}function o1(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),f=o._clusterPoints&&l(a.id._point);if(c&&(f||u))continue;const h=a.computeScreenSpacePosition(n);l(h)&&t.push({index:s,collection:e,clustered:!1,coord:h})}}const fQe=new qe,dQe=new qe,hQe=new qe;function pQe(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 Cc({scene:n}),l(a)?a.removeAll():a=e._clusterBillboardCollection=new na({scene:n}),l(c)?c.removeAll():c=e._clusterPointCollection=new Tc;const u=e._pixelRange,f=e._minimumClusterSize,h=e._previousClusters,_=[],g=e._previousHeight,p=n.camera.positionCartographic.height,y=n.mapProjection.ellipsoid,C=n.camera.positionWC,T=new cl(y,C),E=[];e._clusterLabels&&o1(i,E,n,T,e),e._clusterBillboards&&o1(o,E,n,T,e),e._clusterPoints&&o1(r,E,n,T,e);let w,S,P,O,z,R,F,H,v,I,m,D;const L=new sQe(E,aQe,cQe,64,Int32Array);if(p<g)for(P=h.length,w=0;w<P;++w){const M=h[w];if(!T.isPointVisible(M.position))continue;const V=Rt._computeScreenSpacePosition(B.IDENTITY,M.position,d.ZERO,j.ZERO,n);if(!l(V))continue;const k=1-p/g;let W=M.width=M.width*k,G=M.height=M.height*k;W=Math.max(W,M.minimumWidth),G=Math.max(G,M.minimumHeight);const K=V.x-W*.5,q=V.y-G*.5,te=V.x+W,$=V.y+G;for(z=L.range(K,q,te,$),R=z.length,I=0,v=[],S=0;S<R;++S)F=z[S],H=E[F],H.clustered||(++I,m=H.collection,D=H.index,v.push(m.get(D).id));if(I>=f)for(HG(M.position,I,v,e),_.push(M),S=0;S<R;++S)E[z[S]].clustered=!0}for(P=E.length,w=0;w<P;++w){const M=E[w];if(M.clustered)continue;M.clustered=!0,m=M.collection,D=M.index;const V=m.get(D);O=UG(V,M.coord,u,e,fQe);const k=qe.clone(O,dQe);z=L.range(O.x,O.y,O.x+O.width,O.y+O.height),R=z.length;const W=d.clone(V.position);for(I=1,v=[V.id],S=0;S<R;++S)if(F=z[S],H=E[F],!H.clustered){const G=H.collection.get(H.index),K=UG(G,H.coord,u,e,hQe);d.add(G.position,W,W),qe.union(k,K,k),++I,v.push(G.id)}if(I>=f){const G=d.multiplyByScalar(W,1/I,W);for(HG(G,I,v,e),_.push({position:G,width:k.width,height:k.height,minimumWidth:O.width,minimumHeight:O.height}),S=0;S<R;++S)E[z[S]].clustered=!0}else uQe(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=_,e._previousHeight=p}}fu.prototype._initialize=function(e){this._scene=e;const t=pQe(this);this._cluster=t,this._removeEventListener=e.camera.changed.addEventListener(t)};Object.defineProperties(fu.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 bF(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 f=this;return Promise.resolve().then(function(){f._clusterDirty=!0}),c}}function EF(e,t){const n=e._collectionIndicesByEntity[t];!l(n.billboardIndex)&&!l(n.labelIndex)&&!l(n.pointIndex)&&delete e._collectionIndicesByEntity[t]}fu.prototype.getLabel=bF("_labelCollection",Cc,"_unusedLabelIndices","labelIndex");fu.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,EF(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};fu.prototype.getBillboard=bF("_billboardCollection",na,"_unusedBillboardIndices","billboardIndex");fu.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,EF(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};fu.prototype.getPoint=bF("_pointCollection",Tc,"_unusedPointIndices","pointIndex");fu.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,EF(this,e.id);const i=this._pointCollection.get(n);i.show=!1,i.id=void 0,this._unusedPointIndices.push(n),this._clusterDirty=!0};function r1(e){if(!l(e))return;const t=e.length;for(let n=0;n<t;++n)e.get(n).clusterShow=!0}function mQe(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,r1(e._labelCollection),r1(e._billboardCollection),r1(e._pointCollection))}fu.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,mQe(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)};fu.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 xF(e){this._name=e,this._clock=void 0,this._changed=new $e,this._error=new $e,this._isLoading=!1,this._loading=new $e,this._entityCollection=new ia(this),this._entityCluster=new fu}Object.defineProperties(xF.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){hD.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}}});xF.prototype.update=function(e){return!0};const qQ={};qQ.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 f,h=0,_=0;const g=o?a*3:0,p=o?(a+i)*3:i*3;for(f=0;f<i;f++){const y=f/i*N.TWO_PI,C=Math.cos(y),T=Math.sin(y),E=C*n,w=T*n,S=C*t,P=T*t;u[_+g]=E,u[_+g+1]=w,u[_+g+2]=s,u[_+p]=S,u[_+p+1]=P,u[_+p+2]=r,_+=3,o&&(u[h++]=E,u[h++]=w,u[h++]=s,u[h++]=S,u[h++]=P,u[h++]=r)}return u};const YQ=qQ,s1=new j,_Qe=new d,gQe=new d,yQe=new d,AQe=new d;function ad(e){e=A(e,A.EMPTY_OBJECT);const t=e.length,n=e.topRadius,i=e.bottomRadius,o=A(e.vertexFormat,Ne.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===fn.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=Ne.clone(o),this._slices=r,this._offsetAttribute=e.offsetAttribute,this._workerName="createCylinderGeometry"}ad.packedLength=Ne.packedLength+5;ad.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),Ne.pack(e._vertexFormat,t,n),n+=Ne.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 $Q=new Ne,yg={vertexFormat:$Q,length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,offsetAttribute:void 0};ad.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=Ne.unpack(e,t,$Q);t+=Ne.packedLength;const o=e[t++],r=e[t++],s=e[t++],a=e[t++],c=e[t];return l(n)?(n._vertexFormat=Ne.clone(i,n._vertexFormat),n._length=o,n._topRadius=r,n._bottomRadius=s,n._slices=a,n._offsetAttribute=c===-1?void 0:c,n):(yg.length=o,yg.topRadius=r,yg.bottomRadius=s,yg.slices=a,yg.offsetAttribute=c===-1?void 0:c,new ad(yg))};ad.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=YQ.computePositions(t,n,i,r,!0),f=o.st?new Float32Array(c*2):void 0,h=o.normal?new Float32Array(c*3):void 0,_=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,H=0;const v=Math.atan2(i-n,t),I=_Qe;I.z=Math.sin(v);const m=Math.cos(v);let D=yQe,L=gQe;for(p=0;p<r;p++){const M=p/r*N.TWO_PI,V=m*Math.cos(M),k=m*Math.sin(M);y&&(I.x=V,I.y=k,z&&(D=d.normalize(d.cross(d.UNIT_Z,I,D),D)),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&&(_[F++]=D.x,_[F++]=D.y,_[F++]=D.z,_[F++]=D.x,_[F++]=D.y,_[F++]=D.z),o.bitangent&&(L=d.normalize(d.cross(I,D,L),L),g[H++]=L.x,g[H++]=L.y,g[H++]=L.z,g[H++]=L.x,g[H++]=L.y,g[H++]=L.z))}for(p=0;p<r;p++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=-1),o.tangent&&(_[F++]=1,_[F++]=0,_[F++]=0),o.bitangent&&(g[H++]=0,g[H++]=-1,g[H++]=0);for(p=0;p<r;p++)o.normal&&(h[R++]=0,h[R++]=0,h[R++]=1),o.tangent&&(_[F++]=1,_[F++]=0,_[F++]=0),o.bitangent&&(g[H++]=0,g[H++]=1,g[H++]=0)}const C=12*r-12,T=it.createTypedArray(c,C);let E=0,w=0;for(p=0;p<r-1;p++)T[E++]=w,T[E++]=w+2,T[E++]=w+3,T[E++]=w,T[E++]=w+3,T[E++]=w+1,w+=2;for(T[E++]=s-2,T[E++]=0,T[E++]=1,T[E++]=s-2,T[E++]=1,T[E++]=s-1,p=1;p<r-1;p++)T[E++]=s+p+1,T[E++]=s+p,T[E++]=s;for(p=1;p<r-1;p++)T[E++]=a,T[E++]=a+p,T[E++]=a+p+1;let S=0;if(o.st){const z=Math.max(n,i);for(p=0;p<c;p++){const R=d.fromArray(u,p*3,AQe);f[S++]=(R.x+z)/(2*z),f[S++]=(R.y+z)/(2*z)}}const P=new Ui;o.position&&(P.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:u})),o.normal&&(P.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:h})),o.tangent&&(P.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:_})),o.bitangent&&(P.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),o.st&&(P.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:f})),s1.x=t*.5,s1.y=Math.max(i,n);const O=new fe(d.ZERO,j.magnitude(s1));if(l(e._offsetAttribute)){t=u.length;const z=e._offsetAttribute===fn.NONE?0:1,R=new Uint8Array(t/3).fill(z);P.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:R})}return new Dt({attributes:P,indices:T,primitiveType:Je.TRIANGLES,boundingSphere:O,offsetAttribute:e._offsetAttribute})};let a1;ad.getUnitCylinder=function(){return l(a1)||(a1=ad.createGeometry(new ad({topRadius:1,bottomRadius:1,length:1,vertexFormat:Ne.POSITION_ONLY}))),a1};const c1=new j;function Gy(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(b.typeOf.number("options.positions",t),b.typeOf.number("options.topRadius",n),b.typeOf.number("options.bottomRadius",i),b.typeOf.number.greaterThanOrEquals("options.slices",o,3),l(e.offsetAttribute)&&e.offsetAttribute===fn.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"}Gy.packedLength=6;Gy.pack=function(e,t,n){return b.typeOf.object("value",e),b.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 lm={length:void 0,topRadius:void 0,bottomRadius:void 0,slices:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};Gy.unpack=function(e,t,n){b.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):(lm.length=i,lm.topRadius=o,lm.bottomRadius=r,lm.slices=s,lm.numberOfVerticalLines=a,lm.offsetAttribute=c===-1?void 0:c,new Gy(lm))};Gy.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=YQ.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 f=it.createTypedArray(s,c*2);let h=0,_;for(_=0;_<o-1;_++)f[h++]=_,f[h++]=_+1,f[h++]=_+o,f[h++]=_+1+o;if(f[h++]=o-1,f[h++]=0,f[h++]=o+o-1,f[h++]=o,r>0)for(_=0;_<o;_+=u)f[h++]=_,f[h++]=_+o;const g=new Ui;g.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:a}),c1.x=t*.5,c1.y=Math.max(i,n);const p=new fe(d.ZERO,j.magnitude(c1));if(l(e._offsetAttribute)){t=a.length;const y=e._offsetAttribute===fn.NONE?0:1,C=new Uint8Array(t/3).fill(y);g.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:C})}return new Dt({attributes:g,indices:f,primitiveType:Je.LINES,boundingSphere:p,offsetAttribute:e._offsetAttribute})};const XQ=d.ZERO,KQ=new d,CQe=new d,JQ=new U;function TQe(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 ic(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new TQe(e),geometryPropertyName:"cylinder",observedPropertyNames:["availability","position","orientation","cylinder"]}),this._onEntityPropertyChanged(e,"cylinder",e.cylinder,void 0)}l(Object.create)&&(ic.prototype=Object.create(Nn.prototype),ic.prototype.constructor=ic);Object.defineProperties(ic.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});ic.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=_i.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r,color:void 0,offset:void 0};if(this._materialProperty instanceof Jt){let a;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,JQ)),l(a)||(a=U.WHITE),s.color=an.fromColor(a)}return l(this._options.offsetAttribute)&&(s.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,XQ,KQ))),new nn({id:t,geometry:new ad(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:s})};ic.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,JQ),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,XQ,KQ))),new nn({id:t,geometry:new Gy(this._options),modelMatrix:t.computeModelMatrixForHeightReference(e,t.cylinder.heightReference,this._options.length*.5,this._scene.mapProjection.ellipsoid),attributes:r})};ic.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};ic.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.length)||!l(t.topRadius)||!l(t.bottomRadius)||Nn.prototype._isHidden.call(this,e,t)};ic.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)};ic.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Jt?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,i.length=t.length.getValue(lt.MINIMUM_VALUE),i.topRadius=t.topRadius.getValue(lt.MINIMUM_VALUE),i.bottomRadius=t.bottomRadius.getValue(lt.MINIMUM_VALUE),i.slices=Z.getValueOrUndefined(t.slices,lt.MINIMUM_VALUE),i.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,lt.MINIMUM_VALUE),i.offsetAttribute=n!==Et.NONE?fn.ALL:void 0};ic.prototype._onEntityPropertyChanged=BM;ic.DynamicGeometryUpdater=my;function my(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(my.prototype=Object.create(si.prototype),my.prototype.constructor=my);my.prototype._isHidden=function(e,t,n){const i=this._options,o=Z.getValueOrUndefined(e.position,n,CQe);return!l(o)||!l(i.length)||!l(i.topRadius)||!l(i.bottomRadius)||si.prototype._isHidden.call(this,e,t,n)};my.prototype._setOptions=function(e,t,n){const i=Z.getValueOrDefault(t.heightReference,n,Et.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!==Et.NONE?fn.ALL:void 0};const bQe={NONE:0,HOLD:1,EXTRAPOLATE:2},Zg=Object.freeze(bQe),wF={type:"Linear"};wF.getRequiredDataPoints=function(e){return 2};wF.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 EQe=wF;function jm(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(hc.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 hc(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 $e,e.collectionChanged.addEventListener(hc.prototype._onCollectionChanged,this)}Object.defineProperties(hc.prototype,{isConstant:{get:function(){return Z.isConstant(jm(this))}},definitionChanged:{get:function(){return this._definitionChanged}},referenceFrame:{get:function(){const e=jm(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 jm(this)}}});hc.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 hc(e,n,i)};hc.prototype.getValue=function(e,t){const n=jm(this);return l(n)?n.getValue(e,t):void 0};hc.prototype.getValueInReferenceFrame=function(e,t,n){const i=jm(this);return l(i)?i.getValueInReferenceFrame(e,t,n):void 0};hc.prototype.getType=function(e){const t=jm(this);return l(t)?t.getType(e):void 0};hc.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};hc.prototype._onTargetEntityDefinitionChanged=function(e,t,n,i){l(this._targetProperty)&&this._targetPropertyNames[0]===t&&(this._targetProperty=void 0,this._definitionChanged.raiseEvent(this))};hc.prototype._onCollectionChanged=function(e,t,n){let i=this._targetEntity;l(i)&&n.indexOf(i)!==-1?(i.definitionChanged.removeEventListener(hc.prototype._onTargetEntityDefinitionChanged,this),this._targetEntity=this._targetProperty=void 0):l(i)||(i=jm(this),l(i)&&this._definitionChanged.raiseEvent(this))};const VG={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 kG(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 GG(e,t){return e instanceof ne?e:typeof e=="string"?ne.fromIso8601(e):ne.addSeconds(t,e,new ne)}const l1=[],u1=[];function pD(e,t,n,i,o){let r=0,s,a,c,u,f,h;for(;r<i.length;){f=GG(i[r],e),c=Cs(t,f,ne.compare);let _=0,g=0;if(c<0){for(c=~c,u=c*o,a=void 0,h=t[c];r<i.length&&(f=GG(i[r],e),!(l(a)&&ne.compare(a,f)>=0||l(h)&&ne.compare(f,h)>=0));){for(l1[_++]=f,r=r+1,s=0;s<o;s++)u1[g++]=i[r],r=r+1;a=f}_>0&&(u1.length=g,kG(n,u,u1),l1.length=_,kG(t,c,l1))}else{for(s=0;s<o;s++)r++,n[c*o+s]=i[r];r++}}}function du(e,t){b.defined("type",e);let n=e;n===Number&&(n=VG);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=VG);const f=u.packedLength;i+=f,o+=A(u.packedInterpolationLength,f),s[c]=u}r=a}this._type=e,this._innerType=n,this._interpolationDegree=1,this._interpolationAlgorithm=EQe,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 $e,this._derivativeTypes=t,this._innerDerivativeTypes=s,this._inputOrder=r,this._forwardExtrapolationType=Zg.NONE,this._forwardExtrapolationDuration=0,this._backwardExtrapolationType=Zg.NONE,this._backwardExtrapolationDuration=0}Object.defineProperties(du.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))}}});du.prototype.getValue=function(e,t){b.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=Cs(n,e,ne.compare);if(a<0){if(a=~a,a===0){const S=n[a];if(o=this._backwardExtrapolationDuration,this._backwardExtrapolationType===Zg.NONE||o!==0&&ne.secondsDifference(S,e)>o)return;if(this._backwardExtrapolationType===Zg.HOLD)return r.unpack(s,0,t)}if(a>=i){a=i-1;const S=n[a];if(o=this._forwardExtrapolationDuration,this._forwardExtrapolationType===Zg.NONE||o!==0&&ne.secondsDifference(e,S)>o)return;if(this._forwardExtrapolationType===Zg.HOLD)return a=i-1,r.unpack(s,a*r.packedLength,t)}const c=this._xTable,u=this._yTable,f=this._interpolationAlgorithm,h=this._packedInterpolationLength,_=this._inputOrder;if(this._updateTableLength){this._updateTableLength=!1;const S=Math.min(f.getRequiredDataPoints(this._interpolationDegree,_),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 T=y-p+1;for(let S=0;S<T;++S)c[S]=ne.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 O=p*P;const z=(y+1)*P;for(;O<z;)u[S]=s[O],O++,S++}const E=ne.secondsDifference(e,n[y]);let w;if(_===0||!l(f.interpolate))w=f.interpolateOrderZero(E,c,u,h,this._interpolationResult);else{const S=Math.floor(h/(_+1));w=f.interpolate(E,c,u,S,_,_,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)};du.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))};du.prototype.addSample=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);b.defined("time",e),b.defined("value",t),o&&b.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)}pD(void 0,this._times,this._values,s,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};du.prototype.addSamples=function(e,t,n){const i=this._innerDerivativeTypes,o=l(i);if(b.defined("times",e),b.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],f=i.length;for(let h=0;h<f;h++)i[h].pack(u[h],a,a.length)}pD(void 0,this._times,this._values,a,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};du.prototype.addSamplesPackedArray=function(e,t){b.defined("packedSamples",e),pD(t,this._times,this._values,e,this._packedLength),this._updateTableLength=!0,this._definitionChanged.raiseEvent(this)};du.prototype.removeSample=function(e){b.defined("time",e);const t=Cs(this._times,e,ne.compare);return t<0?!1:(QQ(this,t,1),!0)};function QQ(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)}du.prototype.removeSamples=function(e){b.defined("timeInterval",e);const t=this._times;let n=Cs(t,e.start,ne.compare);n<0?n=~n:e.isStartIncluded||++n;let i=Cs(t,e.stop,ne.compare);i<0?i=~i:e.isStopIncluded&&++i,QQ(this,n,i-n)};du.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(!ne.equals(a[r],c[r]))return!1;const u=this._values,f=e._values;for(s=u.length,r=0;r<s;r++)if(u[r]!==f[r])return!1;return!0};du._mergeNewSamples=pD;function pc(e,t){t=A(t,0);let n;if(t>0){n=new Array(t);for(let i=0;i<t;i++)n[i]=d}this._numberOfDerivatives=t,this._property=new du(d,n),this._definitionChanged=new $e,this._referenceFrame=A(e,ea.FIXED),this._property._definitionChanged.addEventListener(function(){this._definitionChanged.raiseEvent(this)},this)}Object.defineProperties(pc.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}}});pc.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ea.FIXED,t)};pc.prototype.getValueInReferenceFrame=function(e,t,n){if(b.defined("time",e),b.defined("referenceFrame",t),n=this._property.getValue(e,n),l(n))return Ip.convertToReferenceFrame(e,n,this._referenceFrame,t,n)};pc.prototype.setInterpolationOptions=function(e){this._property.setInterpolationOptions(e)};pc.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)};pc.prototype.addSamples=function(e,t,n){this._property.addSamples(e,t,n)};pc.prototype.addSamplesPackedArray=function(e,t){this._property.addSamplesPackedArray(e,t)};pc.prototype.removeSample=function(e){return this._property.removeSample(e)};pc.prototype.removeSamples=function(e){this._property.removeSamples(e)};pc.prototype.equals=function(e){return this===e||e instanceof pc&&Z.equals(this._property,e._property)&&this._referenceFrame===e._referenceFrame};function mp(e){this._definitionChanged=new $e,this._intervals=new To,this._intervals.changedEvent.addEventListener(mp.prototype._intervalsChanged,this),this._referenceFrame=A(e,ea.FIXED)}Object.defineProperties(mp.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}}});mp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ea.FIXED,t)};mp.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 Ip.convertToReferenceFrame(e,i,this._referenceFrame,t,n)};mp.prototype.equals=function(e){return this===e||e instanceof mp&&this._intervals.equals(e._intervals,Z.equals)&&this._referenceFrame===e._referenceFrame};mp.prototype._intervalsChanged=function(){this._definitionChanged.raiseEvent(this)};function Sa(){this._dataSources=[],this._dataSourceAdded=new $e,this._dataSourceRemoved=new $e,this._dataSourceMoved=new $e}Object.defineProperties(Sa.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}}});Sa.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})};Sa.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};Sa.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=[]};Sa.prototype.contains=function(e){return this.indexOf(e)!==-1};Sa.prototype.indexOf=function(e){return this._dataSources.indexOf(e)};Sa.prototype.get=function(e){if(!l(e))throw new x("index is required.");return this._dataSources[e]};Sa.prototype.getByName=function(e){if(!l(e))throw new x("name is required.");return this._dataSources.filter(function(t){return t.name===e})};function mD(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 ZQ(e,t,n){const i=e._dataSources,o=i.length-1;if(t=N.clamp(t,0,o),n=N.clamp(n,0,o),t===n)return;const r=i[t];i[t]=i[n],i[n]=r,e.dataSourceMoved.raiseEvent(r,n,t)}Sa.prototype.raise=function(e){const t=mD(this._dataSources,e);ZQ(this,t,t+1)};Sa.prototype.lower=function(e){const t=mD(this._dataSources,e);ZQ(this,t,t-1)};Sa.prototype.raiseToTop=function(e){const t=mD(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))};Sa.prototype.lowerToBottom=function(e){const t=mD(this._dataSources,e);t!==0&&(this._dataSources.splice(t,1),this._dataSources.splice(0,0,e),this.dataSourceMoved.raiseEvent(e,0,t))};Sa.prototype.isDestroyed=function(){return!1};Sa.prototype.destroy=function(){return this.removeAll(!0),Ue(this)};function Tf(){this._length=0,this._collections={},this._collectionsArray=[],this.show=!0}Object.defineProperties(Tf.prototype,{length:{get:function(){return this._length}}});Tf.prototype.add=function(e,t){b.defined("primitive",e),l(t)&&b.typeOf.number("zIndex",t),t=A(t,0);let n=this._collections[t];if(!l(n)){n=new No({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};Tf.prototype.set=function(e,t){return b.defined("primitive",e),b.typeOf.number("zIndex",t),t===e._zIndex||(this.remove(e,!0),this.add(e,t)),e};Tf.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};Tf.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};Tf.prototype.contains=function(e){if(!l(e))return!1;const t=this._collections[e._zIndex];return l(t)&&t.contains(e)};Tf.prototype.update=function(e){if(!this.show)return;const t=this._collectionsArray;for(let n=0;n<t.length;n++)t[n].update(e)};Tf.prototype.isDestroyed=function(){return!1};Tf.prototype.destroy=function(){return this.removeAll(),Ue(this)};function k_(e,t){this._primitives=e,this._orderedGroundPrimitives=t,this._dynamicUpdaters=new xt}k_.prototype.add=function(e,t){this._dynamicUpdaters.set(t.id,t.createDynamicUpdater(this._primitives,this._orderedGroundPrimitives))};k_.prototype.remove=function(e){const t=e.id,n=this._dynamicUpdaters.get(t);l(n)&&(this._dynamicUpdaters.remove(t),n.destroy())};k_.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};k_.prototype.removeAllPrimitives=function(){const e=this._dynamicUpdaters.values;for(let t=0,n=e.length;t<n;t++)e[t].destroy();this._dynamicUpdaters.removeAll()};k_.prototype.getBoundingSphere=function(e,t){return e=this._dynamicUpdaters.get(e.id),l(e)&&l(e.getBoundingSphere)?e.getBoundingSphere(t):pt.FAILED};const SF={},gx=new d,WG=new d,jG=new Ce,qG=new J;function Ag(e,t,n,i,o,r,s,a,c,u){const f=e+t;d.multiplyByScalar(i,Math.cos(f),gx),d.multiplyByScalar(n,Math.sin(f),WG),d.add(gx,WG,gx);let h=Math.cos(e);h=h*h;let _=Math.sin(e);_=_*_;const p=r/Math.sqrt(s*h+o*_)/a;return Ce.fromAxisAngle(gx,p,jG),J.fromQuaternion(jG,qG),J.multiplyByVector(qG,c,u),d.normalize(u,u),d.multiplyByScalar(u,a,u),u}const eZ=new d,tZ=new d,JB=new d,xQe=new d;SF.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 f=0;f<c;f+=3){const h=f+1,_=f+2,g=d.fromArray(e,f,eZ);i.scaleToGeodeticSurface(g,g);const p=d.clone(g,tZ),y=i.geodeticSurfaceNormal(g,xQe),C=d.multiplyByScalar(y,o,JB);d.add(g,C,g),n&&(d.multiplyByScalar(y,r,C),d.add(p,C,p),a[f+u]=p.x,a[h+u]=p.y,a[_+u]=p.z),a[f]=g.x,a[h]=g.y,a[_]=g.z}return a};const wQe=new d,SQe=new d,vQe=new d;SF.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,f=o*i,h=d.magnitude(s),_=d.normalize(s,wQe);let g=d.cross(d.UNIT_Z,s,SQe);g=d.normalize(g,g);const p=d.cross(_,g,vQe);let y=1+Math.ceil(N.PI_OVER_TWO/a);const C=N.PI_OVER_TWO/(y-1);let T=N.PI_OVER_TWO-y*C;T<0&&(y-=Math.ceil(Math.abs(T)/C));const E=2*(y*(y+2)),w=t?new Array(E*3):void 0;let S=0,P=eZ,O=tZ;const z=y*4*3;let R=z-1,F=0;const H=n?new Array(z):void 0;let v,I,m,D,L;for(T=N.PI_OVER_TWO,P=Ag(T,r,p,g,c,f,u,h,_,P),t&&(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z),n&&(H[R--]=P.z,H[R--]=P.y,H[R--]=P.x),T=N.PI_OVER_TWO-C,v=1;v<y+1;++v){if(P=Ag(T,r,p,g,c,f,u,h,_,P),O=Ag(Math.PI-T,r,p,g,c,f,u,h,_,O),t){for(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,m=2*v+2,I=1;I<m-1;++I)D=I/(m-1),L=d.lerp(P,O,D,JB),w[S++]=L.x,w[S++]=L.y,w[S++]=L.z;w[S++]=O.x,w[S++]=O.y,w[S++]=O.z}n&&(H[R--]=P.z,H[R--]=P.y,H[R--]=P.x,H[F++]=O.x,H[F++]=O.y,H[F++]=O.z),T=N.PI_OVER_TWO-(v+1)*C}for(v=y;v>1;--v){if(T=N.PI_OVER_TWO-(v-1)*C,P=Ag(-T,r,p,g,c,f,u,h,_,P),O=Ag(T+Math.PI,r,p,g,c,f,u,h,_,O),t){for(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,m=2*(v-1)+2,I=1;I<m-1;++I)D=I/(m-1),L=d.lerp(P,O,D,JB),w[S++]=L.x,w[S++]=L.y,w[S++]=L.z;w[S++]=O.x,w[S++]=O.y,w[S++]=O.z}n&&(H[R--]=P.z,H[R--]=P.y,H[R--]=P.x,H[F++]=O.x,H[F++]=O.y,H[F++]=O.z)}T=N.PI_OVER_TWO,P=Ag(-T,r,p,g,c,f,u,h,_,P);const M={};return t&&(w[S++]=P.x,w[S++]=P.y,w[S++]=P.z,M.positions=w,M.numPts=y),n&&(H[R--]=P.z,H[R--]=P.y,H[R--]=P.x,M.outerPositions=H),M};const gd=SF,Wy=new d,QB=new d,ZB=new d,YG=new d,_r=new j,nZ=new J,DQe=new J,eR=new Ce,iZ=new d,oZ=new d,rZ=new d,GS=new Ae,sZ=new d,aZ=new j,cZ=new j;function lZ(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,f=t.shadowVolume,h=i.st?new Float32Array(u*2):void 0,_=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=f?new Float32Array(u*3):void 0;let C=0,T=iZ,E=oZ,w=rZ;const S=new jo(a),P=S.project(a.cartesianToCartographic(o,GS),sZ),O=a.scaleToGeodeticSurface(o,Wy);a.geodeticSurfaceNormal(O,O);let z=nZ,R=DQe;if(c!==0){let L=Ce.fromAxisAngle(O,c,eR);z=J.fromQuaternion(L,z),L=Ce.fromAxisAngle(O,-c,eR),R=J.fromQuaternion(L,R)}else z=J.clone(J.IDENTITY,z),R=J.clone(J.IDENTITY,R);const F=j.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,aZ),H=j.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,cZ);let v=e.length;const I=n?v:0,m=I/3*2;for(let L=0;L<v;L+=3){const M=L+1,V=L+2,k=d.fromArray(e,L,Wy);if(i.st){const W=J.multiplyByVector(z,k,QB),G=S.project(a.cartesianToCartographic(W,GS),ZB);d.subtract(G,P,G),_r.x=(G.x+r)/(2*r),_r.y=(G.y+s)/(2*s),F.x=Math.min(_r.x,F.x),F.y=Math.min(_r.y,F.y),H.x=Math.max(_r.x,H.x),H.y=Math.max(_r.y,H.y),n&&(h[C+m]=_r.x,h[C+1+m]=_r.y),h[C++]=_r.x,h[C++]=_r.y}(i.normal||i.tangent||i.bitangent||f)&&(T=a.geodeticSurfaceNormal(k,T),f&&(y[L+I]=-T.x,y[M+I]=-T.y,y[V+I]=-T.z),(i.normal||i.tangent||i.bitangent)&&((i.tangent||i.bitangent)&&(E=d.normalize(d.cross(d.UNIT_Z,T,E),E),J.multiplyByVector(R,E,E)),i.normal&&(_[L]=T.x,_[M]=T.y,_[V]=T.z,n&&(_[L+I]=-T.x,_[M+I]=-T.y,_[V+I]=-T.z)),i.tangent&&(g[L]=E.x,g[M]=E.y,g[V]=E.z,n&&(g[L+I]=-E.x,g[M+I]=-E.y,g[V+I]=-E.z)),i.bitangent&&(w=d.normalize(d.cross(T,E,w),w),p[L]=w.x,p[M]=w.y,p[V]=w.z,n&&(p[L+I]=w.x,p[M+I]=w.y,p[V+I]=w.z))))}if(i.st){v=h.length;for(let L=0;L<v;L+=2)h[L]=(h[L]-F.x)/(H.x-F.x),h[L+1]=(h[L+1]-F.y)/(H.y-F.y)}const D=new Ui;if(i.position){const L=gd.raisePositionsToHeight(e,t,n);D.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:L})}if(i.st&&(D.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:h})),i.normal&&(D.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:_})),i.tangent&&(D.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),i.bitangent&&(D.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),f&&(D.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),n&&l(t.offsetAttribute)){let L=new Uint8Array(u);if(t.offsetAttribute===fn.TOP)L=L.fill(1,0,u/2);else{const M=t.offsetAttribute===fn.NONE?0:1;L=L.fill(M)}D.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:L})}return D}function uZ(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 um=new d;function IQe(e){const t=e.center;um=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,um),e.height,um),um=d.add(t,um,um);const n=new fe(um,e.semiMajorAxis),i=gd.computeEllipsePositions(e,!0,!1),o=i.positions,r=i.numPts,s=lZ(o,e,!1);let a=uZ(r);return a=it.createTypedArray(o.length/3,a),{boundingSphere:n,attributes:s,indices:a}}function PQe(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,f=e.length/3*2,h=new Float64Array(f*3),_=n.st?new Float32Array(f*2):void 0,g=n.normal?new Float32Array(f*3):void 0,p=n.tangent?new Float32Array(f*3):void 0,y=n.bitangent?new Float32Array(f*3):void 0,C=t.shadowVolume,T=C?new Float32Array(f*3):void 0;let E=0,w=iZ,S=oZ,P=rZ;const O=new jo(s),z=O.project(s.cartesianToCartographic(i,GS),sZ),R=s.scaleToGeodeticSurface(i,Wy);s.geodeticSurfaceNormal(R,R);const F=Ce.fromAxisAngle(R,u,eR),H=J.fromQuaternion(F,nZ),v=j.fromElements(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,aZ),I=j.fromElements(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,cZ);let m=e.length;const D=m/3*2;for(let M=0;M<m;M+=3){const V=M+1,k=M+2;let W=d.fromArray(e,M,Wy),G;if(n.st){const q=J.multiplyByVector(H,W,QB),te=O.project(s.cartesianToCartographic(q,GS),ZB);d.subtract(te,z,te),_r.x=(te.x+o)/(2*o),_r.y=(te.y+r)/(2*r),v.x=Math.min(_r.x,v.x),v.y=Math.min(_r.y,v.y),I.x=Math.max(_r.x,I.x),I.y=Math.max(_r.y,I.y),_[E+D]=_r.x,_[E+1+D]=_r.y,_[E++]=_r.x,_[E++]=_r.y}W=s.scaleToGeodeticSurface(W,W),G=d.clone(W,QB),w=s.geodeticSurfaceNormal(W,w),C&&(T[M+m]=-w.x,T[V+m]=-w.y,T[k+m]=-w.z);let K=d.multiplyByScalar(w,a,YG);if(W=d.add(W,K,W),K=d.multiplyByScalar(w,c,K),G=d.add(G,K,G),n.position&&(h[M+m]=G.x,h[V+m]=G.y,h[k+m]=G.z,h[M]=W.x,h[V]=W.y,h[k]=W.z),n.normal||n.tangent||n.bitangent){P=d.clone(w,P);const q=d.fromArray(e,(M+3)%m,YG);d.subtract(q,W,q);const te=d.subtract(G,W,ZB);w=d.normalize(d.cross(te,q,w),w),n.normal&&(g[M]=w.x,g[V]=w.y,g[k]=w.z,g[M+m]=w.x,g[V+m]=w.y,g[k+m]=w.z),n.tangent&&(S=d.normalize(d.cross(P,w,S),S),p[M]=S.x,p[V]=S.y,p[k]=S.z,p[M+m]=S.x,p[M+1+m]=S.y,p[M+2+m]=S.z),n.bitangent&&(y[M]=P.x,y[V]=P.y,y[k]=P.z,y[M+m]=P.x,y[V+m]=P.y,y[k+m]=P.z)}}if(n.st){m=_.length;for(let M=0;M<m;M+=2)_[M]=(_[M]-v.x)/(I.x-v.x),_[M+1]=(_[M+1]-v.y)/(I.y-v.y)}const L=new Ui;if(n.position&&(L.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h})),n.st&&(L.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:_})),n.normal&&(L.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:g})),n.tangent&&(L.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),n.bitangent&&(L.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),C&&(L.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:T})),l(t.offsetAttribute)){let M=new Uint8Array(f);if(t.offsetAttribute===fn.TOP)M=M.fill(1,0,f/2);else{const V=t.offsetAttribute===fn.NONE?0:1;M=M.fill(V)}L.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:M})}return L}function OQe(e){const t=e.length/3,n=it.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 yx=new fe,Ax=new fe;function LQe(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,Wy),e.height,Wy);yx.center=d.add(t,o,yx.center),yx.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),Ax.center=d.add(t,o,Ax.center),Ax.radius=i;const r=gd.computeEllipsePositions(e,!0,!0),s=r.positions,a=r.numPts,c=r.outerPositions,u=fe.union(yx,Ax),f=lZ(s,e,!0);let h=uZ(a);const _=h.length;h.length=_*2;const g=s.length/3;for(let S=0;S<_;S+=3)h[S+_]=h[S+2]+g,h[S+1+_]=h[S+1]+g,h[S+2+_]=h[S]+g;const p=it.createTypedArray(g*2/3,h),y=new Dt({attributes:f,indices:p,primitiveType:Je.TRIANGLES}),C=PQe(c,e);h=OQe(c);const T=it.createTypedArray(c.length*2/3,h),E=new Dt({attributes:C,indices:T,primitiveType:Je.TRIANGLES}),w=Ri.combineInstances([new nn({geometry:y}),new nn({geometry:E})]);return{boundingSphere:u,attributes:w[0].attributes,indices:w[0].indices}}function fZ(e,t,n,i,o,r,s){const c=gd.computeEllipsePositions({center:e,semiMajorAxis:t,semiMinorAxis:n,rotation:i,granularity:o},!1,!0).outerPositions,u=c.length/3,f=new Array(u);for(let _=0;_<u;++_)f[_]=d.fromArray(c,_*3);const h=_e.fromCartesianArray(f,r,s);return h.width>N.PI&&(h.north=h.north>0?N.PI_OVER_TWO-N.EPSILON7:h.north,h.south=h.south<0?N.EPSILON7-N.PI_OVER_TWO:h.south,h.east=N.PI,h.west=-N.PI),h}function rl(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,pe.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,N.RADIANS_PER_DEGREE),s=A(e.vertexFormat,Ne.DEFAULT);if(b.defined("options.center",t),b.typeOf.number("options.semiMajorAxis",i),b.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=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=pe.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=Ne.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}rl.packedLength=d.packedLength+pe.packedLength+Ne.packedLength+9;rl.pack=function(e,t,n){return b.defined("value",e),b.defined("array",t),n=A(n,0),d.pack(e._center,t,n),n+=d.packedLength,pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.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 dZ=new d,hZ=new pe,pZ=new Ne,Tu={center:dZ,ellipsoid:hZ,vertexFormat:pZ,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};rl.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=d.unpack(e,t,dZ);t+=d.packedLength;const o=pe.unpack(e,t,hZ);t+=pe.packedLength;const r=Ne.unpack(e,t,pZ);t+=Ne.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t++],g=e[t++]===1,p=e[t];return l(n)?(n._center=d.clone(i,n._center),n._ellipsoid=pe.clone(o,n._ellipsoid),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._semiMajorAxis=s,n._semiMinorAxis=a,n._rotation=c,n._stRotation=u,n._height=f,n._granularity=h,n._extrudedHeight=_,n._shadowVolume=g,n._offsetAttribute=p===-1?void 0:p,n):(Tu.height=f,Tu.extrudedHeight=_,Tu.granularity=h,Tu.stRotation=u,Tu.rotation=c,Tu.semiMajorAxis=s,Tu.semiMinorAxis=a,Tu.shadowVolume=g,Tu.offsetAttribute=p===-1?void 0:p,new rl(Tu))};rl.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.center,i=A(e.ellipsoid,pe.WGS84),o=e.semiMajorAxis,r=e.semiMinorAxis,s=A(e.granularity,N.RADIANS_PER_DEGREE),a=A(e.rotation,0);if(b.defined("options.center",n),b.typeOf.number("options.semiMajorAxis",o),b.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 fZ(n,o,r,a,s,i,t)};rl.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!N.equalsEpsilon(t,n,0,N.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=LQe(o);else if(r=IQe(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===fn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Dt({attributes:r.attributes,indices:r.indices,primitiveType:Je.TRIANGLES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};rl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new rl({center:e._center,semiMajorAxis:e._semiMajorAxis,semiMinorAxis:e._semiMinorAxis,ellipsoid:o,rotation:e._rotation,stRotation:e._stRotation,granularity:i,extrudedHeight:r,height:s,vertexFormat:Ne.POSITION_ONLY,shadowVolume:!0})};function BQe(e){const t=-e._stRotation;if(t===0)return[0,0,0,1,1,0];const i=gd.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]=d.fromArray(i,c*3);const s=e._ellipsoid,a=e.rectangle;return Dt._textureCoordinateRotationPoints(r,t,s,a)}Object.defineProperties(rl.prototype,{rectangle:{get:function(){return l(this._rectangle)||(this._rectangle=fZ(this._center,this._semiMajorAxis,this._semiMinorAxis,this._rotation,this._granularity,this._ellipsoid)),this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=BQe(this)),this._textureCoordinateRotationPoints}}});const $G=new d;let fm=new d;function RQe(e){const t=e.center;fm=d.multiplyByScalar(e.ellipsoid.geodeticSurfaceNormal(t,fm),e.height,fm),fm=d.add(t,fm,fm);const n=new fe(fm,e.semiMajorAxis),i=gd.computeEllipsePositions(e,!1,!0).outerPositions,o=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:gd.raisePositionsToHeight(i,e,!1)})}),r=i.length/3,s=it.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 Cx=new fe,Tx=new fe;function NQe(e){const t=e.center,n=e.ellipsoid,i=e.semiMajorAxis;let o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,$G),e.height,$G);Cx.center=d.add(t,o,Cx.center),Cx.radius=i,o=d.multiplyByScalar(n.geodeticSurfaceNormal(t,o),e.extrudedHeight,o),Tx.center=d.add(t,o,Tx.center),Tx.radius=i;let r=gd.computeEllipsePositions(e,!1,!0).outerPositions;const s=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:gd.raisePositionsToHeight(r,e,!0)})});r=s.position.values;const a=fe.union(Cx,Tx);let c=r.length/3;if(l(e.offsetAttribute)){let p=new Uint8Array(c);if(e.offsetAttribute===fn.TOP)p=p.fill(1,0,c/2);else{const y=e.offsetAttribute===fn.NONE?0:1;p=p.fill(y)}s.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:p})}let u=A(e.numberOfVerticalLines,16);u=N.clamp(u,0,c/2);const f=it.createTypedArray(c,c*2+u*2);c/=2;let h=0,_;for(_=0;_<c;++_)f[h++]=_,f[h++]=(_+1)%c,f[h++]=_+c,f[h++]=(_+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(_=0;_<y;_+=g)f[h++]=_,f[h++]=_+c}return{boundingSphere:a,attributes:s,indices:f}}function jy(e){e=A(e,A.EMPTY_OBJECT);const t=e.center,n=A(e.ellipsoid,pe.WGS84),i=e.semiMajorAxis,o=e.semiMinorAxis,r=A(e.granularity,N.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=d.clone(t),this._semiMajorAxis=i,this._semiMinorAxis=o,this._ellipsoid=pe.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"}jy.packedLength=d.packedLength+pe.packedLength+8;jy.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),d.pack(e._center,t,n),n+=d.packedLength,pe.pack(e._ellipsoid,t,n),n+=pe.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 mZ=new d,_Z=new pe,Lf={center:mZ,ellipsoid:_Z,semiMajorAxis:void 0,semiMinorAxis:void 0,rotation:void 0,height:void 0,granularity:void 0,extrudedHeight:void 0,numberOfVerticalLines:void 0,offsetAttribute:void 0};jy.unpack=function(e,t,n){if(!l(e))throw new x("array is required");t=A(t,0);const i=d.unpack(e,t,mZ);t+=d.packedLength;const o=pe.unpack(e,t,_Z);t+=pe.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++],_=e[t];return l(n)?(n._center=d.clone(i,n._center),n._ellipsoid=pe.clone(o,n._ellipsoid),n._semiMajorAxis=r,n._semiMinorAxis=s,n._rotation=a,n._height=c,n._granularity=u,n._extrudedHeight=f,n._numberOfVerticalLines=h,n._offsetAttribute=_===-1?void 0:_,n):(Lf.height=c,Lf.extrudedHeight=f,Lf.granularity=u,Lf.rotation=a,Lf.semiMajorAxis=r,Lf.semiMinorAxis=s,Lf.numberOfVerticalLines=h,Lf.offsetAttribute=_===-1?void 0:_,new jy(Lf))};jy.createGeometry=function(e){if(e._semiMajorAxis<=0||e._semiMinorAxis<=0)return;const t=e._height,n=e._extrudedHeight,i=!N.equalsEpsilon(t,n,0,N.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=NQe(o);else if(r=RQe(o),l(e._offsetAttribute)){const s=r.attributes.position.values.length,a=e._offsetAttribute===fn.NONE?0:1,c=new Uint8Array(s/3).fill(a);r.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:c})}return new Dt({attributes:r.attributes,indices:r.indices,primitiveType:Je.LINES,boundingSphere:r.boundingSphere,offsetAttribute:e._offsetAttribute})};const gZ=new U,yZ=d.ZERO,AZ=new d,CZ=new _e;function MQe(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 Vl(e,t){Yt.call(this,{entity:e,scene:t,geometryOptions:new MQe(e),geometryPropertyName:"ellipse",observedPropertyNames:["availability","position","ellipse"]}),this._onEntityPropertyChanged(e,"ellipse",e.ellipse,void 0)}l(Object.create)&&(Vl.prototype=Object.create(Yt.prototype),Vl.prototype.constructor=Vl);Vl.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:_i.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Jt){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,gZ)),l(o)||(o=U.WHITE),i.color=an.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,yZ,AZ))),new nn({id:t,geometry:new rl(this._options),attributes:i})};Vl.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,gZ),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,yZ,AZ))),new nn({id:t,geometry:new jy(this._options),attributes:r})};Vl.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};Vl.prototype._isHidden=function(e,t){const n=e.position;return!l(n)||!l(t.semiMajorAxis)||!l(t.semiMinorAxis)||Nn.prototype._isHidden.call(this,e,t)};Vl.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 Jt)};Vl.prototype._setStaticOptions=function(e,t){let n=Z.getValueOrUndefined(t.height,lt.MINIMUM_VALUE);const i=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE);let o=Z.getValueOrUndefined(t.extrudedHeight,lt.MINIMUM_VALUE);const r=Z.getValueOrDefault(t.extrudedHeightReference,lt.MINIMUM_VALUE,Et.NONE);l(o)&&!l(n)&&(n=0);const s=this._options;s.vertexFormat=this._materialProperty instanceof Jt?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,s.center=e.position.getValue(lt.MINIMUM_VALUE,s.center),s.semiMajorAxis=t.semiMajorAxis.getValue(lt.MINIMUM_VALUE,s.semiMajorAxis),s.semiMinorAxis=t.semiMinorAxis.getValue(lt.MINIMUM_VALUE,s.semiMinorAxis),s.rotation=Z.getValueOrUndefined(t.rotation,lt.MINIMUM_VALUE),s.granularity=Z.getValueOrUndefined(t.granularity,lt.MINIMUM_VALUE),s.stRotation=Z.getValueOrUndefined(t.stRotation,lt.MINIMUM_VALUE),s.numberOfVerticalLines=Z.getValueOrUndefined(t.numberOfVerticalLines,lt.MINIMUM_VALUE),s.offsetAttribute=Yt.computeGeometryOffsetAttribute(n,i,o,r),s.height=Yt.getGeometryHeight(n,i),o=Yt.getGeometryExtrudedHeight(o,r),o===Yt.CLAMP_TO_GROUND&&(o=Qi.getMinimumMaximumHeights(rl.computeRectangle(s,CZ)).minimumTerrainHeight),s.extrudedHeight=o};Vl.DynamicGeometryUpdater=_y;function _y(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(_y.prototype=Object.create(si.prototype),_y.prototype.constructor=_y);_y.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.center)||!l(i.semiMajorAxis)||!l(i.semiMinorAxis)||si.prototype._isHidden.call(this,e,t,n)};_y.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,Et.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,Et.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=Yt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Yt.getGeometryHeight(o,r),s=Yt.getGeometryExtrudedHeight(s,a),s===Yt.CLAMP_TO_GROUND&&(s=Qi.getMinimumMaximumHeights(rl.computeRectangle(i,CZ)).minimumTerrainHeight),i.extrudedHeight=s};const FQe=new Jt(U.WHITE),vF=d.ZERO,DF=new d,zQe=new d,UQe=new d,IF=new U,HQe=new d(1,1,1);function VQe(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 oc(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new VQe(e),geometryPropertyName:"ellipsoid",observedPropertyNames:["availability","position","orientation","ellipsoid"]}),this._onEntityPropertyChanged(e,"ellipsoid",e.ellipsoid,void 0)}l(Object.create)&&(oc.prototype=Object.create(Nn.prototype),oc.prototype.constructor=oc);Object.defineProperties(oc.prototype,{terrainOffsetProperty:{get:function(){return this._terrainOffsetProperty}}});oc.prototype.createFillGeometryInstance=function(e,t,n){b.defined("time",e);const i=this._entity,o=i.isAvailable(e);let r;const s=new Hn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),a=this._distanceDisplayConditionProperty.getValue(e),c=_i.fromDistanceDisplayCondition(a),u={show:s,distanceDisplayCondition:c,color:void 0,offset:void 0};if(this._materialProperty instanceof Jt){let f;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||o)&&(f=this._materialProperty.color.getValue(e,IF)),l(f)||(f=U.WHITE),r=an.fromColor(f),u.color=r}return l(this._options.offsetAttribute)&&(u.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,vF,DF))),new nn({id:i,geometry:new Za(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:u})};oc.prototype.createOutlineGeometryInstance=function(e,t,n){b.defined("time",e);const i=this._entity,o=i.isAvailable(e),r=Z.getValueOrDefault(this._outlineColorProperty,e,U.BLACK,IF),s=this._distanceDisplayConditionProperty.getValue(e),a={show:new Hn(o&&i.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(r),distanceDisplayCondition:_i.fromDistanceDisplayCondition(s),offset:void 0};return l(this._options.offsetAttribute)&&(a.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,vF,DF))),new nn({id:i,geometry:new cc(this._options),modelMatrix:t?void 0:i.computeModelMatrixForHeightReference(e,i.ellipsoid.heightReference,this._options.radii.z*.5,this._scene.mapProjection.ellipsoid,n),attributes:a})};oc.prototype._computeCenter=function(e,t){return Z.getValueOrUndefined(this._entity.position,e,t)};oc.prototype._isHidden=function(e,t){return!l(e.position)||!l(t.radii)||Nn.prototype._isHidden.call(this,e,t)};oc.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)};oc.prototype._setStaticOptions=function(e,t){const n=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE),i=this._options;i.vertexFormat=this._materialProperty instanceof Jt?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,i.radii=t.radii.getValue(lt.MINIMUM_VALUE,i.radii),i.innerRadii=Z.getValueOrUndefined(t.innerRadii,i.radii),i.minimumClock=Z.getValueOrUndefined(t.minimumClock,lt.MINIMUM_VALUE),i.maximumClock=Z.getValueOrUndefined(t.maximumClock,lt.MINIMUM_VALUE),i.minimumCone=Z.getValueOrUndefined(t.minimumCone,lt.MINIMUM_VALUE),i.maximumCone=Z.getValueOrUndefined(t.maximumCone,lt.MINIMUM_VALUE),i.stackPartitions=Z.getValueOrUndefined(t.stackPartitions,lt.MINIMUM_VALUE),i.slicePartitions=Z.getValueOrUndefined(t.slicePartitions,lt.MINIMUM_VALUE),i.subdivisions=Z.getValueOrUndefined(t.subdivisions,lt.MINIMUM_VALUE),i.offsetAttribute=n!==Et.NONE?fn.ALL:void 0};oc.prototype._onEntityPropertyChanged=BM;oc.DynamicGeometryUpdater=bC;function bC(e,t,n){si.call(this,e,t,n),this._scene=e._scene,this._modelMatrix=new B,this._attributes=void 0,this._outlineAttributes=void 0,this._lastSceneMode=void 0,this._lastShow=void 0,this._lastOutlineShow=void 0,this._lastOutlineWidth=void 0,this._lastOutlineColor=void 0,this._lastOffset=new d,this._material={}}l(Object.create)&&(bC.prototype=Object.create(si.prototype),bC.prototype.constructor=bC);bC.prototype.update=function(e){b.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,zQe);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,U.BLACK,IF),c=Ar.getValue(e,A(n.material,FQe),this._material),u=Z.getValueOrUndefined(n.innerRadii,e,UQe),f=Z.getValueOrUndefined(n.minimumClock,e),h=Z.getValueOrUndefined(n.maximumClock,e),_=Z.getValueOrUndefined(n.minimumCone,e),g=Z.getValueOrUndefined(n.maximumCone,e),p=Z.getValueOrUndefined(n.stackPartitions,e),y=Z.getValueOrUndefined(n.slicePartitions,e),C=Z.getValueOrUndefined(n.subdivisions,e),T=Z.getValueOrDefault(n.outlineWidth,e,1),E=Z.getValueOrDefault(n.heightReference,e,Et.NONE),w=E!==Et.NONE?fn.ALL:void 0,S=this._scene.mode,P=S===le.SCENE3D&&E===Et.NONE,O=this._options,z=this._geometryUpdater.shadowsProperty.getValue(e),F=this._geometryUpdater.distanceDisplayConditionProperty.getValue(e),H=Z.getValueOrDefault(this._geometryUpdater.terrainOffsetProperty,e,vF,DF);if(!P||this._lastSceneMode!==S||!l(this._primitive)||O.stackPartitions!==p||O.slicePartitions!==y||l(u)&&!d.equals(O.innerRadii!==u)||O.minimumClock!==f||O.maximumClock!==h||O.minimumCone!==_||O.maximumCone!==g||O.subdivisions!==C||this._lastOutlineWidth!==T||O.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=T,O.stackPartitions=p,O.slicePartitions=y,O.subdivisions=C,O.offsetAttribute=w,O.radii=d.clone(P?HQe:i,O.radii),l(u))if(P){const M=d.magnitude(i);O.innerRadii=d.fromElements(u.x/M,u.y/M,u.z/M,O.innerRadii)}else O.innerRadii=d.clone(u,O.innerRadii);else O.innerRadii=void 0;O.minimumClock=f,O.maximumClock=h,O.minimumCone=_,O.maximumCone=g;const m=new Ho({material:c,translucent:c.isTranslucent(),closed:!0});O.vertexFormat=m.vertexFormat;const D=this._geometryUpdater.createFillGeometryInstance(e,P,this._modelMatrix);this._primitive=I.add(new Wt({geometryInstances:D,appearance:m,asynchronous:!1,shadows:z}));const L=this._geometryUpdater.createOutlineGeometryInstance(e,P,this._modelMatrix);this._outlinePrimitive=I.add(new Wt({geometryInstances:L,appearance:new _n({flat:!0,translucent:L.attributes.color.value[3]!==255,renderState:{lineWidth:this._geometryUpdater._scene.clampLineWidth(T)}}),asynchronous:!1,shadows:z})),this._lastShow=r,this._lastOutlineShow=s,this._lastOutlineColor=U.clone(a,this._lastOutlineColor),this._lastDistanceDisplayCondition=F,this._lastOffset=d.clone(H,this._lastOffset)}else if(this._primitive.ready){const I=this._primitive,m=this._outlinePrimitive;I.show=!0,m.show=!0,I.appearance.material=c;let D=this._attributes;l(D)||(D=I.getGeometryInstanceAttributes(t),this._attributes=D),r!==this._lastShow&&(D.show=Hn.toValue(r,D.show),this._lastShow=r);let L=this._outlineAttributes;l(L)||(L=m.getGeometryInstanceAttributes(t),this._outlineAttributes=L),s!==this._lastOutlineShow&&(L.show=Hn.toValue(s,L.show),this._lastOutlineShow=s),U.equals(a,this._lastOutlineColor)||(L.color=an.toValue(a,L.color),U.clone(a,this._lastOutlineColor)),Ut.equals(F,this._lastDistanceDisplayCondition)||(D.distanceDisplayCondition=_i.toValue(F,D.distanceDisplayCondition),L.distanceDisplayCondition=_i.toValue(F,L.distanceDisplayCondition),Ut.clone(F,this._lastDistanceDisplayCondition)),d.equals(H,this._lastOffset)||(D.offset=Ro.toValue(H,D.offset),L.offset=Ro.toValue(H,D.offset),d.clone(H,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 qy(e){e=A(e,A.EMPTY_OBJECT);const t=A(e.vertexFormat,Ne.DEFAULT);this._vertexFormat=t,this._workerName="createPlaneGeometry"}qy.packedLength=Ne.packedLength;qy.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),Ne.pack(e._vertexFormat,t,n),t};const TZ=new Ne,kQe={vertexFormat:TZ};qy.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=Ne.unpack(e,t,TZ);return l(n)?(n._vertexFormat=Ne.clone(i,n._vertexFormat),n):new qy(kQe)};const bx=new d(-.5,-.5,0),Ex=new d(.5,.5,0);qy.createGeometry=function(e){const t=e._vertexFormat,n=new Ui;let i,o;if(t.position){if(o=new Float64Array(4*3),o[0]=bx.x,o[1]=bx.y,o[2]=0,o[3]=Ex.x,o[4]=bx.y,o[5]=0,o[6]=Ex.x,o[7]=Ex.y,o[8]=0,o[9]=bx.x,o[10]=Ex.y,o[11]=0,n.position=new ze({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 ze({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 ze({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 ze({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 ze({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 Dt({attributes:n,indices:i,primitiveType:Je.TRIANGLES,boundingSphere:new fe(d.ZERO,Math.sqrt(2))})};function Yy(){this._workerName="createPlaneOutlineGeometry"}Yy.packedLength=0;Yy.pack=function(e,t){return b.defined("value",e),b.defined("array",t),t};Yy.unpack=function(e,t,n){return b.defined("array",e),l(n)?n:new Yy};const fh=new d(-.5,-.5,0),xx=new d(.5,.5,0);Yy.createGeometry=function(){const e=new Ui,t=new Uint16Array(4*2),n=new Float64Array(4*3);return n[0]=fh.x,n[1]=fh.y,n[2]=fh.z,n[3]=xx.x,n[4]=fh.y,n[5]=fh.z,n[6]=xx.x,n[7]=xx.y,n[8]=fh.z,n[9]=fh.x,n[10]=xx.y,n[11]=fh.z,e.position=new ze({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 Dt({attributes:e,indices:t,primitiveType:Je.LINES,boundingSphere:new fe(d.ZERO,Math.sqrt(2))})};const GQe=new d,bZ=new U;function WQe(e){this.id=e,this.vertexFormat=void 0,this.plane=void 0,this.dimensions=void 0}function Qc(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new WQe(e),geometryPropertyName:"plane",observedPropertyNames:["availability","position","orientation","plane"]}),this._onEntityPropertyChanged(e,"plane",e.plane,void 0)}l(Object.create)&&(Qc.prototype=Object.create(Nn.prototype),Qc.prototype.constructor=Qc);Qc.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=_i.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Jt){let g;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(g=this._materialProperty.color.getValue(e,bZ)),l(g)||(g=U.WHITE),o=an.fromColor(g),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};const c=t.plane,u=this._options;let f=t.computeModelMatrix(e);const h=Z.getValueOrDefault(c.plane,e,u.plane),_=Z.getValueOrUndefined(c.dimensions,e,u.dimensions);return u.plane=h,u.dimensions=_,f=PF(h,_,f,f),new nn({id:t,geometry:new qy(this._options),modelMatrix:f,attributes:i})};Qc.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,bZ),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=PF(c,u,a,a),new nn({id:t,geometry:new Yy,modelMatrix:a,attributes:{show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o)}})};Qc.prototype._isHidden=function(e,t){return!l(t.plane)||!l(t.dimensions)||!l(e.position)||Nn.prototype._isHidden.call(this,e,t)};Qc.prototype._getIsClosed=function(e){return!1};Qc.prototype._isDynamic=function(e,t){return!e.position.isConstant||!Z.isConstant(e.orientation)||!t.plane.isConstant||!t.dimensions.isConstant||!Z.isConstant(t.outlineWidth)};Qc.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Jt,i=this._options;i.vertexFormat=n?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,i.plane=t.plane.getValue(lt.MINIMUM_VALUE,i.plane),i.dimensions=t.dimensions.getValue(lt.MINIMUM_VALUE,i.dimensions)};Qc.DynamicGeometryUpdater=gy;function gy(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(gy.prototype=Object.create(si.prototype),gy.prototype.constructor=gy);gy.prototype._isHidden=function(e,t,n){const i=this._options,o=Z.getValueOrUndefined(e.position,n,GQe);return!l(o)||!l(i.plane)||!l(i.dimensions)||si.prototype._isHidden.call(this,e,t,n)};gy.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 jQe=new d,qQe=new d,YQe=new d,$Qe=new d,XQe=new J,KQe=new J,JQe=new B;function PF(e,t,n,i){const o=e.normal,r=e.distance,s=d.multiplyByScalar(o,-r,YQe);let a=d.clone(d.UNIT_Z,qQe);N.equalsEpsilon(Math.abs(d.dot(a,o)),1,N.EPSILON8)&&(a=d.clone(d.UNIT_Y,a));const c=d.cross(a,o,jQe);a=d.cross(o,c,a),d.normalize(c,c),d.normalize(a,a);const u=XQe;J.setColumn(u,0,c,u),J.setColumn(u,1,a,u),J.setColumn(u,2,o,u);const f=d.fromElements(t.x,t.y,1,$Qe),h=J.multiplyByScale(u,f,KQe),_=B.fromRotationTranslation(h,s,JQe);return B.multiplyTransformation(n,_,i)}Qc.createPrimitiveMatrix=PF;const QQe=new d,ZQe=new qe,eZe=new j,tZe=new j,nZe=new d,iZe=new d,oZe=new d,CA=new d,rZe=new d,sZe=new d,XG=new Ce,aZe=new J,cZe=new J,lZe=new d;function uZe(e,t,n,i,o,r,s,a,c){const u=e.positions;let f=Wi.triangulate(e.positions2D,e.holes);f.length<3&&(f=[0,1,2]);const h=it.createTypedArray(u.length,f.length);h.set(f);let _=aZe;if(i!==0){let v=Ce.fromAxisAngle(s,i,XG);if(_=J.fromQuaternion(v,_),t.tangent||t.bitangent){v=Ce.fromAxisAngle(s,-i,XG);const I=J.fromQuaternion(v,cZe);a=d.normalize(J.multiplyByVector(I,a,a),a),t.bitangent&&(c=d.normalize(d.cross(s,a,c),c))}}else _=J.clone(J.IDENTITY,_);const g=tZe;t.st&&(g.x=n.x,g.y=n.y);const p=u.length,y=p*3,C=new Float64Array(y),T=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,O=0,z=0,R=0,F=0;for(let v=0;v<p;v++){const I=u[v];if(C[P++]=I.x,C[P++]=I.y,C[P++]=I.z,t.st)if(l(o)&&o.positions.length===p)S[F++]=o.positions[v].x,S[F++]=o.positions[v].y;else{const m=J.multiplyByVector(_,I,QQe),D=r(m,eZe);j.subtract(D,g,D);const L=N.clamp(D.x/n.width,0,1),M=N.clamp(D.y/n.height,0,1);S[F++]=L,S[F++]=M}t.normal&&(T[O++]=s.x,T[O++]=s.y,T[O++]=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 H=new Ui;return t.position&&(H.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:C})),t.normal&&(H.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:T})),t.tangent&&(H.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(H.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:w})),t.st&&(H.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:S})),new Dt({attributes:H,indices:h,primitiveType:Je.TRIANGLES})}function a_(e){e=A(e,A.EMPTY_OBJECT);const t=e.polygonHierarchy,n=e.textureCoordinates;b.defined("options.polygonHierarchy",t);const i=A(e.vertexFormat,Ne.DEFAULT);this._vertexFormat=Ne.clone(i),this._polygonHierarchy=t,this._stRotation=A(e.stRotation,0),this._ellipsoid=pe.clone(A(e.ellipsoid,pe.WGS84)),this._workerName="createCoplanarPolygonGeometry",this._textureCoordinates=n,this.packedLength=Rn.computeHierarchyPackedLength(t,d)+Ne.packedLength+pe.packedLength+(l(n)?Rn.computeHierarchyPackedLength(n,j):1)+2}a_.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),b.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 a_(t)};a_.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),n=Rn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.packedLength,t[n++]=e._stRotation,l(e._textureCoordinates)?n=Rn.packPolygonHierarchy(e._textureCoordinates,t,n,j):t[n++]=-1,t[n++]=e.packedLength,t};const fZe=pe.clone(pe.UNIT_SPHERE),dZe=new Ne,hZe={polygonHierarchy:{}};a_.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=Rn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=pe.unpack(e,t,fZe);t+=pe.packedLength;const r=Ne.unpack(e,t,dZe);t+=Ne.packedLength;const s=e[t++],a=e[t]===-1?void 0:Rn.unpackPolygonHierarchy(e,t,j);l(a)?(t=a.startingIndex,delete a.startingIndex):t++;const c=e[t++];return l(n)||(n=new a_(hZe)),n._polygonHierarchy=i,n._ellipsoid=pe.clone(o,n._ellipsoid),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._stRotation=s,n._textureCoordinates=a,n.packedLength=c,n};a_.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=Zs(s,d.equalsEpsilon,!0),s.length<3)return;let a=nZe,c=iZe,u=oZe,f=rZe;const h=sZe;if(!Pw.computeProjectTo2DArguments(s,CA,f,h))return;if(a=d.cross(f,h,a),a=d.normalize(a,a),!d.equalsEpsilon(CA,d.ZERO,N.EPSILON6)){const F=e._ellipsoid.geodeticSurfaceNormal(CA,lZe);d.dot(a,F)<0&&(a=d.negate(a,a),f=d.negate(f,f))}const g=Pw.createProjectPointsTo2DFunction(CA,f,h),p=Pw.createProjectPointTo2DFunction(CA,f,h);t.tangent&&(c=d.clone(f,c)),t.bitangent&&(u=d.clone(h,u));const y=Rn.polygonsFromHierarchy(n,r,g,!1),C=y.hierarchy,T=y.polygons,E=function(F){return F},w=r?Rn.polygonsFromHierarchy(o,!0,E,!1).polygons:void 0;if(C.length===0)return;s=C[0].outerRing;const S=fe.fromPoints(s),P=Rn.computeBoundingRectangle(a,p,s,i,ZQe),O=[];for(let F=0;F<T.length;F++){const H=new nn({geometry:uZe(T[F],t,P,i,r?w[F]:void 0,p,a,c,u)});O.push(H)}const z=Ri.combineInstances(O)[0];z.attributes.position.values=new Float64Array(z.attributes.position.values),z.indices=it.createTypedArray(z.attributes.position.values.length/3,z.indices);const R=z.attributes;return t.position||delete R.position,new Dt({attributes:R,indices:z.indices,primitiveType:z.primitiveType,boundingSphere:S})};const pZe=new Ae,KG=new Ae;function mZe(e,t,n,i){const r=i.cartesianToCartographic(e,pZe).height,s=i.cartesianToCartographic(t,KG);s.height=r,i.cartographicToCartesian(s,t);const a=i.cartesianToCartographic(n,KG);a.height=r-100,i.cartographicToCartesian(a,n)}const _Ze=new qe,gZe=new d,yZe=new d,AZe=new d,CZe=new d,TZe=new d,bZe=new d;let wx=new d,bu=new d,Cg=new d;const EZe=new j,xZe=new j,wZe=new d,JG=new Ce,SZe=new J,vZe=new J;function f1(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 f=e.boundingRectangle,h=e.tangentPlane,_=e.ellipsoid,g=e.stRotation,p=e.perPositionHeight,y=EZe;y.x=f.x,y.y=f.y;const C=t.st?new Float32Array(2*(s/3)):void 0;let T;t.normal&&(p&&c&&!a?T=n.attributes.normal.values:T=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,O=0,z=yZe,R=AZe,F=CZe,H=!0,v=SZe,I=vZe;if(g!==0){let L=Ce.fromAxisAngle(h._plane.normal,g,JG);v=J.fromQuaternion(L,v),L=Ce.fromAxisAngle(h._plane.normal,-g,JG),I=J.fromQuaternion(L,I)}else v=J.clone(J.IDENTITY,v),I=J.clone(J.IDENTITY,I);let m=0,D=0;c&&u&&(m=s/2,D=s/3,s/=2);for(let L=0;L<s;L+=3){const M=d.fromArray(o,L,wZe);if(t.st&&!l(r)){let V=J.multiplyByVector(v,M,gZe);V=_.scaleToGeodeticSurface(V,V);const k=h.projectPointOntoPlane(V,xZe);j.subtract(k,y,k);const W=N.clamp(k.x/f.width,0,1),G=N.clamp(k.y/f.height,0,1);u&&(C[P+D]=W,C[P+1+D]=G),c&&(C[P]=W,C[P+1]=G),P+=2}if(t.normal||t.tangent||t.bitangent||i){const V=O+1,k=O+2;if(a){if(L+3<s){const W=d.fromArray(o,L+3,TZe);if(H){const G=d.fromArray(o,L+s,bZe);p&&mZe(M,W,G,_),d.subtract(W,M,W),d.subtract(G,M,G),z=d.normalize(d.cross(G,W,z),z),H=!1}d.equalsEpsilon(W,M,N.EPSILON10)&&(H=!0)}(t.tangent||t.bitangent)&&(F=_.geodeticSurfaceNormal(M,F),t.tangent&&(R=d.normalize(d.cross(F,z,R),R)))}else z=_.geodeticSurfaceNormal(M,z),(t.tangent||t.bitangent)&&(p&&(wx=d.fromArray(T,O,wx),bu=d.cross(d.UNIT_Z,wx,bu),bu=d.normalize(J.multiplyByVector(I,bu,bu),bu),t.bitangent&&(Cg=d.normalize(d.cross(wx,bu,Cg),Cg))),R=d.cross(d.UNIT_Z,z,R),R=d.normalize(J.multiplyByVector(I,R,R),R),t.bitangent&&(F=d.normalize(d.cross(z,R,F),F)));t.normal&&(e.wall?(T[O+m]=z.x,T[V+m]=z.y,T[k+m]=z.z):u&&(T[O+m]=-z.x,T[V+m]=-z.y,T[k+m]=-z.z),(c&&!p||a)&&(T[O]=z.x,T[V]=z.y,T[k]=z.z)),i&&(a&&(z=_.geodeticSurfaceNormal(M,z)),S[O+m]=-z.x,S[V+m]=-z.y,S[k+m]=-z.z),t.tangent&&(e.wall?(E[O+m]=R.x,E[V+m]=R.y,E[k+m]=R.z):u&&(E[O+m]=-R.x,E[V+m]=-R.y,E[k+m]=-R.z),c&&(p?(E[O]=bu.x,E[V]=bu.y,E[k]=bu.z):(E[O]=R.x,E[V]=R.y,E[k]=R.z))),t.bitangent&&(u&&(w[O+m]=F.x,w[V+m]=F.y,w[k+m]=F.z),c&&(p?(w[O]=Cg.x,w[V]=Cg.y,w[k]=Cg.z):(w[O]=F.x,w[V]=F.y,w[k]=F.z))),O+=3}}t.st&&!l(r)&&(n.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:C})),t.normal&&(n.attributes.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:T})),t.tangent&&(n.attributes.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:E})),t.bitangent&&(n.attributes.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:w})),i&&(n.attributes.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:S}))}if(e.extrude&&l(e.offsetAttribute)){const f=o.length/3;let h=new Uint8Array(f);if(e.offsetAttribute===fn.TOP)c&&u||a?h=h.fill(1,0,f/2):c&&(h=h.fill(1));else{const _=e.offsetAttribute===fn.NONE?0:1;h=h.fill(_)}n.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:h})}return n}const DZe=new Ae,IZe=new Ae,dh={westOverIDL:0,eastOverIDL:0};let Tg=new vd;function EZ(e,t,n,i,o){if(o=A(o,new _e),!l(e)||e.length<3)return o.west=0,o.north=0,o.south=0,o.east=0,o;if(n===xn.RHUMB)return _e.fromCartesianArray(e,t,o);Tg.ellipsoid.equals(t)||(Tg=new vd(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,dh.westOverIDL=Number.POSITIVE_INFINITY,dh.eastOverIDL=Number.NEGATIVE_INFINITY;const r=1/N.chordLength(i,t.maximumRadius),s=e.length;let a=t.cartesianToCartographic(e[0],IZe),c=DZe,u;for(let f=1;f<s;f++)u=c,c=a,a=t.cartesianToCartographic(e[f],u),Tg.setEndPoints(c,a),QG(Tg,r,o,dh);return u=c,c=a,a=t.cartesianToCartographic(e[0],u),Tg.setEndPoints(c,a),QG(Tg,r,o,dh),o.east-o.west>dh.eastOverIDL-dh.westOverIDL&&(o.west=dh.westOverIDL,o.east=dh.eastOverIDL,o.east>N.PI&&(o.east=o.east-N.TWO_PI),o.west>N.PI&&(o.west=o.west-N.TWO_PI)),o}const PZe=new Ae;function QG(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,PZe);a+=s;const f=u.longitude,h=u.latitude;n.west=Math.min(n.west,f),n.east=Math.max(n.east,f),n.south=Math.min(n.south,h),n.north=Math.max(n.north,h);const _=f>=0?f:f+N.TWO_PI;i.westOverIDL=Math.min(i.westOverIDL,_),i.eastOverIDL=Math.max(i.eastOverIDL,_)}}const ZG=[];function OZe(e,t,n,i,o,r,s,a,c,u){const f={walls:[]};let h;if(s||a){const E=Rn.createGeometryFromPositions(e,t,n,i,r,c,u),w=E.attributes.position.values,S=E.indices;let P,O;if(s&&a){const z=w.concat(w);P=z.length/3,O=it.createTypedArray(P,S.length*2),O.set(S);const R=S.length,F=P/2;for(h=0;h<R;h+=3){const H=O[h]+F,v=O[h+1]+F,I=O[h+2]+F;O[h+R]=I,O[h+1+R]=v,O[h+2+R]=H}if(E.attributes.position.values=z,r&&c.normal){const H=E.attributes.normal.values;E.attributes.normal.values=new Float32Array(z.length),E.attributes.normal.values.set(H)}if(c.st&&l(n)){const H=E.attributes.st.values;E.attributes.st.values=new Float32Array(P*2),E.attributes.st.values=H.concat(H)}E.indices=O}else if(a){for(P=w.length/3,O=it.createTypedArray(P,S.length),h=0;h<S.length;h+=3)O[h]=S[h+2],O[h+1]=S[h+1],O[h+2]=S[h];E.indices=O}f.topAndBottom=new nn({geometry:E})}let _=o.outerRing,g=ss.fromPoints(_,e),p=g.projectPointsOntoPlane(_,ZG),y=Wi.computeWindingOrder2D(p);y===el.CLOCKWISE&&(_=_.slice().reverse());let C=Rn.computeWallGeometry(_,n,e,i,r,u);f.walls.push(new nn({geometry:C}));const T=o.holes;for(h=0;h<T.length;h++){let E=T[h];g=ss.fromPoints(E,e),p=g.projectPointsOntoPlane(E,ZG),y=Wi.computeWindingOrder2D(p),y===el.COUNTER_CLOCKWISE&&(E=E.slice().reverse()),C=Rn.computeWallGeometry(E,n,e,i,r,u),f.walls.push(new nn({geometry:C}))}return f}function mc(e){if(b.typeOf.object("options",e),b.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!==xn.GEODESIC&&e.arcType!==xn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.vertexFormat,Ne.DEFAULT),i=A(e.ellipsoid,pe.WGS84),o=A(e.granularity,N.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),f=A(e.extrudedHeight,u);if(!c){const h=Math.max(u,f);f=Math.min(u,f),u=h}this._vertexFormat=Ne.clone(n),this._ellipsoid=pe.clone(i),this._granularity=o,this._stRotation=r,this._height=u,this._extrudedHeight=f,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,xn.GEODESIC),this._rectangle=void 0,this._textureCoordinateRotationPoints=void 0,this._textureCoordinates=s,this.packedLength=Rn.computeHierarchyPackedLength(t,d)+pe.packedLength+Ne.packedLength+(s?Rn.computeHierarchyPackedLength(s,j):1)+12}mc.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),b.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 mc(t)};mc.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),n=Rn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.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=Rn.packPolygonHierarchy(e._textureCoordinates,t,n,j):t[n++]=-1,t[n++]=e.packedLength,t};const LZe=pe.clone(pe.UNIT_SPHERE),BZe=new Ne,RZe={polygonHierarchy:{}};mc.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=Rn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=pe.unpack(e,t,LZe);t+=pe.packedLength;const r=Ne.unpack(e,t,BZe);t+=Ne.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++]===1,h=e[t++]===1,_=e[t++]===1,g=e[t++]===1,p=e[t++]===1,y=e[t++],C=e[t++],T=e[t]===-1?void 0:Rn.unpackPolygonHierarchy(e,t,j);l(T)?(t=T.startingIndex,delete T.startingIndex):t++;const E=e[t++];return l(n)||(n=new mc(RZe)),n._polygonHierarchy=i,n._ellipsoid=pe.clone(o,n._ellipsoid),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._height=s,n._extrudedHeight=a,n._granularity=c,n._stRotation=u,n._perPositionHeightExtrude=f,n._perPositionHeight=h,n._closeTop=_,n._closeBottom=g,n._shadowVolume=p,n._offsetAttribute=y===-1?void 0:y,n._arcType=C,n._textureCoordinates=T,n.packedLength=E,n};mc.computeRectangle=function(e,t){b.typeOf.object("options",e),b.typeOf.object("options.polygonHierarchy",e.polygonHierarchy);const n=A(e.granularity,N.RADIANS_PER_DEGREE),i=A(e.arcType,xn.GEODESIC);if(i!==xn.GEODESIC&&i!==xn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const o=e.polygonHierarchy,r=A(e.ellipsoid,pe.WGS84);return EZ(o.positions,r,i,n,t)};mc.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,f=e._textureCoordinates,h=l(f);let _=r.positions;if(_.length<3)return;const g=ss.fromPoints(_,n),p=Rn.polygonsFromHierarchy(r,h,g.projectPointsOntoPlane.bind(g),!s,n),y=p.hierarchy,C=p.polygons,T=function(m){return m},E=h?Rn.polygonsFromHierarchy(f,!0,T,!1).polygons:void 0;if(y.length===0)return;_=y[0].outerRing;const w=Rn.computeBoundingRectangle(g.plane.normal,g.projectPointOntoPlane.bind(g),_,o,_Ze),S=[],P=e._height,O=e._extrudedHeight,z=e._perPositionHeightExtrude||!N.equalsEpsilon(P,O,0,N.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<C.length;F++){const m=OZe(n,C[F],h?E[F]:void 0,i,y[F],s,a,c,t,u);let D;a&&c?(D=m.topAndBottom,R.geometry=Rn.scaleToGeodeticHeightExtruded(D.geometry,P,O,n,s)):a?(D=m.topAndBottom,D.geometry.attributes.position.values=Wi.scaleToGeodeticHeight(D.geometry.attributes.position.values,P,n,!s),R.geometry=D.geometry):c&&(D=m.topAndBottom,D.geometry.attributes.position.values=Wi.scaleToGeodeticHeight(D.geometry.attributes.position.values,O,n,!0),R.geometry=D.geometry),(a||c)&&(R.wall=!1,D.geometry=f1(R),S.push(D));const L=m.walls;R.wall=!0;for(let M=0;M<L.length;M++){const V=L[M];R.geometry=Rn.scaleToGeodeticHeightExtruded(V.geometry,P,O,n,s),V.geometry=f1(R),S.push(V)}}else for(F=0;F<C.length;F++){const m=new nn({geometry:Rn.createGeometryFromPositions(n,C[F],h?E[F]:void 0,i,s,t,u)});if(m.geometry.attributes.position.values=Wi.scaleToGeodeticHeight(m.geometry.attributes.position.values,P,n,!s),R.geometry=m.geometry,m.geometry=f1(R),l(e._offsetAttribute)){const D=m.geometry.attributes.position.values.length,L=e._offsetAttribute===fn.NONE?0:1,M=new Uint8Array(D/3).fill(L);m.geometry.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:M})}S.push(m)}const H=Ri.combineInstances(S)[0];H.attributes.position.values=new Float64Array(H.attributes.position.values),H.indices=it.createTypedArray(H.attributes.position.values.length/3,H.indices);const v=H.attributes,I=fe.fromVertices(v.position.values);return t.position||delete v.position,new Dt({attributes:v,indices:H.indices,primitiveType:H.primitiveType,boundingSphere:I,offsetAttribute:e._offsetAttribute})};mc.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new mc({polygonHierarchy:e._polygonHierarchy,ellipsoid:o,stRotation:e._stRotation,granularity:i,perPositionHeight:!1,extrudedHeight:r,height:s,vertexFormat:Ne.POSITION_ONLY,shadowVolume:!0,arcType:e._arcType})};function NZe(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 Dt._textureCoordinateRotationPoints(i,t,n,o)}Object.defineProperties(mc.prototype,{rectangle:{get:function(){if(!l(this._rectangle)){const e=this._polygonHierarchy.positions;this._rectangle=EZ(e,this._ellipsoid,this._arcType,this._granularity)}return this._rectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=NZe(this)),this._textureCoordinateRotationPoints}}});const xZ=[],WS=[];function MZe(e,t,n,i,o){const s=ss.fromPoints(t,e).projectPointsOntoPlane(t,xZ);Wi.computeWindingOrder2D(s)===el.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,f=t.length,h=0;if(i)for(c=new Float64Array(f*2*3),u=0;u<f;u++){const p=t[u],y=t[(u+1)%f];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===xn.GEODESIC)for(u=0;u<f;u++)p+=Rn.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===xn.RHUMB)for(u=0;u<f;u++)p+=Rn.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(c=new Float64Array(p*3),u=0;u<f;u++){let y;o===xn.GEODESIC?y=Rn.subdivideLine(t[u],t[(u+1)%f],n,WS):o===xn.RHUMB&&(y=Rn.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,WS));const C=y.length;for(let T=0;T<C;++T)c[h++]=y[T]}}f=c.length/3;const _=f*2,g=it.createTypedArray(f,_);for(h=0,u=0;u<f-1;u++)g[h++]=u,g[h++]=u+1;return g[h++]=f-1,g[h++]=0,new nn({geometry:new Dt({attributes:new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})}),indices:g,primitiveType:Je.LINES})})}function FZe(e,t,n,i,o){const s=ss.fromPoints(t,e).projectPointsOntoPlane(t,xZ);Wi.computeWindingOrder2D(s)===el.CLOCKWISE&&(s.reverse(),t=t.slice().reverse());let c,u,f=t.length;const h=new Array(f);let _=0;if(i)for(c=new Float64Array(f*2*3*2),u=0;u<f;++u){h[u]=_/3;const C=t[u],T=t[(u+1)%f];c[_++]=C.x,c[_++]=C.y,c[_++]=C.z,c[_++]=T.x,c[_++]=T.y,c[_++]=T.z}else{let C=0;if(o===xn.GEODESIC)for(u=0;u<f;u++)C+=Rn.subdivideLineCount(t[u],t[(u+1)%f],n);else if(o===xn.RHUMB)for(u=0;u<f;u++)C+=Rn.subdivideRhumbLineCount(e,t[u],t[(u+1)%f],n);for(c=new Float64Array(C*3*2),u=0;u<f;++u){h[u]=_/3;let T;o===xn.GEODESIC?T=Rn.subdivideLine(t[u],t[(u+1)%f],n,WS):o===xn.RHUMB&&(T=Rn.subdivideRhumbLine(e,t[u],t[(u+1)%f],n,WS));const E=T.length;for(let w=0;w<E;++w)c[_++]=T[w]}}f=c.length/(3*2);const g=h.length,p=(f*2+g)*2,y=it.createTypedArray(f+g,p);for(_=0,u=0;u<f;++u)y[_++]=u,y[_++]=(u+1)%f,y[_++]=u+f,y[_++]=(u+1)%f+f;for(u=0;u<g;u++){const C=h[u];y[_++]=C,y[_++]=C+f}return new nn({geometry:new Dt({attributes:new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:c})}),indices:y,primitiveType:Je.LINES})})}function c_(e){if(b.typeOf.object("options",e),b.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!==xn.GEODESIC&&e.arcType!==xn.RHUMB)throw new x("Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB.");const t=e.polygonHierarchy,n=A(e.ellipsoid,pe.WGS84),i=A(e.granularity,N.RADIANS_PER_DEGREE),o=A(e.perPositionHeight,!1),r=o&&l(e.extrudedHeight),s=A(e.arcType,xn.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=pe.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=Rn.computeHierarchyPackedLength(t,d)+pe.packedLength+8}c_.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),n=Rn.packPolygonHierarchy(e._polygonHierarchy,t,n,d),pe.pack(e._ellipsoid,t,n),n+=pe.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 zZe=pe.clone(pe.UNIT_SPHERE),UZe={polygonHierarchy:{}};c_.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=Rn.unpackPolygonHierarchy(e,t,d);t=i.startingIndex,delete i.startingIndex;const o=pe.unpack(e,t,zZe);t+=pe.packedLength;const r=e[t++],s=e[t++],a=e[t++],c=e[t++]===1,u=e[t++]===1,f=e[t++],h=e[t++],_=e[t];return l(n)||(n=new c_(UZe)),n._polygonHierarchy=i,n._ellipsoid=pe.clone(o,n._ellipsoid),n._height=r,n._extrudedHeight=s,n._granularity=a,n._perPositionHeight=u,n._perPositionHeightExtrude=c,n._arcType=f,n._offsetAttribute=h===-1?void 0:h,n.packedLength=_,n};c_.fromPositions=function(e){e=A(e,A.EMPTY_OBJECT),b.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 c_(t)};c_.createGeometry=function(e){const t=e._ellipsoid,n=e._granularity,i=e._polygonHierarchy,o=e._perPositionHeight,r=e._arcType,s=Rn.polygonOutlinesFromHierarchy(i,!o,t);if(s.length===0)return;let a;const c=[],u=N.chordLength(n,t.maximumRadius),f=e._height,h=e._extrudedHeight,_=e._perPositionHeightExtrude||!N.equalsEpsilon(f,h,0,N.EPSILON2);let g,p;if(_)for(p=0;p<s.length;p++){if(a=FZe(t,s[p],u,o,r),a.geometry=Rn.scaleToGeodeticHeightExtruded(a.geometry,f,h,t,o),l(e._offsetAttribute)){const T=a.geometry.attributes.position.values.length/3;let E=new Uint8Array(T);e._offsetAttribute===fn.TOP?E=E.fill(1,0,T/2):(g=e._offsetAttribute===fn.NONE?0:1,E=E.fill(g)),a.geometry.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}c.push(a)}else for(p=0;p<s.length;p++){if(a=MZe(t,s[p],u,o,r),a.geometry.attributes.position.values=Wi.scaleToGeodeticHeight(a.geometry.attributes.position.values,f,t,!o),l(e._offsetAttribute)){const T=a.geometry.attributes.position.values.length;g=e._offsetAttribute===fn.NONE?0:1;const E=new Uint8Array(T/3).fill(g);a.geometry.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:E})}c.push(a)}const y=Ri.combineInstances(c)[0],C=fe.fromVertices(y.attributes.position.values);return new Dt({attributes:y.attributes,indices:y.indices,primitiveType:y.primitiveType,boundingSphere:C,offsetAttribute:e._offsetAttribute})};const wZ="Entity polygons cannot have both height and perPositionHeight. height will be ignored",SZ="heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored",vZ=new U,DZ=d.ZERO,IZ=new d,PZ=new _e,HZe=[],VZe=new j;function kZe(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 rc(e,t){Yt.call(this,{entity:e,scene:t,geometryOptions:new kZe(e),geometryPropertyName:"polygon",observedPropertyNames:["availability","polygon"]}),this._onEntityPropertyChanged(e,"polygon",e.polygon,void 0)}l(Object.create)&&(rc.prototype=Object.create(Yt.prototype),rc.prototype.constructor=rc);rc.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:_i.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Jt){let s;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(s=this._materialProperty.color.getValue(e,vZ)),l(s)||(s=U.WHITE),o.color=an.fromColor(s)}l(i.offsetAttribute)&&(o.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,DZ,IZ)));let r;return i.perPositionHeight&&!l(i.extrudedHeight)?r=new a_(i):r=new mc(i),new nn({id:t,geometry:r,attributes:o})};rc.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,vZ),r=this._distanceDisplayConditionProperty.getValue(e),s={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(o),distanceDisplayCondition:_i.fromDistanceDisplayCondition(r),offset:void 0};l(i.offsetAttribute)&&(s.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,DZ,IZ)));let a;return i.perPositionHeight&&!l(i.extrudedHeight)?a=new qa(i):a=new c_(i),new nn({id:t,geometry:a,attributes:s})};rc.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=ss.fromPoints(i,o),s=r.projectPointsOntoPlane(i,HZe),a=s.length;let c=0,u=a-1,f=new j;for(let _=0;_<a;u=_++){const g=s[_],p=s[u],y=g.x*p.y-p.x*g.y;let C=j.add(g,p,VZe);C=j.multiplyByScalar(C,y,C),f=j.add(f,C,f),c+=y}const h=1/(c*3);return f=j.multiplyByScalar(f,h,f),r.projectPointOntoEllipsoid(f,t)};rc.prototype._isHidden=function(e,t){return!l(t.hierarchy)||Nn.prototype._isHidden.call(this,e,t)};rc.prototype._isOnTerrain=function(e,t){const n=Yt.prototype._isOnTerrain.call(this,e,t),i=t.perPositionHeight,o=l(i)&&(i.isConstant?i.getValue(lt.MINIMUM_VALUE):!0);return n&&!o};rc.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 Jt)};rc.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Jt,i=this._options;i.vertexFormat=n?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat;const o=t.hierarchy.getValue(lt.MINIMUM_VALUE);let r=Z.getValueOrUndefined(t.height,lt.MINIMUM_VALUE);const s=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE);let a=Z.getValueOrUndefined(t.extrudedHeight,lt.MINIMUM_VALUE);const c=Z.getValueOrDefault(t.extrudedHeightReference,lt.MINIMUM_VALUE,Et.NONE),u=Z.getValueOrDefault(t.perPositionHeight,lt.MINIMUM_VALUE,!1);r=Yt.getGeometryHeight(r,s);let f;u?(l(r)&&(r=void 0,Di(wZ)),s!==Et.NONE&&u&&(r=void 0,Di(SZ))):(l(a)&&!l(r)&&(r=0),f=Yt.computeGeometryOffsetAttribute(r,s,a,c)),i.polygonHierarchy=o,i.granularity=Z.getValueOrUndefined(t.granularity,lt.MINIMUM_VALUE),i.stRotation=Z.getValueOrUndefined(t.stRotation,lt.MINIMUM_VALUE),i.perPositionHeight=u,i.closeTop=Z.getValueOrDefault(t.closeTop,lt.MINIMUM_VALUE,!0),i.closeBottom=Z.getValueOrDefault(t.closeBottom,lt.MINIMUM_VALUE,!0),i.offsetAttribute=f,i.height=r,i.arcType=Z.getValueOrDefault(t.arcType,lt.MINIMUM_VALUE,xn.GEODESIC),i.textureCoordinates=Z.getValueOrUndefined(t.textureCoordinates,lt.MINIMUM_VALUE),a=Yt.getGeometryExtrudedHeight(a,c),a===Yt.CLAMP_TO_GROUND&&(a=Qi.getMinimumMaximumHeights(mc.computeRectangle(i,PZ)).minimumTerrainHeight),i.extrudedHeight=a};rc.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)};rc.DynamicGeometryUpdater=yy;function yy(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(yy.prototype=Object.create(si.prototype),yy.prototype.constructor=yy);yy.prototype._isHidden=function(e,t,n){return!l(this._options.polygonHierarchy)||si.prototype._isHidden.call(this,e,t,n)};yy.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,Et.NONE),s=Z.getValueOrDefault(t.extrudedHeightReference,n,Et.NONE);let a=Z.getValueOrUndefined(t.extrudedHeight,n);const c=Z.getValueOrUndefined(t.perPositionHeight,n);o=Yt.getGeometryHeight(o,s);let u;c?(l(o)&&(o=void 0,Di(wZ)),r!==Et.NONE&&c&&(o=void 0,Di(SZ))):(l(a)&&!l(o)&&(o=0),u=Yt.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,xn.GEODESIC),a=Yt.getGeometryExtrudedHeight(a,s),a===Yt.CLAMP_TO_GROUND&&(a=Qi.getMinimumMaximumHeights(mc.computeRectangle(i,PZ)).minimumTerrainHeight),i.extrudedHeight=a};function GZe(e,t,n,i){const o=new Ui;i.position&&(o.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:e}));const r=t.length,s=e.length/3,a=(s-r*2)/(r*2),c=Wi.triangulate(t),u=(a-1)*r*6+c.length*2,f=it.createTypedArray(s,u);let h,_,g,p,y,C;const T=r*2;let E=0;for(h=0;h<a-1;h++){for(_=0;_<r-1;_++)g=_*2+h*r*2,C=g+T,p=g+1,y=p+T,f[E++]=p,f[E++]=g,f[E++]=y,f[E++]=y,f[E++]=g,f[E++]=C;g=r*2-2+h*r*2,p=g+1,y=p+T,C=g+T,f[E++]=p,f[E++]=g,f[E++]=y,f[E++]=y,f[E++]=g,f[E++]=C}if(i.st||i.tangent||i.bitangent){const P=new Float32Array(s*2),O=1/(a-1),z=1/n.height,R=n.height/2;let F,H,v=0;for(h=0;h<a;h++){for(F=h*O,H=z*(t[0].y+R),P[v++]=F,P[v++]=H,_=1;_<r;_++)H=z*(t[_].y+R),P[v++]=F,P[v++]=H,P[v++]=F,P[v++]=H;H=z*(t[0].y+R),P[v++]=F,P[v++]=H}for(_=0;_<r;_++)F=0,H=z*(t[_].y+R),P[v++]=F,P[v++]=H;for(_=0;_<r;_++)F=(a-1)*O,H=z*(t[_].y+R),P[v++]=F,P[v++]=H;o.st=new ze({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,O=c[h+1]+w,z=c[h+2]+w;f[E++]=P,f[E++]=O,f[E++]=z,f[E++]=z+r,f[E++]=O+r,f[E++]=P+r}let S=new Dt({attributes:o,indices:f,boundingSphere:fe.fromVertices(e),primitiveType:Je.TRIANGLES});if(i.normal&&(S=Ri.computeNormal(S)),i.tangent||i.bitangent){try{S=Ri.computeTangentAndBitangent(S)}catch{Di("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 mT(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=pe.clone(A(e.ellipsoid,pe.WGS84)),this._cornerType=A(e.cornerType,Jo.ROUNDED),this._vertexFormat=Ne.clone(A(e.vertexFormat,Ne.DEFAULT)),this._granularity=A(e.granularity,N.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*j.packedLength,this.packedLength=i+pe.packedLength+Ne.packedLength+2}mT.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+=d.packedLength)d.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 pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const OZ=pe.clone(pe.UNIT_SPHERE),LZ=new Ne,TA={polylinePositions:void 0,shapePositions:void 0,ellipsoid:OZ,vertexFormat:LZ,cornerType:void 0,granularity:void 0};mT.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+=d.packedLength)r[i]=d.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=pe.unpack(e,t,OZ);t+=pe.packedLength;const c=Ne.unpack(e,t,LZ);t+=Ne.packedLength;const u=e[t++],f=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=pe.clone(a,n._ellipsoid),n._vertexFormat=Ne.clone(c,n._vertexFormat),n._cornerType=u,n._granularity=f,n):(TA.polylinePositions=r,TA.shapePositions=s,TA.cornerType=u,TA.granularity=f,new mT(TA))};const WZe=new qe;mT.createGeometry=function(e){const t=e._positions,n=Zs(t,d.equalsEpsilon);let i=e._shape;if(i=hT.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;Wi.computeWindingOrder2D(i)===el.CLOCKWISE&&i.reverse();const o=qe.fromPoints(i,WZe),r=hT.computePositions(n,i,o,e,!0);return GZe(r,i,o,e._vertexFormat)};function jZe(e,t){const n=new Ui;n.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:e});const i=t.length,o=n.position.values.length/3,s=e.length/3/i,a=it.createTypedArray(o,2*i*(s+1));let c,u,f=0;c=0;let h=c*i;for(u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,c=s-1,h=c*i,u=0;u<i-1;u++)a[f++]=u+h,a[f++]=u+h+1;for(a[f++]=i-1+h,a[f++]=h,c=0;c<s-1;c++){const g=i*c,p=g+i;for(u=0;u<i;u++)a[f++]=u+g,a[f++]=u+p}return new Dt({attributes:n,indices:it.createTypedArray(o,a),boundingSphere:fe.fromVertices(e),primitiveType:Je.LINES})}function _T(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=pe.clone(A(e.ellipsoid,pe.WGS84)),this._cornerType=A(e.cornerType,Jo.ROUNDED),this._granularity=A(e.granularity,N.RADIANS_PER_DEGREE),this._workerName="createPolylineVolumeOutlineGeometry";let i=1+t.length*d.packedLength;i+=1+n.length*j.packedLength,this.packedLength=i+pe.packedLength+2}_T.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+=d.packedLength)d.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 pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,t[n++]=e._cornerType,t[n]=e._granularity,t};const BZ=pe.clone(pe.UNIT_SPHERE),bA={polylinePositions:void 0,shapePositions:void 0,ellipsoid:BZ,height:void 0,cornerType:void 0,granularity:void 0};_T.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+=d.packedLength)r[i]=d.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=pe.unpack(e,t,BZ);t+=pe.packedLength;const c=e[t++],u=e[t];return l(n)?(n._positions=r,n._shape=s,n._ellipsoid=pe.clone(a,n._ellipsoid),n._cornerType=c,n._granularity=u,n):(bA.polylinePositions=r,bA.shapePositions=s,bA.cornerType=c,bA.granularity=u,new _T(bA))};const qZe=new qe;_T.createGeometry=function(e){const t=e._positions,n=Zs(t,d.equalsEpsilon);let i=e._shape;if(i=hT.removeDuplicatesFromShape(i),n.length<2||i.length<3)return;Wi.computeWindingOrder2D(i)===el.CLOCKWISE&&i.reverse();const o=qe.fromPoints(i,qZe),r=hT.computePositions(n,i,o,e,!1);return jZe(r,i)};const RZ=new U;function YZe(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 ku(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new YZe(e),geometryPropertyName:"polylineVolume",observedPropertyNames:["availability","polylineVolume"]}),this._onEntityPropertyChanged(e,"polylineVolume",e.polylineVolume,void 0)}l(Object.create)&&(ku.prototype=Object.create(Nn.prototype),ku.prototype.constructor=ku);ku.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=_i.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Jt){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,RZ)),l(c)||(c=U.WHITE),o=an.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new nn({id:t,geometry:new mT(this._options),attributes:i})};ku.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,RZ),o=this._distanceDisplayConditionProperty.getValue(e);return new nn({id:t,geometry:new _T(this._options),attributes:{show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o)}})};ku.prototype._isHidden=function(e,t){return!l(t.positions)||!l(t.shape)||Nn.prototype._isHidden.call(this,e,t)};ku.prototype._isDynamic=function(e,t){return!t.positions.isConstant||!t.shape.isConstant||!Z.isConstant(t.granularity)||!Z.isConstant(t.outlineWidth)||!Z.isConstant(t.cornerType)};ku.prototype._setStaticOptions=function(e,t){const n=t.granularity,i=t.cornerType,o=this._options,r=this._materialProperty instanceof Jt;o.vertexFormat=r?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,o.polylinePositions=t.positions.getValue(lt.MINIMUM_VALUE,o.polylinePositions),o.shapePositions=t.shape.getValue(lt.MINIMUM_VALUE,o.shape),o.granularity=l(n)?n.getValue(lt.MINIMUM_VALUE):void 0,o.cornerType=l(i)?i.getValue(lt.MINIMUM_VALUE):void 0};ku.DynamicGeometryUpdater=Ay;function Ay(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(Ay.prototype=Object.create(si.prototype),Ay.prototype.constructor=Ay);Ay.prototype._isHidden=function(e,t,n){const i=this._options;return!l(i.polylinePositions)||!l(i.shapePositions)||si.prototype._isHidden.call(this,e,t,n)};Ay.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 OF=new d,NZ=new d,MZ=new d,FZ=new d,zZ=new _e,$Ze=new j,XZe=new fe,KZe=new fe;function UZ(e,t){const n=new Dt({attributes:new Ui,primitiveType:Je.TRIANGLES});return n.attributes.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:t.positions}),e.normal&&(n.attributes.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.normals})),e.tangent&&(n.attributes.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.tangents})),e.bitangent&&(n.attributes.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:t.bitangents})),n}function JZe(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=FZ,f=MZ;let h=NZ;if(t.normal||t.tangent||t.bitangent)for(let _=0;_<o;_+=3){const g=d.fromArray(e,_,OF),p=c+1,y=c+2;h=n.geodeticSurfaceNormal(g,h),(t.tangent||t.bitangent)&&(d.cross(d.UNIT_Z,h,f),J.multiplyByVector(i,f,f),d.normalize(f,f),t.bitangent&&d.normalize(d.cross(h,f,u),u)),t.normal&&(r[c]=h.x,r[p]=h.y,r[y]=h.z),t.tangent&&(s[c]=f.x,s[p]=f.y,s[y]=f.z),t.bitangent&&(a[c]=u.x,a[p]=u.y,a[y]=u.z),c+=3}return UZ(t,{positions:e,normals:r,tangents:s,bitangents:a})}const LF=new d,HZ=new d;function QZe(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,f=!0,h=FZ,_=MZ,g=NZ;if(t.normal||t.tangent||t.bitangent)for(let p=0;p<i;p+=6){const y=d.fromArray(e,p,OF),C=d.fromArray(e,(p+6)%i,LF);if(f){const T=d.fromArray(e,(p+3)%i,HZ);d.subtract(C,y,C),d.subtract(T,y,T),g=d.normalize(d.cross(T,C,g),g),f=!1}d.equalsEpsilon(C,y,N.EPSILON10)&&(f=!0),(t.tangent||t.bitangent)&&(h=n.geodeticSurfaceNormal(y,h),t.tangent&&(_=d.normalize(d.cross(h,g,_),_))),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++]=_.x,r[c++]=_.y,r[c++]=_.z,r[c++]=_.x,r[c++]=_.y,r[c++]=_.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 UZ(t,{positions:e,normals:o,tangents:r,bitangents:s})}function VZ(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,f=o,h=0;s&&(c=1,f-=1,h+=1),a&&(u-=1,f-=1,h+=1),h+=r*f;const _=n.position?new Float64Array(h*3):void 0,g=n.st?new Float32Array(h*2):void 0;let p=0,y=0;const C=OF,T=$Ze;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 m=0;m<r;++m)ma.computePosition(t,i,n.st,I,m,C,T),_[p++]=C.x,_[p++]=C.y,_[p++]=C.z,n.st&&(g[y++]=T.x,g[y++]=T.y,E=Math.min(E,T.x),w=Math.min(w,T.y),S=Math.max(S,T.x),P=Math.max(P,T.y));if(s&&(ma.computePosition(t,i,n.st,0,0,C,T),_[p++]=C.x,_[p++]=C.y,_[p++]=C.z,n.st&&(g[y++]=T.x,g[y++]=T.y,E=T.x,w=T.y,S=T.x,P=T.y)),a&&(ma.computePosition(t,i,n.st,o-1,0,C,T),_[p++]=C.x,_[p++]=C.y,_[p]=C.z,n.st&&(g[y++]=T.x,g[y]=T.y,E=Math.min(E,T.x),w=Math.min(w,T.y),S=Math.max(S,T.x),P=Math.max(P,T.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 O=JZe(_,n,i,t.tangentRotationMatrix);let z=6*(r-1)*(f-1);s&&(z+=3*(r-1)),a&&(z+=3*(r-1));const R=it.createTypedArray(h,z);let F=0,H=0,v;for(v=0;v<f-1;++v){for(let I=0;I<r-1;++I){const m=F,D=m+r,L=D+1,M=m+1;R[H++]=m,R[H++]=D,R[H++]=M,R[H++]=M,R[H++]=D,R[H++]=L,++F}++F}if(s||a){let I=h-1;const m=h-1;s&&a&&(I=h-2);let D,L;if(F=0,s)for(v=0;v<r-1;v++)D=F,L=D+1,R[H++]=I,R[H++]=D,R[H++]=L,++F;if(a)for(F=(f-1)*r,v=0;v<r-1;v++)D=F,L=D+1,R[H++]=D,R[H++]=m,R[H++]=L,++F}return O.indices=R,n.st&&(O.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:g})),O}function bg(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 Eg(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 BF=new Ne;function ZZe(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 f;if(n){const Te=Ne.clone(o,BF);Te.normal=!0,e._vertexFormat=Te}const h=VZ(e,t);n&&(e._vertexFormat=o);let _=Wi.scaleToGeodeticHeight(h.attributes.position.values,s,a,!1);_=new Float64Array(_);let g=_.length;const p=g*2,y=new Float64Array(p);y.set(_);const C=Wi.scaleToGeodeticHeight(h.attributes.position.values,r,a);y.set(C,g),h.attributes.position.values=y;const T=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,O;if(o.normal){for(O=h.attributes.normal.values,T.set(O),f=0;f<g;f++)O[f]=-O[f];T.set(O,g),h.attributes.normal.values=T}if(n){O=h.attributes.normal.values,o.normal||(h.attributes.normal=void 0);const Te=new Float32Array(p);for(f=0;f<g;f++)O[f]=-O[f];Te.set(O,g),h.attributes.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:Te})}let z;const R=l(i);if(R){const Te=g/3*2;let Oe=new Uint8Array(Te);i===fn.TOP?Oe=Oe.fill(1,0,Te/2):(z=i===fn.NONE?0:1,Oe=Oe.fill(z)),h.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:Oe})}if(o.tangent){const Te=h.attributes.tangent.values;for(E.set(Te),f=0;f<g;f++)Te[f]=-Te[f];E.set(Te,g),h.attributes.tangent.values=E}if(o.bitangent){const Te=h.attributes.bitangent.values;w.set(Te),w.set(Te,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,H=F.length,v=g/3,I=it.createTypedArray(p/3,H*2);for(I.set(F),f=0;f<H;f+=3)I[f+H]=F[f+2]+v,I[f+1+H]=F[f+1]+v,I[f+2+H]=F[f]+v;h.indices=I;const m=t.northCap,D=t.southCap;let L=c,M=2,V=0,k=4,W=4;m&&(M-=1,L-=1,V+=1,k-=2,W-=1),D&&(M-=1,L-=1,V+=1,k-=2,W-=1),V+=M*u+2*L-k;const G=(V+W)*2;let K=new Float64Array(G*3);const q=n?new Float32Array(G*3):void 0;let te=R?new Uint8Array(G):void 0,$=o.st?new Float32Array(G*2):void 0;const X=i===fn.TOP;R&&!X&&(z=i===fn.ALL?1:0,te=te.fill(z));let Y=0,ae=0,ue=0,re=0;const he=u*L;let ce;for(f=0;f<he;f+=u)ce=f*3,K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,f*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1);if(D){const Te=m?he+1:he;for(ce=Te*3,f=0;f<2;f++)K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,Te*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1)}else for(f=he-u;f<he;f++)ce=f*3,K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,f*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1);for(f=he-1;f>0;f-=u)ce=f*3,K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,f*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1);if(m){const Te=he;for(ce=Te*3,f=0;f<2;f++)K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,Te*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1)}else for(f=u-1;f>=0;f--)ce=f*3,K=bg(K,Y,ce,_,C),Y+=6,o.st&&($=Eg($,ae,f*2,P),ae+=4),n&&(ue+=3,q[ue++]=O[ce],q[ue++]=O[ce+1],q[ue++]=O[ce+2]),X&&(te[re++]=1,re+=1);let Q=QZe(K,o,a);o.st&&(Q.attributes.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:$})),n&&(Q.attributes.extrudeDirection=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:q})),R&&(Q.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:te}));const ie=it.createTypedArray(G,V*6);let de,me,Ee,xe;g=K.length/3;let Pe=0;for(f=0;f<g-1;f+=2){de=f,xe=(de+2)%g;const Te=d.fromArray(K,de*3,LF),Oe=d.fromArray(K,xe*3,HZ);d.equalsEpsilon(Te,Oe,N.EPSILON10)||(me=(de+1)%g,Ee=(me+2)%g,ie[Pe++]=de,ie[Pe++]=me,ie[Pe++]=xe,ie[Pe++]=xe,ie[Pe++]=me,ie[Pe++]=Ee)}return Q.indices=ie,Q=Ri.combineInstances([new nn({geometry:h}),new nn({geometry:Q})]),Q[0]}const eet=[new d,new d,new d,new d],kZ=new Ae,tet=new Ae;function RF(e,t,n,i,o){if(n===0)return _e.clone(e,o);const r=ma.computeOptions(e,t,n,0,zZ,kZ),s=r.height,a=r.width,c=eet;return ma.computePosition(r,i,!1,0,0,c[0]),ma.computePosition(r,i,!1,0,a-1,c[1]),ma.computePosition(r,i,!1,s-1,0,c[2]),ma.computePosition(r,i,!1,s-1,a-1,c[3]),_e.fromCartesianArray(c,i,o)}function sl(e){e=A(e,A.EMPTY_OBJECT);const t=e.rectangle;if(b.typeOf.object("rectangle",t),_e.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=_e.clone(t),this._granularity=A(e.granularity,N.RADIANS_PER_DEGREE),this._ellipsoid=pe.clone(A(e.ellipsoid,pe.WGS84)),this._surfaceHeight=Math.max(n,i),this._rotation=A(e.rotation,0),this._stRotation=A(e.stRotation,0),this._vertexFormat=Ne.clone(A(e.vertexFormat,Ne.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}sl.packedLength=_e.packedLength+pe.packedLength+Ne.packedLength+7;sl.pack=function(e,t,n){return b.typeOf.object("value",e),b.defined("array",t),n=A(n,0),_e.pack(e._rectangle,t,n),n+=_e.packedLength,pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.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 GZ=new _e,WZ=pe.clone(pe.UNIT_SPHERE),hh={rectangle:GZ,ellipsoid:WZ,vertexFormat:BF,granularity:void 0,height:void 0,rotation:void 0,stRotation:void 0,extrudedHeight:void 0,shadowVolume:void 0,offsetAttribute:void 0};sl.unpack=function(e,t,n){b.defined("array",e),t=A(t,0);const i=_e.unpack(e,t,GZ);t+=_e.packedLength;const o=pe.unpack(e,t,WZ);t+=pe.packedLength;const r=Ne.unpack(e,t,BF);t+=Ne.packedLength;const s=e[t++],a=e[t++],c=e[t++],u=e[t++],f=e[t++],h=e[t++]===1,_=e[t];return l(n)?(n._rectangle=_e.clone(i,n._rectangle),n._ellipsoid=pe.clone(o,n._ellipsoid),n._vertexFormat=Ne.clone(r,n._vertexFormat),n._granularity=s,n._surfaceHeight=a,n._rotation=c,n._stRotation=u,n._extrudedHeight=f,n._shadowVolume=h,n._offsetAttribute=_===-1?void 0:_,n):(hh.granularity=s,hh.height=a,hh.rotation=c,hh.stRotation=u,hh.extrudedHeight=f,hh.shadowVolume=h,hh.offsetAttribute=_===-1?void 0:_,new sl(hh))};sl.computeRectangle=function(e,t){e=A(e,A.EMPTY_OBJECT);const n=e.rectangle;if(b.typeOf.object("rectangle",n),_e.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,N.RADIANS_PER_DEGREE),o=A(e.ellipsoid,pe.WGS84),r=A(e.rotation,0);return RF(n,i,r,o,t)};const net=new J,e5=new Ce,iet=new Ae;sl.createGeometry=function(e){if(N.equalsEpsilon(e._rectangle.north,e._rectangle.south,N.EPSILON10)||N.equalsEpsilon(e._rectangle.east,e._rectangle.west,N.EPSILON10))return;let t=e._rectangle;const n=e._ellipsoid,i=e._rotation,o=e._stRotation,r=e._vertexFormat,s=ma.computeOptions(t,e._granularity,i,o,zZ,kZ,tet),a=net;if(o!==0||i!==0){const g=_e.center(t,iet),p=n.geodeticSurfaceNormalCartographic(g,LF);Ce.fromAxisAngle(p,-o,e5),J.fromQuaternion(e5,a)}else J.clone(J.IDENTITY,a);const c=e._surfaceHeight,u=e._extrudedHeight,f=!N.equalsEpsilon(c,u,0,N.EPSILON2);s.lonScalar=1/e._rectangle.width,s.latScalar=1/e._rectangle.height,s.tangentRotationMatrix=a;let h,_;if(t=e._rectangle,f){h=ZZe(e,s);const g=fe.fromRectangle3D(t,n,c,KZe),p=fe.fromRectangle3D(t,n,u,XZe);_=fe.union(g,p)}else{if(h=VZ(e,s),h.attributes.position.values=Wi.scaleToGeodeticHeight(h.attributes.position.values,c,n,!1),l(e._offsetAttribute)){const g=h.attributes.position.values.length,p=e._offsetAttribute===fn.NONE?0:1,y=new Uint8Array(g/3).fill(p);h.attributes.applyOffset=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:1,values:y})}_=fe.fromRectangle3D(t,n,c)}return r.position||delete h.attributes.position,new Dt({attributes:h.attributes,indices:h.indices,primitiveType:h.primitiveType,boundingSphere:_,offsetAttribute:e._offsetAttribute})};sl.createShadowVolume=function(e,t,n){const i=e._granularity,o=e._ellipsoid,r=t(i,o),s=n(i,o);return new sl({rectangle:e._rectangle,rotation:e._rotation,ellipsoid:o,stRotation:e._stRotation,granularity:i,extrudedHeight:s,height:r,vertexFormat:Ne.POSITION_ONLY,shadowVolume:!0})};const t5=new _e,oet=[new j,new j,new j],ret=new at,set=new Ae;function aet(e){if(e._stRotation===0)return[0,0,0,1,1,0];const t=_e.clone(e._rectangle,t5),n=e._granularity,i=e._ellipsoid,o=e._rotation-e._stRotation,r=RF(t,n,o,i,t5),s=oet;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=at.fromRotation(e._stRotation,ret),u=_e.center(a,set);for(let p=0;p<3;++p){const y=s[p];y.x-=u.longitude,y.y-=u.latitude,at.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 f=s[0],h=s[1],_=s[2],g=new Array(6);return j.pack(f,g),j.pack(h,g,2),j.pack(_,g,4),g}Object.defineProperties(sl.prototype,{rectangle:{get:function(){return l(this._rotatedRectangle)||(this._rotatedRectangle=RF(this._rectangle,this._granularity,this._rotation,this._ellipsoid)),this._rotatedRectangle}},textureCoordinateRotationPoints:{get:function(){return l(this._textureCoordinateRotationPoints)||(this._textureCoordinateRotationPoints=aet(this)),this._textureCoordinateRotationPoints}}});const jZ=new U,qZ=d.ZERO,YZ=new d,$Z=new _e,cet=new _e,uet=new Ae;function fet(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 kl(e,t){Yt.call(this,{entity:e,scene:t,geometryOptions:new fet(e),geometryPropertyName:"rectangle",observedPropertyNames:["availability","rectangle"]}),this._onEntityPropertyChanged(e,"rectangle",e.rectangle,void 0)}l(Object.create)&&(kl.prototype=Object.create(Yt.prototype),kl.prototype.constructor=kl);kl.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),distanceDisplayCondition:_i.fromDistanceDisplayCondition(this._distanceDisplayConditionProperty.getValue(e)),offset:void 0,color:void 0};if(this._materialProperty instanceof Jt){let o;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(o=this._materialProperty.color.getValue(e,jZ)),l(o)||(o=U.WHITE),i.color=an.fromColor(o)}return l(this._options.offsetAttribute)&&(i.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,qZ,YZ))),new nn({id:t,geometry:new sl(this._options),attributes:i})};kl.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,jZ),o=this._distanceDisplayConditionProperty.getValue(e),r={show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o),offset:void 0};return l(this._options.offsetAttribute)&&(r.offset=Ro.fromCartesian3(Z.getValueOrDefault(this._terrainOffsetProperty,e,qZ,YZ))),new nn({id:t,geometry:new e_(this._options),attributes:r})};kl.prototype._computeCenter=function(e,t){const n=Z.getValueOrUndefined(this._entity.rectangle.coordinates,e,cet);if(!l(n))return;const i=_e.center(n,uet);return Ae.toCartesian(i,pe.WGS84,t)};kl.prototype._isHidden=function(e,t){return!l(t.coordinates)||Nn.prototype._isHidden.call(this,e,t)};kl.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 Jt)};kl.prototype._setStaticOptions=function(e,t){const n=this._materialProperty instanceof Jt;let i=Z.getValueOrUndefined(t.height,lt.MINIMUM_VALUE);const o=Z.getValueOrDefault(t.heightReference,lt.MINIMUM_VALUE,Et.NONE);let r=Z.getValueOrUndefined(t.extrudedHeight,lt.MINIMUM_VALUE);const s=Z.getValueOrDefault(t.extrudedHeightReference,lt.MINIMUM_VALUE,Et.NONE);l(r)&&!l(i)&&(i=0);const a=this._options;a.vertexFormat=n?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,a.rectangle=t.coordinates.getValue(lt.MINIMUM_VALUE,a.rectangle),a.granularity=Z.getValueOrUndefined(t.granularity,lt.MINIMUM_VALUE),a.stRotation=Z.getValueOrUndefined(t.stRotation,lt.MINIMUM_VALUE),a.rotation=Z.getValueOrUndefined(t.rotation,lt.MINIMUM_VALUE),a.offsetAttribute=Yt.computeGeometryOffsetAttribute(i,o,r,s),a.height=Yt.getGeometryHeight(i,o),r=Yt.getGeometryExtrudedHeight(r,s),r===Yt.CLAMP_TO_GROUND&&(r=Qi.getMinimumMaximumHeights(sl.computeRectangle(a,$Z)).minimumTerrainHeight),a.extrudedHeight=r};kl.DynamicGeometryUpdater=Cy;function Cy(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(Cy.prototype=Object.create(si.prototype),Cy.prototype.constructor=Cy);Cy.prototype._isHidden=function(e,t,n){return!l(this._options.rectangle)||si.prototype._isHidden.call(this,e,t,n)};Cy.prototype._setOptions=function(e,t,n){const i=this._options;let o=Z.getValueOrUndefined(t.height,n);const r=Z.getValueOrDefault(t.heightReference,n,Et.NONE);let s=Z.getValueOrUndefined(t.extrudedHeight,n);const a=Z.getValueOrDefault(t.extrudedHeightReference,n,Et.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=Yt.computeGeometryOffsetAttribute(o,r,s,a),i.height=Yt.getGeometryHeight(o,r),s=Yt.getGeometryExtrudedHeight(s,a),s===Yt.CLAMP_TO_GROUND&&(s=Qi.getMinimumMaximumHeights(sl.computeRectangle(i,$Z)).minimumTerrainHeight),i.extrudedHeight=s};const n5=new U,det=new Ut,het=new Ut,pet=d.ZERO,met=new d;function hu(e,t,n,i,o,r,s){this.translucent=t,this.appearanceType=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.subscriptions=new xt,this.showsUpdated=new xt,this.itemsToRemove=[],this.invalidated=!1;let a;l(o)&&(a=o.definitionChanged.addEventListener(hu.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}hu.prototype.onMaterialChanged=function(){this.invalidated=!0};hu.prototype.isMaterial=function(e){const t=this.depthFailMaterialProperty,n=e.depthFailMaterialProperty;return n===t?!0:l(t)?t.equals(n):!1};hu.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)}))}};hu.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};hu.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=Ar.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),c=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),i=new Wt({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 Jt)&&(this.depthFailMaterial=Ar.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],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||c){const C=u.fillMaterialProperty.color,T=Z.getValueOrDefault(C,e,U.WHITE,n5);U.equals(h._lastColor,T)||(h._lastColor=U.clone(T,h._lastColor),h.color=an.toValue(T,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 Jt&&(!u.depthFailMaterialProperty.isConstant||c)){const C=u.depthFailMaterialProperty.color,T=Z.getValueOrDefault(C,e,U.WHITE,n5);U.equals(h._lastDepthFailColor,T)||(h._lastDepthFailColor=U.clone(T,h._lastDepthFailColor),h.depthFailColor=an.toValue(T,h.depthFailColor))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const C=Z.getValueOrDefault(p,e,het,det);Ut.equals(C,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(C,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(C,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!Z.isConstant(y)){const C=Z.getValueOrDefault(y,e,pet,met);d.equals(C,h._lastOffset)||(h._lastOffset=d.clone(C,h._lastOffset),h.offset=Ro.toValue(C,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};hu.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=Hn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};hu.prototype.contains=function(e){return this.updaters.contains(e.id)};hu.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?pt.FAILED:(i.boundingSphere.clone(t),pt.DONE)};hu.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 Wc(e,t,n,i,o){this._solidItems=[],this._translucentItems=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}Wc.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 hu(this._primitives,i,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);s.add(t,o),n.push(s)};function i5(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}Wc.prototype.remove=function(e){i5(this._solidItems,e)||i5(this._translucentItems,e)};function o5(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 Sx(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}Wc.prototype.update=function(e){let t=Sx(this,this._solidItems,e,!0);t=Sx(this,this._translucentItems,e,t)&&t;const n=o5(this,this._solidItems,e),i=o5(this,this._translucentItems,e);return(n||i)&&(t=Sx(this,this._solidItems,e,t)&&t,t=Sx(this,this._translucentItems,e,t)&&t),t};function r5(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 pt.FAILED}Wc.prototype.getBoundingSphere=function(e,t){const n=r5(this._solidItems,e,t);return n===pt.FAILED?r5(this._translucentItems,e,t):n};function s5(e){const t=e.length;for(let n=0;n<t;n++)e[n].destroy();e.length=0}Wc.prototype.removeAllPrimitives=function(){s5(this._solidItems),s5(this._translucentItems)};const _et=new Ut,get=new Ut,yet=d.ZERO,Aet=new d;function pu(e,t,n,i,o,r,s){this.primitives=e,this.appearanceType=t,this.materialProperty=n,this.depthFailAppearanceType=i,this.depthFailMaterialProperty=o,this.closed=r,this.shadows=s,this.updaters=new xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.depthFailMaterial=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(pu.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt}pu.prototype.onMaterialChanged=function(){this.invalidated=!0};pu.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};pu.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};pu.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 Cet=new U;pu.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=Ar.getValue(e,this.materialProperty,this.material);let a;l(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Ar.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),a=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.depthFailMaterial.isTranslucent(),closed:this.closed})),n=new Wt({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=Ar.getValue(e,this.materialProperty,this.material),this.primitive.appearance.material=this.material,l(this.depthFailAppearanceType)&&!(this.depthFailMaterialProperty instanceof Jt)&&(this.depthFailMaterial=Ar.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,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),l(this.depthFailAppearanceType)&&this.depthFailMaterialProperty instanceof Jt&&!c.depthFailMaterialProperty.isConstant){const C=c.depthFailMaterialProperty.color,T=Z.getValueOrDefault(C,e,U.WHITE,Cet);U.equals(h._lastDepthFailColor,T)||(h._lastDepthFailColor=U.clone(T,h._lastDepthFailColor),h.depthFailColor=an.toValue(T,h.depthFailColor))}const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const C=Z.getValueOrDefault(p,e,get,_et);Ut.equals(C,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(C,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(C,h.distanceDisplayCondition))}const y=c.terrainOffsetProperty;if(!Z.isConstant(y)){const C=Z.getValueOrDefault(y,e,yet,Aet);d.equals(C,h._lastOffset)||(h._lastOffset=d.clone(C,h._lastOffset),h.offset=Ro.toValue(C,h.offset))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};pu.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=Hn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};pu.prototype.contains=function(e){return this.updaters.contains(e.id)};pu.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?pt.FAILED:(i.boundingSphere.clone(t),pt.DONE)};pu.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 jc(e,t,n,i,o){this._items=[],this._primitives=e,this._appearanceType=t,this._depthFailAppearanceType=n,this._closed=i,this._shadows=o}jc.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 pu(this._primitives,this._appearanceType,t.fillMaterialProperty,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);o.add(e,t),n.push(o)};jc.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}}};jc.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};jc.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 pt.FAILED};jc.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 Tet(e,t,n,i,o){XZ(e,t,n||0,i||e.length-1,o||bet)}function XZ(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),f=Math.max(n,Math.floor(t-s*c/r+u)),h=Math.min(i,Math.floor(t+(r-s)*c/r+u));XZ(e,t,f,h,o)}var _=e[t],g=n,p=i;for(EA(e,n,t),o(e[i],_)>0&&EA(e,n,i);g<p;){for(EA(e,g,p),g++,p--;o(e[g],_)<0;)g++;for(;o(e[p],_)>0;)p--}o(e[n],_)===0?EA(e,n,p):(p++,EA(e,p,i)),p<=t&&(n=p+1),t<=p&&(i=p-1)}}function EA(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function bet(e,t){return e<t?-1:e>t?1:0}class Eet{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(!Dx(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;Dx(t,c)&&(n.leaf?i.push(a):h1(t,c)?this._all(a,i):r.push(a))}n=r.pop()}return i}collides(t){let n=this.data;if(!Dx(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(Dx(t,s)){if(n.leaf||h1(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=Vg([]),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 f=xet(t,i.children,n);if(f!==-1)return i.children.splice(f,1),r.push(i),this._condense(r),this}!u&&!i.leaf&&h1(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=Vg(t.slice(n,i+1)),xg(a,this.toBBox),a;o||(o=Math.ceil(Math.log(r)/Math.log(s)),s=Math.ceil(r/Math.pow(s,o-1))),a=Vg([]),a.leaf=!1,a.height=o;const c=Math.ceil(r/s),u=c*Math.ceil(Math.sqrt(s));a5(t,n,i,u,this.compareMinX);for(let f=n;f<=i;f+=u){const h=Math.min(f+u-1,i);a5(t,f,h,c,this.compareMinY);for(let _=f;_<=h;_+=c){const g=Math.min(_+c-1,h);a.children.push(this._build(t,_,g,o-1))}}return xg(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],f=d1(u),h=Det(t,u)-f;h<s?(s=h,r=f<r?f:r,a=u):h===s&&f<r&&(r=f,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),jA(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=Vg(i.children.splice(s,i.children.length-s));a.height=i.height,a.leaf=i.leaf,xg(i,this.toBBox),xg(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(i,a)}_splitRoot(t,n){this.data=Vg([t,n]),this.data.height=t.height+1,this.data.leaf=!1,xg(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=WA(t,0,a,this.toBBox),u=WA(t,a,i,this.toBBox),f=Iet(c,u),h=d1(c)+d1(u);f<r?(r=f,o=a,s=h<s?h:s):f===r&&h<s&&(s=h,o=a)}return o||i-n}_chooseSplitAxis(t,n,i){const o=t.leaf?this.compareMinX:wet,r=t.leaf?this.compareMinY:vet,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=WA(t,0,n,r),a=WA(t,i-n,i,r);let c=vx(s)+vx(a);for(let u=n;u<i-n;u++){const f=t.children[u];jA(s,t.leaf?r(f):f),c+=vx(s)}for(let u=i-n-1;u>=n;u--){const f=t.children[u];jA(a,t.leaf?r(f):f),c+=vx(a)}return c}_adjustParentBBoxes(t,n,i){for(let o=i;o>=0;o--)jA(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():xg(t[n],this.toBBox)}}function xet(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 xg(e,t){WA(e,0,e.children.length,t,e)}function WA(e,t,n,i,o){o||(o=Vg(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];jA(o,e.leaf?i(s):s)}return o}function jA(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 wet(e,t){return e.minX-t.minX}function vet(e,t){return e.minY-t.minY}function d1(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function vx(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Det(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 Iet(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 h1(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Dx(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Vg(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function a5(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;Tet(e,s,t,n,o),r.push(t,s,s,n)}}function db(){this._tree=new Eet}function l_(){this.minX=0,this.minY=0,this.maxX=0,this.maxY=0,this.id=""}l_.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};db.prototype.insert=function(e,t){b.typeOf.string("id",e),b.typeOf.object("rectangle",t);const n=l_.fromRectangleAndId(e,t,new l_);this._tree.insert(n)};function Pet(e,t){return e.id===t.id}const Oet=new l_;db.prototype.remove=function(e,t){b.typeOf.string("id",e),b.typeOf.object("rectangle",t);const n=l_.fromRectangleAndId(e,t,Oet);this._tree.remove(n,Pet)};const Let=new l_;db.prototype.collides=function(e){b.typeOf.object("rectangle",e);const t=l_.fromRectangleAndId("",e,Let);return this._tree.collides(t)};const Bet=new U,Ret=new Ut,Net=new Ut;function kd(e,t,n,i){this.primitives=e,this.zIndex=i,this.classificationType=t,this.color=n,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.subscriptions=new xt,this.showsUpdated=new xt,this.itemsToRemove=[],this.isDirty=!1,this.rectangleCollisionCheck=new db}kd.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};kd.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)}))}};kd.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};kd.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 Fr({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],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.fillMaterialProperty.isConstant||c){const y=u.fillMaterialProperty.color,C=Z.getValueOrDefault(y,e,U.WHITE,Bet);U.equals(h._lastColor,C)||(h._lastColor=U.clone(C,h._lastColor),h.color=an.toValue(C,h.color))}const _=u.entity.isShowing&&(u.hasConstantFill||u.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,Net,Ret);Ut.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(y,h.distanceDisplayCondition))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};kd.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=Hn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};kd.prototype.contains=function(e){return this.updaters.contains(e.id)};kd.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getBoundingSphere(e.entity);return l(i)?(i.clone(t),pt.DONE):pt.FAILED};kd.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 u_(e,t){this._batches=[],this._primitives=e,this._classificationType=t}u_.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 kd(this._primitives,this._classificationType,n.attributes.color.value,o),i.push(r)),r.add(t,n),r};u_.prototype.remove=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;++i)if(t[i].remove(e))return};u_.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 f=this.add(e,n);s.isDirty=!0,f.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};u_.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 pt.FAILED};u_.prototype.removeAllPrimitives=function(){const e=this._batches,t=e.length;for(let n=0;n<t;++n)e[n].removeAllPrimitives()};const Met=new Ut,Fet=new Ut;function dl(e,t,n,i,o,r){this.primitives=e,this.classificationType=t,this.appearanceType=n,this.materialProperty=i,this.updaters=new xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=i.definitionChanged.addEventListener(dl.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt,this.usingSphericalTextureCoordinates=o,this.zIndex=r,this.rectangleCollisionCheck=new db}dl.prototype.onMaterialChanged=function(){this.invalidated=!0};dl.prototype.overlapping=function(e){return this.rectangleCollisionCheck.collides(e)};dl.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Jt&&t instanceof Jt?!0:l(t)&&t.equals(n)};dl.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};dl.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};dl.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=Ar.getValue(e,this.materialProperty,this.material),n=new Fr({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=Ar.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,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h));const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,Fet,Met);Ut.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};dl.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=Hn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};dl.prototype.contains=function(e){return this.updaters.contains(e.id)};dl.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?pt.FAILED:(i.boundingSphere.clone(t),pt.DONE)};dl.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 A0(e,t,n){this._items=[],this._primitives=e,this._classificationType=t,this._appearanceType=n}A0.prototype.add=function(e,t){const n=this._items,i=n.length,o=t.createFillGeometryInstance(e),r=is.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 dl(this._primitives,this._classificationType,this._appearanceType,t.fillMaterialProperty,r,s);a.add(e,t,o),n.push(a)};A0.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}}};A0.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};A0.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 pt.FAILED};A0.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 zet=new U,Uet=new Ut,Het=new Ut,Vet=d.ZERO,ket=new d;function yd(e,t,n,i){this.translucent=t,this.width=n,this.shadows=i,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.updaters=new xt,this.updatersWithAttributes=new xt,this.attributes=new xt,this.itemsToRemove=[],this.subscriptions=new xt,this.showsUpdated=new xt}yd.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)}))}};yd.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};yd.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 Wt({show:!1,asynchronous:!0,geometryInstances:s.slice(),appearance:new _n({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],f=this.geometry.get(u.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=i.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!u.outlineColorProperty.isConstant||c){const C=u.outlineColorProperty,T=Z.getValueOrDefault(C,e,U.WHITE,zet);U.equals(h._lastColor,T)||(h._lastColor=U.clone(T,h._lastColor),h.color=an.toValue(T,h.color),(this.translucent&&h.color[3]===255||!this.translucent&&h.color[3]!==255)&&(this.itemsToRemove[n++]=u))}const _=u.entity.isShowing&&(u.hasConstantOutline||u.isOutlineVisible(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=u.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const C=Z.getValueOrDefault(p,e,Het,Uet);Ut.equals(C,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(C,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(C,h.distanceDisplayCondition))}const y=u.terrainOffsetProperty;if(!Z.isConstant(y)){const C=Z.getValueOrDefault(y,e,Vet,ket);d.equals(C,h._lastOffset)||(h._lastOffset=d.clone(C,h._lastOffset),h.offset=Ro.toValue(C,h.offset))}}this.updateShows(i),this.waitingOnCreate=!1}else l(i)&&!i.ready&&(t=!1);return this.itemsToRemove.length=n,t};yd.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=Hn.toValue(a,s.show),r.attributes.show.value[0]=s.show[0])}this.showsUpdated.removeAll()};yd.prototype.contains=function(e){return this.updaters.contains(e.id)};yd.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?pt.FAILED:(i.boundingSphere.clone(t),pt.DONE)};yd.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,n){this._primitives=e,this._scene=t,this._shadows=n,this._solidBatches=new xt,this._translucentBatches=new xt}f_.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 yd(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 yd(this._primitives,!0,i,this._shadows),o.set(i,r)),r.add(t,n))};f_.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};f_.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,f=!0,h=!1;do{for(h=!1,n=0;n<s;n++){o=r[n],f=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(h=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}for(n=0;n<c;n++){o=a[n],f=o.update(e),u=o.itemsToRemove;const _=u.length;if(_>0)for(h=!0,t=0;t<_;t++)i=u[t],o.remove(i),this.add(e,i)}}while(h);return f};f_.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 pt.FAILED};f_.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 KZ={};function Get(e,t){return N.equalsEpsilon(e.latitude,t.latitude,N.EPSILON10)&&N.equalsEpsilon(e.longitude,t.longitude,N.EPSILON10)}const Wet=new Ae,jet=new Ae;function qet(e,t,n,i){t=Zs(t,d.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),f=t[0];a[0]=f;const h=e.cartesianToCartographic(f,Wet);s&&(h.height=n[0]),c[0]=h.height,r?u[0]=i[0]:u[0]=0;const _=c[0],g=u[0];let p=_===g,y=1;for(let C=1;C<o;++C){const T=t[C],E=e.cartesianToCartographic(T,jet);s&&(E.height=n[C]),p=p&&E.height===0,Get(h,E)?h.height<E.height&&(c[y-1]=E.height):(a[y]=T,c[y]=E.height,r?u[y]=i[C]:u[y]=0,p=p&&c[y]===u[y],Ae.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 Yet=new Array(2),$et=new Array(2),Xet={positions:void 0,height:void 0,granularity:void 0,ellipsoid:void 0};KZ.computePositions=function(e,t,n,i,o,r){const s=qet(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,f;const h=N.chordLength(o,e.maximumRadius),_=Xet;if(_.minDistance=h,_.ellipsoid=e,r){let g=0,p;for(p=0;p<a-1;p++)g+=sr.numberOfPoints(t[p],t[p+1],h)+1;u=new Float64Array(g*3),f=new Float64Array(g*3);const y=Yet,C=$et;_.positions=y,_.height=C;let T=0;for(p=0;p<a-1;p++){y[0]=t[p],y[1]=t[p+1],C[0]=n[p],C[1]=n[p+1];const E=sr.generateArc(_);u.set(E,T),C[0]=i[p],C[1]=i[p+1],f.set(sr.generateArc(_),T),T+=E.length}}else _.positions=t,_.height=n,u=new Float64Array(sr.generateArc(_)),_.height=i,f=new Float64Array(sr.generateArc(_));return{bottomPositions:f,topPositions:u,numCorners:c}};const JZ=KZ,p1=new d,Ix=new d,Ket=new d,c5=new d,Jet=new d,Qet=new d,Zet=new d;function d_(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,Ne.DEFAULT),r=A(e.granularity,N.RADIANS_PER_DEGREE),s=A(e.ellipsoid,pe.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._vertexFormat=Ne.clone(o),this._granularity=r,this._ellipsoid=pe.clone(s),this._workerName="createWallGeometry";let a=1+t.length*d.packedLength+2;l(i)&&(a+=i.length),l(n)&&(a+=n.length),this.packedLength=a+pe.packedLength+Ne.packedLength+1}d_.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+=d.packedLength)d.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 pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.packedLength,t[n]=e._granularity,t};const QZ=pe.clone(pe.UNIT_SPHERE),ZZ=new Ne,xA={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:QZ,vertexFormat:ZZ,granularity:void 0};d_.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+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=pe.unpack(e,t,QZ);t+=pe.packedLength;const u=Ne.unpack(e,t,ZZ);t+=Ne.packedLength;const f=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=pe.clone(c,n._ellipsoid),n._vertexFormat=Ne.clone(u,n._vertexFormat),n._granularity=f,n):(xA.positions=r,xA.minimumHeights=s,xA.maximumHeights=a,xA.granularity=f,new d_(xA))};d_.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 f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=r)}const c={positions:t,maximumHeights:i,minimumHeights:n,ellipsoid:e.ellipsoid,vertexFormat:e.vertexFormat};return new d_(c)};d_.createGeometry=function(e){const t=e._positions,n=e._minimumHeights,i=e._maximumHeights,o=e._vertexFormat,r=e._granularity,s=e._ellipsoid,a=JZ.computePositions(s,t,i,n,r,!0);if(!l(a))return;const c=a.bottomPositions,u=a.topPositions,f=a.numCorners;let h=u.length,_=h*2;const g=o.position?new Float64Array(_):void 0,p=o.normal?new Float32Array(_):void 0,y=o.tangent?new Float32Array(_):void 0,C=o.bitangent?new Float32Array(_):void 0,T=o.st?new Float32Array(_/3*2):void 0;let E=0,w=0,S=0,P=0,O=0,z=Zet,R=Qet,F=Jet,H=!0;h/=3;let v,I=0;const m=1/(h-f-1);for(v=0;v<h;++v){const k=v*3,W=d.fromArray(u,k,p1),G=d.fromArray(c,k,Ix);if(o.position&&(g[E++]=G.x,g[E++]=G.y,g[E++]=G.z,g[E++]=W.x,g[E++]=W.y,g[E++]=W.z),o.st&&(T[O++]=I,T[O++]=0,T[O++]=I,T[O++]=1),o.normal||o.tangent||o.bitangent){let K=d.clone(d.ZERO,c5);const q=d.subtract(W,s.geodeticSurfaceNormal(W,Ix),Ix);if(v+1<h&&(K=d.fromArray(u,k+3,c5)),H){const te=d.subtract(K,W,Ket),$=d.subtract(q,W,p1);z=d.normalize(d.cross($,te,z),z),H=!1}d.equalsEpsilon(W,K,N.EPSILON10)?H=!0:(I+=m,o.tangent&&(R=d.normalize(d.subtract(K,W,R),R)),o.bitangent&&(F=d.normalize(d.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&&(C[S++]=F.x,C[S++]=F.y,C[S++]=F.z,C[S++]=F.x,C[S++]=F.y,C[S++]=F.z)}}const D=new Ui;o.position&&(D.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:g})),o.normal&&(D.normal=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:p})),o.tangent&&(D.tangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:y})),o.bitangent&&(D.bitangent=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:3,values:C})),o.st&&(D.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:T}));const L=_/3;_-=6*(f+1);const M=it.createTypedArray(L,_);let V=0;for(v=0;v<L-2;v+=2){const k=v,W=v+2,G=d.fromArray(g,k*3,p1),K=d.fromArray(g,W*3,Ix);if(d.equalsEpsilon(G,K,N.EPSILON10))continue;const q=v+1,te=v+3;M[V++]=q,M[V++]=k,M[V++]=te,M[V++]=te,M[V++]=k,M[V++]=W}return new Dt({attributes:D,indices:M,primitiveType:Je.TRIANGLES,boundingSphere:new fe.fromVertices(g)})};const l5=new d,u5=new d;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,N.RADIANS_PER_DEGREE),r=A(e.ellipsoid,pe.WGS84);this._positions=t,this._minimumHeights=i,this._maximumHeights=n,this._granularity=o,this._ellipsoid=pe.clone(r),this._workerName="createWallOutlineGeometry";let s=1+t.length*d.packedLength+2;l(i)&&(s+=i.length),l(n)&&(s+=n.length),this.packedLength=s+pe.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+=d.packedLength)d.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 pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,t[n]=e._granularity,t};const eee=pe.clone(pe.UNIT_SPHERE),wA={positions:void 0,minimumHeights:void 0,maximumHeights:void 0,ellipsoid:eee,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+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];let s;if(o>0)for(s=new Array(o),i=0;i<o;++i)s[i]=e[t++];o=e[t++];let a;if(o>0)for(a=new Array(o),i=0;i<o;++i)a[i]=e[t++];const c=pe.unpack(e,t,eee);t+=pe.packedLength;const u=e[t];return l(n)?(n._positions=r,n._minimumHeights=s,n._maximumHeights=a,n._ellipsoid=pe.clone(c,n._ellipsoid),n._granularity=u,n):(wA.positions=r,wA.minimumHeights=s,wA.maximumHeights=a,wA.granularity=u,new h_(wA))};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 f=0;f<u;++f)s&&(n[f]=o),a&&(i[f]=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=JZ.computePositions(r,t,i,n,o,!1);if(!l(s))return;const a=s.bottomPositions,c=s.topPositions;let u=c.length,f=u*2;const h=new Float64Array(f);let _=0;u/=3;let g;for(g=0;g<u;++g){const E=g*3,w=d.fromArray(c,E,l5),S=d.fromArray(a,E,u5);h[_++]=S.x,h[_++]=S.y,h[_++]=S.z,h[_++]=w.x,h[_++]=w.y,h[_++]=w.z}const p=new Ui({position:new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:h})}),y=f/3;f=2*y-4+y;const C=it.createTypedArray(y,f);let T=0;for(g=0;g<y-2;g+=2){const E=g,w=g+2,S=d.fromArray(h,E*3,l5),P=d.fromArray(h,w*3,u5);if(d.equalsEpsilon(S,P,N.EPSILON10))continue;const O=g+1,z=g+3;C[T++]=O,C[T++]=E,C[T++]=O,C[T++]=z,C[T++]=E,C[T++]=w}return C[T++]=y-2,C[T++]=y-1,new Dt({attributes:p,indices:C,primitiveType:Je.LINES,boundingSphere:new fe.fromVertices(h)})};const tee=new U;function ett(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 Gl(e,t){Nn.call(this,{entity:e,scene:t,geometryOptions:new ett(e),geometryPropertyName:"wall",observedPropertyNames:["availability","wall"]}),this._onEntityPropertyChanged(e,"wall",e.wall,void 0)}l(Object.create)&&(Gl.prototype=Object.create(Nn.prototype),Gl.prototype.constructor=Gl);Gl.prototype.createFillGeometryInstance=function(e){if(b.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._fillProperty.getValue(e)),s=this._distanceDisplayConditionProperty.getValue(e),a=_i.fromDistanceDisplayCondition(s);if(this._materialProperty instanceof Jt){let c;l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(c=this._materialProperty.color.getValue(e,tee)),l(c)||(c=U.WHITE),o=an.fromColor(c),i={show:r,distanceDisplayCondition:a,color:o}}else i={show:r,distanceDisplayCondition:a};return new nn({id:t,geometry:new d_(this._options),attributes:i})};Gl.prototype.createOutlineGeometryInstance=function(e){if(b.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,U.BLACK,tee),o=this._distanceDisplayConditionProperty.getValue(e);return new nn({id:t,geometry:new h_(this._options),attributes:{show:new Hn(n&&t.isShowing&&this._showProperty.getValue(e)&&this._showOutlineProperty.getValue(e)),color:an.fromColor(i),distanceDisplayCondition:_i.fromDistanceDisplayCondition(o)}})};Gl.prototype._isHidden=function(e,t){return!l(t.positions)||Nn.prototype._isHidden.call(this,e,t)};Gl.prototype._getIsClosed=function(e){return!1};Gl.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)};Gl.prototype._setStaticOptions=function(e,t){const n=t.minimumHeights,i=t.maximumHeights,o=t.granularity,r=this._materialProperty instanceof Jt,s=this._options;s.vertexFormat=r?_n.VERTEX_FORMAT:Ho.MaterialSupport.TEXTURED.vertexFormat,s.positions=t.positions.getValue(lt.MINIMUM_VALUE,s.positions),s.minimumHeights=l(n)?n.getValue(lt.MINIMUM_VALUE,s.minimumHeights):void 0,s.maximumHeights=l(i)?i.getValue(lt.MINIMUM_VALUE,s.maximumHeights):void 0,s.granularity=l(o)?o.getValue(lt.MINIMUM_VALUE):void 0};Gl.DynamicGeometryUpdater=Ty;function Ty(e,t,n){si.call(this,e,t,n)}l(Object.create)&&(Ty.prototype=Object.create(si.prototype),Ty.prototype.constructor=Ty);Ty.prototype._isHidden=function(e,t,n){return!l(this._options.positions)||si.prototype._isHidden.call(this,e,t,n)};Ty.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 ttt=[],f5=[nc,ic,Hl,Vl,oc,Qc,rc,ku,kl,Gl];function hb(e,t){this.entity=e,this.scene=t;const n=new Array(f5.length),i=new $e;function o(s){i.raiseEvent(s)}const r=new Cf;for(let s=0;s<n.length;s++){const a=new f5[s](e,t);r.add(a.geometryChanged,o),n[s]=a}this.updaters=n,this.geometryChanged=i,this.eventHelper=r,this._removeEntitySubscription=e.definitionChanged.addEventListener(hb.prototype._onEntityPropertyChanged,this)}hb.prototype._onEntityPropertyChanged=function(e,t,n,i){const o=this.updaters;for(let r=0;r<o.length;r++)o[r]._onEntityPropertyChanged(e,t,n,i)};hb.prototype.forEach=function(e){const t=this.updaters;for(let n=0;n<t.length;n++)e(t[n])};hb.prototype.destroy=function(){this.eventHelper.removeAll();const e=this.updaters;for(let t=0;t<e.length;t++)e[t].destroy();this._removeEntitySubscription(),Ue(this)};function al(e,t,n,i){b.defined("scene",e),b.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 xt,this._removedObjects=new xt,this._changedObjects=new xt;const o=Co.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=Er.supportsMaterialsforEntitiesOnTerrain(e);this._supportsMaterialsforEntitiesOnTerrain=r;let s;for(s=0;s<o;++s)this._outlineBatches[s]=new f_(n,e,s),this._outlineBatches[o+s]=new f_(n,e,s),this._closedColorBatches[s]=new Wc(n,_n,void 0,!0,s),this._closedColorBatches[o+s]=new Wc(n,_n,void 0,!0,s),this._closedMaterialBatches[s]=new jc(n,Ho,void 0,!0,s),this._closedMaterialBatches[o+s]=new jc(n,Ho,void 0,!0,s),this._openColorBatches[s]=new Wc(n,_n,void 0,!1,s),this._openColorBatches[o+s]=new Wc(n,_n,void 0,!1,s),this._openMaterialBatches[s]=new jc(n,Ho,void 0,!1,s),this._openMaterialBatches[o+s]=new jc(n,Ho,void 0,!1,s);const a=go.NUMBER_OF_CLASSIFICATION_TYPES,c=new Array(a),u=[];if(r)for(s=0;s<a;++s)u.push(new A0(i,s,Ho)),c[s]=new u_(i,s);else for(s=0;s<a;++s)c[s]=new u_(i,s);this._groundColorBatches=c,this._groundMaterialBatches=u,this._dynamicBatch=new k_(n,i),this._batches=this._outlineBatches.concat(this._closedColorBatches,this._closedMaterialBatches,this._openColorBatches,this._openMaterialBatches,this._groundColorBatches,this._groundMaterialBatches,this._dynamicBatch),this._subscriptions=new xt,this._updaterSets=new xt,this._entityCollection=t,t.collectionChanged.addEventListener(al.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,ttt)}al.prototype.update=function(e){b.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,f;const h=this;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,f=this._updaterSets.get(u),f.entity===c?f.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,f=this._updaterSets.get(u),f.forEach(this._removeUpdater.bind(this)),f.destroy(),this._updaterSets.remove(u),this._subscriptions.get(u)(),this._subscriptions.remove(u);for(a=n.length-1;a>-1;a--)c=n[a],u=c.id,f=new hb(c,this._scene),this._updaterSets.set(u,f),f.forEach(function(y){h._insertUpdaterIntoBatch(e,y)}),this._subscriptions.set(u,f.geometryChanged.addEventListener(al._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let _=!0;const g=this._batches,p=g.length;for(a=0;a<p;a++)_=g[a].update(e)&&_;return _};const ntt=[],itt=new fe;al.prototype.getBoundingSphere=function(e,t){b.defined("entity",e),b.defined("result",t);const n=ntt,i=itt;let o=0,r=pt.DONE;const s=this._batches,a=s.length,c=e.id,u=this._updaterSets.get(c).updaters;for(let f=0;f<u.length;f++){const h=u[f];for(let _=0;_<a;_++){if(r=s[_].getBoundingSphere(h,i),r===pt.PENDING)return pt.PENDING;r===pt.DONE&&(n[o]=fe.clone(i,n[o]),o++)}}return o===0?pt.FAILED:(n.length=o,fe.fromBoundingSpheres(n,t),pt.DONE)};al.prototype.isDestroyed=function(){return!1};al.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(al.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(),Ue(this)};al.prototype._removeUpdater=function(e){const t=this._batches,n=t.length;for(let i=0;i<n;i++)t[i].remove(e)};al.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=Co.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 Jt?this._groundColorBatches[o].add(e,t):this._groundMaterialBatches[o].add(e,t)}else t.isClosed?t.fillMaterialProperty instanceof Jt?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 Jt?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)};al._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)};al.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 ott=1,rtt="30px sans-serif",stt=Nl.FILL,att=U.WHITE,ctt=U.BLACK,ltt=1,utt=!1,ftt=new U(.165,.165,.165,.8),dtt=new j(7,5),htt=j.ZERO,ptt=d.ZERO,mtt=Et.NONE,_tt=Ta.CENTER,gtt=Si.CENTER,ytt=new d,Att=new U,Ctt=new U,Ttt=new U,btt=new j,Ett=new d,xtt=new j,wtt=new Mt,Stt=new Mt,vtt=new Mt,Dtt=new Ut;function d5(e){this.entity=e,this.label=void 0,this.index=void 0}function _p(e,t){if(!l(e))throw new x("entityCluster is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(_p.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}_p.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,f=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(f&&(h=Z.getValueOrUndefined(s._position,e,ytt),c=Z.getValueOrUndefined(a._text,e),f=l(h)&&l(c)),!f){tR(r,s,n);continue}Z.isConstant(s._position)||(n._clusterDirty=!0);let _=!1;const g=Z.getValueOrDefault(a._heightReference,e,mtt);l(u)||(u=n.getLabel(s),u.id=s,r.label=u,_=d.equals(u.position,h)&&u.heightReference===g),u.show=!0,u.position=h,u.text=c,u.scale=Z.getValueOrDefault(a._scale,e,ott),u.font=Z.getValueOrDefault(a._font,e,rtt),u.style=Z.getValueOrDefault(a._style,e,stt),u.fillColor=Z.getValueOrDefault(a._fillColor,e,att,Att),u.outlineColor=Z.getValueOrDefault(a._outlineColor,e,ctt,Ctt),u.outlineWidth=Z.getValueOrDefault(a._outlineWidth,e,ltt),u.showBackground=Z.getValueOrDefault(a._showBackground,e,utt),u.backgroundColor=Z.getValueOrDefault(a._backgroundColor,e,ftt,Ttt),u.backgroundPadding=Z.getValueOrDefault(a._backgroundPadding,e,dtt,btt),u.pixelOffset=Z.getValueOrDefault(a._pixelOffset,e,htt,xtt),u.eyeOffset=Z.getValueOrDefault(a._eyeOffset,e,ptt,Ett),u.heightReference=g,u.horizontalOrigin=Z.getValueOrDefault(a._horizontalOrigin,e,_tt),u.verticalOrigin=Z.getValueOrDefault(a._verticalOrigin,e,gtt),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,wtt),u.pixelOffsetScaleByDistance=Z.getValueOrUndefined(a._pixelOffsetScaleByDistance,e,Stt),u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,vtt),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,Dtt),u.disableDepthTestDistance=Z.getValueOrUndefined(a._disableDepthTestDistance,e),_&&u._updateClamping()}return!0};_p.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 pt.FAILED;const i=n.label;return t.center=d.clone(A(i._clampedPosition,i.position),t.center),t.radius=0,pt.DONE};_p.prototype.isDestroyed=function(){return!1};_p.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(_p.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removeLabel(e[t]);return Ue(this)};_p.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 d5(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 d5(r)):(tR(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],tR(s.get(r.id),r,a),s.remove(r.id)};function tR(e,t,n){l(e)&&(e.label=void 0,n.removeLabel(t))}function Itt(e,t,n){return b.typeOf.object("terrainProvider",e),b.typeOf.number("level",t),b.defined("positions",n),e.readyPromise.then(function(){return Ltt(e,t,n)})}function Ptt(e,t){const n=e[0],i=n.terrainProvider.requestTileGeometry(n.x,n.y,n.level);if(!i)return!1;const o=i.then(Btt(n)).catch(Rtt(n));return e.shift(),t.push(o),!0}function Ott(e){return new Promise(function(t){setTimeout(t,e)})}function nR(e,t){return e.length?Ptt(e,t)?nR(e,t):Ott(100).then(()=>nR(e,t)):Promise.resolve()}function Ltt(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 f={x:c.x,y:c.y,level:t,tilingScheme:i,terrainProvider:e,positions:[]};s[u]=f,r.push(f)}s[u].positions.push(n[o])}const a=[];return nR(r,a).then(function(){return Promise.all(a).then(function(){return n})})}function h5(e,t,n){const i=t.interpolateHeight(n,e.longitude,e.latitude);return i===void 0?!1:(e.height=i,!0)}function Btt(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(!h5(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];h5(s,i,n)}}):Promise.resolve()}}function Rtt(e){const t=e.positions;return function(){for(let n=0;n<t.length;++n){const i=t[n];i.height=void 0}}}const m1=new j;function _D(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,m1);const f=e.loadTileDataAvailability(m1.x,m1.y,1);l(f)&&r.push(f)}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 Itt(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 _D(e,s)}).then(function(){return t})})}const Ntt=1,Mtt=0,Ftt=!0,ztt=!0,Utt=Co.ENABLED,Htt=Et.NONE,Vtt=U.RED,ktt=0,Gtt=U.WHITE,Wtt=iD.HIGHLIGHT,jtt=.5,qtt=new j(1,1),Ytt=new B,$tt=new B,p5=new U;function Ju(e,t){b.typeOf.object("scene",e),b.typeOf.object("entityCollection",t),t.collectionChanged.addEventListener(Ju.prototype._onCollectionChanged,this),this._scene=e,this._primitives=e.primitives,this._entityCollection=t,this._modelHash={},this._entitiesToVisualize=new xt,this._onCollectionChanged(t,t.values,[],[])}Ju.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],f=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),h;if(f&&(h=s.computeModelMatrix(e,Ytt),c=Re.createIfNeeded(Z.getValueOrUndefined(a._uri,e)),f=l(h)&&l(c)),!f){l(u)&&(u.modelPrimitive.show=!1);continue}let _=l(u)?u.modelPrimitive:void 0;if((!l(_)||c.url!==u.url)&&(l(_)&&(i.removeAndDestroy(_),delete n[s.id]),_=ui.fromGltf({url:c,incrementallyLoadTextures:Z.getValueOrDefault(a._incrementallyLoadTextures,e,Ftt),scene:this._scene}),_.id=s,i.add(_),u={modelPrimitive:_,url:c.url,animationsRunning:!1,nodeTransformationsScratch:{},articulationsScratch:{},loadFail:!1,awaitingSampleTerrain:!1,clampedBoundingSphere:void 0,sampleTerrainFailed:!1},n[s.id]=u,Ktt(_,s,n)),_.show=!0,_.scale=Z.getValueOrDefault(a._scale,e,Ntt),_.minimumPixelSize=Z.getValueOrDefault(a._minimumPixelSize,e,Mtt),_.maximumScale=Z.getValueOrUndefined(a._maximumScale,e),_.modelMatrix=B.clone(h,_.modelMatrix),_.shadows=Z.getValueOrDefault(a._shadows,e,Utt),_.heightReference=Z.getValueOrDefault(a._heightReference,e,Htt),_.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e),_.silhouetteColor=Z.getValueOrDefault(a._silhouetteColor,e,Vtt,p5),_.silhouetteSize=Z.getValueOrDefault(a._silhouetteSize,e,ktt),_.color=Z.getValueOrDefault(a._color,e,Gtt,p5),_.colorBlendMode=Z.getValueOrDefault(a._colorBlendMode,e,Wtt),_.colorBlendAmount=Z.getValueOrDefault(a._colorBlendAmount,e,jtt),_.clippingPlanes=Z.getValueOrUndefined(a._clippingPlanes,e),_.clampAnimations=Z.getValueOrDefault(a._clampAnimations,e,ztt),_.imageBasedLighting.imageBasedLightingFactor=Z.getValueOrDefault(a._imageBasedLightingFactor,e,qtt),_.lightColor=Z.getValueOrUndefined(a._lightColor,e),_.customShader=Z.getValueOrUndefined(a._customShader,e),_.ready){const g=Z.getValueOrDefault(a._runAnimations,e,!0);u.animationsRunning!==g&&(g?_.activeAnimations.addAll({loop:Wf.REPEAT}):_.activeAnimations.removeAll(),u.animationsRunning=g);const p=Z.getValueOrUndefined(a._nodeTransformations,e,u.nodeTransformationsScratch);if(l(p)){const T=Object.keys(p);for(let E=0,w=T.length;E<w;++E){const S=T[E],P=p[S];if(!l(P))continue;const O=_.getNode(S);if(!l(O))continue;const z=B.fromTranslationRotationScale(P,$tt);O.matrix=B.multiply(O.originalMatrix,z,z)}}let y=!1;const C=Z.getValueOrUndefined(a._articulations,e,u.articulationsScratch);if(l(C)){const T=Object.keys(C);for(let E=0,w=T.length;E<w;++E){const S=T[E],P=C[S];l(P)&&(y=!0,_.setArticulationStage(S,P))}}y&&_.applyArticulations()}}return!0};Ju.prototype.isDestroyed=function(){return!1};Ju.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Ju.prototype._onCollectionChanged,this);const e=this._entitiesToVisualize.values,t=this._modelHash,n=this._primitives;for(let i=e.length-1;i>-1;i--)iR(this,e[i],t,n);return Ue(this)};Ju._sampleTerrainMostDetailed=_D;const wg=new d,m5=new Ae;Ju.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 pt.FAILED;const i=n.modelPrimitive;if(!l(i)||!i.show)return pt.FAILED;if(!i.ready)return pt.PENDING;const r=this._scene.globe,s=r.ellipsoid,a=r.terrainProvider;if(i.heightReference!==Et.NONE){if(!a.ready)return pt.PENDING;const u=i.modelMatrix;wg.x=u[12],wg.y=u[13],wg.z=u[14];const f=s.cartesianToCartographic(wg);if(!l(a.availability)){i.heightReference===Et.CLAMP_TO_GROUND&&(f.height=0);const g=s.cartographicToCartesian(f);return fe.clone(i.boundingSphere,t),t.center=g,pt.DONE}let h=this._modelHash[e.id].clampedBoundingSphere;return this._modelHash[e.id].sampleTerrainFailed?(this._modelHash[e.id].sampleTerrainFailed=!1,pt.FAILED):l(h)?(fe.clone(h,t),this._modelHash[e.id].clampedBoundingSphere=void 0,pt.DONE):(h=new fe,this._modelHash[e.id].awaitingSampleTerrain||(Ae.clone(f,m5),this._modelHash[e.id].awaitingSampleTerrain=!0,Ju._sampleTerrainMostDetailed(a,[m5]).then(p=>{this._modelHash[e.id].awaitingSampleTerrain=!1;const y=p[0];i.heightReference===Et.RELATIVE_TO_GROUND&&(y.height+=f.height),s.cartographicToCartesian(y,wg),fe.clone(i.boundingSphere,h),h.center=wg,this._modelHash[e.id].clampedBoundingSphere=fe.clone(h)}).catch(p=>{this._modelHash[e.id].sampleTerrainFailed=!0,this._modelHash[e.id].awaitingSampleTerrain=!1})),pt.PENDING)}return fe.clone(i.boundingSphere,t),pt.DONE};Ju.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)?(Xtt(r,a),s.set(r.id,r)):(iR(this,r,a,c),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],iR(this,r,a,c),s.remove(r.id)};function iR(e,t,n,i){const o=n[t.id];l(o)&&(i.removeAndDestroy(o.modelPrimitive),delete n[t.id])}function Xtt(e,t){const n=t[e.id];l(n)&&(n.nodeTransformationsScratch={},n.articulationsScratch={})}function Ktt(e,t,n){e.readyPromise.catch(function(i){console.error(i),n[t.id].loadFail=!0})}function gp(e){this._definitionChanged=new $e,this._value=void 0,this._removeSubscription=void 0,this.setValue(e)}Object.defineProperties(gp.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:ea.FIXED}}});gp.prototype.getValue=function(e,t){return this.getValueInReferenceFrame(e,ea.FIXED,t)};gp.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))};gp.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)?pe.WGS84.scaleToGeodeticSurface(n,n):void 0};gp.prototype.equals=function(e){return this===e||e instanceof gp&&this._value===e._value};gp.prototype._raiseDefinitionChanged=function(){this._definitionChanged.raiseEvent(this)};const Jtt=60,Qtt=1,nee=new Zt,_1=new Zt,g1=new Zt;function _5(e){this.entity=e,this.polyline=void 0,this.index=void 0,this.updater=void 0}function Ztt(e,t,n,i,o,r,s,a,c){let u=a,f;f=e.getValueInReferenceFrame(t,r,c[u]),l(f)&&(c[u++]=f);let h=!l(o)||ne.lessThanOrEquals(o,t)||ne.greaterThanOrEquals(o,n),_=0;const g=i.length;let p=i[_];const y=n;let C=!1,T,E,w;for(;_<g;){if(!h&&ne.greaterThanOrEquals(p,o)&&(f=e.getValueInReferenceFrame(o,r,c[u]),l(f)&&(c[u++]=f),h=!0),ne.greaterThan(p,t)&&ne.lessThan(p,y)&&!p.equals(o)&&(f=e.getValueInReferenceFrame(p,r,c[u]),l(f)&&(c[u++]=f)),_<g-1){if(s>0&&!C){const S=i[_+1],P=ne.secondsDifference(S,p);C=P>s,C&&(T=Math.ceil(P/s),E=0,w=P/Math.max(T,2),T=Math.max(T-1,1))}if(C&&E<T){p=ne.addSeconds(p,w,new ne),E++;continue}}C=!1,_++,p=i[_]}return f=e.getValueInReferenceFrame(n,r,c[u]),l(f)&&(c[u++]=f),u}function ent(e,t,n,i,o,r,s,a){let c,u=0,f=s,h=t;const _=Math.max(r,60);let g=!l(i)||ne.lessThanOrEquals(i,t)||ne.greaterThanOrEquals(i,n);for(;ne.lessThan(h,n);)!g&&ne.greaterThanOrEquals(h,i)&&(g=!0,c=e.getValueInReferenceFrame(i,o,a[f]),l(c)&&(a[f]=c,f++)),c=e.getValueInReferenceFrame(h,o,a[f]),l(c)&&(a[f]=c,f++),u++,h=ne.addSeconds(t,_*u,new ne);return c=e.getValueInReferenceFrame(n,o,a[f]),l(c)&&(a[f]=c,f++),f}function tnt(e,t,n,i,o,r,s,a){g1.start=t,g1.stop=n;let c=s;const u=e.intervals;for(let f=0;f<u.length;f++){const h=u.get(f);if(!Zt.intersect(h,g1,nee).isEmpty){let _=h.start;h.isStartIncluded||(h.isStopIncluded?_=h.stop:_=ne.addSeconds(h.start,ne.secondsDifference(h.stop,h.start)/2,new ne));const g=e.getValueInReferenceFrame(_,o,a[c]);l(g)&&(a[c]=g,c++)}}return c}function nnt(e,t,n,i,o,r,s,a){const c=e.getValueInReferenceFrame(t,o,a[s]);return l(c)&&(a[s++]=c),s}function int(e,t,n,i,o,r,s,a){_1.start=t,_1.stop=n;let c=s;const u=e.intervals;for(let f=0;f<u.length;f++){const h=u.get(f);if(!Zt.intersect(h,_1,nee).isEmpty){const _=h.start,g=h.stop;let p=t;ne.greaterThan(_,p)&&(p=_);let y=n;ne.lessThan(g,y)&&(y=g),c=iee(h.data,p,y,i,o,r,c,a)}}return c}function iee(e,t,n,i,o,r,s,a){for(;e instanceof hc;)e=e.resolvedProperty;if(e instanceof pc){const c=e._property._times;s=Ztt(e,t,n,c,i,o,r,s,a)}else e instanceof pp?s=int(e,t,n,i,o,r,s,a):e instanceof mp?s=tnt(e,t,n,i,o,r,s,a):e instanceof _d||e instanceof gp&&Z.isConstant(e)?s=nnt(e,t,n,i,o,r,s,a):s=ent(e,t,n,i,o,r,s,a);return s}function oee(e,t,n,i,o,r,s){l(s)||(s=[]);const a=iee(e,t,n,i,o,r,0,s);return s.length=a,s}const g5=new J;function pb(e,t){this._unusedIndexes=[],this._polylineCollection=new Ha,this._scene=e,this._referenceFrame=t,e.primitives.add(this._polylineCollection)}pb.prototype.update=function(e){if(this._referenceFrame===ea.INERTIAL){let t=tn.computeIcrfToFixedMatrix(e,g5);l(t)||(t=tn.computeTemeToPseudoFixedMatrix(e,g5)),B.fromRotationTranslation(t,d.ZERO,this._polylineCollection.modelMatrix)}};pb.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),_=Z.getValueOrUndefined(i._trailTime,e),g=n._availability,p=l(g),y=l(h),C=l(_);if(u=p||y&&C,u){if(C&&(r=ne.addSeconds(e,-_,new ne)),y&&(s=ne.addSeconds(e,h,new ne)),p){const T=g.start,E=g.stop;(!C||ne.greaterThan(T,r))&&(r=T),(!y||ne.lessThan(E,s))&&(s=E)}u=ne.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 f=Z.getValueOrDefault(i._resolution,e,Jtt);c.show=!0,c.positions=oee(o,r,s,e,this._referenceFrame,f,c.positions.slice()),c.material=Ar.getValue(e,i._material,c.material),c.width=Z.getValueOrDefault(i._width,e,Qtt),c.distanceDisplayCondition=Z.getValueOrUndefined(i._distanceDisplayCondition,e,c.distanceDisplayCondition)};pb.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)};pb.prototype.destroy=function(){return this._scene.primitives.remove(this._polylineCollection),Ue(this)};function yp(e,t){if(!l(e))throw new x("scene is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(yp.prototype._onCollectionChanged,this),this._scene=e,this._updaters={},this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}yp.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=ea.FIXED;this._scene.mode===le.SCENE3D&&(u=a.referenceFrame);let f=this._updaters[u];if(c===f&&l(f)){f.updateObject(e,r);continue}l(c)&&c.removeObject(r),l(f)||(f=new pb(this._scene,u),f.update(e),this._updaters[u]=f),r.updater=f,l(f)&&f.updateObject(e,r)}return!0};yp.prototype.isDestroyed=function(){return!1};yp.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(yp.prototype._onCollectionChanged,this);const e=this._updaters;for(const t in e)e.hasOwnProperty(t)&&e[t].destroy();return Ue(this)};yp.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 _5(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 _5(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))};yp._subSample=oee;const y5=U.WHITE,A5=U.BLACK,C5=0,T5=1,b5=0,E5=new U,ont=new d,x5=new U,w5=new Mt,S5=new Mt,v5=new Ut;function D5(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 Ap(e,t){if(!l(e))throw new x("entityCluster is required.");if(!l(t))throw new x("entityCollection is required.");t.collectionChanged.addEventListener(Ap.prototype._onCollectionChanged,this),this._cluster=e,this._entityCollection=t,this._items=new xt,this._onCollectionChanged(t,t.values,[],[])}Ap.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 f=Z.getValueOrDefault(a._heightReference,e,Et.NONE);let h=s.isShowing&&s.isAvailable(e)&&Z.getValueOrDefault(a._show,e,!0),_;if(h&&(_=Z.getValueOrUndefined(s._position,e,ont),h=l(_)),!h){EC(r,s,n);continue}Z.isConstant(s._position)||(n._clusterDirty=!0);let g=!1,p=!1;if(f!==Et.NONE&&!l(u)?(l(c)&&(EC(r,s,n),c=void 0),u=n.getBillboard(s),u.id=s,u.image=void 0,r.billboard=u,g=!0,p=d.equals(u.position,_)&&u.heightReference===f):f===Et.NONE&&!l(c)&&(l(u)&&(EC(r,s,n),u=void 0),c=n.getPoint(s),c.id=s,r.pointPrimitive=c),l(c))c.show=!0,c.position=_,c.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,w5),c.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,S5),c.color=Z.getValueOrDefault(a._color,e,y5,E5),c.outlineColor=Z.getValueOrDefault(a._outlineColor,e,A5,x5),c.outlineWidth=Z.getValueOrDefault(a._outlineWidth,e,C5),c.pixelSize=Z.getValueOrDefault(a._pixelSize,e,T5),c.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,v5),c.disableDepthTestDistance=Z.getValueOrDefault(a._disableDepthTestDistance,e,b5);else if(l(u)){u.show=!0,u.position=_,u.scaleByDistance=Z.getValueOrUndefined(a._scaleByDistance,e,w5),u.translucencyByDistance=Z.getValueOrUndefined(a._translucencyByDistance,e,S5),u.distanceDisplayCondition=Z.getValueOrUndefined(a._distanceDisplayCondition,e,v5),u.disableDepthTestDistance=Z.getValueOrDefault(a._disableDepthTestDistance,e,b5),u.heightReference=f;const y=Z.getValueOrDefault(a._color,e,y5,E5),C=Z.getValueOrDefault(a._outlineColor,e,A5,x5),T=Math.round(Z.getValueOrDefault(a._outlineWidth,e,C5));let E=Math.max(1,Math.round(Z.getValueOrDefault(a._pixelSize,e,T5)));if(T>0?(u.scale=1,g=g||T!==r.outlineWidth||E!==r.pixelSize||!U.equals(y,r.color)||!U.equals(C,r.outlineColor)):(u.scale=E/50,E=50,g=g||T!==r.outlineWidth||!U.equals(y,r.color)||!U.equals(C,r.outlineColor)),g){r.color=U.clone(y,r.color),r.outlineColor=U.clone(C,r.outlineColor),r.pixelSize=E,r.outlineWidth=T;const w=y.alpha,S=y.toCssColorString(),P=C.toCssColorString(),O=JSON.stringify([S,E,P,T]);u.setImage(O,PJ(w,S,P,T,E))}p&&u._updateClamping()}}return!0};Ap.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 pt.FAILED;if(l(n.pointPrimitive))t.center=d.clone(n.pointPrimitive.position,t.center);else{const i=n.billboard;if(!l(i._clampedPosition))return pt.PENDING;t.center=d.clone(i._clampedPosition,t.center)}return t.radius=0,pt.DONE};Ap.prototype.isDestroyed=function(){return!1};Ap.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Ap.prototype._onCollectionChanged,this);const e=this._entityCollection.values;for(let t=0;t<e.length;t++)this._cluster.removePoint(e[t]);return Ue(this)};Ap.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 D5(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 D5(r)):(EC(s.get(r.id),r,a),s.remove(r.id));for(o=n.length-1;o>-1;o--)r=n[o],EC(s.get(r.id),r,a),s.remove(r.id)};function EC(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 ree=[];function rnt(e,t,n,i,o){const r=ree;r.length=o;let s;const a=n.red,c=n.green,u=n.blue,f=n.alpha,h=i.red,_=i.green,g=i.blue,p=i.alpha;if(U.equals(n,i)){for(s=0;s<o;s++)r[s]=U.clone(n);return r}const y=(h-a)/o,C=(_-c)/o,T=(g-u)/o,E=(p-f)/o;for(s=0;s<o;s++)r[s]=new U(a+s*y,c+s*C,u+s*T,f+s*E);return r}function gT(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=Ne.clone(A(e.vertexFormat,Ne.DEFAULT)),this._arcType=A(e.arcType,xn.GEODESIC),this._granularity=A(e.granularity,N.RADIANS_PER_DEGREE),this._ellipsoid=pe.clone(A(e.ellipsoid,pe.WGS84)),this._workerName="createPolylineGeometry";let r=1+t.length*d.packedLength;r+=l(n)?1+n.length*U.packedLength:1,this.packedLength=r+pe.packedLength+Ne.packedLength+4}gT.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+=d.packedLength)d.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+=U.packedLength)U.pack(s[i],t,n);return pe.pack(e._ellipsoid,t,n),n+=pe.packedLength,Ne.pack(e._vertexFormat,t,n),n+=Ne.packedLength,t[n++]=e._width,t[n++]=e._colorsPerVertex?1:0,t[n++]=e._arcType,t[n]=e._granularity,t};const see=pe.clone(pe.UNIT_SPHERE),aee=new Ne,dm={positions:void 0,colors:void 0,ellipsoid:see,vertexFormat:aee,width:void 0,colorsPerVertex:void 0,arcType:void 0,granularity:void 0};gT.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+=d.packedLength)r[i]=d.unpack(e,t);o=e[t++];const s=o>0?new Array(o):void 0;for(i=0;i<o;++i,t+=U.packedLength)s[i]=U.unpack(e,t);const a=pe.unpack(e,t,see);t+=pe.packedLength;const c=Ne.unpack(e,t,aee);t+=Ne.packedLength;const u=e[t++],f=e[t++]===1,h=e[t++],_=e[t];return l(n)?(n._positions=r,n._colors=s,n._ellipsoid=pe.clone(a,n._ellipsoid),n._vertexFormat=Ne.clone(c,n._vertexFormat),n._width=u,n._colorsPerVertex=f,n._arcType=h,n._granularity=_,n):(dm.positions=r,dm.colors=s,dm.width=u,dm.colorsPerVertex=f,dm.arcType=h,dm.granularity=_,new gT(dm))};const I5=new d,P5=new d,O5=new d,L5=new d;gT.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,f;const h=[];let _=Zs(e._positions,d.equalsEpsilon,!1,h);if(l(i)&&h.length>0){let L=0,M=h[0];i=i.filter(function(V,k){let W=!1;return o?W=k===M||k===0&&M===1:W=k+1===M,W?(L++,M=h[L],!1):!0})}let g=_.length;if(g<2||t<=0)return;if(r===xn.GEODESIC||r===xn.RHUMB){let L,M;r===xn.GEODESIC?(L=N.chordLength(s,a.maximumRadius),M=sr.numberOfPoints):(L=s,M=sr.numberOfPointsRhumbLine);const V=sr.extractHeights(_,a);if(l(i)){let k=1;for(c=0;c<g-1;++c)k+=M(_[c],_[c+1],L);const W=new Array(k);let G=0;for(c=0;c<g-1;++c){const K=_[c],q=_[c+1],te=i[c],$=M(K,q,L);if(o&&c<k){const X=i[c+1],Y=rnt(K,q,te,X,$),ae=Y.length;for(u=0;u<ae;++u)W[G++]=Y[u]}else for(u=0;u<$;++u)W[G++]=U.clone(te)}W[G]=U.clone(i[i.length-1]),i=W,ree.length=0}r===xn.GEODESIC?_=sr.generateCartesianArc({positions:_,minDistance:L,ellipsoid:a,height:V}):_=sr.generateCartesianRhumbArc({positions:_,granularity:L,ellipsoid:a,height:V})}g=_.length;const p=g*4-4,y=new Float64Array(p*3),C=new Float64Array(p*3),T=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,O=0,z=0,R=0,F;for(u=0;u<g;++u){u===0?(F=I5,d.subtract(_[0],_[1],F),d.add(_[0],F,F)):F=_[u-1],d.clone(F,O5),d.clone(_[u],P5),u===g-1?(F=I5,d.subtract(_[g-1],_[g-2],F),d.add(_[g-1],F,F)):F=_[u+1],d.clone(F,L5);let L,M;l(S)&&(u!==0&&!o?L=i[u-1]:L=i[u],u!==g-1&&(M=i[u]));const V=u===0?2:0,k=u===g-1?2:4;for(f=V;f<k;++f){d.pack(P5,y,P),d.pack(O5,C,P),d.pack(L5,T,P),P+=3;const W=f-2<0?-1:1;if(E[O++]=2*(f%2)-1,E[O++]=W*t,n.st&&(w[z++]=u/(g-1),w[z++]=Math.max(E[O-2],0)),l(S)){const G=f<2?L:M;S[R++]=U.floatToByte(G.red),S[R++]=U.floatToByte(G.green),S[R++]=U.floatToByte(G.blue),S[R++]=U.floatToByte(G.alpha)}}}const H=new Ui;H.position=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:y}),H.prevPosition=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:C}),H.nextPosition=new ze({componentDatatype:ee.DOUBLE,componentsPerAttribute:3,values:T}),H.expandAndWidth=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:E}),n.st&&(H.st=new ze({componentDatatype:ee.FLOAT,componentsPerAttribute:2,values:w})),l(S)&&(H.color=new ze({componentDatatype:ee.UNSIGNED_BYTE,componentsPerAttribute:4,values:S,normalize:!0}));const v=it.createTypedArray(p,g*6-6);let I=0,m=0;const D=g-1;for(u=0;u<D;++u)v[m++]=I,v[m++]=I+2,v[m++]=I+1,v[m++]=I+1,v[m++]=I+2,v[m++]=I+3,I+=4;return new Dt({attributes:H,indices:v,primitiveType:Je.TRIANGLES,boundingSphere:fe.fromPoints(_),geometryType:qg.POLYLINES})};const snt=new Wo(0),jS={},B5=new U,ant=new Jt(U.WHITE),cnt=new Wo(!0),lnt=new Wo(Co.DISABLED),unt=new Wo(new Ut),fnt=new Wo(go.BOTH);function dnt(){this.vertexFormat=void 0,this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function hnt(){this.positions=void 0,this.width=void 0,this.arcType=void 0,this.granularity=void 0}function mu(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(mu.prototype._onEntityPropertyChanged,this),this._fillEnabled=!1,this._dynamic=!1,this._geometryChanged=new $e,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 dnt,this._groundGeometryOptions=new hnt,this._id=`polyline-${e.id}`,this._clampToGround=!1,this._supportsPolylinesOnTerrain=Er.supportsPolylinesOnTerrain(t),this._zIndex=0,this._onEntityPropertyChanged(e,"polyline",e.polyline,void 0)}Object.defineProperties(mu.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}}});mu.prototype.isOutlineVisible=function(e){return!1};mu.prototype.isFilled=function(e){const t=this._entity,n=this._fillEnabled&&t.isAvailable(e)&&this._showProperty.getValue(e);return A(n,!1)};mu.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 Hn(n&&t.isShowing&&this._showProperty.getValue(e)),o=this._distanceDisplayConditionProperty.getValue(e),r=_i.fromDistanceDisplayCondition(o),s={show:i,distanceDisplayCondition:r};let a;return this._materialProperty instanceof Jt&&(l(this._materialProperty.color)&&(this._materialProperty.color.isConstant||n)&&(a=this._materialProperty.color.getValue(e,B5)),l(a)||(a=U.WHITE),s.color=an.fromColor(a)),this.clampToGround?new nn({id:t,geometry:new pd(this._groundGeometryOptions),attributes:s}):(l(this._depthFailMaterialProperty)&&this._depthFailMaterialProperty instanceof Jt&&(l(this._depthFailMaterialProperty.color)&&(this._depthFailMaterialProperty.color.isConstant||n)&&(a=this._depthFailMaterialProperty.color.getValue(e,B5)),l(a)||(a=U.WHITE),s.depthFailColor=an.fromColor(a)),new nn({id:t,geometry:new gT(this._geometryOptions),attributes:s}))};mu.prototype.createOutlineGeometryInstance=function(e){throw new x("This instance does not represent an outlined geometry.")};mu.prototype.isDestroyed=function(){return!1};mu.prototype.destroy=function(){this._entitySubscription(),Ue(this)};mu.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(lt.MINIMUM_VALUE)||!l(r)){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}const a=o.zIndex,c=A(o.material,ant),u=c instanceof Jt;this._materialProperty=c,this._depthFailMaterialProperty=o.depthFailMaterial,this._showProperty=A(s,cnt),this._shadowsProperty=A(o.shadows,lnt),this._distanceDisplayConditionProperty=A(o.distanceDisplayCondition,unt),this._classificationTypeProperty=A(o.classificationType,fnt),this._fillEnabled=!0,this._zIndex=A(a,snt);const f=o.width,h=o.arcType,_=o.clampToGround,g=o.granularity;if(!r.isConstant||!Z.isConstant(f)||!Z.isConstant(h)||!Z.isConstant(g)||!Z.isConstant(_)||!Z.isConstant(a))this._dynamic||(this._dynamic=!0,this._geometryChanged.raiseEvent(this));else{const p=this._geometryOptions,y=r.getValue(lt.MINIMUM_VALUE,p.positions);if(!l(y)||y.length<2){this._fillEnabled&&(this._fillEnabled=!1,this._geometryChanged.raiseEvent(this));return}let C;u&&(!l(this._depthFailMaterialProperty)||this._depthFailMaterialProperty instanceof Jt)?C=Vs.VERTEX_FORMAT:C=_s.VERTEX_FORMAT,p.vertexFormat=C,p.positions=y,p.width=l(f)?f.getValue(lt.MINIMUM_VALUE):void 0,p.arcType=l(h)?h.getValue(lt.MINIMUM_VALUE):void 0,p.granularity=l(g)?g.getValue(lt.MINIMUM_VALUE):void 0;const T=this._groundGeometryOptions;T.positions=y,T.width=p.width,T.arcType=p.arcType,T.granularity=p.granularity,this._clampToGround=l(_)?_.getValue(lt.MINIMUM_VALUE):!1,!this._clampToGround&&l(a)&&Di("Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."),this._dynamic=!1,this._geometryChanged.raiseEvent(this)}};mu.prototype.createDynamicUpdater=function(e,t){if(b.defined("primitives",e),b.defined("groundPrimitives",t),!this._dynamic)throw new x("This instance does not represent dynamic geometry.");return new mb(e,t,this)};const Sg={positions:void 0,granularity:void 0,height:void 0,ellipsoid:void 0};function mb(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 cee(e){if(l(e._line))return e._line;const t=e._geometryUpdater._scene.id;let n=jS[t];const i=e._primitives;!l(n)||n.isDestroyed()?(n=new Ha,jS[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}mb.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,xn.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 f=t.fillMaterialProperty;let h;if(f instanceof Jt)h=new Vs;else{const _=Ar.getValue(e,f,this._material);h=new _s({material:_,translucent:_.isTranslucent()}),this._material=_}this._groundPolylinePrimitive=s.add(new il({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=cee(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=xn.GEODESIC;c=Z.getValueOrDefault(i._arcType,e,c);const u=t._scene.globe;c!==xn.NONE&&l(u)&&(Sg.ellipsoid=u.ellipsoid,Sg.positions=r,Sg.granularity=Z.getValueOrUndefined(i._granularity,e),Sg.height=sr.extractHeights(r,u.ellipsoid),c===xn.GEODESIC?r=sr.generateCartesianArc(Sg):r=sr.generateCartesianRhumbArc(Sg)),a.show=!0,a.positions=r.slice(),a.material=Ar.getValue(e,t.fillMaterialProperty,a.material),a.width=Z.getValueOrDefault(i._width,e,1),a.distanceDisplayCondition=Z.getValueOrUndefined(i._distanceDisplayCondition,e,a.distanceDisplayCondition)};mb.prototype.getBoundingSphere=function(e){if(b.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),pt.DONE}return l(t)&&!t.ready?pt.PENDING:pt.DONE}else{const t=cee(this);if(t.show&&t.positions.length>0)return fe.fromPoints(t.positions,e),pt.DONE}return pt.FAILED};mb.prototype.isDestroyed=function(){return!1};mb.prototype.destroy=function(){const t=this._geometryUpdater._scene.id,n=jS[t];l(n)&&(n.remove(this._line),n.length===0&&(this._primitives.removeAndDestroy(n),delete jS[t])),l(this._groundPolylinePrimitive)&&this._groundPrimitives.remove(this._groundPolylinePrimitive),Ue(this)};const pnt=new U,mnt=new Ut,_nt=new Ut;function _u(e,t,n,i,o){let r;n instanceof Jt?r=Vs:r=_s,this.orderedGroundPrimitives=e,this.classificationType=t,this.appearanceType=r,this.materialProperty=n,this.updaters=new xt,this.createPrimitive=!0,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new xt,this.material=void 0,this.updatersWithAttributes=new xt,this.attributes=new xt,this.invalidated=!1,this.removeMaterialSubscription=n.definitionChanged.addEventListener(_u.prototype.onMaterialChanged,this),this.subscriptions=new xt,this.showsUpdated=new xt,this.zIndex=i,this._asynchronous=o}_u.prototype.onMaterialChanged=function(){this.invalidated=!0};_u.prototype.isMaterial=function(e){const t=this.materialProperty,n=e.fillMaterialProperty;return n===t||n instanceof Jt&&t instanceof Jt?!0:l(t)&&t.equals(n)};_u.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};_u.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};_u.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 il({show:!1,asynchronous:this._asynchronous,geometryInstances:o.slice(),appearance:new this.appearanceType,classificationType:this.classificationType}),this.appearanceType===_s&&(this.material=Ar.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===_s&&(this.material=Ar.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,f=this.geometry.get(c.id);let h=this.attributes.get(f.id.id);if(l(h)||(h=n.getGeometryInstanceAttributes(f.id),this.attributes.set(f.id.id,h)),!c.fillMaterialProperty.isConstant){const y=c.fillMaterialProperty.color,C=Z.getValueOrDefault(y,e,U.WHITE,pnt);U.equals(h._lastColor,C)||(h._lastColor=U.clone(C,h._lastColor),h.color=an.toValue(C,h.color))}const _=u.isShowing&&(c.hasConstantFill||c.isFilled(e)),g=h.show[0]===1;_!==g&&(h.show=Hn.toValue(_,h.show));const p=c.distanceDisplayConditionProperty;if(!Z.isConstant(p)){const y=Z.getValueOrDefault(p,e,_nt,mnt);Ut.equals(y,h._lastDistanceDisplayCondition)||(h._lastDistanceDisplayCondition=Ut.clone(y,h._lastDistanceDisplayCondition),h.distanceDisplayCondition=_i.toValue(y,h.distanceDisplayCondition))}}this.updateShows(n)}else l(n)&&!n.ready&&(t=!1);return t};_u.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=Hn.toValue(c,a.show),s.attributes.show.value[0]=a.show[0])}this.showsUpdated.removeAll()};_u.prototype.contains=function(e){return this.updaters.contains(e.id)};_u.prototype.getBoundingSphere=function(e,t){const n=this.primitive;if(!n.ready)return pt.PENDING;const i=n.getGeometryInstanceAttributes(e.entity);return!l(i)||!l(i.boundingSphere)||l(i.show)&&i.show[0]===0?pt.FAILED:(i.boundingSphere.clone(t),pt.DONE)};_u.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 C0(e,t,n){this._items=[],this._orderedGroundPrimitives=e,this._classificationType=t,this._asynchronous=A(n,!0)}C0.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 _u(this._orderedGroundPrimitives,this._classificationType,t.fillMaterialProperty,r,this._asynchronous);s.add(e,t,o),n.push(s)};C0.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}}};C0.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};C0.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 pt.FAILED};C0.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 gnt=[];function R5(e,t){const n=e._batches,i=n.length;for(let o=0;o<i;o++)n[o].remove(t)}function N5(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 Jt?1:2);let r;l(i)&&(r=i+o*Co.NUMBER_OF_SHADOW_MODES),n.fillEnabled&&(n.fillMaterialProperty instanceof Jt?e._colorBatches[r].add(t,n):e._materialBatches[r].add(t,n))}function Qu(e,t,n,i){b.defined("scene",e),b.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 xt,this._removedObjects=new xt,this._changedObjects=new xt;let o;const r=Co.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 Wc(n,Vs,void 0,!1,o),this._materialBatches[o]=new jc(n,_s,void 0,!1,o),this._colorBatches[o+r]=new Wc(n,Vs,Vs,!1,o),this._materialBatches[o+r]=new jc(n,_s,Vs,!1,o),this._colorBatches[o+r*2]=new Wc(n,Vs,_s,!1,o),this._materialBatches[o+r*2]=new jc(n,_s,_s,!1,o);this._dynamicBatch=new k_(n,i);const s=go.NUMBER_OF_CLASSIFICATION_TYPES;for(this._groundBatches=new Array(s),o=0;o<s;++o)this._groundBatches[o]=new C0(i,o);this._batches=this._colorBatches.concat(this._materialBatches,this._dynamicBatch,this._groundBatches),this._subscriptions=new xt,this._updaters=new xt,this._entityCollection=t,t.collectionChanged.addEventListener(Qu.prototype._onCollectionChanged,this),this._onCollectionChanged(t,t.values,gnt)}Qu.prototype.update=function(e){b.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,f;for(a=s.length-1;a>-1;a--)c=s[a],u=c.id,f=this._updaters.get(u),f.entity===c?(R5(this,f),N5(this,e,f)):(o.push(c),n.push(c));for(a=o.length-1;a>-1;a--)c=o[a],u=c.id,f=this._updaters.get(u),R5(this,f),f.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,f=new mu(c,this._scene),this._updaters.set(u,f),N5(this,e,f),this._subscriptions.set(u,f.geometryChanged.addEventListener(Qu._onGeometryChanged,this));t.removeAll(),i.removeAll(),r.removeAll();let h=!0;const _=this._batches,g=_.length;for(a=0;a<g;a++)h=_[a].update(e)&&h;return h};const ynt=[],Ant=new fe;Qu.prototype.getBoundingSphere=function(e,t){b.defined("entity",e),b.defined("result",t);const n=ynt,i=Ant;let o=0,r=pt.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===pt.PENDING)return pt.PENDING;r===pt.DONE&&(n[o]=fe.clone(i,n[o]),o++)}return o===0?pt.FAILED:(n.length=o,fe.fromBoundingSpheres(n,t),pt.DONE)};Qu.prototype.isDestroyed=function(){return!1};Qu.prototype.destroy=function(){this._entityCollection.collectionChanged.removeEventListener(Qu.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(),Ue(this)};Qu._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)};Qu.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 hl(e){b.typeOf.object("options",e),b.typeOf.object("options.scene",e.scene),b.typeOf.object("options.dataSourceCollection",e.dataSourceCollection),Fr.initializeTerrainHeights(),il.initializeTerrainHeights();const t=e.scene,n=e.dataSourceCollection;this._eventHelper=new Cf,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,hl.defaultVisualizersCallback);let i=!1;const o=new No,r=new No;n.length>0&&(t.primitives.add(o),t.groundPrimitives.add(r),i=!0),this._primitives=o,this._groundPrimitives=r;for(let u=0,f=n.length;u<f;u++)this._onDataSourceAdded(n,n.get(u));const s=new xF;this._onDataSourceAdded(void 0,s),this._defaultDataSource=s;let a,c;if(!i){const u=this,f=function(){t.primitives.add(o),t.groundPrimitives.add(r),a(),c(),u._removeDefaultDataSourceListener=void 0,u._removeDataSourceCollectionListener=void 0};a=s.entities.collectionChanged.addEventListener(f),c=n.dataSourceAdded.addEventListener(f)}this._removeDefaultDataSourceListener=a,this._removeDataSourceCollectionListener=c,this._ready=!1}hl.defaultVisualizersCallback=function(e,t,n){const i=n.entities;return[new lp(t,i),new al(e,i,n._primitives,n._groundPrimitives),new _p(t,i),new Ju(e,i),new hp(e,i),new Ap(t,i),new yp(e,i),new Qu(e,i,n._primitives,n._groundPrimitives)]};Object.defineProperties(hl.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}}});hl.prototype.isDestroyed=function(){return!1};hl.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)),Ue(this)};hl.prototype.update=function(e){if(b.defined("time",e),!Qi.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};hl.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 Cnt=[],Tnt=new fe;hl.prototype.getBoundingSphere=function(e,t,n){if(b.defined("entity",e),b.typeOf.bool("allowPartial",t),b.defined("result",n),!this._ready)return pt.PENDING;let i,o,r=this._defaultDataSource;if(!r.entities.contains(e)){r=void 0;const _=this._dataSourceCollection;for(o=_.length,i=0;i<o;i++){const g=_.get(i);if(g.entities.contains(e)){r=g;break}}}if(!l(r))return pt.FAILED;const s=Cnt,a=Tnt;let c=0,u=pt.DONE;const f=r._visualizers,h=f.length;for(i=0;i<h;i++){const _=f[i];if(l(_.getBoundingSphere)){if(u=f[i].getBoundingSphere(e,a),!t&&u===pt.PENDING)return pt.PENDING;u===pt.DONE&&(s[c]=fe.clone(a,s[c]),c++)}}return c===0?pt.FAILED:(s.length=c,fe.fromBoundingSpheres(s,n),pt.DONE)};hl.prototype._onDataSourceAdded=function(e,t){const n=this._scene,i=this._primitives,o=this._groundPrimitives,r=i.add(new No),s=o.add(new Tf);t._primitives=r,t._groundPrimitives=s;const a=t.clustering;a._initialize(n),r.add(a),t._visualizers=this._visualizersCallback(n,a,t)};hl.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};hl.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 M5=new J,F5=new J,z5=new J,bnt=new B,Px=new d,U5=new d,y1=new d,A1=new d,H5=new d,V5=new d,vg=new ne,Ent=1.25;function xnt(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,f=!1,h,_,g;if(a===le.SCENE3D){ne.addSeconds(r,.001,vg);let E=o.getValue(vg,Px);if(l(E)||(ne.addSeconds(r,-.001,vg),E=o.getValue(vg,Px),f=!0),l(E)){let w=tn.computeFixedToIcrfMatrix(r,M5),S=tn.computeFixedToIcrfMatrix(vg,F5),P;!l(w)||!l(S)?(P=tn.computeTemeToPseudoFixedMatrix(r,z5),w=J.transpose(P,M5),S=tn.computeTemeToPseudoFixedMatrix(vg,F5),J.transpose(S,S)):P=J.transpose(w,z5);const O=J.multiplyByVector(w,c,H5),z=J.multiplyByVector(S,E,V5);d.subtract(O,z,A1);const R=d.magnitude(A1)*1e3,F=N.GRAVITATIONALPARAMETER,H=-F/(R*R-2*F/d.magnitude(O));H<0||H>Ent*s.maximumRadius?(h=U5,d.normalize(c,h),d.negate(h,h),g=d.clone(d.UNIT_Z,y1),_=d.cross(g,h,Px),d.magnitude(_)>N.EPSILON7&&(d.normalize(h,h),d.normalize(_,_),g=d.cross(h,_,y1),d.normalize(g,g),u=!0)):d.equalsEpsilon(c,E,N.EPSILON7)||(g=U5,d.normalize(O,g),d.normalize(z,z),_=d.cross(g,z,y1),f&&(_=d.multiplyByScalar(_,-1,_)),d.equalsEpsilon(_,d.ZERO,N.EPSILON7)||(h=d.cross(_,g,Px),J.multiplyByVector(P,h,h),J.multiplyByVector(P,_,_),J.multiplyByVector(P,g,g),d.normalize(h,h),d.normalize(_,_),d.normalize(g,g),u=!0))}}l(e.boundingSphere)&&(c=e.boundingSphere.center);let p,y,C;i&&(p=d.clone(t.position,A1),y=d.clone(t.direction,H5),C=d.clone(t.up,V5));const T=bnt;u?(T[0]=h.x,T[1]=h.y,T[2]=h.z,T[3]=0,T[4]=_.x,T[5]=_.y,T[6]=_.z,T[7]=0,T[8]=g.x,T[9]=g.y,T[10]=g.z,T[11]=0,T[12]=c.x,T[13]=c.y,T[14]=c.z,T[15]=0):tn.eastNorthUpToFixedFrame(c,s,T),t._setTransform(T),i&&(d.clone(p,t.position),d.clone(y,t.direction),d.clone(C,t.up),d.cross(y,C,t.right))}if(n){const u=a===le.SCENE2D||d.equals(e._offset3D,d.ZERO)?void 0:e._offset3D;t.lookAtTransform(t.transform,u)}}function yT(e,t,n){b.defined("entity",e),b.defined("scene",t),this.entity=e,this.scene=t,this.ellipsoid=A(n,pe.WGS84),this.boundingSphere=void 0,this._lastEntity=void 0,this._mode=void 0,this._lastCartesian=new d,this._defaultOffset3D=void 0,this._offset3D=new d}Object.defineProperties(yT,{defaultOffset3D:{get:function(){return this._defaultOffset3D},set:function(e){this._defaultOffset3D=d.clone(e,new d)}}});yT.defaultOffset3D=new d(-14e3,3500,3500);const Ox=new t_,wnt=new d;yT.prototype.update=function(e,t){b.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 f=a||c,h=!0;if(a){const _=r.viewFrom,g=l(_);if(!g&&l(t)){Ox.pitch=-N.PI_OVER_FOUR,Ox.range=0;const p=s.getValue(e,wnt);if(l(p)){const y=2-1/Math.max(1,d.magnitude(p)/i.maximumRadius);Ox.pitch*=y}u.viewBoundingSphere(t,Ox),this.boundingSphere=t,f=!1,h=!1}else(!g||!l(_.getValue(e,this._offset3D)))&&d.clone(yT._defaultOffset3D,this._offset3D)}else!c&&this._mode!==le.SCENE2D&&d.clone(u.position,this._offset3D);this._lastEntity=r,this._mode=o,xnt(this,u,f,h,s,e,i)};function jf(e,t){this._tilingScheme=e,this._maximumLevel=t,this._rootNodes=[]}const gm=new _e;function Snt(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}jf.prototype.addAvailableTileRange=function(e,t,n,i,o){const r=this._tilingScheme,s=this._rootNodes;if(e===0)for(let _=n;_<=o;++_)for(let g=t;g<=i;++g)Snt(e,g,_,s)||s.push(new kg(r,void 0,0,g,_));r.tileXYToRectangle(t,n,e,gm);const a=gm.west,c=gm.north;r.tileXYToRectangle(i,o,e,gm);const u=gm.east,f=gm.south,h=new Ont(e,a,f,u,c);for(let _=0;_<s.length;++_){const g=s[_];NF(g.extent,h)&&Lnt(this._maximumLevel,g,h)}};jf.prototype.computeMaximumLevelAtPosition=function(e){let t;for(let n=0;n<this._rootNodes.length;++n){const i=this._rootNodes[n];if(Gg(i.extent,e)){t=i;break}}return l(t)?qA(void 0,t,e):-1};const vnt=[],Dnt=[],Int=new _e,Pnt=new _e;jf.prototype.computeBestAvailableLevelOverRectangle=function(e){const t=vnt;t.length=0,e.east<e.west?(t.push(_e.fromRadians(-Math.PI,e.south,e.east,e.north,Int)),t.push(_e.fromRadians(e.west,e.south,Math.PI,e.north,Pnt))):t.push(e);const n=Dnt;n.length=0;let i;for(i=0;i<this._rootNodes.length;++i)YA(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 k5=new Ae;jf.prototype.isTileAvailable=function(e,t,n){const i=this._tilingScheme.tileXYToRectangle(t,n,e,gm);return _e.center(i,k5),this.computeMaximumLevelAtPosition(k5)>=e};jf.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 kg(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(kg.prototype,{nw:{get:function(){return this._nw||(this._nw=new kg(this.tilingScheme,this,this.level+1,this.x*2,this.y*2)),this._nw}},ne:{get:function(){return this._ne||(this._ne=new kg(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2)),this._ne}},sw:{get:function(){return this._sw||(this._sw=new kg(this.tilingScheme,this,this.level+1,this.x*2,this.y*2+1)),this._sw}},se:{get:function(){return this._se||(this._se=new kg(this.tilingScheme,this,this.level+1,this.x*2+1,this.y*2+1)),this._se}}});function Ont(e,t,n,i,o){this.level=e,this.west=t,this.south=n,this.east=i,this.north=o}function NF(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 Lnt(e,t,n){for(;t.level<e;)if(Lx(t.nw.extent,n))t=t.nw;else if(Lx(t.ne.extent,n))t=t.ne;else if(Lx(t.sw.extent,n))t=t.sw;else if(Lx(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=Cs(t.rectangles,n.level,Bnt);i<0&&(i=~i),t.rectangles.splice(i,0,n)}}function Bnt(e,t){return e.level-t}function Lx(e,t){return t.west>=e.west&&t.east<=e.east&&t.south>=e.south&&t.north<=e.north}function Gg(e,t){return t.longitude>=e.west&&t.longitude<=e.east&&t.latitude>=e.south&&t.latitude<=e.north}function qA(e,t,n){let i=0,o=!1;for(;!o;){const r=t._nw&&Gg(t._nw.extent,n),s=t._ne&&Gg(t._ne.extent,n),a=t._sw&&Gg(t._sw.extent,n),c=t._se&&Gg(t._se.extent,n);if(r+s+a+c>1){r&&(i=Math.max(i,qA(t,t._nw,n))),s&&(i=Math.max(i,qA(t,t._ne,n))),a&&(i=Math.max(i,qA(t,t._sw,n))),c&&(i=Math.max(i,qA(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];Gg(a,n)&&(i=a.level)}t=t.parent}return i}function YA(e,t,n){if(!t)return;let i,o=!1;for(i=0;i<n.length;++i)o=o||NF(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]=Rnt(e[s.level],s)}YA(e,t._nw,n),YA(e,t._ne,n),YA(e,t._sw,n),YA(e,t._se,n)}function Rnt(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];NF(o,t)?(o.west<t.west&&n.push(new _e(o.west,o.south,t.west,o.north)),o.east>t.east&&n.push(new _e(t.east,o.south,o.east,o.north)),o.south<t.south&&n.push(new _e(Math.max(t.west,o.west),o.south,Math.min(t.east,o.east),t.south)),o.north>t.north&&n.push(new _e(Math.max(t.west,o.west),t.north,Math.min(t.east,o.east),o.north))):n.push(o)}return n}function lee(){}lee.prototype.geocode=function(e){b.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:d.fromDegrees(n,i,o)};return Promise.resolve([r])}}return Promise.resolve([])};const gD={};gD.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 f,h,_,g,p,y;return u===1?s?(f=(e-n)/(i-n),h=(e-n)/(o-n),r.push(1),r.push(2),h!==1&&(r.push(-1),r.push(0),r.push(2),r.push(h)),f!==1&&(r.push(-1),r.push(0),r.push(1),r.push(f))):a?(_=(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)),_!==1&&(r.push(-1),r.push(1),r.push(2),r.push(_))):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),f=(e-n)/(i-n),r.push(1),r.push(-1),r.push(2),r.push(1),r.push(y),r.push(-1),r.push(0),r.push(1),r.push(f)):!c&&o!==e&&(h=(e-n)/(o-n),_=(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(_)):u!==3&&(r.push(0),r.push(1),r.push(2)),r};gD.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,f=s-o,h=r-a,_=i-a,g=1/(h*u+f*_),p=t-a,y=e-s,C=(h*y+f*p)*g,T=(-_*y+u*p)*g,E=1-C-T;return l(c)?(c.x=C,c.y=T,c.z=E,c):new d(C,T,E)};gD.computeLineSegmentLineSegmentIntersection=function(e,t,n,i,o,r,s,a,c){b.typeOf.number("x00",e),b.typeOf.number("y00",t),b.typeOf.number("x01",n),b.typeOf.number("y01",i),b.typeOf.number("x10",o),b.typeOf.number("y10",r),b.typeOf.number("x11",s),b.typeOf.number("y11",a);const u=(s-o)*(t-r)-(a-r)*(e-o),f=(n-e)*(t-r)-(i-t)*(e-o),h=(a-r)*(n-e)-(s-o)*(i-t);if(h===0)return;const _=u/h,g=f/h;if(_>=0&&_<=1&&g>=0&&g<=1)return l(c)||(c=new j),c.x=e+_*(n-e),c.y=t+_*(i-t),c};const uee=gD;function Cp(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=Rx(e.westIndices,o,t),this._southIndices=Rx(e.southIndices,r,t),this._eastIndices=Rx(e.eastIndices,o,t),this._northIndices=Rx(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(Cp.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 Bx=[];function Rx(e,t,n){Bx.length=e.length;let i=!1;for(let o=0,r=e.length;o<r;++o)Bx[o]=e[o],i=i||o>0&&t(e[o-1],e[o])>0;return i?(Bx.sort(t),it.createTypedArray(n,Bx)):e}const fee="createVerticesFromQuantizedTerrainMesh",Nnt=new vi(fee),Mnt=new vi(fee,rf.maximumAsynchronousTasks);Cp.prototype.createMesh=function(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.tilingScheme",e.tilingScheme),b.typeOf.number("options.x",e.x),b.typeOf.number("options.y",e.y),b.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?Mnt:Nnt).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 _=this;return Promise.resolve(h).then(function(g){const p=_._quantizedVertices.length/3,y=p+_._westIndices.length+_._southIndices.length+_._eastIndices.length+_._northIndices.length,C=it.createTypedArray(y,g.indices),T=new Float32Array(g.vertices),E=g.center,w=g.minimumHeight,S=g.maximumHeight,P=_._boundingSphere,O=_._orientedBoundingBox,z=A(d.clone(g.occludeePointInScaledSpace),_._horizonOcclusionPoint),R=g.vertexStride,F=ur.clone(g.encoding);return _._mesh=new vv(E,T,C,g.indexCountWithoutSkirts,p,w,S,P,z,R,O,F,g.westIndicesSouthToNorth,g.southIndicesEastToWest,g.eastIndicesNorthToSouth,g.northIndicesWestToEast),_._quantizedVertices=void 0,_._encodedNormals=void 0,_._indices=void 0,_._uValues=void 0,_._vValues=void 0,_._heightValues=void 0,_._westIndices=void 0,_._southIndices=void 0,_._eastIndices=void 0,_._northIndices=void 0,_._mesh})};const Fnt=new vi("upsampleQuantizedTerrainMesh",rf.maximumAsynchronousTasks);Cp.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,f=n*2===r,h=e.ellipsoid,_=e.tileXYToRectangle(o,r,s),g=Fnt.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:f,childRectangle:_,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,C=f?p*.5:this._southSkirtHeight,T=u?this._eastSkirtHeight:p*.5,E=f?this._northSkirtHeight:p*.5,w=this._credits;return Promise.resolve(g).then(function(S){const P=new Uint16Array(S.vertices),O=it.createTypedArray(P.length/3,S.indices);let z;return l(S.encodedNormals)&&(z=new Uint8Array(S.encodedNormals)),new Cp({quantizedVertices:P,indices:O,encodedNormals:z,minimumHeight:S.minimumHeight,maximumHeight:S.maximumHeight,boundingSphere:fe.clone(S.boundingSphere),orientedBoundingBox:Bt.clone(S.orientedBoundingBox),horizonOcclusionPoint:d.clone(S.horizonOcclusionPoint),westIndices:S.westIndices,southIndices:S.southIndices,eastIndices:S.eastIndices,northIndices:S.northIndices,westSkirtHeight:y,southSkirtHeight:C,eastSkirtHeight:T,northSkirtHeight:E,childTileMask:0,credits:w,createdByUpsampling:!0})})};const oR=32767,dee=new d;Cp.prototype.interpolateHeight=function(e,t,n){let i=N.clamp((t-e.west)/e.width,0,1);i*=oR;let o=N.clamp((n-e.south)/e.height,0,1);return o*=oR,l(this._mesh)?Vnt(this,i,o):knt(this,i,o)};function hee(e,t,n,i,o,r,s,a){const c=Math.min(n,o,s),u=Math.max(n,o,s),f=Math.min(i,r,a),h=Math.max(i,r,a);return e>=c&&e<=u&&t>=f&&t<=h}const znt=new j,Unt=new j,Hnt=new j;function Vnt(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],f=s[a+1],h=s[a+2],_=r.decodeTextureCoordinates(o,u,znt),g=r.decodeTextureCoordinates(o,f,Unt),p=r.decodeTextureCoordinates(o,h,Hnt);if(hee(t,n,_.x,_.y,g.x,g.y,p.x,p.y)){const y=uee.computeBarycentricCoordinates(t,n,_.x,_.y,g.x,g.y,p.x,p.y,dee);if(y.x>=-1e-15&&y.y>=-1e-15&&y.z>=-1e-15){const C=r.decodeHeight(o,u),T=r.decodeHeight(o,f),E=r.decodeHeight(o,h);return y.x*C+y.y*T+y.z*E}}}}function knt(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],f=s[a+1],h=s[a+2],_=i[u],g=i[f],p=i[h],y=o[u],C=o[f],T=o[h];if(hee(t,n,_,y,g,C,p,T)){const E=uee.computeBarycentricCoordinates(t,n,_,y,g,C,p,T,dee);if(E.x>=-1e-15&&E.y>=-1e-15&&E.z>=-1e-15){const w=E.x*r[u]+E.y*r[f]+E.z*r[h];return N.lerp(e._minimumHeight,e._maximumHeight,w/oR)}}}}Cp.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};Cp.prototype.wasCreatedByUpsampling=function(){return this._createdByUpsampling};function Gnt(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 G_(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 $e;let t=e.credit;typeof t=="string"&&(t=new Kn(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 C=Re.createIfNeeded(y);return C.appendForwardSlash(),i=C,o=i.getDerivedResource({url:"layer.json"}),n._tileCredits=C.credits,p()});function f(y){let C;if(!y.format)return C="The tile format is not specified in the layer.json file.",r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C));if(!y.tiles||y.tiles.length===0)return C="The layer.json file does not specify any tile URL templates.",r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C));let T=!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 C=`The tile format "${y.format}" is invalid or not supported.`,r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C));const O=y.tiles,z=y.maxzoom;if(u=Math.max(u,z),!y.projection||y.projection==="EPSG:4326")n._tilingScheme=new Xs({numberOfLevelZeroTilesX:2,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else if(y.projection==="EPSG:3857")n._tilingScheme=new ws({numberOfLevelZeroTilesX:1,numberOfLevelZeroTilesY:1,ellipsoid:n._ellipsoid});else return C=`The projection "${y.projection}" is invalid or not supported.`,r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C));if(n._levelZeroMaximumGeometricError=Go.getEstimatedLevelZeroGeometricErrorForAHeightmap(n._tilingScheme.ellipsoid,n._heightmapWidth,n._tilingScheme.getNumberOfXTilesAtLevel(0)),!y.scheme||y.scheme==="tms"||y.scheme==="slippyMap")n._scheme=y.scheme;else return C=`The scheme "${y.scheme}" is invalid or not supported.`,r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C));let R;l(y.extensions)&&y.extensions.indexOf("octvertexnormals")!==-1?T=!0:l(y.extensions)&&y.extensions.indexOf("vertexnormals")!==-1&&(T=!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,H=y.available;let v;if(l(H)&&!l(F)){v=new jf(n._tilingScheme,H.length);for(let m=0;m<H.length;++m){const D=H[m],L=n._tilingScheme.getNumberOfYTilesAtLevel(m);l(c[m])||(c[m]=[]);for(let M=0;M<D.length;++M){const V=D[M],k=L-V.endY-1,W=L-V.startY-1;c[m].push([V.startX,k,V.endX,W]),v.addAvailableTileRange(m,V.startX,k,V.endX,W)}}}else l(F)&&(R=new jf(n._tilingScheme,z),v=new jf(n._tilingScheme,z),c[0]=[[0,0,1,0]],v.addAvailableTileRange(0,0,0,1,0));n._hasWaterMask=n._hasWaterMask||E,n._hasVertexNormals=n._hasVertexNormals||T,n._hasMetadata=n._hasMetadata||w,l(y.attribution)&&(a.length>0&&(a+=" "),a+=y.attribution),s.push(new Gnt({resource:i,version:y.version,isHeightmap:P,tileUrlTemplates:O,availability:v,hasVertexNormals:T,hasWaterMask:E,hasMetadata:w,availabilityLevels:F,availabilityTilesLoaded:R,littleEndianExtensionSize:S}));const I=y.parentUrl;if(l(I)){if(!l(v))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 m=o.fetchJson();return Promise.resolve(m).then(f).catch(h)}return Promise.resolve(!0)}function h(y){const C=`An error occurred while accessing ${o.url}.`;return r=Ki.reportError(r,n,n._errorEvent,C),r.retry?p():Promise.reject(new Se(C))}function _(y){return f(y).then(function(){if(l(r))return;const C=c.length;if(C>0){const T=n._availability=new jf(n._tilingScheme,u);for(let E=0;E<C;++E){const w=c[E];for(let S=0;S<w.length;++S){const P=w[S];T.addAvailableTileRange(E,P[0],P[1],P[2],P[3])}}}if(a.length>0){const T=new Kn(a);l(n._tileCredits)?n._tileCredits.push(T):n._tileCredits=[T]}return n._ready=!0,Promise.resolve(!0)})}function g(y){return l(y)&&y.statusCode===404?_({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(_).catch(g)}}const C1={OCT_VERTEX_NORMALS:1,WATER_MASK:2,METADATA:4};function G5(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 Wnt(e,t,n,i,o){const r=new Uint16Array(t,0,e._heightmapWidth*e._heightmapWidth);return new $l({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 jnt(e,t,n,i,o,r){const s=r.littleEndianExtensionSize;let a=0;const c=3,u=c+1,f=Float64Array.BYTES_PER_ELEMENT*c,h=Float64Array.BYTES_PER_ELEMENT*u,_=3,g=Uint16Array.BYTES_PER_ELEMENT*_,p=3;let y=Uint16Array.BYTES_PER_ELEMENT,C=y*p;const T=new DataView(t),E=new d(T.getFloat64(a,!0),T.getFloat64(a+8,!0),T.getFloat64(a+16,!0));a+=f;const w=T.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const S=T.getFloat32(a,!0);a+=Float32Array.BYTES_PER_ELEMENT;const P=new fe(new d(T.getFloat64(a,!0),T.getFloat64(a+8,!0),T.getFloat64(a+16,!0)),T.getFloat64(a+f,!0));a+=h;const O=new d(T.getFloat64(a,!0),T.getFloat64(a+8,!0),T.getFloat64(a+16,!0));a+=f;const z=T.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,C=y*p);const F=R.subarray(0,z),H=R.subarray(z,2*z),v=R.subarray(z*2,3*z);oi.zigZagDeltaDecode(F,H,v),a%y!==0&&(a+=y-a%y);const I=T.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const m=it.createTypedArrayFromArrayBuffer(z,t,a,I*p);a+=I*C;let D=0;const L=m.length;for(let re=0;re<L;++re){const he=m[re];m[re]=D-he,he===0&&++D}const M=T.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const V=it.createTypedArrayFromArrayBuffer(z,t,a,M);a+=M*y;const k=T.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const W=it.createTypedArrayFromArrayBuffer(z,t,a,k);a+=k*y;const G=T.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const K=it.createTypedArrayFromArrayBuffer(z,t,a,G);a+=G*y;const q=T.getUint32(a,!0);a+=Uint32Array.BYTES_PER_ELEMENT;const te=it.createTypedArrayFromArrayBuffer(z,t,a,q);a+=q*y;let $,X;for(;a<T.byteLength;){const re=T.getUint8(a,!0);a+=Uint8Array.BYTES_PER_ELEMENT;const he=T.getUint32(a,s);if(a+=Uint32Array.BYTES_PER_ELEMENT,re===C1.OCT_VERTEX_NORMALS&&e._requestVertexNormals)$=new Uint8Array(t,a,z*2);else if(re===C1.WATER_MASK&&e._requestWaterMask)X=new Uint8Array(t,a,he);else if(re===C1.METADATA&&e._requestMetadata){const ce=T.getUint32(a,!0);if(ce>0){const ie=Fa(new Uint8Array(t),a+Uint32Array.BYTES_PER_ELEMENT,ce).available;if(l(ie))for(let de=0;de<ie.length;++de){const me=n+de+1,Ee=ie[de],xe=e._tilingScheme.getNumberOfYTilesAtLevel(me);for(let Pe=0;Pe<Ee.length;++Pe){const Te=Ee[Pe],Oe=xe-Te.endY-1,De=xe-Te.startY-1;e.availability.addAvailableTileRange(me,Te.startX,Oe,Te.endX,De),r.availability.addAvailableTileRange(me,Te.startX,Oe,Te.endX,De)}}}r.availabilityTilesLoaded.addAvailableTileRange(n,i,o,i,o)}a+=he}const Y=e.getLevelMaximumGeometricError(n)*5,ae=e._tilingScheme.tileXYToRectangle(i,o,n),ue=Bt.fromRectangle(ae,w,S,e._tilingScheme.ellipsoid);return new Cp({center:E,minimumHeight:w,maximumHeight:S,boundingSphere:P,orientedBoundingBox:ue,horizonOcclusionPoint:O,quantizedVertices:R,encodedNormals:$,indices:m,westIndices:V,southIndices:W,eastIndices:K,northIndices:te,westSkirtHeight:Y,southSkirtHeight:Y,eastSkirtHeight:Y,northSkirtHeight:Y,childTileMask:e.availability.computeChildMaskForTile(n,i,o),waterMask:X,credits:e._tileCredits})}G_.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 pee(this,e,t,n,r,i)};function pee(e,t,n,i,o,r){if(!l(o))return Promise.reject(new Se("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,f;const h=s[(t+a+i)%s.length],_=o.resource;l(_._ionEndpoint)&&!l(_._ionEndpoint.externalType)?(c.length!==0&&(f={extensions:c.join("-")}),u=G5(void 0)):u=G5(c);const g=_.getDerivedResource({url:h,templateValues:{version:o.version,z:i,x:t,y:a},queryParameters:f,headers:u,request:r}).fetchArrayBuffer();if(l(g))return g.then(function(p){return l(p)?l(e._heightmapStructure)?Wnt(e,p):jnt(e,p,i,t,n,o):Promise.reject(new Se("Mesh buffer doesn't exist."))})}Object.defineProperties(G_.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}}});G_.prototype.getLevelMaximumGeometricError=function(e){return this._levelZeroMaximumGeometricError/(1<<e)};G_.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(mee(this,e,t,n,i[r],r===0).result)return;return!1};G_.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=mee(this,e,t,n,i[r],r===0);if(l(s.promise))return s.promise}};function rR(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 mee(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 f=rR(o,t,n,i);for(;l(f);){if(u.isTileAvailable(f.level,f.x,f.y)&&!c.isTileAvailable(f.level,f.x,f.y)){let h;if(!r&&(s=`${f.level}-${f.x}-${f.y}`,h=o.availabilityPromiseCache[s],!l(h))){const _=new ju({throttle:!1,throttleByServer:!0,type:C_.TERRAIN});h=pee(e,f.x,f.y,f.level,o,_),l(h)&&(o.availabilityPromiseCache[s]=h,h.then(a))}return{result:!0,promise:h}}f=rR(o,f.x,f.y,f.level)}return{result:!1}}G_._getAvailabilityTile=rR;function eu(e){b.typeOf.object("options",e),b.defined("options.comparator",e.comparator),l(e.maximumLength)&&b.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(eu.prototype,{length:{get:function(){return this._length}},maximumLength:{get:function(){return this._maximumLength},set:function(e){if(l(e)){for(b.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}}});eu.prototype.clone=function(){const e=this._maximumLength,t=this._comparator,n=this._array,i=this._length,o=new eu({comparator:t,maximumLength:e});o._length=i;for(let r=0;r<i;r++)o._array[r]=n[r];return o};eu.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};eu.prototype.resort=function(){const e=this._length;for(let t=0;t<e;t++)_ee(this,t)};eu.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++,_ee(this,i),t};eu.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],gee(this,0)),this._array[e-1]=void 0,t};eu.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=MF(this,1,2)?1:2;t=this._array[n],this._array[n]=this._array[e-1],e>=4&&gee(this,n)}return this._array[e-1]=void 0,t};eu.prototype.getMinimum=function(){if(this._length!==0)return this._array[0]};eu.prototype.getMaximum=function(){const e=this._length;if(e!==0)return e<=2?this._array[e-1]:this._array[MF(this,1,2)?1:2]};function qS(e,t,n){const i=e._array,o=i[t];i[t]=i[n],i[n]=o}function xC(e,t,n){return e._comparator(e._array[t],e._array[n])<0}function MF(e,t,n){return e._comparator(e._array[t],e._array[n])>0}function _ee(e,t){if(t===0)return;const n=Math.floor(N.log2(t+1))%2===0,i=Math.floor((t-1)/2),o=xC(e,t,i);for(o!==n&&(qS(e,t,i),t=i);t>=3;){const r=Math.floor((t-3)/4);if(xC(e,t,r)!==o)break;qS(e,t,r),t=r}}function gee(e,t){const n=e._length,i=Math.floor(N.log2(t+1))%2===0;let o;for(;(o=2*t+1)<n;){let r=o;const s=o+1;if(s<n){xC(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 f=a+u;xC(e,f,r)===i&&(r=f)}}if(xC(e,r,t)===i&&(qS(e,r,t),r!==o&&r!==s)){const a=Math.floor((r-1)/2);MF(e,r,a)===i&&qS(e,r,a)}t=r}}const qnt={SEARCH:0,AUTOCOMPLETE:1},FF=Object.freeze(qnt);function zF(e){b.defined("url",e),this._url=Re.createIfNeeded(e),this._url.appendForwardSlash()}Object.defineProperties(zF.prototype,{url:{get:function(){return this._url}}});zF.prototype.geocode=function(e,t){return b.typeOf.string("query",e),this._url.getDerivedResource({url:t===FF.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=_e.fromDegrees(s[0],s[1],s[2],s[3]);else{const a=o.geometry.coordinates[0],c=o.geometry.coordinates[1];r=d.fromDegrees(a,c)}return{displayName:o.properties.label,destination:r}})})};function yee(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.scene",e.scene);const t=A(e.accessToken,zm.defaultAccessToken),n=Re.createIfNeeded(A(e.server,zm.defaultServer));n.appendForwardSlash();const i=zm.getDefaultTokenCredit(t);l(i)&&e.scene.frameState.creditDisplay.addDefaultCredit(Kn.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 zF(o)}yee.prototype.geocode=function(e,t){return this._pelias.geocode(e,t)};function Ynt(e){return e=A(e,A.EMPTY_OBJECT),new G_({url:ts.fromAssetId(1),requestVertexNormals:A(e.requestVertexNormals,!1),requestWaterMask:A(e.requestWaterMask,!1)})}function $nt(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 Gs(){this.orientedBoundingBox=new Bt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._minBounds=d.clone(Gs.DefaultMinBounds,new d),this._maxBounds=d.clone(Gs.DefaultMaxBounds,new d),this.shaderUniforms={boxUvToRenderBoundsTransform:new B,boxUvToRenderBoundsScale:new d,boxUvToRenderBoundsTranslate:new d,boxUvToShapeUvScale:new d,boxUvToShapeUvTranslate:new d},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 Xnt=new d,sR=new d,Knt=new J,Jnt=new B,Qnt=new d,Znt=new d,eit=new J,tit=new d,nit=new d,iit=new d,oit=new d,rit=B.fromRotationTranslation(J.fromUniformScale(2,new J),new d(-1,-1,-1),new B),sit=B.fromRotation(J.fromColumnMajorArray([0,0,1,0,1,0,1,0,0],new J),new B),ait=B.fromRotation(J.fromColumnMajorArray([1,0,0,0,0,1,0,1,0],new J),new B);Gs.prototype.update=function(e,t,n,i,o){i=A(i,Gs.DefaultMinBounds),o=A(o,Gs.DefaultMaxBounds),b.typeOf.object("modelMatrix",e),b.typeOf.object("minBounds",t),b.typeOf.object("maxBounds",n);const r=Gs.DefaultMinBounds,s=Gs.DefaultMaxBounds;t=this._minBounds=d.clamp(t,r,s,this._minBounds),n=this._maxBounds=d.clamp(n,r,s,this._maxBounds),i=d.clamp(i,r,s,tit),o=d.clamp(o,r,s,nit);const a=d.clamp(t,i,o,iit),c=d.clamp(n,i,o,oit),u=B.getScale(e,sR);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=Aee(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 f=this.shaderUniforms,h=this.shaderDefines;for(const y in h)h.hasOwnProperty(y)&&(h[y]=void 0);const _=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,_){h.BOX_HAS_RENDER_BOUNDS=!0;const y=a,C=c,T=d.fromElements(2/(y.x===C.x?1:C.x-y.x),2/(y.y===C.y?1:C.y-y.y),2/(y.z===C.z?1:C.z-y.z),Znt),E=d.fromElements(-T.x*.5*(y.x+C.x),-T.y*.5*(y.y+C.y),-T.z*.5*(y.z+C.z),Qnt);let w=B.fromRotationTranslation(J.fromScale(T,eit),E,Jnt);if(y.x===C.x||y.y===C.y||y.z===C.z){h.BOX_IS_2D=!0;let S;y.x===C.x?S=sit:y.y===C.y?S=ait:y.z===C.z&&(S=B.IDENTITY),w=B.multiplyTransformation(S,w,w)}f.boxUvToRenderBoundsTransform=B.multiplyTransformation(w,rit,f.boxUvToRenderBoundsTransform),f.boxUvToRenderBoundsScale=B.getScale(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsScale),f.boxUvToRenderBoundsTranslate=B.getTranslation(f.boxUvToRenderBoundsTransform,f.boxUvToRenderBoundsTranslate)}if(g){h.BOX_HAS_SHAPE_BOUNDS=!0;const y=t,C=n;f.boxUvToShapeUvScale=d.fromElements(2/(y.x===C.x?1:C.x-y.x),2/(y.y===C.y?1:C.y-y.y),2/(y.z===C.z?1:C.z-y.z),f.boxUvToShapeUvScale),f.boxUvToShapeUvTranslate=d.fromElements(-f.boxUvToShapeUvScale.x*(y.x*.5+.5),-f.boxUvToShapeUvScale.y*(y.y*.5+.5),-f.boxUvToShapeUvScale.z*(y.z*.5+.5),f.boxUvToShapeUvTranslate)}return this.shaderMaximumIntersectionsLength=p,!0};const cit=new d,lit=new d;Gs.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){b.typeOf.number("tileLevel",e),b.typeOf.number("tileX",t),b.typeOf.number("tileY",n),b.typeOf.number("tileZ",i),b.typeOf.object("result",o);const r=this._minBounds,s=this._maxBounds,a=1/Math.pow(2,e),c=d.fromElements(N.lerp(r.x,s.x,a*t),N.lerp(r.y,s.y,a*n),N.lerp(r.z,s.z,a*i),cit),u=d.fromElements(N.lerp(r.x,s.x,a*(t+1)),N.lerp(r.y,s.y,a*(n+1)),N.lerp(r.z,s.z,a*(i+1)),lit);return Aee(c,u,this.shapeTransform,o)};Gs.prototype.computeApproximateStepSize=function(e){return b.typeOf.object("dimensions",e),1/d.maximumComponent(e)};Gs.DefaultMinBounds=Object.freeze(new d(-1,-1,-1));Gs.DefaultMaxBounds=Object.freeze(new d(1,1,1));function Aee(e,t,n,i){const o=Gs.DefaultMinBounds,r=Gs.DefaultMaxBounds;if(d.equals(e,o)&&d.equals(t,r))i.center=B.getTranslation(n,i.center),i.halfAxes=B.getMatrix3(n,i.halfAxes);else{let a=B.getScale(n,sR);const c=d.midpoint(e,t,Xnt);i.center=B.multiplyByPoint(n,c,i.center),a=d.fromElements(a.x*.5*(t.x-e.x),a.y*.5*(t.y-e.y),a.z*.5*(t.z-e.z),sR);const u=B.getRotation(n,Knt);i.halfAxes=J.setScale(u,a,i.halfAxes)}return i}function vo(){this.orientedBoundingBox=new Bt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._minimumRadius=vo.DefaultMinBounds.x,this._maximumRadius=vo.DefaultMaxBounds.x,this._minimumHeight=vo.DefaultMinBounds.y,this._maximumHeight=vo.DefaultMaxBounds.y,this._minimumAngle=vo.DefaultMinBounds.z,this._maximumAngle=vo.DefaultMaxBounds.z,this.shaderUniforms={cylinderUvToRenderBoundsScale:new d,cylinderUvToRenderBoundsTranslate:new d,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 Cee=new d,uit=new d,fit=new d,dit=new J,hit=new B,pit=new B,mit=B.fromRotationTranslation(J.fromUniformScale(2,new J),new d(-1,-1,-1),new B);vo.prototype.update=function(e,t,n,i,o){i=A(i,vo.DefaultMinBounds),o=A(o,vo.DefaultMaxBounds),b.typeOf.object("modelMatrix",e),b.typeOf.object("minBounds",t),b.typeOf.object("maxBounds",n);const r=vo.DefaultMinBounds.x,s=vo.DefaultMaxBounds.x,a=vo.DefaultMinBounds.y,c=vo.DefaultMaxBounds.y,u=vo.DefaultMinBounds.z,f=vo.DefaultMaxBounds.z,h=f-u,_=.5*h,g=N.EPSILON10,p=N.EPSILON3,y=N.EPSILON10,C=N.clamp(t.x,r,s),T=N.clamp(n.x,r,s),E=N.clamp(i.x,r,s),w=N.clamp(o.x,r,s),S=Math.max(C,E),P=Math.min(T,w),O=N.clamp(t.y,a,c),z=N.clamp(n.y,a,c),R=N.clamp(i.y,a,c),F=N.clamp(o.y,a,c),H=Math.max(O,R),v=Math.min(z,F),I=N.negativePiToPi(t.z),m=N.negativePiToPi(n.z),D=N.negativePiToPi(i.z),L=N.negativePiToPi(o.z),M=Math.max(I,D),V=Math.min(m,L),k=B.getScale(e,Cee);if(P===0||S>P||H>v||N.equalsEpsilon(k.x,0,void 0,g)||N.equalsEpsilon(k.y,0,void 0,g)||N.equalsEpsilon(k.z,0,void 0,g))return!1;this._minimumRadius=C,this._maximumRadius=T,this._minimumHeight=O,this._maximumHeight=z,this._minimumAngle=I,this._maximumAngle=m,this.shapeTransform=B.clone(e,this.shapeTransform),this.orientedBoundingBox=UF(S,P,H,v,M,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=C===r&&T===s,q=O===a&&z===c,te=m<I,$=m-I+te*h,X=$>_+y&&$<h-y,Y=$>y&&$<_-y,ae=$>=_-y&&$<=_+y,ue=$<=y,re=X||Y||ae||ue,he=N.equalsEpsilon(I,u,void 0,p),ce=N.equalsEpsilon(m,f,void 0,p),Q=P===s,ie=S===r,de=H===a&&v===c,me=V<M,Ee=V-M+me*h,xe=Ee>_+y&&Ee<h-y,Pe=Ee>y&&Ee<_-y,Te=Ee>=_-y&&Ee<=_+y,Oe=Ee<=y,De=xe||Pe||Te||Oe,Me=this.shaderUniforms,ve=this.shaderDefines;for(const Ve in ve)ve.hasOwnProperty(Ve)&&(ve[Ve]=void 0);let Ie=0;if(ve.CYLINDER_INTERSECTION_INDEX_RADIUS_MAX=Ie,Ie+=1,ie||(ve.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MIN=!0,ve.CYLINDER_INTERSECTION_INDEX_RADIUS_MIN=Ie,Ie+=1,Me.cylinderUvToRenderRadiusMin=P/S),Q||(ve.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_MAX=!0),S===P&&(ve.CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT=!0),de||(ve.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT=!0),H===v&&(ve.CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),O===z&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0),C===T&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT=!0),!K){ve.CYLINDER_HAS_SHAPE_BOUNDS_RADIUS=!0;const Ve=1/(T-C),Le=C/(C-T);Me.cylinderUvToShapeUvRadius=j.fromElements(Ve,Le,Me.cylinderUvToShapeUvRadius)}if(!q){ve.CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT=!0;const Ve=2/(z-O),Le=(O+1)/(O-z);Me.cylinderUvToShapeUvHeight=j.fromElements(Ve,Le,Me.cylinderUvToShapeUvHeight)}if(!Q||!de){const Ve=.5*(v-H),Le=d.fromElements(1/P,1/P,1/(Ve===0?1:Ve),fit),_t=d.fromElements(0,0,-Le.z*.5*(H+v),uit),Tt=B.fromRotationTranslation(J.fromScale(Le,dit),_t,hit),Ot=B.multiplyTransformation(Tt,mit,pit);Me.cylinderUvToRenderBoundsScale=B.getScale(Ot,Me.cylinderUvToRenderBoundsScale),Me.cylinderUvToRenderBoundsTranslate=B.getTranslation(Ot,Me.cylinderUvToRenderBoundsTranslate)}if(te&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED=!0),De&&(ve.CYLINDER_HAS_RENDER_BOUNDS_ANGLE=!0,ve.CYLINDER_INTERSECTION_INDEX_ANGLE=Ie,xe?(ve.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF=!0,Ie+=1):Pe?(ve.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF=!0,Ie+=2):Te?(ve.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF=!0,Ie+=1):Oe&&(ve.CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0,Ie+=2),Me.cylinderRenderAngleMinMax=j.fromElements(M,V,Me.cylinderAngleMinMax)),re){ve.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE=!0,ue&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO=!0),he&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY=!0),ce&&(ve.CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY=!0);const Ve=(I-u)/h,Le=(m-u)/h,_t=1-$/h;Me.cylinderShapeUvAngleMinMax=j.fromElements(Ve,Le,Me.cylinderShapeUvAngleMinMax),Me.cylinderShapeUvAngleRangeZeroMid=(Le+.5*_t)%1;const Tt=h/$,Ot=-(I-u)/$;Me.cylinderUvToShapeUvAngle=j.fromElements(Tt,Ot,Me.cylinderUvToShapeUvAngle)}return this.shaderMaximumIntersectionsLength=Ie,!0};vo.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){b.typeOf.number("tileLevel",e),b.typeOf.number("tileX",t),b.typeOf.number("tileY",n),b.typeOf.number("tileZ",i),b.typeOf.object("result",o);const r=this._minimumRadius,s=this._maximumRadius,a=this._minimumHeight,c=this._maximumHeight,u=this._minimumAngle,f=this._maximumAngle,h=1/Math.pow(2,e),_=N.lerp(r,s,t*h),g=N.lerp(r,s,(t+1)*h),p=N.lerp(a,c,n*h),y=N.lerp(a,c,(n+1)*h),C=N.lerp(u,f,i*h),T=N.lerp(u,f,(i+1)*h);return UF(_,g,p,y,C,T,this.shapeTransform,o)};const _it=new Bt,git=new d,yit=new d,Ait=new d;vo.prototype.computeApproximateStepSize=function(e){b.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,f=1-1/e.z,h=N.lerp(n,i,c),_=N.lerp(o,r,u),g=N.lerp(s,a,f),T=UF(h,i,_,r,g,a,t,_it),E=J.getScale(T.halfAxes,git),w=B.getScale(t,yit),S=d.divideComponents(E,w,Ait);return d.minimumComponent(S)};vo.DefaultMinBounds=Object.freeze(new d(0,-1,-N.PI));vo.DefaultMaxBounds=Object.freeze(new d(1,1,+N.PI));const Cit=5,Tit=new Array(Cit),bit=new d,Eit=new J,xit=new B,wit=new B,Sit=new B,T1=new B,vit=new d,Dit=new d,Iit=new d,Tee=new Array(8);for(let e=0;e<8;e++)Tee[e]=new d;function W5(e,t,n){return Math.abs(oe.dot(e,t))<n}function Pit(e){const t=B.getColumn(e,0,vit),n=B.getColumn(e,1,Dit),i=B.getColumn(e,2,Iit),o=N.EPSILON4;return W5(t,n,o)&&W5(n,i,o)}function Oit(e,t){const n=Tee;d.fromElements(-.5,-.5,-.5,n[0]),d.fromElements(-.5,-.5,.5,n[1]),d.fromElements(-.5,.5,-.5,n[2]),d.fromElements(-.5,.5,.5,n[3]),d.fromElements(.5,-.5,-.5,n[4]),d.fromElements(.5,-.5,.5,n[5]),d.fromElements(.5,.5,-.5,n[6]),d.fromElements(.5,.5,.5,n[7]);for(let i=0;i<8;++i)B.multiplyByPoint(e,n[i],n[i]);return Bt.fromPoints(n,t)}function UF(e,t,n,i,o,r,s,a){const c=vo.DefaultMinBounds,u=vo.DefaultMaxBounds,f=c.x,h=u.x,_=c.y,g=u.y,p=c.z,y=u.z;if(e===f&&t===h&&n===_&&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+=N.TWO_PI);const T=r-o,E=o+T*.5,w=Tit;let S=0;w[S++]=o,w[S++]=r,w[S++]=E,T>N.PI&&(w[S++]=E-N.PI_OVER_TWO,w[S++]=E+N.PI_OVER_TWO);let P=1,O=1,z=-1,R=-1;for(let te=0;te<S;++te){const $=w[te]-E,X=Math.cos($),Y=Math.sin($),ae=X*e,ue=Y*e,re=X*t,he=Y*t;P=Math.min(P,ae),O=Math.min(O,ue),P=Math.min(P,re),O=Math.min(O,he),z=Math.max(z,ae),R=Math.max(R,ue),z=Math.max(z,re),R=Math.max(R,he)}const F=z-P,H=R-O,v=i-n,I=(P+z)*.5,m=(O+R)*.5,D=(n+i)*.5,L=d.fromElements(I,m,D,bit),M=J.fromRotationZ(E,Eit),V=d.fromElements(F,H,v,Cee),k=B.fromScale(V,Sit),W=B.fromRotation(M,wit),G=B.fromTranslation(L,xit),K=B.multiplyTransformation(W,B.multiplyTransformation(G,k,T1),T1),q=B.multiplyTransformation(s,K,T1);return Pit(q)?Bt.fromTransformation(q,a):Oit(q,a)}function Fs(){this.orientedBoundingBox=new Bt,this.boundingSphere=new fe,this.boundTransform=new B,this.shapeTransform=new B,this._rectangle=new _e,this._minimumHeight=Fs.DefaultMinBounds.z,this._maximumHeight=Fs.DefaultMaxBounds.z,this._ellipsoid=new pe,this._translation=new d,this._rotation=new J,this.shaderUniforms={ellipsoidRadiiUv:new d,ellipsoidInverseRadiiSquaredUv:new d,ellipsoidRenderLongitudeMinMax:new j,ellipsoidShapeUvLongitudeMinMaxMid:new d,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 Lit=new d,Bit=new J,j5=new d,q5=new d,Y5=new d,$5=new d,Rit=new _e;Fs.prototype.update=function(e,t,n,i,o){i=A(i,Fs.DefaultMinBounds),o=A(o,Fs.DefaultMaxBounds),b.typeOf.object("modelMatrix",e),b.typeOf.object("minBounds",t),b.typeOf.object("maxBounds",n);const r=Fs.DefaultMinBounds.x,s=Fs.DefaultMaxBounds.x,a=s-r,c=.5*a,u=Fs.DefaultMinBounds.y,f=Fs.DefaultMaxBounds.y,h=f-u,_=N.EPSILON10,g=N.EPSILON3,p=N.EPSILON10,y=N.EPSILON10,C=N.EPSILON3,T=N.clamp(t.x,r,s),E=N.clamp(n.x,r,s),w=N.clamp(i.x,r,s),S=N.clamp(o.x,r,s),P=Math.max(T,w),O=Math.min(E,S),z=N.clamp(t.y,u,f),R=N.clamp(n.y,u,f),F=N.clamp(i.y,u,f),H=N.clamp(o.y,u,f),v=Math.max(z,F),I=Math.min(R,H),m=B.getScale(e,Lit),D=m.x===m.y&&m.y===m.z,L=d.minimumComponent(m),M=Math.max(t.z,-L),V=Math.max(n.z,-L),k=Math.max(i.z,-L),W=Math.max(o.z,-L),G=Math.max(M,k),K=Math.min(V,W),q=d.add(m,d.fromElements(M,M,M,q5),q5),te=d.add(m,d.fromElements(V,V,V,j5),j5),$=d.maximumComponent(te),X=d.add(m,d.fromElements(G,G,G,$5),$5),Y=d.add(m,d.fromElements(K,K,K,Y5),Y5),ae=d.maximumComponent(Y);if(v>I||v===f||I===u||G>K||N.equalsEpsilon(Y,d.ZERO,void 0,_))return!1;this._rectangle=_e.fromRadians(T,z,E,R),this._translation=B.getTranslation(e,this._translation),this._rotation=B.getRotation(e,this._rotation),this._ellipsoid=pe.fromCartesian3(m,this._ellipsoid),this._minimumHeight=M,this._maximumHeight=V;const ue=_e.fromRadians(P,v,O,I,Rit);this.orientedBoundingBox=bee(ue,G,K,this._ellipsoid,this._translation,this._rotation,this.orientedBoundingBox),this.shapeTransform=B.fromRotationTranslation(J.setScale(this._rotation,Y,Bit),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=O<P,he=O-P+re*a,ce=he<=p,Q=he>c+p&&he<a-p,ie=he>=c-p&&he<=c+p,de=he>p&&he<c-p,me=ce||Q||ie||de,Ee=O<P,xe=E-T+Ee*a,Pe=xe<=p,Te=xe>c+p&&xe<a-p,Oe=xe>=c-p&&xe<=c+p,De=xe>p&&xe<c-p,Me=Pe||Te||Oe||De,ve=I<-C,Ie=I>=-C&&I<=+C,Ve=I>+C&&I<f-y,Le=ve||Ie||Ve,_t=v>u+y&&v<-C,Tt=v>=-C&&v<=+C,Ot=v>+C,Tn=_t||Tt||Ot,Sn=Le||Tn,gn=R-z,on=R<-C,Nt=R>=-C&&R<=+C,yn=R>+C&&R<f-y,Cn=on||Nt||yn,Ht=z>u+y&&z<-C,Xt=z>=-C&&z<=+C,Mn=z>+C,en=Cn||(Ht||Xt||Mn),xi=!d.equals(X,d.ZERO),Yi=!d.equals(Y,d.ZERO),Pi=xi||Yi,Jn=K-G,cn=!d.equals(q,d.ZERO),Vn=!d.equals(te,d.ZERO),On=cn||Vn,rn=this.shaderUniforms,gt=this.shaderDefines;for(const vn in gt)gt.hasOwnProperty(vn)&&(gt[vn]=void 0);rn.ellipsoidRadiiUv=d.divideByScalar(te,$,rn.ellipsoidRadiiUv),rn.ellipsoidInverseRadiiSquaredUv=d.divideComponents(d.ONE,d.multiplyComponents(rn.ellipsoidRadiiUv,rn.ellipsoidRadiiUv,rn.ellipsoidInverseRadiiSquaredUv),rn.ellipsoidInverseRadiiSquaredUv);let ke=0;if(gt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MAX=ke,ke+=1,Pi&&(Jn===0&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_FLAT=!0),xi&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_HEIGHT_MIN=!0,gt.ELLIPSOID_INTERSECTION_INDEX_HEIGHT_MIN=ke,ke+=1,rn.ellipsoidInverseInnerScaleUv=ae/(ae-Jn))),On){if(cn){gt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_MIN=!0;const vn=(V-M)/$;rn.ellipsoidInverseHeightDifferenceUv=1/vn,rn.ellipseInnerRadiiUv=j.fromElements(rn.ellipsoidRadiiUv.x*(1-vn),rn.ellipsoidRadiiUv.z*(1-vn),rn.ellipseInnerRadiiUv)}M===V&&(gt.ELLIPSOID_HAS_SHAPE_BOUNDS_HEIGHT_FLAT=!0)}if(me&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE=!0,gt.ELLIPSOID_INTERSECTION_INDEX_LONGITUDE=ke,Q?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_UNDER_HALF=!0,ke+=1):de?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_OVER_HALF=!0,ke+=2):ie?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_HALF=!0,ke+=1):ce&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_RANGE_EQUAL_ZERO=!0,ke+=2),rn.ellipsoidRenderLongitudeMinMax=j.fromElements(P,O,rn.ellipsoidRenderLongitudeMinMax)),Me){gt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE=!0,E<T&&(gt.ELLIPSOID_HAS_SHAPE_BOUNDS_LONGITUDE_MIN_MAX_REVERSED=!0);const pn=a/xe,Hi=-(T-r)/xe;rn.ellipsoidUvToShapeUvLongitude=j.fromElements(pn,Hi,rn.ellipsoidUvToShapeUvLongitude)}if(me){const vn=N.equalsEpsilon(P,r,void 0,g),pn=N.equalsEpsilon(O,s,void 0,g);vn&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MIN_DISCONTINUITY=!0),pn&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LONGITUDE_MAX_DISCONTINUITY=!0);const Hi=(T-r)/a,Dn=(E-r)/a,Oi=(O-r)/a,bo=1-he/a,no=(Oi+.5*bo)%1;rn.ellipsoidShapeUvLongitudeMinMaxMid=d.fromElements(Hi,Dn,no,rn.ellipsoidShapeUvLongitudeMinMaxMid)}if(Sn){gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE=!0,Tn&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN=!0,gt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MIN=ke,_t?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_UNDER_HALF=!0,ke+=1):Tt?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_EQUAL_HALF=!0,ke+=1):Ot&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MIN_OVER_HALF=!0,ke+=2)),Le&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX=!0,gt.ELLIPSOID_INTERSECTION_INDEX_LATITUDE_MAX=ke,ve?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_UNDER_HALF=!0,ke+=2):Ie?(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_EQUAL_HALF=!0,ke+=1):Ve&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_MAX_OVER_HALF=!0,ke+=1)),v===I&&(gt.ELLIPSOID_HAS_RENDER_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const vn=Math.pow(Math.cos(N.PI_OVER_TWO-Math.abs(v)),2),pn=Math.pow(Math.cos(N.PI_OVER_TWO-Math.abs(I)),2);rn.ellipsoidRenderLatitudeCosSqrHalfMinMax=j.fromElements(vn,pn,rn.ellipsoidRenderLatitudeCosSqrHalfMinMax)}if(en){gt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE=!0,z===R&&(gt.ELLIPSOID_HAS_SHAPE_BOUNDS_LATITUDE_RANGE_EQUAL_ZERO=!0);const vn=h/gn,pn=(u-z)/gn;rn.ellipsoidUvToShapeUvLatitude=j.fromElements(vn,pn,rn.ellipsoidUvToShapeUvLatitude)}return D&&(gt.ELLIPSOID_IS_SPHERE=!0),this.shaderMaximumIntersectionsLength=ke,!0};const Nit=new _e;Fs.prototype.computeOrientedBoundingBoxForTile=function(e,t,n,i,o){b.typeOf.number("tileLevel",e),b.typeOf.number("tileX",t),b.typeOf.number("tileY",n),b.typeOf.number("tileZ",i),b.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,f=i*r,h=(i+1)*r,_=_e.subsection(this._rectangle,s,c,a,u,Nit),g=N.lerp(this._minimumHeight,this._maximumHeight,f),p=N.lerp(this._minimumHeight,this._maximumHeight,h);return bee(_,g,p,this._ellipsoid,this._translation,this._rotation,o)};Fs.prototype.computeApproximateStepSize=function(e){b.typeOf.object("dimensions",e);const n=this._ellipsoid.maximumRadius,i=this._minimumHeight,o=this._maximumHeight;return .5*((o-i)/(n+o))/e.z};function bee(e,t,n,i,o,r,s){return s=Bt.fromRectangle(e,t,n,i,s),s.center=d.add(s.center,o,s.center),s.halfAxes=J.multiply(s.halfAxes,r,s.halfAxes),s}Fs.DefaultMinBounds=Object.freeze(new d(-N.PI,-N.PI_OVER_TWO,-Number.MAX_VALUE));Fs.DefaultMaxBounds=Object.freeze(new d(+N.PI,+N.PI_OVER_TWO,+Number.MAX_VALUE));const Ja={BOX:"BOX",ELLIPSOID:"ELLIPSOID",CYLINDER:"CYLINDER"};Ja.getMinBounds=function(e){switch(e){case Ja.BOX:return Gs.DefaultMinBounds;case Ja.ELLIPSOID:return Fs.DefaultMinBounds;case Ja.CYLINDER:return vo.DefaultMinBounds;default:throw new x(`Invalid shape type ${e}`)}};Ja.getMaxBounds=function(e){switch(e){case Ja.BOX:return Gs.DefaultMaxBounds;case Ja.ELLIPSOID:return Fs.DefaultMaxBounds;case Ja.CYLINDER:return vo.DefaultMaxBounds;default:throw new x(`Invalid shape type ${e}`)}};Ja.getShapeConstructor=function(e){switch(e){case Ja.BOX:return Gs;case Ja.ELLIPSOID:return Fs;case Ja.CYLINDER:return vo;default:throw new x(`Invalid shape type ${e}`)}};const Wg=Object.freeze(Ja),Eee=Object.freeze({UNLOADED:0,RECEIVING:1,RECEIVED:2,LOADED:3,FAILED:4,UNAVAILABLE:5});function Ai(e,t){this.spatialNode=e,this.keyframe=t,this.state=Eee.UNLOADED,this.metadatas=[],this.megatextureIndex=-1,this.priority=-Number.MAX_VALUE,this.highPriorityFrameNumber=-1}Ai.priorityComparator=function(e,t){return e.priority-t.priority};Ai.searchComparator=function(e,t){return e.keyframe-t.keyframe};Ai.LoadState=Eee;function Gd(e,t,n,i,o){i===Vt.UNSIGNED_SHORT&&(i=Vt.FLOAT32);const r=e.floatingPointTexture;if(i===Vt.FLOAT32&&!r)throw new Se("Floating point texture not supported");let s;i===Vt.FLOAT32||i===Vt.FLOAT64?s=Ke.FLOAT:i===Vt.UINT8&&(s=Ke.UNSIGNED_BYTE);let a;n===1?a=nt.LUMINANCE:n===2?a=nt.LUMINANCE_ALPHA:n===3?a=nt.RGB:n===4&&(a=nt.RGBA);const c=512*1024*1024,u=128*1024*1024;o=Math.min(A(o,u),c);const f=wt.maximumTextureSize,h=Vt.getSizeInBytes(i),_=Math.floor(o/(n*h)),g=Math.min(f,N.previousPowerOfTwo(Math.floor(Math.sqrt(_)))),p=Math.ceil(Math.sqrt(t.x)),y=Math.ceil(t.z/p),C=p*t.x,T=y*t.y,E=Math.floor(g/C),w=Math.floor(g/T);if(E===0||w===0)throw new Se("Tileset is too large to fit into megatexture");this.channelCount=n,this.componentType=i,this.voxelCountPerTile=d.clone(t,new d),this.maximumTileCount=E*w,this.regionCountPerMegatexture=new j(E,w),this.voxelCountPerRegion=new j(C,T),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(C/g,T/g),this.texture=new zt({context:e,pixelFormat:a,pixelDatatype:s,flipY:!1,width:g,height:g,sampler:new Yn({wrapS:Ei.CLAMP_TO_EDGE,wrapT:Ei.CLAMP_TO_EDGE,minificationFilter:An.LINEAR,magnificationFilter:Hr.LINEAR})});const S=Vt.toComponentDatatype(i);this.tileVoxelDataTemp=ee.createTypedArray(S,C*T*n),this.nodes=new Array(this.maximumTileCount);for(let P=0;P<this.maximumTileCount;P++)this.nodes[P]=new Mit(P);for(let P=0;P<this.maximumTileCount;P++){const O=this.nodes[P];O.previousNode=P>0?this.nodes[P-1]:void 0,O.nextNode=P<this.maximumTileCount-1?this.nodes[P+1]:void 0}this.occupiedList=void 0,this.emptyList=this.nodes[0],this.occupiedCount=0}function Mit(e){this.index=e,this.nextNode=void 0,this.previousNode=void 0}Gd.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};Gd.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--};Gd.prototype.isFull=function(){return this.emptyList===void 0};Gd.getApproximateTextureMemoryByteLength=function(e,t,n,i){i===Vt.UNSIGNED_SHORT&&(i=Vt.FLOAT32);const o=Vt.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 f=N.previousPowerOfTwo(Math.floor(Math.sqrt(r)));for(;;){const _=Math.floor(f/c),g=Math.floor(f/u);if(_*g>=e)break;f*=2}return f*f*n*o};Gd.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 C=y%o.x*i.x,T=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=(T+E)*r.x+(C+w);for(let O=0;O<s;O++)a[P*s+O]=n[S*s+O]}}const c=this.regionCountPerMegatexture,u=r.x,f=r.y,h=e%c.x*r.x,_=Math.floor(e/c.x)*r.y,p={source:{arrayBufferView:a,width:u,height:f},xOffset:h,yOffset:_};this.texture.copyFrom(p)};Gd.prototype.isDestroyed=function(){return!1};Gd.prototype.destroy=function(){return this.texture=this.texture&&this.texture.destroy(),Ue(this)};const Fit=new Kn("MapQuest, Open Street Map and contributors, CC-BY-SA");function by(e){e=A(e,A.EMPTY_OBJECT);const t=Re.createIfNeeded(A(e.url,"https://a.tile.openstreetmap.org/"));t.appendForwardSlash(),t.url+=`{z}/{x}/{y}.${A(e.fileExtension,"png")}`;const n=new ws({ellipsoid:e.ellipsoid}),i=256,o=256,r=A(e.minimumLevel,0),s=e.maximumLevel,a=A(e.rectangle,n.rectangle),c=n.positionToTileXY(_e.southwest(a),r),u=n.positionToTileXY(_e.northeast(a),r),f=(Math.abs(u.x-c.x)+1)*(Math.abs(u.y-c.y)+1);if(f>4)throw new x(`The rectangle and minimumLevel indicate that there are ${f} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`);let h=A(e.credit,Fit);typeof h=="string"&&(h=new Kn(h)),_c.call(this,{url:t,credit:h,tilingScheme:n,tileWidth:i,tileHeight:o,minimumLevel:r,maximumLevel:s,rectangle:a})}l(Object.create)&&(by.prototype=Object.create(_c.prototype),by.prototype.constructor=by);function zit(e,t,n){return b.typeOf.string("samplerUniformName",e),b.typeOf.string("matrixUniformName",t),b.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 Uit={modifyFragmentShader:function(t){return t=Ge.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}}},xee=Uit,Sm={NEEDS_DECODE:0,DECODING:1,READY:2,FAILED:3};function _b(e){b.typeOf.object("options",e),b.typeOf.object("options.arrayBuffer",e.arrayBuffer),this._parsedContent=void 0,this._drawCommand=void 0,this._isTranslucent=!1,this._styleTranslucent=!1,this._constantColor=U.clone(U.DARKGRAY),this._highlightColor=U.clone(U.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=Sm.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,Be.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=Co.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,w_.NONE),this._splittingEnabled=!1,this._resolveReadyPromise=void 0,this._rejectReadyPromise=void 0,this._readyPromise=Hit(this,e)}Object.defineProperties(_b.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 U.clone(this._highlightColor)},set:function(e){this._highlightColor=U.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 Hit(e,t){const n=eJ.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=gi.getBinaryProperties(n.pointsLength,n.batchTableJson,n.batchTableBinary)),l(n.draco)){const a=n.draco;e._decodingState=Sm.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=U.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 Vit=new d,kit=new d,Git=new d;let X5,Nx;function Wit(e){if(!l(Nx)){X5=new gv(0),Nx=new Array(e);for(let t=0;t<e;++t)Nx[t]=X5.random()}return Nx}function jit(e){const n=e.length/3,i=Math.min(n,20),o=Wit(20),r=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=d.fromElements(r,r,r,Vit),c=d.fromElements(s,s,s,kit);for(let f=0;f<i;++f){const h=Math.floor(o[f]*n),_=d.unpack(e,h*3,Git);d.minimumByComponent(a,_,a),d.maximumByComponent(c,_,c)}const u=fe.fromCornerPoints(a,c);return u.radius+=N.EPSILON2,u}function K5(e,t){const n=ee.fromTypedArray(e);return n===ee.INT||n===ee.UNSIGNED_INT||n===ee.DOUBLE?(Di("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 qit=new oe,Yit=new oe,$it=new U,wee=0,YS=1,aR=2,See=3,Xit=4,b1=new B,Kit=new B;function Jit(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,f=l(u),h=e._isQuantized,_=e._isQuantizedDraco,g=e._isOctEncoded16P,p=e._isOctEncodedDraco,y=e._quantizedRange,C=e._octEncodedRange,T=e._isRGB565,E=e._isTranslucent,w=e._hasColors,S=e._hasNormals,P=e._hasBatchIds;let O,z;const R=[],F={};if(e._styleableShaderAttributes=F,f){let k=Xit;for(const W in u)if(u.hasOwnProperty(W)){const G=u[W],K=K5(G.typedArray,W);O=G.componentCount,z=ee.fromTypedArray(K);const q=At.createVertexBuffer({context:n,typedArray:K,usage:Ze.STATIC_DRAW});e._geometryByteLength+=q.sizeInBytes;const te={index:k,vertexBuffer:q,componentsPerAttribute:O,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0};R.push(te),F[W]={location:k,componentCount:O},++k}}const H=At.createVertexBuffer({context:n,typedArray:r.typedArray,usage:Ze.STATIC_DRAW});e._geometryByteLength+=H.sizeInBytes;let v;w&&(v=At.createVertexBuffer({context:n,typedArray:s.typedArray,usage:Ze.STATIC_DRAW}),e._geometryByteLength+=v.sizeInBytes);let I;S&&(I=At.createVertexBuffer({context:n,typedArray:a.typedArray,usage:Ze.STATIC_DRAW}),e._geometryByteLength+=I.sizeInBytes);let m;P&&(c.typedArray=K5(c.typedArray,"batchIds"),m=At.createVertexBuffer({context:n,typedArray:c.typedArray,usage:Ze.STATIC_DRAW}),e._geometryByteLength+=m.sizeInBytes);let D=[];if(h?z=ee.UNSIGNED_SHORT:_?z=y<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT:z=ee.FLOAT,D.push({index:wee,vertexBuffer:H,componentsPerAttribute:3,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0}),e._cull&&(h||_?e._boundingSphere=fe.fromCornerPoints(d.ZERO,e._quantizedVolumeScale):e._boundingSphere=jit(r.typedArray)),w)if(T)D.push({index:YS,vertexBuffer:v,componentsPerAttribute:1,componentDatatype:ee.UNSIGNED_SHORT,normalize:!1,offsetInBytes:0,strideInBytes:0});else{const k=E?4:3;D.push({index:YS,vertexBuffer:v,componentsPerAttribute:k,componentDatatype:ee.UNSIGNED_BYTE,normalize:!0,offsetInBytes:0,strideInBytes:0})}S&&(g?(O=2,z=ee.UNSIGNED_BYTE):p?(O=2,z=C<=255?ee.UNSIGNED_BYTE:ee.UNSIGNED_SHORT):(O=3,z=ee.FLOAT),D.push({index:aR,vertexBuffer:I,componentsPerAttribute:O,componentDatatype:z,normalize:!1,offsetInBytes:0,strideInBytes:0})),P&&D.push({index:See,vertexBuffer:m,componentsPerAttribute:1,componentDatatype:ee.fromTypedArray(c.typedArray),normalize:!1,offsetInBytes:0,strideInBytes:0}),f&&(D=D.concat(R));const L=new to({context:n,attributes:D}),M={depthTest:{enabled:!0}},V={depthTest:{enabled:!0},depthMask:!1,blending:Ii.ALPHA_BLEND};e._opaquePass===Be.CESIUM_3D_TILE&&(M.stencilTest=Pt.setCesium3DTileBit(),M.stencilMask=Pt.CESIUM_3D_TILE_MASK,V.stencilTest=Pt.setCesium3DTileBit(),V.stencilMask=Pt.CESIUM_3D_TILE_MASK),e._opaqueRenderState=Qe.fromCache(M),e._translucentRenderState=Qe.fromCache(V),e._drawCommand=new dt({boundingVolume:new fe,cull:e._cull,modelMatrix:new B,primitiveType:Je.POINTS,vertexArray:L,count:o,shaderProgram:void 0,uniformMap:void 0,renderState:E?e._translucentRenderState:e._opaqueRenderState,pass:E?Be.TRANSLUCENT:e._opaquePass,owner:e,castShadows:!1,receiveShadows:!1,pickId:e._pickIdLoaded()})}function Qit(e,t){const n=t.context,i=e._isQuantized,o=e._isQuantizedDraco,r=e._isOctEncodedDraco;let s={u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier:function(){const a=qit;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 Ft?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 U.TRANSPARENT;const c=U.clone(a.edgeColor,$it);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,b1);const u=B.multiply(b1,a.modelMatrix,b1);return B.inverseTranspose(u,Kit)}};xee.addUniforms(e,s),(i||o||r)&&(s=sn(s,{u_quantizedVolumeScaleAndOctEncodedRange:function(){const a=Yit;if(l(e._quantizedVolumeScale)){const c=d.clone(e._quantizedVolumeScale,a);d.divideByScalar(c,e._quantizedRange,a)}return a.w=e._octEncodedRange,a}})),l(e._uniformMapLoaded)&&(s=e._uniformMapLoaded(s)),e._drawCommand.uniformMap=s}function E1(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 x1(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 w1(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 Zit={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 eot(e,t,n){let i,o,r;const s=t.context,a=l(n),c=e._isQuantized,u=e._isQuantizedDraco,f=e._isOctEncoded16P,h=e._isOctEncodedDraco,_=e._isRGB565,g=e._isTranslucent,p=e._hasColors,y=e._hasNormals,C=e._hasBatchIds,T=e._backFaceCulling,E=e._normalShading,w=e._drawCommand.vertexArray,S=e.clippingPlanes,P=e._attenuation;let O,z,R,F=g;const H=ut(Zit),v={},I=e._styleableShaderAttributes;for(o in I)I.hasOwnProperty(o)&&(r=I[o],H[o]=`czm_3dtiles_property_${r.location}`,v[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)";O=n.getColorShaderFunction(`getColorFromStyle${he}`,H,re),z=n.getShowShaderFunction(`getShowFromStyle${he}`,H,re),R=n.getPointSizeShaderFunction(`getPointSizeFromStyle${he}`,H,re),l(O)&&re.translucent&&(F=!0)}e._styleTranslucent=F;const m=l(O),D=l(z),L=l(R),M=e.isClipped,V=[],k=[];m&&(E1(O,V),x1(O,k)),D&&(E1(z,V),x1(z,k)),L&&(E1(R,V),x1(R,k));const W=k.indexOf("COLOR")>=0,G=k.indexOf("NORMAL")>=0;if(G&&!y)throw new Se("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=w1(w,r.location);he.enabled=re}const K=p&&(!m||W);if(p){const re=w1(w,YS);re.enabled=K}const q=y&&(E||T||G);if(y){const re=w1(w,aR);re.enabled=q}const te={a_position:wee};K&&(te.a_color=YS),q&&(te.a_normal=aR),C&&(te.a_batchId=See);let $="";const X=V.length;for(i=0;i<X;++i){const re=V[i];r=v[re];const he=r.componentCount,ce=`czm_3dtiles_property_${re}`;let Q;he===1?Q="float":Q=`vec${he}`,$+=`attribute ${Q} ${ce};
`,te[ce]=r.location}Qit(e,t);let Y=`attribute vec3 a_position;
varying vec4 v_color;
uniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
uniform vec4 u_constantColor;
uniform vec4 u_highlightColor;
`;Y+=`float u_pointSize;
float tiles3d_tileset_time;
`,P&&(Y+=`float u_geometricError;
float u_depthMultiplier;
`),Y+=$,K&&(g?Y+=`attribute vec4 a_color;
`:_?Y+=`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;
`:Y+=`attribute vec3 a_color;
`),q&&(f||h?Y+=`attribute vec2 a_normal;
`:Y+=`attribute vec3 a_normal;
`),C&&(Y+=`attribute float a_batchId;
`),(c||u||h)&&(Y+=`uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange;
`),m&&(Y+=O),D&&(Y+=z),L&&(Y+=R),Y+=`void main()
{
u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x;
tiles3d_tileset_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y;
`,P&&(Y+=` u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z;
u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w;
`),K?g?Y+=` vec4 color = a_color;
`:_?Y+=` 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);
`:Y+=` vec4 color = vec4(a_color, 1.0);
`:Y+=` vec4 color = u_constantColor;
`,c||u?Y+=` vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz;
`:Y+=` vec3 position = a_position;
`,Y+=` vec3 position_absolute = vec3(czm_model * vec4(position, 1.0));
`,q?(f?Y+=` vec3 normal = czm_octDecode(a_normal);
`:h?Y+=` vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy;
`:Y+=` vec3 normal = a_normal;
`,Y+=` vec3 normalEC = czm_normal * normal;
`):Y+=` vec3 normal = vec3(1.0);
`,m&&(Y+=` color = getColorFromStyle(position, position_absolute, color, normal);
`),D&&(Y+=` float show = float(getShowFromStyle(position, position_absolute, color, normal));
`),L?Y+=` gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio;
`:P?Y+=` vec4 positionEC = czm_modelView * vec4(position, 1.0);
float depth = -positionEC.z;
gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize);
`:Y+=` gl_PointSize = u_pointSize;
`,Y+=` color = color * u_highlightColor;
`,q&&E&&(Y+=` float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC);
diffuseStrength = max(diffuseStrength, 0.4);
color.xyz *= diffuseStrength * czm_lightColor;
`),Y+=` v_color = color;
gl_Position = czm_modelViewProjection * vec4(position, 1.0);
`,q&&T&&(Y+=` float visible = step(-normalEC.z, 0.0);
gl_Position *= visible;
gl_PointSize *= visible;
`),D&&(Y+=` gl_Position.w *= float(show);
gl_PointSize *= float(show);
`),Y+=`}
`;let ae=`varying vec4 v_color;
`;M&&(ae+=`uniform highp sampler2D u_clippingPlanes;
uniform mat4 u_clippingPlanesMatrix;
uniform vec4 u_clippingPlanesEdgeStyle;
`,ae+=`
`,ae+=qN(S,s),ae+=`
`),ae+=`void main()
{
gl_FragColor = czm_gammaCorrect(v_color);
`,M&&(ae+=zit("u_clippingPlanes","u_clippingPlanesMatrix","u_clippingPlanesEdgeStyle")),ae+=`}
`,e.splitDirection!==w_.NONE&&(ae=xee.modifyFragmentShader(ae)),l(e._vertexShaderLoaded)&&(Y=e._vertexShaderLoaded(Y)),l(e._fragmentShaderLoaded)&&(ae=e._fragmentShaderLoaded(ae));const ue=e._drawCommand;l(ue.shaderProgram)&&ue.shaderProgram.destroy(),ue.shaderProgram=hn.fromCache({context:s,vertexShaderSource:Y,fragmentShaderSource:ae,attributeLocations:te});try{ue.shaderProgram._bind()}catch{throw new Se("Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error.")}}function tot(e,t){if(e._decodingState===Sm.READY)return!1;if(e._decodingState===Sm.NEEDS_DECODE){const n=e._parsedContent,i=n.draco,o=Qr.decodePointCloud(i,t);l(o)&&(e._decodingState=Sm.DECODING,o.then(function(r){e._decodingState=Sm.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,f=l(r.BATCH_ID)?r.BATCH_ID.array:void 0,h=l(s)&&l(r.POSITION.data.quantization),_=l(u)&&l(r.NORMAL.data.quantization);if(h){const C=r.POSITION.data.quantization,T=C.range;e._quantizedVolumeScale=d.fromElements(T,T,T),e._quantizedVolumeOffset=d.unpack(C.minValues),e._quantizedRange=(1<<C.quantizationBits)-1,e._isQuantizedDraco=!0}_&&(e._octEncodedRange=(1<<r.NORMAL.data.quantization.quantizationBits)-1,e._isOctEncodedDraco=!0);let g=n.styleableProperties;const p=i.batchTableProperties;for(const C in p)if(p.hasOwnProperty(C)){const T=r[C];l(g)||(g={}),g[C]={typedArray:T.array,componentCount:T.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(f)&&(n.batchIds={typedArray:f}),n.styleableProperties=g}).catch(function(r){e._decodingState=Sm.FAILED,e._rejectReadyPromise(r)}))}return!0}const not=new oe,iot=new d;_b.prototype.update=function(e){const t=e.context;if(tot(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)||(Jit(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,_=B.getColumn(u,3,not);oe.equals(_,oe.UNIT_W)||tn.basisTo2D(h,u,u)}const f=this._drawCommand.boundingVolume;if(fe.clone(this._boundingSphere,f),this._cull){const h=f.center;B.multiplyByPoint(u,h,h);const _=B.getScale(u,iot);f.radius*=d.maximumComponent(_)}}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!==w_.NONE;this._splittingEnabled!==r&&(this._splittingEnabled=r,i=!0),i&&eot(this,e,this._style),this._drawCommand.castShadows=Co.castShadows(this.shadows),this._drawCommand.receiveShadows=Co.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?Be.TRANSLUCENT:this._opaquePass;const a=e.commandList,c=e.passes;(c.render||c.pick)&&a.push(this._drawCommand)};_b.prototype.isDestroyed=function(){return!1};_b.prototype.destroy=function(){const e=this._drawCommand;return l(e)&&(e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy()),Ue(this)};function pl(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 Bt,this.approximateVoxelSize=0,this.screenSpaceError=0,this.visitedFrameNumber=-1,this.computeBoundingVolumes(r,s)}pl.spatialComparator=function(e,t){return t.screenSpaceError-e.screenSpaceError};const oot=new d;pl.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,oot),i=2*d.maximumComponent(n);this.approximateVoxelSize=i/d.minimumComponent(t)};pl.prototype.visibility=function(e,t){const n=this.orientedBoundingBox;return e.cullingVolume.computeVisibilityWithPlaneMask(n,t)};pl.prototype.computeScreenSpaceError=function(e,t){const n=this.orientedBoundingBox;let i=Math.sqrt(n.distanceSquaredTo(e));i=Math.max(i,N.EPSILON7);const o=this.approximateVoxelSize,r=t*(o/i);this.screenSpaceError=r};const J5={keyframe:0};function AT(e,t){return J5.keyframe=e,Cs(t,J5,Ai.searchComparator)}pl.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 f=AT(i,u);f<0&&(f=N.clamp(~f-1,0,u.length-1));const h=u[f],_=h.keyframe;let g;if(o===i||i<_)g=h;else{const z=Math.min(f+1,u.length-1);g=u[z]}const p=g.keyframe,y=i-_,C=p-o,T=n-t.level,E=Math.exp(T*4),w=1,S=200,P=T*E+(y>=0?y*w:-y*S),O=T*E+(C>=0?C*w:-C*S);if(P<a&&(a=P,r=h),O<c&&(c=O,s=g),y===0&&C===0)break}t=t.parent}if(this.renderableKeyframeNodePrevious=r,this.renderableKeyframeNodeNext=s,l(r)&&l(s)){const u=r.keyframe,f=s.keyframe;this.renderableKeyframeNodeLerp=u===f?0:N.clamp((e-u)/(f-u),0,1)}};pl.prototype.isVisited=function(e){return this.visitedFrameNumber===e};pl.prototype.createKeyframeNode=function(e){let t=AT(e,this.keyframeNodes);if(t<0){t=~t;const n=new Ai(this,e);this.keyframeNodes.splice(t,0,n)}};pl.prototype.destroyKeyframeNode=function(e,t){const n=e.keyframe,i=AT(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=AT(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=Ai.LoadState.UNLOADED,e.metadatas={},e.megatextureIndex=-1,e.priority=-Number.MAX_VALUE,e.highPriorityFrameNumber=-1};pl.prototype.addKeyframeNodeToMegatextures=function(e,t){if(e.state!==Ai.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=Ai.LoadState.LOADED;const n=this.renderableKeyframeNodes;let i=AT(e.keyframe,n);if(i>=0)throw new x("Keyframe already renderable");i=~i,n.splice(i,0,e)};pl.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 Np(e){e=A(e,A.EMPTY_OBJECT),b.typeOf.object("options.clock",e.clock),b.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,Co.ENABLED),this.maximumMemoryUsage=A(e.maximumMemoryUsage,256),this.shading=new ib(e.shading),this.style=e.style,this.frameFailed=new $e,this.frameChanged=new $e,this._clock=e.clock,this._intervals=e.intervals,this._clippingPlanes=void 0,this.clippingPlanes=e.clippingPlanes,this._pointCloudEyeDomeLighting=new Op,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(Np.prototype,{clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Ao.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 rot(e){return`uniform vec4 czm_pickColor;
${e}`}function sot(e){return function(t){return sn(t,{czm_pickColor:function(){return e._pickId.color}})}}function aot(){return"czm_pickColor"}Np.prototype.makeStyleDirty=function(){this._styleDirty=!0};Np.prototype._getAverageLoadTime=function(){return this._runningLength===0?.05:this._runningAverage};const cot=new ne;function HF(e){const t=e._clock,n=t.canAnimate&&t.shouldAnimate,i=t.multiplier;return n?i:0}function p_(e,t){return e._intervals.indexOf(t.start)}function lot(e,t){const n=e._intervals,i=e._clock,o=HF(e);if(o===0)return;const r=e._getAverageLoadTime(),s=ne.addSeconds(i.currentTime,r*o,cot);let a=n.indexOf(s);const c=p_(e,t);return a===c&&(o>=0?++a:--a),n.get(a)}function uot(e){const t=e._intervals,i=e._clock.currentTime,o=t.indexOf(i);return t.get(o)}function fot(e,t,n){const i=HF(e),o=p_(e,t),r=p_(e,n);return i>=0?o>=r:o<=r}function dot(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 hot(e,t,n){const i=p_(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:er(),sequential:!0,ready:!1,touchedFrameNumber:n.frameNumber},o[i]=r,Re.fetchArrayBuffer({url:c}).then(function(u){return r.pointCloud=new _b({arrayBuffer:u,cull:!0,fragmentShaderLoaded:rot,uniformMapLoaded:sot(e),pickIdLoaded:aot}),r.pointCloud.readyPromise}).catch(dot(e,c))}return r}function pot(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 mot(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(vee(e,t,n,i),o.ready&&(t.ready=!0,e._totalMemoryUsageInBytes+=o.geometryByteLength,r.length=s,t.sequential)){const a=(er()-t.timestamp)/1e3;pot(e,a)}}t.touchedFrameNumber=i.frameNumber}const _ot=new B;function got(e,t){const n=e.shading;return l(n)&&l(n.baseResolution)?n.baseResolution:l(t.boundingSphere)?N.cbrt(t.boundingSphere.volume()/t.pointsLength):0}function yot(e){const t=e.shading;return l(t)&&l(t.maximumAttenuation)?t.maximumAttenuation:10}const Aot=new ib;function vee(e,t,n,i){const o=A(e.shading,Aot),r=t.pointCloud,s=A(t.transform,B.IDENTITY);r.modelMatrix=B.multiplyTransformation(e.modelMatrix,s,_ot),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=got(e,r),r.geometricErrorScale=o.geometricErrorScale,r.maximumAttenuation=yot(e),r.update(i),t.touchedFrameNumber=i.frameNumber}function cR(e,t,n,i){const o=hot(e,t,i);mot(e,o,n,i)}function Cot(e){return function(t){return t.touchedFrameNumber<e.frameNumber}}function Dee(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 Tot(e,t){const n=p_(e,t),i=e._frames[n];if(l(i)&&i.ready)return i}function Q5(e,t,n,i,o){return l(n)?n.ready?!0:(cR(e,t,i,o),n.ready):!1}function bot(e,t,n,i,o){let r,s,a;const c=e._intervals,u=e._frames,f=p_(e,n),h=p_(e,t);if(f>=h){for(r=f;r>=h;--r)if(s=c.get(r),a=u[r],Q5(e,s,a,i,o))return s}else for(r=f;r<=h;++r)if(s=c.get(r),a=u[r],Q5(e,s,a,i,o))return s;return t}function Eot(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 Dg={timeSinceLoad:0,isClipped:!1,clippingPlanesDirty:!1};Np.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=ne.clone(e.time));const t=Math.max(ne.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)&&Eot(this,o,s),Dg.timeSinceLoad=t,Dg.isClipped=r;const a=this.shading,c=this._pointCloudEyeDomeLighting,u=e.commandList,f=u.length;let h=this._previousInterval,_=this._nextInterval;const g=uot(this);if(!l(g))return;let p=!1;const y=HF(this),C=y===0;y!==this._clockMultiplier&&(p=!0,this._clockMultiplier=y),(!l(h)||C)&&(h=g),(!l(_)||p||fot(this,g,_))&&(_=lot(this,g)),h=bot(this,h,g,Dg,e);let T=Tot(this,h);l(T)||(cR(this,h,Dg,e),T=this._lastRenderedFrame),l(T)&&vee(this,T,Dg,e),l(_)&&cR(this,_,Dg,e);const E=this;l(T)&&!l(this._lastRenderedFrame)&&e.afterRender.push(function(){return E._resolveReadyPromise(E),!0}),l(T)&&T!==this._lastRenderedFrame&&E.frameChanged.numberOfListeners>0&&e.afterRender.push(function(){return E.frameChanged.raiseEvent(E),!0}),this._previousInterval=h,this._nextInterval=_,this._lastRenderedFrame=T;const w=this._totalMemoryUsageInBytes,S=this.maximumMemoryUsage*1024*1024;w>S&&Dee(this,Cot(e));const O=u.length-f;l(a)&&a.attenuation&&a.eyeDomeLighting&&O>0&&c.update(e,f,a,this.boundingSphere)};Np.prototype.isDestroyed=function(){return!1};Np.prototype.destroy=function(){return Dee(this),this._clippingPlanes=this._clippingPlanes&&this._clippingPlanes.destroy(),this._pickId=this._pickId&&this._pickId.destroy(),Ue(this)};const xot=`// 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
}
`,wot=`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);
}
`,Sot=`/* 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 };
`,vot=`// 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));
}
}
`,Dot=`// 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
}
`,Iot=`// 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);
}
`,Pot=`// 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
}
`,Oot=`// 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
}
`,S1=`// 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;
}
`,Lot=`/* 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
}
`,Bot=`/* 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);
}
`,Rot=`/* 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);
}
`,Not=`// 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);
}
}
`,Mot=`// 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 Fot(e){const t=new oa;this.shaderBuilder=t;const n=e._customShader,i=sn(e._uniformMap,n.uniformMap);e._uniformMap=i;const o=n.uniforms;for(const _ in o)if(o.hasOwnProperty(_)){const g=o[_];t.addUniform(g.type,_,we.FRAGMENT)}t.addUniform("sampler2D","u_megatextureTextures[METADATA_COUNT]",we.FRAGMENT),this.uniformMap=i;const r=e._clippingPlanes,s=l(r)&&r.enabled?r.length:0;this.clippingPlanes=r,this.clippingPlanesLength=s,t.addVertexLines([wot]),t.addFragmentLines([n.fragmentShaderText,"#line 0",Sot]),s>0&&(t.addDefine("CLIPPING_PLANES",void 0,we.FRAGMENT),t.addDefine("CLIPPING_PLANES_COUNT",s,we.FRAGMENT),r.unionClippingRegions&&t.addDefine("CLIPPING_PLANES_UNION",void 0,we.FRAGMENT),t.addFragmentLines([Dot])),e._depthTest&&(t.addDefine("DEPTH_TEST",void 0,we.FRAGMENT),t.addFragmentLines([vot]));const a=e._provider.shape;a==="BOX"?t.addFragmentLines([Iot,S1,Lot]):a==="CYLINDER"?t.addFragmentLines([Pot,S1,Bot]):a==="ELLIPSOID"&&t.addFragmentLines([Oot,S1,Rot]),t.addFragmentLines([Not,Mot,xot]);const c=e._shape,u=c.shaderDefines;for(const _ in u)if(u.hasOwnProperty(_)){let g=u[_];l(g)&&(g=g===!0?void 0:g,t.addDefine(_,g,we.FRAGMENT))}let f=c.shaderMaximumIntersectionsLength;s>0&&(t.addDefine("CLIPPING_PLANES_INTERSECTION_INDEX",f,we.FRAGMENT),s===1?f+=1:r.unionClippingRegions?f+=2:f+=1),e._depthTest&&(t.addDefine("DEPTH_INTERSECTION_INDEX",f,we.FRAGMENT),f+=1),t.addDefine("INTERSECTION_COUNT",f,we.FRAGMENT),(!d.equals(e.paddingBefore,d.ZERO)||!d.equals(e.paddingAfter,d.ZERO))&&t.addDefine("PADDING",void 0,we.FRAGMENT),e._useLogDepth&&t.addDefine("LOG_DEPTH_READ_ONLY",void 0,we.FRAGMENT),e._jitter&&t.addDefine("JITTER",void 0,we.FRAGMENT),e._nearestSampling&&t.addDefine("NEAREST_SAMPLING",void 0,we.FRAGMENT);const h=e._traversal;t.addDefine("SAMPLE_COUNT",`${h._sampleCount}`,we.FRAGMENT)}function zot(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,we.FRAGMENT),u&&n.addDefine("STATISTICS",void 0,we.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],H=o[R],v=`PropertyStatistics_${F}`,I=`PropertyStatistics_${F}`;n.addStruct(v,I,we.FRAGMENT);const m=Mx(H);n.addStructField(v,m,"min"),n.addStructField(v,m,"max")}const f="Statistics",h="Statistics",_="statistics";n.addStruct(f,h,we.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],H=`PropertyStatistics_${F}`,v=F;n.addStructField(f,H,v)}const g="Metadata",p="Metadata",y="metadata";n.addStruct(g,p,we.FRAGMENT),n.addStructField(g,h,_);for(let R=0;R<c;R++){const F=i[R],H=o[R],v=Mx(H);n.addStructField(g,v,F)}for(let R=0;R<c;R++){const F=i[R],H=o[R],v=Hot(H),I=`VoxelProperty_${F}`,m=`VoxelProperty_${F}`;n.addStruct(I,m,we.FRAGMENT),n.addStructField(I,v,"partialDerivativeLocal"),n.addStructField(I,v,"partialDerivativeWorld"),n.addStructField(I,v,"partialDerivativeView"),n.addStructField(I,v,"partialDerivativeValid")}const C="Voxel",T="Voxel",E="voxel";n.addStruct(C,T,we.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],H=`VoxelProperty_${F}`;n.addStructField(C,H,F)}n.addStructField(C,"vec3","positionEC"),n.addStructField(C,"vec3","positionUv"),n.addStructField(C,"vec3","positionShapeUv"),n.addStructField(C,"vec3","positionUvLocal"),n.addStructField(C,"vec3","viewDirUv"),n.addStructField(C,"vec3","viewDirWorld"),n.addStructField(C,"float","travelDistance");const w="FragmentInput",S="FragmentInput";n.addStruct(w,S,we.FRAGMENT),n.addStructField(w,p,y),n.addStructField(w,T,E);const P="Properties",O="Properties",z="properties";n.addStruct(P,O,we.FRAGMENT);for(let R=0;R<c;R++){const F=i[R],H=o[R],v=Mx(H);n.addStructField(P,v,F)}{const R="clearProperties";n.addFunction(R,`${O} clearProperties()`,we.FRAGMENT),n.addFunctionLines(R,[`${O} ${z};`]);for(let F=0;F<c;F++){const H=i[F],v=o[F];r[F];const I=Mx(v);n.addFunctionLines(R,[`${z}.${H} = ${I}(0.0);`])}n.addFunctionLines(R,[`return ${z};`])}{const R="sumProperties";n.addFunction(R,`${O} sumProperties(${O} propertiesA, ${O} propertiesB)`,we.FRAGMENT),n.addFunctionLines(R,[`${O} ${z};`]);for(let F=0;F<c;F++){const H=i[F];n.addFunctionLines(R,[`${z}.${H} = propertiesA.${H} + propertiesB.${H};`])}n.addFunctionLines(R,[`return ${z};`])}{const R="scaleProperties";n.addFunction(R,`${O} scaleProperties(${O} ${z}, float scale)`,we.FRAGMENT),n.addFunctionLines(R,[`${O} scaledProperties = ${z};`]);for(let F=0;F<c;F++){const H=i[F];n.addFunctionLines(R,[`scaledProperties.${H} *= scale;`])}n.addFunctionLines(R,["return scaledProperties;"])}{const R="mixProperties";n.addFunction(R,`${O} mixProperties(${O} propertiesA, ${O} propertiesB, float mixFactor)`,we.FRAGMENT),n.addFunctionLines(R,[`${O} ${z};`]);for(let F=0;F<c;F++){const H=i[F];n.addFunctionLines(R,[`${z}.${H} = mix(propertiesA.${H}, propertiesB.${H}, mixFactor);`])}n.addFunctionLines(R,[`return ${z};`])}{const R="copyPropertiesToMetadata";n.addFunction(R,`void copyPropertiesToMetadata(in ${O} ${z}, inout ${p} ${y})`,we.FRAGMENT);for(let F=0;F<c;F++){const H=i[F];n.addFunctionLines(R,[`${y}.${H} = ${z}.${H};`])}}if(u){const R="setStatistics";n.addFunction(R,`void setStatistics(inout ${h} ${_})`,we.FRAGMENT);for(let F=0;F<c;F++){const H=i[F],v=o[F],I=It.getComponentCount(v);for(let m=0;m<I;m++){const D=Vot(v,m),L=s[F][m],M=a[F][m];n.addFunctionLines(R,[`${_}.${H}.min${D} = ${Z5(L)};`,`${_}.${H}.max${D} = ${Z5(M)};`])}}}{const R="getPropertiesFromMegatextureAtUv";n.addFunction(R,`${O} getPropertiesFromMegatextureAtUv(vec2 texcoord)`,we.FRAGMENT),n.addFunctionLines(R,[`${O} ${z};`]);for(let F=0;F<c;F++){const H=i[F],v=o[F];r[F];const I=Uot(v);n.addFunctionLines(R,[`properties.${H} = texture2D(u_megatextureTextures[${F}], texcoord)${I};`])}n.addFunctionLines(R,[`return ${z};`])}}function Mx(e){if(e===It.SCALAR)return"float";if(e===It.VEC2)return"vec2";if(e===It.VEC3)return"vec3";if(e===It.VEC4)return"vec4"}function Uot(e){if(e===It.SCALAR)return".r";if(e===It.VEC2)return".ra";if(e===It.VEC3)return".rgb";if(e===It.VEC4)return""}function Hot(e){if(e===It.SCALAR)return"vec3";if(e===It.VEC2)return"mat2";if(e===It.VEC3)return"mat3";if(e===It.VEC4)return"mat4"}function Z5(e){let t=e.toString();return t.indexOf(".")===-1&&(t=`${e}.0`),t}function Vot(e,t){return e===It.SCALAR?"":`[${t}]`}function kot(e,t){const n=new Fot(e);zot(n,e);const{shaderBuilder:i,clippingPlanes:o,clippingPlanesLength:r}=n;if(r>0){const p="getClippingPlane",y=qN(o,t),C=0,T=y.indexOf(")")+1,E=y.indexOf("{",T)+1,w=y.indexOf("}",E),S=y.slice(C,T),P=y.slice(E,w);i.addFunction(p,S,we.FRAGMENT),i.addFunctionLines(p,[P])}const s=i.clone();s.addDefine("PICKING",void 0,we.FRAGMENT);const a=i.buildShaderProgram(t),c=s.buildShaderProgram(t),u=Qe.fromCache({cull:{enabled:!0,face:Po.BACK},depthTest:{enabled:!1},depthMask:!1,blending:Ii.PRE_MULTIPLIED_ALPHA_BLEND}),f=t.getViewportQuadVertexArray(),h=e._depthTest,_=new dt({vertexArray:f,primitiveType:Je.TRIANGLES,renderState:u,shaderProgram:a,uniformMap:n.uniformMap,pass:Be.VOXELS,executeInClosestFrustum:!0,owner:this,cull:h,occlude:h}),g=dt.shallowClone(_,new dt);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=_,e._drawCommandPick=g}function Ad(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 O=i[P],z=It.getComponentCount(O),R=o[P];this.megatextures[P]=new Gd(t,n,z,R,s)}const c=this.megatextures[0].maximumTileCount;this._simultaneousRequestCount=0,this._debugPrint=!1,this._frameNumber=0;const u=e._shape,f=0,h=0,_=0,g=0,p=void 0;this.rootNode=new pl(f,h,_,g,p,u,n),this._priorityQueue=new eu({maximumLength:c,comparator:Ai.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,O,z,R){if(O>z)return;const F=Math.floor((O+z)/2);P[F]=R,y(P,O,F-1,R+1),y(P,F+1,z,R+1)}const C=this._binaryTreeKeyframeWeighting;C[0]=0,C[r-1]=0,y(C,1,r-2,0);const T=9,E=2048,w=Math.floor(E/T),S=Math.ceil(c/w);this.internalNodeTexture=new zt({context:t,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,flipY:!1,width:E,height:S,sampler:new Yn({minificationFilter:An.NEAREST,magnificationFilter:Hr.NEAREST})}),this.internalNodeTilesPerRow=w,this.internalNodeTexelSizeUv=new j(1/E,1/S),this.leafNodeTexture=void 0,this.leafNodeTilesPerRow=void 0,this.leafNodeTexelSizeUv=new j}Ad.simultaneousRequestCountMaximum=50;Ad.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,f=a>1,h=(u?2:1)*(f?2:1);this._sampleCount=h;const _=h>=2;if(_&&!l(this.leafNodeTexture)){const E=Math.floor(512),w=Math.ceil(s/E);this.leafNodeTexture=new zt({context:r,pixelFormat:nt.RGBA,pixelDatatype:Ke.UNSIGNED_BYTE,flipY:!1,width:1024,height:w,sampler:new Yn({minificationFilter:An.NEAREST,magnificationFilter:Hr.NEAREST})}),this.leafNodeTexelSizeUv=j.fromElements(1/1024,1/w,this.leafNodeTexelSizeUv),this.leafNodeTilesPerRow=E}else!_&&l(this.leafNodeTexture)&&(this.leafNodeTexture=this.leafNodeTexture.destroy());if(this._keyframeLocation=N.clamp(t,0,a-1),n&&Iee(this,this.rootNode),i)return;this._frameNumber=e.frameNumber;const g=er();jot(this,e);const p=er();$ot(this,h,c);const y=er();if(this._debugPrint){const C=p-g,T=y-p,E=y-g;Yot(this,C,T,E)}};Ad.prototype.isRenderable=function(e){return e.isRenderable(this._frameNumber)};Ad.prototype.isDestroyed=function(){return!1};Ad.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(),Ue(this)};function Iee(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];Iee(e,s)}}function Got(e,t){if(e._simultaneousRequestCount>=Ad.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 f(g){e._simultaneousRequestCount--;const p=n._provider.types.length;if(!l(g))t.state=Ai.LoadState.UNAVAILABLE;else if(g===Ai.LoadState.FAILED)t.state=Ai.LoadState.FAILED;else if(!Array.isArray(g)||g.length!==p)t.state=Ai.LoadState.FAILED;else{const y=e.megatextures;for(let C=0;C<p;C++){const{voxelCountPerTile:T,channelCount:E}=y[C],{x:w,y:S,z:P}=T,O=w*S*P,z=g[C],R=O*E;if(z.length===R)t.metadatas[C]=z,t.state=Ai.LoadState.RECEIVED;else{t.state=Ai.LoadState.FAILED;break}}}}function h(){e._simultaneousRequestCount--,t.state=Ai.LoadState.FAILED}const _=i.requestData({tileLevel:s,tileX:a,tileY:c,tileZ:u,keyframe:o});l(_)?(e._simultaneousRequestCount++,t.state=Ai.LoadState.RECEIVING,_.then(f).catch(h)):t.state=Ai.LoadState.FAILED}function Wot(e){return e/(1+e)}function jot(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,f=e.rootNode,h=t.camera.positionWC,_=t.camera.frustum.sseDenominator,p=t.context.drawingBufferHeight/t.pixelRatio/_;function y(R,F){if(R.computeScreenSpaceError(h,p),F=R.visibility(t,F),F===Ko.MASK_OUTSIDE)return;R.visitedFrameNumber=n;const H=N.clamp(Math.floor(c),0,u-2),v=H+1;if(u===1)R.createKeyframeNode(0);else if(R.keyframeNodes.length!==u)for(let M=0;M<u;M++)R.createKeyframeNode(M);const I=Wot(R.screenSpaceError);let m=!1;const D=R.keyframeNodes;for(let M=0;M<D.length;M++){const V=D[M],k=V.keyframe,W=Math.min(Math.abs(k-H),Math.abs(k-v)),G=Math.max(H,u-v-1,1),K=Math.pow(1-W/G,4),q=Math.exp(-e._binaryTreeKeyframeWeighting[k]);V.priority=10*I,V.priority+=N.lerp(q,K,.15+.85*K),V.state!==Ai.LoadState.UNAVAILABLE&&V.state!==Ai.LoadState.FAILED&&V.priority!==-Number.MAX_VALUE&&a.insert(V),V.state===Ai.LoadState.LOADED&&(m=!0)}if(R.screenSpaceError<s||!m){R.children=void 0;return}if(!l(R.children)){const M=qot(R),V=R.level+1;R.children=M.map(([k,W,G])=>new pl(V,k,W,G,R,o,r))}for(let M=0;M<8;M++){const V=R.children[M];y(V,F)}}a.reset(),y(f,Ko.MASK_INDETERMINATE);const C=e._highPriorityKeyframeNodes;let T=0,E;for(;a.length>0;)E=a.removeMaximum(),E.highPriorityFrameNumber=n,C[T]=E,T++;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 O=0,z=0;for(let R=0;R<T;R++)if(E=C[R],!(E.state===Ai.LoadState.LOADED||E.spatialNode===void 0)&&(E.state===Ai.LoadState.UNLOADED&&Got(e,E),E.state===Ai.LoadState.RECEIVED)){let F=0;if(S.isFull()){F=P-1-O,O++;const H=w[F];H.spatialNode.destroyKeyframeNode(H,e.megatextures)}else F=P+z,z++;E.spatialNode.addKeyframeNodeToMegatextures(E,e.megatextures),w[F]=E}}function qot(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 Yot(e,t,n,i){const o=e._keyframeCount,r=e.rootNode,s=Object.keys(Ai.LoadState).length,a=new Array(s),c=new Array(s);let u=0;for(let T=0;T<s;T++){const E=new Array(o);a[T]=E;for(let w=0;w<o;w++)E[w]=0;c[T]=0}function f(T){const E=T.keyframeNodes;for(let w=0;w<E.length;w++){const S=E[w],P=S.keyframe,O=S.state;a[O][P]+=1,c[O]+=1,u++}if(l(T.children))for(let w=0;w<8;w++){const S=T.children[w];f(S)}}f(r);const h=`KEYFRAMES: ${a[Ai.LoadState.LOADED]}`,_=`UNLOADED: ${c[Ai.LoadState.UNLOADED]} | RECEIVING: ${c[Ai.LoadState.RECEIVING]} | RECEIVED: ${c[Ai.LoadState.RECEIVED]} | LOADED: ${c[Ai.LoadState.LOADED]} | FAILED: ${c[Ai.LoadState.FAILED]} | UNAVAILABLE: ${c[Ai.LoadState.UNAVAILABLE]} | TOTAL: ${u}`,g=Math.round(t*100)/100,p=Math.round(n*100)/100,y=Math.round(i*100)/100,C=`LOAD: ${g} | OCT: ${p} | ALL: ${y}`;console.log(`${h} || ${_} || ${C}`)}const Fx={INTERNAL:0,LEAF:1,PACKED_LEAF_FROM_PARENT:2};function $ot(e,t,n){const i=e._primitive._screenSpaceError,o=e._keyframeLocation,r=e._frameNumber,s=t>=2;let a=0,c=0;const u=[],f=[];function h(g,p,y,C,T){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[T]=Fx.INTERNAL<<16|p,u[y]=C,a++,C=p,T=C*9+1;for(let w=0;w<8;w++){const S=g.children[w];p=a,y=p*9+0,h(S,p,y,C,T+w)}}else{if(s){const w=c*5,S=g.renderableKeyframeNodePrevious,P=g.level-S.spatialNode.level,O=S.spatialNode.parent,z=l(O)?O.renderableKeyframeNodePrevious:S,R=Xot(g,i,n),F=P,H=1,v=S.megatextureIndex,I=z.megatextureIndex;f[w+0]=R,f[w+1]=F,f[w+2]=H,f[w+3]=v,f[w+4]=I,u[T]=Fx.LEAF<<16|c}else{const w=g.renderableKeyframeNodePrevious,P=g.level-w.spatialNode.level===0?Fx.LEAF:Fx.PACKED_LEAF_FROM_PARENT;u[T]=P<<16|w.megatextureIndex}c++}}const _=e.rootNode;_.computeSurroundingRenderableKeyframeNodes(o),_.isRenderable(r)&&h(_,0,0,0,0),Kot(u,9,e.internalNodeTilesPerRow,e.internalNodeTexture),s&&Jot(f,2,e.leafNodeTilesPerRow,e.leafNodeTexture)}function Xot(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 N.clamp(s,0,1)}function Kot(e,t,n,i){const o=nt.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 _=e[h],g=h*o;for(let p=0;p<o;p++)c[g+p]=_>>>p*8&255}const f={source:{arrayBufferView:c,width:s,height:a},xOffset:0,yOffset:0};i.copyFrom(f)}function Jot(e,t,n,i){const o=nt.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 _=0;_<s;_++){const g=e[_*r+0],p=e[_*r+1],y=e[_*r+2],C=e[_*r+3],T=e[_*r+4],E=N.clamp(Math.floor(65536*g),0,65535);u[_*8+0]=E>>>0&255,u[_*8+1]=E>>>8&255,u[_*8+2]=p&255,u[_*8+3]=y&255,u[_*8+4]=C>>>0&255,u[_*8+5]=C>>>8&255,u[_*8+6]=T>>>0&255,u[_*8+7]=T>>>8&255}const h={source:{arrayBufferView:u,width:a,height:c},xOffset:0,yOffset:0};i.copyFrom(h)}Ad.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=It.getComponentCount(a);o+=Gd.getApproximateTextureMemoryByteLength(e,t,u,c)}return o};const Qot={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"},lR=Object.freeze(Qot);function T0(){this._defaultTexture=void 0,this._textures={},this._loadedImages=[],this._lastUpdatedFrame=-1}T0.prototype.getTexture=function(e){return this._textures[e]};function Zot(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})}T0.prototype.loadTexture2D=function(e,t){l(t.typedArray)?this._loadedImages.push({id:e,textureUniform:t}):Zot(this,e,t)};function ert(e,t,n){const{id:i,textureUniform:o,image:r}=t,s=n.webgl2?Bw(o,r,n):trt(o,r,n),a=e._textures[i];l(a)&&a!==n.defaultTexture&&a.destroy(),e._textures[i]=s}function Bw(e,t,n){const{typedArray:i,sampler:o}=e,r=l(i)?Oee(e,n):new zt({context:n,source:t,sampler:o});return Pee(o)&&r.generateMipmap(),r}function trt(e,t,n){const{typedArray:i,sampler:o}=e,r=Pee(o),s=o.wrapS===Ei.REPEAT||o.wrapS===Ei.MIRRORED_REPEAT||o.wrapT===Ei.REPEAT||o.wrapT===Ei.MIRRORED_REPEAT,{width:a,height:c}=l(i)?e:t,u=[a,c].every(N.isPowerOfTwo);if((r||s)&&!u)if(l(i)){if(e.pixelDatatype===Ke.UNSIGNED_BYTE){const h=$nt(i,a,c),_=SB(h);return Bw({sampler:o},_,n)}}else{const h=SB(t);return Bw(e,h,n)}else return Bw(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."),Oee(e,n)}function Pee(e){return[An.NEAREST_MIPMAP_NEAREST,An.NEAREST_MIPMAP_LINEAR,An.LINEAR_MIPMAP_NEAREST,An.LINEAR_MIPMAP_LINEAR].includes(e.minificationFilter)}function Oee(e,t){const{pixelFormat:n,pixelDatatype:i,width:o,height:r,typedArray:s,sampler:a}=e;return new zt({context:t,pixelFormat:n,pixelDatatype:i,source:{arrayBufferView:s,width:o,height:r},sampler:a,flipY:!1})}T0.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];ert(this,o,t)}n.length=0};T0.prototype.isDestroyed=function(){return!1};T0.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 Ue(this)};function gb(e){e=A(e,A.EMPTY_OBJECT),this.mode=A(e.mode,nF.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,NB.INHERIT),this._textureManager=new T0,this._defaultTexture=void 0,this.uniformMap=nrt(this),this.usedVariablesVertex={attributeSet:{},featureIdSet:{},metadataSet:{}},this.usedVariablesFragment={attributeSet:{},featureIdSet:{},metadataSet:{},materialSet:{}},rrt(this),srt(this)}function nrt(e){const t=e.uniforms,n={};for(const i in t)if(t.hasOwnProperty(i)){const o=t[i],r=o.type;if(r===lR.SAMPLER_CUBE)throw new x("CustomShader does not support samplerCube uniforms");r===lR.SAMPLER_2D?(e._textureManager.loadTexture2D(i,o.value),n[i]=irt(e,i)):n[i]=ort(e,i)}return n}function irt(e,t){return function(){return A(e._textureManager.getTexture(t),e._defaultTexture)}}function ort(e,t){return function(){return e.uniforms[t].value}}function hm(e,t,n){let i;for(;(i=t.exec(e))!==null;){const o=i[1];n[o]=!0}}function rrt(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,hm(r,t,o),o=e.usedVariablesVertex.featureIdSet,hm(r,n,o),o=e.usedVariablesVertex.metadataSet,hm(r,i,o));const s=e.fragmentShaderText;if(l(s)){o=e.usedVariablesFragment.attributeSet,hm(s,t,o),o=e.usedVariablesFragment.featureIdSet,hm(s,n,o),o=e.usedVariablesFragment.metadataSet,hm(s,i,o);const a=/material\.(\w+)/g,c=e.usedVariablesFragment.materialSet;hm(s,a,c)}}function e8(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 Ls(e,t,n,i){if(e.hasOwnProperty(t)){const o=`${e8(t)} is not available in the ${i} shader. Did you mean ${e8(n)} instead?`;throw new x(o)}}function srt(e){const t=e.usedVariablesVertex.attributeSet;Ls(t,"position","positionMC","vertex"),Ls(t,"normal","normalMC","vertex"),Ls(t,"tangent","tangentMC","vertex"),Ls(t,"bitangent","bitangentMC","vertex"),Ls(t,"positionWC","positionMC","vertex"),Ls(t,"positionEC","positionMC","vertex"),Ls(t,"normalEC","normalMC","vertex"),Ls(t,"tangentEC","tangentMC","vertex"),Ls(t,"bitangentEC","bitangentMC","vertex");const n=e.usedVariablesFragment.attributeSet;Ls(n,"position","positionEC","fragment"),Ls(n,"normal","normalEC","fragment"),Ls(n,"tangent","tangentEC","fragment"),Ls(n,"bitangent","bitangentEC","fragment"),Ls(n,"normalMC","normalEC","fragment"),Ls(n,"tangentMC","tangentEC","fragment"),Ls(n,"bitangentMC","bitangentEC","fragment")}gb.prototype.setUniform=function(e,t){if(b.typeOf.string("uniformName",e),b.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===lR.SAMPLER_2D?this._textureManager.loadTexture2D(e,t):l(t.clone)?n.value=t.clone(n.value):n.value=t};gb.prototype.update=function(e){this._defaultTexture=e.context.defaultTexture,this._textureManager.update(e)};gb.prototype.isDestroyed=function(){return!1};gb.prototype.destroy=function(){this._textureManager=this._textureManager&&this._textureManager.destroy(),Ue(this)};function tu(e){e=A(e,A.EMPTY_OBJECT),this._ready=!1,this._provider=A(e.provider,tu.DefaultProvider),this._traversal=void 0,this._shape=void 0,this._shapeVisible=!1,this._paddingBefore=new d,this._paddingAfter=new d,this._minBounds=new d,this._minBoundsOld=new d,this._maxBounds=new d,this._maxBoundsOld=new d,this._minClippingBounds=new d,this._minClippingBoundsOld=new d,this._maxClippingBounds=new d,this._maxClippingBoundsOld=new d,this._clippingPlanes=void 0,this._clippingPlanesState=0,this._clippingPlanesEnabled=!1,this._modelMatrix=B.clone(A(e.modelMatrix,B.IDENTITY)),this._compoundModelMatrix=new B,this._compoundModelMatrixOld=new B,this._customShader=A(e.customShader,tu.DefaultCustomShader),this._customShaderCompilationEvent=new $e,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 Ha,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 d,paddingBefore:new d,paddingAfter:new d,transformPositionViewToUv:new B,transformPositionUvToView:new B,transformDirectionViewToLocal:new J,transformNormalLocalToWorld:new J,cameraPositionUv:new d,ndcSpaceAxisAlignedBoundingBox:new oe,clippingPlanesTexture:void 0,clippingPlanesMatrix:new B,stepSize:0,pickColor:new U},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=art(this,i)}function art(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(tu.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){b.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){b.typeOf.bool("show",e),this._disableRender=!e}},disableUpdate:{get:function(){return this._disableUpdate},set:function(e){b.typeOf.bool("disableUpdate",e),this._disableUpdate=e}},debugDraw:{get:function(){return this._debugDraw},set:function(e){b.typeOf.bool("debugDraw",e),this._debugDraw=e}},depthTest:{get:function(){return this._depthTest},set:function(e){b.typeOf.bool("depthTest",e),this._depthTest!==e&&(this._depthTest=e,this._shaderDirty=!0)}},jitter:{get:function(){return this._jitter},set:function(e){b.typeOf.bool("jitter",e),this._jitter!==e&&(this._jitter=e,this._shaderDirty=!0)}},nearestSampling:{get:function(){return this._nearestSampling},set:function(e){b.typeOf.bool("nearestSampling",e),this._nearestSampling!==e&&(this._nearestSampling=e,this._shaderDirty=!0)}},levelBlendFactor:{get:function(){return this._levelBlendFactor},set:function(e){b.typeOf.number("levelBlendFactor",e),this._levelBlendFactor=N.clamp(e,0,1)}},screenSpaceError:{get:function(){return this._screenSpaceError},set:function(e){b.typeOf.number("screenSpaceError",e),this._screenSpaceError=e}},stepSize:{get:function(){return this._stepSizeMultiplier},set:function(e){b.typeOf.number("stepSize",e),this._stepSizeMultiplier=e}},minBounds:{get:function(){return this._minBounds},set:function(e){b.defined("minBounds",e),this._minBounds=d.clone(e,this._minBounds)}},maxBounds:{get:function(){return this._maxBounds},set:function(e){b.defined("maxBounds",e),this._maxBounds=d.clone(e,this._maxBounds)}},minClippingBounds:{get:function(){return this._minClippingBounds},set:function(e){b.defined("minClippingBounds",e),this._minClippingBounds=d.clone(e,this._minClippingBounds)}},maxClippingBounds:{get:function(){return this._maxClippingBounds},set:function(e){b.defined("maxClippingBounds",e),this._maxClippingBounds=d.clone(e,this._maxClippingBounds)}},clippingPlanes:{get:function(){return this._clippingPlanes},set:function(e){Ao.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=tu.DefaultCustomShader,this._shaderDirty=!0}}},customShaderCompilationEvent:{get:function(){return this._customShaderCompilationEvent}}});const crt=new d,lrt=new oe,urt=new oe,frt=new d,drt=new d,hrt=new J,prt=new J,mrt=new B,_rt=new B,grt=new B,yrt=B.fromRotationTranslation(J.fromUniformScale(.5,new J),new d(.5,.5,.5),new B),Art=B.fromRotationTranslation(J.fromUniformScale(2,new J),new d(-1,-1,-1),new B);tu.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){Crt(this,t,n),this._completeLoad(this,e);return}const i=Lee(this,t),o=this._shape;if(i&&(this._shapeVisible=Bee(this,o,t),Ert(this,o)&&(this._shaderDirty=!0)),!this._shapeVisible)return;const r=xrt(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&&Lrt(this,e),this._disableRender))return;this._useLogDepth!==e.useLogDepth&&(this._useLogDepth=e.useLogDepth,this._shaderDirty=!0),wrt(this,e)&&(this._shaderDirty=!0);const u=s.leafNodeTexture,f=this._uniforms;l(u)&&(f.octreeLeafNodeTexture=s.leafNodeTexture,f.octreeLeafNodeTexelSizeUv=j.clone(s.leafNodeTexelSizeUv,f.octreeLeafNodeTexelSizeUv),f.octreeLeafNodeTilesPerRow=s.leafNodeTilesPerRow),this._shaderDirty&&(kot(this,n),this._shaderDirty=!1);const h=n.uniformState.viewProjection,_=o.orientedBoundingBox,g=Drt(_,h,urt);if(g.x===1||g.y===1||g.z===-1||g.w===-1)return;f.ndcSpaceAxisAlignedBoundingBox=oe.clone(g,f.ndcSpaceAxisAlignedBoundingBox);const y=n.uniformState.inverseView;f.transformPositionViewToUv=B.multiply(this._transformPositionWorldToUv,y,f.transformPositionViewToUv);const C=n.uniformState.view;f.transformPositionUvToView=B.multiply(C,this._transformPositionUvToWorld,f.transformPositionUvToView);const T=n.uniformState.inverseViewRotation;f.transformDirectionViewToLocal=J.multiply(this._transformDirectionWorldToLocal,T,f.transformDirectionViewToLocal),f.transformNormalLocalToWorld=J.clone(this._transformNormalLocalToWorld,f.transformNormalLocalToWorld);const E=e.camera.positionWC;f.cameraPositionUv=B.multiplyByPoint(this._transformPositionWorldToUv,E,f.cameraPositionUv),f.stepSize=this._stepSizeUv*this._stepSizeMultiplier;const w=e.passes.pick?this._drawCommandPick:this._drawCommand;w.boundingVolume=o.boundingSphere,e.commandList.push(w)};function Crt(e,t,n){const i=e._uniforms;e._pickId=n.createPickId({primitive:e}),i.pickColor=U.clone(e._pickId.color,i.pickColor);const{shape:o,minBounds:r=Wg.getMinBounds(o),maxBounds:s=Wg.getMaxBounds(o)}=t;e.minBounds=r,e.maxBounds=s,e.minClippingBounds=Wg.getMinBounds(o),e.maxClippingBounds=Wg.getMaxBounds(o),Lee(e,t);const a=Wg.getShapeConstructor(o);e._shape=new a,e._shapeVisible=Bee(e,e._shape,t);const{shaderDefines:c,shaderUniforms:u}=e._shape;e._shapeDefinesOld=ut(c,!0);const f=e._uniformMap;for(const h in u)if(u.hasOwnProperty(h)){const _=`u_${h}`;l(f[_])&&Di(`VoxelPrimitive: Uniform name "${_}" is already defined`),f[_]=function(){return u[h]}}i.dimensions=d.clone(t.dimensions,i.dimensions),e._paddingBefore=d.clone(A(t.paddingBefore,d.ZERO),e._paddingBefore),i.paddingBefore=d.clone(e._paddingBefore,i.paddingBefore),e._paddingAfter=d.clone(A(t.paddingAfter,d.ZERO),e._paddingBefore),i.paddingAfter=d.clone(e._paddingAfter,i.paddingAfter),e._traversal=Trt(e,t,n),brt(e._traversal,i)}function Lee(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),SA(e,"_compoundModelMatrix","_compoundModelMatrixOld")+SA(e,"_minBounds","_minBoundsOld")+SA(e,"_maxBounds","_maxBoundsOld")+SA(e,"_minClippingBounds","_minClippingBoundsOld")+SA(e,"_maxClippingBounds","_maxClippingBoundsOld")>0}function SA(e,t,n){const i=e[t],o=e[n],r=!i.equals(o);return r&&i.clone(o),r?1:0}function Bee(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,mrt),s=B.getRotation(o,hrt),a=B.getScale(o,frt),c=d.maximumComponent(a),u=d.divideByScalar(a,c,drt),f=J.multiplyByScale(s,u,prt),h=n.dimensions;return e._stepSizeUv=t.computeApproximateStepSize(h),e._transformPositionWorldToUv=B.multiply(yrt,r,e._transformPositionWorldToUv),e._transformPositionUvToWorld=B.multiply(o,Art,e._transformPositionUvToWorld),e._transformDirectionWorldToLocal=B.getMatrix3(r,e._transformDirectionWorldToLocal),e._transformNormalLocalToWorld=J.inverseTranspose(f,e._transformNormalLocalToWorld),!0}function Trt(e,t,n){const i=d.clone(t.dimensions,crt);d.add(i,e._paddingBefore,i),d.add(i,e._paddingAfter,i);const o=t.maximumTileCount,r=l(o)?Ad.getApproximateTextureMemoryByteLength(o,i,t.types,t.componentTypes):void 0,s=A(t.keyframeCount,1);return new Ad(e,n,i,t.types,t.componentTypes,s,r)}function brt(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 Ert(e,t){const n=t.shaderDefines,i=Object.keys(n).some(o=>n[o]!==e._shapeDefinesOld[o]);return i&&(e._shapeDefinesOld=ut(n,!0)),i}function xrt(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=ne.secondsDifference(i.stop,i.start),a=ne.secondsDifference(n,i.start)/r;return o+a}function wrt(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)}tu.prototype.isDestroyed=function(){return!1};tu.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(),Ue(this)};const t8=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)),Srt=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),vrt=new Array(new oe,new oe,new oe,new oe,new oe,new oe,new oe,new oe);function Drt(e,t,n){const i=B.fromRotationTranslation(e.halfAxes,e.center,_rt),o=B.multiply(t,i,grt);let r=+Number.MAX_VALUE,s=-Number.MAX_VALUE,a=+Number.MAX_VALUE,c=-Number.MAX_VALUE,u;const f=vrt,h=t8.length;for(u=0;u<h;u++)B.multiplyByVector(o,t8[u],f[u]);for(u=0;u<h;u++){const _=f[u];if(_.z>=-_.w){const g=_.x/_.w,p=_.y/_.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=Srt[u*3+g],y=f[p];if(y.z>=-y.w){const C=_.z+_.w,T=y.z+y.w,E=C/(C-T),w=oe.lerp(_,y,E,lrt),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=N.clamp(r,-1,1),a=N.clamp(a,-1,1),s=N.clamp(s,-1,1),c=N.clamp(c,-1,1),n=oe.fromElements(r,a,s,c,n),n}const VF=3e7,Irt=new d(VF,0,0),Prt=new d(0,VF,0),Ort=new d(0,0,VF);function Lrt(e,t){const n=e._traversal,i=e._debugPolylines;i.removeAll();function o(c,u,f,h){i.add({positions:[c,u],width:h,material:Fe.fromType("Color",{color:f})})}function r(c,u,f){const h=c.computeCorners();o(h[0],h[1],u,f),o(h[2],h[3],u,f),o(h[4],h[5],u,f),o(h[6],h[7],u,f),o(h[0],h[2],u,f),o(h[4],h[6],u,f),o(h[1],h[3],u,f),o(h[5],h[7],u,f),o(h[0],h[4],u,f),o(h[2],h[6],u,f),o(h[1],h[5],u,f),o(h[3],h[7],u,f)}function s(c){if(!n.isRenderable(c))return;const u=c.level,h=Math.max(1,5/Math.pow(2,u)),g=[U.RED,U.LIME,U.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,U.WHITE,5),s(n.rootNode);const a=10;o(d.ZERO,Irt,U.RED,a),o(d.ZERO,Prt,U.LIME,a),o(d.ZERO,Ort,U.BLUE,a),i.update(t)}tu.DefaultCustomShader=new gb({fragmentShaderText:`void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
material.diffuse = vec3(1.0);
material.alpha = 1.0;
}`});function Ree(){this.ready=!0,this.readyPromise=Promise.resolve(this),this.shape=Wg.BOX,this.dimensions=new d(1,1,1),this.names=["data"],this.types=[It.SCALAR],this.componentTypes=[Vt.FLOAT32],this.maximumTileCount=1}Ree.prototype.requestData=function(e){if(!((l(e)?A(e.tileLevel,0):0)>=1))return Promise.resolve([new Float32Array(1)])};tu.DefaultProvider=new Ree;function yD(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=[_e.center(e),_e.southeast(e),_e.southwest(e),_e.northeast(e),_e.northwest(e)];return yD._sampleTerrainMostDetailed(n,c).then(function(u){const f=u.reduce(function(_,g){return Math.max(g.height,_)},-Number.MAX_VALUE),h=r;return h.height+=f,h})}):Promise.resolve(r)}yD._sampleTerrainMostDetailed=_D;var $A;typeof ko<"u"&&($A=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(v,I){return v===null||typeof v in y?v===I:!1}function u(v,I){var m;return function(){m||(m=p.a.setTimeout(function(){m=e,v()},I))}}function f(v,I){var m;return function(){clearTimeout(m),m=p.a.setTimeout(v,I)}}function h(v,I){I&&I!=="change"?I==="beforeChange"?this.pc(v):this.gb(v,I):this.qc(v)}function _(v,I){I!==null&&I.s&&I.s()}function g(v,I){var m=this.qd,D=m[S];D.ra||(this.Qb&&this.mb[I]?(m.uc(I,v,this.mb[I]),this.mb[I]=null,--this.Qb):D.I[I]||m.uc(I,v,D.J?{da:v}:m.$c(v)),v.Ja&&v.gd())}var p=typeof s<"u"?s:{};p.b=function(v,I){for(var m=v.split("."),D=p,L=0;L<m.length-1;L++)D=D[m[L]];D[m[m.length-1]]=I},p.L=function(v,I,m){v[I]=m},p.version="3.5.1",p.b("version",p.version),p.options={deferUpdates:!1,useOnlyNativeEvents:!1,foreachHidesDestroyed:!1},p.a=function(){function v($,X){for(var Y in $)L.call($,Y)&&X(Y,$[Y])}function I($,X){if(X)for(var Y in X)L.call(X,Y)&&($[Y]=X[Y]);return $}function m($,X){return $.__proto__=X,$}function D($,X,Y,ae){var ue=$[X].match(q)||[];p.a.D(Y.match(q),function(re){p.a.Na(ue,re,ae)}),$[X]=ue.join(" ")}var L=Object.prototype.hasOwnProperty,M={__proto__:[]}instanceof Array,V=typeof Symbol=="function",k={},W={};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(" "),v(k,function($,X){if(X.length)for(var Y=0,ae=X.length;Y<ae;Y++)W[X[Y]]=$});var G={propertychange:!0},K=n&&function(){for(var $=3,X=n.createElement("div"),Y=X.getElementsByTagName("i");X.innerHTML="<!--[if gt IE "+ ++$+"]><i></i><![endif]-->",Y[0];);return 4<$?$:e}(),q=/\S+/g,te;return{Jc:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],D:function($,X,Y){for(var ae=0,ue=$.length;ae<ue;ae++)X.call(Y,$[ae],ae,$)},A:typeof Array.prototype.indexOf=="function"?function($,X){return Array.prototype.indexOf.call($,X)}:function($,X){for(var Y=0,ae=$.length;Y<ae;Y++)if($[Y]===X)return Y;return-1},Lb:function($,X,Y){for(var ae=0,ue=$.length;ae<ue;ae++)if(X.call(Y,$[ae],ae,$))return $[ae];return e},Pa:function($,X){var Y=p.a.A($,X);0<Y?$.splice(Y,1):Y===0&&$.shift()},wc:function($){var X=[];return $&&p.a.D($,function(Y){0>p.a.A(X,Y)&&X.push(Y)}),X},Mb:function($,X,Y){var ae=[];if($)for(var ue=0,re=$.length;ue<re;ue++)ae.push(X.call(Y,$[ue],ue));return ae},jb:function($,X,Y){var ae=[];if($)for(var ue=0,re=$.length;ue<re;ue++)X.call(Y,$[ue],ue)&&ae.push($[ue]);return ae},Nb:function($,X){if(X instanceof Array)$.push.apply($,X);else for(var Y=0,ae=X.length;Y<ae;Y++)$.push(X[Y]);return $},Na:function($,X,Y){var ae=p.a.A(p.a.bc($),X);0>ae?Y&&$.push(X):Y||$.splice(ae,1)},Ba:M,extend:I,setPrototypeOf:m,Ab:M?m:I,P:v,Ga:function($,X,Y){if(!$)return $;var ae={},ue;for(ue in $)L.call($,ue)&&(ae[ue]=X.call(Y,$[ue],ue,$));return ae},Tb:function($){for(;$.firstChild;)p.removeNode($.firstChild)},Yb:function($){$=p.a.la($);for(var X=($[0]&&$[0].ownerDocument||n).createElement("div"),Y=0,ae=$.length;Y<ae;Y++)X.appendChild(p.oa($[Y]));return X},Ca:function($,X){for(var Y=0,ae=$.length,ue=[];Y<ae;Y++){var re=$[Y].cloneNode(!0);ue.push(X?p.oa(re):re)}return ue},va:function($,X){if(p.a.Tb($),X)for(var Y=0,ae=X.length;Y<ae;Y++)$.appendChild(X[Y])},Xc:function($,X){var Y=$.nodeType?[$]:$;if(0<Y.length){for(var ae=Y[0],ue=ae.parentNode,re=0,he=X.length;re<he;re++)ue.insertBefore(X[re],ae);for(re=0,he=Y.length;re<he;re++)p.removeNode(Y[re])}},Ua:function($,X){if($.length){for(X=X.nodeType===8&&X.parentNode||X;$.length&&$[0].parentNode!==X;)$.splice(0,1);for(;1<$.length&&$[$.length-1].parentNode!==X;)$.length--;if(1<$.length){var Y=$[0],ae=$[$.length-1];for($.length=0;Y!==ae;)$.push(Y),Y=Y.nextSibling;$.push(ae)}}return $},Zc:function($,X){7>K?$.setAttribute("selected",X):$.selected=X},Db:function($){return $===null||$===e?"":$.trim?$.trim():$.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function($,X){return $=$||"",X.length>$.length?!1:$.substring(0,X.length)===X},vd:function($,X){if($===X)return!0;if($.nodeType===11)return!1;if(X.contains)return X.contains($.nodeType!==1?$.parentNode:$);if(X.compareDocumentPosition)return(X.compareDocumentPosition($)&16)==16;for(;$&&$!=X;)$=$.parentNode;return!!$},Sb:function($){return p.a.vd($,$.ownerDocument.documentElement)},kd:function($){return!!p.a.Lb($,p.a.Sb)},R:function($){return $&&$.tagName&&$.tagName.toLowerCase()},Ac:function($){return p.onError?function(){try{return $.apply(this,arguments)}catch(X){throw p.onError&&p.onError(X),X}}:$},setTimeout:function($,X){return setTimeout(p.a.Ac($),X)},Gc:function($){setTimeout(function(){throw p.onError&&p.onError($),$},0)},B:function($,X,Y){var ae=p.a.Ac(Y);if(Y=G[X],p.options.useOnlyNativeEvents||Y||!o)if(Y||typeof $.addEventListener!="function")if(typeof $.attachEvent<"u"){var ue=function(he){ae.call($,he)},re="on"+X;$.attachEvent(re,ue),p.a.K.za($,function(){$.detachEvent(re,ue)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else $.addEventListener(X,ae,!1);else te||(te=typeof o($).on=="function"?"on":"bind"),o($)[te](X,ae)},Fb:function($,X){if(!$||!$.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var Y;if(p.a.R($)==="input"&&$.type&&X.toLowerCase()=="click"?(Y=$.type,Y=Y=="checkbox"||Y=="radio"):Y=!1,p.options.useOnlyNativeEvents||!o||Y)if(typeof n.createEvent=="function")if(typeof $.dispatchEvent=="function")Y=n.createEvent(W[X]||"HTMLEvents"),Y.initEvent(X,!0,!0,t,0,0,0,0,0,!1,!1,!1,!1,0,$),$.dispatchEvent(Y);else throw Error("The supplied element doesn't support dispatchEvent");else if(Y&&$.click)$.click();else if(typeof $.fireEvent<"u")$.fireEvent("on"+X);else throw Error("Browser doesn't support triggering events");else o($).trigger(X)},f:function($){return p.O($)?$():$},bc:function($){return p.O($)?$.v():$},Eb:function($,X,Y){var ae;X&&(typeof $.classList=="object"?(ae=$.classList[Y?"add":"remove"],p.a.D(X.match(q),function(ue){ae.call($.classList,ue)})):typeof $.className.baseVal=="string"?D($.className,"baseVal",X,Y):D($,"className",X,Y))},Bb:function($,X){var Y=p.a.f(X);(Y===null||Y===e)&&(Y="");var ae=p.h.firstChild($);!ae||ae.nodeType!=3||p.h.nextSibling(ae)?p.h.va($,[$.ownerDocument.createTextNode(Y)]):ae.data=Y,p.a.Ad($)},Yc:function($,X){if($.name=X,7>=K)try{var Y=$.name.replace(/[&<>'"]/g,function(ae){return"&#"+ae.charCodeAt(0)+";"});$.mergeAttributes(n.createElement("<input name='"+Y+"'/>"),!1)}catch{}},Ad:function($){9<=K&&($=$.nodeType==1?$:$.parentNode,$.style&&($.style.zoom=$.style.zoom))},wd:function($){if(K){var X=$.style.width;$.style.width=0,$.style.width=X}},Pd:function($,X){$=p.a.f($),X=p.a.f(X);for(var Y=[],ae=$;ae<=X;ae++)Y.push(ae);return Y},la:function($){for(var X=[],Y=0,ae=$.length;Y<ae;Y++)X.push($[Y]);return X},Da:function($){return V?Symbol($):$},Zd:K===6,$d:K===7,W:K,Lc:function($,X){for(var Y=p.a.la($.getElementsByTagName("input")).concat(p.a.la($.getElementsByTagName("textarea"))),ae=typeof X=="string"?function(he){return he.name===X}:function(he){return X.test(he.name)},ue=[],re=Y.length-1;0<=re;re--)ae(Y[re])&&ue.push(Y[re]);return ue},Nd:function($){return typeof $=="string"&&($=p.a.Db($))?r&&r.parse?r.parse($):new Function("return "+$)():null},hc:function($,X,Y){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($),X,Y)},Od:function($,X,Y){Y=Y||{};var ae=Y.params||{},ue=Y.includeFields||this.Jc,re=$;if(typeof $=="object"&&p.a.R($)==="form")for(var re=$.action,he=ue.length-1;0<=he;he--)for(var ce=p.a.Lc($,ue[he]),Q=ce.length-1;0<=Q;Q--)ae[ce[Q].name]=ce[Q].value;X=p.a.f(X);var ie=n.createElement("form");ie.style.display="none",ie.action=re,ie.method="post";for(var de in X)$=n.createElement("input"),$.type="hidden",$.name=de,$.value=p.a.hc(p.a.f(X[de])),ie.appendChild($);v(ae,function(me,Ee){var xe=n.createElement("input");xe.type="hidden",xe.name=me,xe.value=Ee,ie.appendChild(xe)}),n.body.appendChild(ie),Y.submitter?Y.submitter(ie):ie.submit(),setTimeout(function(){ie.parentNode.removeChild(ie)},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(v){var I=this;if(arguments.length===1)return function(){return I.apply(v,arguments)};var m=Array.prototype.slice.call(arguments,1);return function(){var D=m.slice(0);return D.push.apply(D,arguments),I.apply(v,D)}}),p.a.g=new function(){var v=0,I="__ko__"+new Date().getTime(),m={},D,L;return p.a.W?(D=function(M,V){var k=M[I];if(!k||k==="null"||!m[k]){if(!V)return e;k=M[I]="ko"+v++,m[k]={}}return m[k]},L=function(M){var V=M[I];return V?(delete m[V],M[I]=null,!0):!1}):(D=function(M,V){var k=M[I];return!k&&V&&(k=M[I]={}),k},L=function(M){return M[I]?(delete M[I],!0):!1}),{get:function(M,V){var k=D(M,!1);return k&&k[V]},set:function(M,V,k){(M=D(M,k!==e))&&(M[V]=k)},Ub:function(M,V,k){return M=D(M,!0),M[V]||(M[V]=k)},clear:L,Z:function(){return v+++I}}},p.b("utils.domData",p.a.g),p.b("utils.domData.clear",p.a.g.clear),p.a.K=new function(){function v(V,k){var W=p.a.g.get(V,D);return W===e&&k&&(W=[],p.a.g.set(V,D,W)),W}function I(V){var k=v(V,!1);if(k)for(var k=k.slice(0),W=0;W<k.length;W++)k[W](V);p.a.g.clear(V),p.a.K.cleanExternalData(V),M[V.nodeType]&&m(V.childNodes,!0)}function m(V,k){for(var W=[],G,K=0;K<V.length;K++)if((!k||V[K].nodeType===8)&&(I(W[W.length]=G=V[K]),V[K]!==G))for(;K--&&p.a.A(W,V[K])==-1;);}var D=p.a.g.Z(),L={1:!0,8:!0,9:!0},M={1:!0,9:!0};return{za:function(V,k){if(typeof k!="function")throw Error("Callback must be a function");v(V,!0).push(k)},yb:function(V,k){var W=v(V,!1);W&&(p.a.Pa(W,k),W.length==0&&p.a.g.set(V,D,e))},oa:function(V){return p.u.G(function(){L[V.nodeType]&&(I(V),M[V.nodeType]&&m(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 v=[0,"",""],I=[1,"<table>","</table>"],m=[3,"<table><tbody><tr>","</tr></tbody></table>"],D=[1,"<select multiple='multiple'>","</select>"],L={thead:I,tbody:I,tfoot:I,tr:[2,"<table><tbody>","</tbody></table>"],td:m,th:m,option:D,optgroup:D},M=8>=p.a.W;p.a.ua=function(V,k){var W;if(o){if(o.parseHTML)W=o.parseHTML(V,k)||[];else if((W=o.clean([V],k))&&W[0]){for(var G=W[0];G.parentNode&&G.parentNode.nodeType!==11;)G=G.parentNode;G.parentNode&&G.parentNode.removeChild(G)}}else{(W=k)||(W=n);var G=W.parentWindow||W.defaultView||t,K=p.a.Db(V).toLowerCase(),q=W.createElement("div"),te;for(te=(K=K.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&L[K[1]]||v,K=te[0],te="ignored<div>"+te[1]+V+te[2]+"</div>",typeof G.innerShiv=="function"?q.appendChild(G.innerShiv(te)):(M&&W.body.appendChild(q),q.innerHTML=te,M&&q.parentNode.removeChild(q));K--;)q=q.lastChild;W=p.a.la(q.lastChild.childNodes)}return W},p.a.Md=function(V,k){var W=p.a.ua(V,k);return W.length&&W[0].parentElement||p.a.Yb(W)},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 W=p.a.ua(k,V.ownerDocument),G=0;G<W.length;G++)V.appendChild(W[G])}}(),p.b("utils.parseHtmlFragment",p.a.ua),p.b("utils.setHtml",p.a.fc),p.aa=function(){function v(m,D){if(m){if(m.nodeType==8){var L=p.aa.Uc(m.nodeValue);L!=null&&D.push({ud:m,Kd:L})}else if(m.nodeType==1)for(var L=0,M=m.childNodes,V=M.length;L<V;L++)v(M[L],D)}}var I={};return{Xb:function(m){if(typeof m!="function")throw Error("You can only pass a function to ko.memoization.memoize()");var D=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);return I[D]=m,"<!--[ko_memo:"+D+"]-->"},bd:function(m,D){var L=I[m];if(L===e)throw Error("Couldn't find any memo with ID "+m+". Perhaps it's already been unmemoized.");try{return L.apply(null,D||[]),!0}finally{delete I[m]}},cd:function(m,D){var L=[];v(m,L);for(var M=0,V=L.length;M<V;M++){var k=L[M].ud,W=[k];D&&p.a.Nb(W,D),p.aa.bd(L[M].Kd,W),k.nodeValue="",k.parentNode&&k.parentNode.removeChild(k)}},Uc:function(m){return(m=m.match(/^\[ko_memo\:(.*?)\]$/))?m[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 v(){if(L){for(var k=L,W=0,G;V<L;)if(G=D[V++]){if(V>k){if(5e3<=++W){V=L,p.a.Gc(Error("'Too much recursion' after processing "+W+" task groups."));break}k=L}try{G()}catch(K){p.a.Gc(K)}}}}function I(){v(),V=L=D.length=0}var m,D=[],L=0,M=1,V=0;return t.MutationObserver?m=function(k){var W=n.createElement("div");return new MutationObserver(k).observe(W,{attributes:!0}),function(){W.classList.toggle("foo")}}(I):m=n&&"onreadystatechange"in n.createElement("script")?function(k){var W=n.createElement("script");W.onreadystatechange=function(){W.onreadystatechange=null,n.documentElement.removeChild(W),W=null,k()},n.documentElement.appendChild(W)}:function(k){setTimeout(k,0)},{scheduler:m,zb:function(k){return L||p.na.scheduler(I),D[L++]=k,M++},cancel:function(k){k=k-(M-L),k>=V&&k<L&&(D[k]=null)},resetForTesting:function(){var k=L-V;return V=L=D.length=0,k},Sd:v}}(),p.b("tasks",p.na),p.b("tasks.schedule",p.na.zb),p.b("tasks.runEarly",p.na.Sd),p.Ta={throttle:function(v,I){v.throttleEvaluation=I;var m=null;return p.$({read:v,write:function(D){clearTimeout(m),m=p.a.setTimeout(function(){v(D)},I)}})},rateLimit:function(v,I){var m,D,L;typeof I=="number"?m=I:(m=I.timeout,D=I.method),v.Hb=!1,L=typeof D=="function"?D:D=="notifyWhenChangesStop"?f:u,v.ub(function(M){return L(M,m,I)})},deferred:function(v,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.");v.Hb||(v.Hb=!0,v.ub(function(m){var D,L=!1;return function(){if(!L){p.na.cancel(D),D=p.na.zb(m);try{L=!0,v.notifySubscribers(e,"dirty")}finally{L=!1}}}}))},notify:function(v,I){v.equalityComparer=I=="always"?null:c}};var y={undefined:1,boolean:1,number:1,string:1};p.b("extenders",p.Ta),p.ic=function(v,I,m){this.da=v,this.lc=I,this.mc=m,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(v){this.Jb=v,p.a.K.za(v,this.fb=this.s.bind(this))},p.T=function(){p.a.Ab(this,C),C.qb(this)};var C={qb:function(v){v.U={change:[]},v.sc=1},subscribe:function(v,I,m){var D=this;m=m||"change";var L=new p.ic(D,I?v.bind(I):v,function(){p.a.Pa(D.U[m],L),D.hb&&D.hb(m)});return D.Qa&&D.Qa(m),D.U[m]||(D.U[m]=[]),D.U[m].push(L),L},notifySubscribers:function(v,I){if(I=I||"change",I==="change"&&this.Gb(),this.Wa(I)){var m=I==="change"&&this.ed||this.U[I].slice(0);try{p.u.xc();for(var D=0,L;L=m[D];++D)L.Ib||L.lc(v)}finally{p.u.end()}}},ob:function(){return this.sc},Dd:function(v){return this.ob()!==v},Gb:function(){++this.sc},ub:function(v){var I=this,m=p.O(I),D,L,M,V,k;I.gb||(I.gb=I.notifySubscribers,I.notifySubscribers=h);var W=v(function(){I.Ja=!1,m&&V===I&&(V=I.nc?I.nc():I());var G=L||k&&I.sb(M,V);k=L=D=!1,G&&I.gb(M=V)});I.qc=function(G,K){K&&I.Ja||(k=!K),I.ed=I.U.change.slice(0),I.Ja=D=!0,V=G,W()},I.pc=function(G){D||(M=G,I.gb(G,"beforeChange"))},I.rc=function(){k=!0},I.gd=function(){I.sb(M,I.v(!0))&&(L=!0)}},Wa:function(v){return this.U[v]&&this.U[v].length},Bd:function(v){if(v)return this.U[v]&&this.U[v].length||0;var I=0;return p.a.P(this.U,function(m,D){m!=="dirty"&&(I+=D.length)}),I},sb:function(v,I){return!this.equalityComparer||!this.equalityComparer(v,I)},toString:function(){return"[object Object]"},extend:function(v){var I=this;return v&&p.a.P(v,function(m,D){var L=p.Ta[m];typeof L=="function"&&(I=L(I,D)||I)}),I}};p.L(C,"init",C.qb),p.L(C,"subscribe",C.subscribe),p.L(C,"extend",C.extend),p.L(C,"getSubscriptionsCount",C.Bd),p.a.Ba&&p.a.setPrototypeOf(C,Function.prototype),p.T.fn=C,p.Qc=function(v){return v!=null&&typeof v.subscribe=="function"&&typeof v.notifySubscribers=="function"},p.b("subscribable",p.T),p.b("isSubscribable",p.Qc),p.S=p.u=function(){function v(M){m.push(D),D=M}function I(){D=m.pop()}var m=[],D,L=0;return{xc:v,end:I,cc:function(M){if(D){if(!p.Qc(M))throw Error("Only subscribable things can act as dependencies");D.od.call(D.pd,M,M.fd||(M.fd=++L))}},G:function(M,V,k){try{return v(),M.apply(V,k||[])}finally{I()}},qa:function(){if(D)return D.o.qa()},Va:function(){if(D)return D.o.Va()},Ya:function(){if(D)return D.Ya},o:function(){if(D)return D.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 T=p.a.Da("_latestValue");p.ta=function(v){function I(){return 0<arguments.length?(I.sb(I[T],arguments[0])&&(I.ya(),I[T]=arguments[0],I.xa()),this):(p.u.cc(I),I[T])}return I[T]=v,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[T]},xa:function(){this.notifySubscribers(this[T],"spectate"),this.notifySubscribers(this[T])},ya:function(){this.notifySubscribers(this[T],"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(v){if((v=typeof v=="function"&&v[w])&&v!==E[w]&&v!==p.o.fn[w])throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");return!!v},p.Za=function(v){return typeof v=="function"&&(v[w]===E[w]||v[w]===p.o.fn[w]&&v.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(v){if(v=v||[],typeof v!="object"||!("length"in v))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");return v=p.ta(v),p.a.Ab(v,p.Ha.fn),v.extend({trackArrayChanges:!0})},p.Ha.fn={remove:function(v){for(var I=this.v(),m=[],D=typeof v!="function"||p.O(v)?function(V){return V===v}:v,L=0;L<I.length;L++){var M=I[L];if(D(M)){if(m.length===0&&this.ya(),I[L]!==M)throw Error("Array modified during remove; cannot remove item");m.push(M),I.splice(L,1),L--}}return m.length&&this.xa(),m},removeAll:function(v){if(v===e){var I=this.v(),m=I.slice(0);return this.ya(),I.splice(0,I.length),this.xa(),m}return v?this.remove(function(D){return 0<=p.a.A(v,D)}):[]},destroy:function(v){var I=this.v(),m=typeof v!="function"||p.O(v)?function(M){return M===v}:v;this.ya();for(var D=I.length-1;0<=D;D--){var L=I[D];m(L)&&(L._destroy=!0)}this.xa()},destroyAll:function(v){return v===e?this.destroy(function(){return!0}):v?this.destroy(function(I){return 0<=p.a.A(v,I)}):[]},indexOf:function(v){var I=this();return p.a.A(I,v)},replace:function(v,I){var m=this.indexOf(v);0<=m&&(this.ya(),this.v()[m]=I,this.xa())},sorted:function(v){var I=this().slice(0);return v?I.sort(v):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(v){p.Ha.fn[v]=function(){var I=this.v();this.ya(),this.zc(I,v,arguments);var m=I[v].apply(I,arguments);return this.xa(),m===I?this:m}}),p.a.D(["slice"],function(v){p.Ha.fn[v]=function(){var I=this();return I[v].apply(I,arguments)}}),p.Pc=function(v){return p.O(v)&&typeof v.remove=="function"&&typeof v.push=="function"},p.b("observableArray",p.Ha),p.b("isObservableArray",p.Pc),p.Ta.trackArrayChanges=function(v,I){function m(){function q(){if(k){var te=[].concat(v.v()||[]),$;v.Wa("arrayChange")&&((!L||1<k)&&(L=p.a.Pb(W,te,v.Ob)),$=L),W=te,L=null,k=0,$&&$.length&&v.notifySubscribers($,"arrayChange")}}D?q():(D=!0,V=v.subscribe(function(){++k},null,"spectate"),W=[].concat(v.v()||[]),L=null,M=v.subscribe(q))}if(v.Ob={},I&&typeof I=="object"&&p.a.extend(v.Ob,I),v.Ob.sparse=!0,!v.zc){var D=!1,L=null,M,V,k=0,W,G=v.Qa,K=v.hb;v.Qa=function(q){G&&G.call(v,q),q==="arrayChange"&&m()},v.hb=function(q){K&&K.call(v,q),q!=="arrayChange"||v.Wa("arrayChange")||(M&&M.s(),V&&V.s(),V=M=null,D=!1,W=e)},v.zc=function(q,te,$){function X(ie,de,me){return Y[Y.length]={status:ie,value:de,index:me}}if(D&&!k){var Y=[],ae=q.length,ue=$.length,re=0;switch(te){case"push":re=ae;case"unshift":for(te=0;te<ue;te++)X("added",$[te],re+te);break;case"pop":re=ae-1;case"shift":ae&&X("deleted",q[re],re);break;case"splice":te=Math.min(Math.max(0,0>$[0]?ae+$[0]:$[0]),ae);for(var ae=ue===1?ae:Math.min(te+($[1]||0),ae),ue=te+ue-2,re=Math.max(ae,ue),he=[],ce=[],Q=2;te<re;++te,++Q)te<ae&&ce.push(X("deleted",q[te],te)),te<ue&&he.push(X("added",$[Q],te));p.a.Kc(ce,he);break;default:return}L=Y}}}};var S=p.a.Da("_state");p.o=p.$=function(v,I,m){function D(){if(0<arguments.length){if(typeof L=="function")L.apply(M.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 M.ra||p.u.cc(D),(M.ka||M.J&&D.Xa())&&D.ha(),M.X}if(typeof v=="object"?m=v:(m=m||{},v&&(m.read=v)),typeof m.read!="function")throw Error("Pass a function that returns the value of the ko.computed");var L=m.write,M={X:e,sa:!0,ka:!0,rb:!1,jc:!1,ra:!1,wb:!1,J:!1,Wc:m.read,nb:I||m.owner,l:m.disposeWhenNodeIsRemoved||m.l||null,Sa:m.disposeWhen||m.Sa,Rb:null,I:{},V:0,Ic:null};return D[S]=M,D.Nc=typeof L=="function",p.a.Ba||p.a.extend(D,p.T.fn),p.T.fn.qb(D),p.a.Ab(D,P),m.pure?(M.wb=!0,M.J=!0,p.a.extend(D,O)):m.deferEvaluation&&p.a.extend(D,z),p.options.deferUpdates&&p.Ta.deferred(D,!0),M.l&&(M.jc=!0,M.l.nodeType||(M.l=null)),M.J||m.deferEvaluation||D.ha(),M.l&&D.ja()&&p.a.K.za(M.l,M.Rb=function(){D.s()}),D};var P={equalityComparer:c,qa:function(){return this[S].V},Va:function(){var v=[];return p.a.P(this[S].I,function(I,m){v[m.Ka]=m.da}),v},Vb:function(v){if(!this[S].V)return!1;var I=this.Va();return p.a.A(I,v)!==-1?!0:!!p.a.Lb(I,function(m){return m.Vb&&m.Vb(v)})},uc:function(v,I,m){if(this[S].wb&&I===this)throw Error("A 'pure' computed must not be called recursively");this[S].I[v]=m,m.Ka=this[S].V++,m.La=I.ob()},Xa:function(){var v,I,m=this[S].I;for(v in m)if(Object.prototype.hasOwnProperty.call(m,v)&&(I=m[v],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 v=this[S];return v.ka||0<v.V},Rd:function(){this.Ja?this[S].ka&&(this[S].sa=!0):this.Hc()},$c:function(v){if(v.Hb){var I=v.subscribe(this.Jd,this,"dirty"),m=v.subscribe(this.Rd,this);return{da:v,s:function(){I.s(),m.s()}}}return v.subscribe(this.Hc,this)},Hc:function(){var v=this,I=v.throttleEvaluation;I&&0<=I?(clearTimeout(this[S].Ic),this[S].Ic=p.a.setTimeout(function(){v.ha(!0)},I)):v.Ia?v.Ia(!0):v.ha(!0)},ha:function(v){var I=this[S],m=I.Sa,D=!1;if(!I.rb&&!I.ra){if(I.l&&!p.a.Sb(I.l)||m&&m()){if(!I.jc){this.s();return}}else I.jc=!1;I.rb=!0;try{D=this.zd(v)}finally{I.rb=!1}return D}},zd:function(v){var I=this[S],D=!1,m=I.wb?e:!I.V,D={qd:this,mb:I.I,Qb:I.V};p.u.xc({pd:D,od:g,o:this,Ya:m}),I.I={},I.V=0;var L=this.yd(I,D);return I.V?D=this.sb(I.X,L):(this.s(),D=!0),D&&(I.J?this.Gb():this.notifySubscribers(I.X,"beforeChange"),I.X=L,this.notifySubscribers(I.X,"spectate"),!I.J&&v&&this.notifySubscribers(I.X),this.rc&&this.rc()),m&&this.notifySubscribers(I.X,"awake"),D},yd:function(v,I){try{var m=v.Wc;return v.nb?m.call(v.nb):m()}finally{p.u.end(),I.Qb&&!v.J&&p.a.P(I.mb,_),v.sa=v.ka=!1}},v:function(v){var I=this[S];return(I.ka&&(v||!I.V)||I.J&&this.Xa())&&this.ha(),I.X},ub:function(v){p.T.fn.ub.call(this,v),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 v=this[S];!v.J&&v.I&&p.a.P(v.I,function(I,m){m.s&&m.s()}),v.l&&v.Rb&&p.a.K.yb(v.l,v.Rb),v.I=e,v.V=0,v.ra=!0,v.sa=!1,v.ka=!1,v.J=!1,v.l=e,v.Sa=e,v.Wc=e,this.Nc||(v.nb=e)}},O={Qa:function(v){var I=this,m=I[S];if(!m.ra&&m.J&&v=="change"){if(m.J=!1,m.sa||I.Xa())m.I=null,m.V=0,I.ha()&&I.Gb();else{var D=[];p.a.P(m.I,function(L,M){D[M.Ka]=L}),p.a.D(D,function(L,M){var V=m.I[L],k=I.$c(V.da);k.Ka=M,k.La=V.La,m.I[L]=k}),I.Xa()&&I.ha()&&I.Gb()}m.ra||I.notifySubscribers(m.X,"awake")}},hb:function(v){var I=this[S];I.ra||v!="change"||this.Wa("change")||(p.a.P(I.I,function(m,D){D.s&&(I.I[m]={da:D.da,Ka:D.Ka,La:D.La},D.s())}),I.J=!0,this.notifySubscribers(e,"asleep"))},ob:function(){var v=this[S];return v.J&&(v.sa||this.Xa())&&this.ha(),p.T.fn.ob.call(this)}},z={Qa:function(v){v!="change"&&v!="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(v){return typeof v=="function"&&v[R]===P[R]},p.Fd=function(v){return p.Oc(v)&&v[S]&&v[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(v,I){return typeof v=="function"?p.o(v,I,{pure:!0}):(v=p.a.extend({},v),v.pure=!0,p.o(v,I))},p.b("pureComputed",p.xb),function(){function v(D,L,M){if(M=M||new m,D=L(D),typeof D!="object"||D===null||D===e||D instanceof RegExp||D instanceof Date||D instanceof String||D instanceof Number||D instanceof Boolean)return D;var V=D instanceof Array?[]:{};return M.save(D,V),I(D,function(k){var W=L(D[k]);switch(typeof W){case"boolean":case"number":case"string":case"function":V[k]=W;break;case"object":case"undefined":var G=M.get(W);V[k]=G!==e?G:v(W,L,M)}}),V}function I(D,L){if(D instanceof Array){for(var M=0;M<D.length;M++)L(M);typeof D.toJSON=="function"&&L("toJSON")}else for(M in D)L(M)}function m(){this.keys=[],this.values=[]}p.ad=function(D){if(arguments.length==0)throw Error("When calling ko.toJS, pass the object you want to convert.");return v(D,function(L){for(var M=0;p.O(L)&&10>M;M++)L=L();return L})},p.toJSON=function(D,L,M){return D=p.ad(D),p.a.hc(D,L,M)},m.prototype={constructor:m,save:function(D,L){var M=p.a.A(this.keys,D);0<=M?this.values[M]=L:(this.keys.push(D),this.values.push(L))},get:function(D){return D=p.a.A(this.keys,D),0<=D?this.values[D]:e}}}(),p.b("toJS",p.ad),p.b("toJSON",p.toJSON),p.Wd=function(v,I,m){function D(L){var M=p.xb(v,m).extend({ma:"always"}),V=M.subscribe(function(k){k&&(V.s(),L(k))});return M.notifySubscribers(M.v()),V}return typeof Promise!="function"||I?D(I.bind(m)):new Promise(D)},p.b("when",p.Wd),function(){p.w={M:function(v){switch(p.a.R(v)){case"option":return v.__ko__hasDomDataOptionValue__===!0?p.a.g.get(v,p.c.options.$b):7>=p.a.W?v.getAttributeNode("value")&&v.getAttributeNode("value").specified?v.value:v.text:v.value;case"select":return 0<=v.selectedIndex?p.w.M(v.options[v.selectedIndex]):e;default:return v.value}},cb:function(v,I,m){switch(p.a.R(v)){case"option":typeof I=="string"?(p.a.g.set(v,p.c.options.$b,e),"__ko__hasDomDataOptionValue__"in v&&delete v.__ko__hasDomDataOptionValue__,v.value=I):(p.a.g.set(v,p.c.options.$b,I),v.__ko__hasDomDataOptionValue__=!0,v.value=typeof I=="number"?I:"");break;case"select":(I===""||I===null)&&(I=e);for(var D=-1,L=0,M=v.options.length,V;L<M;++L)if(V=p.w.M(v.options[L]),V==I||V===""&&I===e){D=L;break}(m||0<=D||I===e&&1<v.size)&&(v.selectedIndex=D,p.a.W===6&&p.a.setTimeout(function(){v.selectedIndex=D},0));break;default:(I===null||I===e)&&(I=""),v.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 v(k){k=p.a.Db(k),k.charCodeAt(0)===123&&(k=k.slice(1,-1)),k+=`
,`;var W=[],G=k.match(D),K,q=[],te=0;if(1<G.length){for(var $=0,X;X=G[$];++$){var Y=X.charCodeAt(0);if(Y===44){if(0>=te){W.push(K&&q.length?{key:K,value:q.join("")}:{unknown:K||q.join("")}),K=te=0,q=[];continue}}else if(Y===58){if(!te&&!K&&q.length===1){K=q.pop();continue}}else{if(Y===47&&1<X.length&&(X.charCodeAt(1)===47||X.charCodeAt(1)===42))continue;Y===47&&$&&1<X.length?(Y=G[$-1].match(L))&&!M[Y[0]]&&(k=k.substr(k.indexOf(X)+1),G=k.match(D),$=-1,X="/"):Y===40||Y===123||Y===91?++te:Y===41||Y===125||Y===93?--te:K||q.length||Y!==34&&Y!==39||(X=X.slice(1,-1))}q.push(X)}if(0<te)throw Error("Unbalanced parentheses, braces, or brackets")}return W}var I=["true","false","null","undefined"],m=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,D=RegExp(`"(?:\\\\.|[^"])*"|'(?:\\\\.|[^'])*'|\`(?:\\\\.|[^\`])*\`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*
|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,"'\`{}()/:[\\]]*[^\\s,"'\`{}()/:[\\]]|[^\\s]`,"g"),L=/[\])"'A-Za-z0-9_$]+$/,M={in:1,return:1,typeof:1},V={};return{Ra:[],wa:V,ac:v,vb:function(k,W){function G(Y,ae){var ue;if(!$){var re=p.getBindingHandler(Y);if(re&&re.preprocess&&!(ae=re.preprocess(ae,Y,G)))return;(re=V[Y])&&(ue=ae,0<=p.a.A(I,ue)?ue=!1:(re=ue.match(m),ue=re===null?!1:re[1]?"Object("+re[1]+")"+re[2]:ue),re=ue),re&&q.push("'"+(typeof V[Y]=="string"?V[Y]:Y)+"':function(_z){"+ue+"=_z}")}te&&(ae="function(){return "+ae+" }"),K.push("'"+Y+"':"+ae)}W=W||{};var K=[],q=[],te=W.valueAccessors,$=W.bindingParams,X=typeof k=="string"?v(k):k;return p.a.D(X,function(Y){G(Y.key||Y.unknown,Y.value)}),q.length&&G("_ko_property_writers","{"+q.join(",")+" }"),K.join(",")},Id:function(k,W){for(var G=0;G<k.length;G++)if(k[G].key==W)return!0;return!1},eb:function(k,W,G,K,q){k&&p.O(k)?!p.Za(k)||q&&k.v()===K||k(K):(k=W.get("_ko_property_writers"))&&k[G]&&k[G](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 v(G){return G.nodeType==8&&M.test(L?G.text:G.nodeValue)}function I(G){return G.nodeType==8&&V.test(L?G.text:G.nodeValue)}function m(G,K){for(var q=G,te=1,$=[];q=q.nextSibling;){if(I(q)&&(p.a.g.set(q,W,!0),te--,te===0))return $;$.push(q),v(q)&&te++}if(!K)throw Error("Cannot find closing comment tag to match: "+G.nodeValue);return null}function D(G,K){var q=m(G,K);return q?0<q.length?q[q.length-1].nextSibling:G.nextSibling:null}var L=n&&n.createComment("test").text==="<!--test-->",M=L?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,V=L?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,k={ul:!0,ol:!0},W="__ko_matchedEndComment__";p.h={ea:{},childNodes:function(G){return v(G)?m(G):G.childNodes},Ea:function(G){if(v(G)){G=p.h.childNodes(G);for(var K=0,q=G.length;K<q;K++)p.removeNode(G[K])}else p.a.Tb(G)},va:function(G,K){if(v(G)){p.h.Ea(G);for(var q=G.nextSibling,te=0,$=K.length;te<$;te++)q.parentNode.insertBefore(K[te],q)}else p.a.va(G,K)},Vc:function(G,K){var q;v(G)?(q=G.nextSibling,G=G.parentNode):q=G.firstChild,q?K!==q&&G.insertBefore(K,q):G.appendChild(K)},Wb:function(G,K,q){q?(q=q.nextSibling,v(G)&&(G=G.parentNode),q?K!==q&&G.insertBefore(K,q):G.appendChild(K)):p.h.Vc(G,K)},firstChild:function(G){if(v(G))return!G.nextSibling||I(G.nextSibling)?null:G.nextSibling;if(G.firstChild&&I(G.firstChild))throw Error("Found invalid end comment, as the first child of "+G);return G.firstChild},nextSibling:function(G){if(v(G)&&(G=D(G)),G.nextSibling&&I(G.nextSibling)){var K=G.nextSibling;if(I(K)&&!p.a.g.get(K,W))throw Error("Found end comment without a matching opening comment, as child of "+G);return null}return G.nextSibling},Cd:v,Vd:function(G){return(G=(L?G.text:G.nodeValue).match(M))?G[1]:null},Sc:function(G){if(k[p.a.R(G)]){var K=G.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(v(q)){var $=D(q,!0);$?q=$:te=[q]}else I(q)&&(te=[q]);while(q=q.nextSibling);if(q=te)for(te=K.nextSibling,$=0;$<q.length;$++)te?G.insertBefore(q[$],te):G.appendChild(q[$])}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(v){switch(v.nodeType){case 1:return v.getAttribute("data-bind")!=null||p.j.getComponentNameForNode(v);case 8:return p.h.Cd(v);default:return!1}},getBindings:function(v,I){var m=this.getBindingsString(v,I),m=m?this.parseBindingsString(m,I,v):null;return p.j.tc(m,v,I,!1)},getBindingAccessors:function(v,I){var m=this.getBindingsString(v,I),m=m?this.parseBindingsString(m,I,v,{valueAccessors:!0}):null;return p.j.tc(m,v,I,!0)},getBindingsString:function(v){switch(v.nodeType){case 1:return v.getAttribute("data-bind");case 8:return p.h.Vd(v);default:return null}},parseBindingsString:function(v,I,m,D){try{var L=this.nd,M=v+(D&&D.valueAccessors||""),V;if(!(V=L[M])){var k,W="with($context){with($data||{}){return{"+p.m.vb(v,D)+"}}}";k=new Function("$context","$element",W),V=L[M]=k}return V(I,m)}catch(G){throw G.message=`Unable to parse bindings.
Bindings value: `+v+`
Message: `+G.message,G}}}),p.ga.instance=new p.ga}(),p.b("bindingProvider",p.ga),function(){function v(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,v),ce&&ce.N&&(ce.N.kb.push(re),this.Kb=ce)}function m(re){return function(){return re}}function D(re){return re()}function L(re){return p.a.Ga(p.u.G(re),function(he,ce){return function(){return re()[ce]}})}function M(re,he,ce){return typeof re=="function"?L(re.bind(null,he,ce)):p.a.Ga(re,m)}function V(re,he){return L(this.getBindings.bind(this,re,he))}function k(re,he){var ce=p.h.firstChild(he);if(ce){var Q,ie=p.ga.instance,de=ie.preprocessNode;if(de){for(;Q=ce;)ce=p.h.nextSibling(Q),de.call(ie,Q);ce=p.h.firstChild(he)}for(;Q=ce;)ce=p.h.nextSibling(Q),W(re,Q)}p.i.ma(he,p.i.H)}function W(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&&!Y[p.a.R(he)]&&k(ce,he)}function G(re){var he=[],ce={},Q=[];return p.a.P(re,function ie(de){if(!ce[de]){var me=p.getBindingHandler(de);me&&(me.after&&(Q.push(de),p.a.D(me.after,function(Ee){if(re[Ee]){if(p.a.A(Q,Ee)!==-1)throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+Q.join(", "));ie(Ee)}}),Q.length--),he.push({key:de,Mc:me})),ce[de]=!0}}),he}function K(re,he,ce){var Q=p.a.g.Ub(re,ue,{}),ie=Q.hd;if(!he){if(ie)throw Error("You cannot apply bindings multiple times to the same element.");Q.hd=!0}ie||(Q.context=ce),Q.Zb||(Q.Zb={});var de;if(he&&typeof he!="function")de=he;else{var me=p.ga.instance,Ee=me.getBindingAccessors||V,xe=p.$(function(){return(de=he?he(ce,re):Ee.call(me,re,ce))&&(ce[te]&&ce[te](),ce[X]&&ce[X]()),de},null,{l:re});de&&xe.ja()||(xe=null)}var Pe=ce,Te;if(de){var Oe=function(){return p.a.Ga(xe?xe():de,D)},De=xe?function(Me){return function(){return D(xe()[Me])}}:function(Me){return de[Me]};Oe.get=function(Me){return de[Me]&&D(De(Me))},Oe.has=function(Me){return Me in de},p.i.H in de&&p.i.subscribe(re,p.i.H,function(){var Me=(0,de[p.i.H])();if(Me){var ve=p.h.childNodes(re);ve.length&&Me(ve,p.Ec(ve[0]))}}),p.i.pa in de&&(Pe=p.i.Cb(re,ce),p.i.subscribe(re,p.i.pa,function(){var Me=(0,de[p.i.pa])();Me&&p.h.firstChild(re)&&Me(re)})),Q=G(de),p.a.D(Q,function(Me){var ve=Me.Mc.init,Ie=Me.Mc.update,Ve=Me.key;if(re.nodeType===8&&!p.h.ea[Ve])throw Error("The binding '"+Ve+"' cannot be used with virtual elements");try{typeof ve=="function"&&p.u.G(function(){var Le=ve(re,De(Ve),Oe,Pe.$data,Pe);if(Le&&Le.controlsDescendantBindings){if(Te!==e)throw Error("Multiple bindings ("+Te+" and "+Ve+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");Te=Ve}}),typeof Ie=="function"&&p.$(function(){Ie(re,De(Ve),Oe,Pe.$data,Pe)},null,{l:re})}catch(Le){throw Le.message='Unable to process binding "'+Ve+": "+de[Ve]+`"
Message: `+Le.message,Le}})}return Q=Te===e,{shouldBindDescendants:Q,bindingContextForDescendants:Q&&Pe}}function q(re,he){return re&&re instanceof p.fa?re:new p.fa(re,e,e,he)}var te=p.a.Da("_subscribable"),$=p.a.Da("_ancestorBindingInfo"),X=p.a.Da("_dataDependency");p.c={};var Y={script:!0,textarea:!0,template:!0};p.getBindingHandler=function(re){return p.c[re]};var ae={};p.fa=function(re,he,ce,Q,ie){function de(){var De=Pe?xe():xe,Me=p.a.f(De);return he?(p.a.extend(me,he),$ in he&&(me[$]=he[$])):(me.$parents=[],me.$root=Me,me.ko=p),me[te]=Te,Ee?Me=me.$data:(me.$rawData=De,me.$data=Me),ce&&(me[ce]=Me),Q&&Q(me,he,Me),he&&he[te]&&!p.S.o().Vb(he[te])&&he[te](),Oe&&(me[X]=Oe),me.$data}var me=this,Ee=re===ae,xe=Ee?e:re,Pe=typeof xe=="function"&&!p.O(xe),Te,Oe=ie&&ie.dataDependency;ie&&ie.exportDependencies?de():(Te=p.xb(de),Te.v(),Te.ja()?Te.equalityComparer=null:me[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 ie=typeof re=="function"&&!p.O(re);return new p.fa(ae,this,null,function(de){ce&&ce(de),de[he]=ie?re():re},Q)}return new p.fa(re,this,he,function(de,me){de.$parentContext=me,de.$parent=me.$data,de.$parents=(me.$parents||[]).slice(0),de.$parents.unshift(de.$parent),ce&&ce(de)},Q)},p.fa.prototype.extend=function(re,he){return new p.fa(ae,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,v),p.i.ma(this.node,p.i.pa),this.Tc())},p.i={H:"childrenComplete",pa:"descendantsComplete",subscribe:function(re,he,ce,Q,ie){var de=p.a.g.Ub(re,ue,{});return de.Fa||(de.Fa=new p.T),ie&&ie.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[$])),he[$]==ce?he:he.extend(function(Q){Q[$]=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,M(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");W(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(v){function I(V,k){var W=Object.prototype.hasOwnProperty.call(L,V)?L[V]:v,G;W?W.subscribe(k):(W=L[V]=new p.T,W.subscribe(k),m(V,function(K,q){var te=!(!q||!q.synchronous);M[V]={definition:K,Gd:te},delete L[V],G||te?W.notifySubscribers(K):p.na.zb(function(){W.notifySubscribers(K)})}),G=!0)}function m(V,k){D("getConfig",[V],function(W){W?D("loadComponent",[V,W],function(G){k(G,W)}):k(null,null)})}function D(V,k,W,G){G||(G=p.j.loaders.slice(0));var K=G.shift();if(K){var q=K[V];if(q){var te=!1;if(q.apply(K,k.concat(function($){te?W(null):$!==null?W($):D(V,k,W,G)}))!==v&&(te=!0,!K.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.")}else D(V,k,W,G)}else W(null)}var L={},M={};p.j={get:function(V,k){var W=Object.prototype.hasOwnProperty.call(M,V)?M[V]:v;W?W.Gd?p.u.G(function(){k(W.definition)}):p.na.zb(function(){k(W.definition)}):I(V,k)},Bc:function(V){delete M[V]},oc:D},p.j.loaders=[],p.b("components",p.j),p.b("components.get",p.j.get),p.b("components.clearCachedDefinition",p.j.Bc)}(),function(){function v(W,G,K,q){function te(){--X===0&&q($)}var $={},X=2,Y=K.template;K=K.viewModel,Y?L(G,Y,function(ae){p.j.oc("loadTemplate",[W,ae],function(ue){$.template=ue,te()})}):te(),K?L(G,K,function(ae){p.j.oc("loadViewModel",[W,ae],function(ue){$[k]=ue,te()})}):te()}function I(W,G,K){if(typeof G=="function")K(function(te){return new G(te)});else if(typeof G[k]=="function")K(G[k]);else if("instance"in G){var q=G.instance;K(function(){return q})}else"viewModel"in G?I(W,G.viewModel,K):W("Unknown viewModel value: "+G)}function m(W){switch(p.a.R(W)){case"script":return p.a.ua(W.text);case"textarea":return p.a.ua(W.value);case"template":if(D(W.content))return p.a.Ca(W.content.childNodes)}return p.a.Ca(W.childNodes)}function D(W){return t.DocumentFragment?W instanceof DocumentFragment:W&&W.nodeType===11}function L(W,G,K){typeof G.require=="string"?a||t.require?(a||t.require)([G.require],function(q){q&&typeof q=="object"&&q.Xd&&q.default&&(q=q.default),K(q)}):W("Uses require, but no AMD loader is present"):K(G)}function M(W){return function(G){throw Error("Component '"+W+"': "+G)}}var V={};p.j.register=function(W,G){if(!G)throw Error("Invalid configuration for "+W);if(p.j.tb(W))throw Error("Component "+W+" is already registered");V[W]=G},p.j.tb=function(W){return Object.prototype.hasOwnProperty.call(V,W)},p.j.unregister=function(W){delete V[W],p.j.Bc(W)},p.j.Fc={getConfig:function(W,G){G(p.j.tb(W)?V[W]:null)},loadComponent:function(W,G,K){var q=M(W);L(q,G,function(te){v(W,q,te,K)})},loadTemplate:function(W,G,K){if(W=M(W),typeof G=="string")K(p.a.ua(G));else if(G instanceof Array)K(G);else if(D(G))K(p.a.la(G.childNodes));else if(G.element)if(G=G.element,t.HTMLElement?G instanceof HTMLElement:G&&G.tagName&&G.nodeType===1)K(m(G));else if(typeof G=="string"){var q=n.getElementById(G);q?K(m(q)):W("Cannot find element with ID "+G)}else W("Unknown element type: "+G);else W("Unknown template value: "+G)},loadViewModel:function(W,G,K){I(M(W),G,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 v(m,D){var L=m.getAttribute("params");if(L){var L=I.parseBindingsString(L,D,m,{valueAccessors:!0,bindingParams:!0}),L=p.a.Ga(L,function(k){return p.o(k,null,{l:m})}),M=p.a.Ga(L,function(k){var W=k.v();return k.ja()?p.o({read:function(){return p.a.f(k())},write:p.Za(W)&&function(G){k()(G)},l:m}):W});return Object.prototype.hasOwnProperty.call(M,"$raw")||(M.$raw=L),M}return{$raw:{}}}p.j.getComponentNameForNode=function(m){var D=p.a.R(m);if(p.j.tb(D)&&(D.indexOf("-")!=-1||""+m=="[object HTMLUnknownElement]"||8>=p.a.W&&m.tagName===D))return D},p.j.tc=function(m,D,L,M){if(D.nodeType===1){var V=p.j.getComponentNameForNode(D);if(V){if(m=m||{},m.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var k={name:V,params:v(D,L)};m.component=M?function(){return k}:k}}return m};var I=new p.ga;9>p.a.W&&(p.j.register=function(m){return function(D){return m.apply(this,arguments)}}(p.j.register),n.createDocumentFragment=function(m){return function(){var D=m();return p.j.dd,D}}(n.createDocumentFragment))}(),function(){function v(D,L,M){if(L=L.template,!L)throw Error("Component '"+D+"' has no template");D=p.a.Ca(L),p.h.va(M,D)}function I(D,L,M){var V=D.createViewModel;return V?V.call(D,L,M):L}var m=0;p.c.component={init:function(D,L,M,V,k){function W(){var $=G&&G.dispose;typeof $=="function"&&$.call(G),q&&q.s(),K=G=q=null}var G,K,q,te=p.a.la(p.h.childNodes(D));return p.h.Ea(D),p.a.K.za(D,W),p.o(function(){var $=p.a.f(L()),X,Y;if(typeof $=="string"?X=$:(X=p.a.f($.name),Y=p.a.f($.params)),!X)throw Error("No component name specified");var ae=p.i.Cb(D,k),ue=K=++m;p.j.get(X,function(re){if(K===ue){if(W(),!re)throw Error("Unknown component '"+X+"'");v(X,re,D);var he=I(re,Y,{element:D,templateNodes:te});re=ae.createChildContext(he,{extend:function(ce){ce.$component=he,ce.$componentTemplateNodes=te}}),he&&he.koDescendantsComplete&&(q=p.i.subscribe(D,p.i.pa,he.koDescendantsComplete,he)),G=he,p.Oa(re,D)}})},null,{l:D}),{controlsDescendantBindings:!0}}},p.h.ea.component=!0}();var F={class:"className",for:"htmlFor"};p.c.attr={update:function(v,I){var m=p.a.f(I())||{};p.a.P(m,function(D,L){L=p.a.f(L);var M=D.indexOf(":"),M="lookupNamespaceURI"in v&&0<M&&v.lookupNamespaceURI(D.substr(0,M)),V=L===!1||L===null||L===e;V?M?v.removeAttributeNS(M,D):v.removeAttribute(D):L=L.toString(),8>=p.a.W&&D in F?(D=F[D],V?v.removeAttribute(D):v[D]=L):V||(M?v.setAttributeNS(M,D,L):v.setAttribute(D,L)),D==="name"&&p.a.Yc(v,V?"":L)})}},function(){p.c.checked={after:["value","attr"],init:function(v,I,m){function D(){var $=v.checked,X=M();if(!p.S.Ya()&&($||!k&&!p.S.qa())){var Y=p.u.G(I);if(G){var ae=K?Y.v():Y,ue=te;te=X,ue!==X?$&&(p.a.Na(ae,X,!0),p.a.Na(ae,ue,!1)):p.a.Na(ae,X,$),K&&p.Za(Y)&&Y(ae)}else V&&(X===e?X=$:$||(X=e)),p.m.eb(Y,m,"checked",X,!0)}}function L(){var $=p.a.f(I()),X=M();G?(v.checked=0<=p.a.A($,X),te=X):v.checked=V&&X===e?!!$:M()===$}var M=p.xb(function(){if(m.has("checkedValue"))return p.a.f(m.get("checkedValue"));if(q)return m.has("value")?p.a.f(m.get("value")):v.value}),V=v.type=="checkbox",k=v.type=="radio";if(V||k){var W=I(),G=V&&p.a.f(W)instanceof Array,K=!(G&&W.push&&W.splice),q=k||G,te=G?M():e;k&&!v.name&&p.c.uniqueName.init(v,function(){return!0}),p.o(D,null,{l:v}),p.a.B(v,"click",D),p.o(L,null,{l:v}),W=e}}},p.m.wa.checked=!0,p.c.checkedValue={update:function(v,I){v.value=p.a.f(I())}}}(),p.c.class={update:function(v,I){var m=p.a.Db(p.a.f(I()));p.a.Eb(v,v.__ko__cssValue,!1),v.__ko__cssValue=m,p.a.Eb(v,m,!0)}},p.c.css={update:function(v,I){var m=p.a.f(I());m!==null&&typeof m=="object"?p.a.P(m,function(D,L){L=p.a.f(L),p.a.Eb(v,D,L)}):p.c.class.update(v,I)}},p.c.enable={update:function(v,I){var m=p.a.f(I());m&&v.disabled?v.removeAttribute("disabled"):m||v.disabled||(v.disabled=!0)}},p.c.disable={update:function(v,I){p.c.enable.update(v,function(){return!p.a.f(I())})}},p.c.event={init:function(v,I,m,D,L){var M=I()||{};p.a.P(M,function(V){typeof V=="string"&&p.a.B(v,V,function(k){var W,G=I()[V];if(G){try{var K=p.a.la(arguments);D=L.$data,K.unshift(D),W=G.apply(D,K)}finally{W!==!0&&(k.preventDefault?k.preventDefault():k.returnValue=!1)}m.get(V+"Bubble")===!1&&(k.cancelBubble=!0,k.stopPropagation&&k.stopPropagation())}})})}},p.c.foreach={Rc:function(v){return function(){var I=v(),m=p.a.bc(I);return!m||typeof m.length=="number"?{foreach:I,templateEngine:p.ba.Ma}:(p.a.f(I),{foreach:m.data,as:m.as,noChildContext:m.noChildContext,includeDestroyed:m.includeDestroyed,afterAdd:m.afterAdd,beforeRemove:m.beforeRemove,afterRender:m.afterRender,beforeMove:m.beforeMove,afterMove:m.afterMove,templateEngine:p.ba.Ma})}},init:function(v,I){return p.c.template.init(v,p.c.foreach.Rc(I))},update:function(v,I,m,D,L){return p.c.template.update(v,p.c.foreach.Rc(I),m,D,L)}},p.m.Ra.foreach=!1,p.h.ea.foreach=!0,p.c.hasfocus={init:function(v,I,m){function D(V){v.__ko_hasfocusUpdating=!0;var k=v.ownerDocument;if("activeElement"in k){var W;try{W=k.activeElement}catch{W=k.body}V=W===v}k=I(),p.m.eb(k,m,"hasfocus",V,!0),v.__ko_hasfocusLastValue=V,v.__ko_hasfocusUpdating=!1}var L=D.bind(null,!0),M=D.bind(null,!1);p.a.B(v,"focus",L),p.a.B(v,"focusin",L),p.a.B(v,"blur",M),p.a.B(v,"focusout",M),v.__ko_hasfocusLastValue=!1},update:function(v,I){var m=!!p.a.f(I());v.__ko_hasfocusUpdating||v.__ko_hasfocusLastValue===m||(m?v.focus():v.blur(),!m&&v.__ko_hasfocusLastValue&&v.ownerDocument.body.focus(),p.u.G(p.a.Fb,null,[v,m?"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(v,I){p.a.fc(v,I())}},function(){function v(I,m,D){p.c[I]={init:function(L,M,V,k,W){var G,K,q={},te,$,X;if(m){k=V.get("as");var Y=V.get("noChildContext");X=!(k&&Y),q={as:k,noChildContext:Y,exportDependencies:X}}return $=(te=V.get("completeOn")=="render")||V.has(p.i.pa),p.o(function(){var ae=p.a.f(M()),ue=!D!=!ae,re=!K,he;(X||ue!==G)&&($&&(W=p.i.Cb(L,W)),ue&&((!m||X)&&(q.dataDependency=p.S.o()),he=m?W.createChildContext(typeof ae=="function"?ae:M,q):p.S.qa()?W.extend(null,q):W),re&&p.S.qa()&&(K=p.a.Ca(p.h.childNodes(L),!0)),ue?(re||p.h.va(L,p.a.Ca(K)),p.Oa(he,L)):(p.h.Ea(L),te||p.i.ma(L,p.i.H)),G=ue)},null,{l:L}),{controlsDescendantBindings:!0}}},p.m.Ra[I]=!1,p.h.ea[I]=!0}v("if"),v("ifnot",!1,!0),v("with",!0)}(),p.c.let={init:function(v,I,m,D,L){return I=L.extend(I),p.Oa(I,v),{controlsDescendantBindings:!0}}},p.h.ea.let=!0;var H={};p.c.options={init:function(v){if(p.a.R(v)!=="select")throw Error("options binding applies only to SELECT elements");for(;0<v.length;)v.remove(0);return{controlsDescendantBindings:!0}},update:function(v,I,m){function D(){return p.a.jb(v.options,function(Y){return Y.selected})}function L(Y,ae,ue){var re=typeof ae;return re=="function"?ae(Y):re=="string"?Y[ae]:ue}function M(Y,ae){if($&&G)p.i.ma(v,p.i.H);else if(te.length){var ue=0<=p.a.A(te,p.w.M(ae[0]));p.a.Zc(ae[0],ue),$&&!ue&&p.u.G(p.a.Fb,null,[v,"change"])}}var V=v.multiple,k=v.length!=0&&V?v.scrollTop:null,W=p.a.f(I()),G=m.get("valueAllowUnset")&&m.has("value"),K=m.get("optionsIncludeDestroyed");I={};var q,te=[];G||(V?te=p.a.Mb(D(),p.w.M):0<=v.selectedIndex&&te.push(p.w.M(v.options[v.selectedIndex]))),W&&(typeof W.length>"u"&&(W=[W]),q=p.a.jb(W,function(Y){return K||Y===e||Y===null||!p.a.f(Y._destroy)}),m.has("optionsCaption")&&(W=p.a.f(m.get("optionsCaption")),W!==null&&W!==e&&q.unshift(H)));var $=!1;if(I.beforeRemove=function(Y){v.removeChild(Y)},W=M,m.has("optionsAfterRender")&&typeof m.get("optionsAfterRender")=="function"&&(W=function(Y,ae){M(0,ae),p.u.G(m.get("optionsAfterRender"),null,[ae[0],Y!==H?Y:e])}),p.a.ec(v,q,function(Y,ae,ue){return ue.length&&(te=!G&&ue[0].selected?[p.w.M(ue[0])]:[],$=!0),ae=v.ownerDocument.createElement("option"),Y===H?(p.a.Bb(ae,m.get("optionsCaption")),p.w.cb(ae,e)):(ue=L(Y,m.get("optionsValue"),Y),p.w.cb(ae,p.a.f(ue)),Y=L(Y,m.get("optionsText"),ue),p.a.Bb(ae,Y)),[ae]},I,W),!G){var X;V?X=te.length&&D().length<te.length:X=te.length&&0<=v.selectedIndex?p.w.M(v.options[v.selectedIndex])!==te[0]:te.length||0<=v.selectedIndex,X&&p.u.G(p.a.Fb,null,[v,"change"])}(G||p.S.Ya())&&p.i.ma(v,p.i.H),p.a.wd(v),k&&20<Math.abs(k-v.scrollTop)&&(v.scrollTop=k)}},p.c.options.$b=p.a.g.Z(),p.c.selectedOptions={init:function(v,I,m){function D(){var V=I(),k=[];p.a.D(v.getElementsByTagName("option"),function(W){W.selected&&k.push(p.w.M(W))}),p.m.eb(V,m,"selectedOptions",k)}function L(){var V=p.a.f(I()),k=v.scrollTop;V&&typeof V.length=="number"&&p.a.D(v.getElementsByTagName("option"),function(W){var G=0<=p.a.A(V,p.w.M(W));W.selected!=G&&p.a.Zc(W,G)}),v.scrollTop=k}if(p.a.R(v)!="select")throw Error("selectedOptions binding applies only to SELECT elements");var M;p.i.subscribe(v,p.i.H,function(){M?D():(p.a.B(v,"change",D),M=p.o(L,null,{l:v}))},null,{notifyImmediately:!0})},update:function(){}},p.m.wa.selectedOptions=!0,p.c.style={update:function(v,I){var m=p.a.f(I()||{});p.a.P(m,function(D,L){if(L=p.a.f(L),(L===null||L===e||L===!1)&&(L=""),o)o(v).css(D,L);else if(/^--/.test(D))v.style.setProperty(D,L);else{D=D.replace(/-(\w)/g,function(V,k){return k.toUpperCase()});var M=v.style[D];v.style[D]=L,L===M||v.style[D]!=M||isNaN(L)||(v.style[D]=L+"px")}})}},p.c.submit={init:function(v,I,m,D,L){if(typeof I()!="function")throw Error("The value for a submit binding must be a function");p.a.B(v,"submit",function(M){var V,k=I();try{V=k.call(L.$data,v)}finally{V!==!0&&(M.preventDefault?M.preventDefault():M.returnValue=!1)}})}},p.c.text={init:function(){return{controlsDescendantBindings:!0}},update:function(v,I){p.a.Bb(v,I())}},p.h.ea.text=!0,function(){if(t&&t.navigator){var v=function(q){if(q)return parseFloat(q[1])},I=t.navigator.userAgent,m,D,L,M,V;(m=t.opera&&t.opera.version&&parseInt(t.opera.version()))||(V=v(I.match(/Edge\/([^ ]+)$/)))||v(I.match(/Chrome\/([^ ]+)/))||(D=v(I.match(/Version\/([^ ]+) Safari/)))||(L=v(I.match(/Firefox\/([^ ]+)/)))||(M=p.a.W||v(I.match(/MSIE ([^ ]+)/)))||(M=v(I.match(/rv:([^ )]+)/)))}if(8<=M&&10>M)var k=p.a.g.Z(),W=p.a.g.Z(),G=function(q){var te=this.activeElement;(te=te&&p.a.g.get(te,W))&&te(q)},K=function(q,te){var $=q.ownerDocument;p.a.g.get($,k)||(p.a.g.set($,k,!0),p.a.B($,"selectionchange",G)),p.a.g.set(q,W,te)};p.c.textInput={init:function(q,te,$){function X(de,me){p.a.B(q,de,me)}function Y(){var de=p.a.f(te());(de===null||de===e)&&(de=""),ce!==e&&de===ce?p.a.setTimeout(Y,4):q.value!==de&&(ie=!0,q.value=de,ie=!1,re=q.value)}function ae(){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(),$,"textInput",de))}var re=q.value,he,ce,Q=p.a.W==9?ae:ue,ie=!1;M&&X("keypress",ue),11>M&&X("propertychange",function(de){ie||de.propertyName!=="value"||Q()}),M==8&&(X("keyup",ue),X("keydown",ue)),K&&(K(q,Q),X("dragend",ae)),(!M||9<=M)&&X("input",Q),5>D&&p.a.R(q)==="textarea"?(X("keydown",ae),X("paste",ae),X("cut",ae)):11>m?X("keydown",ae):4>L?(X("DOMAutoComplete",ue),X("dragdrop",ue),X("drop",ue)):V&&q.type==="number"&&X("keydown",ae),X("change",ue),X("blur",ue),p.o(Y,null,{l:q})}},p.m.wa.textInput=!0,p.c.textinput={preprocess:function(q,te,$){$("textInput",q)}}}(),p.c.uniqueName={init:function(v,I){if(I()){var m="ko_unique_"+ ++p.c.uniqueName.rd;p.a.Yc(v,m)}}},p.c.uniqueName.rd=0,p.c.using={init:function(v,I,m,D,L){var M;return m.has("as")&&(M={as:m.get("as"),noChildContext:m.get("noChildContext")}),I=L.createChildContext(I,M),p.Oa(I,v),{controlsDescendantBindings:!0}}},p.h.ea.using=!0,p.c.value={init:function(v,I,m){var D=p.a.R(v),L=D=="input";if(!L||v.type!="checkbox"&&v.type!="radio"){var M=[],V=m.get("valueUpdate"),k=!1,W=null;V&&(typeof V=="string"?M=[V]:M=p.a.wc(V),p.a.Pa(M,"change"));var G=function(){W=null,k=!1;var te=I(),$=p.w.M(v);p.m.eb(te,m,"value",$)};!p.a.W||!L||v.type!="text"||v.autocomplete=="off"||v.form&&v.form.autocomplete=="off"||p.a.A(M,"propertychange")!=-1||(p.a.B(v,"propertychange",function(){k=!0}),p.a.B(v,"focus",function(){k=!1}),p.a.B(v,"blur",function(){k&&G()})),p.a.D(M,function(te){var $=G;p.a.Ud(te,"after")&&($=function(){W=p.w.M(v),p.a.setTimeout(G,0)},te=te.substring(5)),p.a.B(v,te,$)});var K;if(K=L&&v.type=="file"?function(){var te=p.a.f(I());te===null||te===e||te===""?v.value="":p.u.G(G)}:function(){var te=p.a.f(I()),$=p.w.M(v);W!==null&&te===W?p.a.setTimeout(K,0):(te!==$||$===e)&&(D==="select"?($=m.get("valueAllowUnset"),p.w.cb(v,te,$),$||te===p.w.M(v)||p.u.G(G)):p.w.cb(v,te))},D==="select"){var q;p.i.subscribe(v,p.i.H,function(){q?m.get("valueAllowUnset")?K():G():(p.a.B(v,"change",G),q=p.o(K,null,{l:v}))},null,{notifyImmediately:!0})}else p.a.B(v,"change",G),p.o(K,null,{l:v})}else p.ib(v,{checkedValue:I})},update:function(){}},p.m.wa.value=!0,p.c.visible={update:function(v,I){var m=p.a.f(I()),D=v.style.display!="none";m&&!D?v.style.display="":!m&&D&&(v.style.display="none")}},p.c.hidden={update:function(v,I){p.c.visible.update(v,function(){return!p.a.f(I())})}},function(v){p.c[v]={init:function(I,m,D,L,M){return p.c.event.init.call(this,I,function(){var V={};return V[v]=m(),V},D,L,M)}}}("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(v,I){if(typeof v=="string"){I=I||n;var m=I.getElementById(v);if(!m)throw Error("Cannot find template with ID "+v);return new p.C.F(m)}if(v.nodeType==1||v.nodeType==8)return new p.C.ia(v);throw Error("Unknown template type: "+v)},p.ca.prototype.renderTemplate=function(v,I,m,D){return v=this.makeTemplateSource(v,D),this.renderTemplateSource(v,I,m,D)},p.ca.prototype.isTemplateRewritten=function(v,I){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(v,I).data("isRewritten")},p.ca.prototype.rewriteTemplate=function(v,I,m){v=this.makeTemplateSource(v,m),I=I(v.text()),v.text(I),v.data("isRewritten",!0)},p.b("templateEngine",p.ca),p.kc=function(){function v(D,L,M,V){D=p.m.ac(D);for(var k=p.m.Ra,W=0;W<D.length;W++){var G=D[W].key;if(Object.prototype.hasOwnProperty.call(k,G)){var K=k[G];if(typeof K=="function"){if(G=K(D[W].value))throw Error(G)}else if(!K)throw Error("This template engine does not support the '"+G+"' binding within its templates")}}return M="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+p.m.vb(D,{valueAccessors:!0})+" } })()},'"+M.toLowerCase()+"')",V.createJavaScriptEvaluatorBlock(M)+L}var I=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,m=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{xd:function(D,L,M){L.isTemplateRewritten(D,M)||L.rewriteTemplate(D,function(V){return p.kc.Ld(V,L)},M)},Ld:function(D,L){return D.replace(I,function(M,V,k,W,G){return v(G,V,k,L)}).replace(m,function(M,V){return v(V,"<!-- ko -->","#comment",L)})},md:function(D,L){return p.aa.Xb(function(M,V){var k=M.nextSibling;k&&k.nodeName.toLowerCase()===L&&p.ib(k,D,V)})}}}(),p.b("__tr_ambtns",p.kc.md),function(){p.C={},p.C.F=function(m){if(this.F=m){var D=p.a.R(m);this.ab=D==="script"?1:D==="textarea"?2:D=="template"&&m.content&&m.content.nodeType===11?3:4}},p.C.F.prototype.text=function(){var m=this.ab===1?"text":this.ab===2?"value":"innerHTML";if(arguments.length==0)return this.F[m];var D=arguments[0];m==="innerHTML"?p.a.fc(this.F,D):this.F[m]=D};var v=p.a.g.Z()+"_";p.C.F.prototype.data=function(m){if(arguments.length===1)return p.a.g.get(this.F,v+m);p.a.g.set(this.F,v+m,arguments[1])};var I=p.a.g.Z();p.C.F.prototype.nodes=function(){var m=this.F;if(arguments.length==0){var D=p.a.g.get(m,I)||{},L=D.lb||(this.ab===3?m.content:this.ab===4?m:e);if(!L||D.jd){var M=this.text();M&&M!==D.bb&&(L=p.a.Md(M,m.ownerDocument),p.a.g.set(m,I,{lb:L,bb:M,jd:!0}))}return L}D=arguments[0],this.ab!==e&&this.text(""),p.a.g.set(m,I,{lb:D})},p.C.ia=function(m){this.F=m},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 m=p.a.g.get(this.F,I)||{};return m.bb===e&&m.lb&&(m.bb=m.lb.innerHTML),m.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 v(W,G,K){var q;for(G=p.h.nextSibling(G);W&&(q=W)!==G;)W=p.h.nextSibling(q),K(q,W)}function I(W,G){if(W.length){var K=W[0],q=W[W.length-1],te=K.parentNode,$=p.ga.instance,X=$.preprocessNode;if(X){if(v(K,q,function(Y,ae){var ue=Y.previousSibling,re=X.call($,Y);re&&(Y===K&&(K=re[0]||ae),Y===q&&(q=re[re.length-1]||ue))}),W.length=0,!K)return;K===q?W.push(K):(W.push(K,q),p.a.Ua(W,te))}v(K,q,function(Y){Y.nodeType!==1&&Y.nodeType!==8||p.vc(G,Y)}),v(K,q,function(Y){Y.nodeType!==1&&Y.nodeType!==8||p.aa.cd(Y,[G])}),p.a.Ua(W,te)}}function m(W){return W.nodeType?W:0<W.length?W[0]:null}function D(W,G,K,q,te){te=te||{};var $=(W&&m(W)||K||{}).ownerDocument,X=te.templateEngine||M;if(p.kc.xd(K,X,$),K=X.renderTemplate(K,q,te,$),typeof K.length!="number"||0<K.length&&typeof K[0].nodeType!="number")throw Error("Template engine must return an array of DOM nodes");switch($=!1,G){case"replaceChildren":p.h.va(W,K),$=!0;break;case"replaceNode":p.a.Xc(W,K),$=!0;break;case"ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+G)}return $&&(I(K,q),te.afterRender&&p.u.G(te.afterRender,null,[K,q[te.as||"$data"]]),G=="replaceChildren"&&p.i.ma(W,p.i.H)),K}function L(W,G,K){return p.O(W)?W():typeof W=="function"?W(G,K):W}var M;p.gc=function(W){if(W!=e&&!(W instanceof p.ca))throw Error("templateEngine must inherit from ko.templateEngine");M=W},p.dc=function(W,G,K,q,te){if(K=K||{},(K.templateEngine||M)==e)throw Error("Set a template engine before calling renderTemplate");if(te=te||"replaceChildren",q){var $=m(q);return p.$(function(){var Y=G&&G instanceof p.fa?G:new p.fa(G,null,null,null,{exportDependencies:!0}),X=L(W,Y.$data,Y),Y=D(q,te,X,Y,K);te=="replaceNode"&&(q=Y,$=m(q))},null,{Sa:function(){return!$||!p.a.Sb($)},l:$&&te=="replaceNode"?$.parentNode:$})}return p.aa.Xb(function(X){p.dc(W,G,K,X,"replaceNode")})},p.Qd=function(W,G,K,q,te){function $(ce,Q){p.u.G(p.a.ec,null,[q,ce,Y,K,X,Q]),p.i.ma(q,p.i.H)}function X(ce,Q){I(Q,ae),K.afterRender&&K.afterRender(Q,ce),ae=null}function Y(ce,Q){ae=te.createChildContext(ce,{as:ue,noChildContext:K.noChildContext,extend:function(de){de.$index=Q,ue&&(de[ue+"Index"]=Q)}});var ie=L(W,ce,ae);return D(q,"ignoreTargetNode",ie,ae,K)}var ae,ue=K.as,re=K.includeDestroyed===!1||p.options.foreachHidesDestroyed&&!K.includeDestroyed;if(re||K.beforeRemove||!p.Pc(G))return p.$(function(){var ce=p.a.f(G)||[];typeof ce.length>"u"&&(ce=[ce]),re&&(ce=p.a.jb(ce,function(Q){return Q===e||Q===null||!p.a.f(Q._destroy)})),$(ce)},null,{l:q});$(G.v());var he=G.subscribe(function(ce){$(G(),ce)},null,"arrayChange");return he.l(q),he};var V=p.a.g.Z(),k=p.a.g.Z();p.c.template={init:function(W,G){var K=p.a.f(G());if(typeof K=="string"||"name"in K)p.h.Ea(W);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(W).nodes(q)}else if(K=p.h.childNodes(W),0<K.length)q=p.a.Yb(K),new p.C.ia(W).nodes(q);else throw Error("Anonymous template defined, but no template content was provided");return{controlsDescendantBindings:!0}},update:function(W,G,K,q,te){var $=G();G=p.a.f($),K=!0,q=null,typeof G=="string"?G={}:($="name"in G?G.name:W,"if"in G&&(K=p.a.f(G.if)),K&&"ifnot"in G&&(K=!p.a.f(G.ifnot)),K&&!$&&(K=!1)),"foreach"in G?q=p.Qd($,K&&G.foreach||[],G,W,te):K?(K=te,"data"in G&&(K=te.createChildContext(G.data,{as:G.as,noChildContext:G.noChildContext,exportDependencies:!0})),q=p.dc($,K,G,W)):p.h.Ea(W),te=q,(G=p.a.g.get(W,V))&&typeof G.s=="function"&&G.s(),p.a.g.set(W,V,!te||te.ja&&!te.ja()?e:te)}},p.m.Ra.template=function(W){return W=p.m.ac(W),W.length==1&&W[0].unknown||p.m.Id(W,"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(v,I,m){if(v.length&&I.length){var D,L,M,V,k;for(D=L=0;(!m||D<m)&&(V=v[L]);++L){for(M=0;k=I[M];++M)if(V.value===k.value){V.moved=k.index,k.moved=V.index,I.splice(M,1),D=M=0;break}D+=M}}},p.a.Pb=function(){function v(I,m,D,L,M){var V=Math.min,k=Math.max,W=[],G,K=I.length,q,te=m.length,$=te-K||1,X=K+te+1,Y,ae,ue;for(G=0;G<=K;G++)for(ae=Y,W.push(Y=[]),ue=V(te,G+$),q=k(0,G-1);q<=ue;q++)Y[q]=q?G?I[G-1]===m[q-1]?ae[q-1]:V(ae[q]||X,Y[q-1]||X)+1:q+1:G+1;for(V=[],k=[],$=[],G=K,q=te;G||q;)te=W[G][q]-1,q&&te===W[G][q-1]?k.push(V[V.length]={status:D,value:m[--q],index:q}):G&&te===W[G-1][q]?$.push(V[V.length]={status:L,value:I[--G],index:G}):(--q,--G,M.sparse||V.push({status:"retained",value:m[q]}));return p.a.Kc($,k,!M.dontLimitMoves&&10*K),V.reverse()}return function(I,m,D){return D=typeof D=="boolean"?{dontLimitMoves:D}:D||{},I=I||[],m=m||[],I.length<m.length?v(I,m,"added","deleted",D):v(m,I,"deleted","added",D)}}(),p.b("utils.compareArrays",p.a.Pb),function(){function v(D,L,M,V,k){var W=[],G=p.$(function(){var K=L(M,k,p.a.Ua(W,D))||[];0<W.length&&(p.a.Xc(W,K),V&&p.u.G(V,null,[M,K,k])),W.length=0,p.a.Nb(W,K)},null,{l:D,Sa:function(){return!p.a.kd(W)}});return{Y:W,$:G.ja()?G:e}}var I=p.a.g.Z(),m=p.a.g.Z();p.a.ec=function(D,L,M,V,k,W){function G(Me){ie={Aa:Me,pb:p.ta(ae++)},X.push(ie),$||Q.push(ie)}function K(Me){ie=te[Me],ae!==ie.pb.v()&&ce.push(ie),ie.pb(ae++),p.a.Ua(ie.Y,D),X.push(ie)}function q(Me,ve){if(Me)for(var Ie=0,Ve=ve.length;Ie<Ve;Ie++)p.a.D(ve[Ie].Y,function(Le){Me(Le,Ie,ve[Ie].Aa)})}L=L||[],typeof L.length>"u"&&(L=[L]),V=V||{};var te=p.a.g.get(D,I),$=!te,X=[],Y=0,ae=0,ue=[],re=[],he=[],ce=[],Q=[],ie,de=0;if($)p.a.D(L,G);else{if(!W||te&&te._countWaitingForRemove){var me=p.a.Mb(te,function(Me){return Me.Aa});W=p.a.Pb(me,L,{dontLimitMoves:V.dontLimitMoves,sparse:!0})}for(var me=0,Ee,xe,Pe;Ee=W[me];me++)switch(xe=Ee.moved,Pe=Ee.index,Ee.status){case"deleted":for(;Y<Pe;)K(Y++);xe===e&&(ie=te[Y],ie.$&&(ie.$.s(),ie.$=e),p.a.Ua(ie.Y,D).length&&(V.beforeRemove&&(X.push(ie),de++,ie.Aa===m?ie=null:he.push(ie)),ie&&ue.push.apply(ue,ie.Y))),Y++;break;case"added":for(;ae<Pe;)K(Y++);xe!==e?(re.push(X.length),K(xe)):G(Ee.value)}for(;ae<L.length;)K(Y++);X._countWaitingForRemove=de}p.a.g.set(D,I,X),q(V.beforeMove,ce),p.a.D(ue,V.beforeRemove?p.oa:p.removeNode);var Te,Oe,De;try{De=D.ownerDocument.activeElement}catch{}if(re.length)for(;(me=re.shift())!=e;){for(ie=X[me],Te=e;me;)if((Oe=X[--me].Y)&&Oe.length){Te=Oe[Oe.length-1];break}for(L=0;Y=ie.Y[L];Te=Y,L++)p.h.Wb(D,Y,Te)}for(me=0;ie=X[me];me++){for(ie.Y||p.a.extend(ie,v(D,M,ie.Aa,k,ie.pb)),L=0;Y=ie.Y[L];Te=Y,L++)p.h.Wb(D,Y,Te);!ie.Ed&&k&&(k(ie.Aa,ie.Y,ie.pb),ie.Ed=!0,Te=ie.Y[ie.Y.length-1])}for(De&&D.ownerDocument.activeElement!=De&&De.focus(),q(V.beforeRemove,he),me=0;me<he.length;++me)he[me].Aa=m;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(v,I,m,D){return(I=!(9>p.a.W)&&v.nodes?v.nodes():null)?p.a.la(I.cloneNode(!0).childNodes):(v=v.text(),p.a.ua(v,D))},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(m,D,L,M){if(M=M||n,L=L||{},2>I)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var V=m.data("precompiled");return V||(V=m.text()||"",V=o.template(null,"{{ko_with $item.koBindingContext}}"+V+"{{/ko_with}}"),m.data("precompiled",V)),m=[D.$data],D=o.extend({koBindingContext:D},L.templateOptions),D=o.tmpl(V,m,D),D.appendTo(M.createElement("div")),o.fragments={},D},this.createJavaScriptEvaluatorBlock=function(m){return"{{ko_code ((function() { return "+m+" })()) }}"},this.addTemplate=function(m,D){n.write("<script type='text/html' id='"+m+"'>"+D+"<\/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 v=new p.$a;0<v.Hd&&p.gc(v),p.b("jqueryTmplTemplateEngine",p.$a)}()})})()})()})();var Brt=ko;typeof window<"u"?(ko=window.ko,typeof $A<"u"?window.ko=$A:delete window.ko):(ko=global.ko,typeof $A<"u"?global.ko=$A:delete global.ko);const et=Brt;/**
* @license
* Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
* Copyright (c) Steve Sanderson
* MIT license
*/var uR="__knockoutObservables",fR="__knockoutSubscribable";function Nee(e,t){if(!e)throw new Error("When calling ko.track, you must pass an object as the first parameter.");var n=this,i=Mee(e,!0);return t=t||Object.getOwnPropertyNames(e),t.forEach(function(o){if(!(o===uR||o===fR)&&!(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&&Nrt(n,a)}}),e}function Mee(e,t){var n=e[uR];return!n&&t&&(n={},Object.defineProperty(e,uR,{value:n})),n}function Rrt(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),Nee.call(i,e,[t]),e}function Nrt(e,t){var n=null;e.computed(function(){n&&(n.dispose(),n=null);var i=t();i instanceof Array&&(n=Mrt(e,t,i))})}function Mrt(e,t,n){var i=Frt(e,n);return i.subscribe(t)}function Frt(e,t){var n=t[fR];if(!n){n=new e.subscribable,Object.defineProperty(t,fR,{value:n});var i={};zrt(t,n,i),Urt(e,t,n,i)}return n}function zrt(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 Urt(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 Fee(e,t){if(!e)return null;var n=Mee(e,!1);return n&&n[t]||null}function Hrt(e,t){var n=Fee(e,t);n&&n.valueHasMutated()}function Vrt(e){e.track=Nee,e.getObservable=Fee,e.valueHasMutated=Hrt,e.defineProperty=Rrt}const krt={attachToKo:Vrt},n8="http://www.w3.org/2000/svg",i8="cesium-svgPath-svg",Grt={register:function(e){e.bindingHandlers.cesiumSvgPath={init:function(t,n){const i=document.createElementNS(n8,"svg:svg");i.setAttribute("class",i8);const o=document.createElementNS(n8,"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",`${i8} ${e.unwrap(r.css)}`)},disposeWhenNodeIsRemoved:t}),{controlsDescendantBindings:!0}}},e.virtualElements.allowedBindings.cesiumSvgPath=!0}},Wrt=Grt;krt.attachToKo(et);Wrt.register(et);function yb(e){l(e)||(e=new MT),this._clock=e,this._eventHelper=new Cf,this._eventHelper.add(e.onTick,this.synchronize,this),this.systemTime=et.observable(ne.now()),this.systemTime.equalityComparer=ne.equals,this.startTime=et.observable(e.startTime),this.startTime.equalityComparer=ne.equals,this.startTime.subscribe(function(t){e.startTime=t,this.synchronize()},this),this.stopTime=et.observable(e.stopTime),this.stopTime.equalityComparer=ne.equals,this.stopTime.subscribe(function(t){e.stopTime=t,this.synchronize()},this),this.currentTime=et.observable(e.currentTime),this.currentTime.equalityComparer=ne.equals,this.currentTime.subscribe(function(t){e.currentTime=t,this.synchronize()},this),this.multiplier=et.observable(e.multiplier),this.multiplier.subscribe(function(t){e.multiplier=t,this.synchronize()},this),this.clockStep=et.observable(e.clockStep),this.clockStep.subscribe(function(t){e.clockStep=t,this.synchronize()},this),this.clockRange=et.observable(e.clockRange),this.clockRange.subscribe(function(t){e.clockRange=t,this.synchronize()},this),this.canAnimate=et.observable(e.canAnimate),this.canAnimate.subscribe(function(t){e.canAnimate=t,this.synchronize()},this),this.shouldAnimate=et.observable(e.shouldAnimate),this.shouldAnimate.subscribe(function(t){e.shouldAnimate=t,this.synchronize()},this),et.track(this,["systemTime","startTime","stopTime","currentTime","multiplier","clockStep","clockRange","canAnimate","shouldAnimate"])}Object.defineProperties(yb.prototype,{clock:{get:function(){return this._clock}}});yb.prototype.synchronize=function(){const e=this._clock;this.systemTime=ne.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};yb.prototype.isDestroyed=function(){return!1};yb.prototype.destroy=function(){this._eventHelper.removeAll(),Ue(this)};function XA(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,""),et.track(this,["toggled","tooltip"])}Object.defineProperties(XA.prototype,{command:{get:function(){return this._command}}});function Xo(e,t){if(!l(e))throw new x("func is required.");t=A(t,!0);const n=new $e,i=new $e;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,et.track(o,["canExecute"]),Object.defineProperties(o,{beforeExecute:{value:n},afterExecute:{value:i}}),o}function Vc(e,t,n,i,o){return n.call(i,e[t]),et.getObservable(e,t).subscribe(n,i,o)}const Om="http://www.w3.org/2000/svg",zee="http://www.w3.org/1999/xlink";let zx;const vA=U.fromCssColorString("rgba(247,250,255,0.384)"),Ux=U.fromCssColorString("rgba(143,191,255,0.216)"),v1=U.fromCssColorString("rgba(153,197,255,0.098)"),Hx=U.fromCssColorString("rgba(255,255,255,0.086)"),jrt=U.fromCssColorString("rgba(255,255,255,0.267)"),qrt=U.fromCssColorString("rgba(255,255,255,0)"),o8=U.fromCssColorString("rgba(66,67,68,0.3)"),r8=U.fromCssColorString("rgba(0,0,0,0.5)");function ph(e){return U.fromCssColorString(window.getComputedStyle(e).getPropertyValue("color"))}const CT={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 Dl(e){const t=document.createElementNS(Om,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(Dl(e.children[o]))}else n.indexOf("xlink:")===0?t.setAttributeNS(zee,n.substring(6),e[n]):n==="textContent"?t.textContent=e[n]:t.setAttribute(n,e[n]);return t}function D1(e,t,n){const i=document.createElementNS(Om,"text");i.setAttribute("x",e),i.setAttribute("y",t),i.setAttribute("class","cesium-animation-svgText");const o=document.createElementNS(Om,"tspan");return o.textContent=n,i.appendChild(o),i}function Yrt(e,t,n){e.setAttribute("transform",`translate(100,100) rotate(${n})`),t.setAttribute("transform",`rotate(${n})`)}const Vx=new U;function $o(e,t){const n=t.alpha,i=1-n;return Vx.red=e.red*i+t.red*n,Vx.green=e.green*i+t.green*n,Vx.blue=e.blue*i+t.blue*n,Vx.toCssColorString()}function I1(e,t,n){const i=CT[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 Dl(o)}function $rt(e,t,n){const i=CT[n],o=CT.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 Dl(r)}function Xrt(e,t){const n=e._viewModel,i=n.shuttleRingDragging;if(!(i&&zx!==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 f=e._shuttleRingPointer.getBoundingClientRect(),h=c-o-a.left,_=u-r-a.top;let g=Math.atan2(_,h)*180/Math.PI+90;g>180&&(g-=360);const p=n.shuttleRingAngle;i||c<f.right&&c>f.left&&u>f.top&&u<f.bottom?(zx=e,n.shuttleRingDragging=!0,n.shuttleRingAngle=g):g<p?n.slower():g>p&&n.faster(),t.preventDefault()}else e===zx&&(zx=void 0),n.shuttleRingDragging=!1}function qf(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=[Vc(t,"toggled",this.setToggled,this),Vc(t,"tooltip",this.setTooltip,this),Vc(t.command,"canExecute",this.setEnabled,this)]}qf.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();Ue(this)};qf.prototype.isDestroyed=function(){return!1};qf.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")}};qf.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")))};qf.prototype.setTooltip=function(e){this.svgElement.getElementsByTagName("title")[0].textContent=e};function b0(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("viewModel is required.");e=cr(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(Om,"svg:svg");this._svgNode=r,r.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",zee);const s=document.createElementNS(Om,"g");this._topG=s,this._realtimeSVG=new qf($rt(3,4,"animation_pathClock"),t.playRealtimeViewModel),this._playReverseSVG=new qf(I1(44,99,"animation_pathPlayReverse"),t.playReverseViewModel),this._playForwardSVG=new qf(I1(124,99,"animation_pathPlay"),t.playForwardViewModel),this._pauseSVG=new qf(I1(84,99,"animation_pathPause"),t.pauseViewModel);const a=document.createElementNS(Om,"g");a.appendChild(this._realtimeSVG.svgElement),a.appendChild(this._playReverseSVG.svgElement),a.appendChild(this._playForwardSVG.svgElement),a.appendChild(this._pauseSVG.svgElement);const c=Dl({tagName:"circle",class:"cesium-animation-shuttleRingBack",cx:100,cy:100,r:99});this._shuttleRingBackPanel=c;const u=CT.animation_pathSwooshFX,f=CT.animation_pathPointer,h=Dl({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=Dl({class:"cesium-animation-shuttleRingPointer",id:"animation_pathPointer",tagName:f.tagName,d:f.d});const _=Dl({tagName:"g",transform:"translate(100,100)"});this._knobOuter=Dl({tagName:"circle",class:"cesium-animation-knobOuter",cx:0,cy:0,r:71});const g=61,p=Dl({tagName:"circle",class:"cesium-animation-knobInner",cx:0,cy:0,r:g});this._knobDate=D1(0,-24,""),this._knobTime=D1(0,-7,""),this._knobStatus=D1(0,-41,"");const y=Dl({tagName:"circle",class:"cesium-animation-blank",cx:0,cy:0,r:g}),C=document.createElementNS(Om,"g");C.setAttribute("class","cesium-animation-shuttleRingG"),e.appendChild(o),s.appendChild(C),s.appendChild(_),s.appendChild(a),C.appendChild(c),C.appendChild(h),C.appendChild(this._shuttleRingPointer),_.appendChild(this._knobOuter),_.appendChild(p),_.appendChild(this._knobDate),_.appendChild(this._knobTime),_.appendChild(this._knobStatus),_.appendChild(y),r.appendChild(s),e.appendChild(r);const T=this;function E(z){Xrt(T,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 O;this._subscriptions=[Vc(t.pauseViewModel,"toggled",function(z){O!==z&&(O=z,O?T._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPausePointer"):T._shuttleRingPointer.setAttribute("class","cesium-animation-shuttleRingPointer"))}),Vc(t,"shuttleRingAngle",function(z){Yrt(T._shuttleRingPointer,T._knobOuter,z)}),Vc(t,"dateLabel",function(z){S.textContent!==z&&(S.textContent=z)}),Vc(t,"timeLabel",function(z){w.textContent!==z&&(w.textContent=z)}),Vc(t,"multiplierLabel",function(z){P.textContent!==z&&(P.textContent=z)})],this.applyThemeChanges(),this.resize()}Object.defineProperties(b0.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});b0.prototype.isDestroyed=function(){return!1};b0.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 Ue(this)};b0.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};b0.prototype.applyThemeChanges=function(){const e=this._container.ownerDocument;if(!e.body.contains(this._container)){if(l(this._observer))return;const f=this;f._observer=new MutationObserver(function(){e.body.contains(f._container)&&(f._observer.disconnect(),f._observer=void 0,f.applyThemeChanges())}),f._observer.observe(e,{childList:!0,subtree:!0});return}const t=ph(this._themeNormal),n=ph(this._themeHover),i=ph(this._themeSelect),o=ph(this._themeDisabled),r=ph(this._themeKnob),s=ph(this._themePointer),a=ph(this._themeSwoosh),c=ph(this._themeSwooshHover),u=Dl({tagName:"defs",children:[{id:"animation_buttonNormal",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":$o(t,vA)},{tagName:"stop",offset:"12%","stop-color":$o(t,Ux)},{tagName:"stop",offset:"46%","stop-color":$o(t,v1)},{tagName:"stop",offset:"81%","stop-color":$o(t,Hx)}]},{id:"animation_buttonHovered",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":$o(n,vA)},{tagName:"stop",offset:"12%","stop-color":$o(n,Ux)},{tagName:"stop",offset:"46%","stop-color":$o(n,v1)},{tagName:"stop",offset:"81%","stop-color":$o(n,Hx)}]},{id:"animation_buttonToggled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":$o(i,vA)},{tagName:"stop",offset:"12%","stop-color":$o(i,Ux)},{tagName:"stop",offset:"46%","stop-color":$o(i,v1)},{tagName:"stop",offset:"81%","stop-color":$o(i,Hx)}]},{id:"animation_buttonDisabled",tagName:"linearGradient",x1:"50%",y1:"0%",x2:"50%",y2:"100%",children:[{tagName:"stop",offset:"0%","stop-color":$o(o,jrt)},{tagName:"stop",offset:"75%","stop-color":$o(o,qrt)}]},{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":$o(s,r8)},{tagName:"stop",offset:"100%","stop-color":$o(s,r8)}]},{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":$o(r,vA)},{tagName:"stop",offset:"60%","stop-color":$o(r,o8)},{tagName:"stop",offset:"85%","stop-color":$o(r,Ux)}]},{id:"animation_knobInner",tagName:"linearGradient",x1:"20%",y1:"0%",x2:"90%",y2:"100%",children:[{tagName:"stop",offset:"5%","stop-color":$o(r,o8)},{tagName:"stop",offset:"60%","stop-color":$o(r,vA)},{tagName:"stop",offset:"85%","stop-color":$o(r,Hx)}]}]});l(this._defsElement)?this._svgNode.replaceChild(u,this._defsElement):this._svgNode.appendChild(u),this._defsElement=u};const Krt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Zh=15,Ey=105;function Uee(e,t){return e-t}function P1(e,t){const n=Cs(t,e,Uee);return n<0?~n:n}function Jrt(e,t){if(Math.abs(e)<=Zh)return e/Zh;const n=Zh,i=Ey;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 Qrt(e,t,n){if(n.clockStep===Ms.SYSTEM_CLOCK)return Zh;if(Math.abs(e)<=1)return e*Zh;const i=t[t.length-1];e>i?e=i:e<-i&&(e=-i);const o=Zh,r=Ey;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 Zc(e){if(!l(e))throw new x("clockViewModel is required.");const t=this;this._clockViewModel=e,this._allShuttleRingTicks=[],this._dateFormatter=Zc.defaultDateFormatter,this._timeFormatter=Zc.defaultTimeFormatter,this.shuttleRingDragging=!1,this.snapToTicks=!1,et.track(this,["_allShuttleRingTicks","_dateFormatter","_timeFormatter","shuttleRingDragging","snapToTicks"]),this._sortedFilteredPositiveTicks=[],this.setShuttleRingTicks(Zc.defaultTicks),this.timeLabel=void 0,et.defineProperty(this,"timeLabel",function(){return t._timeFormatter(t._clockViewModel.currentTime,t)}),this.dateLabel=void 0,et.defineProperty(this,"dateLabel",function(){return t._dateFormatter(t._clockViewModel.currentTime,t)}),this.multiplierLabel=void 0,et.defineProperty(this,"multiplierLabel",function(){const s=t._clockViewModel;if(s.clockStep===Ms.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,et.defineProperty(this,"shuttleRingAngle",{get:function(){return Qrt(e.multiplier,t._allShuttleRingTicks,e)},set:function(s){s=Math.max(Math.min(s,Ey),-Ey);const a=t._allShuttleRingTicks,c=t._clockViewModel;if(c.clockStep=Ms.SYSTEM_CLOCK_MULTIPLIER,Math.abs(s)===Ey){c.multiplier=s>0?a[a.length-1]:a[0];return}let u=Jrt(s,a);if(t.snapToTicks)u=a[P1(u,a)];else if(u!==0){const f=Math.abs(u);if(f>100){const h=f.toFixed(0).length-2,_=Math.pow(10,h);u=Math.round(u/_)*_|0}else f>Zh?u=Math.round(u):f>1?u=+u.toFixed(1):f>0&&(u=+u.toFixed(2))}c.multiplier=u}}),this._canAnimate=void 0,et.defineProperty(this,"_canAnimate",function(){const s=t._clockViewModel,a=s.clockRange;if(t.shuttleRingDragging||a===Gh.UNBOUNDED)return!0;const c=s.multiplier,u=s.currentTime,f=s.startTime;let h=!1;if(a===Gh.LOOP_STOP)h=ne.greaterThan(u,f)||u.equals(f)&&c>0;else{const _=s.stopTime;h=ne.greaterThan(u,f)&&ne.lessThan(u,_)||u.equals(f)&&c>0||u.equals(_)&&c<0}return h||(s.shouldAnimate=!1),h}),this._isSystemTimeAvailable=void 0,et.defineProperty(this,"_isSystemTimeAvailable",function(){const s=t._clockViewModel;if(s.clockRange===Gh.UNBOUNDED)return!0;const c=s.systemTime;return ne.greaterThanOrEquals(c,s.startTime)&&ne.lessThanOrEquals(c,s.stopTime)}),this._isAnimating=void 0,et.defineProperty(this,"_isAnimating",function(){return t._clockViewModel.shouldAnimate&&(t._canAnimate||t.shuttleRingDragging)});const n=Xo(function(){const s=t._clockViewModel;s.shouldAnimate?s.shouldAnimate=!1:t._canAnimate&&(s.shouldAnimate=!0)});this._pauseViewModel=new XA(n,{toggled:et.computed(function(){return!t._isAnimating}),tooltip:"Pause"});const i=Xo(function(){const s=t._clockViewModel,a=s.multiplier;a>0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playReverseViewModel=new XA(i,{toggled:et.computed(function(){return t._isAnimating&&e.multiplier<0}),tooltip:"Play Reverse"});const o=Xo(function(){const s=t._clockViewModel,a=s.multiplier;a<0&&(s.multiplier=-a),s.shouldAnimate=!0});this._playForwardViewModel=new XA(o,{toggled:et.computed(function(){return t._isAnimating&&e.multiplier>0&&e.clockStep!==Ms.SYSTEM_CLOCK}),tooltip:"Play Forward"});const r=Xo(function(){t._clockViewModel.clockStep=Ms.SYSTEM_CLOCK},et.getObservable(this,"_isSystemTimeAvailable"));this._playRealtimeViewModel=new XA(r,{toggled:et.computed(function(){return e.clockStep===Ms.SYSTEM_CLOCK}),tooltip:et.computed(function(){return t._isSystemTimeAvailable?"Today (real-time)":"Current time not in range"})}),this._slower=Xo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=P1(c,a)-1;u>=0&&(s.multiplier=a[u])}),this._faster=Xo(function(){const s=t._clockViewModel,a=t._allShuttleRingTicks,c=s.multiplier,u=P1(c,a)+1;u<a.length&&(s.multiplier=a[u])})}Zc.defaultDateFormatter=function(e,t){const n=ne.toGregorianDate(e);return`${Krt[n.month-1]} ${n.day} ${n.year}`};Zc.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];Zc.defaultTimeFormatter=function(e,t){const n=ne.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`};Zc.prototype.getShuttleRingTicks=function(){return this._sortedFilteredPositiveTicks.slice(0)};Zc.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(Uee);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(Zc.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}}});Zc._maxShuttleRingAngle=Ey;Zc._realtimeShuttleRingAngle=Zh;function Hee(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,et.track(this,["imageryProviderViewModels","terrainProviderViewModels","dropDownVisible"]);const o=et.getObservable(this,"imageryProviderViewModels"),r=et.pureComputed(function(){const h=o(),_={};let g;for(g=0;g<h.length;g++){const C=h[g],T=C.category;l(_[T])?_[T].push(C):_[T]=[C]}const p=Object.keys(_),y=[];for(g=0;g<p.length;g++){const C=p[g];y.push({name:C,providers:_[C]})}return y});this._imageryProviders=r;const s=et.getObservable(this,"terrainProviderViewModels"),a=et.pureComputed(function(){const h=s(),_={};let g;for(g=0;g<h.length;g++){const C=h[g],T=C.category;l(_[T])?_[T].push(C):_[T]=[C]}const p=Object.keys(_),y=[];for(g=0;g<p.length;g++){const C=p[g];y.push({name:C,providers:_[C]})}return y});this._terrainProviders=a,this.buttonTooltip=void 0,et.defineProperty(this,"buttonTooltip",function(){const h=this.selectedImagery,_=this.selectedTerrain,g=l(h)?h.name:void 0,p=l(_)?_.name:void 0;return l(g)&&l(p)?`${g}
${p}`:l(g)?g:p}),this.buttonImageUrl=void 0,et.defineProperty(this,"buttonImageUrl",function(){const h=this.selectedImagery;if(l(h))return h.iconUrl}),this.selectedImagery=void 0;const c=et.observable();this._currentImageryProviders=[],et.defineProperty(this,"selectedImagery",{get:function(){return c()},set:function(h){if(c()===h){this.dropDownVisible=!1;return}let _;const g=this._currentImageryProviders,p=g.length,y=this._globe.imageryLayers;let C=!1;for(_=0;_<p;_++){const T=y.length;for(let E=0;E<T;E++){const w=y.get(E);if(w.imageryProvider===g[_]){y.remove(w),C=!0;break}}}if(l(h)){const T=h.creationCommand();if(Array.isArray(T)){const E=T.length;for(_=E-1;_>=0;_--)y.addImageryProvider(T[_],0);this._currentImageryProviders=T.slice(0)}else if(this._currentImageryProviders=[T],C)y.addImageryProvider(T,0);else{const E=y.get(0);l(E)&&y.remove(E),y.addImageryProvider(T,0)}}c(h),this.dropDownVisible=!1}}),this.selectedTerrain=void 0;const u=et.observable();et.defineProperty(this,"selectedTerrain",{get:function(){return u()},set:function(h){if(u()===h){this.dropDownVisible=!1;return}let _;l(h)&&(_=h.creationCommand()),this._globe.depthTestAgainstTerrain=!(_ instanceof wp),this._globe.terrainProvider=_,u(h),this.dropDownVisible=!1}});const f=this;this._toggleDropDown=Xo(function(){f.dropDownVisible=!f.dropDownVisible}),this.selectedImagery=A(e.selectedImageryProviderViewModel,n[0]),this.selectedTerrain=A(e.selectedTerrainProviderViewModel,i[0])}Object.defineProperties(Hee.prototype,{toggleDropDown:{get:function(){return this._toggleDropDown}},globe:{get:function(){return this._globe}}});function AD(e,t){if(!l(e))throw new x("container is required.");e=cr(e);const n=new Hee(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 f=document.createElement("div");f.className="cesium-baseLayerPicker-choices",f.setAttribute("data-bind","foreach: providers"),c.appendChild(f);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; }'),f.appendChild(h);const _=document.createElement("img");_.className="cesium-baseLayerPicker-itemIcon",_.setAttribute("data-bind","attr: { src: iconUrl }"),_.setAttribute("draggable","false"),h.appendChild(_);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 C=document.createElement("div");C.className="cesium-baseLayerPicker-category",y.appendChild(C);const T=document.createElement("div");T.className="cesium-baseLayerPicker-categoryTitle",T.setAttribute("data-bind","text: name"),C.appendChild(T);const E=document.createElement("div");E.className="cesium-baseLayerPicker-choices",E.setAttribute("data-bind","foreach: providers"),C.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),et.applyBindings(n,i),et.applyBindings(n,r),this._viewModel=n,this._container=e,this._element=i,this._dropPanel=r,this._closeDropDown=function(O){i.contains(O.target)||r.contains(O.target)||(n.dropDownVisible=!1)},un.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(AD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});AD.prototype.isDestroyed=function(){return!1};AD.prototype.destroy=function(){return un.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),et.cleanNode(this._element),et.cleanNode(this._dropPanel),this._container.removeChild(this._element),this._container.removeChild(this._dropPanel),Ue(this)};function fs(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=Xo(t)),this._creationCommand=t,this.name=e.name,this.tooltip=e.tooltip,this.iconUrl=e.iconUrl,this._category=A(e.category,""),et.track(this,["name","tooltip","iconUrl"])}Object.defineProperties(fs.prototype,{creationCommand:{get:function(){return this._creationCommand}},category:{get:function(){return this._category}}});function Zrt(){const e=[];return e.push(new fs({name:"Bing Maps Aerial",iconUrl:dn("Widgets/Images/ImageryProviders/bingAerial.png"),tooltip:"Bing Maps aerial imagery, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return ow({style:iw.AERIAL})}})),e.push(new fs({name:"Bing Maps Aerial with Labels",iconUrl:dn("Widgets/Images/ImageryProviders/bingAerialLabels.png"),tooltip:"Bing Maps aerial imagery with labels, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return ow({style:iw.AERIAL_WITH_LABELS})}})),e.push(new fs({name:"Bing Maps Roads",iconUrl:dn("Widgets/Images/ImageryProviders/bingRoads.png"),tooltip:"Bing Maps standard road maps, provided by Cesium ion",category:"Cesium ion",creationFunction:function(){return ow({style:iw.ROAD})}})),e.push(new fs({name:"ESRI World Imagery",iconUrl:dn("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 kh({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",enablePickFeatures:!1})}})),e.push(new fs({name:"ESRI World Street Map",iconUrl:dn("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 kh({url:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",enablePickFeatures:!1})}})),e.push(new fs({name:"ESRI National Geographic",iconUrl:dn("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 kh({url:"https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",enablePickFeatures:!1})}})),e.push(new fs({name:"Open­Street­Map",iconUrl:dn("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 by({url:"https://a.tile.openstreetmap.org/"})}})),e.push(new fs({name:"Stamen Watercolor",iconUrl:dn("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 by({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 fs({name:"Stamen Toner",iconUrl:dn("Widgets/Images/ImageryProviders/stamenToner.png"),tooltip:`A high contrast black and white map.
http://maps.stamen.com`,category:"Other",creationFunction:function(){return new by({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 fs({name:"Sentinel-2",iconUrl:dn("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 Fl({assetId:3954})}})),e.push(new fs({name:"Blue Marble",iconUrl:dn("Widgets/Images/ImageryProviders/blueMarble.png"),tooltip:"Blue Marble Next Generation July, 2004 imagery from NASA.",category:"Cesium ion",creationFunction:function(){return new Fl({assetId:3845})}})),e.push(new fs({name:"Earth at night",iconUrl:dn("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 Fl({assetId:3812})}})),e.push(new fs({name:"Natural Earth II",iconUrl:dn("Widgets/Images/ImageryProviders/naturalEarthII.png"),tooltip:`Natural Earth II, darkened for contrast.
http://www.naturalearthdata.com/`,category:"Cesium ion",creationFunction:function(){return new Jf({url:dn("Assets/Textures/NaturalEarthII")})}})),e}function est(){const e=[];return e.push(new fs({name:"WGS84 Ellipsoid",iconUrl:dn("Widgets/Images/TerrainProviders/Ellipsoid.png"),tooltip:"WGS84 standard ellipsoid, also known as EPSG:4326",category:"Cesium ion",creationFunction:function(){return new wp}})),e.push(new fs({name:"Cesium World Terrain",iconUrl:dn("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 Ynt({requestWaterMask:!0,requestVertexNormals:!0})}})),e}function CD(e,t){l(t)||(t=document.body),t=cr(t);const n=this,i=et.observable($r.fullscreen),o=et.observable($r.enabled),r=t.ownerDocument;this.isFullscreen=void 0,et.defineProperty(this,"isFullscreen",{get:function(){return i()}}),this.isFullscreenEnabled=void 0,et.defineProperty(this,"isFullscreenEnabled",{get:function(){return o()},set:function(s){o(s&&$r.enabled)}}),this.tooltip=void 0,et.defineProperty(this,"tooltip",function(){return this.isFullscreenEnabled?i()?"Exit full screen":"Full screen":"Full screen unavailable"}),this._command=Xo(function(){$r.fullscreen?$r.exitFullscreen():$r.requestFullscreen(n._fullscreenElement)},et.getObservable(this,"isFullscreenEnabled")),this._fullscreenElement=A(cr(e),r.body),this._callback=function(){i($r.fullscreen)},r.addEventListener($r.changeEventName,this._callback)}Object.defineProperties(CD.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}}});CD.prototype.isDestroyed=function(){return!1};CD.prototype.destroy=function(){document.removeEventListener($r.changeEventName,this._callback),Ue(this)};const tst="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",nst="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 TD(e,t){if(!l(e))throw new x("container is required.");e=cr(e);const n=new CD(t,e);n._exitFullScreenPath=nst,n._enterFullScreenPath=tst;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),et.applyBindings(n,i),this._container=e,this._viewModel=n,this._element=i}Object.defineProperties(TD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});TD.prototype.isDestroyed=function(){return!1};TD.prototype.destroy=function(){return this._viewModel.destroy(),et.cleanNode(this._element),this._container.removeChild(this._element),Ue(this)};const s8=1e3;function Zu(e){if(!l(e)||!l(e.scene))throw new x("options.scene is required.");l(e.geocoderServices)?this._geocoderServices=e.geocoderServices:this._geocoderServices=[new lee,new yee({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 $e,this._suggestions=[],this._selectedSuggestion=void 0,this._showSuggestions=!0,this._handleArrowDown=c8,this._handleArrowUp=a8;const t=this;this._suggestionsVisible=et.pureComputed(function(){const o=et.getObservable(t,"_suggestions")().length>0,r=et.getObservable(t,"_showSuggestions")();return o&&r}),this._searchCommand=Xo(function(i){if(i=A(i,FF.SEARCH),t._focusTextbox=!1,l(t._selectedSuggestion))return t.activateSuggestion(t._selectedSuggestion),!1;t.hideSuggestions(),t.isSearchInProgress?cst(t):sst(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?a8(t):r?c8(t):a&&t._searchCommand(),!0},this.activateSuggestion=function(i){t.hideSuggestions(),t._searchText=i.displayName;const o=i.destination;kee(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,Zu.flyToDestination),this._focusTextbox=!1,et.track(this,["_searchText","_isSearchInProgress","keepExpanded","_suggestions","_selectedSuggestion","_showSuggestions","_focusTextbox"]);const n=et.getObservable(this,"_searchText");n.extend({rateLimit:{timeout:500}}),this._suggestionSubscription=n.subscribe(function(){Zu._updateSearchSuggestions(t)}),this.isSearchInProgress=void 0,et.defineProperty(this,"isSearchInProgress",{get:function(){return this._isSearchInProgress}}),this.searchText=void 0,et.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,et.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(Zu.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}}});Zu.prototype.destroy=function(){this._suggestionSubscription.dispose()};function a8(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],Zu._adjustSuggestionsScroll(e,n)}function c8(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],Zu._adjustSuggestionsScroll(e,i)}function ist(e,t){const n=l(t)?t.availability:void 0;return l(n)?_D(t,[e]).then(function(i){return e=i[0],e.height+=s8,e}):(e.height+=s8,Promise.resolve(e))}function ost(e,t){const n=e._scene,o=n.mapProjection.ellipsoid,r=n.camera,s=n.terrainProvider;let a=t,c;return t instanceof _e?N.equalsEpsilon(t.south,t.north,N.EPSILON7)&&N.equalsEpsilon(t.east,t.west,N.EPSILON7)?t=_e.center(t):c=yD(t,n):t=o.cartesianToCartographic(t),l(c)||(c=ist(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 rst(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 sst(e,t,n){const i=e._searchText;if(Vee(i)){e.showSuggestions();return}e._isSearchInProgress=!0;let o=Promise.resolve();for(let r=0;r<t.length;r++)o=rst(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 ast(e,t){const n=cr(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 cst(e){e._isSearchInProgress=!1,l(e._geocodePromise)&&(e._geocodePromise.cancel=!0,e._geocodePromise=void 0)}function Vee(e){return/^\s*$/.test(e)}function kee(e){et.getObservable(e,"_suggestions").removeAll()}function lst(e){if(!e.autoComplete)return;const t=e._searchText;if(kee(e),Vee(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,FF.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])})}Zu.flyToDestination=ost;Zu._updateSearchSuggestions=lst;Zu._adjustSuggestionsScroll=ast;const ust="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",fst="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 bD(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=cr(e.container),n=new Zu(e);n._startSearchPath=ust,n._stopSearchPath=fst;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),et.applyBindings(n,i),et.applyBindings(n,s),this._container=t,this._searchSuggestionsContainer=s,this._viewModel=n,this._form=i,this._onInputBegin=function(u){let f=u.target;typeof u.composedPath=="function"&&(f=u.composedPath()[0]),t.contains(f)||(n._focusTextbox=!1,n.hideSuggestions())},this._onInputEnd=function(u){n._focusTextbox=!0,n.showSuggestions()},un.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(bD.prototype,{container:{get:function(){return this._container}},searchSuggestionsContainer:{get:function(){return this._searchSuggestionsContainer}},viewModel:{get:function(){return this._viewModel}}});bD.prototype.isDestroyed=function(){return!1};bD.prototype.destroy=function(){const e=this._container;return un.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(),et.cleanNode(this._form),et.cleanNode(this._searchSuggestionsContainer),e.removeChild(this._form),e.removeChild(this._searchSuggestionsContainer),this._textBox.removeEventListener("focus",this._onTextBoxFocus,!1),Ue(this)};function Gee(e,t){if(!l(e))throw new x("scene is required.");this._scene=e,this._duration=t;const n=this;this._command=Xo(function(){n._scene.camera.flyHome(n._duration)}),this.tooltip="View Home",et.track(this,["tooltip"])}Object.defineProperties(Gee.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 ED(e,t,n){if(!l(e))throw new x("container is required.");e=cr(e);const i=new Gee(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),et.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(ED.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});ED.prototype.isDestroyed=function(){return!1};ED.prototype.destroy=function(){return et.cleanNode(this._element),this._container.removeChild(this._element),Ue(this)};const dst="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",hst="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 kF(){this._cameraClicked=new $e,this._closeClicked=new $e,this.maxHeight=500,this.enableCamera=!1,this.isCameraTracking=!1,this.showInfo=!1,this.titleText="",this.description="",et.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,et.defineProperty(this,"cameraIconPath",{get:function(){return!this.enableCamera||this.isCameraTracking?hst:dst}}),et.defineProperty(this,"_bodyless",{get:function(){return!l(this.description)||this.description.length===0}})}kF.prototype.maxHeightOffset=function(e){return`${this.maxHeight-e}px`};Object.defineProperties(kF.prototype,{cameraClicked:{get:function(){return this._cameraClicked}},closeClicked:{get:function(){return this._closeClicked}}});function xD(e){b.defined("container",e),e=cr(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="&times;",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 kF;et.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=dn("Widgets/InfoBox/InfoBoxDescription.css"),u.rel="stylesheet",u.type="text/css";const f=c.createElement("div");f.className="cesium-infoBox-description",c.head.appendChild(u),c.body.appendChild(f),a._descriptionSubscription=Vc(s,"description",function(h){r.style.height="5px",f.innerHTML=h;let _=null;const g=f.firstElementChild;if(g!==null&&f.childNodes.length===1){const y=window.getComputedStyle(g);if(y!==null){const C=y["background-color"],T=U.fromCssColorString(C);l(T)&&T.alpha!==0&&(_=y["background-color"])}}t.style["background-color"]=_;const p=f.getBoundingClientRect().height;r.style.height=`${p}px`})}),r.setAttribute("src","about:blank")}Object.defineProperties(xD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}},frame:{get:function(){return this._frame}}});xD.prototype.isDestroyed=function(){return!1};xD.prototype.destroy=function(){const e=this._container;return et.cleanNode(this._element),e.removeChild(this._element),l(this._descriptionSubscription)&&this._descriptionSubscription.dispose(),Ue(this)};function Wee(){this.showInstructions=!1;const e=this;this._command=Xo(function(){e.showInstructions=!e.showInstructions}),this._showClick=Xo(function(){e._touch=!1}),this._showTouch=Xo(function(){e._touch=!0}),this._touch=!1,this.tooltip="Navigation Instructions",et.track(this,["tooltip","showInstructions","_touch"])}Object.defineProperties(Wee.prototype,{command:{get:function(){return this._command}},showClick:{get:function(){return this._showClick}},showTouch:{get:function(){return this._showTouch}}});function wD(e){if(!l(e)||!l(e.container))throw new x("options.container is required.");const t=cr(e.container),n=new Wee,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=dn("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 f=document.createElement("img");f.src=dn("Widgets/Images/NavigationHelp/Touch.svg"),f.className="cesium-navigation-button-icon",f.style.width="25px",f.style.height="25px",u.appendChild(f),u.appendChild(document.createTextNode("Touch")),s.appendChild(a),s.appendChild(u);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="${dn("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="${dn("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="${dn("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 _=document.createElement("div");_.className="cesium-touch-navigation-help cesium-navigation-help-instructions",_.setAttribute("data-bind",'css: { "cesium-touch-navigation-help-visible" : _touch}'),_.innerHTML=` <table> <tr> <td><img src="${dn("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="${dn("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="${dn("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="${dn("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(_),et.applyBindings(n,o),this._container=t,this._viewModel=n,this._wrapper=o,this._closeInstructions=function(g){o.contains(g.target)||(n.showInstructions=!1)},un.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeInstructions,!0):(document.addEventListener("mousedown",this._closeInstructions,!0),document.addEventListener("touchstart",this._closeInstructions,!0))}Object.defineProperties(wD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});wD.prototype.isDestroyed=function(){return!1};wD.prototype.destroy=function(){return un.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeInstructions,!0):(document.removeEventListener("mousedown",this._closeInstructions,!0),document.removeEventListener("touchstart",this._closeInstructions,!0)),et.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Ue(this)};function SD(e){if(!l(e))throw new x("scene is required.");this._scene=e,this._orthographic=e.camera.frustum instanceof Ft,this._flightInProgress=!1,this.dropDownVisible=!1,this.tooltipPerspective="Perspective Projection",this.tooltipOrthographic="Orthographic Projection",this.selectedTooltip=void 0,this.sceneMode=e.mode,et.track(this,["_orthographic","_flightInProgress","sceneMode","dropDownVisible","tooltipPerspective","tooltipOrthographic"]);const t=this;et.defineProperty(this,"selectedTooltip",function(){return t._orthographic?t.tooltipOrthographic:t.tooltipPerspective}),this._toggleDropDown=Xo(function(){t.sceneMode===le.SCENE2D||t._flightInProgress||(t.dropDownVisible=!t.dropDownVisible)}),this._eventHelper=new Cf,this._eventHelper.add(e.morphComplete,function(n,i,o,r){t.sceneMode=o,t._orthographic=o===le.SCENE2D||t._scene.camera.frustum instanceof Ft}),this._eventHelper.add(e.preRender,function(){t._flightInProgress=l(e.camera._currentFlight)}),this._switchToPerspective=Xo(function(){t.sceneMode!==le.SCENE2D&&(t._scene.camera.switchToPerspectiveFrustum(),t._orthographic=!1,t.dropDownVisible=!1)}),this._switchToOrthographic=Xo(function(){t.sceneMode!==le.SCENE2D&&(t._scene.camera.switchToOrthographicFrustum(),t._orthographic=!0,t.dropDownVisible=!1)}),this._sceneMode=le}Object.defineProperties(SD.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}}});SD.prototype.isDestroyed=function(){return!1};SD.prototype.destroy=function(){this._eventHelper.removeAll(),Ue(this)};const pst="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",mst="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 vD(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=cr(e);const n=new SD(t);n._perspectivePath=pst,n._orthographicPath=mst;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),et.applyBindings(n,i),this._viewModel=n,this._container=e,this._wrapper=i,this._closeDropDown=function(a){i.contains(a.target)||(n.dropDownVisible=!1)},un.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(vD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});vD.prototype.isDestroyed=function(){return!1};vD.prototype.destroy=function(){return this._viewModel.destroy(),un.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),et.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Ue(this)};function DD(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 Cf,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",et.track(this,["sceneMode","dropDownVisible","tooltip2D","tooltip3D","tooltipColumbusView"]),this.selectedTooltip=void 0,et.defineProperty(this,"selectedTooltip",function(){const o=n.sceneMode;return o===le.SCENE2D?n.tooltip2D:o===le.SCENE3D?n.tooltip3D:n.tooltipColumbusView}),this._toggleDropDown=Xo(function(){n.dropDownVisible=!n.dropDownVisible}),this._morphTo2D=Xo(function(){e.morphTo2D(n._duration)}),this._morphTo3D=Xo(function(){e.morphTo3D(n._duration)}),this._morphToColumbusView=Xo(function(){e.morphToColumbusView(n._duration)}),this._sceneMode=le}Object.defineProperties(DD.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}}});DD.prototype.isDestroyed=function(){return!1};DD.prototype.destroy=function(){this._eventHelper.removeAll(),Ue(this)};const _st="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",gst="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",yst="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 ID(e,t,n){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=cr(e);const i=new DD(t,n);i._globePath=_st,i._flatMapPath=gst,i._columbusViewPath=yst;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),et.applyBindings(i,o),this._viewModel=i,this._container=e,this._wrapper=o,this._closeDropDown=function(u){o.contains(u.target)||(i.dropDownVisible=!1)},un.supportsPointerEvents()?document.addEventListener("pointerdown",this._closeDropDown,!0):(document.addEventListener("mousedown",this._closeDropDown,!0),document.addEventListener("touchstart",this._closeDropDown,!0))}Object.defineProperties(ID.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});ID.prototype.isDestroyed=function(){return!1};ID.prototype.destroy=function(){return this._viewModel.destroy(),un.supportsPointerEvents()?document.removeEventListener("pointerdown",this._closeDropDown,!0):(document.removeEventListener("mousedown",this._closeDropDown,!0),document.removeEventListener("touchstart",this._closeDropDown,!0)),et.cleanNode(this._wrapper),this._container.removeChild(this._wrapper),Ue(this)};const Ast=new j,$S="-1000px";function Ab(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=$S,this._screenPositionY=$S,this._tweens=e.tweens,this._container=A(n,document.body),this._selectionIndicatorElement=t,this._scale=1,this.position=void 0,this.showSelection=!1,et.track(this,["position","_screenPositionX","_screenPositionY","_scale","showSelection"]),this.isVisible=void 0,et.defineProperty(this,"isVisible",{get:function(){return this.showSelection&&l(this.position)}}),et.defineProperty(this,"_transform",{get:function(){return`scale(${this._scale})`}}),this.computeScreenSpacePosition=function(i,o){return lr.wgs84ToWindowCoordinates(e,i,o)}}Ab.prototype.update=function(){if(this.showSelection&&l(this.position)){const e=this.computeScreenSpacePosition(this.position,Ast);if(!l(e))this._screenPositionX=$S,this._screenPositionY=$S;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`}}};Ab.prototype.animateAppear=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:2,stopValue:1,duration:.8,easingFunction:lc.EXPONENTIAL_OUT})};Ab.prototype.animateDepart=function(){this._tweens.addProperty({object:this,property:"_scale",startValue:this._scale,stopValue:1.5,duration:.8,easingFunction:lc.EXPONENTIAL_OUT})};Object.defineProperties(Ab.prototype,{container:{get:function(){return this._container}},selectionIndicatorElement:{get:function(){return this._selectionIndicatorElement}},scene:{get:function(){return this._scene}}});function PD(e,t){if(!l(e))throw new x("container is required.");e=cr(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 Ab(t,this._element,this._container);this._viewModel=c,et.applyBindings(this._viewModel,this._element)}Object.defineProperties(PD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});PD.prototype.isDestroyed=function(){return!1};PD.prototype.destroy=function(){const e=this._container;return et.cleanNode(this._element),e.removeChild(this._element),Ue(this)};function W_(e,t,n){this._color=e,this._height=t,this._base=A(n,0)}W_.prototype.getHeight=function(){return this._height};W_.prototype.getBase=function(){return this._base};W_.prototype.getStartTime=function(){return this._start};W_.prototype.getStopTime=function(){return this._stop};W_.prototype.setRange=function(e,t){this._start=e,this._stop=t};W_.prototype.render=function(e){let t="";if(this._start&&this._stop&&this._color){const n=ne.secondsDifference(this._start,e.epochJulian);let i=Math.round(e.timeBarWidth*e.getAlpha(n));const o=ne.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 jee(e,t,n,i){this.interval=e,this.height=t,this.color=n||new U(.5,.5,.5,1),this.backgroundColor=i||new U(0,0,0,0)}jee.prototype.render=function(e,t){const n=this.interval.start,i=this.interval.stop,o=t.startJulian,r=ne.addSeconds(t.startJulian,t.duration,new ne);if(ne.lessThan(n,o)&&ne.greaterThan(i,r))e.fillStyle=this.color.toCssColorString(),e.fillRect(0,t.y,t.timeBarWidth,this.height);else if(ne.lessThanOrEquals(n,r)&&ne.greaterThanOrEquals(i,o)){let s,a,c;for(s=0;s<t.timeBarWidth;++s){const u=ne.addSeconds(t.startJulian,s/t.timeBarWidth*t.duration,new ne);!l(a)&&ne.greaterThanOrEquals(u,n)?a=s:!l(c)&&ne.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 O1=1e12;const qc={none:0,scrub:1,slide:2,zoom:3,touchOnly:4},pa={none:0,scrub:1,slideZoom:2,singleTap:3,ignore:4},mh=[.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],Cst=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sa(e,t){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("clock is required.");e=cr(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=qc.none,this._touchMode=pa.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=Tst(this),this._onMouseUp=bst(this),this._onMouseMove=Est(this),this._onMouseWheel=xst(this),this._onTouchStart=wst(this),this._onTouchMove=vst(this),this._onTouchEnd=Sst(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()}sa.prototype.addEventListener=function(e,t,n){this._topDiv.addEventListener(e,t,n)};sa.prototype.removeEventListener=function(e,t,n){this._topDiv.removeEventListener(e,t,n)};sa.prototype.isDestroyed=function(){return!1};sa.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),Ue(this)};sa.prototype.addHighlightRange=function(e,t,n){const i=new W_(e,t,n);return this._highlightRanges.push(i),this.resize(),i};sa.prototype.addTrack=function(e,t,n,i){const o=new jee(e,t,n,i);return this._trackList.push(o),this._lastHeight=void 0,this.resize(),o};sa.prototype.zoomTo=function(e,t){if(!l(e))throw new x("startTime is required.");if(!l(t))throw new x("stopTime is required");if(ne.lessThanOrEquals(t,e))throw new x("Start time must come before end time.");if(this._startJulian=e,this._endJulian=t,this._timeBarSecondsSpan=ne.secondsDifference(t,e),this._clock&&this._clock.clockRange!==Gh.UNBOUNDED){const i=this._clock.startTime,o=this._clock.stopTime,r=ne.secondsDifference(o,i),s=ne.secondsDifference(i,this._startJulian),a=ne.secondsDifference(o,this._endJulian);this._timeBarSecondsSpan>=r?(this._timeBarSecondsSpan=r,this._startJulian=this._clock.startTime,this._endJulian=this._clock.stopTime):s>0?(this._endJulian=ne.addSeconds(this._endJulian,s,new ne),this._startJulian=i,this._timeBarSecondsSpan=ne.secondsDifference(this._endJulian,this._startJulian)):a<0&&(this._startJulian=ne.addSeconds(this._startJulian,a,new ne),this._endJulian=o,this._timeBarSecondsSpan=ne.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)};sa.prototype.zoomFrom=function(e){let t=ne.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(ne.addSeconds(this._startJulian,t-t*e,new ne),ne.addSeconds(this._endJulian,n*e-n,new ne))};function L1(e){return e<10?`0${e.toString()}`:e.toString()}sa.prototype.makeLabel=function(e){const t=ne.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`${Cst[t.month-1]} ${t.day} ${t.year} ${L1(t.hour)}:${L1(t.minute)}:${L1(t.second)}${i}`};sa.prototype.smallestTicInPixels=7;sa.prototype._makeTics=function(){const e=this._timeBarEle,t=ne.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 f=0,h=this._timeBarSecondsSpan;h<a?(h=a,this._timeBarSecondsSpan=a,this._endJulian=ne.addSeconds(this._startJulian,a,new ne)):h>c&&(h=c,this._timeBarSecondsSpan=c,this._endJulian=ne.addSeconds(this._startJulian,c,new ne));let _=this._timeBarEle.clientWidth;_<10&&(_=10);const g=this._startJulian,p=Math.min(h/_*1e-5,.4);let y;const C=ne.toGregorianDate(g);h>31536e4?y=ne.fromDate(new Date(Date.UTC(Math.floor(C.year/100)*100,0))):h>31536e3?y=ne.fromDate(new Date(Date.UTC(Math.floor(C.year/10)*10,0))):h>86400?y=ne.fromDate(new Date(Date.UTC(C.year,0))):y=ne.fromDate(new Date(Date.UTC(C.year,C.month,C.day)));const T=ne.secondsDifference(this._startJulian,ne.addSeconds(y,p,new ne));let E=T+h;this._epochJulian=y;function w(G){return Math.floor(T/G)*G}function S(G,K){return Math.ceil(G/K+.5)*K}function P(G){return(G-T)/h}function O(G,K){return G-K*Math.round(G/K)}this._rulerEle.innerHTML=this.makeLabel(ne.addSeconds(this._endJulian,-a,new ne));let z=this._rulerEle.offsetWidth+20;z<30&&(z=180);const R=f;f-=u;const F={startTime:T,startJulian:g,epochJulian:y,duration:h,timeBarWidth:_,getAlpha:P};this._highlightRanges.forEach(function(G){s+=G.render(F)});let H=0,v=0,I=0,m=z/_;m>1&&(m=1),m*=this._timeBarSecondsSpan;let D=-1,L=-1;const M=mh.length;let V;for(V=0;V<M;++V){const G=mh[V];if(++D,H=G,G>m&&G>f)break;L<0&&_*(G/this._timeBarSecondsSpan)>=this.smallestTicInPixels&&(L=D)}if(D>0){for(;D>0;)if(--D,Math.abs(O(H,mh[D]))<1e-5){mh[D]>=f&&(v=mh[D]);break}if(L>=0)for(;L<D;){if(Math.abs(O(v,mh[L]))<1e-5&&mh[L]>=f){I=mh[L];break}++L}}f=R,f>u&&I<1e-5&&Math.abs(f-H)>u&&(I=f,f<=H+u&&(v=0));let k=-999999,W;if(_*(I/this._timeBarSecondsSpan)>=3)for(o=w(I);o<=E;o=S(o,I))s+=`<span class="cesium-timeline-ticTiny" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(v/this._timeBarSecondsSpan)>=3)for(o=w(v);o<=E;o=S(o,v))s+=`<span class="cesium-timeline-ticSub" style="left: ${Math.round(_*P(o)).toString()}px;"></span>`;if(_*(H/this._timeBarSecondsSpan)>=2){this._mainTicSpan=H,E+=H,o=w(H);const G=ne.computeTaiMinusUtc(y);for(;o<=E;){let K=ne.addSeconds(g,o-T,new ne);if(H>2.1){const X=ne.computeTaiMinusUtc(K);Math.abs(X-G)>.1&&(o+=X-G,K=ne.addSeconds(g,o-T,new ne))}const q=Math.round(_*P(o)),te=this.makeLabel(K);this._rulerEle.innerHTML=te,W=this._rulerEle.offsetWidth,W<10&&(W=z);const $=q-(W/2-1);$>k?(k=$+W+5,s+=`<span class="cesium-timeline-ticMain" style="left: ${q.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${$.toString()}px;">${te}</span>`):s+=`<span class="cesium-timeline-ticSub" style="left: ${q.toString()}px;"></span>`,o=S(o,H)}}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(G){G.render(r._context,F),F.y+=G.height})};sa.prototype.updateFromClock=function(){this._scrubJulian=this._clock.currentTime;const e=this._scrubElement;if(l(this._scrubElement)){const t=ne.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(ne.addSeconds(this._startJulian,this._timelineDrag,new ne),ne.addSeconds(this._endJulian,this._timelineDrag,new ne)))};sa.prototype._setTimeBarTime=function(e,t){if(e=Math.round(e),this._scrubJulian=ne.addSeconds(this._startJulian,t,new ne),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 Tst(e){return function(t){e._mouseMode!==qc.touchOnly&&(t.button===0?(e._mouseMode=qc.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition="-16px 0"),e._onMouseMove(t)):(e._mouseX=t.clientX,t.button===2?e._mouseMode=qc.zoom:e._mouseMode=qc.slide)),t.preventDefault()}}function bst(e){return function(t){e._mouseMode=qc.none,e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0"),e._timelineDrag=0,e._timelineDragLocation=void 0}}function Est(e){return function(t){let n;if(e._mouseMode===qc.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===qc.slide){if(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0){const i=n*e._timeBarSecondsSpan/e._topDiv.clientWidth;e.zoomTo(ne.addSeconds(e._startJulian,i,new ne),ne.addSeconds(e._endJulian,i,new ne))}}else e._mouseMode===qc.zoom&&(n=e._mouseX-t.clientX,e._mouseX=t.clientX,n!==0&&e.zoomFrom(Math.pow(1.01,n)))}}function xst(e){return function(t){let n=t.wheelDeltaY||t.wheelDelta||-t.detail;O1=Math.max(Math.min(Math.abs(n),O1),1),n/=O1,e.zoomFrom(Math.pow(1.05,-n))}}function wst(e){return function(t){const n=t.touches.length;let i,o;const r=e._topDiv.getBoundingClientRect().left;t.preventDefault(),e._mouseMode=qc.touchOnly,n===1?(i=ne.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=pa.scrub,e._scrubElement&&(e._scrubElement.style.backgroundPosition=n===1?"-16px 0":"0 0")):(e._touchMode=pa.singleTap,e._touchState.centerX=t.touches[0].clientX-r)):n===2?(e._touchMode=pa.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=pa.ignore}}function Sst(e){return function(t){const n=t.touches.length,i=e._topDiv.getBoundingClientRect().left;e._touchMode===pa.singleTap?(e._touchMode=pa.scrub,e._onTouchMove(t)):e._touchMode===pa.scrub&&e._onTouchMove(t),e._mouseMode=qc.touchOnly,n!==1?e._touchMode=n>0?pa.ignore:pa.none:e._touchMode===pa.slideZoom&&(e._touchState.centerX=t.touches[0].clientX-i),e._scrubElement&&(e._scrubElement.style.backgroundPosition="0 0")}}function vst(e){return function(t){let n,i,o,r,s,a,c=1;const u=e._topDiv.getBoundingClientRect().left;e._touchMode===pa.singleTap&&(e._touchMode=pa.slideZoom),e._mouseMode=qc.touchOnly,e._touchMode===pa.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===pa.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=ne.addSeconds(e._startJulian,(e._touchState.centerX*e._timeBarSecondsSpan-r*e._timeBarSecondsSpan*c)/e._topDiv.clientWidth,new ne)):(n=e._touchState.centerX-r,a=ne.addSeconds(e._startJulian,n*e._timeBarSecondsSpan/e._topDiv.clientWidth,new ne)),e.zoomTo(a,ne.addSeconds(a,e._timeBarSecondsSpan*c,new ne)),e._touchState.centerX=r,e._touchState.spanX=s))}}sa.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 Dst={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:Ist,mp4:Pst}=Dst,B1=()=>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,R1=()=>"wakeLock"in navigator;class Ost{constructor(){if(this.enabled=!1,R1()){this._wakeLock=null;const t=()=>{this._wakeLock!==null&&document.visibilityState==="visible"&&this.enable()};document.addEventListener("visibilitychange",t),document.addEventListener("fullscreenchange",t)}else B1()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm",Ist),this._addSourceToVideo(this.noSleepVideo,"mp4",Pst),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 R1()?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}):B1()?(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(){R1()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):B1()?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 Lst=Ost;function Bst(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 qee(){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 Rst(e,t,n,i){i()||(n()?(t.useWebVR=!1,e._locked&&(qee(),e._locked=!1),e._noSleep.disable(),$r.exitFullscreen(),n(!1)):($r.fullscreen||$r.requestFullscreen(e._vrElement),e._noSleep.enable(),e._locked||(e._locked=Bst("landscape")),t.useWebVR=!0,n(!0)))}function OD(e,t){if(!l(e))throw new x("scene is required.");const n=this,i=et.observable($r.enabled),o=et.observable(!1);this.isVRMode=void 0,et.defineProperty(this,"isVRMode",{get:function(){return o()}}),this.isVREnabled=void 0,et.defineProperty(this,"isVREnabled",{get:function(){return i()},set:function(s){i(s&&$r.enabled)}}),this.tooltip=void 0,et.defineProperty(this,"tooltip",function(){return i()?o()?"Exit VR mode":"Enter VR mode":"VR mode is unavailable"});const r=et.observable(!1);this._isOrthographic=void 0,et.defineProperty(this,"_isOrthographic",{get:function(){return r()}}),this._eventHelper=new Cf,this._eventHelper.add(e.preRender,function(){r(e.camera.frustum instanceof Ft)}),this._locked=!1,this._noSleep=new Lst,this._command=Xo(function(){Rst(n,e,o,r)},et.getObservable(this,"isVREnabled")),this._vrElement=A(cr(t),document.body),this._callback=function(){!$r.fullscreen&&o()&&(e.useWebVR=!1,n._locked&&(qee(),n._locked=!1),n._noSleep.disable(),o(!1))},document.addEventListener($r.changeEventName,this._callback)}Object.defineProperties(OD.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}}});OD.prototype.isDestroyed=function(){return!1};OD.prototype.destroy=function(){this._eventHelper.removeAll(),document.removeEventListener($r.changeEventName,this._callback),Ue(this)};const Nst="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",Mst="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 LD(e,t,n){if(!l(e))throw new x("container is required.");if(!l(t))throw new x("scene is required.");e=cr(e);const i=new OD(t,n);i._exitVRPath=Mst,i._enterVRPath=Nst;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),et.applyBindings(i,o),this._container=e,this._viewModel=i,this._element=o}Object.defineProperties(LD.prototype,{container:{get:function(){return this._container}},viewModel:{get:function(){return this._viewModel}}});LD.prototype.isDestroyed=function(){return!1};LD.prototype.destroy=function(){return this._viewModel.destroy(),et.cleanNode(this._element),this._container.removeChild(this._element),Ue(this)};const Fh=new fe;function Yee(e){const t=e.clock;t.currentTime=e.timeJulian,t.shouldAnimate=!1}function Fst(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 zst(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 l8(e,t){const n=e.scene.pick(t.position);if(l(n)){const i=A(n.id,n.primitive.id);if(i instanceof Er)return i;if(n instanceof as)return new Er({name:zst(n),description:Fst(n),feature:n})}if(l(e.scene.globe))return Vst(e,t.position)}const Ust=new ne;function $ee(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;ne.equals(o,r)&&(r=ne.addSeconds(o,N.EPSILON2,Ust)),e.updateFromClock(),e.zoomTo(o,r)}}}const Hst=new d;function Vst(e,t){const n=e.scene,i=n.camera.getPickRay(t),o=n.imageryLayers.pickImageryLayerFeatures(i,n);if(!l(o))return;const r=new Er({id:"Loading...",description:"Loading feature information..."});return o.then(function(s){if(e.selectedEntity!==r)return;if(!l(s)||s.length===0){e.selectedEntity=u8();return}const a=s[0],c=new Er({id:a.name,description:a.description});if(l(a.position)){const u=e.scene.globe.ellipsoid.cartographicToCartesian(a.position,Hst);c.position=new _d(u)}e.selectedEntity=c},function(){e.selectedEntity===r&&(e.selectedEntity=u8())}),r}function u8(){return new Er({id:"None",description:"No features found."})}function kst(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,f=e._infoBox,h=e._selectionIndicator,_=t?"hidden":"visible";if(l(n)&&(n.container.style.visibility=_),l(i)&&(i.container.style.visibility=_),l(o)&&(o.container.style.visibility=_),l(r)&&(r.container.style.visibility=_),l(s)&&(s.container.style.visibility=_),l(a)&&(a.container.style.visibility=_),l(c)&&(c.container.style.visibility=_),l(u)&&u.viewModel.isFullscreenEnabled&&(u.container.style.visibility=_),l(f)&&(f.container.style.visibility=_),l(h)&&(h.container.style.visibility=_),e._container){const g=t||!l(u)?0:u.container.clientWidth;e._vrButton.container.style.right=`${g}px`,e.forceResize()}}function $n(e,t){if(!l(e))throw new x("container is required.");e=cr(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,f=!1;l(t.clockViewModel)?(u=t.clockViewModel,c=u.clock):(c=new MT,u=new yb(c),f=!0),l(t.shouldAnimate)&&(c.shouldAnimate=t.shouldAnimate);const h=new M_(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 _=t.dataSources,g=!1;l(_)||(_=new Sa,g=!0);const p=h.scene,y=new hl({scene:p,dataSourceCollection:_}),C=new Cf;C.add(c.onTick,$n.prototype._onTick,this),C.add(p.morphStart,$n.prototype._clearTrackedObject,this);let T;if(!l(t.selectionIndicator)||t.selectionIndicator!==!1){const q=document.createElement("div");q.className="cesium-viewer-selectionIndicatorContainer",o.appendChild(q),T=new PD(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 xD(q);const te=E.viewModel;C.add(te.cameraClicked,$n.prototype._onInfoBoxCameraClicked,this),C.add(te.closeClicked,$n.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 bD({container:q,geocoderServices:te,scene:p}),C.add(S.viewModel.search.beforeExecute,$n.prototype._clearObjects,this)}let P;if((!l(t.homeButton)||t.homeButton!==!1)&&(P=new ED(w,p),l(S)&&C.add(P.viewModel.command.afterExecute,function(){const q=S.viewModel;q.searchText="",q.isSearchInProgress&&q.search()}),C.add(P.viewModel.command.beforeExecute,$n.prototype._clearTrackedObject,this)),t.sceneModePicker===!0&&a)throw new x("options.sceneModePicker is not available when options.scene3DOnly is set to true.");let O;!a&&(!l(t.sceneModePicker)||t.sceneModePicker!==!1)&&(O=new ID(w,p));let z;t.projectionPicker&&(z=new vD(w,p));let R,F;if(n){const q=A(t.imageryProviderViewModels,Zrt()),te=A(t.terrainProviderViewModels,est());R=new AD(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 H;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{}H=new wD({container:w,instructionsInitiallyVisible:A(t.navigationInstructionsInitiallyVisible,q)})}let v;if(!l(t.animation)||t.animation!==!1){const q=document.createElement("div");q.className="cesium-viewer-animationContainer",o.appendChild(q),v=new b0(q,new Zc(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 sa(q,c),I.addEventListener("settime",Yee,!1),I.zoomTo(c.startTime,c.stopTime)}let m,D,L;(!l(t.fullscreenButton)||t.fullscreenButton!==!1)&&(L=document.createElement("div"),L.className="cesium-viewer-fullscreenContainer",o.appendChild(L),m=new TD(L,t.fullscreenElement),D=Vc(m.viewModel,"isFullscreenEnabled",function(q){L.style.display=q?"block":"none",l(I)&&(I.container.style.right=`${L.clientWidth}px`,I.resize())}));let M,V,k;if(t.vrButton){const q=document.createElement("div");q.className="cesium-viewer-vrContainer",o.appendChild(q),M=new LD(q,p,t.fullScreenElement),V=Vc(M.viewModel,"isVREnabled",function(te){q.style.display=te?"block":"none",l(m)&&(q.style.right=`${L.clientWidth}px`),l(I)&&(I.container.style.right=`${q.clientWidth}px`,I.resize())}),k=Vc(M.viewModel,"isVRMode",function(te){kst(i,te)})}this._baseLayerPickerDropDown=F,this._fullscreenSubscription=D,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=T,this._infoBox=E,this._dataSourceCollection=_,this._destroyDataSourceCollection=g,this._dataSourceDisplay=y,this._clockViewModel=u,this._destroyClockViewModel=f,this._toolbar=w,this._homeButton=P,this._sceneModePicker=O,this._projectionPicker=z,this._baseLayerPicker=R,this._navigationHelpButton=H,this._animation=v,this._timeline=I,this._fullscreenButton=m,this._vrButton=M,this._geocoder=S,this._eventHelper=C,this._lastWidth=0,this._lastHeight=0,this._allowDataSourcesToSuspendAnimation=!0,this._entityView=void 0,this._enableInfoOrSelection=l(E)||l(T),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 $e,this._trackedEntityChanged=new $e,et.track(this,["_trackedEntity","_selectedEntity","_clockTrackedDataSource"]),C.add(_.dataSourceAdded,$n.prototype._onDataSourceAdded,this),C.add(_.dataSourceRemoved,$n.prototype._onDataSourceRemoved,this),C.add(p.postUpdate,$n.prototype.resize,this),C.add(p.postRender,$n.prototype._postRender,this);const W=_.length;for(let q=0;q<W;q++)this._dataSourceAdded(_,_.get(q));this._dataSourceAdded(void 0,y.defaultDataSource),C.add(_.dataSourceAdded,$n.prototype._dataSourceAdded,this),C.add(_.dataSourceRemoved,$n.prototype._dataSourceRemoved,this);function G(q){const te=l8(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=l8(i,q)}h.screenSpaceEventHandler.setInputAction(K,Bn.LEFT_CLICK),h.screenSpaceEventHandler.setInputAction(G,Bn.LEFT_DOUBLE_CLICK)}Object.defineProperties($n.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,XS(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,$ee(this._timeline,this.clock,e))}}});$n.prototype.extend=function(e,t){if(!l(e))throw new x("mixin is required.");e(this,t)};$n.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,f=0,h=0,_=0;if(o&&window.getComputedStyle(this._animation.container).visibility!=="hidden"){const g=this._lastWidth;u=this._animation.container,n>900?(f=169,g<=900&&(u.style.width="169px",u.style.height="112px",this._animation.resize())):n>=600?(f=136,(g<600||g>900)&&(u.style.width="136px",u.style.height="90px",this._animation.resize())):(f=106,(g>600||g===0)&&(u.style.width="106px",u.style.height="70px",this._animation.resize())),h=f+5}if(r&&window.getComputedStyle(this._timeline.container).visibility!=="hidden"){const g=this._fullscreenButton,p=this._vrButton,y=c.container,C=y.style;_=y.clientHeight+3,C.left=`${f}px`;let T=0;l(g)&&(T+=g.container.clientWidth),l(p)&&(T+=p.container.clientWidth),C.right=`${T}px`,c.resize()}this._bottomContainer.style.left=`${h}px`,this._bottomContainer.style.bottom=`${_}px`,this._lastWidth=n,this._lastHeight=i};$n.prototype.forceResize=function(){this._lastWidth=0,this.resize()};$n.prototype.render=function(){this._cesiumWidget.render()};$n.prototype.isDestroyed=function(){return!1};$n.prototype.destroy=function(){let e;this.screenSpaceEventHandler.removeInputAction(Bn.LEFT_CLICK),this.screenSpaceEventHandler.removeInputAction(Bn.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",Yee,!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()),Ue(this)};$n.prototype._dataSourceAdded=function(e,t){t.entities.collectionChanged.addEventListener($n.prototype._onEntityCollectionChanged,this)};$n.prototype._dataSourceRemoved=function(e,t){const n=t.entities;n.collectionChanged.removeEventListener($n.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)};$n.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 f=this._trackedEntity;this._dataSourceDisplay.getBoundingSphere(f,!1,Fh)===pt.DONE&&i.update(t,Fh)}let o,r=!1;const s=this.selectedEntity,a=l(s)&&this._enableInfoOrSelection;a&&s.isShowing&&s.isAvailable(t)&&(this._dataSourceDisplay.getBoundingSphere(s,!0,Fh)!==pt.FAILED?o=Fh.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=d.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=""))};$n.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)}};$n.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)}};$n.prototype._clearTrackedObject=function(){this.trackedEntity=void 0};$n.prototype._onInfoBoxClockClicked=function(e){this.selectedEntity=void 0};$n.prototype._clearObjects=function(){this.trackedEntity=void 0,this.selectedEntity=void 0};$n.prototype._onDataSourceChanged=function(e){this.clockTrackedDataSource===e&&$ee(this.timeline,this.clock,e)};$n.prototype._onDataSourceAdded=function(e,t){this._automaticallyTrackDataSourceClocks&&(this.clockTrackedDataSource=t);const n=t.entities.id,i=this._eventHelper.add(t.changedEvent,$n.prototype._onDataSourceChanged,this);this._dataSourceChangedListeners[n]=i};$n.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}};$n.prototype.zoomTo=function(e,t){return Xee(this,e,{offset:t},!1)};$n.prototype.flyTo=function(e,t){return Xee(this,e,t,!0)};function Xee(e,t,n,i){if(!l(t))throw new x("zoomTarget is required.");XS(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 Ln){r.getViewableRectangle().then(function(s){return yD(s,e.scene)}).then(function(s){e._zoomPromise===o&&(e._zoomTarget=s)});return}if(r instanceof xr||r instanceof Np||r instanceof tu){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 jg(e){e._zoomPromise=void 0,e._zoomTarget=void 0,e._zoomOptions=void 0}function XS(e){const t=e._zoomPromise;l(t)&&(jg(e),e._completeZoom(!1))}$n.prototype._postRender=function(){Gst(this),Wst(this)};function Gst(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 xr||t instanceof tu)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new t_(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)),jg(e)}).catch(()=>{XS(e)});if(t instanceof Np)return t.readyPromise.then(function(){const u=t.boundingSphere;l(o.offset)||(o.offset=new t_(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)),jg(e)});if(t instanceof Ae){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)),jg(e);return}const s=t,a=[];for(let u=0,f=s.length;u<f;u++){const h=e._dataSourceDisplay.getBoundingSphere(s[u],!1,Fh);if(h===pt.PENDING)return;h!==pt.FAILED&&a.push(fe.clone(Fh))}if(a.length===0){XS(e);return}e.trackedEntity=void 0;const c=fe.fromBoundingSpheres(a);e._zoomIsFlight?(jg(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),jg(e),e._completeZoom(!0))}function Wst(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,Fh);if(r===pt.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!==pt.FAILED?Fh:void 0;e._entityView=new yT(t,o,o.mapProjection.ellipsoid),e._entityView.update(n,a),e._needTrackedEntityUpdate=!1}function Kee(e,t){return function(){return e.apply(t,arguments)}}const{toString:Jee}=Object.prototype,{getPrototypeOf:GF}=Object,WF=(e=>t=>{const n=Jee.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Wd=e=>(e=e.toLowerCase(),t=>WF(t)===e),BD=e=>t=>typeof t===e,{isArray:E0}=Array,TT=BD("undefined");function jst(e){return e!==null&&!TT(e)&&e.constructor!==null&&!TT(e.constructor)&&m_(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Qee=Wd("ArrayBuffer");function qst(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Qee(e.buffer),t}const Yst=BD("string"),m_=BD("function"),Zee=BD("number"),jF=e=>e!==null&&typeof e=="object",$st=e=>e===!0||e===!1,Rw=e=>{if(WF(e)!=="object")return!1;const t=GF(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Xst=Wd("Date"),Kst=Wd("File"),Jst=Wd("Blob"),Qst=Wd("FileList"),Zst=e=>jF(e)&&m_(e.pipe),eat=e=>{const t="[object FormData]";return e&&(typeof FormData=="function"&&e instanceof FormData||Jee.call(e)===t||m_(e.toString)&&e.toString()===t)},tat=Wd("URLSearchParams"),nat=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Cb(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let i,o;if(typeof e!="object"&&(e=[e]),E0(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 ete(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 tte=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),nte=e=>!TT(e)&&e!==tte;function dR(){const{caseless:e}=nte(this)&&this||{},t={},n=(i,o)=>{const r=e&&ete(t,o)||o;Rw(t[r])&&Rw(i)?t[r]=dR(t[r],i):Rw(i)?t[r]=dR({},i):E0(i)?t[r]=i.slice():t[r]=i};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&Cb(arguments[i],n);return t}const iat=(e,t,n,{allOwnKeys:i}={})=>(Cb(t,(o,r)=>{n&&m_(o)?e[r]=Kee(o,n):e[r]=o},{allOwnKeys:i}),e),oat=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),rat=(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)},sat=(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&&GF(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},aat=(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},cat=e=>{if(!e)return null;if(E0(e))return e;let t=e.length;if(!Zee(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},lat=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&GF(Uint8Array)),uat=(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])}},fat=(e,t)=>{let n;const i=[];for(;(n=e.exec(t))!==null;)i.push(n);return i},dat=Wd("HTMLFormElement"),hat=e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,function(n,i,o){return i.toUpperCase()+o}),f8=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),pat=Wd("RegExp"),ite=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),i={};Cb(n,(o,r)=>{t(o,r,e)!==!1&&(i[r]=o)}),Object.defineProperties(e,i)},mat=e=>{ite(e,(t,n)=>{if(m_(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const i=e[n];if(m_(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+"'")})}})},_at=(e,t)=>{const n={},i=o=>{o.forEach(r=>{n[r]=!0})};return E0(e)?i(e):i(String(e).split(t)),n},gat=()=>{},yat=(e,t)=>(e=+e,Number.isFinite(e)?e:t),Aat=e=>{const t=new Array(10),n=(i,o)=>{if(jF(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[o]=i;const r=E0(i)?[]:{};return Cb(i,(s,a)=>{const c=n(s,o+1);!TT(c)&&(r[a]=c)}),t[o]=void 0,r}}return i};return n(e,0)},We={isArray:E0,isArrayBuffer:Qee,isBuffer:jst,isFormData:eat,isArrayBufferView:qst,isString:Yst,isNumber:Zee,isBoolean:$st,isObject:jF,isPlainObject:Rw,isUndefined:TT,isDate:Xst,isFile:Kst,isBlob:Jst,isRegExp:pat,isFunction:m_,isStream:Zst,isURLSearchParams:tat,isTypedArray:lat,isFileList:Qst,forEach:Cb,merge:dR,extend:iat,trim:nat,stripBOM:oat,inherits:rat,toFlatObject:sat,kindOf:WF,kindOfTest:Wd,endsWith:aat,toArray:cat,forEachEntry:uat,matchAll:fat,isHTMLForm:dat,hasOwnProperty:f8,hasOwnProp:f8,reduceDescriptors:ite,freezeMethods:mat,toObjectSet:_at,toCamelCase:hat,noop:gat,toFiniteNumber:yat,findKey:ete,global:tte,isContextDefined:nte,toJSONObject:Aat};function hi(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)}We.inherits(hi,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:We.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const ote=hi.prototype,rte={};["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=>{rte[e]={value:e}});Object.defineProperties(hi,rte);Object.defineProperty(ote,"isAxiosError",{value:!0});hi.from=(e,t,n,i,o,r)=>{const s=Object.create(ote);return We.toFlatObject(e,s,function(c){return c!==Error.prototype},a=>a!=="isAxiosError"),hi.call(s,e.message,t,n,i,o),s.cause=e,s.name=e.name,r&&Object.assign(s,r),s};var Cat=typeof self=="object"?self.FormData:window.FormData;const Tat=Cat;function hR(e){return We.isPlainObject(e)||We.isArray(e)}function ste(e){return We.endsWith(e,"[]")?e.slice(0,-2):e}function d8(e,t,n){return e?e.concat(t).map(function(o,r){return o=ste(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function bat(e){return We.isArray(e)&&!e.some(hR)}const Eat=We.toFlatObject(We,{},null,function(t){return/^is[A-Z]/.test(t)});function xat(e){return e&&We.isFunction(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator]}function RD(e,t,n){if(!We.isObject(e))throw new TypeError("target must be an object");t=t||new(Tat||FormData),n=We.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,C){return!We.isUndefined(C[y])});const i=n.metaTokens,o=n.visitor||f,r=n.dots,s=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&xat(t);if(!We.isFunction(o))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(We.isDate(p))return p.toISOString();if(!c&&We.isBlob(p))throw new hi("Blob is not supported. Use a Buffer instead.");return We.isArrayBuffer(p)||We.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,y,C){let T=p;if(p&&!C&&typeof p=="object"){if(We.endsWith(y,"{}"))y=i?y:y.slice(0,-2),p=JSON.stringify(p);else if(We.isArray(p)&&bat(p)||We.isFileList(p)||We.endsWith(y,"[]")&&(T=We.toArray(p)))return y=ste(y),T.forEach(function(w,S){!(We.isUndefined(w)||w===null)&&t.append(s===!0?d8([y],S,r):s===null?y:y+"[]",u(w))}),!1}return hR(p)?!0:(t.append(d8(C,y,r),u(p)),!1)}const h=[],_=Object.assign(Eat,{defaultVisitor:f,convertValue:u,isVisitable:hR});function g(p,y){if(!We.isUndefined(p)){if(h.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));h.push(p),We.forEach(p,function(T,E){(!(We.isUndefined(T)||T===null)&&o.call(t,T,We.isString(E)?E.trim():E,y,_))===!0&&g(T,y?y.concat(E):[E])}),h.pop()}}if(!We.isObject(e))throw new TypeError("data must be an object");return g(e),t}function h8(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function qF(e,t){this._pairs=[],e&&RD(e,this,t)}const ate=qF.prototype;ate.append=function(t,n){this._pairs.push([t,n])};ate.toString=function(t){const n=t?function(i){return t.call(this,i,h8)}:h8;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function wat(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function cte(e,t,n){if(!t)return e;const i=n&&n.encode||wat,o=n&&n.serialize;let r;if(o?r=o(t,n):r=We.isURLSearchParams(t)?t.toString():new qF(t,n).toString(i),r){const s=e.indexOf("#");s!==-1&&(e=e.slice(0,s)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class Sat{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){We.forEach(this.handlers,function(i){i!==null&&t(i)})}}const p8=Sat,lte={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},vat=typeof URLSearchParams<"u"?URLSearchParams:qF,Dat=FormData,Iat=(()=>{let e;return typeof navigator<"u"&&((e=navigator.product)==="ReactNative"||e==="NativeScript"||e==="NS")?!1:typeof window<"u"&&typeof document<"u"})(),Pat=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Mu={isBrowser:!0,classes:{URLSearchParams:vat,FormData:Dat,Blob},isStandardBrowserEnv:Iat,isStandardBrowserWebWorkerEnv:Pat,protocols:["http","https","file","blob","url","data"]};function Oat(e,t){return RD(e,new Mu.classes.URLSearchParams,Object.assign({visitor:function(n,i,o,r){return Mu.isNode&&We.isBuffer(n)?(this.append(i,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function Lat(e){return We.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Bat(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 ute(e){function t(n,i,o,r){let s=n[r++];const a=Number.isFinite(+s),c=r>=n.length;return s=!s&&We.isArray(o)?o.length:s,c?(We.hasOwnProp(o,s)?o[s]=[o[s],i]:o[s]=i,!a):((!o[s]||!We.isObject(o[s]))&&(o[s]=[]),t(n,i,o[s],r)&&We.isArray(o[s])&&(o[s]=Bat(o[s])),!a)}if(We.isFormData(e)&&We.isFunction(e.entries)){const n={};return We.forEachEntry(e,(i,o)=>{t(Lat(i),o,n,0)}),n}return null}const Rat={"Content-Type":void 0};function Nat(e,t,n){if(We.isString(e))try{return(t||JSON.parse)(e),We.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(n||JSON.stringify)(e)}const ND={transitional:lte,adapter:["xhr","http"],transformRequest:[function(t,n){const i=n.getContentType()||"",o=i.indexOf("application/json")>-1,r=We.isObject(t);if(r&&We.isHTMLForm(t)&&(t=new FormData(t)),We.isFormData(t))return o&&o?JSON.stringify(ute(t)):t;if(We.isArrayBuffer(t)||We.isBuffer(t)||We.isStream(t)||We.isFile(t)||We.isBlob(t))return t;if(We.isArrayBufferView(t))return t.buffer;if(We.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 Oat(t,this.formSerializer).toString();if((a=We.isFileList(t))||i.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return RD(a?{"files[]":t}:t,c&&new c,this.formSerializer)}}return r||o?(n.setContentType("application/json",!1),Nat(t)):t}],transformResponse:[function(t){const n=this.transitional||ND.transitional,i=n&&n.forcedJSONParsing,o=this.responseType==="json";if(t&&We.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"?hi.from(a,hi.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:Mu.classes.FormData,Blob:Mu.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};We.forEach(["delete","get","head"],function(t){ND.headers[t]={}});We.forEach(["post","put","patch"],function(t){ND.headers[t]=We.merge(Rat)});const YF=ND,Mat=We.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"]),Fat=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]&&Mat[n])&&(n==="set-cookie"?t[n]?t[n].push(i):t[n]=[i]:t[n]=t[n]?t[n]+", "+i:i)}),t},m8=Symbol("internals");function DA(e){return e&&String(e).trim().toLowerCase()}function Nw(e){return e===!1||e==null?e:We.isArray(e)?e.map(Nw):String(e)}function zat(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 Uat(e){return/^[-_a-zA-Z]+$/.test(e.trim())}function _8(e,t,n,i){if(We.isFunction(i))return i.call(this,t,n);if(We.isString(t)){if(We.isString(i))return t.indexOf(i)!==-1;if(We.isRegExp(i))return i.test(t)}}function Hat(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,i)=>n.toUpperCase()+i)}function Vat(e,t){const n=We.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 MD{constructor(t){t&&this.set(t)}set(t,n,i){const o=this;function r(a,c,u){const f=DA(c);if(!f)throw new Error("header name must be a non-empty string");const h=We.findKey(o,f);(!h||o[h]===void 0||u===!0||u===void 0&&o[h]!==!1)&&(o[h||c]=Nw(a))}const s=(a,c)=>We.forEach(a,(u,f)=>r(u,f,c));return We.isPlainObject(t)||t instanceof this.constructor?s(t,n):We.isString(t)&&(t=t.trim())&&!Uat(t)?s(Fat(t),n):t!=null&&r(n,t,i),this}get(t,n){if(t=DA(t),t){const i=We.findKey(this,t);if(i){const o=this[i];if(!n)return o;if(n===!0)return zat(o);if(We.isFunction(n))return n.call(this,o,i);if(We.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=DA(t),t){const i=We.findKey(this,t);return!!(i&&(!n||_8(this,this[i],i,n)))}return!1}delete(t,n){const i=this;let o=!1;function r(s){if(s=DA(s),s){const a=We.findKey(i,s);a&&(!n||_8(i,i[a],a,n))&&(delete i[a],o=!0)}}return We.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 We.forEach(this,(o,r)=>{const s=We.findKey(i,r);if(s){n[s]=Nw(o),delete n[r];return}const a=t?Hat(r):String(r).trim();a!==r&&delete n[r],n[a]=Nw(o),i[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return We.forEach(this,(i,o)=>{i!=null&&i!==!1&&(n[o]=t&&We.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[m8]=this[m8]={accessors:{}}).accessors,o=this.prototype;function r(s){const a=DA(s);i[a]||(Vat(o,s),i[a]=!0)}return We.isArray(t)?t.forEach(r):r(t),this}}MD.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]);We.freezeMethods(MD.prototype);We.freezeMethods(MD);const cd=MD;function N1(e,t){const n=this||YF,i=t||n,o=cd.from(i.headers);let r=i.data;return We.forEach(e,function(a){r=a.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function fte(e){return!!(e&&e.__CANCEL__)}function Tb(e,t,n){hi.call(this,e??"canceled",hi.ERR_CANCELED,t,n),this.name="CanceledError"}We.inherits(Tb,hi,{__CANCEL__:!0});const kat=null;function Gat(e,t,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?e(n):t(new hi("Request failed with status code "+n.status,[hi.ERR_BAD_REQUEST,hi.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Wat=Mu.isStandardBrowserEnv?function(){return{write:function(n,i,o,r,s,a){const c=[];c.push(n+"="+encodeURIComponent(i)),We.isNumber(o)&&c.push("expires="+new Date(o).toGMTString()),We.isString(r)&&c.push("path="+r),We.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 jat(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qat(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function dte(e,t){return e&&!jat(t)?qat(e,t):t}const Yat=Mu.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=We.isString(s)?o(s):s;return a.protocol===i.protocol&&a.host===i.host}}():function(){return function(){return!0}}();function $at(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Xat(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(),f=i[r];s||(s=u),n[o]=c,i[o]=u;let h=r,_=0;for(;h!==o;)_+=n[h++],h=h%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),u-s<t)return;const g=f&&u-f;return g?Math.round(_*1e3/g):void 0}}function g8(e,t){let n=0;const i=Xat(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 f={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};f[t?"download":"upload"]=!0,e(f)}}const Kat=typeof XMLHttpRequest<"u",Jat=Kat&&function(e){return new Promise(function(n,i){let o=e.data;const r=cd.from(e.headers).normalize(),s=e.responseType;let a;function c(){e.cancelToken&&e.cancelToken.unsubscribe(a),e.signal&&e.signal.removeEventListener("abort",a)}We.isFormData(o)&&(Mu.isStandardBrowserEnv||Mu.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 f=dte(e.baseURL,e.url);u.open(e.method.toUpperCase(),cte(f,e.params,e.paramsSerializer),!0),u.timeout=e.timeout;function h(){if(!u)return;const g=cd.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};Gat(function(T){n(T),c()},function(T){i(T),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 hi("Request aborted",hi.ECONNABORTED,e,u)),u=null)},u.onerror=function(){i(new hi("Network Error",hi.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||lte;e.timeoutErrorMessage&&(p=e.timeoutErrorMessage),i(new hi(p,y.clarifyTimeoutError?hi.ETIMEDOUT:hi.ECONNABORTED,e,u)),u=null},Mu.isStandardBrowserEnv){const g=(e.withCredentials||Yat(f))&&e.xsrfCookieName&&Wat.read(e.xsrfCookieName);g&&r.set(e.xsrfHeaderName,g)}o===void 0&&r.setContentType(null),"setRequestHeader"in u&&We.forEach(r.toJSON(),function(p,y){u.setRequestHeader(y,p)}),We.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),s&&s!=="json"&&(u.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&u.addEventListener("progress",g8(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",g8(e.onUploadProgress)),(e.cancelToken||e.signal)&&(a=g=>{u&&(i(!g||g.type?new Tb(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 _=$at(f);if(_&&Mu.protocols.indexOf(_)===-1){i(new hi("Unsupported protocol "+_+":",hi.ERR_BAD_REQUEST,e));return}u.send(o||null)})},Mw={http:kat,xhr:Jat};We.forEach(Mw,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Qat={getAdapter:e=>{e=We.isArray(e)?e:[e];const{length:t}=e;let n,i;for(let o=0;o<t&&(n=e[o],!(i=We.isString(n)?Mw[n.toLowerCase()]:n));o++);if(!i)throw i===!1?new hi(`Adapter ${n} is not supported by the environment`,"ERR_NOT_SUPPORT"):new Error(We.hasOwnProp(Mw,n)?`Adapter '${n}' is not available in the build`:`Unknown adapter '${n}'`);if(!We.isFunction(i))throw new TypeError("adapter is not a function");return i},adapters:Mw};function M1(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Tb(null,e)}function y8(e){return M1(e),e.headers=cd.from(e.headers),e.data=N1.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Qat.getAdapter(e.adapter||YF.adapter)(e).then(function(i){return M1(e),i.data=N1.call(e,e.transformResponse,i),i.headers=cd.from(i.headers),i},function(i){return fte(i)||(M1(e),i&&i.response&&(i.response.data=N1.call(e,e.transformResponse,i.response),i.response.headers=cd.from(i.response.headers))),Promise.reject(i)})}const A8=e=>e instanceof cd?e.toJSON():e;function $y(e,t){t=t||{};const n={};function i(u,f,h){return We.isPlainObject(u)&&We.isPlainObject(f)?We.merge.call({caseless:h},u,f):We.isPlainObject(f)?We.merge({},f):We.isArray(f)?f.slice():f}function o(u,f,h){if(We.isUndefined(f)){if(!We.isUndefined(u))return i(void 0,u,h)}else return i(u,f,h)}function r(u,f){if(!We.isUndefined(f))return i(void 0,f)}function s(u,f){if(We.isUndefined(f)){if(!We.isUndefined(u))return i(void 0,u)}else return i(void 0,f)}function a(u,f,h){if(h in t)return i(u,f);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,f)=>o(A8(u),A8(f),!0)};return We.forEach(Object.keys(e).concat(Object.keys(t)),function(f){const h=c[f]||o,_=h(e[f],t[f],f);We.isUndefined(_)&&h!==a||(n[f]=_)}),n}const hte="1.2.2",$F={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{$F[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}});const C8={};$F.transitional=function(t,n,i){function o(r,s){return"[Axios v"+hte+"] Transitional option '"+r+"'"+s+(i?". "+i:"")}return(r,s,a)=>{if(t===!1)throw new hi(o(s," has been removed"+(n?" in "+n:"")),hi.ERR_DEPRECATED);return n&&!C8[s]&&(C8[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 Zat(e,t,n){if(typeof e!="object")throw new hi("options must be an object",hi.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 hi("option "+r+" must be "+c,hi.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new hi("Unknown option "+r,hi.ERR_BAD_OPTION)}}const pR={assertOptions:Zat,validators:$F},_h=pR.validators;class KS{constructor(t){this.defaults=t,this.interceptors={request:new p8,response:new p8}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$y(this.defaults,n);const{transitional:i,paramsSerializer:o,headers:r}=n;i!==void 0&&pR.assertOptions(i,{silentJSONParsing:_h.transitional(_h.boolean),forcedJSONParsing:_h.transitional(_h.boolean),clarifyTimeoutError:_h.transitional(_h.boolean)},!1),o!==void 0&&pR.assertOptions(o,{encode:_h.function,serialize:_h.function},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s;s=r&&We.merge(r.common,r[n.method]),s&&We.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),n.headers=cd.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 f,h=0,_;if(!c){const p=[y8.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,u),_=p.length,f=Promise.resolve(n);h<_;)f=f.then(p[h++],p[h++]);return f}_=a.length;let g=n;for(h=0;h<_;){const p=a[h++],y=a[h++];try{g=p(g)}catch(C){y.call(this,C);break}}try{f=y8.call(this,g)}catch(p){return Promise.reject(p)}for(h=0,_=u.length;h<_;)f=f.then(u[h++],u[h++]);return f}getUri(t){t=$y(this.defaults,t);const n=dte(t.baseURL,t.url);return cte(n,t.params,t.paramsSerializer)}}We.forEach(["delete","get","head","options"],function(t){KS.prototype[t]=function(n,i){return this.request($y(i||{},{method:t,url:n,data:(i||{}).data}))}});We.forEach(["post","put","patch"],function(t){function n(i){return function(r,s,a){return this.request($y(a||{},{method:t,headers:i?{"Content-Type":"multipart/form-data"}:{},url:r,data:s}))}}KS.prototype[t]=n(),KS.prototype[t+"Form"]=n(!0)});const Fw=KS;class XF{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 Tb(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 XF(function(o){t=o}),cancel:t}}}const ect=XF;function tct(e){return function(n){return e.apply(null,n)}}function nct(e){return We.isObject(e)&&e.isAxiosError===!0}const mR={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(mR).forEach(([e,t])=>{mR[t]=e});const ict=mR;function pte(e){const t=new Fw(e),n=Kee(Fw.prototype.request,t);return We.extend(n,Fw.prototype,t,{allOwnKeys:!0}),We.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return pte($y(e,o))},n}const kr=pte(YF);kr.Axios=Fw;kr.CanceledError=Tb;kr.CancelToken=ect;kr.isCancel=fte;kr.VERSION=hte;kr.toFormData=RD;kr.AxiosError=hi;kr.Cancel=kr.CanceledError;kr.all=function(t){return Promise.all(t)};kr.spread=tct;kr.isAxiosError=nct;kr.mergeConfig=$y;kr.AxiosHeaders=cd;kr.formToJSON=e=>ute(We.isHTMLForm(e)?new FormData(e):e);kr.HttpStatusCode=ict;kr.default=kr;const oct=kr,rct="https://celestrak.org";function sct(e=""){let t=`${rct}/NORAD/elements/gp.php?GROUP=${e}&FORMAT=tle`;return oct.get(t).then(n=>n.status===200?Promise.resolve(n.data):($fe.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 Cd=Math.PI,Qo=Cd*2,KA=Cd/180,act=1440,cct=398600.5,Ya=6378.137,Yf=60/Math.sqrt(Ya*Ya*Ya/cct),F1=Ya*Yf/60,lct=1/Yf,Lm=.00108262998905,uct=-253215306e-14,fct=-161098761e-14,Bm=uct/Lm,bT=2/3;function dct(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 f=Math.floor(c),h=(c-f)*60;return{mon:s,day:a,hr:u,minute:f,sec:h}}function T8(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 KF(e,t,n,i,o,r,s){if(e instanceof Date){var a=e;return T8(a.getUTCFullYear(),a.getUTCMonth()+1,a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds())}return T8(e,t,n,i,o,r,s)}function mte(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,f=e.se3,h=e.sgh2,_=e.sgh3,g=e.sgh4,p=e.sh2,y=e.sh3,C=e.si2,T=e.si3,E=e.sl2,w=e.sl3,S=e.sl4,P=e.t,O=e.xgh2,z=e.xgh3,R=e.xgh4,F=e.xh2,H=e.xh3,v=e.xi2,I=e.xi3,m=e.xl2,D=e.xl3,L=e.xl4,M=e.zmol,V=e.zmos,k=t.init,W=t.opsmode,G=t.ep,K=t.inclp,q=t.nodep,te=t.argpp,$=t.mp,X,Y,ae,ue,re,he,ce,Q,ie,de,me,Ee,xe,Pe,Te,Oe,De,Me,ve,Ie,Ve,Le=119459e-10,_t=.01675,Tt=.00015835218,Ot=.0549;Ve=V+Le*P,k==="y"&&(Ve=V),Ie=Ve+2*_t*Math.sin(Ve),De=Math.sin(Ie),de=.5*De*De-.25,me=-.5*De*Math.cos(Ie);var Tn=u*de+f*me,Sn=C*de+T*me,gn=E*de+w*me+S*De,on=h*de+_*me+g*De,Nt=p*de+y*me;Ve=M+Tt*P,k==="y"&&(Ve=M),Ie=Ve+2*Ot*Math.sin(Ve),De=Math.sin(Ie),de=.5*De*De-.25,me=-.5*De*Math.cos(Ie);var yn=i*de+n*me,Cn=v*de+I*me,Ht=m*de+D*me+L*De,Xt=O*de+z*me+R*De,Mn=F*de+H*me;return Ee=Tn+yn,Te=Sn+Cn,Oe=gn+Ht,xe=on+Xt,Pe=Nt+Mn,k==="n"&&(Ee-=o,Te-=a,Oe-=c,xe-=r,Pe-=s,K+=Te,G+=Ee,ue=Math.sin(K),ae=Math.cos(K),K>=.2?(Pe/=ue,xe-=ae*Pe,te+=xe,q+=Pe,$+=Oe):(he=Math.sin(q),re=Math.cos(q),X=ue*he,Y=ue*re,ce=Pe*re+Te*ae*he,Q=-Pe*he+Te*ae*re,X+=ce,Y+=Q,q%=Qo,q<0&&W==="a"&&(q+=Qo),Me=$+te+ae*q,ie=Oe+xe-Te*q*ue,Me+=ie,ve=q,q=Math.atan2(X,Y),q<0&&W==="a"&&(q+=Qo),Math.abs(ve-q)>Cd&&(q<ve?q+=Qo:q-=Qo),$+=Oe,te=Me-$-ae*q)),{ep:G,inclp:K,nodep:q,argpp:te,mp:$}}function hct(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,f,h,_,g,p,y,C,T,E,w,S,P,O,z,R,F,H,v,I,m,D,L,M,V,k,W,G,K,q,te,$,X,Y,ae,ue,re,he,ce,Q,ie,de,me,Ee,xe,Pe,Te,Oe,De,Me,ve,Ie,Ve,Le,_t,Tt,Ot,Tn,Sn,gn,on,Nt,yn=.01675,Cn=.0549,Ht=29864797e-13,Xt=47968065e-14,Mn=.39785416,ti=.91744867,en=.1945905,xi=-.98088458,Yi=a,Pi=n,Jn=Math.sin(s),cn=Math.cos(s),Vn=Math.sin(i),On=Math.cos(i),rn=Math.sin(r),gt=Math.cos(r),ke=Pi*Pi,vn=1-ke,pn=Math.sqrt(vn),Hi=0,Dn=0,Oi=0,bo=0,no=0,Dr=t+18261.5+o/1440,Vi=(4.523602-.00092422029*Dr)%Qo,Li=Math.sin(Vi),Ir=Math.cos(Vi),aa=.91375164-.03568096*Ir,yt=Math.sqrt(1-aa*aa),be=.089683511*Li/yt,je=Math.sqrt(1-be*be),tt=5.8351514+.001944368*Dr,kn=.39785416*Li/yt,Gr=je*Ir+.91744867*be*Li;kn=Math.atan2(kn,Gr),kn+=tt-Vi;var hr=Math.cos(kn),or=Math.sin(kn);v=en,I=xi,L=ti,M=Mn,m=cn,D=Jn,E=Ht;for(var jd=1/Yi,Eo=0;Eo<2;)Eo+=1,c=v*m+I*L*D,f=-I*m+v*L*D,p=-v*D+I*L*m,y=I*M,C=I*D+v*L*m,T=v*M,u=gt*p+rn*y,h=gt*C+rn*T,_=-rn*p+gt*y,g=-rn*C+gt*T,w=c*On+u*Vn,S=f*On+h*Vn,P=-c*Vn+u*On,O=-f*Vn+h*On,z=_*Vn,R=g*Vn,F=_*On,H=g*On,gn=12*w*w-3*P*P,on=24*w*S-6*P*O,Nt=12*S*S-3*O*O,ve=3*(c*c+u*u)+gn*ke,Ie=6*(c*f+u*h)+on*ke,Ve=3*(f*f+h*h)+Nt*ke,Le=-6*c*_+ke*(-24*w*F-6*P*z),_t=-6*(c*g+f*_)+ke*(-24*(S*F+w*H)+-6*(P*R+O*z)),Tt=-6*f*g+ke*(-24*S*H-6*O*R),Ot=6*u*_+ke*(24*w*z-6*P*F),Tn=6*(h*_+u*g)+ke*(24*(S*z+w*R)-6*(O*F+P*H)),Sn=6*h*g+ke*(24*S*R-6*O*H),ve=ve+ve+vn*gn,Ie=Ie+Ie+vn*on,Ve=Ve+Ve+vn*Nt,Pe=E*jd,xe=-.5*Pe/pn,Te=Pe*pn,Ee=-15*Pi*Te,Oe=w*P+S*O,De=S*P+w*O,Me=S*O-w*P,Eo===1&&(V=Ee,k=xe,W=Pe,G=Te,K=Oe,q=De,te=Me,$=ve,X=Ie,Y=Ve,ae=Le,ue=_t,re=Tt,he=Ot,ce=Tn,Q=Sn,ie=gn,de=on,me=Nt,v=hr,I=or,L=aa,M=yt,m=je*cn+be*Jn,D=Jn*je-cn*be,E=Xt);var bf=(4.7199672+(.2299715*Dr-tt))%Qo,j_=(6.2565837+.017201977*Dr)%Qo,bb=2*V*q,Mp=2*V*te,Fp=2*k*ue,FD=2*k*(re-ae),zD=-2*W*X,UD=-2*W*(Y-$),HD=-2*W*(-21-9*ke)*yn,q_=2*G*de,VD=2*G*(me-ie),kD=-18*G*yn,x0=-2*k*ce,Eb=-2*k*(Q-he),w0=2*Ee*De,GD=2*Ee*Me,WD=2*xe*_t,gte=2*xe*(Tt-Le),yte=-2*Pe*Ie,Ate=-2*Pe*(Ve-ve),Cte=-2*Pe*(-21-9*ke)*Cn,Tte=2*Te*on,bte=2*Te*(Nt-gn),Ete=-18*Te*Cn,xte=-2*xe*Tn,wte=-2*xe*(Sn-Ot);return{snodm:Jn,cnodm:cn,sinim:rn,cosim:gt,sinomm:Vn,cosomm:On,day:Dr,e3:GD,ee2:w0,em:Pi,emsq:ke,gam:tt,peo:Hi,pgho:bo,pho:no,pinco:Dn,plo:Oi,rtemsq:pn,se2:bb,se3:Mp,sgh2:q_,sgh3:VD,sgh4:kD,sh2:x0,sh3:Eb,si2:Fp,si3:FD,sl2:zD,sl3:UD,sl4:HD,s1:Ee,s2:xe,s3:Pe,s4:Te,s5:Oe,s6:De,s7:Me,ss1:V,ss2:k,ss3:W,ss4:G,ss5:K,ss6:q,ss7:te,sz1:$,sz2:X,sz3:Y,sz11:ae,sz12:ue,sz13:re,sz21:he,sz22:ce,sz23:Q,sz31:ie,sz32:de,sz33:me,xgh2:Tte,xgh3:bte,xgh4:Ete,xh2:xte,xh3:wte,xi2:WD,xi3:gte,xl2:yte,xl3:Ate,xl4:Cte,nm:Yi,z1:ve,z2:Ie,z3:Ve,z11:Le,z12:_t,z13:Tt,z21:Ot,z22:Tn,z23:Sn,z31:gn,z32:on,z33:Nt,zmol:bf,zmos:j_}}function pct(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,f=e.ss2,h=e.ss3,_=e.ss4,g=e.ss5,p=e.sz1,y=e.sz3,C=e.sz11,T=e.sz13,E=e.sz21,w=e.sz23,S=e.sz31,P=e.sz33,O=e.t,z=e.tc,R=e.gsto,F=e.mo,H=e.mdot,v=e.no,I=e.nodeo,m=e.nodedot,D=e.xpidot,L=e.z1,M=e.z3,V=e.z11,k=e.z13,W=e.z21,G=e.z23,K=e.z31,q=e.z33,te=e.ecco,$=e.eccsq,X=e.emsq,Y=e.em,ae=e.argpm,ue=e.inclm,re=e.mm,he=e.nm,ce=e.nodem,Q=e.irez,ie=e.atime,de=e.d2201,me=e.d2211,Ee=e.d3210,xe=e.d3222,Pe=e.d4410,Te=e.d4422,Oe=e.d5220,De=e.d5232,Me=e.d5421,ve=e.d5433,Ie=e.dedt,Ve=e.didt,Le=e.dmdt,_t=e.dnodt,Tt=e.domdt,Ot=e.del1,Tn=e.del2,Sn=e.del3,gn=e.xfact,on=e.xlamo,Nt=e.xli,yn=e.xni,Cn,Ht,Xt,Mn,ti,en,xi,Yi,Pi,Jn,cn,Vn,On,rn,gt,ke,vn,pn,Hi,Dn,Oi,bo,no,Dr,Vi,Li,Ir,aa,yt,be,je,tt,kn=17891679e-13,Gr=21460748e-13,hr=22123015e-14,or=17891679e-13,jd=73636953e-16,Eo=21765803e-16,bf=.0043752690880113,j_=37393792e-14,bb=11428639e-14,Mp=.00015835218,Fp=119459e-10;Q=0,he<.0052359877&&he>.0034906585&&(Q=1),he>=.00826&&he<=.00924&&Y>=.5&&(Q=2);var FD=u*Fp*g,zD=f*Fp*(C+T),UD=-Fp*h*(p+y-14-6*X),HD=_*Fp*(S+P-6),q_=-Fp*f*(E+w);(ue<.052359877||ue>Cd-.052359877)&&(q_=0),c!==0&&(q_/=c);var VD=HD-t*q_;Ie=FD+i*Mp*a,Ve=zD+o*Mp*(V+k),Le=UD-Mp*r*(L+M-14-6*X);var kD=s*Mp*(K+q-6),x0=-Mp*o*(W+G);(ue<.052359877||ue>Cd-.052359877)&&(x0=0),Tt=VD+kD,_t=q_,c!==0&&(Tt-=t/c*x0,_t+=x0/c);var Eb=0,w0=(R+z*bf)%Qo;if(Y+=Ie*O,ue+=Ve*O,ae+=Tt*O,ce+=_t*O,re+=Le*O,Q!==0){if(be=Math.pow(he/Yf,bT),Q===2){je=t*t;var GD=Y;Y=te;var WD=X;X=$,tt=Y*X,rn=-.306-(Y-.64)*.44,Y<=.65?(gt=3.616-13.247*Y+16.29*X,vn=-19.302+117.39*Y-228.419*X+156.591*tt,pn=-18.9068+109.7927*Y-214.6334*X+146.5816*tt,Hi=-41.122+242.694*Y-471.094*X+313.953*tt,Dn=-146.407+841.88*Y-1629.014*X+1083.435*tt,Oi=-532.114+3017.977*Y-5740.032*X+3708.276*tt):(gt=-72.099+331.819*Y-508.738*X+266.724*tt,vn=-346.844+1582.851*Y-2415.925*X+1246.113*tt,pn=-342.585+1554.908*Y-2366.899*X+1215.972*tt,Hi=-1052.797+4758.686*Y-7193.992*X+3651.957*tt,Dn=-3581.69+16178.11*Y-24462.77*X+12422.52*tt,Y>.715?Oi=-5149.66+29936.92*Y-54087.36*X+31324.56*tt:Oi=1464.74-4664.75*Y+3763.64*X),Y<.7?(Dr=-919.2277+4988.61*Y-9064.77*X+5542.21*tt,bo=-822.71072+4568.6173*Y-8491.4146*X+5337.524*tt,no=-853.666+4690.25*Y-8624.77*X+5341.4*tt):(Dr=-37995.78+161616.52*Y-229838.2*X+109377.94*tt,bo=-51752.104+218913.95*Y-309468.16*X+146349.42*tt,no=-40023.88+170470.89*Y-242699.48*X+115605.82*tt),Vi=c*c,Cn=.75*(1+2*t+je),Ht=1.5*Vi,Mn=1.875*c*(1-2*t-3*je),ti=-1.875*c*(1+2*t-3*je),xi=35*Vi*Cn,Yi=39.375*Vi*Vi,Pi=9.84375*c*(Vi*(1-2*t-5*je)+.33333333*(-2+4*t+6*je)),Jn=c*(4.92187512*Vi*(-2-4*t+10*je)+6.56250012*(1+2*t-3*je)),cn=29.53125*c*(2-8*t+je*(-12+8*t+10*je)),Vn=29.53125*c*(-2-8*t+je*(12+8*t-10*je)),aa=he*he,yt=be*be,Ir=3*aa*yt,Li=Ir*or,de=Li*Cn*rn,me=Li*Ht*gt,Ir*=be,Li=Ir*j_,Ee=Li*Mn*vn,xe=Li*ti*pn,Ir*=be,Li=2*Ir*jd,Pe=Li*xi*Hi,Te=Li*Yi*Dn,Ir*=be,Li=Ir*bb,Oe=Li*Pi*Oi,De=Li*Jn*no,Li=2*Ir*Eo,Me=Li*cn*bo,ve=Li*Vn*Dr,on=(F+I+I-(w0+w0))%Qo,gn=H+Le+2*(m+_t-bf)-v,Y=GD,X=WD}Q===1&&(On=1+X*(-2.5+.8125*X),vn=1+2*X,ke=1+X*(-6+6.60937*X),Cn=.75*(1+t)*(1+t),Xt=.9375*c*c*(1+3*t)-.75*(1+t),en=1+t,en*=1.875*en*en,Ot=3*he*he*be*be,Tn=2*Ot*Cn*On*kn,Sn=3*Ot*en*ke*hr*be,Ot=Ot*Xt*vn*Gr*be,on=(F+I+n-w0)%Qo,gn=H+D+Le+Tt+_t-(v+bf)),Nt=on,yn=v,ie=0,he=v+Eb}return{em:Y,argpm:ae,inclm:ue,mm:re,nm:he,nodem:ce,irez:Q,atime:ie,d2201:de,d2211:me,d3210:Ee,d3222:xe,d4410:Pe,d4422:Te,d5220:Oe,d5232:De,d5421:Me,d5433:ve,dedt:Ie,didt:Ve,dmdt:Le,dndt:Eb,dnodt:_t,domdt:Tt,del1:Ot,del2:Tn,del3:Sn,xfact:gn,xlamo:on,xli:Nt,xni:yn}}function b8(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*KA/240%Qo,n<0&&(n+=Qo),n}function mct(){return(arguments.length<=0?void 0:arguments[0])instanceof Date||arguments.length>1?b8(KF.apply(void 0,arguments)):b8.apply(void 0,arguments)}function _ct(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),f=u*u,h=Math.pow(Yf/r,bT),_=.75*Lm*(3*f-1)/(c*a),g=_/(h*h),p=h*(1-g*g-g*(1/3+134*g*g/81));g=_/(p*p),r/=1+g;var y=Math.pow(Yf/r,bT),C=Math.sin(i),T=y*a,E=1-5*f,w=-E-f-f,S=1/y,P=T*T,O=y*(1-t),z="n",R;if(o==="a"){var F=n-7305,H=Math.floor(F+1e-8),v=F-H,I=.017202791694070362,m=1.7321343856509375,D=5075514194322695e-30,L=I+Qo;R=(m+I*H+L*v+F*F*D)%Qo,R<0&&(R+=Qo)}else R=mct(n+24332815e-1);return{no:r,method:z,ainv:S,ao:y,con41:w,con42:E,cosio:u,cosio2:f,eccsq:s,omeosq:a,posq:P,rp:O,rteosq:c,sinio:C,gsto:R}}function gct(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,f=e.d5421,h=e.d5433,_=e.dedt,g=e.del1,p=e.del2,y=e.del3,C=e.didt,T=e.dmdt,E=e.dnodt,w=e.domdt,S=e.argpo,P=e.argpdot,O=e.t,z=e.tc,R=e.gsto,F=e.xfact,H=e.xlamo,v=e.no,I=e.atime,m=e.em,D=e.argpm,L=e.inclm,M=e.xli,V=e.mm,k=e.xni,W=e.nodem,G=e.nm,K=.13130908,q=2.8843198,te=.37448087,$=5.7686396,X=.95240898,Y=1.8014998,ae=1.050833,ue=4.4108898,re=.0043752690880113,he=720,ce=-720,Q=259200,ie,de,me,Ee,xe,Pe,Te,Oe,De=0,Me=0,ve=(R+z*re)%Qo;if(m+=_*O,L+=C*O,D+=w*O,W+=E*O,V+=T*O,t!==0){(I===0||O*I<=0||Math.abs(O)<Math.abs(I))&&(I=0,k=v,M=H),O>0?ie=he:ie=ce;for(var Ie=381;Ie===381;)t!==2?(Te=g*Math.sin(M-K)+p*Math.sin(2*(M-q))+y*Math.sin(3*(M-te)),xe=k+F,Pe=g*Math.cos(M-K)+2*p*Math.cos(2*(M-q))+3*y*Math.cos(3*(M-te)),Pe*=xe):(Oe=S+P*I,me=Oe+Oe,de=M+M,Te=n*Math.sin(me+M-$)+i*Math.sin(M-$)+o*Math.sin(Oe+M-X)+r*Math.sin(-Oe+M-X)+s*Math.sin(me+de-Y)+a*Math.sin(de-Y)+c*Math.sin(Oe+M-ae)+u*Math.sin(-Oe+M-ae)+f*Math.sin(Oe+de-ue)+h*Math.sin(-Oe+de-ue),xe=k+F,Pe=n*Math.cos(me+M-$)+i*Math.cos(M-$)+o*Math.cos(Oe+M-X)+r*Math.cos(-Oe+M-X)+c*Math.cos(Oe+M-ae)+u*Math.cos(-Oe+M-ae)+2*s*Math.cos(me+de-Y)+a*Math.cos(de-Y)+f*Math.cos(Oe+de-ue)+h*Math.cos(-Oe+de-ue),Pe*=xe),Math.abs(O-I)>=he?Ie=381:(Me=O-I,Ie=0),Ie===381&&(M+=xe*ie+Te*Q,k+=Te*ie+Pe*Q,I+=ie);G=k+Te*Me+Pe*Me*Me*.5,Ee=M+xe*Me+Te*Me*Me*.5,t!==1?(V=Ee-2*W+2*ve,De=G-v):(V=Ee-W-D+ve,De=G-v),G=v+De}return{atime:I,em:m,argpm:D,inclm:L,xli:M,mm:V,xni:k,nodem:W,dndt:De,nm:G}}function _te(e,t){var n,i,o,r,s,a,c,u,f,h,_,g,p,y,C,T,E,w,S,P,O,z,R,F,H,v,I,m=15e-13;e.t=t,e.error=0;var D=e.mo+e.mdot*e.t,L=e.argpo+e.argpdot*e.t,M=e.nodeo+e.nodedot*e.t;f=L,O=D;var V=e.t*e.t;if(R=M+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(D);a=e.xmcof*(k*k*k-e.delmo),T=c+a,O=D+T,f=L-T,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(O)-e.sinmao),S=S+e.t3cof*g+p*(e.t4cof+e.t*e.t5cof)}z=e.no;var W=e.ecco;if(P=e.inclo,e.method==="d"){y=e.t;var G={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:W,argpm:f,inclm:P,xli:e.xli,mm:O,xni:e.xni,nodem:R,nm:z},K=gct(G);W=K.em,f=K.argpm,P=K.inclm,O=K.mm,R=K.nodem,z=K.nm}if(z<=0)return e.error=2,[!1,!1];var q=Math.pow(Yf/z,bT)*E*E;if(z=Yf/Math.pow(q,1.5),W-=w,W>=1||W<-.001)return e.error=1,[!1,!1];W<1e-6&&(W=1e-6),O+=e.no*S,H=O+f+R,R%=Qo,f%=Qo,H%=Qo,O=(H-f-R)%Qo;var te=Math.sin(P),$=Math.cos(P),X=W;if(F=P,h=f,I=R,v=O,r=te,o=$,e.method==="d"){var Y={inclo:e.inclo,init:"n",ep:X,inclp:F,nodep:I,argpp:h,mp:v,opsmode:e.operationmode},ae=mte(e,Y);if(X=ae.ep,I=ae.nodep,h=ae.argpp,v=ae.mp,F=ae.inclp,F<0&&(F=-F,I+=Cd,h-=Cd),X<0||X>1)return e.error=3,[!1,!1]}e.method==="d"&&(r=Math.sin(F),o=Math.cos(F),e.aycof=-.5*Bm*r,Math.abs(o+1)>15e-13?e.xlcof=-.25*Bm*r*(3+5*o)/(1+o):e.xlcof=-.25*Bm*r*(3+5*o)/m);var ue=X*Math.cos(h);T=1/(q*(1-X*X));var re=X*Math.sin(h)+T*e.aycof,he=v+h+I+T*e.xlcof*ue,ce=(he-I)%Qo;u=ce,C=9999.9;for(var Q=1;Math.abs(C)>=1e-12&&Q<=10;)i=Math.sin(u),n=Math.cos(u),C=1-n*ue-i*re,C=(ce-re*n+ue*i-u)/C,Math.abs(C)>=.95&&(C>0?C=.95:C=-.95),u+=C,Q+=1;var ie=ue*n+re*i,de=ue*i-re*n,me=ue*ue+re*re,Ee=q*(1-me);if(Ee<0)return e.error=4,[!1,!1];var xe=q*(1-ie),Pe=Math.sqrt(q)*de/xe,Te=Math.sqrt(Ee)/xe,Oe=Math.sqrt(1-me);T=de/(1+Oe);var De=q/xe*(i-re-ue*T),Me=q/xe*(n-ue+re*T);_=Math.atan2(De,Me);var ve=(Me+Me)*De,Ie=1-2*De*De;T=1/Ee;var Ve=.5*Lm*T,Le=Ve*T;e.method==="d"&&(s=o*o,e.con41=3*s-1,e.x1mth2=1-s,e.x7thm1=7*s-1);var _t=xe*(1-1.5*Le*Oe*e.con41)+.5*Ve*e.x1mth2*Ie;if(_t<1)return e.error=6,{position:!1,velocity:!1};_-=.25*Le*e.x7thm1*ve;var Tt=I+1.5*Le*o*ve,Ot=F+1.5*Le*o*r*Ie,Tn=Pe-z*Ve*e.x1mth2*ve/Yf,Sn=Te+z*Ve*(e.x1mth2*Ie+1.5*e.con41)/Yf,gn=Math.sin(_),on=Math.cos(_),Nt=Math.sin(Tt),yn=Math.cos(Tt),Cn=Math.sin(Ot),Ht=Math.cos(Ot),Xt=-Nt*Ht,Mn=yn*Ht,ti=Xt*gn+yn*on,en=Mn*gn+Nt*on,xi=Cn*gn,Yi=Xt*on-yn*gn,Pi=Mn*on-Nt*gn,Jn=Cn*on,cn={x:_t*ti*Ya,y:_t*en*Ya,z:_t*xi*Ya},Vn={x:(Tn*ti+Sn*Yi)*F1,y:(Tn*en+Sn*Pi)*F1,z:(Tn*xi+Sn*Jn)*F1};return{position:cn,velocity:Vn}}function yct(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,f=t.xno,h=t.xnodeo,_,g,p,y,C,T,E,w,S,P,O,z,R,F,H,v,I,m,D,L,M,V,k,W,G,K,q,te,$,X,Y,ae,ue,re,he,ce,Q,ie,de,me,Ee,xe,Pe,Te,Oe,De,Me,ve,Ie,Ve,Le,_t,Tt,Ot,Tn,Sn,gn=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=f,e.nodeo=h,e.operationmode=n;var on=78/Ya+1,Nt=(120-78)/Ya,yn=Nt*Nt*Nt*Nt;e.init="y",e.t=0;var Cn={satn:i,ecco:e.ecco,epoch:o,inclo:e.inclo,no:e.no,method:e.method,opsmode:e.operationmode},Ht=_ct(Cn),Xt=Ht.ao,Mn=Ht.con42,ti=Ht.cosio,en=Ht.cosio2,xi=Ht.eccsq,Yi=Ht.omeosq,Pi=Ht.posq,Jn=Ht.rp,cn=Ht.rteosq,Vn=Ht.sinio;if(e.no=Ht.no,e.con41=Ht.con41,e.gsto=Ht.gsto,e.error=0,Yi>=0||e.no>=0){if(e.isimp=0,Jn<220/Ya+1&&(e.isimp=1),q=on,M=yn,m=(Jn-1)*Ya,m<156){q=m-78,m<98&&(q=20);var On=(120-q)/Ya;M=On*On*On*On,q=q/Ya+1}D=1/Pi,De=1/(Xt-q),e.eta=Xt*e.ecco*De,z=e.eta*e.eta,O=e.ecco*e.eta,L=Math.abs(1-z),T=M*Math.pow(De,4),E=T/Math.pow(L,3.5),y=E*e.no*(Xt*(1+1.5*z+O*(4+z))+.375*Lm*De/L*e.con41*(8+3*z*(8+z))),e.cc1=e.bstar*y,C=0,e.ecco>1e-4&&(C=-2*T*De*Bm*e.no*Vn/e.ecco),e.x1mth2=1-en,e.cc4=2*e.no*E*Xt*Yi*(e.eta*(2+.5*z)+e.ecco*(.5+2*z)-Lm*De/(Xt*L)*(-3*e.con41*(1-2*O+z*(1.5-.5*O))+.75*e.x1mth2*(2*z-O*(1+z))*Math.cos(2*e.argpo))),e.cc5=2*E*Xt*Yi*(1+2.75*(z+O)+O*z),w=en*en,Pe=1.5*Lm*D*e.no,Te=.5*Pe*Lm*D,Oe=-.46875*fct*D*D*e.no,e.mdot=e.no+.5*Pe*cn*e.con41+.0625*Te*cn*(13-78*en+137*w),e.argpdot=-.5*Pe*Mn+.0625*Te*(7-114*en+395*w)+Oe*(3-36*en+49*w),ve=-Pe*ti,e.nodedot=ve+(.5*Te*(4-19*en)+2*Oe*(3-7*en))*ti,Me=e.argpdot+e.nodedot,e.omgcof=e.bstar*C*Math.cos(e.argpo),e.xmcof=0,e.ecco>1e-4&&(e.xmcof=-bT*T*e.bstar/O),e.nodecf=3.5*Yi*ve*e.cc1,e.t2cof=1.5*e.cc1,Math.abs(ti+1)>15e-13?e.xlcof=-.25*Bm*Vn*(3+5*ti)/(1+ti):e.xlcof=-.25*Bm*Vn*(3+5*ti)/gn,e.aycof=-.5*Bm*Vn;var rn=1+e.eta*Math.cos(e.mo);if(e.delmo=rn*rn*rn,e.sinmao=Math.sin(e.mo),e.x7thm1=7*en-1,2*Cd/e.no>=225){e.method="d",e.isimp=1,Ee=0,H=e.inclo;var gt={epoch:o,ep:e.ecco,argpp:e.argpo,tc:Ee,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},ke=hct(gt);e.e3=ke.e3,e.ee2=ke.ee2,e.peo=ke.peo,e.pgho=ke.pgho,e.pho=ke.pho,e.pinco=ke.pinco,e.plo=ke.plo,e.se2=ke.se2,e.se3=ke.se3,e.sgh2=ke.sgh2,e.sgh3=ke.sgh3,e.sgh4=ke.sgh4,e.sh2=ke.sh2,e.sh3=ke.sh3,e.si2=ke.si2,e.si3=ke.si3,e.sl2=ke.sl2,e.sl3=ke.sl3,e.sl4=ke.sl4,g=ke.sinim,_=ke.cosim,S=ke.em,P=ke.emsq,V=ke.s1,k=ke.s2,W=ke.s3,G=ke.s4,K=ke.s5,te=ke.ss1,$=ke.ss2,X=ke.ss3,Y=ke.ss4,ae=ke.ss5,ue=ke.sz1,re=ke.sz3,he=ke.sz11,ce=ke.sz13,Q=ke.sz21,ie=ke.sz23,de=ke.sz31,me=ke.sz33,e.xgh2=ke.xgh2,e.xgh3=ke.xgh3,e.xgh4=ke.xgh4,e.xh2=ke.xh2,e.xh3=ke.xh3,e.xi2=ke.xi2,e.xi3=ke.xi3,e.xl2=ke.xl2,e.xl3=ke.xl3,e.xl4=ke.xl4,e.zmol=ke.zmol,e.zmos=ke.zmos,I=ke.nm,Ie=ke.z1,Ve=ke.z3,Le=ke.z11,_t=ke.z13,Tt=ke.z21,Ot=ke.z23,Tn=ke.z31,Sn=ke.z33;var vn={inclo:H,init:e.init,ep:e.ecco,inclp:e.inclo,nodep:e.nodeo,argpp:e.argpo,mp:e.mo,opsmode:e.operationmode},pn=mte(e,vn);e.ecco=pn.ep,e.inclo=pn.inclp,e.nodeo=pn.nodep,e.argpo=pn.argpp,e.mo=pn.mp,R=0,F=0,v=0;var Hi={cosim:_,emsq:P,argpo:e.argpo,s1:V,s2:k,s3:W,s4:G,s5:K,sinim:g,ss1:te,ss2:$,ss3:X,ss4:Y,ss5:ae,sz1:ue,sz3:re,sz11:he,sz13:ce,sz21:Q,sz23:ie,sz31:de,sz33:me,t:e.t,tc:Ee,gsto:e.gsto,mo:e.mo,mdot:e.mdot,no:e.no,nodeo:e.nodeo,nodedot:e.nodedot,xpidot:Me,z1:Ie,z3:Ve,z11:Le,z13:_t,z21:Tt,z23:Ot,z31:Tn,z33:Sn,ecco:e.ecco,eccsq:xi,em:S,argpm:R,inclm:H,mm:v,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},Dn=pct(Hi);e.irez=Dn.irez,e.atime=Dn.atime,e.d2201=Dn.d2201,e.d2211=Dn.d2211,e.d3210=Dn.d3210,e.d3222=Dn.d3222,e.d4410=Dn.d4410,e.d4422=Dn.d4422,e.d5220=Dn.d5220,e.d5232=Dn.d5232,e.d5421=Dn.d5421,e.d5433=Dn.d5433,e.dedt=Dn.dedt,e.didt=Dn.didt,e.dmdt=Dn.dmdt,e.dnodt=Dn.dnodt,e.domdt=Dn.domdt,e.del1=Dn.del1,e.del2=Dn.del2,e.del3=Dn.del3,e.xfact=Dn.xfact,e.xlamo=Dn.xlamo,e.xli=Dn.xli,e.xni=Dn.xni}e.isimp!==1&&(p=e.cc1*e.cc1,e.d2=4*Xt*De*p,xe=e.d2*De*e.cc1/3,e.d3=(17*Xt+q)*xe,e.d4=.5*xe*Xt*De*(221*Xt+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)))}_te(e,0),e.init="n"}function Act(e,t){var n="i",i=1440/(2*Cd),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*lct,-2/3),r.ndot/=i*1440,r.nddot/=i*1440*1440,r.inclo*=KA,r.nodeo*=KA,r.argpo*=KA,r.mo*=KA,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=dct(o,r.epochdays),a=s.mon,c=s.day,u=s.hr,f=s.minute,h=s.sec;return r.jdsatepoch=KF(o,a,c,u,f,h),yct(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 Cct(e){return Tct(e)||bct(e)||Ect(e)||xct()}function Tct(e){if(Array.isArray(e))return _R(e)}function bct(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function Ect(e,t){if(e){if(typeof e=="string")return _R(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 _R(e,t)}}function _R(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 xct(){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 wct(){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=KF.apply(void 0,Cct(o)),s=(r-i.jdsatepoch)*act;return _te(i,s)}class Sct{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=Act(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 wct(this.satrec,t).position}_getPositionProperty(){const t=ne.fromIso8601(new Date().toISOString()),n=new pc(ea.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=ne.addSeconds(t,o*this.stepSeconds,new ne),c={x:s.x*1e3,y:s.y*1e3,z:s.z*1e3};n.addSample(a,c)}return n}createSatelliteEntity(){const t=ne.fromIso8601(new Date().toISOString()),n=ne.addSeconds(t,this.totalSeconds,new ne),i=U.fromRandom({alpha:1});return{name:this.name,description:this.name,availability:new To([new Zt({start:t,stop:n})]),position:this._getPositionProperty(),point:{pixelSize:8,color:i},path:new ky({width:.5,show:!0,leadTime:this.leadTime,trailTime:this.trailTime,material:i}),label:{text:this.name,font:"12px sans-serif",showBackground:!0,backgroundColor:new U(.165,.165,.165,.5),backgroundPadding:new j(4,4),outlineWidth:1,verticalOrigin:Si.TOP,horizontalOrigin:Si.LEFT,pixelOffset:new j(0,5),fillColor:U.WHITE}}}}let vct=[{label:"卫星集合",value:null,group:null,type:"title"},{label:"Last 30 Days' Launches",value:"last-30-days",group:"last-30-days"},{label:"Space Stations",value:"stations",group:"stations"},{label:"100 (or so) Brightest",value:"visual",group:"visual"},{label:"Active Satellites",value:"active",group:"active"},{label:"Analyst Satellites ",value:"analyst",group:"analyst"}],Dct=[{label:"气象和地球资源卫星",value:null,group:null,type:"title"},{label:"Weather",value:"weather",group:"weather"},{label:"NOAA",value:"noaa",group:"noaa"},{label:"GOES",value:"goes",group:"goes"},{label:"Earth Resources",value:"resource",group:"resource"},{label:"Search & Rescue (SARSAT) ",value:"sarsat",group:"sarsat"},{label:"Disaster Monitoring",value:"dmc",group:"dmc"},{label:"TDRSS",value:"tdrss",group:"tdrss"},{label:"ARGOS Data Collection System",value:"argos",group:"argos"},{label:"Planet",value:"planet",group:"planet"},{label:"Spire",value:"spire",group:"spire"}],Ict=[{label:"通讯卫星",value:null,group:null,type:"title"},{label:"Active Geosynchronous",value:"geo",group:"geo"},{label:"GEO Protected Zone",value:"gpz",group:"gpz"},{label:"GEO Protected Zone Plus",value:"gpz-plus",group:"gpz-plus"},{label:"Intelsat",value:"intelsat",group:"intelsat"},{label:"SES",value:"ses",group:"ses"},{label:"Iridium",value:"iridium",group:"iridium"},{label:"Iridium NEXT",value:"iridium-NEXT",group:"iridium-NEXT"},{label:"Starlink",value:"starlink",group:"starlink"},{label:"OneWeb",value:"oneweb",group:"oneweb"},{label:"Orbcomm",value:"orbcomm",group:"orbcomm"},{label:"Globalstar",value:"globalstar",group:"globalstar"},{label:"Swarm",value:"swarm",group:"swarm"},{label:"Amateur Radio",value:"amateur",group:"amateur"},{label:"Experimental Comm",value:"x-comm",group:"x-comm"},{label:"Other Comm",value:"other-comm",group:"other-comm"},{label:"SatNOGS",value:"satnogs",group:"satnogs"},{label:"Gorizont",value:"gorizont",group:"gorizont"},{label:"Raduga",value:"raduga",group:"raduga"},{label:"Molniya",value:"molniya",group:"molniya"}],Pct=[{label:"导航卫星",value:null,group:null,type:"title"},{label:"GNSS",value:"gnss",group:"gnss"},{label:"GPS Operational",value:"gps-ops",group:"gps-ops"},{label:"GLONASS Operational",value:"glo-ops",group:"glo-ops"},{label:"Galileo",value:"galileo",group:"galileo"},{label:"Beidou",value:"beidou",group:"beidou"},{label:"Satellite-Based Augmentation System",value:"sbas",group:"sbas"},{label:"Navy Navigation Satellite System (NNSS)",value:"nnss",group:"nnss"},{label:"Russian LEO Navigation",value:"musson",group:"musson"}],Oct=[{label:"科学卫星",value:null,group:null,type:"title"},{label:"Space & Earth Science",value:"science",group:"science"},{label:"Geodetic",value:"geodetic",group:"geodetic"},{label:"Engineering",value:"engineering",group:"engineering"},{label:"Education",value:"education",group:"education"}],Lct=[{label:"其他卫星",value:null,group:null,type:"title"},{label:"Miscellaneous Military",value:"military",group:"military"},{label:"Radar Calibration",value:"radar",group:"radar"},{label:"CubeSats",value:"cubesat",group:"cubesat"},{label:"Other Satellites",value:"other",group:"other"}];function Bct(e,t){if(!Array.isArray(e)||!Array.isArray(t))throw new Error("Both oldArray and newArray must be arrays.");const n=t.filter(o=>!e.includes(o)),i=e.filter(o=>!t.includes(o));return{addedItems:n,removedItems:i}}const Rct=rs("div",{id:"cesiumContainer"},null,-1),Nct={class:"operate_container"},Mct=rs("img",{src:Xfe,width:"28",height:"28",alt:"卫星星座选择"},null,-1),Fct=[Mct],zct={__name:"SatelliteTrack",setup(e){const t=[...vct,...Dct,...Ict,...Pct,...Oct,...Lct];window.CESIUM_BASE_URL="/satellite-track/cesium";let n;const i=86400,o=new Map,r=Gi(!1),s=Gi(["last-30-days"]),a=new Map;zm.defaultAccessToken="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJiYjZmMWM4Ny01YzQ4LTQ3MzUtYTI5Mi1hNTgyNjdhMmFiMmMiLCJpZCI6NjIwMjgsImlhdCI6MTYyNjY3MTMxNX0.5SelYUyzXWRoMyjjFvmFIAoPtWlJPQMjsVl2e_jQe-c";function c(){sa.prototype.makeLabel=function(S){let P=0-new Date().getTimezoneOffset(),O=ne.addMinutes(S,P,new ne);return ne.toIso8601(O).slice(0,19)};let C=new _c({url:"https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",minimumLevel:3,maximumLevel:18,tilingScheme:new ws});n=new $n("cesiumContainer",{baseLayerPicker:!0,geocoder:!1,navigationHelpButton:!1,infoBox:!1});const T=new fs({name:"高德地图",iconUrl:"/src/assets/gaode.jpg",tooltip:"高德地图",category:"Cesium ion",creationFunction:function(){return C}});n.baseLayerPicker.viewModel.imageryProviderViewModels.unshift(T);const E=n.baseLayerPicker.viewModel.imageryProviderViewModels[0];n.baseLayerPicker.viewModel.selectedImagery=E;let w=0-new Date().getTimezoneOffset();n.animation.viewModel.timeFormatter=function(S,P){let O=ne.addMinutes(S,w,new ne);return ne.toIso8601(O).slice(11,19)},n.animation.viewModel.dateFormatter=function(S,P){let O=ne.addMinutes(S,w,new ne);return ne.toIso8601(O).slice(0,10)},ot.DEFAULT_VIEW_RECTANGLE=_e.fromDegrees(75,10,140,60)}function u(){const C=ne.fromIso8601(new Date().toISOString()),T=ne.addSeconds(C,i,new ne);n.clock.startTime=C.clone(),n.clock.stopTime=T.clone(),n.clock.currentTime=C.clone(),n.timeline.zoomTo(C,T),n.clock.multiplier=1,n.clock.shouldAnimate=!0,n.clock.clockRange=Gh.LOOP_STOP}function f(C=""){if(C.length===0)return;let T=C.split(`\r
`),E=[],w=0,S=[];return T.forEach(P=>{w++,S.push(P),w===3&&(E.push(S.join(`\r
`)),S=[],w=0)}),E}function h(){let C=n.screenSpaceEventHandler.getInputAction(Bn.LEFT_CLICK);n.screenSpaceEventHandler.setInputAction(function(E){C(E);const w=n.scene.pick(E.position);console.log(w)},Bn.LEFT_CLICK)}function _(C){}async function g(C){let T=a.get(C);if(T)return console.log(`%c 命中缓存,key值为${C}`,"color:#0f0;"),T;{console.warn("未命中缓存开始下载TLE数据");const E=await sct(C);return a.set(C,E),E}}async function p(C){if(o.has(C))o.get(C).forEach(E=>n.entities.add(E));else{let T=await g(C),E=f(T),w=new Set;E.forEach(S=>{let O=new Sct(S).createSatelliteEntity(),z=n.entities.add(O);w.add(z)}),o.set(C,w)}}function y(C){o.has(C)&&o.get(C).forEach(E=>n.entities.remove(E))}return Nr(s,(C,T)=>{const{addedItems:E,removedItems:w}=Bct(T,C);E.length&&p(E[0]),w.length&&y(w[0])}),ef(async()=>{c(),u(),h()}),(C,T)=>{const E=Rfe,w=afe,S=cfe,P=vfe;return Gn(),mo(ms,null,[Rct,rs("div",Nct,[rs("div",{class:"menu_button",onClick:T[0]||(T[0]=O=>r.value=!r.value),title:"卫星星座选择"},Fct)]),_o(P,{modelValue:r.value,"onUpdate:modelValue":T[2]||(T[2]=O=>r.value=O),title:"卫星星座选择",direction:"ltr"},{default:Ws(()=>[_o(S,{modelValue:s.value,"onUpdate:modelValue":T[1]||(T[1]=O=>s.value=O),onChange:_,max:5},{default:Ws(()=>[(Gn(),mo(ms,null,Yne(t,(O,z)=>(Gn(),mo(ms,{key:z},[O.type==="title"?(Gn(),Ma(E,{key:0,class:"satellite_type"},{default:Ws(()=>[OC(qm(O.label),1)]),_:2},1024)):da("",!0),O.type?da("",!0):(Gn(),Ma(w,{key:1,label:O.value},{default:Ws(()=>[OC(qm(O.label),1)]),_:2},1032,["label"]))],64))),64))]),_:1},8,["modelValue"])]),_:1},8,["modelValue"])],64)}}},Uct=rre({history:boe("/satellite-track/"),routes:[{path:"/",name:"home",component:zct}]}),JF=eoe(lre);JF.use(ooe());JF.use(Uct);JF.mount("#app")});export default Hct();