12345678910111213141516 |
- import{CanvasTexture as t,LinearFilter as e,RepeatWrapping as r,Vector2 as n,Frustum as s,Matrix4 as i,Group as o,PlaneGeometry as a,Vector3 as c,MeshBasicMaterial as u,DoubleSide as l,Mesh as h,ArrowHelper as d,Color as f,BoxGeometry as A,EdgesGeometry as m,LineSegments as p,LineBasicMaterial as B,ShaderMaterial as g,Euler as y,BufferGeometry as C,Float32BufferAttribute as b,Uint8BufferAttribute as w,BufferAttribute as T,Points as E}from"three";import{GLTFLoader as _}from"three/examples/jsm/loaders/GLTFLoader.js";import{DRACOLoader as M}from"three/examples/jsm/loaders/DRACOLoader.js";import{KTX2Loader as v}from"three/examples/jsm/loaders/KTX2Loader.js";
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */function I(t,e,r,n){return new(r||(r=Promise))((function(s,i){function o(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}c((n=n.apply(t,e||[])).next())}))}function F(t,e){if(!t)throw new Error(e||"loader assertion failed.")}const D=Boolean("object"!=typeof process||"[object process]"!==String(process)||process.browser),G="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);G&&parseFloat(G[1]);function R(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}const S={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document},O=S.global||S.self||S.window||{},x="object"!=typeof process||"[object process]"!==String(process)||process.browser,U="function"==typeof importScripts,L="undefined"!=typeof window&&void 0!==window.orientation,N="undefined"!=typeof process&&process.version&&/v([0-9]*)/.exec(process.version);function H(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}N&&parseFloat(N[1]);class J{constructor(t,e){H(this,"name",void 0),H(this,"workerThread",void 0),H(this,"isRunning",void 0),H(this,"result",void 0),H(this,"_resolve",void 0),H(this,"_reject",void 0),this.name=t,this.workerThread=e,this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},this.result=new Promise(((t,e)=>{this._resolve=t,this._reject=e}))}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){R(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){R(this.isRunning),this.isRunning=!1,this._reject(t)}}const P=new Map;function j(t){R(t.source&&!t.url||!t.source&&t.url);let e=P.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return k((e=t,"try {\n importScripts('".concat(e,"');\n} catch (error) {\n console.error(error);\n throw error;\n}")));var e}(t.url),P.set(t.url,e)),t.source&&(e=k(t.source),P.set(t.source,e))),R(e),e}function k(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function K(t,e=!0,r){const n=r||new Set;if(t){if(V(t))n.add(t);else if(V(t.buffer))n.add(t.buffer);else if(ArrayBuffer.isView(t));else if(e&&"object"==typeof t)for(const r in t)K(t[r],e,n)}else;return void 0===r?Array.from(n):[]}function V(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}const Q=()=>{};class q{static isSupported(){return"undefined"!=typeof Worker}constructor(t){H(this,"name",void 0),H(this,"source",void 0),H(this,"url",void 0),H(this,"terminated",!1),H(this,"worker",void 0),H(this,"onMessage",void 0),H(this,"onError",void 0),H(this,"_loadableURL","");const{name:e,source:r,url:n}=t;R(r||n),this.name=e,this.source=r,this.url=n,this.onMessage=Q,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=Q,this.onError=Q,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||K(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+="worker ".concat(this.name," from ").concat(this.url,". "),t.message&&(e+="".concat(t.message," in ")),t.lineno&&(e+=":".concat(t.lineno,":").concat(t.colno)),new Error(e)}_createBrowserWorker(){this._loadableURL=j({source:this.source,url:this.url});const t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=t=>{t.data?this.onMessage(t.data):this.onError(new Error("No data received"))},t.onerror=t=>{this.onError(this._getErrorFromErrorEvent(t)),this.terminated=!0},t.onmessageerror=t=>console.error(t),t}}class z{constructor(t){H(this,"name","unnamed"),H(this,"source",void 0),H(this,"url",void 0),H(this,"maxConcurrency",1),H(this,"maxMobileConcurrency",1),H(this,"onDebug",(()=>{})),H(this,"reuseWorkers",!0),H(this,"props",{}),H(this,"jobQueue",[]),H(this,"idleQueue",[]),H(this,"count",0),H(this,"isDestroyed",!1),this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach((t=>t.destroy())),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},void 0!==t.name&&(this.name=t.name),void 0!==t.maxConcurrency&&(this.maxConcurrency=t.maxConcurrency),void 0!==t.maxMobileConcurrency&&(this.maxMobileConcurrency=t.maxMobileConcurrency),void 0!==t.reuseWorkers&&(this.reuseWorkers=t.reuseWorkers),void 0!==t.onDebug&&(this.onDebug=t.onDebug)}async startJob(t,e=((t,e,r)=>t.done(r)),r=((t,e)=>t.error(e))){const n=new Promise((n=>(this.jobQueue.push({name:t,onMessage:e,onError:r,onStart:n}),this)));return this._startQueuedJob(),await n}async _startQueuedJob(){if(!this.jobQueue.length)return;const t=this._getAvailableWorker();if(!t)return;const e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});const r=new J(e.name,t);t.onMessage=t=>e.onMessage(r,t.type,t.payload),t.onError=t=>e.onError(r,t),e.onStart(r);try{await r.result}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;const t="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new q({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return L?this.maxMobileConcurrency:this.maxConcurrency}}const W={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class Y{static isSupported(){return q.isSupported()}static getWorkerFarm(t={}){return Y._workerFarm=Y._workerFarm||new Y({}),Y._workerFarm.setProps(t),Y._workerFarm}constructor(t){H(this,"props",void 0),H(this,"workerPools",new Map),this.props={...W},this.setProps(t),this.workerPools=new Map}destroy(){for(const t of this.workerPools.values())t.destroy()}setProps(t){this.props={...this.props,...t};for(const t of this.workerPools.values())t.setProps(this._getWorkerPoolProps())}getWorkerPool(t){const{name:e,source:r,url:n}=t;let s=this.workerPools.get(e);return s||(s=new z({name:e,source:r,url:n}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}H(Y,"_workerFarm",void 0);var X={},Z=Object.freeze(Object.assign(Object.create(null),X,{default:X}));const $={};async function tt(t,e=null,r={}){return e&&(t=function(t,e,r){if(t.startsWith("http"))return t;const n=r.modules||{};if(n[t])return n[t];if(!x)return"modules/".concat(e,"/dist/libs/").concat(t);if(r.CDN)return R(r.CDN.startsWith("http")),"".concat(r.CDN,"/").concat(e,"@").concat("3.1.4","/dist/libs/").concat(t);if(U)return"../src/libs/".concat(t);return"modules/".concat(e,"/src/libs/").concat(t)}(t,e,r)),$[t]=$[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!x)try{return Z&&X.requireFromFile&&await X.requireFromFile(t)}catch{return null}if(U)return importScripts(t);const e=await fetch(t);return function(t,e){if(!x)return X.requireFromString&&X.requireFromString(t,e);if(U)return eval.call(O,t),null;const r=document.createElement("script");r.id=e;try{r.appendChild(document.createTextNode(t))}catch(e){r.text=t}return document.body.appendChild(r),null}(await e.text(),t)}(t),await $[t]}async function et(t,e,r,n,s){const i=t.id,o=function(t,e={}){const r=e[t.id]||{},n="".concat(t.id,"-worker.js");let s=r.workerUrl;if(s||"compression"!==t.id||(s=e.workerUrl),"test"===e._workerType&&(s="modules/".concat(t.module,"/dist/").concat(n)),!s){let e=t.version;"latest"===e&&(e="latest");const r=e?"@".concat(e):"";s="https://unpkg.com/@loaders.gl/".concat(t.module).concat(r,"/dist/").concat(n)}return R(s),s}(t,r),a=Y.getWorkerFarm(r).getWorkerPool({name:i,url:o});r=JSON.parse(JSON.stringify(r));const c=await a.startJob("process-on-worker",rt.bind(null,s));c.postMessage("process",{input:e,options:r});const u=await c.result;return await u.result}async function rt(t,e,r,n){switch(r){case"done":e.done(n);break;case"error":e.error(new Error(n.error));break;case"process":const{id:s,input:i,options:o}=n;try{const r=await t(i,o);e.postMessage("done",{id:s,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:s,error:r})}break;default:console.warn("parse-with-worker unknown message ".concat(r))}}function nt(t,e,r){if(t.byteLength<=e+r)return"";const n=new DataView(t);let s="";for(let t=0;t<r;t++)s+=String.fromCharCode(n.getUint8(e+t));return s}function st(t){try{return JSON.parse(t)}catch(e){throw new Error('Failed to parse JSON from data starting with "'.concat(function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return nt(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer)return nt(t,0,e);return""}(t),'"'))}}function it(t){return t&&"object"==typeof t&&t.isBuffer}function ot(t){if(it(t))return function(t){if(it(t))return new Uint8Array(t.buffer,t.byteOffset,t.length).slice().buffer;return t}(t);if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t))return 0===t.byteOffset&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);if("string"==typeof t){const e=t;return(new TextEncoder).encode(e).buffer}if(t&&"object"==typeof t&&t._toArrayBuffer)return t._toArrayBuffer();throw new Error("toArrayBuffer")}function at(t,e,r){const n=void 0!==r?new Uint8Array(t).subarray(e,e+r):new Uint8Array(t).subarray(e);return new Uint8Array(n).buffer}function ct(t,e){return F(t>=0),F(e>0),t+(e-1)&~(e-1)}function ut(t,e,r){let n;if(t instanceof ArrayBuffer)n=new Uint8Array(t);else{const e=t.byteOffset,r=t.byteLength;n=new Uint8Array(t.buffer||t.arrayBuffer,e,r)}return e.set(n,r),r+ct(n.byteLength,4)}async function lt(t){const e=[];for await(const r of t)e.push(r);return function(...t){const e=t.map((t=>t instanceof ArrayBuffer?new Uint8Array(t):t)),r=e.reduce(((t,e)=>t+e.byteLength),0),n=new Uint8Array(r);let s=0;for(const t of e)n.set(t,s),s+=t.byteLength;return n.buffer}(...e)}function ht(){let t;if("undefined"!=typeof window&&window.performance)t=window.performance.now();else if("undefined"!=typeof process&&process.hrtime){const e=process.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}class dt{constructor(t,e){H(this,"name",void 0),H(this,"type",void 0),H(this,"sampleSize",1),H(this,"time",void 0),H(this,"count",void 0),H(this,"samples",void 0),H(this,"lastTiming",void 0),H(this,"lastSampleTime",void 0),H(this,"lastSampleCount",void 0),H(this,"_count",0),H(this,"_time",0),H(this,"_samples",0),H(this,"_startTime",0),H(this,"_timerPending",!1),this.name=t,this.type=e,this.reset()}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=ht(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(ht()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}class ft{constructor(t){H(this,"id",void 0),H(this,"stats",{}),this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"count";return this._getOrCreate({name:t,type:e})}get size(){return Object.keys(this.stats).length}reset(){for(const t in this.stats)this.stats[t].reset();return this}forEach(t){for(const e in this.stats)t(this.stats[e])}getTable(){const t={};return this.forEach((e=>{t[e.name]={time:e.time||0,count:e.count||0,average:e.getAverageTime()||0,hz:e.getHz()||0}})),t}_initializeStats(){(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((t=>this._getOrCreate(t)))}_getOrCreate(t){if(!t||!t.name)return null;const{name:e,type:r}=t;return this.stats[e]||(this.stats[e]=t instanceof dt?t:new dt(e,r)),this.stats[e]}}const At={id:"request-scheduler",throttleRequests:!0,maxRequests:6};class mt{constructor(t={}){H(this,"props",void 0),H(this,"stats",void 0),H(this,"activeRequestCount",0),H(this,"requestQueue",[]),H(this,"requestMap",new Map),H(this,"deferredUpdate",null),this.props={...At,...t},this.stats=new ft({id:this.props.id}),this.stats.get("Queued Requests"),this.stats.get("Active Requests"),this.stats.get("Cancelled Requests"),this.stats.get("Queued Requests Ever"),this.stats.get("Active Requests Ever")}scheduleRequest(t,e=(()=>0)){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const r={handle:t,priority:0,getPriority:e},n=new Promise((t=>(r.resolve=t,r)));return this.requestQueue.push(r),this.requestMap.set(t,n),this._issueNewRequests(),n}_issueRequest(t){const{handle:e,resolve:r}=t;let n=!1;const s=()=>{n||(n=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,r?r({done:s}):Promise.resolve({done:s})}_issueNewRequests(){this.deferredUpdate||(this.deferredUpdate=setTimeout((()=>this._issueNewRequestsAsync()),0))}_issueNewRequestsAsync(){this.deferredUpdate=null;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(0!==t){this._updateAllRequests();for(let e=0;e<t;++e){const t=this.requestQueue.shift();t&&this._issueRequest(t)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const r=t[e];this._updateRequest(r)||(t.splice(e,1),this.requestMap.delete(r.handle),e--)}t.sort(((t,e)=>t.priority-e.priority))}_updateRequest(t){return t.priority=t.getPriority(t.handle),!(t.priority<0)||(t.resolve(null),!1)}}const pt={};function Bt(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(0,e):""}const gt=t=>"function"==typeof t,yt=t=>null!==t&&"object"==typeof t,Ct=t=>yt(t)&&t.constructor==={}.constructor,bt=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,wt=t=>"undefined"!=typeof Blob&&t instanceof Blob,Tt=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||yt(t)&>(t.tee)&>(t.cancel)&>(t.getReader))(t)||(t=>yt(t)&>(t.read)&>(t.pipe)&&(t=>"boolean"==typeof t)(t.readable))(t),Et=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,_t=/^([-\w.]+\/[-\w.+]+)/;function Mt(t){const e=_t.exec(t);return e?e[1]:t}function vt(t){const e=Et.exec(t);return e?e[1]:""}const It=/\?.*/;function Ft(t){if(bt(t)){const e=Dt(t.url||"");return{url:e,type:Mt(t.headers.get("content-type")||"")||vt(e)}}return wt(t)?{url:Dt(t.name||""),type:t.type||""}:"string"==typeof t?{url:Dt(t),type:vt(t)}:{url:"",type:""}}function Dt(t){return t.replace(It,"")}async function Gt(t){if(bt(t))return t;const e={},r=function(t){return bt(t)?t.headers["content-length"]||-1:wt(t)?t.size:"string"==typeof t?t.length:t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:-1}(t);r>=0&&(e["content-length"]=String(r));const{url:n,type:s}=Ft(t);s&&(e["content-type"]=s);const i=await async function(t){const e=5;if("string"==typeof t)return"data:,".concat(t.slice(0,e));if(t instanceof Blob){const e=t.slice(0,5);return await new Promise((t=>{const r=new FileReader;r.onload=e=>{var r;return t(null==e||null===(r=e.target)||void 0===r?void 0:r.result)},r.readAsDataURL(e)}))}if(t instanceof ArrayBuffer){const r=function(t){let e="";const r=new Uint8Array(t);for(let t=0;t<r.byteLength;t++)e+=String.fromCharCode(r[t]);return btoa(e)}(t.slice(0,e));return"data:base64,".concat(r)}return null}(t);i&&(e["x-first-bytes"]=i),"string"==typeof t&&(t=(new TextEncoder).encode(t));const o=new Response(t,{headers:e});return Object.defineProperty(o,"url",{value:n}),o}async function Rt(t,e){if("string"==typeof t){t=function(t){for(const e in pt)if(t.startsWith(e)){const r=pt[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t="".concat("").concat(t)),t}(t);let r=e;return null!=e&&e.fetch&&"function"!=typeof(null==e?void 0:e.fetch)&&(r=e.fetch),await fetch(t,r)}return await Gt(t)}function St(){return!("object"==typeof process&&"[object process]"===String(process)&&!process.browser)||function(t){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof process&&"object"==typeof process.versions&&Boolean(process.versions.electron))return!0;const e="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}()}const Ot={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:"undefined"!=typeof global&&global,document:"undefined"!=typeof document&&document,process:"object"==typeof process&&process},xt=Ot.window||Ot.self||Ot.global,Ut=Ot.process||{},Lt="undefined"!=typeof __VERSION__?__VERSION__:"untranspiled source";St();class Nt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sessionStorage";H(this,"storage",void 0),H(this,"id",void 0),H(this,"config",{}),this.storage=function(t){try{const e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch(t){return null}}(r),this.id=t,this.config={},Object.assign(this.config,e),this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){return this.config={},this.updateConfiguration(t)}updateConfiguration(t){if(Object.assign(this.config,t),this.storage){const t=JSON.stringify(this.config);this.storage.setItem(this.id,t)}return this}_loadConfiguration(){let t={};if(this.storage){const e=this.storage.getItem(this.id);t=e?JSON.parse(e):{}}return Object.assign(this.config,t),this}}function Ht(t,e,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:600;const s=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));const i=t.width*r,o=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(o/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(o,"px;"),"background:url(".concat(s,");"),"background-size:".concat(i,"px ").concat(o,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}let Jt;function Pt(t){return"string"==typeof t?Jt[t.toUpperCase()]||Jt.WHITE:t}function jt(t,e){if(!t)throw new Error(e||"Assertion failed")}function kt(){let t;var e,r;if(St&&"performance"in xt)t=null==xt||null===(e=xt.performance)||void 0===e||null===(r=e.now)||void 0===r?void 0:r.call(e);else if("hrtime"in Ut){var n;const e=null==Ut||null===(n=Ut.hrtime)||void 0===n?void 0:n.call(Ut);t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}!function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"}(Jt||(Jt={}));const Kt={debug:St&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},Vt={enabled:!0,level:0};function Qt(){}const qt={},zt={once:!0};class Wt{constructor(){let{id:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:""};H(this,"id",void 0),H(this,"VERSION",Lt),H(this,"_startTs",kt()),H(this,"_deltaTs",kt()),H(this,"_storage",void 0),H(this,"userData",{}),H(this,"LOG_THROTTLE_TIMEOUT",0),this.id=t,this._storage=new Nt("__probe-".concat(this.id,"__"),Vt),this.userData={},this.timeStamp("".concat(this.id," started")),function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["constructor"];const r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r);for(const r of n)"function"==typeof t[r]&&(e.find((t=>r===t))||(t[r]=t[r].bind(t)))}(this),Object.seal(this)}set level(t){this.setLevel(t)}get level(){return this.getLevel()}isEnabled(){return this._storage.config.enabled}getLevel(){return this._storage.config.level}getTotal(){return Number((kt()-this._startTs).toPrecision(10))}getDelta(){return Number((kt()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,e){jt(t,e)}warn(t){return this._getLogFunction(0,t,Kt.warn,arguments,zt)}error(t){return this._getLogFunction(0,t,Kt.error,arguments)}deprecated(t,e){return this.warn("`".concat(t,"` is deprecated and will be removed in a later version. Use `").concat(e,"` instead"))}removed(t,e){return this.error("`".concat(t,"` has been removed. Use `").concat(e,"` instead"))}probe(t,e){return this._getLogFunction(t,e,Kt.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,Kt.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];return this._getLogFunction(t,e,Kt.debug||Kt.info,arguments,zt)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||Qt,r&&[r],{tag:Zt(e)}):Qt}image(t){let{logLevel:e,priority:r,image:n,message:s="",scale:i=1}=t;return this._shouldLog(e||r)?St?function(t){let{image:e,message:r="",scale:n=1}=t;if("string"==typeof e){const t=new Image;return t.onload=()=>{const e=Ht(t,r,n);console.log(...e)},t.src=e,Qt}const s=e.nodeName||"";if("img"===s.toLowerCase())return console.log(...Ht(e,r,n)),Qt;if("canvas"===s.toLowerCase()){const t=new Image;return t.onload=()=>console.log(...Ht(t,r,n)),t.src=e.toDataURL(),Qt}return Qt}({image:n,message:s,scale:i}):function(t){let{image:e,message:r="",scale:n=1}=t,s=null;try{s=module.require("asciify-image")}catch(t){}if(s)return()=>s(e,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then((t=>console.log(t)));return Qt}({image:n,message:s,scale:i}):Qt}time(t,e){return this._getLogFunction(t,e,console.time?console.time:console.info)}timeEnd(t,e){return this._getLogFunction(t,e,console.timeEnd?console.timeEnd:console.info)}timeStamp(t,e){return this._getLogFunction(t,e,console.timeStamp||Qt)}group(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};const n=Xt({logLevel:t,message:e,opts:r}),{collapsed:s}=r;return n.method=(s?console.groupCollapsed:console.group)||console.info,this._getLogFunction(n)}groupCollapsed(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||Qt)}withGroup(t,e,r){this.group(t,e)();try{r()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&this.getLevel()>=Yt(t)}_getLogFunction(t,e,r,n,s){if(this._shouldLog(t)){s=Xt({logLevel:t,message:e,args:n,opts:s}),jt(r=r||s.method),s.total=this.getTotal(),s.delta=this.getDelta(),this._deltaTs=kt();const i=s.tag||s.message;if(s.once){if(qt[i])return Qt;qt[i]=kt()}return e=function(t,e,r){if("string"==typeof e){const o=r.time?function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;const r=Math.max(e-t.length,0);return"".concat(" ".repeat(r)).concat(t)}(function(t){let e;return e=t<10?"".concat(t.toFixed(2),"ms"):t<100?"".concat(t.toFixed(1),"ms"):t<1e3?"".concat(t.toFixed(0),"ms"):"".concat((t/1e3).toFixed(2),"s"),e}(r.total)):"";e=r.time?"".concat(t,": ").concat(o," ").concat(e):"".concat(t,": ").concat(e),n=e,s=r.color,i=r.background,St||"string"!=typeof n||(s&&(s=Pt(s),n="[".concat(s,"m").concat(n,"[39m")),i&&(s=Pt(i),n="[".concat(i+10,"m").concat(n,"[49m"))),e=n}var n,s,i;return e}(this.id,s.message,s),r.bind(console,e,...s.args)}return Qt}}function Yt(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return jt(Number.isFinite(e)&&e>=0),e}function Xt(t){const{logLevel:e,message:r}=t;t.logLevel=Yt(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":void 0!==r&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e)}"function"==typeof t.message&&(t.message=t.message());const s=typeof t.message;return jt("string"===s||"object"===s),Object.assign(t,{args:n},t.opts)}function Zt(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}H(Wt,"VERSION",Lt);const $t=new Wt({id:"loaders.gl"});class te{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const ee={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){H(this,"console",void 0),this.console=console}log(...t){return this.console.log.bind(this.console,...t)}info(...t){return this.console.info.bind(this.console,...t)}warn(...t){return this.console.warn.bind(this.console,...t)}error(...t){return this.console.error.bind(this.console,...t)}},CDN:"https://unpkg.com/@loaders.gl",worker:!0,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,_workerType:"",limit:0,_limitMB:0,batchSize:"auto",batchDebounceMs:0,metadata:!1,transforms:[]},re={throws:"nothrow",dataType:"(no longer used)",uri:"baseUri",method:"fetch.method",headers:"fetch.headers",body:"fetch.body",mode:"fetch.mode",credentials:"fetch.credentials",cache:"fetch.cache",redirect:"fetch.redirect",referrer:"fetch.referrer",referrerPolicy:"fetch.referrerPolicy",integrity:"fetch.integrity",keepalive:"fetch.keepalive",signal:"fetch.signal"};function ne(){globalThis.loaders=globalThis.loaders||{};const{loaders:t}=globalThis;return t._state=t._state||{},t._state}const se=()=>{const t=ne();return t.globalOptions=t.globalOptions||{...ee},t.globalOptions};function ie(t,e,r,n){return r=r||[],function(t,e){ae(t,null,ee,re,e);for(const r of e){const n=t&&t[r.id]||{},s=r.options&&r.options[r.id]||{},i=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};ae(n,r.id,s,i,e)}}(t,r=Array.isArray(r)?r:[r]),function(t,e,r){const n={...t.options||{}};(function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)})(n,r),null===n.log&&(n.log=new te);return ue(n,se()),ue(n,e),n}(e,t,n)}function oe(t,e){const r=se(),n=t||r;return"function"==typeof n.fetch?n.fetch:yt(n.fetch)?t=>Rt(t,n):null!=e&&e.fetch?null==e?void 0:e.fetch:Rt}function ae(t,e,r,n,s){const i=e||"Top level",o=e?"".concat(e,"."):"";for(const a in t){const c=!e&&yt(t[a]),u="baseUri"===a&&!e,l="workerUrl"===a&&e;if(!(a in r)&&!u&&!l)if(a in n)$t.warn("".concat(i," loader option '").concat(o).concat(a,"' no longer supported, use '").concat(n[a],"'"))();else if(!c){const t=ce(a,s);$t.warn("".concat(i," loader option '").concat(o).concat(a,"' not recognized. ").concat(t))()}}}function ce(t,e){const r=t.toLowerCase();let n="";for(const s of e)for(const e in s.options){if(t===e)return"Did you mean '".concat(s.id,".").concat(e,"'?");const i=e.toLowerCase();(r.startsWith(i)||i.startsWith(r))&&(n=n||"Did you mean '".concat(s.id,".").concat(e,"'?"))}return n}function ue(t,e){for(const r in e)if(r in e){const n=e[r];Ct(n)&&Ct(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function le(t){var e;if(!t)return!1;Array.isArray(t)&&(t=t[0]);return Array.isArray(null===(e=t)||void 0===e?void 0:e.extensions)}function he(t){var e,r;let n;return F(t,"null loader"),F(le(t),"invalid loader"),Array.isArray(t)&&(n=t[1],t=t[0],t={...t,options:{...t.options,...n}}),(null!==(e=t)&&void 0!==e&&e.parseTextSync||null!==(r=t)&&void 0!==r&&r.parseText)&&(t.text=!0),t.text||(t.binary=!0),t}function de(){return(()=>{const t=ne();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry})()}const fe=/\.([^.]+)$/;function Ae(t,e=[],r,n){if(!me(t))return null;if(e&&!Array.isArray(e))return he(e);let s=[];e&&(s=s.concat(e)),null!=r&&r.ignoreRegisteredLoaders||s.push(...de()),function(t){for(const e of t)he(e)}(s);const i=function(t,e,r,n){const{url:s,type:i}=Ft(t),o=s||(null==n?void 0:n.url);let a=null;null!=r&&r.mimeType&&(a=Be(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&fe.exec(e),n=r&&r[1];return n?function(t,e){e=e.toLowerCase();for(const r of t)for(const t of r.extensions)if(t.toLowerCase()===e)return r;return null}(t,n):null}(e,o),a=a||Be(e,i),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(ge(e,r))return r}else if(ArrayBuffer.isView(e)){if(ye(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(ye(e,0,r))return r}return null}(e,t),a=a||Be(e,null==r?void 0:r.fallbackMimeType),a}(t,s,r,n);if(!(i||null!=r&&r.nothrow))throw new Error(pe(t));return i}function me(t){return!(t instanceof Response&&204===t.status)}function pe(t){const{url:e,type:r}=Ft(t);let n="No valid loader found (";n+=e?"".concat(function(t){const e=t&&t.lastIndexOf("/");return e>=0?t.substr(e+1):""}(e),", "):"no url provided, ",n+="MIME type: ".concat(r?'"'.concat(r,'"'):"not provided",", ");const s=t?function(t,e=5){if("string"==typeof t)return t.slice(0,e);if(ArrayBuffer.isView(t))return Ce(t.buffer,t.byteOffset,e);if(t instanceof ArrayBuffer){return Ce(t,0,e)}return""}(t):"";return n+=s?' first bytes: "'.concat(s,'"'):"first bytes: not available",n+=")",n}function Be(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x.".concat(r.id))return r}return null}function ge(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some((e=>t.startsWith(e)))}function ye(t,e,r){return(Array.isArray(r.tests)?r.tests:[r.tests]).some((n=>function(t,e,r,n){if(n instanceof ArrayBuffer)return function(t,e,r){if(r=r||t.byteLength,t.byteLength<r||e.byteLength<r)return!1;const n=new Uint8Array(t),s=new Uint8Array(e);for(let t=0;t<n.length;++t)if(n[t]!==s[t])return!1;return!0}(n,t,n.byteLength);switch(typeof n){case"function":return n(t,r);case"string":return n===Ce(t,e,n.length);default:return!1}}(t,e,r,n)))}function Ce(t,e,r){if(t.byteLength<e+r)return"";const n=new DataView(t);let s="";for(let t=0;t<r;t++)s+=String.fromCharCode(n.getUint8(e+t));return s}const be=262144;function we(t,e){return D?async function*(t,e){const r=t.getReader();let n;try{for(;;){const t=n||r.read();null!=e&&e._streamReadAhead&&(n=r.read());const{done:s,value:i}=await t;if(s)return;yield ot(i)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield ot(e)}(t)}function Te(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let n=0;const s=new TextEncoder;for(;n<t.length;){const e=Math.min(t.length-n,r),i=t.slice(n,n+e);n+=e,yield s.encode(i)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=be}=e;let n=0;for(;n<t.byteLength;){const e=Math.min(t.byteLength-n,r),s=new ArrayBuffer(e),i=new Uint8Array(t,n,e);new Uint8Array(s).set(i),n+=e,yield s}}(t,e);if(wt(t))return async function*(t,e){const r=(null==e?void 0:e.chunkSize)||1048576;let n=0;for(;n<t.size;){const e=n+r,s=await t.slice(n,e).arrayBuffer();n=e,yield s}}(t,e);if(Tt(t))return we(t,e);if(bt(t)){return we(t.body,e)}throw new Error("makeIterator")}const Ee="Cannot convert supplied data type";async function _e(t,e,r){const n=t instanceof ArrayBuffer||ArrayBuffer.isView(t);if("string"==typeof t||n)return function(t,e,r){if(e.text&&"string"==typeof t)return t;var n;if((n=t)&&"object"==typeof n&&n.isBuffer&&(t=t.buffer),t instanceof ArrayBuffer){const r=t;return e.text&&!e.binary?new TextDecoder("utf8").decode(r):r}if(ArrayBuffer.isView(t)){if(e.text&&!e.binary)return new TextDecoder("utf8").decode(t);let r=t.buffer;const n=t.byteLength||t.length;return 0===t.byteOffset&&n===r.byteLength||(r=r.slice(t.byteOffset,t.byteOffset+n)),r}throw new Error(Ee)}(t,e);if(wt(t)&&(t=await Gt(t)),bt(t)){const r=t;return await async function(t){if(!t.ok){const e=await async function(t){let e="Failed to fetch resource ".concat(t.url," (").concat(t.status,"): ");try{const r=t.headers.get("Content-Type");let n=t.statusText;r.includes("application/json")&&(n+=" ".concat(await t.text())),e+=n,e=e.length>60?"".concat(e.slice(60),"..."):e}catch(t){}return e}(t);throw new Error(e)}}(r),e.binary?await r.arrayBuffer():await r.text()}if(Tt(t)&&(t=Te(t,r)),(s=t)&&"function"==typeof s[Symbol.iterator]||(t=>t&&"function"==typeof t[Symbol.asyncIterator])(t))return lt(t);var s;throw new Error(Ee)}async function Me(t,e,r,n){R(!n||"object"==typeof n),!e||Array.isArray(e)||le(e)||(n=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:s}=Ft(t),i=function(t,e){if(!e&&t&&!Array.isArray(t))return t;let r;if(t&&(r=Array.isArray(t)?t:[t]),e&&e.loaders){const t=Array.isArray(e.loaders)?e.loaders:[e.loaders];r=r?[...r,...t]:t}return r&&r.length?r:null}(e,n),o=await async function(t,e=[],r,n){if(!me(t))return null;let s=Ae(t,e,{...r,nothrow:!0},n);if(s)return s;if(wt(t)&&(s=Ae(t=await t.slice(0,10).arrayBuffer(),e,r,n)),!(s||null!=r&&r.nothrow))throw new Error(pe(t));return s}(t,i,r);return o?(n=function(t,e,r=null){if(r)return r;const n={fetch:oe(e,t),...t};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:s,parse:Me,loaders:i},r=ie(r,o,i,s),n),await async function(t,e,r,n){if(function(t,e="3.1.4"){R(t,"no worker provided");const r=t.version}(t),e=await _e(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,n,t);if(function(t,e){return!!Y.isSupported()&&t.worker&&(null==e?void 0:e.worker)}(t,r))return await et(t,e,r,0,Me);if(t.parseText&&"string"==typeof e)return await t.parseText(e,r,n,t);if(t.parse)return await t.parse(e,r,n,t);throw R(!t.parseSync),new Error("".concat(t.id," loader - no parser found and worker is disabled"))}(o,t,r,n)):null}async function ve(t,e,r,n){Array.isArray(e)||le(e)||(r=e,e=void 0);const s=oe(r);let i=t;return"string"==typeof t&&(i=await s(t)),wt(t)&&(i=await s(t)),await Me(i,e,r)}function Ie(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const Fe=1/Math.PI*180,De=1/180*Math.PI,Ge={};function Re(t,{precision:e=Ge.precision||4}={}){return t=function(t){return Math.round(t/Ge.EPSILON)*Ge.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Se(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Oe(t,e,r){if(Se(t)){r=r||((n=t).clone?n.clone():new Array(n.length));for(let n=0;n<r.length&&n<t.length;++n)r[n]=e(t[n],n,r);return r}var n;return e(t)}function xe(t){return function(t,e){return Oe(t,(t=>t*De),e)}(t)}function Ue(t){return Le(t)}function Le(t,e){return Oe(t,(t=>t*Fe),e)}function Ne(t,e,r){const n=Ge.EPSILON;r&&(Ge.EPSILON=r);try{if(t===e)return!0;if(Se(t)&&Se(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Ne(t[r],e[r]))return!1;return!0}return t&&t.equals?t.equals(e):e&&e.equals?e.equals(t):!(!Number.isFinite(t)||!Number.isFinite(e))&&Math.abs(t-e)<=Ge.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{Ge.EPSILON=n}}Ge.EPSILON=1e-12,Ge.debug=!1,Ge.precision=4,Ge.printTypes=!1,Ge.printDegrees=!1,Ge.printRowMajor=!0;class He extends(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Array)){get ELEMENTS(){return Ie(!1),0}clone(){return(new this.constructor).copy(this)}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}fromArray(t,e=0){for(let r=0;r<this.ELEMENTS;++r)this[r]=t[r+e];return this.check()}to(t){return t===this?this:Se(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toArray(t=[],e=0){for(let r=0;r<this.ELEMENTS;++r)t[e+r]=this[r];return t}toFloat32Array(){return new Float32Array(this)}toString(){return this.formatString(Ge)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Re(this[r],t);return"".concat(t.printTypes?this.constructor.name:"","[").concat(e,"]")}equals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(!Ne(this[e],t[e]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let e=0;e<this.ELEMENTS;++e)if(this[e]!==t[e])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,e,r){void 0===r&&(r=e,e=t,t=this);for(let n=0;n<this.ELEMENTS;++n){const s=t[n];this[n]=s+r*(e[n]-s)}return this.check()}min(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.min(t[e],this[e]);return this.check()}max(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=Math.max(t[e],this[e]);return this.check()}clamp(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t[r]),e[r]);return this.check()}add(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]+=e[t];return this.check()}subtract(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]-=e[t];return this.check()}scale(t){if(Array.isArray(t))return this.multiply(t);for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}sub(t){return this.subtract(t)}setScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]=t;return this.check()}addScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]+=t;return this.check()}subScalar(t){return this.addScalar(-t)}multiplyScalar(t){for(let e=0;e<this.ELEMENTS;++e)this[e]*=t;return this.check()}divideScalar(t){return this.scale(1/t)}clampScalar(t,e){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(Math.max(this[r],t),e);return this.check()}multiplyByScalar(t){return this.scale(t)}get elements(){return this}check(){if(Ge.debug&&!this.validate())throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));return this}validate(){let t=this.length===this.ELEMENTS;for(let e=0;e<this.ELEMENTS;++e)t=t&&Number.isFinite(this[e]);return t}}function Je(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Pe(t,e,r=""){if(Ge.debug&&!function(t,e){if(t.length!==e)return!1;for(let e=0;e<t.length;++e)if(!Number.isFinite(t[e]))return!1;return!0}(t,e))throw new Error("math.gl: ".concat(r," some fields set to invalid numbers'"));return t}const je={};function ke(t,e){je[t]||(je[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class Ke extends He{get ELEMENTS(){return Ie(!1),0}copy(t){return Ie(!1),this}get x(){return this[0]}set x(t){this[0]=Je(t)}get y(){return this[1]}set y(t){this[1]=Je(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let e=0;e<this.ELEMENTS;++e)t+=this[e]*this[e];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let e=0;for(let r=0;r<this.ELEMENTS;++r){const n=this[r]-t[r];e+=n*n}return Je(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Je(e)}normalize(){const t=this.magnitude();if(0!==t)for(let e=0;e<this.ELEMENTS;++e)this[e]/=t;return this.check()}multiply(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]*=e[t];return this.check()}divide(...t){for(const e of t)for(let t=0;t<this.ELEMENTS;++t)this[t]/=e[t];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return Ie(t>=0&&t<this.ELEMENTS,"index is out of range"),Je(this[t])}setComponent(t,e){return Ie(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=e,this.check()}addVectors(t,e){return this.copy(t).add(e)}subVectors(t,e){return this.copy(t).subtract(e)}multiplyVectors(t,e){return this.copy(t).multiply(e)}addScaledVector(t,e){return this.add(new this.constructor(t).multiplyScalar(e))}}var Ve,Qe="undefined"!=typeof Float32Array?Float32Array:Array;function qe(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[3]*s+r[6],t[1]=r[1]*n+r[4]*s+r[7],t}function ze(t,e,r){var n=e[0],s=e[1];return t[0]=r[0]*n+r[4]*s+r[12],t[1]=r[1]*n+r[5]*s+r[13],t}function We(t,e,r){const n=e[0],s=e[1],i=r[3]*n+r[7]*s||1;return t[0]=(r[0]*n+r[4]*s)/i,t[1]=(r[1]*n+r[5]*s)/i,t}function Ye(t,e,r){const n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i||1;return t[0]=(r[0]*n+r[4]*s+r[8]*i)/o,t[1]=(r[1]*n+r[5]*s+r[9]*i)/o,t[2]=(r[2]*n+r[6]*s+r[10]*i)/o,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),Ve=new Qe(2),Qe!=Float32Array&&(Ve[0]=0,Ve[1]=0);class Xe extends Ke{constructor(t=0,e=0){super(2),Se(t)&&1===arguments.length?this.copy(t):(Ge.debug&&(Je(t),Je(e)),this[0]=t,this[1]=e)}set(t,e){return this[0]=t,this[1]=e,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return Ge.debug&&(Je(t.x),Je(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return ze(this,this,t),this.check()}transformAsVector(t){return We(this,this,t),this.check()}transformByMatrix3(t){return qe(this,this,t),this.check()}transformByMatrix2x3(t){return function(t,e,r){var n=e[0],s=e[1];t[0]=r[0]*n+r[2]*s+r[4],t[1]=r[1]*n+r[3]*s+r[5]}(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){var n=e[0],s=e[1];t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s}(this,this,t),this.check()}}function Ze(){var t=new Qe(3);return Qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function $e(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function tr(t,e,r){var n=new Qe(3);return n[0]=t,n[1]=e,n[2]=r,n}function er(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function rr(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2];return t[0]=s*c-i*a,t[1]=i*o-n*c,t[2]=n*a-s*o,t}function nr(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[3]*n+r[7]*s+r[11]*i+r[15];return o=o||1,t[0]=(r[0]*n+r[4]*s+r[8]*i+r[12])/o,t[1]=(r[1]*n+r[5]*s+r[9]*i+r[13])/o,t[2]=(r[2]*n+r[6]*s+r[10]*i+r[14])/o,t}function sr(t,e,r){var n=e[0],s=e[1],i=e[2];return t[0]=n*r[0]+s*r[3]+i*r[6],t[1]=n*r[1]+s*r[4]+i*r[7],t[2]=n*r[2]+s*r[5]+i*r[8],t}var ir=$e;!function(){var t=Ze()}();const or=[0,0,0],ar={};class cr extends Ke{static get ZERO(){return ar.ZERO=ar.ZERO||Object.freeze(new cr(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Se(t)?this.copy(t):(Ge.debug&&(Je(t),Je(e),Je(r)),this[0]=t,this[1]=e,this[2]=r)}set(t,e,r){return this[0]=t,this[1]=e,this[2]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return Ge.debug&&(Je(t.x),Je(t.y),Je(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=Je(t)}angle(t){return function(t,e){var r=t[0],n=t[1],s=t[2],i=e[0],o=e[1],a=e[2],c=Math.sqrt(r*r+n*n+s*s)*Math.sqrt(i*i+o*o+a*a),u=c&&er(t,e)/c;return Math.acos(Math.min(Math.max(u,-1),1))}(this,t)}cross(t){return rr(this,this,t),this.check()}rotateX({radians:t,origin:e=or}){return function(t,e,r,n){var s=[],i=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0],i[1]=s[1]*Math.cos(n)-s[2]*Math.sin(n),i[2]=s[1]*Math.sin(n)+s[2]*Math.cos(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2]}(this,this,e,t),this.check()}rotateY({radians:t,origin:e=or}){return function(t,e,r,n){var s=[],i=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[2]*Math.sin(n)+s[0]*Math.cos(n),i[1]=s[1],i[2]=s[2]*Math.cos(n)-s[0]*Math.sin(n),t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2]}(this,this,e,t),this.check()}rotateZ({radians:t,origin:e=or}){return function(t,e,r,n){var s=[],i=[];s[0]=e[0]-r[0],s[1]=e[1]-r[1],s[2]=e[2]-r[2],i[0]=s[0]*Math.cos(n)-s[1]*Math.sin(n),i[1]=s[0]*Math.sin(n)+s[1]*Math.cos(n),i[2]=s[2],t[0]=i[0]+r[0],t[1]=i[1]+r[1],t[2]=i[2]+r[2]}(this,this,e,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return nr(this,this,t),this.check()}transformAsVector(t){return Ye(this,this,t),this.check()}transformByMatrix3(t){return sr(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],s=e[1];t[0]=r[0]*n+r[2]*s,t[1]=r[1]*n+r[3]*s,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){return function(t,e,r){var n=r[0],s=r[1],i=r[2],o=r[3],a=e[0],c=e[1],u=e[2],l=s*u-i*c,h=i*a-n*u,d=n*c-s*a,f=s*d-i*h,A=i*l-n*d,m=n*h-s*l,p=2*o;l*=p,h*=p,d*=p,f*=2,A*=2,m*=2,t[0]=a+l+f,t[1]=c+h+A,t[2]=u+d+m}(this,this,t),this.check()}}class ur extends He{get ELEMENTS(){return Ie(!1),0}get RANK(){return Ie(!1),0}toString(){let t="[";if(Ge.printRowMajor){t+="row-major:";for(let e=0;e<this.RANK;++e)for(let r=0;r<this.RANK;++r)t+=" ".concat(this[r*this.RANK+e])}else{t+="column-major:";for(let e=0;e<this.ELEMENTS;++e)t+=" ".concat(this[e])}return t+="]",t}getElementIndex(t,e){return e*this.RANK+t}getElement(t,e){return this[e*this.RANK+t]}setElement(t,e,r){return this[e*this.RANK+t]=Je(r),this}getColumn(t,e=new Array(this.RANK).fill(-0)){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)e[t]=this[r+t];return e}setColumn(t,e){const r=t*this.RANK;for(let t=0;t<this.RANK;++t)this[r+t]=e[t];return this}}function lr(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=r[0],f=r[1],A=r[2],m=r[3],p=r[4],B=r[5],g=r[6],y=r[7],C=r[8];return t[0]=d*n+f*o+A*u,t[1]=d*s+f*a+A*l,t[2]=d*i+f*c+A*h,t[3]=m*n+p*o+B*u,t[4]=m*s+p*a+B*l,t[5]=m*i+p*c+B*h,t[6]=g*n+y*o+C*u,t[7]=g*s+y*a+C*l,t[8]=g*i+y*c+C*h,t}function hr(t,e,r){var n=r[0],s=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=s*e[3],t[4]=s*e[4],t[5]=s*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const dr=Object.freeze([1,0,0,0,1,0,0,0,1]),fr=Object.freeze([0,0,0,0,0,0,0,0,0]),Ar=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),mr={};class pr extends ur{static get IDENTITY(){return mr.IDENTITY=mr.IDENTITY||Object.freeze(new pr(dr)),mr.IDENTITY}static get ZERO(){return mr.ZERO=mr.ZERO||Object.freeze(new pr(fr)),mr.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Ar}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}set(t,e,r,n,s,i,o,a,c){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=s,this[5]=i,this[6]=o,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,r,n,s,i,o,a,c){return this[0]=t,this[1]=n,this[2]=o,this[3]=e,this[4]=s,this[5]=a,this[6]=r,this[7]=i,this[8]=c,this.check()}determinant(){return function(t){var e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8];return e*(u*i-o*c)+r*(-u*s+o*a)+n*(c*s-i*a)}(this)}identity(){return this.copy(dr)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,l=n*o,h=n*a,d=s*o,f=s*a,A=s*c,m=i*o,p=i*a,B=i*c;t[0]=1-h-A,t[3]=l-B,t[6]=d+p,t[1]=l+B,t[4]=1-u-A,t[7]=f-m,t[2]=d-p,t[5]=f+m,t[8]=1-u-h}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],s=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=s}else 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]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],h=l*o-a*u,d=-l*i+a*c,f=u*i-o*c,A=r*h+n*d+s*f;A&&(A=1/A,t[0]=h*A,t[1]=(-l*n+s*u)*A,t[2]=(a*n-s*o)*A,t[3]=d*A,t[4]=(l*r-s*c)*A,t[5]=(-a*r+s*i)*A,t[6]=f*A,t[7]=(-u*r+n*c)*A,t[8]=(o*r-n*i)*A)}(this,this),this.check()}multiplyLeft(t){return lr(this,t,this),this.check()}multiplyRight(t){return lr(this,this,t),this.check()}rotate(t){return function(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=Math.sin(r),f=Math.cos(r);t[0]=f*n+d*o,t[1]=f*s+d*a,t[2]=f*i+d*c,t[3]=f*o-d*n,t[4]=f*a-d*s,t[5]=f*c-d*i,t[6]=u,t[7]=l,t[8]=h}(this,this,t),this.check()}scale(t){return Array.isArray(t)?hr(this,this,t):hr(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=r[0],f=r[1];t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=d*n+f*o+u,t[7]=d*s+f*a+l,t[8]=d*i+f*c+h}(this,this,t),this.check()}transform(t,e){switch(t.length){case 2:e=qe(e||[-0,-0],t,this);break;case 3:e=sr(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const n=e[0],s=e[1],i=e[2];return t[0]=r[0]*n+r[3]*s+r[6]*i,t[1]=r[1]*n+r[4]*s+r[7]*i,t[2]=r[2]*n+r[5]*s+r[8]*i,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Pe(e,t.length),e}transformVector(t,e){return ke("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return ke("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return ke("Matrix3.transformVector"),this.transform(t,e)}}function Br(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=e[9],f=e[10],A=e[11],m=e[12],p=e[13],B=e[14],g=e[15],y=r[0],C=r[1],b=r[2],w=r[3];return t[0]=y*n+C*a+b*h+w*m,t[1]=y*s+C*c+b*d+w*p,t[2]=y*i+C*u+b*f+w*B,t[3]=y*o+C*l+b*A+w*g,y=r[4],C=r[5],b=r[6],w=r[7],t[4]=y*n+C*a+b*h+w*m,t[5]=y*s+C*c+b*d+w*p,t[6]=y*i+C*u+b*f+w*B,t[7]=y*o+C*l+b*A+w*g,y=r[8],C=r[9],b=r[10],w=r[11],t[8]=y*n+C*a+b*h+w*m,t[9]=y*s+C*c+b*d+w*p,t[10]=y*i+C*u+b*f+w*B,t[11]=y*o+C*l+b*A+w*g,y=r[12],C=r[13],b=r[14],w=r[15],t[12]=y*n+C*a+b*h+w*m,t[13]=y*s+C*c+b*d+w*p,t[14]=y*i+C*u+b*f+w*B,t[15]=y*o+C*l+b*A+w*g,t}function gr(t,e,r){var n=r[0],s=r[1],i=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*s,t[5]=e[5]*s,t[6]=e[6]*s,t[7]=e[7]*s,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}!function(){var t=function(){var t=new Qe(4);return Qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}()}();const yr=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Cr=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),br=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL0ROW3:3,COL1ROW0:4,COL1ROW1:5,COL1ROW2:6,COL1ROW3:7,COL2ROW0:8,COL2ROW1:9,COL2ROW2:10,COL2ROW3:11,COL3ROW0:12,COL3ROW1:13,COL3ROW2:14,COL3ROW3:15}),wr={};class Tr extends ur{static get IDENTITY(){return wr.IDENTITY=wr.IDENTITY||Object.freeze(new Tr(yr)),wr.IDENTITY}static get ZERO(){return wr.ZERO=wr.ZERO||Object.freeze(new Tr(Cr)),wr.ZERO}get INDICES(){return br}get ELEMENTS(){return 16}get RANK(){return 4}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),1===arguments.length&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,e,r,n,s,i,o,a,c,u,l,h,d,f,A,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=s,this[5]=i,this[6]=o,this[7]=a,this[8]=c,this[9]=u,this[10]=l,this[11]=h,this[12]=d,this[13]=f,this[14]=A,this[15]=m,this.check()}setRowMajor(t,e,r,n,s,i,o,a,c,u,l,h,d,f,A,m){return this[0]=t,this[1]=s,this[2]=c,this[3]=d,this[4]=e,this[5]=i,this[6]=u,this[7]=f,this[8]=r,this[9]=o,this[10]=l,this[11]=A,this[12]=n,this[13]=a,this[14]=h,this[15]=m,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(yr)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r+r,a=n+n,c=s+s,u=r*o,l=n*o,h=n*a,d=s*o,f=s*a,A=s*c,m=i*o,p=i*a,B=i*c;t[0]=1-h-A,t[1]=l+B,t[2]=d-p,t[3]=0,t[4]=l-B,t[5]=1-u-A,t[6]=f+m,t[7]=0,t[8]=d+p,t[9]=f-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(this,t),this.check()}frustum({left:t,right:e,bottom:r,top:n,near:s,far:i}){return i===1/0?Tr._computeInfinitePerspectiveOffCenter(this,t,e,r,n,s):function(t,e,r,n,s,i,o){var a=1/(r-e),c=1/(s-n),u=1/(i-o);t[0]=2*i*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*i*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(s+n)*c,t[10]=(o+i)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*i*2*u,t[15]=0}(this,t,e,r,n,s,i),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,s,i){const o=2*i/(r-e),a=2*i/(s-n),c=(r+e)/(r-e),u=(s+n)/(s-n),l=-2*i;return t[0]=o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=c,t[9]=u,t[10]=-1,t[11]=-1,t[12]=0,t[13]=0,t[14]=l,t[15]=0,t}lookAt(t,e,r){return 1===arguments.length&&({eye:t,center:e,up:r}=t),function(t,e,r,n){var s,i,o,a,c,u,l,h,d,f,A=e[0],m=e[1],p=e[2],B=n[0],g=n[1],y=n[2],C=r[0],b=r[1],w=r[2];Math.abs(A-C)<1e-6&&Math.abs(m-b)<1e-6&&Math.abs(p-w)<1e-6?function(t){t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1}(t):(l=A-C,h=m-b,d=p-w,s=g*(d*=f=1/Math.hypot(l,h,d))-y*(h*=f),i=y*(l*=f)-B*d,o=B*h-g*l,(f=Math.hypot(s,i,o))?(s*=f=1/f,i*=f,o*=f):(s=0,i=0,o=0),a=h*o-d*i,c=d*s-l*o,u=l*i-h*s,(f=Math.hypot(a,c,u))?(a*=f=1/f,c*=f,u*=f):(a=0,c=0,u=0),t[0]=s,t[1]=a,t[2]=l,t[3]=0,t[4]=i,t[5]=c,t[6]=h,t[7]=0,t[8]=o,t[9]=u,t[10]=d,t[11]=0,t[12]=-(s*A+i*m+o*p),t[13]=-(a*A+c*m+u*p),t[14]=-(l*A+h*m+d*p),t[15]=1)}(this,t,e=e||[0,0,0],r=r||[0,1,0]),this.check()}ortho({left:t,right:e,bottom:r,top:n,near:s=.1,far:i=500}){return function(t,e,r,n,s,i,o){var a=1/(e-r),c=1/(n-s),u=1/(i-o);t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*a,t[13]=(s+n)*c,t[14]=(o+i)*u,t[15]=1}(this,t,e,r,n,s,i),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:s=500}){if(t>2*Math.PI)throw Error("radians");const i=t/2,o=r*Math.tan(i),a=o*e;return(new Tr).ortho({left:-a,right:a,bottom:-o,top:o,near:n,far:s})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:s=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,n,s){var i,o=1/Math.tan(e/2);t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=s&&s!==1/0?(i=1/(n-s),t[10]=(s+n)*i,t[14]=2*s*n*i):(t[10]=-1,t[14]=-2*n)}(this,t,r,n,s),this.check()}determinant(){return function(t){var e=t[0],r=t[1],n=t[2],s=t[3],i=t[4],o=t[5],a=t[6],c=t[7],u=t[8],l=t[9],h=t[10],d=t[11],f=t[12],A=t[13],m=t[14],p=t[15];return(e*o-r*i)*(h*p-d*m)-(e*a-n*i)*(l*p-d*A)+(e*c-s*i)*(l*m-h*A)+(r*a-n*o)*(u*p-d*f)-(r*c-s*o)*(u*m-h*f)+(n*c-s*a)*(u*A-l*f)}(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*s,t[6]=this[6]*i,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*s,t[10]=this[10]*i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t=[-0,-0,-0,-0,-0,-0,-0,-0,-0],e=null){const r=this.getScale(e||[-0,-0,-0]),n=1/r[0],s=1/r[1],i=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*s,t[2]=this[2]*i,t[3]=this[4]*n,t[4]=this[5]*s,t[5]=this[6]*i,t[6]=this[8]*n,t[7]=this[9]*s,t[8]=this[10]*i,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],s=e[3],i=e[6],o=e[7],a=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=i,t[11]=e[14],t[12]=s,t[13]=o,t[14]=a}else 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]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=e[4],a=e[5],c=e[6],u=e[7],l=e[8],h=e[9],d=e[10],f=e[11],A=e[12],m=e[13],p=e[14],B=e[15],g=r*a-n*o,y=r*c-s*o,C=r*u-i*o,b=n*c-s*a,w=n*u-i*a,T=s*u-i*c,E=l*m-h*A,_=l*p-d*A,M=l*B-f*A,v=h*p-d*m,I=h*B-f*m,F=d*B-f*p,D=g*F-y*I+C*v+b*M-w*_+T*E;D&&(D=1/D,t[0]=(a*F-c*I+u*v)*D,t[1]=(s*I-n*F-i*v)*D,t[2]=(m*T-p*w+B*b)*D,t[3]=(d*w-h*T-f*b)*D,t[4]=(c*M-o*F-u*_)*D,t[5]=(r*F-s*M+i*_)*D,t[6]=(p*C-A*T-B*y)*D,t[7]=(l*T-d*C+f*y)*D,t[8]=(o*I-a*M+u*E)*D,t[9]=(n*M-r*I-i*E)*D,t[10]=(A*w-m*C+B*g)*D,t[11]=(h*C-l*w-f*g)*D,t[12]=(a*_-o*v-c*E)*D,t[13]=(r*v-n*_+s*E)*D,t[14]=(m*y-A*b-p*g)*D,t[15]=(l*b-h*y+d*g)*D)}(this,this),this.check()}multiplyLeft(t){return Br(this,t,this),this.check()}multiplyRight(t){return Br(this,this,t),this.check()}rotateX(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[4],o=e[5],a=e[6],c=e[7],u=e[8],l=e[9],h=e[10],d=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=i*s+u*n,t[5]=o*s+l*n,t[6]=a*s+h*n,t[7]=c*s+d*n,t[8]=u*s-i*n,t[9]=l*s-o*n,t[10]=h*s-a*n,t[11]=d*s-c*n}(this,this,t),this.check()}rotateY(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[8],l=e[9],h=e[10],d=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=i*s-u*n,t[1]=o*s-l*n,t[2]=a*s-h*n,t[3]=c*s-d*n,t[8]=i*n+u*s,t[9]=o*n+l*s,t[10]=a*n+h*s,t[11]=c*n+d*s}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){var n=Math.sin(r),s=Math.cos(r),i=e[0],o=e[1],a=e[2],c=e[3],u=e[4],l=e[5],h=e[6],d=e[7];e!==t&&(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[0]=i*s+u*n,t[1]=o*s+l*n,t[2]=a*s+h*n,t[3]=c*s+d*n,t[4]=u*s-i*n,t[5]=l*s-o*n,t[6]=h*s-a*n,t[7]=d*s-c*n}(this,this,t),this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,n){var s,i,o,a,c,u,l,h,d,f,A,m,p,B,g,y,C,b,w,T,E,_,M,v,I=n[0],F=n[1],D=n[2],G=Math.hypot(I,F,D);G<1e-6||(I*=G=1/G,F*=G,D*=G,s=Math.sin(r),o=1-(i=Math.cos(r)),a=e[0],c=e[1],u=e[2],l=e[3],h=e[4],d=e[5],f=e[6],A=e[7],m=e[8],p=e[9],B=e[10],g=e[11],y=I*I*o+i,C=F*I*o+D*s,b=D*I*o-F*s,w=I*F*o-D*s,T=F*F*o+i,E=D*F*o+I*s,_=I*D*o+F*s,M=F*D*o-I*s,v=D*D*o+i,t[0]=a*y+h*C+m*b,t[1]=c*y+d*C+p*b,t[2]=u*y+f*C+B*b,t[3]=l*y+A*C+g*b,t[4]=a*w+h*T+m*E,t[5]=c*w+d*T+p*E,t[6]=u*w+f*T+B*E,t[7]=l*w+A*T+g*E,t[8]=a*_+h*M+m*v,t[9]=c*_+d*M+p*v,t[10]=u*_+f*M+B*v,t[11]=l*_+A*M+g*v,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]))}(this,this,t,e),this.check()}scale(t){return Array.isArray(t)?gr(this,this,t):gr(this,this,[t,t,t]),this.check()}translate(t){return function(t,e,r){var n,s,i,o,a,c,u,l,h,d,f,A,m=r[0],p=r[1],B=r[2];e===t?(t[12]=e[0]*m+e[4]*p+e[8]*B+e[12],t[13]=e[1]*m+e[5]*p+e[9]*B+e[13],t[14]=e[2]*m+e[6]*p+e[10]*B+e[14],t[15]=e[3]*m+e[7]*p+e[11]*B+e[15]):(n=e[0],s=e[1],i=e[2],o=e[3],a=e[4],c=e[5],u=e[6],l=e[7],h=e[8],d=e[9],f=e[10],A=e[11],t[0]=n,t[1]=s,t[2]=i,t[3]=o,t[4]=a,t[5]=c,t[6]=u,t[7]=l,t[8]=h,t[9]=d,t[10]=f,t[11]=A,t[12]=n*m+a*p+h*B+e[12],t[13]=s*m+c*p+d*B+e[13],t[14]=i*m+u*p+f*B+e[14],t[15]=o*m+l*p+A*B+e[15])}(this,this,t),this.check()}transform(t,e){return 4===t.length?(e=function(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3];return t[0]=r[0]*n+r[4]*s+r[8]*i+r[12]*o,t[1]=r[1]*n+r[5]*s+r[9]*i+r[13]*o,t[2]=r[2]*n+r[6]*s+r[10]*i+r[14]*o,t[3]=r[3]*n+r[7]*s+r[11]*i+r[15]*o,t}(e||[-0,-0,-0,-0],t,this),Pe(e,4),e):this.transformAsPoint(t,e)}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:e=ze(e||[-0,-0],t,this);break;case 3:e=nr(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Pe(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=We(e||[-0,-0],t,this);break;case 3:e=Ye(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Pe(e,t.length),e}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,e,r){return this.identity().translate([t,e,r])}transformPoint(t,e){return ke("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return ke("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return ke("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}function Er(){var t=new Qe(4);return Qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function _r(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function Mr(t,e,r){var n=e[0],s=e[1],i=e[2],o=e[3],a=r[0],c=r[1],u=r[2],l=r[3];return t[0]=n*l+o*a+s*u-i*c,t[1]=s*l+o*c+i*a-n*u,t[2]=i*l+o*u+n*c-s*a,t[3]=o*l-n*a-s*c-i*u,t}function vr(t,e,r,n){var s,i,o,a,c,u=e[0],l=e[1],h=e[2],d=e[3],f=r[0],A=r[1],m=r[2],p=r[3];return(i=u*f+l*A+h*m+d*p)<0&&(i=-i,f=-f,A=-A,m=-m,p=-p),1-i>1e-6?(s=Math.acos(i),o=Math.sin(s),a=Math.sin((1-n)*s)/o,c=Math.sin(n*s)/o):(a=1-n,c=n),t[0]=a*u+c*f,t[1]=a*l+c*A,t[2]=a*h+c*m,t[3]=a*d+c*p,t}function Ir(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var s=0;e[4]>e[0]&&(s=1),e[8]>e[3*s+s]&&(s=2);var i=(s+1)%3,o=(s+2)%3;r=Math.sqrt(e[3*s+s]-e[3*i+i]-e[3*o+o]+1),t[s]=.5*r,r=.5/r,t[3]=(e[3*i+o]-e[3*o+i])*r,t[i]=(e[3*i+s]+e[3*s+i])*r,t[o]=(e[3*o+s]+e[3*s+o])*r}return t}var Fr,Dr,Gr,Rr=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t[3]=e[3]+r[3],t},Sr=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t},Or=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},xr=function(t,e,r,n){var s=e[0],i=e[1],o=e[2],a=e[3];return t[0]=s+n*(r[0]-s),t[1]=i+n*(r[1]-i),t[2]=o+n*(r[2]-o),t[3]=a+n*(r[3]-a),t},Ur=function(t){var e=t[0],r=t[1],n=t[2],s=t[3];return Math.hypot(e,r,n,s)},Lr=function(t){var e=t[0],r=t[1],n=t[2],s=t[3];return e*e+r*r+n*n+s*s},Nr=function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=r*o,t[1]=n*o,t[2]=s*o,t[3]=i*o,t},Hr=(Fr=Ze(),Dr=tr(1,0,0),Gr=tr(0,1,0),function(t,e,r){var n=er(e,r);return n<-.999999?(rr(Fr,Dr,e),ir(Fr)<1e-6&&rr(Fr,Gr,e),function(t,e){var r=e[0],n=e[1],s=e[2],i=r*r+n*n+s*s;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i}(Fr,Fr),_r(t,Fr,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(rr(Fr,e,r),t[0]=Fr[0],t[1]=Fr[1],t[2]=Fr[2],t[3]=1+n,Nr(t,t))});Er(),Er(),function(){var t=new Qe(9);Qe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1}();const Jr=[0,0,0,1];class Pr extends He{constructor(t=0,e=0,r=0,n=1){super(-0,-0,-0,-0),Array.isArray(t)&&1===arguments.length?this.copy(t):this.set(t,e,r,n)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,r,n){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this.check()}fromMatrix3(t){return Ir(this,t),this.check()}identity(){return function(t){t[0]=0,t[1]=0,t[2]=0,t[3]=1}(this),this.check()}fromAxisRotation(t,e){return _r(this,t,e),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=Je(t)}get y(){return this[1]}set y(t){this[1]=Je(t)}get z(){return this[2]}set z(t){this[2]=Je(t)}get w(){return this[3]}set w(t){this[3]=Je(t)}len(){return Ur(this)}lengthSquared(){return Lr(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return Or(this,t)}rotationTo(t,e){return Hr(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return Rr(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],n=e[1],s=e[2];t[0]=r,t[1]=n,t[2]=s,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-s*s))}(this,this),this.check()}conjugate(){return function(t,e){t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3]}(this,this),this.check()}invert(){return function(t,e){var r=e[0],n=e[1],s=e[2],i=e[3],o=r*r+n*n+s*s+i*i,a=o?1/o:0;t[0]=-r*a,t[1]=-n*a,t[2]=-s*a,t[3]=i*a}(this,this),this.check()}lerp(t,e,r){return xr(this,t,e,r),this.check()}multiplyRight(t,e){return Ie(!e),Mr(this,this,t),this.check()}multiplyLeft(t,e){return Ie(!e),Mr(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,0===t&&(this[3]=1),this.check()}rotateX(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+o*a,t[1]=s*c+i*a,t[2]=i*c-s*a,t[3]=o*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-i*a,t[1]=s*c+o*a,t[2]=i*c+n*a,t[3]=o*c-s*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],s=e[1],i=e[2],o=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+s*a,t[1]=s*c-n*a,t[2]=i*c+o*a,t[3]=o*c-i*a}(this,this,t),this.check()}scale(t){return Sr(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=Jr,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return vr(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var n=e[0],s=e[1],i=e[2],o=r[0],a=r[1],c=r[2],u=r[3],l=u*n+a*i-c*s,h=u*s+c*n-o*i,d=u*i+o*s-a*n,f=-o*n-a*s-c*i;t[0]=l*u+f*-o+h*-c-d*-a,t[1]=h*u+f*-a+d*-o-l*-c,t[2]=d*u+f*-c+l*-a-h*-o,t[3]=e[3]}(e,t,this),Pe(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t,e){return this.multiplyLeft(t,e)}multiply(t,e){return this.multiplyRight(t,e)}}var jr=.1,kr=1e-12,Kr=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;const Vr=t=>t,Qr=new cr;function qr(t,e=Qr){return function(t,e,r=Vr){return Se(t)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in t?(e[0]=r(t.longitude),e[1]=r(t.latitude),e[2]=t.height):(e[0]=r(t.x),e[1]=r(t.y),e[2]=t.z),e}(t,e,Ge._cartographicRadians?Vr:xe)}function zr(t,e){return function(t,e,r=Vr){return Se(e)?(e[0]=r(t[0]),e[1]=r(t[1]),e[2]=t[2]):"longitude"in e?(e.longitude=r(t[0]),e.latitude=r(t[1]),e.height=t[2]):(e.x=r(t[0]),e.y=r(t[1]),e.z=t[2]),e}(t,e,Ge._cartographicRadians?Vr:Ue)}const Wr=new cr,Yr=new cr,Xr=new cr;const Zr=new cr,$r={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"}},tn={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},en={east:new cr,north:new cr,up:new cr,west:new cr,south:new cr,down:new cr},rn=new cr,nn=new cr,sn=new cr;function on(t,e,r,n,s,i){const o=$r[e]&&$r[e][r];let a,c,u;Ie(o&&(!n||n===o));const l=Zr.copy(s);if(Ne(l.x,0,1e-14)&&Ne(l.y,0,1e-14)){const t=Math.sign(l.z);a=rn.fromArray(tn[e]),"east"!==e&&"west"!==e&&a.scale(t),c=nn.fromArray(tn[r]),"east"!==r&&"west"!==r&&c.scale(t),u=sn.fromArray(tn[n]),"east"!==n&&"west"!==n&&u.scale(t)}else{const{up:s,east:i,north:o}=en;i.set(-l.y,l.x,0).normalize(),t.geodeticSurfaceNormal(l,s),o.copy(s).cross(i);const{down:h,west:d,south:f}=en;h.copy(s).scale(-1),d.copy(i).scale(-1),f.copy(o).scale(-1),a=en[e],c=en[r],u=en[n]}return i[0]=a.x,i[1]=a.y,i[2]=a.z,i[3]=0,i[4]=c.x,i[5]=c.y,i[6]=c.z,i[7]=0,i[8]=u.x,i[9]=u.y,i[10]=u.z,i[11]=0,i[12]=l.x,i[13]=l.y,i[14]=l.z,i[15]=1,i}const an=new cr,cn=new cr,un=new cr,ln=new cr,hn=new cr,dn=new cr;let fn;class An{static get WGS84(){return fn=fn||new An(6378137,6378137,6356752.314245179),fn}constructor(t=0,e=0,r=0){Ie(t>=0),Ie(e>=0),Ie(r>=0),this.radii=new cr(t,e,r),this.radiiSquared=new cr(t*t,e*e,r*r),this.radiiToTheFourth=new cr(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new cr(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new cr(0===t?0:1/(t*t),0===e?0:1/(e*e),0===r?0:1/(r*r)),this.minimumRadius=Math.min(t,e,r),this.maximumRadius=Math.max(t,e,r),this.centerToleranceSquared=jr,0!==this.radiiSquared.z&&(this.squaredXOverSquaredZ=this.radiiSquared.x/this.radiiSquared.z),Object.freeze(this)}equals(t){return this===t||Boolean(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,e=[0,0,0]){const r=cn,n=un,[,,s]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const i=Math.sqrt(r.dot(n));return n.scale(1/i),r.scale(s),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){dn.from(t);const r=this.scaleToGeodeticSurface(dn,ln);if(!r)return;const n=this.geodeticSurfaceNormal(r,cn),s=hn;s.copy(dn).subtract(r);return zr([Math.atan2(n.y,n.x),Math.asin(n.z),Math.sign(er(s,dn))*$e(s)],e)}eastNorthUpToFixedFrame(t,e=new Tr){return on(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,s=new Tr){return on(this,t,e,r,n,s)}geocentricSurfaceNormal(t,e=[0,0,0]){return an.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=qr(t),n=r[0],s=r[1],i=Math.cos(s);return an.set(i*Math.cos(n),i*Math.sin(n),Math.sin(s)).normalize(),an.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return an.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new cr){const{oneOverRadii:n,oneOverRadiiSquared:s,centerToleranceSquared:i}=e;Wr.from(t);const o=t.x,a=t.y,c=t.z,u=n.x,l=n.y,h=n.z,d=o*o*u*u,f=a*a*l*l,A=c*c*h*h,m=d+f+A,p=Math.sqrt(1/m);if(!Number.isFinite(p))return;const B=Yr;if(B.copy(t).scale(p),m<i)return B.to(r);const g=s.x,y=s.y,C=s.z,b=Xr;b.set(B.x*g*2,B.y*y*2,B.z*C*2);let w,T,E,_,M=(1-p)*t.len()/(.5*b.len()),v=0;do{M-=v,w=1/(1+M*g),T=1/(1+M*y),E=1/(1+M*C);const t=w*w,e=T*T,r=E*E;_=d*t+f*e+A*r-1,v=_/(-2*(d*(t*w)*g+f*(e*T)*y+A*(r*E)*C))}while(Math.abs(_)>kr);return Wr.scale([w,T,E]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){ln.from(t);const r=ln.x,n=ln.y,s=ln.z,i=this.oneOverRadiiSquared,o=1/Math.sqrt(r*r*i.x+n*n*i.y+s*s*i.z);return ln.multiplyScalar(o).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return ln.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return ln.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){Ie(Ne(this.radii.x,this.radii.y,Kr)),Ie(this.radii.z>0),ln.from(t);const n=ln.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return ln.set(0,0,n).to(r)}}class mn{constructor(t,e,r){H(this,"item",void 0),H(this,"previous",void 0),H(this,"next",void 0),this.item=t,this.previous=e,this.next=r}}class pn{constructor(){H(this,"head",null),H(this,"tail",null),H(this,"_length",0)}get length(){return this._length}add(t){const e=new mn(t,this.tail,null);return this.tail?(this.tail.next=e,this.tail=e):(this.head=e,this.tail=e),++this._length,e}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,e){t!==e&&(this.remove(e),this._insert(t,e))}_insert(t,e){const r=t.next;t.next=e,this.tail===t?this.tail=e:r.previous=e,e.next=r,e.previous=t,++this._length}}function Bn(t){return null!=t}class gn{constructor(){H(this,"_list",void 0),H(this,"_sentinel",void 0),H(this,"_trimTiles",void 0),this._list=new pn,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){const e=t._cacheNode;Bn(e)&&this._list.splice(this._sentinel,e)}add(t,e,r){Bn(e._cacheNode)||(e._cacheNode=this._list.add(e),r&&r(t,e))}unloadTile(t,e,r){const n=e._cacheNode;Bn(n)&&(this._list.remove(n),e._cacheNode=void 0,r&&r(t,e))}unloadTiles(t,e){const r=this._trimTiles;this._trimTiles=!1;const n=this._list,s=1024*t.maximumMemoryUsage*1024,i=this._sentinel;let o=n.head;for(;o!==i&&(t.gpuMemoryUsageInBytes>s||r);){const r=o.item;o=o.next,this.unloadTile(t,r,e)}}trim(){this._trimTiles=!0}}const yn=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new cr,new cr;const Cn=new cr,bn=new cr;class wn{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new cr,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=Cn.from(e),this.center=(new cr).from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new wn(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,s=t.radius,i=Cn.copy(n).subtract(e),o=i.magnitude();if(r>=o+s)return this.clone();if(s>=o+r)return t.clone();const a=.5*(r+o+s);return bn.copy(i).scale((-r+a)/o).add(e),this.center.copy(bn),this.radius=a,this}expand(t){const e=(t=Cn.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=function(t,e){var r=e[0],n=e[1],s=e[2],i=e[4],o=e[5],a=e[6],c=e[8],u=e[9],l=e[10];return t[0]=Math.hypot(r,n,s),t[1]=Math.hypot(i,o,a),t[2]=Math.hypot(c,u,l),t}(Cn,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const e=(t=Cn.from(t)).subtract(this.center);return Math.max(0,e.len()-this.radius)}intersectPlane(t){const e=this.center,r=this.radius,n=t.normal.dot(e)+t.distance;return n<-r?yn.OUTSIDE:n<r?yn.INTERSECTING:yn.INSIDE}}const Tn=new cr,En=new cr,_n=new cr,Mn=new cr,vn=new cr,In=new cr,Fn=new cr,Dn=0,Gn=1,Rn=2,Sn=3,On=4,xn=5,Un=6,Ln=7,Nn=8;class Hn{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new cr).from(t),this.halfAxes=new pr(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new cr(t).len(),new cr(e).len(),new cr(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new cr(t).normalize(),s=new cr(e).normalize(),i=new cr(r).normalize();return(new Pr).fromMatrix3(new pr([...n,...s,...i]))}fromCenterHalfSizeQuaternion(t,e,r){const n=new Pr(r),s=(new pr).fromQuaternion(n);return s[0]=s[0]*e[0],s[1]=s[1]*e[0],s[2]=s[2]*e[0],s[3]=s[3]*e[1],s[4]=s[4]*e[1],s[5]=s[5]*e[1],s[6]=s[6]*e[2],s[7]=s[7]*e[2],s[8]=s[8]*e[2],this.center=(new cr).from(t),this.halfAxes=s,this}clone(){return new Hn(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new wn){const e=this.halfAxes,r=e.getColumn(0,_n),n=e.getColumn(1,Mn),s=e.getColumn(2,vn),i=Tn.copy(r).add(n).add(s);return t.center.copy(this.center),t.radius=i.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,n=this.halfAxes,s=r.x,i=r.y,o=r.z,a=Math.abs(s*n[Dn]+i*n[Gn]+o*n[Rn])+Math.abs(s*n[Sn]+i*n[On]+o*n[xn])+Math.abs(s*n[Un]+i*n[Ln]+o*n[Nn]),c=r.dot(e)+t.distance;return c<=-a?yn.OUTSIDE:c>=a?yn.INSIDE:yn.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=En.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,_n),s=r.getColumn(1,Mn),i=r.getColumn(2,vn),o=n.magnitude(),a=s.magnitude(),c=i.magnitude();n.normalize(),s.normalize(),i.normalize();let u,l=0;return u=Math.abs(e.dot(n))-o,u>0&&(l+=u*u),u=Math.abs(e.dot(s))-a,u>0&&(l+=u*u),u=Math.abs(e.dot(i))-c,u>0&&(l+=u*u),l}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;const i=this.center,o=this.halfAxes,a=o.getColumn(0,_n),c=o.getColumn(1,Mn),u=o.getColumn(2,vn),l=In.copy(a).add(c).add(u).add(i),h=Fn.copy(l).subtract(t);let d=e.dot(h);return n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).add(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).subtract(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),l.copy(i).add(a).subtract(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).add(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).add(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).subtract(c).add(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),i.copy(l).subtract(a).subtract(c).subtract(u),h.copy(l).subtract(t),d=e.dot(h),n=Math.min(d,n),s=Math.max(d,s),r[0]=n,r[1]=s,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,_n);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,Mn);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,vn);return n.transformAsPoint(t),this.halfAxes=new pr([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const Jn=new cr,Pn=new cr;class jn{constructor(t=[0,0,1],e=0){this.normal=new cr,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Ie(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Jn.from(t),this.normal.from(e).normalize();const r=-this.normal.dot(t);return this.distance=r,this}fromCoefficients(t,e,r,n){return this.normal.set(t,e,r),Ie(Ne(this.normal.len(),1)),this.distance=n,this}clone(t){return new jn(this.normal,this.distance)}equals(t){return Ne(this.distance,t.distance)&&Ne(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=Pn.copy(this.normal).transformAsVector(t).normalize(),r=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(r,e)}projectPointOntoPlane(t,e=[0,0,0]){t=Jn.from(t);const r=this.getPointDistance(t),n=Pn.copy(this.normal).scale(r);return t.subtract(n).to(e)}}const kn=[new cr([1,0,0]),new cr([0,1,0]),new cr([0,0,1])],Kn=new cr,Vn=new cr;new jn(new cr(1,0,0),0);class Qn{static get MASK_OUTSIDE(){return 4294967295}static get MASK_INSIDE(){return 0}static get MASK_INDETERMINATE(){return 2147483647}constructor(t=[]){this.planes=t,Ie(this.planes.every((t=>t instanceof jn)))}fromBoundingSphere(t){this.planes.length=2*kn.length;const e=t.center,r=t.radius;let n=0;for(const t of kn){let s=this.planes[n],i=this.planes[n+1];s||(s=this.planes[n]=new jn),i||(i=this.planes[n+1]=new jn);const o=Kn.copy(t).scale(-r).add(e);t.dot(o),s.fromPointNormal(o,t);const a=Kn.copy(t).scale(r).add(e),c=Vn.copy(t).negate();c.dot(a),i.fromPointNormal(a,c),n+=2}return this}computeVisibility(t){Ie(t);let e=yn.INSIDE;for(const r of this.planes){switch(t.intersectPlane(r)){case yn.OUTSIDE:return yn.OUTSIDE;case yn.INTERSECTING:e=yn.INTERSECTING}}return e}computeVisibilityWithPlaneMask(t,e){if(Ie(t,"boundingVolume is required."),Ie(Number.isFinite(e),"parentPlaneMask is required."),e===Qn.MASK_OUTSIDE||e===Qn.MASK_INSIDE)return e;let r=Qn.MASK_INSIDE;const n=this.planes;for(let s=0;s<this.planes.length;++s){const i=s<31?1<<s:0;if(s<31&&0==(e&i))continue;const o=n[s],a=t.intersectPlane(o);if(a===yn.OUTSIDE)return Qn.MASK_OUTSIDE;a===yn.INTERSECTING&&(r|=i)}return r}}const qn=new cr,zn=new cr,Wn=new cr,Yn=new cr,Xn=new cr;class Zn{constructor(t={}){t={near:1,far:5e8,...t},this.left=t.left,this._left=void 0,this.right=t.right,this._right=void 0,this.top=t.top,this._top=void 0,this.bottom=t.bottom,this._bottom=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this._cullingVolume=new Qn([new jn,new jn,new jn,new jn,new jn,new jn]),this._perspectiveMatrix=new Tr,this._infinitePerspective=new Tr}clone(){return new Zn({right:this.right,left:this.left,top:this.top,bottom:this.bottom,near:this.near,far:this.far})}equals(t){return t&&t instanceof Zn&&this.right===t.right&&this.left===t.left&&this.top===t.top&&this.bottom===t.bottom&&this.near===t.near&&this.far===t.far}get projectionMatrix(){return $n(this),this._perspectiveMatrix}get infiniteProjectionMatrix(){return $n(this),this._infinitePerspective}computeCullingVolume(t,e,r){Ie(t,"position is required."),Ie(e,"direction is required."),Ie(r,"up is required.");const n=this._cullingVolume.planes;r=qn.copy(r).normalize();const s=zn.copy(e).cross(r).normalize(),i=Wn.copy(e).multiplyByScalar(this.near).add(t),o=Yn.copy(e).multiplyByScalar(this.far).add(t);let a=Xn;return a.copy(s).multiplyByScalar(this.left).add(i).subtract(t).cross(r),n[0].fromPointNormal(t,a),a.copy(s).multiplyByScalar(this.right).add(i).subtract(t).cross(r).negate(),n[1].fromPointNormal(t,a),a.copy(r).multiplyByScalar(this.bottom).add(i).subtract(t).cross(s).negate(),n[2].fromPointNormal(t,a),a.copy(r).multiplyByScalar(this.top).add(i).subtract(t).cross(s),n[3].fromPointNormal(t,a),a=(new cr).copy(e),n[4].fromPointNormal(i,a),a.negate(),n[5].fromPointNormal(o,a),this._cullingVolume}getPixelDimensions(t,e,r,n){$n(this),Ie(Number.isFinite(t)&&Number.isFinite(e)),Ie(t>0),Ie(e>0),Ie(r>0),Ie(n);const s=1/this.near;let i=this.top*s;const o=2*r*i/e;i=this.right*s;const a=2*r*i/t;return n.x=a,n.y=o,n}}function $n(t){Ie(Number.isFinite(t.right)&&Number.isFinite(t.left)&&Number.isFinite(t.top)&&Number.isFinite(t.bottom)&&Number.isFinite(t.near)&&Number.isFinite(t.far));const{top:e,bottom:r,right:n,left:s,near:i,far:o}=t;e===t._top&&r===t._bottom&&s===t._left&&n===t._right&&i===t._near&&o===t._far||(Ie(t.near>0&&t.near<t.far,"near must be greater than zero and less than far."),t._left=s,t._right=n,t._top=e,t._bottom=r,t._near=i,t._far=o,t._perspectiveMatrix=(new Tr).frustum({left:s,right:n,bottom:r,top:e,near:i,far:o}),t._infinitePerspective=(new Tr).frustum({left:s,right:n,bottom:r,top:e,near:i,far:1/0}))}class ts{constructor(t={}){t={near:1,far:5e8,xOffset:0,yOffset:0,...t},this._offCenterFrustum=new Zn,this.fov=t.fov,this._fov=void 0,this._fovy=void 0,this._sseDenominator=void 0,this.aspectRatio=t.aspectRatio,this._aspectRatio=void 0,this.near=t.near,this._near=this.near,this.far=t.far,this._far=this.far,this.xOffset=t.xOffset,this._xOffset=this.xOffset,this.yOffset=t.yOffset,this._yOffset=this.yOffset}clone(){return new ts({aspectRatio:this.aspectRatio,fov:this.fov,near:this.near,far:this.far})}equals(t){return null!=t&&t instanceof ts&&(es(this),es(t),this.fov===t.fov&&this.aspectRatio===t.aspectRatio&&this.near===t.near&&this.far===t.far&&this._offCenterFrustum.equals(t._offCenterFrustum))}get projectionMatrix(){return es(this),this._offCenterFrustum.projectionMatrix}get infiniteProjectionMatrix(){return es(this),this._offCenterFrustum.infiniteProjectionMatrix}get fovy(){return es(this),this._fovy}get sseDenominator(){return es(this),this._sseDenominator}computeCullingVolume(t,e,r){return es(this),this._offCenterFrustum.computeCullingVolume(t,e,r)}getPixelDimensions(t,e,r,n){return es(this),this._offCenterFrustum.getPixelDimensions(t,e,r,n)}}function es(t){Ie(Number.isFinite(t.fov)&&Number.isFinite(t.aspectRatio)&&Number.isFinite(t.near)&&Number.isFinite(t.far));const e=t._offCenterFrustum;t.fov===t._fov&&t.aspectRatio===t._aspectRatio&&t.near===t._near&&t.far===t._far&&t.xOffset===t._xOffset&&t.yOffset===t._yOffset||(Ie(t.fov>=0&&t.fov<Math.PI),Ie(t.aspectRatio>0),Ie(t.near>=0&&t.near<t.far),t._aspectRatio=t.aspectRatio,t._fov=t.fov,t._fovy=t.aspectRatio<=1?t.fov:2*Math.atan(Math.tan(.5*t.fov)/t.aspectRatio),t._near=t.near,t._far=t.far,t._sseDenominator=2*Math.tan(.5*t._fovy),t._xOffset=t.xOffset,t._yOffset=t.yOffset,e.top=t.near*Math.tan(.5*t._fovy),e.bottom=-e.top,e.right=t.aspectRatio*e.top,e.left=-e.right,e.near=t.near,e.far=t.far,e.right+=t.xOffset,e.left+=t.xOffset,e.top+=t.yOffset,e.bottom+=t.yOffset)}new cr,new cr,new cr,new cr,new cr,new cr,new cr,new cr,new cr,new cr,new cr,new cr,new pr,new pr,new pr,new pr,new pr,new cr,new cr,new cr,new cr,new cr,new pr,new pr,new pr;const rs=new cr,ns=new cr,ss=new Qn([new jn,new jn,new jn,new jn,new jn,new jn]);function is(t,e){const{cameraDirection:r,cameraUp:n,height:s}=t,{metersPerUnit:i}=t.distanceScales,o=t.unprojectPosition(t.center),a=An.WGS84.cartographicToCartesian(o,new cr),c=An.WGS84.eastNorthUpToFixedFrame(a),u=t.unprojectPosition(t.cameraPosition),l=An.WGS84.cartographicToCartesian(u,new cr),h=new cr(c.transformAsVector(new cr(r).scale(i))).normalize(),d=new cr(c.transformAsVector(new cr(n).scale(i))).normalize();return function(t,e){const r=t.getFrustumPlanes();let n=0;for(const s in r){const i=r[s],o=i.normal.dot(t.center);ns.copy(i.normal).scale(i.distance-o).add(t.center);const a=t.unprojectPosition(ns),c=An.WGS84.cartographicToCartesian(a,new cr);ss.planes[n++].fromPointNormal(c,rs.copy(e).subtract(c))}}(t,a),{camera:{position:l,direction:h,up:d},viewport:t,height:s,cullingVolume:ss,frameNumber:e,sseDenominator:1.15}}const os=new cr;function as(t){const{halfAxes:e,radius:r,width:n,height:s}=t;if(e){const t=function(t){t.getColumn(0,os);const e=t.getColumn(1),r=t.getColumn(2),n=os.add(e).add(r);return n.len()}(e);return Math.log2(6356752.314245179/t)}if(r)return Math.log2(6356752.314245179/r);if(s&&n){return(Math.log2(6378137/n)+Math.log2(6378137/s))/2}return 1}const cs=0,us=1,ls=3,hs=4,ds=5,fs=1,As=2,ms="empty",ps="scenegraph",Bs="pointcloud",gs="mesh",ys="I3S",Cs="TILES3D",bs="geometricError",ws=1;function Ts(t){return null!=t}const Es=new cr,_s=new cr,Ms=new cr;function vs(t,e,r){if(F(t,"3D Tile: boundingVolume must be defined"),t.box)return function(t,e,r){const n=new cr(t[0],t[1],t[2]);e.transform(n,n);let s=[];if(10===t.length){const e=t.slice(3,6),r=new Pr;r.fromArray(t,6);const n=new cr([1,0,0]),i=new cr([0,1,0]),o=new cr([0,0,1]);n.transformByQuaternion(r),n.scale(e[0]),i.transformByQuaternion(r),i.scale(e[1]),o.transformByQuaternion(r),o.scale(e[2]),s=[...n.toArray(),...i.toArray(),...o.toArray()]}else s=[...t.slice(3,6),...t.slice(6,9),...t.slice(9,12)];const i=e.transformAsVector(s.slice(0,3)),o=e.transformAsVector(s.slice(3,6)),a=e.transformAsVector(s.slice(6,9)),c=new pr([i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2]]);if(Ts(r))return r.center=n,r.halfAxes=c,r;return new Hn(n,c)}(t.box,e,r);if(t.region){const[e,r,n,s,i,o]=t.region,a=An.WGS84.cartographicToCartesian([Le(e),Le(s),i],_s),c=An.WGS84.cartographicToCartesian([Le(n),Le(r),o],Ms),u=(new cr).addVectors(a,c).multiplyScalar(.5),l=(new cr).subVectors(a,c).len()/2;return Is([u[0],u[1],u[2],l],new Tr)}if(t.sphere)return Is(t.sphere,e,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function Is(t,e,r){const n=new cr(t[0],t[1],t[2]);e.transform(n,n);const s=e.getScale(Es),i=Math.max(Math.max(s[0],s[1]),s[2]),o=t[3]*i;return Ts(r)?(r.center=n,r.radius=o,r):new wn(n,o)}function Fs(t,e){if(t.dynamicScreenSpaceError&&t.dynamicScreenSpaceErrorComputedDensity){const r=t.dynamicScreenSpaceErrorComputedDensity,n=t.dynamicScreenSpaceErrorFactor,s=function(t,e){const r=t*e;return 1-Math.exp(-r*r)}(e,r)*n;return s}return 0}function Ds(t,e){const r=e.viewport,n=r.constructor,{longitude:s,latitude:i,height:o,width:a,bearing:c,zoom:u}=r,l=new n({longitude:s,latitude:i,height:o,width:a,bearing:c,zoom:u,pitch:0}),h=t.header.mbs[1],d=t.header.mbs[0],f=t.header.mbs[2],A=t.header.mbs[3],m=[...t.boundingVolume.center],p=l.unprojectPosition(l.cameraPosition),B=An.WGS84.cartographicToCartesian(p,new cr),g=new cr(B).subtract(m).normalize(),y=new Tr;An.WGS84.eastNorthUpToFixedFrame(m,y);const C=new Tr(y).invert(),b=new cr(B).transform(C),w=Math.sqrt(b[0]*b[0]+b[1]*b[1]),T=w*w/b[2],E=new cr([b[0],b[1],T]).transform(y),_=new cr(E).subtract(m).normalize(),M=g.cross(_).normalize().scale(A),v=new cr(m).add(M),I=An.WGS84.cartesianToCartographic(v),F=l.project([d,h,f]),D=l.project(I);return new cr(F).subtract(D).magnitude()}new cr,new cr,new Tr,new cr,new cr,new cr;class Gs{constructor(t=0){H(this,"_map",new Map),H(this,"_array",void 0),H(this,"_length",void 0),this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return F(t<this._array.length),this._array[t]}set(t,e){F(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=e,this._map.set(e,t)}delete(t){const e=this._map.get(t);e>=0&&(this._array.splice(e,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){const e=this.length++;this._array[e]=t,this._map.set(t,e)}}pop(){const t=this._array[--this.length];return this._map.delete(t),t}reserve(t){F(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){F(t>=0),this.length=t}trim(t){null==t&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}}const Rs={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""};class Ss{constructor(t){H(this,"options",void 0),H(this,"root",void 0),H(this,"requestedTiles",void 0),H(this,"selectedTiles",void 0),H(this,"emptyTiles",void 0),H(this,"_traversalStack",void 0),H(this,"_emptyTraversalStack",void 0),H(this,"_frameNumber",void 0),this.options={...Rs,...t},this._traversalStack=new Gs,this._emptyTraversalStack=new Gs,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}traverse(t,e,r){this.root=t,this.options={...this.options,...r},this.reset(),this.updateTile(t,e),this._frameNumber=e.frameNumber,this.executeTraversal(t,e)}reset(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,e){const r=this._traversalStack;for(t._selectionDepth=1,r.push(t);r.length>0;){const t=r.pop();let n=!1;this.canTraverse(t,e)&&(this.updateChildTiles(t,e),n=this.updateAndPushChildren(t,e,r,t.hasRenderContent?t._selectionDepth+1:t._selectionDepth));const s=t.parent,i=Boolean(!s||s._shouldRefine),o=!n;t.hasRenderContent?t.refine===fs?(this.loadTile(t,e),this.selectTile(t,e)):t.refine===As&&(this.loadTile(t,e),o&&this.selectTile(t,e)):(this.emptyTiles[t.id]=t,this.loadTile(t,e),o&&this.selectTile(t,e)),this.touchTile(t,e),t._shouldRefine=n&&i}this.options.onTraversalEnd(e)}updateChildTiles(t,e){const r=t.children;for(const t of r)this.updateTile(t,e);return!0}updateAndPushChildren(t,e,r,n){const{loadSiblings:s,skipLevelOfDetail:i}=this.options,o=t.children;o.sort(this.compareDistanceToCamera.bind(this));const a=t.refine===As&&t.hasRenderContent&&!i;let c=!1,u=!0;for(const t of o)if(t._selectionDepth=n,t.isVisibleAndInRequestVolume?(r.find(t)&&r.delete(t),r.push(t),c=!0):(a||s)&&(this.loadTile(t,e),this.touchTile(t,e)),a){let r;if(r=!!t._inRequestVolume&&(t.hasRenderContent?t.contentAvailable:this.executeEmptyTraversal(t,e)),u=u&&r,!u)return!1}return c||(u=!1),u}updateTile(t,e){this.updateTileVisibility(t,e)}selectTile(t,e){this.shouldSelectTile(t)&&(t._selectedFrame=e.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,e){this.shouldLoadTile(t)&&(t._requestedFrame=e.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t)}touchTile(t,e){t.tileset._cache.touch(t),t._touchedFrame=e.frameNumber}canTraverse(t,e,r=!1,n=!1){return!!t.hasChildren&&(t.hasTilesetContent?!t.contentExpired:!(!n&&!t.isVisibleAndInRequestVolume)&&this.shouldRefine(t,e,r))}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t){return t.contentAvailable&&!this.options.skipLevelOfDetail}shouldRefine(t,e,r){let n=t._screenSpaceError;return r&&(n=t.getScreenSpaceError(e,!0)),n>this.options.maximumScreenSpaceError}updateTileVisibility(t,e){const r=[];if(this.options.viewportTraversersMap)for(const t in this.options.viewportTraversersMap){this.options.viewportTraversersMap[t]===e.viewport.id&&r.push(t)}else r.push(e.viewport.id);t.updateVisibility(e,r)}compareDistanceToCamera(t,e){return t._distanceToCamera-e._distanceToCamera}anyChildrenVisible(t,e){let r=!1;for(const n of t.children)n.updateVisibility(e),r=r||n.isVisibleAndInRequestVolume;return r}executeEmptyTraversal(t,e){let r=!0;const n=this._emptyTraversalStack;for(n.push(t);n.length>0&&r;){const t=n.pop();this.updateTile(t,e),t.isVisibleAndInRequestVolume||this.loadTile(t,e),this.touchTile(t,e);if(!t.hasRenderContent&&this.canTraverse(t,e,!1,!0)){const e=t.children;for(const t of e)n.find(t)&&n.delete(t),n.push(t)}else t.contentAvailable||(r=!1)}return r}}const Os=new cr;class xs{constructor(t,e,r,n=""){H(this,"tileset",void 0),H(this,"header",void 0),H(this,"id",void 0),H(this,"url",void 0),H(this,"parent",void 0),H(this,"refine",void 0),H(this,"type",void 0),H(this,"contentUrl",void 0),H(this,"lodMetricType",void 0),H(this,"lodMetricValue",void 0),H(this,"boundingVolume",void 0),H(this,"content",void 0),H(this,"contentState",void 0),H(this,"gpuMemoryUsageInBytes",void 0),H(this,"children",void 0),H(this,"depth",void 0),H(this,"viewportIds",void 0),H(this,"transform",void 0),H(this,"extensions",void 0),H(this,"userData",void 0),H(this,"computedTransform",void 0),H(this,"hasEmptyContent",void 0),H(this,"hasTilesetContent",void 0),H(this,"traverser",void 0),H(this,"_cacheNode",void 0),H(this,"_frameNumber",void 0),H(this,"_lodJudge",void 0),H(this,"_expireDate",void 0),H(this,"_expiredContent",void 0),H(this,"_shouldRefine",void 0),H(this,"_distanceToCamera",void 0),H(this,"_centerZDepth",void 0),H(this,"_screenSpaceError",void 0),H(this,"_visibilityPlaneMask",void 0),H(this,"_visible",void 0),H(this,"_inRequestVolume",void 0),H(this,"_stackLength",void 0),H(this,"_selectionDepth",void 0),H(this,"_touchedFrame",void 0),H(this,"_visitedFrame",void 0),H(this,"_selectedFrame",void 0),H(this,"_requestedFrame",void 0),H(this,"_priority",void 0),H(this,"_contentBoundingVolume",void 0),H(this,"_viewerRequestVolume",void 0),H(this,"_initialTransform",void 0),this.header=e,this.tileset=t,this.id=n||e.id,this.url=e.url,this.parent=r,this.refine=this._getRefine(e.refine),this.type=e.type,this.contentUrl=e.contentUrl,this.lodMetricType="geometricError",this.lodMetricValue=0,this.boundingVolume=null,this.content=null,this.contentState=cs,this.gpuMemoryUsageInBytes=0,this.children=[],this.hasEmptyContent=!1,this.hasTilesetContent=!1,this.depth=0,this.viewportIds=[],this.userData={},this.extensions=null,this._priority=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._screenSpaceError=0,this._cacheNode=null,this._frameNumber=null,this._cacheNode=null,this.traverser=new Ss({}),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._initialTransform=new Tr,this.transform=new Tr,this._initializeLodMetric(e),this._initializeTransforms(e),this._initializeBoundingVolumes(e),this._initializeContent(e),this._initializeRenderingState(e),this._lodJudge=null,this._expireDate=null,this._expiredContent=null,Object.seal(this)}destroy(){this.header=null}isDestroyed(){return null===this.header}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0}get contentReady(){return this.contentState===ls||this.hasEmptyContent}get contentAvailable(){return Boolean(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===cs}get contentExpired(){return this.contentState===hs}get contentFailed(){return this.contentState===ds}getScreenSpaceError(t,e){switch(this.tileset.type){case ys:return Ds(this,t);case Cs:return function(t,e,r){const n=t.tileset,s=t.parent&&t.parent.lodMetricValue||t.lodMetricValue,i=r?s:t.lodMetricValue;if(0===i)return 0;const o=Math.max(t._distanceToCamera,1e-7),{height:a,sseDenominator:c}=e,{viewDistanceScale:u}=n.options;let l=i*a*(u||1)/(o*c);return l-=Fs(n,o),l}(this,t,e);default:throw new Error("Unsupported tileset type")}}_getPriority(){const t=this.tileset._traverser,{skipLevelOfDetail:e}=t.options,r=this.refine===fs||e;if(r&&!this.isVisible&&void 0!==this._visible)return-1;if(this.tileset._frameNumber-this._touchedFrame>=1)return-1;if(this.contentState===cs)return-1;const n=this.parent,s=n&&(!r||0===this._screenSpaceError||n.hasTilesetContent)?n._screenSpaceError:this._screenSpaceError,i=t.root?t.root._screenSpaceError:0;return Math.max(i-s,0)}async loadContent(){if(this.hasEmptyContent)return!1;if(this.content)return!0;this.contentExpired&&(this._expireDate=null),this.contentState=us;const t=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!t)return this.contentState=cs,!1;try{const e=this.tileset.getTileUrl(this.contentUrl),r=this.tileset.loader,n={...this.tileset.loadOptions,[r.id]:{...this.tileset.loadOptions[r.id],isTileset:"json"===this.type,...this._getLoaderSpecificOptions(r.id)}};return this.content=await ve(e,r,n),this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this._isTileset()&&this.tileset._initializeTileHeaders(this.content,this),this.contentState=ls,this._onContentLoaded(),!0}catch(t){throw this.contentState=ds,t}finally{t.done()}}unloadContent(){return this.content&&this.content.destroy&&this.content.destroy(),this.content=null,this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=cs,!0}updateVisibility(t,e){if(this._frameNumber===t.frameNumber)return;const r=this.parent,n=r?r._visibilityPlaneMask:Qn.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){const t=r?r.computedTransform:this.tileset.modelMatrix;this._updateTransform(t)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._visibilityPlaneMask=this.visibility(t,n),this._visible=this._visibilityPlaneMask!==Qn.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=e}visibility(t,e){const{cullingVolume:r}=t,{boundingVolume:n}=this;return r.computeVisibilityWithPlaneMask(n,e)}contentVisibility(){return!0}distanceToTile(t){const e=this.boundingVolume;return Math.sqrt(Math.max(e.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){const e=this.boundingVolume;return Os.subVectors(e.center,t.position),t.direction.dot(Os)}insideViewerRequestVolume(t){const e=this._viewerRequestVolume;return!e||e.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(null!=this._expireDate&&this.contentReady&&!this.hasEmptyContent){const t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=hs,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this.lodMetricValue=t.lodMetricValue:(this.lodMetricValue=this.parent&&this.parent.lodMetricValue||this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"))}_initializeTransforms(t){this.transform=t.transform?new Tr(t.transform):new Tr;const e=this.parent,r=this.tileset,n=e&&e.computedTransform?e.computedTransform.clone():r.modelMatrix.clone();this.computedTransform=new Tr(n).multiplyRight(this.transform);const s=e&&e._initialTransform?e._initialTransform.clone():new Tr;this._initialTransform=new Tr(s).multiplyRight(this.transform)}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.hasEmptyContent=!0,this.contentState=cs,this.hasTilesetContent=!1,t.contentUrl&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._visibilityPlaneMask=Qn.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||As}_isTileset(){return-1!==this.contentUrl.indexOf(".json")}_onContentLoaded(){switch(this.content&&this.content.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0}this._isTileset()&&(this.hasTilesetContent=!0)}_updateBoundingVolume(t){this.boundingVolume=vs(t.boundingVolume,this.computedTransform,this.boundingVolume);const e=t.content;e&&(e.boundingVolume&&(this._contentBoundingVolume=vs(e.boundingVolume,this.computedTransform,this._contentBoundingVolume)),t.viewerRequestVolume&&(this._viewerRequestVolume=vs(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume)))}_updateTransform(t=new Tr){const e=t.clone().multiplyRight(this.transform);!e.equals(this.computedTransform)&&(this.computedTransform=e,this._updateBoundingVolume(this.header))}_getLoaderSpecificOptions(t){return"i3s"===t?{...this.tileset.options.i3s,tile:this.header,tileset:this.tileset.tileset,isTileHeader:!1}:{assetGltfUpAxis:(e=this.tileset.tileset).asset&&e.asset.gltfUpAxis||"Y"};var e}}class Us extends Ss{compareDistanceToCamera(t,e){return 0===e._distanceToCamera&&0===t._distanceToCamera?e._centerZDepth-t._centerZDepth:e._distanceToCamera-t._distanceToCamera}updateTileVisibility(t,e){if(super.updateTileVisibility(t,e),!t.isVisibleAndInRequestVolume)return;const r=t.children.length>0;if(t.hasTilesetContent&&r){const r=t.children[0];return this.updateTileVisibility(r,e),void(t._visible=r._visible)}if(this.meetsScreenSpaceErrorEarly(t,e))return void(t._visible=!1);const n=t.refine===As,s=t._optimChildrenWithinParent===ws;n&&s&&r&&!this.anyChildrenVisible(t,e)&&(t._visible=!1)}meetsScreenSpaceErrorEarly(t,e){const{parent:r}=t;return!(!r||r.hasTilesetContent||r.refine!==fs)&&!this.shouldRefine(t,e,!0)}}const Ls="REQUESTED",Ns="COMPLETED",Hs="ERROR";class Js{constructor(){H(this,"_statusMap",void 0),this._statusMap={}}add(t,e,r,n){this._statusMap[e]||(this._statusMap[e]={request:t,callback:r,key:e,frameState:n,status:Ls},t().then((t=>{this._statusMap[e].status=Ns,this._statusMap[e].callback(t,n)})).catch((t=>{this._statusMap[e].status=Hs,r(t)})))}update(t,e){this._statusMap[t]&&(this._statusMap[t].frameState=e)}find(t){return this._statusMap[t]}}class Ps extends Ss{constructor(t){super(t),H(this,"_tileManager",void 0),this._tileManager=new Js}shouldRefine(t,e){return t._lodJudge=function(t,e){if(0===t.lodMetricValue||isNaN(t.lodMetricValue))return"DIG";const r=2*Ds(t,e);return r<2?"OUT":!t.header.children||r<=t.lodMetricValue?"DRAW":t.header.children?"DIG":"OUT"}(t,e),"DIG"===t._lodJudge}updateChildTiles(t,e){const r=t.header.children||[],n=t.children,s=t.tileset;for(const i of r){const r="".concat(i.id,"-").concat(e.viewport.id),o=n&&n.find((t=>t.id===r));if(o)o&&this.updateTile(o,e);else{let n=()=>this._loadTile(i.id,s);this._tileManager.find(r)?this._tileManager.update(r,e):(s.tileset.nodePages&&(n=()=>s.tileset.nodePagesTile.formTileFromNodePages(i.id)),this._tileManager.add(n,r,(e=>this._onTileLoad(e,t,r)),e))}}return!1}async _loadTile(t,e){const{loader:r}=e,n=e.getTileUrl("".concat(e.url,"/nodes/").concat(t)),s={...e.loadOptions,i3s:{...e.loadOptions.i3s,isTileHeader:!0,loadContent:!1}};return await ve(n,r,s)}_onTileLoad(t,e,r){const n=new xs(e.tileset,t,e,r);e.children.push(n);const s=this._tileManager.find(n.id).frameState;this.updateTile(n,s),this._frameNumber===s.frameNumber&&this.executeTraversal(n,s)}}const js={description:"",ellipsoid:An.WGS84,modelMatrix:new Tr,throttleRequests:!0,maxRequests:64,maximumMemoryUsage:32,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onTraversalComplete:t=>t,contentLoader:void 0,viewDistanceScale:1,maximumScreenSpaceError:8,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{}};class ks{constructor(t,e){H(this,"options",void 0),H(this,"loadOptions",void 0),H(this,"type",void 0),H(this,"tileset",void 0),H(this,"loader",void 0),H(this,"url",void 0),H(this,"basePath",void 0),H(this,"modelMatrix",void 0),H(this,"ellipsoid",void 0),H(this,"lodMetricType",void 0),H(this,"lodMetricValue",void 0),H(this,"refine",void 0),H(this,"root",void 0),H(this,"roots",void 0),H(this,"asset",void 0),H(this,"description",void 0),H(this,"properties",void 0),H(this,"extras",void 0),H(this,"attributions",void 0),H(this,"credits",void 0),H(this,"stats",void 0),H(this,"traverseCounter",void 0),H(this,"geometricError",void 0),H(this,"selectedTiles",void 0),H(this,"cartographicCenter",void 0),H(this,"cartesianCenter",void 0),H(this,"zoom",void 0),H(this,"boundingVolume",void 0),H(this,"gpuMemoryUsageInBytes",void 0),H(this,"dynamicScreenSpaceErrorComputedDensity",void 0),H(this,"_traverser",void 0),H(this,"_cache",void 0),H(this,"_requestScheduler",void 0),H(this,"_frameNumber",void 0),H(this,"_queryParamsString",void 0),H(this,"_queryParams",void 0),H(this,"_extensionsUsed",void 0),H(this,"_tiles",void 0),H(this,"_pendingCount",void 0),H(this,"lastUpdatedVieports",void 0),H(this,"_requestedTiles",void 0),H(this,"_emptyTiles",void 0),H(this,"frameStateData",void 0),H(this,"maximumMemoryUsage",void 0),F(t),this.options={...js,...e},this.tileset=t,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath||Bt(this.url),this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.root.refine,this.loadOptions=this.options.loadOptions||{},this.root=null,this.roots={},this.cartographicCenter=null,this.cartesianCenter=null,this.zoom=1,this.boundingVolume=null,this.traverseCounter=0,this.geometricError=0,this._traverser=this._initializeTraverser(),this._cache=new gn,this._requestScheduler=new mt({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this._frameNumber=0,this._pendingCount=0,this._tiles={},this.selectedTiles=[],this._emptyTiles=[],this._requestedTiles=[],this.frameStateData={},this.lastUpdatedVieports=null,this._queryParams={},this._queryParamsString="",this.maximumMemoryUsage=this.options.maximumMemoryUsage||32,this.gpuMemoryUsageInBytes=0,this.stats=new ft({id:this.url}),this._initializeStats(),this._extensionsUsed=void 0,this.dynamicScreenSpaceErrorComputedDensity=0,this.extras=null,this.asset={},this.credits={},this.description=this.options.description||"",this._initializeTileSet(t)}destroy(){this._destroy()}isLoaded(){return 0===this._pendingCount&&0!==this._frameNumber}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get queryParams(){return this._queryParamsString||(this._queryParamsString=function(t){const e=[];for(const r of Object.keys(t))e.push("".concat(r,"=").concat(t[r]));switch(e.length){case 0:return"";case 1:return"?".concat(e[0]);default:return"?".concat(e.join("&"))}}(this._queryParams)),this._queryParamsString}setProps(t){this.options={...this.options,...t}}setOptions(t){this.options={...this.options,...t}}getTileUrl(t){return t.startsWith("data:")?t:"".concat(t).concat(this.queryParams)}hasExtension(t){return Boolean(this._extensionsUsed&&this._extensionsUsed.indexOf(t)>-1)}update(t){if("loadTiles"in this.options&&!this.options.loadTiles)return;if(this.traverseCounter>0)return;!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t instanceof Array||(t=[t]),this._cache.reset(),this._frameNumber++,this.traverseCounter=t.length;const e=[];for(const r of t){const t=r.id;this._needTraverse(t)?e.push(t):this.traverseCounter--}for(const r of t){const t=r.id;if(this.roots[t]||(this.roots[t]=this._initializeTileHeaders(this.tileset,null)),!e.includes(t))continue;const n=is(r,this._frameNumber);this._traverser.traverse(this.roots[t],n,this.options)}}_needTraverse(t){let e=t;return this.options.viewportTraversersMap&&(e=this.options.viewportTraversersMap[t]),e===t}_onTraversalEnd(t){const e=t.viewport.id;this.frameStateData[e]||(this.frameStateData[e]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});const r=this.frameStateData[e],n=Object.values(this._traverser.selectedTiles);r.selectedTiles=n,r._requestedTiles=Object.values(this._traverser.requestedTiles),r._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,this.traverseCounter>0||this._updateTiles()}_updateTiles(){this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(const t in this.frameStateData){const e=this.frameStateData[t];this.selectedTiles=this.selectedTiles.concat(e.selectedTiles),this._requestedTiles=this._requestedTiles.concat(e._requestedTiles),this._emptyTiles=this._emptyTiles.concat(e._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);for(const t of this.selectedTiles)this._tiles[t.id]=t;this._loadTiles(),this._unloadTiles(),this._updateStats()}_tilesChanged(t,e){if(t.length!==e.length)return!0;const r=new Set(t.map((t=>t.id))),n=new Set(e.map((t=>t.id)));let s=t.filter((t=>!n.has(t.id))).length>0;return s=s||e.filter((t=>!r.has(t.id))).length>0,s}_loadTiles(){for(const t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,((t,e)=>t._unloadTile(e)))}_updateStats(){let t=0,e=0;for(const r of this.selectedTiles)r.contentAvailable&&r.content&&(t++,r.content.pointCount&&(e+=r.content.pointCount));this.stats.get("Tiles In View").count=this.selectedTiles.length,this.stats.get("Tiles To Render").count=t,this.stats.get("Points").count=e}_initializeTileSet(t){this.root=this._initializeTileHeaders(t,null),this.type===Cs&&this._initializeCesiumTileset(t),this.type===ys&&this._initializeI3STileset(),this._calculateViewProps()}_calculateViewProps(){const t=this.root;F(t);const{center:e}=t.boundingVolume;if(!e)return console.warn("center was not pre-calculated for the root tile"),this.cartographicCenter=new cr,void(this.zoom=1);this.cartographicCenter=An.WGS84.cartesianToCartographic(e,new cr),this.cartesianCenter=e,this.zoom=as(t.boundingVolume)}_initializeStats(){this.stats.get("Tiles In Tileset(s)"),this.stats.get("Tiles Loading"),this.stats.get("Tiles In Memory"),this.stats.get("Tiles In View"),this.stats.get("Tiles To Render"),this.stats.get("Tiles Loaded"),this.stats.get("Tiles Unloaded"),this.stats.get("Failed Tile Loads"),this.stats.get("Points","memory"),this.stats.get("Tile Memory Use","memory")}_initializeTileHeaders(t,e){const r=new xs(this,t.root,e);if(e&&(e.children.push(r),r.depth=e.depth+1),this.type===Cs){const t=[];for(t.push(r);t.length>0;){const e=t.pop();this.stats.get("Tiles In Tileset(s)").incrementCount();const r=e.header.children||[];for(const n of r){const r=new xs(this,n,e);e.children.push(r),r.depth=e.depth+1,t.push(r)}}}return r}_initializeTraverser(){let t;switch(this.type){case Cs:t=Us;break;case ys:t=Ps;break;default:t=Ss}return new t({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let e;try{this._onStartTileLoading(),e=await t.loadContent()}catch(e){this._onTileLoadError(t,e)}finally{this._onEndTileLoading(),this._onTileLoad(t,e)}}_onTileLoadError(t,e){this.stats.get("Failed Tile Loads").incrementCount();const r=e.message||e.toString(),n=t.url;console.error("A 3D tile failed to load: ".concat(t.url," ").concat(r)),this.options.onTileError(t,r,n)}_onTileLoad(t,e){e&&(t&&t.content&&function(t,e){F(t),F(e);const{rtcCenter:r,gltfUpAxis:n}=e,{computedTransform:s,boundingVolume:{center:i}}=t;let o=new Tr(s);switch(r&&o.translate(r),n){case"Z":break;case"Y":const t=(new Tr).rotateX(Math.PI/2);o=o.multiplyRight(t);break;case"X":const e=(new Tr).rotateY(-Math.PI/2);o=o.multiplyRight(e)}e.isQuantized&&o.translate(e.quantizedVolumeOffset).scale(e.quantizedVolumeScale);const a=new cr(i);e.cartesianModelMatrix=o,e.cartesianOrigin=a;const c=An.WGS84.cartesianToCartographic(a,new cr),u=An.WGS84.eastNorthUpToFixedFrame(a).invert();e.cartographicModelMatrix=u.multiplyRight(o),e.cartographicOrigin=c,e.coordinateSystem||(e.modelMatrix=e.cartographicModelMatrix)}(t,t.content),this._addTileToCache(t),this.options.onTileLoad(t))}_onStartTileLoading(){this._pendingCount++,this.stats.get("Tiles Loading").incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get("Tiles Loading").decrementCount()}_addTileToCache(t){this._cache.add(this,t,(e=>e._updateCacheStats(t)))}_updateCacheStats(t){this.stats.get("Tiles Loaded").incrementCount(),this.stats.get("Tiles In Memory").incrementCount(),this.gpuMemoryUsageInBytes+=t.content.byteLength||0,this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.content&&t.content.byteLength||0,this.stats.get("Tiles In Memory").decrementCount(),this.stats.get("Tiles Unloaded").incrementCount(),this.stats.get("Tile Memory Use").count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){const t=[];for(this.root&&t.push(this.root);t.length>0;){const e=t.pop();for(const r of e.children)t.push(r);this._destroyTile(e)}this.root=null}_destroySubtree(t){const e=t,r=[];for(r.push(e);r.length>0;){t=r.pop();for(const e of t.children)r.push(e);t!==e&&this._destroyTile(t)}e.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_initializeCesiumTileset(t){if(this.asset=t.asset,!this.asset)throw new Error("Tileset must have an asset property.");if("0.0"!==this.asset.version&&"1.0"!==this.asset.version)throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");"tilesetVersion"in this.asset&&(this._queryParams.v=this.asset.tilesetVersion),this.credits={attributions:this.options.attributions||[]},this.description=this.options.description||"",this.properties=t.properties,this.geometricError=t.geometricError,this._extensionsUsed=t.extensionsUsed,this.extras=t.extras}_initializeI3STileset(){this.loadOptions.i3s&&"token"in this.loadOptions.i3s&&(this._queryParams.token=this.loadOptions.i3s.token)}}const Ks="cmpt",Vs="pnts",Qs="b3dm",qs="i3dm",zs="glTF";function Ws(t,e,r){F(t instanceof ArrayBuffer);const n=new TextDecoder("utf8"),s=new Uint8Array(t,e,r);return n.decode(s)}const Ys={name:"Draco",id:"draco",module:"draco",shapes:["mesh"],version:"3.1.4",worker:!0,extensions:["drc"],mimeTypes:["application/octet-stream"],binary:!0,tests:["DRACO"],options:{draco:{decoderType:"object"==typeof WebAssembly?"wasm":"js",libraryPath:"libs/",extraAttributes:{},attributeNameEntry:void 0}}};class Xs{constructor(t,e){H(this,"fields",void 0),H(this,"metadata",void 0),function(t,e){if(!t)throw new Error(e||"loader assertion failed.")}(Array.isArray(t)),function(t){const e={};for(const r of t)e[r.name]&&console.warn("Schema: duplicated field name",r.name,r),e[r.name]=!0}(t),this.fields=t,this.metadata=e||new Map}compareTo(t){if(this.metadata!==t.metadata)return!1;if(this.fields.length!==t.fields.length)return!1;for(let e=0;e<this.fields.length;++e)if(!this.fields[e].compareTo(t.fields[e]))return!1;return!0}select(...t){const e=Object.create(null);for(const r of t)e[r]=!0;const r=this.fields.filter((t=>e[t.name]));return new Xs(r,this.metadata)}selectAt(...t){const e=t.map((t=>this.fields[t])).filter(Boolean);return new Xs(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof Xs){const n=t;e=n.fields,r=Zs(Zs(new Map,this.metadata),n.metadata)}else e=t;const n=Object.create(null);for(const t of this.fields)n[t.name]=t;for(const t of e)n[t.name]=t;const s=Object.values(n);return new Xs(s,r)}}function Zs(t,e){return new Map([...t||new Map,...e||new Map])}class $s{constructor(t,e,r=!1,n=new Map){H(this,"name",void 0),H(this,"type",void 0),H(this,"nullable",void 0),H(this,"metadata",void 0),this.name=t,this.type=e,this.nullable=r,this.metadata=n}get typeId(){return this.type&&this.type.typeId}clone(){return new $s(this.name,this.type,this.nullable,this.metadata)}compareTo(t){return this.name===t.name&&this.type===t.type&&this.nullable===t.nullable&&this.metadata===t.metadata}toString(){return"".concat(this.type).concat(this.nullable?", nullable":"").concat(this.metadata?", metadata: ".concat(this.metadata):"")}}let ti,ei,ri,ni;!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(ti||(ti={}));class si{static isNull(t){return t&&t.typeId===ti.Null}static isInt(t){return t&&t.typeId===ti.Int}static isFloat(t){return t&&t.typeId===ti.Float}static isBinary(t){return t&&t.typeId===ti.Binary}static isUtf8(t){return t&&t.typeId===ti.Utf8}static isBool(t){return t&&t.typeId===ti.Bool}static isDecimal(t){return t&&t.typeId===ti.Decimal}static isDate(t){return t&&t.typeId===ti.Date}static isTime(t){return t&&t.typeId===ti.Time}static isTimestamp(t){return t&&t.typeId===ti.Timestamp}static isInterval(t){return t&&t.typeId===ti.Interval}static isList(t){return t&&t.typeId===ti.List}static isStruct(t){return t&&t.typeId===ti.Struct}static isUnion(t){return t&&t.typeId===ti.Union}static isFixedSizeBinary(t){return t&&t.typeId===ti.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===ti.FixedSizeList}static isMap(t){return t&&t.typeId===ti.Map}static isDictionary(t){return t&&t.typeId===ti.Dictionary}get typeId(){return ti.NONE}compareTo(t){return this===t}}ei=Symbol.toStringTag;class ii extends si{constructor(t,e){super(),H(this,"isSigned",void 0),H(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return ti.Int}get[ei](){return"Int"}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}}class oi extends ii{constructor(){super(!0,8)}}class ai extends ii{constructor(){super(!0,16)}}class ci extends ii{constructor(){super(!0,32)}}class ui extends ii{constructor(){super(!1,8)}}class li extends ii{constructor(){super(!1,16)}}class hi extends ii{constructor(){super(!1,32)}}const di=32,fi=64;ri=Symbol.toStringTag;class Ai extends si{constructor(t){super(),H(this,"precision",void 0),this.precision=t}get typeId(){return ti.Float}get[ri](){return"Float"}toString(){return"Float".concat(this.precision)}}class mi extends Ai{constructor(){super(di)}}class pi extends Ai{constructor(){super(fi)}}ni=Symbol.toStringTag;class Bi extends si{constructor(t,e){super(),H(this,"listSize",void 0),H(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return ti.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[ni](){return"FixedSizeList"}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}}function gi(t,e,r){const n=function(t){switch(t.constructor){case Int8Array:return new oi;case Uint8Array:return new ui;case Int16Array:return new ai;case Uint16Array:return new li;case Int32Array:return new ci;case Uint32Array:return new hi;case Float32Array:return new mi;case Float64Array:return new pi;default:throw new Error("array type not supported")}}(e.value),s=r||function(t){const e=new Map;"byteOffset"in t&&e.set("byteOffset",t.byteOffset.toString(10));"byteStride"in t&&e.set("byteStride",t.byteStride.toString(10));"normalized"in t&&e.set("normalized",t.normalized.toString());return e}(e);return new $s(t,new Bi(e.size,new $s("value",n)),!1,s)}function yi(t,e,r){return gi(t,e,r?Ci(r.metadata):void 0)}function Ci(t){const e=new Map;for(const r in t)e.set("".concat(r,".string"),JSON.stringify(t[r]));return e}const bi={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},wi={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class Ti{constructor(t){H(this,"draco",void 0),H(this,"decoder",void 0),H(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}destroy(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}parseSync(t,e={}){const r=new this.draco.DecoderBuffer;r.Init(new Int8Array(t),t.byteLength),this._disableAttributeTransforms(e);const n=this.decoder.GetEncodedGeometryType(r),s=n===this.draco.TRIANGULAR_MESH?new this.draco.Mesh:new this.draco.PointCloud;try{let t;switch(n){case this.draco.TRIANGULAR_MESH:t=this.decoder.DecodeBufferToMesh(r,s);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,s);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!s.ptr){const e="DRACO decompression failed: ".concat(t.error_msg());throw new Error(e)}const i=this._getDracoLoaderData(s,n,e),o=this._getMeshData(s,i,e),a=function(t){let e=1/0,r=1/0,n=1/0,s=-1/0,i=-1/0,o=-1/0;const a=t.POSITION?t.POSITION.value:[],c=a&&a.length;for(let t=0;t<c;t+=3){const c=a[t],u=a[t+1],l=a[t+2];e=c<e?c:e,r=u<r?u:r,n=l<n?l:n,s=c>s?c:s,i=u>i?u:i,o=l>o?l:o}return[[e,r,n],[s,i,o]]}(o.attributes),c=function(t,e,r){const n=Ci(e.metadata),s=[],i=function(t){const e={};for(const r in t){const n=t[r];e[n.name||"undefined"]=n}return e}(e.attributes);for(const e in t){const r=yi(e,t[e],i[e]);s.push(r)}if(r){const t=yi("indices",r);s.push(t)}return new Xs(s,n)}(o.attributes,i,o.indices);return{loader:"draco",loaderData:i,header:{vertexCount:s.num_points(),boundingBox:a},...o,schema:c}}finally{this.draco.destroy(r),s&&this.draco.destroy(s)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),s=this._getDracoAttributes(t,r);return{geometry_type:e,num_attributes:t.num_attributes(),num_points:t.num_points(),num_faces:t instanceof this.draco.Mesh?t.num_faces():0,metadata:n,attributes:s}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const s=this.decoder.GetAttribute(t,n),i=this._getAttributeMetadata(t,n);r[s.unique_id()]={unique_id:s.unique_id(),attribute_type:s.attribute_type(),data_type:s.data_type(),num_components:s.num_components(),byte_offset:s.byte_offset(),byte_stride:s.byte_stride(),normalized:s.normalized(),attribute_index:n,metadata:i};const o=this._getQuantizationTransform(s,e);o&&(r[s.unique_id()].quantization_transform=o);const a=this._getOctahedronTransform(s,e);a&&(r[s.unique_id()].octahedron_transform=a)}return r}_getMeshData(t,e,r){const n=this._getMeshAttributes(e,t,r);if(!n.POSITION)throw new Error("DRACO: No position attribute found.");return t instanceof this.draco.Mesh?"triangle-strip"===r.topology?{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}}:{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}:{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const s of Object.values(t.attributes)){const t=this._deduceAttributeName(s,r);s.name=t;const{value:i,size:o}=this._getAttributeValues(e,s);n[t]={value:i,size:o,byteOffset:s.byte_offset,byteStride:s.byte_stride,normalized:s.normalized}}return n}_getTriangleListIndices(t){const e=3*t.num_faces(),r=4*e,n=this.draco._malloc(r);try{return this.decoder.GetTrianglesUInt32Array(t,r,n),new Uint32Array(this.draco.HEAPF32.buffer,n,e).slice()}finally{this.draco._free(n)}}_getTriangleStripIndices(t){const e=new this.draco.DracoInt32Array;try{return this.decoder.GetTriangleStripsFromMesh(t,e),function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(e)}finally{this.draco.destroy(e)}}_getAttributeValues(t,e){const r=wi[e.data_type],n=e.num_components,s=t.num_points()*n,i=s*r.BYTES_PER_ELEMENT,o=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32;default:return t.DT_INVALID}}(this.draco,r);let a;const c=this.draco._malloc(i);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,o,i,c),a=new r(this.draco.HEAPF32.buffer,c,s).slice()}finally{this.draco._free(c)}return{value:a,size:n}}_deduceAttributeName(t,e){const r=t.unique_id;for(const[t,n]of Object.entries(e.extraAttributes||{}))if(n===r)return t;const n=t.attribute_type;for(const t in bi){if(this.draco[t]===n)return bi[t]}const s=e.attributeNameEntry||"name";return t.metadata[s]?t.metadata[s].string:"CUSTOM_ATTRIBUTE_".concat(r)}_getTopLevelMetadata(t){const e=this.decoder.GetMetadata(t);return this._getDracoMetadata(e)}_getAttributeMetadata(t,e){const r=this.decoder.GetAttributeMetadata(t,e);return this._getDracoMetadata(r)}_getDracoMetadata(t){if(!t||!t.ptr)return{};const e={},r=this.metadataQuerier.NumEntries(t);for(let n=0;n<r;n++){const r=this.metadataQuerier.GetEntryName(t,n);e[r]=this._getDracoMetadataField(t,r)}return e}_getDracoMetadataField(t,e){const r=new this.draco.DracoInt32Array;try{this.metadataQuerier.GetIntEntryArray(t,e,r);const n=function(t){const e=t.size(),r=new Int32Array(e);for(let n=0;n<e;n++)r[n]=t.GetValue(n);return r}(r);return{int:this.metadataQuerier.GetIntEntry(t,e),string:this.metadataQuerier.GetStringEntry(t,e),double:this.metadataQuerier.GetDoubleEntry(t,e),intArray:n}}finally{this.draco.destroy(r)}}_disableAttributeTransforms(t){const{quantizedAttributes:e=[],octahedronAttributes:r=[]}=t,n=[...e,...r];for(const t of n)this.decoder.SkipAttributeTransform(this.draco[t])}_getQuantizationTransform(t,e){const{quantizedAttributes:r=[]}=e,n=t.attribute_type();if(r.map((t=>this.decoder[t])).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits(),range:e.range(),min_values:new Float32Array([1,2,3]).map((t=>e.min_value(t)))}}finally{this.draco.destroy(e)}}return null}_getOctahedronTransform(t,e){const{octahedronAttributes:r=[]}=e,n=t.attribute_type();if(r.map((t=>this.decoder[t])).includes(n)){const e=new this.draco.AttributeQuantizationTransform;try{if(e.InitFromAttribute(t))return{quantization_bits:e.quantization_bits()}}finally{this.draco.destroy(e)}}return null}}const Ei="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.js"),_i="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_wasm_wrapper.js"),Mi="https://www.gstatic.com/draco/versioned/decoders/".concat("1.4.1","/draco_decoder.wasm");let vi;async function Ii(t){const e=t.modules||{};return vi=e.draco3d?vi||e.draco3d.createDecoderModule({}).then((t=>({draco:t}))):vi||async function(t){let e,r;if("js"===(t.draco&&t.draco.decoderType))e=await tt(Ei,"draco",t);else[e,r]=await Promise.all([await tt(_i,"draco",t),await tt(Mi,"draco",t)]);return e=e||globalThis.DracoDecoderModule,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise((e=>{t({...r,onModuleLoaded:t=>e({draco:t})})}))}(e,r)}(t),await vi}const Fi={...Ys,parse:async function(t,e){const{draco:r}=await Ii(e),n=new Ti(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};const Di={BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,DOUBLE:5130},Gi={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,...Di},Ri={[Di.DOUBLE]:Float64Array,[Di.FLOAT]:Float32Array,[Di.UNSIGNED_SHORT]:Uint16Array,[Di.UNSIGNED_INT]:Uint32Array,[Di.UNSIGNED_BYTE]:Uint8Array,[Di.BYTE]:Int8Array,[Di.SHORT]:Int16Array,[Di.INT]:Int32Array},Si={DOUBLE:Di.DOUBLE,FLOAT:Di.FLOAT,UNSIGNED_SHORT:Di.UNSIGNED_SHORT,UNSIGNED_INT:Di.UNSIGNED_INT,UNSIGNED_BYTE:Di.UNSIGNED_BYTE,BYTE:Di.BYTE,SHORT:Di.SHORT,INT:Di.INT};class Oi{static fromTypedArray(t){t=ArrayBuffer.isView(t)?t.constructor:t;for(const e in Ri){if(Ri[e]===t)return e}throw new Error("Failed to convert GL type")}static fromName(t){const e=Si[t];if(!e)throw new Error("Failed to convert GL type");return e}static getArrayType(t){switch(t){case Di.UNSIGNED_SHORT_5_6_5:case Di.UNSIGNED_SHORT_4_4_4_4:case Di.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;default:const e=Ri[t];if(!e)throw new Error("Failed to convert GL type");return e}}static getByteSize(t){return Oi.getArrayType(t).BYTES_PER_ELEMENT}static validate(t){return Boolean(Oi.getArrayType(t))}static createTypedArray(t,e,r=0,n){void 0===n&&(n=(e.byteLength-r)/Oi.getByteSize(t));return new(Oi.getArrayType(t))(e,r,n)}}function xi(t,e=[0,0,0]){const r=t>>11&31,n=t>>5&63,s=31&t;return e[0]=r<<3,e[1]=n<<2,e[2]=s<<3,e}function Ui(t,e=255){return function(t,e,r){return Oe(t,(t=>Math.max(e,Math.min(r,t))))}(t,0,e)/e*2-1}function Li(t){return t<0?-1:1}function Ni(t,e,r,n){if(function(t,e){if(!t)throw new Error("math.gl assertion failed. ".concat(e))}(n),t<0||t>r||e<0||e>r)throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(r));if(n.x=Ui(t,r),n.y=Ui(e,r),n.z=1-(Math.abs(n.x)+Math.abs(n.y)),n.z<0){const t=n.x;n.x=(1-Math.abs(n.y))*Li(t),n.y=(1-Math.abs(t))*Li(n.y)}return n.normalize()}new Xe,new cr,new Xe,new Xe;class Hi{constructor(t,e){H(this,"json",void 0),H(this,"buffer",void 0),H(this,"featuresLength",0),H(this,"_cachedTypedArrays",{}),this.json=t,this.buffer=e}getExtension(t){return this.json.extensions&&this.json.extensions[t]}hasProperty(t){return Boolean(this.json[t])}getGlobalProperty(t,e=Gi.UNSIGNED_INT,r=1){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?this._getTypedArrayFromBinary(t,e,r,1,n.byteOffset):n}getPropertyArray(t,e,r){const n=this.json[t];return n&&Number.isFinite(n.byteOffset)?("componentType"in n&&(e=Oi.fromName(n.componentType)),this._getTypedArrayFromBinary(t,e,r,this.featuresLength,n.byteOffset)):this._getTypedArrayFromArray(t,e,n)}getProperty(t,e,r,n,s){const i=this.json[t];if(!i)return i;const o=this.getPropertyArray(t,e,r);if(1===r)return o[n];for(let t=0;t<r;++t)s[t]=o[r*n+t];return s}_getTypedArrayFromBinary(t,e,r,n,s){const i=this._cachedTypedArrays;let o=i[t];return o||(o=Oi.createTypedArray(e,this.buffer.buffer,this.buffer.byteOffset+s,n*r),i[t]=o),o}_getTypedArrayFromArray(t,e,r){const n=this._cachedTypedArrays;let s=n[t];return s||(s=Oi.createTypedArray(e,r),n[t]=s),s}}const Ji={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Pi={SCALAR:(t,e)=>t[e],VEC2:(t,e)=>[t[2*e+0],t[2*e+1]],VEC3:(t,e)=>[t[3*e+0],t[3*e+1],t[3*e+2]],VEC4:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT2:(t,e)=>[t[4*e+0],t[4*e+1],t[4*e+2],t[4*e+3]],MAT3:(t,e)=>[t[9*e+0],t[9*e+1],t[9*e+2],t[9*e+3],t[9*e+4],t[9*e+5],t[9*e+6],t[9*e+7],t[9*e+8]],MAT4:(t,e)=>[t[16*e+0],t[16*e+1],t[16*e+2],t[16*e+3],t[16*e+4],t[16*e+5],t[16*e+6],t[16*e+7],t[16*e+8],t[16*e+9],t[16*e+10],t[16*e+11],t[16*e+12],t[16*e+13],t[16*e+14],t[16*e+15]]},ji={SCALAR:(t,e,r)=>{e[r]=t},VEC2:(t,e,r)=>{e[2*r+0]=t[0],e[2*r+1]=t[1]},VEC3:(t,e,r)=>{e[3*r+0]=t[0],e[3*r+1]=t[1],e[3*r+2]=t[2]},VEC4:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT2:(t,e,r)=>{e[4*r+0]=t[0],e[4*r+1]=t[1],e[4*r+2]=t[2],e[4*r+3]=t[3]},MAT3:(t,e,r)=>{e[9*r+0]=t[0],e[9*r+1]=t[1],e[9*r+2]=t[2],e[9*r+3]=t[3],e[9*r+4]=t[4],e[9*r+5]=t[5],e[9*r+6]=t[6],e[9*r+7]=t[7],e[9*r+8]=t[8],e[9*r+9]=t[9]},MAT4:(t,e,r)=>{e[16*r+0]=t[0],e[16*r+1]=t[1],e[16*r+2]=t[2],e[16*r+3]=t[3],e[16*r+4]=t[4],e[16*r+5]=t[5],e[16*r+6]=t[6],e[16*r+7]=t[7],e[16*r+8]=t[8],e[16*r+9]=t[9],e[16*r+10]=t[10],e[16*r+11]=t[11],e[16*r+12]=t[12],e[16*r+13]=t[13],e[16*r+14]=t[14],e[16*r+15]=t[15]}};const ki=t=>void 0!==t;function Ki(t,e,r){if(!e)return null;let n=t.getExtension("3DTILES_batch_table_hierarchy");const s=e.HIERARCHY;return s&&(console.warn("3D Tile Parser: HIERARCHY is deprecated. Use 3DTILES_batch_table_hierarchy."),e.extensions=e.extensions||{},e.extensions["3DTILES_batch_table_hierarchy"]=s,n=s),n?function(t,e){let r,n,s;const i=t.instancesLength,o=t.classes;let a,c=t.classIds,u=t.parentCounts,l=t.parentIds,h=i;ki(c.byteOffset)&&(c.componentType=defaultValue(c.componentType,GL.UNSIGNED_SHORT),c.type=AttributeType.SCALAR,s=getBinaryAccessor(c),c=s.createArrayBufferView(e.buffer,e.byteOffset+c.byteOffset,i));if(ki(u))for(ki(u.byteOffset)&&(u.componentType=defaultValue(u.componentType,GL.UNSIGNED_SHORT),u.type=AttributeType.SCALAR,s=getBinaryAccessor(u),u=s.createArrayBufferView(e.buffer,e.byteOffset+u.byteOffset,i)),a=new Uint16Array(i),h=0,r=0;r<i;++r)a[r]=h,h+=u[r];ki(l)&&ki(l.byteOffset)&&(l.componentType=defaultValue(l.componentType,GL.UNSIGNED_SHORT),l.type=AttributeType.SCALAR,s=getBinaryAccessor(l),l=s.createArrayBufferView(e.buffer,e.byteOffset+l.byteOffset,h));const d=o.length;for(r=0;r<d;++r){const t=o[r].length,n=o[r].instances,s=getBinaryProperties(t,n,e);o[r].instances=combine(s,n)}const f=new Array(d).fill(0),A=new Uint16Array(i);for(r=0;r<i;++r)n=c[r],A[r]=f[n],++f[n];const m={classes:o,classIds:c,classIndexes:A,parentCounts:u,parentIndexes:a,parentIds:l};return function(t){const e=t.classIds.length;for(let r=0;r<e;++r)Qi(t,r,stack)}(m),m}(n,r):null}function Vi(t,e,r){if(!t)return;const n=t.parentCounts;return t.parentIds?r(t,e):n>0?function(t,e,r){const n=t.classIds,s=t.parentCounts,i=t.parentIds,o=t.parentIndexes,a=n.length,c=scratchVisited;c.length=Math.max(c.length,a);const u=++marker,l=scratchStack;l.length=0,l.push(e);for(;l.length>0;){if(c[e=l.pop()]===u)continue;c[e]=u;const n=r(t,e);if(ki(n))return n;const a=s[e],h=o[e];for(let t=0;t<a;++t){const r=i[h+t];r!==e&&l.push(r)}}return null}(t,e,r):function(t,e,r){let n=!0;for(;n;){const s=r(t,e);if(ki(s))return s;const i=t.parentIds[e];n=i!==e,e=i}throw new Error("traverseHierarchySingleParent")}(t,e,r)}function Qi(t,e,r){const n=t.parentCounts,s=t.parentIds,i=t.parentIndexes,o=t.classIds.length;if(!ki(s))return;assert(e<o,"Parent index ".concat(e," exceeds the total number of instances: ").concat(o)),assert(-1===r.indexOf(e),"Circular dependency detected in the batch table hierarchy."),r.push(e);const a=ki(n)?n[e]:1,c=ki(n)?i[e]:e;for(let n=0;n<a;++n){const i=s[c+n];i!==e&&Qi(t,i,r)}r.pop(e)}function qi(t){return null!=t}const zi=(t,e)=>t,Wi={HIERARCHY:!0,extensions:!0,extras:!0};class Yi{constructor(t,e,r,n={}){var s;H(this,"json",void 0),H(this,"binary",void 0),H(this,"featureCount",void 0),H(this,"_extensions",void 0),H(this,"_properties",void 0),H(this,"_binaryProperties",void 0),H(this,"_hierarchy",void 0),F(r>=0),this.json=t||{},this.binary=e,this.featureCount=r,this._extensions=(null===(s=this.json)||void 0===s?void 0:s.extensions)||{},this._properties={};for(const t in this.json)Wi[t]||(this._properties[t]=this.json[t]);this._binaryProperties=this._initializeBinaryProperties(),n["3DTILES_batch_table_hierarchy"]&&(this._hierarchy=Ki(this,this.json,this.binary))}getExtension(t){return this.json&&this.json.extensions&&this.json.extensions[t]}memorySizeInBytes(){return 0}isClass(t,e){if(this._checkBatchId(t),F("string"==typeof e,e),this._hierarchy){return qi(Vi(this._hierarchy,t,((t,r)=>{const n=t.classIds[r];return t.classes[n].name===e})))}return!1}isExactClass(t,e){return F("string"==typeof e,e),this.getExactClassName(t)===e}getExactClassName(t){if(this._checkBatchId(t),this._hierarchy){const e=this._hierarchy.classIds[t];return this._hierarchy.classes[e].name}}hasProperty(t,e){return this._checkBatchId(t),F("string"==typeof e,e),qi(this._properties[e])||this._hasPropertyInHierarchy(t,e)}getPropertyNames(t,e){this._checkBatchId(t),(e=qi(e)?e:[]).length=0;const r=Object.keys(this._properties);return e.push(...r),this._hierarchy&&this._getPropertyNamesInHierarchy(t,e),e}getProperty(t,e){if(this._checkBatchId(t),F("string"==typeof e,e),this._binaryProperties){const r=this._binaryProperties[e];if(qi(r))return this._getBinaryProperty(r,t)}const r=this._properties[e];if(qi(r))return zi(r[t]);if(this._hierarchy){const r=this._getHierarchyProperty(t,e);if(qi(r))return r}}setProperty(t,e,r){const n=this.featureCount;if(this._checkBatchId(t),F("string"==typeof e,e),this._binaryProperties){const n=this._binaryProperties[e];if(n)return void this._setBinaryProperty(n,t,r)}if(this._hierarchy&&this._setHierarchyProperty(this,t,e,r))return;let s=this._properties[e];qi(s)||(this._properties[e]=new Array(n),s=this._properties[e]),s[t]=zi(r)}_checkBatchId(t){if(!(t>=0&&t<this.featureCount))throw new Error("batchId not in range [0, featureCount - 1].")}_getBinaryProperty(t,e){return t.unpack(t.typedArray,e)}_setBinaryProperty(t,e,r){t.pack(r,t.typedArray,e)}_initializeBinaryProperties(){let t=null;for(const e in this._properties){const r=this._properties[e],n=this._initializeBinaryProperty(e,r);n&&(t=t||{},t[e]=n)}return t}_initializeBinaryProperty(t,e){if("byteOffset"in e){const r=e;F(this.binary,"Property ".concat(t," requires a batch table binary.")),F(r.type,"Property ".concat(t," requires a type."));const n=function(t,e,r,n){const{componentType:s}=t;F(t.componentType);const i="string"==typeof s?Oi.fromName(s):s,o=Ji[t.type],a=Pi[t.type],c=ji[t.type];return r+=t.byteOffset,{values:Oi.createTypedArray(i,e,r,o*n),type:i,size:o,unpacker:a,packer:c}}(r,this.binary.buffer,0|this.binary.byteOffset,this.featureCount);return{typedArray:n.values,componentCount:n.size,unpack:n.unpacker,pack:n.packer}}return null}_hasPropertyInHierarchy(t,e){if(!this._hierarchy)return!1;const r=Vi(this._hierarchy,t,((t,r)=>{const n=t.classIds[r];return qi(t.classes[n].instances[e])}));return qi(r)}_getPropertyNamesInHierarchy(t,e){Vi(this._hierarchy,t,((t,r)=>{const n=t.classIds[r],s=t.classes[n].instances;for(const t in s)s.hasOwnProperty(t)&&-1===e.indexOf(t)&&e.push(t)}))}_getHierarchyProperty(t,e){return Vi(this._hierarchy,t,((t,r)=>{const n=t.classIds[r],s=t.classes[n],i=t.classIndexes[r],o=s.instances[e];return qi(o)?qi(o.typedArray)?this._getBinaryProperty(o,i):zi(o[i]):null}))}_setHierarchyProperty(t,e,r,n){const s=Vi(this._hierarchy,e,((t,s)=>{const i=t.classIds[s],o=t.classes[i],a=t.classIndexes[s],c=o.instances[r];return!!qi(c)&&(F(s===e,'Inherited property "'.concat(r,'" is read-only.')),qi(c.typedArray)?this._setBinaryProperty(c,a,n):c[a]=zi(n),!0)}));return qi(s)}}function Xi(t,e,r=0){const n=new DataView(e);if(t.magic=n.getUint32(r,!0),r+=4,t.version=n.getUint32(r,!0),r+=4,t.byteLength=n.getUint32(r,!0),r+=4,1!==t.version)throw new Error("3D Tile Version ".concat(t.version," not supported"));return r}function Zi(t,e,r){const n=new DataView(e);let s;t.header=t.header||{};let i=n.getUint32(r,!0);r+=4;let o=n.getUint32(r,!0);r+=4;let a=n.getUint32(r,!0);r+=4;let c=n.getUint32(r,!0);return r+=4,a>=570425344?(r-=8,s=i,a=o,c=0,i=0,o=0,console.warn("b3dm tile in legacy format.")):c>=570425344&&(r-=4,s=a,a=i,c=o,i=0,o=0,console.warn("b3dm tile in legacy format.")),t.header.featureTableJsonByteLength=i,t.header.featureTableBinaryByteLength=o,t.header.batchTableJsonByteLength=a,t.header.batchTableBinaryByteLength=c,t.header.batchLength=s,r}function $i(t,e,r,n){return r=function(t,e,r,n){const{featureTableJsonByteLength:s,featureTableBinaryByteLength:i,batchLength:o}=t.header;if(t.featureTableJson={BATCH_LENGTH:o||0},s>0){const n=Ws(e,r,s);t.featureTableJson=JSON.parse(n)}return r+=s,t.featureTableBinary=new Uint8Array(e,r,i),r+=i}(t,e,r),r=function(t,e,r,n){const{batchTableJsonByteLength:s,batchTableBinaryByteLength:i}=t.header;if(s>0){const n=Ws(e,r,s);t.batchTableJson=JSON.parse(n),r+=s,i>0&&(t.batchTableBinary=new Uint8Array(e,r,i),t.batchTableBinary=new Uint8Array(t.batchTableBinary),r+=i)}return r}(t,e,r),r}function to(t,e,r){if(!(e||t&&t.batchIds&&r))return null;const{batchIds:n,isRGB565:s,pointCount:i}=t;if(n&&r){const t=new Uint8ClampedArray(3*i);for(let e=0;e<i;e++){const s=n[e],i=r.getProperty(s,"dimensions").map((t=>255*t));t[3*e]=i[0],t[3*e+1]=i[1],t[3*e+2]=i[2]}return{type:Gi.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}if(s){const t=new Uint8ClampedArray(3*i);for(let r=0;r<i;r++){const n=xi(e[r]);t[3*r]=n[0],t[3*r+1]=n[1],t[3*r+2]=n[2]}return{type:Gi.UNSIGNED_BYTE,value:t,size:3,normalized:!0}}return e&&e.length===3*i?{type:Gi.UNSIGNED_BYTE,value:e,size:3,normalized:!0}:{type:Gi.UNSIGNED_BYTE,value:e,size:4,normalized:!0}}const eo=new cr;function ro(t,e,r){return t.isQuantized?r["3d-tiles"]&&r["3d-tiles"].decodeQuantizedPositions?(t.isQuantized=!1,function(t,e){const r=new cr,n=new Float32Array(3*t.pointCount);for(let s=0;s<t.pointCount;s++)r.set(e[3*s],e[3*s+1],e[3*s+2]).scale(1/t.quantizedRange).multiply(t.quantizedVolumeScale).add(t.quantizedVolumeOffset).toArray(n,3*s);return n}(t,e)):{type:Gi.UNSIGNED_SHORT,value:e,size:3,normalized:!0}:e}async function no(t,e,r,n,s){r=$i(t,e,r=Zi(t,e,r=Xi(t,e,r))),function(t){t.attributes={positions:null,colors:null,normals:null,batchIds:null},t.isQuantized=!1,t.isTranslucent=!1,t.isRGB565=!1,t.isOctEncoded16P=!1}(t);const{featureTable:i,batchTable:o}=function(t){const e=new Hi(t.featureTableJson,t.featureTableBinary),r=e.getGlobalProperty("POINTS_LENGTH");if(!Number.isFinite(r))throw new Error("POINTS_LENGTH must be defined");e.featuresLength=r,t.featuresLength=r,t.pointsLength=r,t.pointCount=r,t.rtcCenter=e.getGlobalProperty("RTC_CENTER",Gi.FLOAT,3);const n=function(t,e){let r=null;if(!t.batchIds&&e.hasProperty("BATCH_ID")&&(t.batchIds=e.getPropertyArray("BATCH_ID",Gi.UNSIGNED_SHORT,1),t.batchIds)){const n=e.getGlobalProperty("BATCH_LENGTH");if(!n)throw new Error("Global property: BATCH_LENGTH must be defined when BATCH_ID is defined.");const{batchTableJson:s,batchTableBinary:i}=t;r=new Yi(s,i,n)}return r}(t,e);return{featureTable:e,batchTable:n}}(t);return await async function(t,e,r,n,s){let i,o,a;const c=t.batchTableJson&&t.batchTableJson.extensions&&t.batchTableJson.extensions["3DTILES_draco_point_compression"];c&&(a=c.properties);const u=e.getExtension("3DTILES_draco_point_compression");if(u){o=u.properties;const e=u.byteOffset,r=u.byteLength;if(!o||!Number.isFinite(e)||!r)throw new Error("Draco properties, byteOffset, and byteLength must be defined");i=t.featureTableBinary.slice(e,e+r),t.hasPositions=Number.isFinite(o.POSITION),t.hasColors=Number.isFinite(o.RGB)||Number.isFinite(o.RGBA),t.hasNormals=Number.isFinite(o.NORMAL),t.hasBatchIds=Number.isFinite(o.BATCH_ID),t.isTranslucent=Number.isFinite(o.RGBA)}if(!i)return!0;const l={buffer:i,properties:{...o,...a},featureTableProperties:o,batchTableProperties:a,dequantizeInShader:!1};return await async function(t,e,r,n){const{parse:s}=n,i={...r,draco:{...r.draco,extraAttributes:e.batchTableProperties||{}}};delete i["3d-tiles"];const o=await s(e.buffer,Fi,i),a=o.attributes.POSITION&&o.attributes.POSITION.value,c=o.attributes.COLOR_0&&o.attributes.COLOR_0.value,u=o.attributes.NORMAL&&o.attributes.NORMAL.value,l=o.attributes.BATCH_ID&&o.attributes.BATCH_ID.value,h=a&&o.attributes.POSITION.value.quantization,d=u&&o.attributes.NORMAL.value.quantization;if(h){const e=o.POSITION.data.quantization,r=e.range;t.quantizedVolumeScale=new cr(r,r,r),t.quantizedVolumeOffset=new cr(e.minValues),t.quantizedRange=(1<<e.quantizationBits)-1,t.isQuantizedDraco=!0}d&&(t.octEncodedRange=(1<<o.NORMAL.data.quantization.quantizationBits)-1,t.isOctEncodedDraco=!0);const f={};if(e.batchTableProperties)for(const t of Object.keys(e.batchTableProperties))o.attributes[t]&&o.attributes[t].value&&(f[t.toLowerCase()]=o.attributes[t].value);t.attributes={positions:a,colors:to(t,c,void 0),normals:u,batchIds:l,...f}}(t,l,n,s)}(t,i,0,n,s),function(t,e,r){if(!t.attributes.positions)if(e.hasProperty("POSITION"))t.attributes.positions=e.getPropertyArray("POSITION",Gi.FLOAT,3);else if(e.hasProperty("POSITION_QUANTIZED")){const n=e.getPropertyArray("POSITION_QUANTIZED",Gi.UNSIGNED_SHORT,3);if(t.isQuantized=!0,t.quantizedRange=65535,t.quantizedVolumeScale=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Gi.FLOAT,3),!t.quantizedVolumeScale)throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");if(t.quantizedVolumeOffset=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Gi.FLOAT,3),!t.quantizedVolumeOffset)throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");t.attributes.positions=ro(t,n,r)}if(!t.attributes.positions)throw new Error("Either POSITION or POSITION_QUANTIZED must be defined.")}(t,i,n),function(t,e,r){if(!t.attributes.colors){let n=null;e.hasProperty("RGBA")?(n=e.getPropertyArray("RGBA",Gi.UNSIGNED_BYTE,4),t.isTranslucent=!0):e.hasProperty("RGB")?n=e.getPropertyArray("RGB",Gi.UNSIGNED_BYTE,3):e.hasProperty("RGB565")&&(n=e.getPropertyArray("RGB565",Gi.UNSIGNED_SHORT,1),t.isRGB565=!0),t.attributes.colors=to(t,n,r)}e.hasProperty("CONSTANT_RGBA")&&(t.constantRGBA=e.getGlobalProperty("CONSTANT_RGBA",Gi.UNSIGNED_BYTE,4))}(t,i,o),function(t,e){if(!t.attributes.normals){let r=null;e.hasProperty("NORMAL")?r=e.getPropertyArray("NORMAL",Gi.FLOAT,3):e.hasProperty("NORMAL_OCT16P")&&(r=e.getPropertyArray("NORMAL_OCT16P",Gi.UNSIGNED_BYTE,2),t.isOctEncoded16P=!0),t.attributes.normals=function(t,e){if(!e)return null;if(t.isOctEncoded16P){const s=new Float32Array(3*t.pointsLength);for(let i=0;i<t.pointsLength;i++)r=e[2*i],n=e[2*i+1],Ni(r,n,255,eo),eo.toArray(s,3*i);return{type:Gi.FLOAT,size:2,value:s}}var r,n;return{type:Gi.FLOAT,size:2,value:e}}(t,r)}}(t,i),r}const so="https://unpkg.com/@loaders.gl/textures@".concat("3.1.4","/dist/libs/basis_encoder.wasm"),io="https://unpkg.com/@loaders.gl/textures@".concat("3.1.4","/dist/libs/basis_encoder.js");let oo,ao;async function co(t){const e=t.modules||{};return e.basis?e.basis:(oo=oo||async function(t){let e=null,r=null;return[e,r]=await Promise.all([await tt("basis_transcoder.js","textures",t),await tt("basis_transcoder.wasm","textures",t)]),e=e||globalThis.BASIS,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise((e=>{t(r).then((t=>{const{BasisFile:r,initializeBasis:n}=t;n(),e({BasisFile:r})}))}))}(e,r)}(t),await oo)}async function uo(t){const e=t.modules||{};return e.basisEncoder?e.basisEncoder:(ao=ao||async function(t){let e=null,r=null;return[e,r]=await Promise.all([await tt(io,"textures",t),await tt(so,"textures",t)]),e=e||globalThis.BASIS,await function(t,e){const r={};e&&(r.wasmBinary=e);return new Promise((e=>{t(r).then((t=>{const{BasisFile:r,KTX2File:n,initializeBasis:s,BasisEncoder:i}=t;s(),e({BasisFile:r,KTX2File:n,BasisEncoder:i})}))}))}(e,r)}(t),await ao)}const lo=33776,ho=33779,fo=35840,Ao=35842,mo=36196,po=37808,Bo=["","WEBKIT_","MOZ_"],go={WEBGL_compressed_texture_s3tc:"dxt",WEBGL_compressed_texture_s3tc_srgb:"dxt-srgb",WEBGL_compressed_texture_etc1:"etc1",WEBGL_compressed_texture_etc:"etc2",WEBGL_compressed_texture_pvrtc:"pvrtc",WEBGL_compressed_texture_atc:"atc",WEBGL_compressed_texture_astc:"astc",EXT_texture_compression_rgtc:"rgtc"};let yo=null;function Co(t){if(!yo){t=t||function(){try{return document.createElement("canvas").getContext("webgl")}catch(t){return null}}()||void 0,yo=new Set;for(const e of Bo)for(const r in go)if(t&&t.getExtension("".concat(e).concat(r))){const t=go[r];yo.add(t)}}return yo}var bo,wo,To,Eo,_o,Mo,vo,Io,Fo;(Fo=bo||(bo={}))[Fo.NONE=0]="NONE",Fo[Fo.BASISLZ=1]="BASISLZ",Fo[Fo.ZSTD=2]="ZSTD",Fo[Fo.ZLIB=3]="ZLIB",function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(wo||(wo={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(To||(To={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(Eo||(Eo={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2"}(_o||(_o={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(Mo||(Mo={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(vo||(vo={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Io||(Io={}));const Do=[171,75,84,88,32,50,48,187,13,10,26,10];const Go={etc1:{basisFormat:0,compressed:!0,format:mo},etc2:{basisFormat:1,compressed:!0},bc1:{basisFormat:2,compressed:!0,format:lo},bc3:{basisFormat:3,compressed:!0,format:ho},bc4:{basisFormat:4,compressed:!0},bc5:{basisFormat:5,compressed:!0},"bc7-m6-opaque-only":{basisFormat:6,compressed:!0},"bc7-m5":{basisFormat:7,compressed:!0},"pvrtc1-4-rgb":{basisFormat:8,compressed:!0,format:fo},"pvrtc1-4-rgba":{basisFormat:9,compressed:!0,format:Ao},"astc-4x4":{basisFormat:10,compressed:!0,format:po},"atc-rgb":{basisFormat:11,compressed:!0},"atc-rgba-interpolated-alpha":{basisFormat:12,compressed:!0},rgba32:{basisFormat:13,compressed:!1},rgb565:{basisFormat:14,compressed:!1},bgr565:{basisFormat:15,compressed:!1},rgba4444:{basisFormat:16,compressed:!1}};function Ro(t,e,r){const n=new t(new Uint8Array(e));try{if(!n.startTranscoding())return null;const t=n.getNumImages(),e=[];for(let s=0;s<t;s++){const t=n.getNumLevels(s),i=[];for(let e=0;e<t;e++)i.push(So(n,s,e,r));e.push(i)}return e}finally{n.close(),n.delete()}}function So(t,e,r,n){const s=t.getImageWidth(e,r),i=t.getImageHeight(e,r),o=t.getHasAlpha(),{compressed:a,format:c,basisFormat:u}=Uo(n,o),l=t.getImageTranscodedSizeInBytes(e,r,u),h=new Uint8Array(l);return t.transcodeImage(h,e,r,u,0,0)?{width:s,height:i,data:h,compressed:a,hasAlpha:o,format:c}:null}function Oo(t,e,r){const n=new t(new Uint8Array(e));try{if(!n.startTranscoding())return null;const t=n.getLevels(),e=[];for(let s=0;s<t;s++){e.push(xo(n,s,r));break}return e}finally{n.close(),n.delete()}}function xo(t,e,r){const{alphaFlag:n,height:s,width:i}=t.getImageLevelInfo(e,0,0),{compressed:o,format:a,basisFormat:c}=Uo(r,n),u=t.getImageTranscodedSizeInBytes(e,0,0,c),l=new Uint8Array(u);return t.transcodeImage(l,e,0,0,c,0,-1,-1)?{width:i,height:s,data:l,compressed:o,alphaFlag:n,format:a}:null}function Uo(t,e){let r=t&&t.basis&&t.basis.format;return"auto"===r&&(r=Lo()),"object"==typeof r&&(r=e?r.alpha:r.noAlpha),r=r.toLowerCase(),Go[r]}function Lo(){const t=Co();return t.has("astc")?"astc-4x4":t.has("dxt")?{alpha:"bc3",noAlpha:"bc1"}:t.has("pvrtc")?{alpha:"pvrtc1-4-rgba",noAlpha:"pvrtc1-4-rgb"}:t.has("etc1")?"etc1":t.has("etc2")?"etc2":"rgb565"}const No={...{name:"Basis",id:"basis",module:"textures",version:"3.1.4",worker:!0,extensions:["basis","ktx2"],mimeTypes:["application/octet-stream","image/ktx2"],tests:["sB"],binary:!0,options:{basis:{format:"auto",libraryPath:"libs/",containerFormat:"auto",module:"transcoder"}}},parse:async function(t,e){if("auto"===e.basis.containerFormat){if(function(t){const e=new Uint8Array(t);return!(e.byteLength<Do.length||e[0]!==Do[0]||e[1]!==Do[1]||e[2]!==Do[2]||e[3]!==Do[3]||e[4]!==Do[4]||e[5]!==Do[5]||e[6]!==Do[6]||e[7]!==Do[7]||e[8]!==Do[8]||e[9]!==Do[9]||e[10]!==Do[10]||e[11]!==Do[11])}(t)){return Oo((await uo(e)).KTX2File,t,e)}const{BasisFile:r}=await co(e);return Ro(r,t,e)}if("encoder"===e.basis.module){const r=await uo(e);return"ktx2"===e.basis.containerFormat?Oo(r.KTX2File,t,e):Ro(r.BasisFile,t,e)}{const{BasisFile:r}=await co(e);return Ro(r,t,e)}}},{_parseImageNode:Ho}=globalThis,Jo="undefined"!=typeof Image,Po="undefined"!=typeof ImageBitmap,jo=Boolean(Ho),ko=!!D||jo;function Ko(t){const e=function(t){if("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap)return"imagebitmap";if("undefined"!=typeof Image&&t instanceof Image)return"image";if(t&&"object"==typeof t&&t.data&&t.width&&t.height)return"data";return null}(t);if(!e)throw new Error("Not an image");return e}const Vo=/^data:image\/svg\+xml/,Qo=/\.svg((\?|#).*)?$/;function qo(t){return t&&(Vo.test(t)||Qo.test(t))}function zo(t,e){if(qo(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function Wo(t,e,r){const n=function(t,e){if(qo(e)){let e=(new TextDecoder).decode(t);try{"function"==typeof unescape&&"function"==typeof encodeURIComponent&&(e=unescape(encodeURIComponent(e)))}catch(t){throw new Error(t.message)}return"data:image/svg+xml;base64,".concat(btoa(e))}return zo(t,e)}(t,r),s=self.URL||self.webkitURL,i="string"!=typeof n&&s.createObjectURL(n);try{return await async function(t,e){const r=new Image;if(r.src=t,e.image&&e.image.decode&&r.decode)return await r.decode(),r;return await new Promise(((e,n)=>{try{r.onload=()=>e(r),r.onerror=e=>n(new Error("Could not load image ".concat(t,": ").concat(e)))}catch(t){n(t)}}))}(i||n,e)}finally{i&&s.revokeObjectURL(i)}}const Yo={};let Xo=!0;async function Zo(t,e,r){let n;if(qo(r)){n=await Wo(t,e,r)}else n=zo(t,r);const s=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||Yo)return!1;return!0}(e)&&Xo||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),Xo=!1}return await createImageBitmap(t)}(n,s)}function $o(t){const e=ta(t);return function(t){const e=ta(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,false)))return null;return{mimeType:"image/png",width:e.getUint32(16,false),height:e.getUint32(20,false)}}(e)||function(t){const e=ta(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,false)&&255===e.getUint8(2)))return null;const{tableMarkers:r,sofMarkers:n}=function(){const t=new Set([65499,65476,65484,65501,65534]);for(let e=65504;e<65520;++e)t.add(e);const e=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:t,sofMarkers:e}}();let s=2;for(;s+9<e.byteLength;){const t=e.getUint16(s,false);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(s+5,false),width:e.getUint16(s+7,false)};if(!r.has(t))return null;s+=2,s+=e.getUint16(s,false)}return null}(e)||function(t){const e=ta(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,false)))return null;return{mimeType:"image/gif",width:e.getUint16(6,true),height:e.getUint16(8,true)}}(e)||function(t){const e=ta(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,false)&&e.getUint32(2,true)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,true),height:e.getUint32(22,true)}}(e)}function ta(t){if(t instanceof DataView)return t;if(ArrayBuffer.isView(t))return new DataView(t.buffer);if(t instanceof ArrayBuffer)return new DataView(t);throw new Error("toDataView")}const ea={id:"image",module:"images",name:"Images",version:"3.1.4",mimeTypes:["image/png","image/jpeg","image/gif","image/webp","image/bmp","image/vnd.microsoft.icon","image/svg+xml"],extensions:["png","jpg","jpeg","gif","webp","bmp","ico","svg"],parse:async function(t,e,r){const n=((e=e||{}).image||{}).type||"auto",{url:s}=r||{};let i;switch(function(t){switch(t){case"auto":case"data":return function(){if(Po)return"imagebitmap";if(Jo)return"image";if(ko)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return Po||Jo||ko;case"imagebitmap":return Po;case"image":return Jo;case"data":return ko;default:throw new Error("@loaders.gl/images: image ".concat(t," not supported in this environment"))}}(t),t}}(n)){case"imagebitmap":i=await Zo(t,e,s);break;case"image":i=await Wo(t,e,s);break;case"data":i=await async function(t,e){const{mimeType:r}=$o(t)||{},n=globalThis._parseImageNode;return F(n),await n(t,r)}(t);break;default:F(!1)}return"data"===n&&(i=function(t){switch(Ko(t)){case"data":return t;case"image":case"imagebitmap":const e=document.createElement("canvas"),r=e.getContext("2d");if(!r)throw new Error("getImageData");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0),r.getImageData(0,0,t.width,t.height);default:throw new Error("getImageData")}}(i)),i},tests:[t=>Boolean($o(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},ra=["image/png","image/jpeg","image/gif"],na={};function sa(t){return void 0===na[t]&&(na[t]=function(t){switch(t){case"image/webp":return function(){if(!D)return!1;try{return 0===document.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")}catch{return!1}}();case"image/svg":return D;default:if(!D){const{_parseImageNode:e}=globalThis;return Boolean(e)&&ra.includes(t)}return!0}}(t)),na[t]}function ia(t,e){if(!t)throw new Error(e||"assert failed: gltf")}function oa(t,e){if(t.startsWith("data:")||t.startsWith("http:")||t.startsWith("https:"))return t;const r=e.baseUri||e.uri;if(!r)throw new Error("'baseUri' must be provided to resolve relative url ".concat(t));return r.substr(0,r.lastIndexOf("/")+1)+t}const aa=["SCALAR","VEC2","VEC3","VEC4"],ca=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]],ua=new Map(ca),la={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},ha={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},da={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function fa(t){return aa[t-1]||aa[0]}function Aa(t){const e=ua.get(t.constructor);if(!e)throw new Error("Illegal typed array");return e}function ma(t,e){const r=da[t.componentType],n=la[t.type],s=ha[t.componentType],i=t.count*n,o=t.count*n*s;return ia(o>=0&&o<=e.byteLength),{ArrayType:r,length:i,byteLength:o}}const pa={asset:{version:"2.0",generator:"loaders.gl"},buffers:[]};class Ba{constructor(t){H(this,"gltf",void 0),H(this,"sourceBuffers",void 0),H(this,"byteLength",void 0),this.gltf=t||{json:{...pa},buffers:[]},this.sourceBuffers=[],this.byteLength=0,this.gltf.buffers&&this.gltf.buffers[0]&&(this.byteLength=this.gltf.buffers[0].byteLength,this.sourceBuffers=[this.gltf.buffers[0]])}get json(){return this.gltf.json}getApplicationData(t){return this.json[t]}getExtraData(t){return(this.json.extras||{})[t]}getExtension(t){const e=this.getUsedExtensions().find((e=>e===t)),r=this.json.extensions||{};return e?r[t]||!0:null}getRequiredExtension(t){const e=this.getRequiredExtensions().find((e=>e===t));return e?this.getExtension(t):null}getRequiredExtensions(){return this.json.extensionsRequired||[]}getUsedExtensions(){return this.json.extensionsUsed||[]}getObjectExtension(t,e){return(t.extensions||{})[e]}getScene(t){return this.getObject("scenes",t)}getNode(t){return this.getObject("nodes",t)}getSkin(t){return this.getObject("skins",t)}getMesh(t){return this.getObject("meshes",t)}getMaterial(t){return this.getObject("materials",t)}getAccessor(t){return this.getObject("accessors",t)}getTexture(t){return this.getObject("textures",t)}getSampler(t){return this.getObject("samplers",t)}getImage(t){return this.getObject("images",t)}getBufferView(t){return this.getObject("bufferViews",t)}getBuffer(t){return this.getObject("buffers",t)}getObject(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];if(!r)throw new Error("glTF file error: Could not find ".concat(t,"[").concat(e,"]"));return r}getTypedArrayForBufferView(t){const e=(t=this.getBufferView(t)).buffer,r=this.gltf.buffers[e];ia(r);const n=(t.byteOffset||0)+r.byteOffset;return new Uint8Array(r.arrayBuffer,n,t.byteLength)}getTypedArrayForAccessor(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,{ArrayType:n,length:s}=ma(t,e);return new n(r,e.byteOffset+t.byteOffset,s)}getTypedArrayForImageData(t){t=this.getAccessor(t);const e=this.getBufferView(t.bufferView),r=this.getBuffer(e.buffer).data,n=e.byteOffset||0;return new Uint8Array(r,n,e.byteLength)}addApplicationData(t,e){return this.json[t]=e,this}addExtraData(t,e){return this.json.extras=this.json.extras||{},this.json.extras[t]=e,this}addObjectExtension(t,e,r){return t.extensions=t.extensions||{},t.extensions[e]=r,this.registerUsedExtension(e),this}setObjectExtension(t,e,r){(t.extensions||{})[e]=r}removeObjectExtension(t,e){const r=t.extensions||{},n=r[e];return delete r[e],n}addExtension(t,e={}){return ia(e),this.json.extensions=this.json.extensions||{},this.json.extensions[t]=e,this.registerUsedExtension(t),e}addRequiredExtension(t,e={}){return ia(e),this.addExtension(t,e),this.registerRequiredExtension(t),e}registerUsedExtension(t){this.json.extensionsUsed=this.json.extensionsUsed||[],this.json.extensionsUsed.find((e=>e===t))||this.json.extensionsUsed.push(t)}registerRequiredExtension(t){this.registerUsedExtension(t),this.json.extensionsRequired=this.json.extensionsRequired||[],this.json.extensionsRequired.find((e=>e===t))||this.json.extensionsRequired.push(t)}removeExtension(t){this.json.extensionsRequired&&this._removeStringFromArray(this.json.extensionsRequired,t),this.json.extensionsUsed&&this._removeStringFromArray(this.json.extensionsUsed,t),this.json.extensions&&delete this.json.extensions[t]}setDefaultScene(t){this.json.scene=t}addScene(t){const{nodeIndices:e}=t;return this.json.scenes=this.json.scenes||[],this.json.scenes.push({nodes:e}),this.json.scenes.length-1}addNode(t){const{meshIndex:e,matrix:r}=t;this.json.nodes=this.json.nodes||[];const n={mesh:e};return r&&(n.matrix=r),this.json.nodes.push(n),this.json.nodes.length-1}addMesh(t){const{attributes:e,indices:r,material:n,mode:s=4}=t,i={primitives:[{attributes:this._addAttributes(e),mode:s}]};if(r){const t=this._addIndices(r);i.primitives[0].indices=t}return Number.isFinite(n)&&(i.primitives[0].material=n),this.json.meshes=this.json.meshes||[],this.json.meshes.push(i),this.json.meshes.length-1}addPointCloud(t){const e={primitives:[{attributes:this._addAttributes(t),mode:0}]};return this.json.meshes=this.json.meshes||[],this.json.meshes.push(e),this.json.meshes.length-1}addImage(t,e){const r=$o(t),n=e||(null==r?void 0:r.mimeType),s={bufferView:this.addBufferView(t),mimeType:n};return this.json.images=this.json.images||[],this.json.images.push(s),this.json.images.length-1}addBufferView(t){const e=t.byteLength;ia(Number.isFinite(e)),this.sourceBuffers=this.sourceBuffers||[],this.sourceBuffers.push(t);const r={buffer:0,byteOffset:this.byteLength,byteLength:e};return this.byteLength+=ct(e,4),this.json.bufferViews=this.json.bufferViews||[],this.json.bufferViews.push(r),this.json.bufferViews.length-1}addAccessor(t,e){const r={bufferView:t,type:fa(e.size),componentType:e.componentType,count:e.count,max:e.max,min:e.min};return this.json.accessors=this.json.accessors||[],this.json.accessors.push(r),this.json.accessors.length-1}addBinaryBuffer(t,e={size:3}){const r=this.addBufferView(t);let n={min:e.min,max:e.max};n.min&&n.max||(n=this._getAccessorMinMax(t,e.size));const s={size:e.size,componentType:Aa(t),count:Math.round(t.length/e.size),min:n.min,max:n.max};return this.addAccessor(r,Object.assign(s,e))}addTexture(t){const{imageIndex:e}=t,r={source:e};return this.json.textures=this.json.textures||[],this.json.textures.push(r),this.json.textures.length-1}addMaterial(t){return this.json.materials=this.json.materials||[],this.json.materials.push(t),this.json.materials.length-1}createBinaryChunk(){var t,e;this.gltf.buffers=[];const r=this.byteLength,n=new ArrayBuffer(r),s=new Uint8Array(n);let i=0;for(const t of this.sourceBuffers||[])i=ut(t,s,i);null!==(t=this.json)&&void 0!==t&&null!==(e=t.buffers)&&void 0!==e&&e[0]?this.json.buffers[0].byteLength=r:this.json.buffers=[{byteLength:r}],this.gltf.binary=n,this.sourceBuffers=[n]}_removeStringFromArray(t,e){let r=!0;for(;r;){const n=t.indexOf(e);n>-1?t.splice(n,1):r=!1}}_addAttributes(t={}){const e={};for(const r in t){const n=t[r],s=this._getGltfAttributeName(r),i=this.addBinaryBuffer(n.value,n);e[s]=i}return e}_addIndices(t){return this.addBinaryBuffer(t,{size:1})}_getGltfAttributeName(t){switch(t.toLowerCase()){case"position":case"positions":case"vertices":return"POSITION";case"normal":case"normals":return"NORMAL";case"color":case"colors":return"COLOR_0";case"texcoord":case"texcoords":return"TEXCOORD_0";default:return t}}_getAccessorMinMax(t,e){const r={min:null,max:null};if(t.length<e)return r;r.min=[],r.max=[];const n=t.subarray(0,e);for(const t of n)r.min.push(t),r.max.push(t);for(let n=e;n<t.length;n+=e)for(let s=0;s<e;s++)r.min[0+s]=Math.min(r.min[0+s],t[n+s]),r.max[0+s]=Math.max(r.max[0+s],t[n+s]);return r}}const ga="object"!=typeof WebAssembly,ya="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EB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nD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",ba=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]),wa=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]),Ta={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Ea={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};async function _a(t,e,r,n,s,i="NONE"){const o=await async function(){Ma||(Ma=async function(){let t=ya;WebAssembly.validate(ba)&&(t=Ca,console.log("Warning: meshopt_decoder is using experimental SIMD support"));const e=await WebAssembly.instantiate(function(t){const e=new Uint8Array(t.length);for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);e[r]=n>96?n-71:n>64?n-65:n>47?n+4:n>46?63:62}let r=0;for(let n=0;n<t.length;++n)e[r++]=e[n]<60?wa[e[n]]:64*(e[n]-60)+e[++n];return e.buffer.slice(0,r)}(t),{});return await e.instance.exports.__wasm_call_ctors(),e.instance}());return Ma}();!function(t,e,r,n,s,i,o){const a=t.exports.sbrk,c=n+3&-4,u=a(c*s),l=a(i.length),h=new Uint8Array(t.exports.memory.buffer);h.set(i,l);const d=e(u,n,s,l,i.length);0===d&&o&&o(u,c,s);if(r.set(h.subarray(u,u+n*s)),a(u-a(0)),0!==d)throw new Error("Malformed buffer data: ".concat(d))}(o,o.exports[Ea[s]],t,e,r,n,o.exports[Ta[i||"NONE"]])}let Ma;async function va(t,e){const r=t.getObjectExtension(e,"EXT_meshopt_compression");if(r){const t=e.buffer,{byteOffset:n=0,byteLength:s=0,byteStride:i,count:o,mode:a,filter:c="NONE"}=r,u=new Uint8Array(t,n,s),l=new ArrayBuffer(o*i);return await _a(new Uint8Array(l),o,i,u,a,c),l}return null}var Ia=Object.freeze({__proto__:null,name:"EXT_meshopt_compression",preprocess:function(t){if(new Ba(t).getRequiredExtensions().includes("EXT_meshopt_compression")&&!ga)throw new Error("gltf: Required extension ".concat("EXT_meshopt_compression"," not supported by browser"))},decode:async function(t,e){var r;const n=new Ba(t);if(null==e||null===(r=e.gltf)||void 0===r||!r.decompressMeshes)return;const s=[];for(const e of t.json.bufferViews||[])s.push(va(n,e));await Promise.all(s),n.removeExtension("EXT_meshopt_compression")}});var Fa=Object.freeze({__proto__:null,name:"EXT_texture_webp",preprocess:function(t,e){const r=new Ba(t);if(!sa("image/webp")){if(r.getRequiredExtensions().includes("EXT_texture_webp"))throw new Error("gltf: Required extension ".concat("EXT_texture_webp"," not supported by browser"));return}const{json:n}=r;for(const t of n.textures||[]){const e=r.getObjectExtension(t,"EXT_texture_webp");e&&(t.source=e.source),r.removeObjectExtension(t,"EXT_texture_webp")}r.removeExtension("EXT_texture_webp")}});var Da=Object.freeze({__proto__:null,name:"KHR_texture_basisu",preprocess:function(t,e){const r=new Ba(t),{json:n}=r;for(const t of n.textures||[]){const e=r.getObjectExtension(t,"KHR_texture_basisu");e&&(t.source=e.source),r.removeObjectExtension(t,"KHR_texture_basisu")}r.removeExtension("KHR_texture_basisu")}});function Ga(t){const{buffer:e,size:r,count:n}=function(t){let e=t,r=1,n=0;t&&t.value&&(e=t.value,r=t.size||1);e&&(ArrayBuffer.isView(e)||(e=function(t,e,r=!1){if(!t)return null;if(Array.isArray(t))return new e(t);if(r&&!(t instanceof e))return new e(t);return t}(e,Float32Array)),n=e.length/r);return{buffer:e,size:r,count:n}}(t);return{value:e,size:r,byteOffset:0,count:n,type:fa(r),componentType:Aa(e)}}async function Ra(t,e,r,n){const s=t.getObjectExtension(e,"KHR_draco_mesh_compression");if(!s)return;const i=t.getTypedArrayForBufferView(s.bufferView),o=at(i.buffer,i.byteOffset),{parse:a}=n,c={...r};delete c["3d-tiles"];const u=await a(o,Fi,c,n),l=function(t){const e={};for(const r in t){const n=t[r];if("indices"!==r){const t=Ga(n);e[r]=t}}return e}(u.attributes);for(const[r,n]of Object.entries(l))if(r in e.attributes){const s=e.attributes[r],i=t.getAccessor(s);null!=i&&i.min&&null!=i&&i.max&&(n.min=i.min,n.max=i.max)}e.attributes=l,u.indices&&(e.indices=Ga(u.indices)),function(t){if(!t.attributes&&Object.keys(t.attributes).length>0)throw new Error("glTF: Empty primitive detected: Draco decompression failure?")}(e)}function Sa(t,e,r=4,n,s){var i;if(!n.DracoWriter)throw new Error("options.gltf.DracoWriter not provided");const o=n.DracoWriter.encodeSync({attributes:t}),a=null==s||null===(i=s.parseSync)||void 0===i?void 0:i.call(s,{attributes:t}),c=n._addFauxAttributes(a.attributes);return{primitives:[{attributes:c,mode:r,extensions:{KHR_draco_mesh_compression:{bufferView:n.addBufferView(o),attributes:c}}}]}}function*Oa(t){for(const e of t.json.meshes||[])for(const t of e.primitives)yield t}var xa=Object.freeze({__proto__:null,name:"KHR_draco_mesh_compression",preprocess:function(t,e,r){const n=new Ba(t);for(const t of Oa(n))n.getObjectExtension(t,"KHR_draco_mesh_compression")},decode:async function(t,e,r){var n;if(null==e||null===(n=e.gltf)||void 0===n||!n.decompressMeshes)return;const s=new Ba(t),i=[];for(const t of Oa(s))s.getObjectExtension(t,"KHR_draco_mesh_compression")&&i.push(Ra(s,t,e,r));await Promise.all(i),s.removeExtension("KHR_draco_mesh_compression")},encode:function(t,e={}){const r=new Ba(t);for(const t of r.json.meshes||[])Sa(t),r.addRequiredExtension("KHR_draco_mesh_compression")}});var Ua=Object.freeze({__proto__:null,name:"KHR_lights_punctual",decode:async function(t){const e=new Ba(t),{json:r}=e,n=e.getExtension("KHR_lights_punctual");n&&(e.json.lights=n.lights,e.removeExtension("KHR_lights_punctual"));for(const t of r.nodes||[]){const r=e.getObjectExtension(t,"KHR_lights_punctual");r&&(t.light=r.light),e.removeObjectExtension(t,"KHR_lights_punctual")}},encode:async function(t){const e=new Ba(t),{json:r}=e;if(r.lights){const t=e.addExtension("KHR_lights_punctual");ia(!t.lights),t.lights=r.lights,delete r.lights}if(e.json.lights){for(const t of e.json.lights){const r=t.node;e.addObjectExtension(r,"KHR_lights_punctual",t)}delete e.json.lights}}});function La(t,e){const r=Object.assign({},t.values);return Object.keys(t.uniforms||{}).forEach((e=>{t.uniforms[e].value&&!(e in r)&&(r[e]=t.uniforms[e].value)})),Object.keys(r).forEach((t=>{"object"==typeof r[t]&&void 0!==r[t].index&&(r[t].texture=e.getTexture(r[t].index))})),r}const Na=[Ia,Fa,Da,xa,Ua,Object.freeze({__proto__:null,name:"KHR_materials_unlit",decode:async function(t){const e=new Ba(t),{json:r}=e;e.removeExtension("KHR_materials_unlit");for(const t of r.materials||[]){t.extensions&&t.extensions.KHR_materials_unlit&&(t.unlit=!0),e.removeObjectExtension(t,"KHR_materials_unlit")}},encode:function(t){const e=new Ba(t),{json:r}=e;if(e.materials)for(const t of r.materials||[])t.unlit&&(delete t.unlit,e.addObjectExtension(t,"KHR_materials_unlit",{}),e.addExtension("KHR_materials_unlit"))}}),Object.freeze({__proto__:null,name:"KHR_techniques_webgl",decode:async function(t){const e=new Ba(t),{json:r}=e,n=e.getExtension("KHR_techniques_webgl");if(n){const t=function(t,e){const{programs:r=[],shaders:n=[],techniques:s=[]}=t,i=new TextDecoder;return n.forEach((t=>{if(!Number.isFinite(t.bufferView))throw new Error("KHR_techniques_webgl: no shader code");t.code=i.decode(e.getTypedArrayForBufferView(t.bufferView))})),r.forEach((t=>{t.fragmentShader=n[t.fragmentShader],t.vertexShader=n[t.vertexShader]})),s.forEach((t=>{t.program=r[t.program]})),s}(n,e);for(const n of r.materials||[]){const r=e.getObjectExtension(n,"KHR_techniques_webgl");r&&(n.technique=Object.assign({},r,t[r.technique]),n.technique.values=La(n.technique,e)),e.removeObjectExtension(n,"KHR_techniques_webgl")}e.removeExtension("KHR_techniques_webgl")}},encode:async function(t,e){}})];function Ha(t,e){var r;const n=(null==e||null===(r=e.gltf)||void 0===r?void 0:r.excludeExtensions)||{};return!(t in n&&!n[t])}const Ja={accessors:"accessor",animations:"animation",buffers:"buffer",bufferViews:"bufferView",images:"image",materials:"material",meshes:"mesh",nodes:"node",samplers:"sampler",scenes:"scene",skins:"skin",textures:"texture"},Pa={accessor:"accessors",animations:"animation",buffer:"buffers",bufferView:"bufferViews",image:"images",material:"materials",mesh:"meshes",node:"nodes",sampler:"samplers",scene:"scenes",skin:"skins",texture:"textures"};class ja{constructor(){H(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}}),H(this,"json",void 0)}normalize(t,e){this.json=t.json;const r=t.json;switch(r.asset&&r.asset.version){case"2.0":return;case void 0:case"1.0":break;default:return void console.warn("glTF: Unknown version ".concat(r.asset.version))}if(!e.normalize)throw new Error("glTF v1 is not supported.");console.warn("Converting glTF v1 to glTF v2 format. This is experimental and may fail."),this._addAsset(r),this._convertTopLevelObjectsToArrays(r),function(t){const e=new Ba(t),{json:r}=e;for(const t of r.images||[]){const r=e.getObjectExtension(t,"KHR_binary_glTF");r&&Object.assign(t,r),e.removeObjectExtension(t,"KHR_binary_glTF")}r.buffers&&r.buffers[0]&&delete r.buffers[0].uri,e.removeExtension("KHR_binary_glTF")}(t),this._convertObjectIdsToArrayIndices(r),this._updateObjects(r),this._updateMaterial(r)}_addAsset(t){t.asset=t.asset||{},t.asset.version="2.0",t.asset.generator=t.asset.generator||"Normalized to glTF 2.0 by loaders.gl"}_convertTopLevelObjectsToArrays(t){for(const e in Ja)this._convertTopLevelObjectToArray(t,e)}_convertTopLevelObjectToArray(t,e){const r=t[e];if(r&&!Array.isArray(r)){t[e]=[];for(const n in r){const s=r[n];s.id=s.id||n;const i=t[e].length;t[e].push(s),this.idToIndexMap[e][n]=i}}}_convertObjectIdsToArrayIndices(t){for(const e in Ja)this._convertIdsToIndices(t,e);"scene"in t&&(t.scene=this._convertIdToIndex(t.scene,"scene"));for(const e of t.textures)this._convertTextureIds(e);for(const e of t.meshes)this._convertMeshIds(e);for(const e of t.nodes)this._convertNodeIds(e);for(const e of t.scenes)this._convertSceneIds(e)}_convertTextureIds(t){t.source&&(t.source=this._convertIdToIndex(t.source,"image"))}_convertMeshIds(t){for(const e of t.primitives){const{attributes:t,indices:r,material:n}=e;for(const e in t)t[e]=this._convertIdToIndex(t[e],"accessor");r&&(e.indices=this._convertIdToIndex(r,"accessor")),n&&(e.material=this._convertIdToIndex(n,"material"))}}_convertNodeIds(t){t.children&&(t.children=t.children.map((t=>this._convertIdToIndex(t,"node")))),t.meshes&&(t.meshes=t.meshes.map((t=>this._convertIdToIndex(t,"mesh"))))}_convertSceneIds(t){t.nodes&&(t.nodes=t.nodes.map((t=>this._convertIdToIndex(t,"node"))))}_convertIdsToIndices(t,e){t[e]||(console.warn("gltf v1: json doesn't contain attribute ".concat(e)),t[e]=[]);for(const r of t[e])for(const t in r){const e=r[t],n=this._convertIdToIndex(e,t);r[t]=n}}_convertIdToIndex(t,e){const r=Pa[e];if(r in this.idToIndexMap){const n=this.idToIndexMap[r][t];if(!Number.isFinite(n))throw new Error("gltf v1: failed to resolve ".concat(e," with id ").concat(t));return n}return t}_updateObjects(t){for(const t of this.json.buffers)delete t.type}_updateMaterial(t){for(const e of t.materials){e.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};const r=e.values&&e.values.tex,n=t.textures.findIndex((t=>t.id===r));-1!==n&&(e.pbrMetallicRoughness.baseColorTexture={index:n})}}}const ka={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ka={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4},Va=10240,Qa=10241,qa=10242,za=10243,Wa=10497,Ya={magFilter:Va,minFilter:Qa,wrapS:qa,wrapT:za},Xa={[Va]:9729,[Qa]:9986,[qa]:Wa,[za]:Wa};class Za{constructor(){H(this,"baseUri",""),H(this,"json",{}),H(this,"buffers",[]),H(this,"images",[])}postProcess(t,e={}){const{json:r,buffers:n=[],images:s=[],baseUri:i=""}=t;return ia(r),this.baseUri=i,this.json=r,this.buffers=n,this.images=s,this._resolveTree(this.json,e),this.json}_resolveTree(t,e={}){t.bufferViews&&(t.bufferViews=t.bufferViews.map(((t,e)=>this._resolveBufferView(t,e)))),t.images&&(t.images=t.images.map(((t,e)=>this._resolveImage(t,e)))),t.samplers&&(t.samplers=t.samplers.map(((t,e)=>this._resolveSampler(t,e)))),t.textures&&(t.textures=t.textures.map(((t,e)=>this._resolveTexture(t,e)))),t.accessors&&(t.accessors=t.accessors.map(((t,e)=>this._resolveAccessor(t,e)))),t.materials&&(t.materials=t.materials.map(((t,e)=>this._resolveMaterial(t,e)))),t.meshes&&(t.meshes=t.meshes.map(((t,e)=>this._resolveMesh(t,e)))),t.nodes&&(t.nodes=t.nodes.map(((t,e)=>this._resolveNode(t,e)))),t.skins&&(t.skins=t.skins.map(((t,e)=>this._resolveSkin(t,e)))),t.scenes&&(t.scenes=t.scenes.map(((t,e)=>this._resolveScene(t,e)))),void 0!==t.scene&&(t.scene=t.scenes[this.json.scene])}getScene(t){return this._get("scenes",t)}getNode(t){return this._get("nodes",t)}getSkin(t){return this._get("skins",t)}getMesh(t){return this._get("meshes",t)}getMaterial(t){return this._get("materials",t)}getAccessor(t){return this._get("accessors",t)}getCamera(t){return null}getTexture(t){return this._get("textures",t)}getSampler(t){return this._get("samplers",t)}getImage(t){return this._get("images",t)}getBufferView(t){return this._get("bufferViews",t)}getBuffer(t){return this._get("buffers",t)}_get(t,e){if("object"==typeof e)return e;const r=this.json[t]&&this.json[t][e];return r||console.warn("glTF file error: Could not find ".concat(t,"[").concat(e,"]")),r}_resolveScene(t,e){return t.id=t.id||"scene-".concat(e),t.nodes=(t.nodes||[]).map((t=>this.getNode(t))),t}_resolveNode(t,e){return t.id=t.id||"node-".concat(e),t.children&&(t.children=t.children.map((t=>this.getNode(t)))),void 0!==t.mesh?t.mesh=this.getMesh(t.mesh):void 0!==t.meshes&&t.meshes.length&&(t.mesh=t.meshes.reduce(((t,e)=>{const r=this.getMesh(e);return t.id=r.id,t.primitives=t.primitives.concat(r.primitives),t}),{primitives:[]})),void 0!==t.camera&&(t.camera=this.getCamera(t.camera)),void 0!==t.skin&&(t.skin=this.getSkin(t.skin)),t}_resolveSkin(t,e){return t.id=t.id||"skin-".concat(e),t.inverseBindMatrices=this.getAccessor(t.inverseBindMatrices),t}_resolveMesh(t,e){return t.id=t.id||"mesh-".concat(e),t.primitives&&(t.primitives=t.primitives.map((t=>{const e=(t={...t}).attributes;t.attributes={};for(const r in e)t.attributes[r]=this.getAccessor(e[r]);return void 0!==t.indices&&(t.indices=this.getAccessor(t.indices)),void 0!==t.material&&(t.material=this.getMaterial(t.material)),t}))),t}_resolveMaterial(t,e){if(t.id=t.id||"material-".concat(e),t.normalTexture&&(t.normalTexture={...t.normalTexture},t.normalTexture.texture=this.getTexture(t.normalTexture.index)),t.occlusionTexture&&(t.occlustionTexture={...t.occlustionTexture},t.occlusionTexture.texture=this.getTexture(t.occlusionTexture.index)),t.emissiveTexture&&(t.emmisiveTexture={...t.emmisiveTexture},t.emissiveTexture.texture=this.getTexture(t.emissiveTexture.index)),t.emissiveFactor||(t.emissiveFactor=t.emmisiveTexture?[1,1,1]:[0,0,0]),t.pbrMetallicRoughness){t.pbrMetallicRoughness={...t.pbrMetallicRoughness};const e=t.pbrMetallicRoughness;e.baseColorTexture&&(e.baseColorTexture={...e.baseColorTexture},e.baseColorTexture.texture=this.getTexture(e.baseColorTexture.index)),e.metallicRoughnessTexture&&(e.metallicRoughnessTexture={...e.metallicRoughnessTexture},e.metallicRoughnessTexture.texture=this.getTexture(e.metallicRoughnessTexture.index))}return t}_resolveAccessor(t,e){var r,n;if(t.id=t.id||"accessor-".concat(e),void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView)),t.bytesPerComponent=(r=t.componentType,Ka[r]),t.components=(n=t.type,ka[n]),t.bytesPerElement=t.bytesPerComponent*t.components,t.bufferView){const e=t.bufferView.buffer,{ArrayType:r,byteLength:n}=ma(t,t.bufferView),s=(t.bufferView.byteOffset||0)+(t.byteOffset||0)+e.byteOffset;let i=e.arrayBuffer.slice(s,s+n);t.bufferView.byteStride&&(i=this._getValueFromInterleavedBuffer(e,s,t.bufferView.byteStride,t.bytesPerElement,t.count)),t.value=new r(i)}return t}_getValueFromInterleavedBuffer(t,e,r,n,s){const i=new Uint8Array(s*n);for(let o=0;o<s;o++){const s=e+o*r;i.set(new Uint8Array(t.arrayBuffer.slice(s,s+n)),o*n)}return i.buffer}_resolveTexture(t,e){return t.id=t.id||"texture-".concat(e),t.sampler="sampler"in t?this.getSampler(t.sampler):Xa,t.source=this.getImage(t.source),t}_resolveSampler(t,e){t.id=t.id||"sampler-".concat(e),t.parameters={};for(const e in t){const r=this._enumSamplerParameter(e);void 0!==r&&(t.parameters[r]=t[e])}return t}_enumSamplerParameter(t){return Ya[t]}_resolveImage(t,e){t.id=t.id||"image-".concat(e),void 0!==t.bufferView&&(t.bufferView=this.getBufferView(t.bufferView));const r=this.images[e];return r&&(t.image=r),t}_resolveBufferView(t,e){const r=t.buffer,n={id:"bufferView-".concat(e),...t,buffer:this.buffers[r]},s=this.buffers[r].arrayBuffer;let i=this.buffers[r].byteOffset||0;return"byteOffset"in t&&(i+=t.byteOffset),n.data=new Uint8Array(s,i,t.byteLength),n}_resolveCamera(t,e){return t.id=t.id||"camera-".concat(e),t.perspective,t.orthographic,t}}const $a=1735152710,tc=!0;function ec(t,e,r=0,n={}){const s=new DataView(e),i=function(t,e=0){return"".concat(String.fromCharCode(t.getUint8(e+0))).concat(String.fromCharCode(t.getUint8(e+1))).concat(String.fromCharCode(t.getUint8(e+2))).concat(String.fromCharCode(t.getUint8(e+3)))}(s,r+0),o=s.getUint32(r+4,tc),a=s.getUint32(r+8,tc);switch(Object.assign(t,{header:{byteOffset:r,byteLength:a,hasBinChunk:!1},type:i,version:o,json:{},binChunks:[]}),r+=12,t.version){case 1:return function(t,e,r){F(t.header.byteLength>20);const n=e.getUint32(r+0,tc),s=e.getUint32(r+4,tc);return r+=8,F(0===s),rc(t,e,r,n),r+=n,r+=nc(t,e,r,t.header.byteLength)}(t,s,r);case 2:return function(t,e,r,n){return F(t.header.byteLength>20),function(t,e,r,n){for(;r+8<=t.header.byteLength;){const s=e.getUint32(r+0,tc),i=e.getUint32(r+4,tc);switch(r+=8,i){case 1313821514:rc(t,e,r,s);break;case 5130562:nc(t,e,r,s);break;case 0:n.strict||rc(t,e,r,s);break;case 1:n.strict||nc(t,e,r,s)}r+=ct(s,4)}}(t,e,r,n),r+t.header.byteLength}(t,s,r,{});default:throw new Error("Invalid GLB version ".concat(t.version,". Only supports v1 and v2."))}}function rc(t,e,r,n){const s=new Uint8Array(e.buffer,r,n),i=new TextDecoder("utf8").decode(s);return t.json=JSON.parse(i),ct(n,4)}function nc(t,e,r,n){return t.header.hasBinChunk=!0,t.binChunks.push({byteOffset:r,byteLength:n,arrayBuffer:e.buffer}),ct(n,4)}async function sc(t,e,r=0,n,s){var i,o,a,c;!function(t,e,r,n){n.uri&&(t.baseUri=n.uri);if(e instanceof ArrayBuffer&&!function(t,e=0,r={}){const n=new DataView(t),{magic:s=$a}=r,i=n.getUint32(e,!1);return i===s||i===$a}(e,r,n)){e=(new TextDecoder).decode(e)}if("string"==typeof e)t.json=st(e);else if(e instanceof ArrayBuffer){const s={};r=ec(s,e,r,n.glb),ia("glTF"===s.type,"Invalid GLB magic string ".concat(s.type)),t._glb=s,t.json=s.json}else ia(!1,"GLTF: must be ArrayBuffer or string");const s=t.json.buffers||[];if(t.buffers=new Array(s.length).fill(null),t._glb&&t._glb.header.hasBinChunk){const{binChunks:e}=t._glb;t.buffers[0]={arrayBuffer:e[0].arrayBuffer,byteOffset:e[0].byteOffset,byteLength:e[0].byteLength}}const i=t.json.images||[];t.images=new Array(i.length).fill({})}(t,e,r,n),function(t,e={}){(new ja).normalize(t,e)}(t,{normalize:null==n||null===(i=n.gltf)||void 0===i?void 0:i.normalize}),function(t,e={},r){const n=Na.filter((t=>Ha(t.name,e)));for(const i of n){var s;null===(s=i.preprocess)||void 0===s||s.call(i,t,e,r)}}(t,n,s);const u=[];if(null!=n&&null!==(o=n.gltf)&&void 0!==o&&o.loadBuffers&&t.json.buffers&&await async function(t,e,r){const n=t.json.buffers||[];for(let o=0;o<n.length;++o){const a=n[o];if(a.uri){var s,i;const{fetch:n}=r;ia(n);const c=oa(a.uri,e),u=await(null==r||null===(s=r.fetch)||void 0===s?void 0:s.call(r,c)),l=await(null==u||null===(i=u.arrayBuffer)||void 0===i?void 0:i.call(u));t.buffers[o]={arrayBuffer:l,byteOffset:0,byteLength:l.byteLength},delete a.uri}}}(t,n,s),null!=n&&null!==(a=n.gltf)&&void 0!==a&&a.loadImages){const e=async function(t,e,r){const n=function(t){const e=new Set,r=t.json.textures||[];for(const t of r)void 0!==t.source&&e.add(t.source);return Array.from(e).sort()}(t),s=t.json.images||[],i=[];for(const o of n)i.push(ic(t,s[o],o,e,r));return await Promise.all(i)}(t,n,s);u.push(e)}const l=async function(t,e={},r){const n=Na.filter((t=>Ha(t.name,e)));for(const i of n){var s;await(null===(s=i.decode)||void 0===s?void 0:s.call(i,t,e,r))}}(t,n,s);return u.push(l),await Promise.all(u),null!=n&&null!==(c=n.gltf)&&void 0!==c&&c.postProcess?function(t,e){return(new Za).postProcess(t,e)}(t,n):t}async function ic(t,e,r,n,s){const{fetch:i,parse:o}=s;let a;if(e.uri){const t=oa(e.uri,n),r=await i(t);a=await r.arrayBuffer()}if(Number.isFinite(e.bufferView)){const r=function(t,e,r){const n=t.bufferViews[r];ia(n);const s=e[n.buffer];ia(s);const i=(n.byteOffset||0)+s.byteOffset;return new Uint8Array(s.arrayBuffer,i,n.byteLength)}(t.json,t.buffers,e.bufferView);a=at(r.buffer,r.byteOffset,r.byteLength)}ia(a,"glTF image has no data");let c=await o(a,[ea,No],{mimeType:e.mimeType,basis:n.basis||{format:Lo()}},s);c&&c[0]&&(c={compressed:!0,mipmaps:!1,width:c[0].width,height:c[0].height,data:c}),t.images=t.images||[],t.images[r]=c}const oc={name:"glTF",id:"gltf",module:"gltf",version:"3.1.4",extensions:["gltf","glb"],mimeTypes:["model/gltf+json","model/gltf-binary"],text:!0,binary:!0,tests:["glTF"],parse:async function(t,e={},r){(e={...oc.options,...e}).gltf={...oc.options.gltf,...e.gltf};const{byteOffset:n=0}=e;return await sc({},t,n,e,r)},options:{gltf:{normalize:!0,loadBuffers:!0,loadImages:!0,decompressMeshes:!0,postProcess:!0},log:console},deprecatedOptions:{fetchImages:"gltf.loadImages",createImages:"gltf.loadImages",decompress:"gltf.decompressMeshes",postProcess:"gltf.postProcess",gltf:{decompress:"gltf.decompressMeshes"}}};const ac=0,cc=1;function uc(t,e,r,n){t.rotateYtoZ=!0;const s=t.byteOffset+t.byteLength-r;if(0===s)throw new Error("glTF byte length must be greater than 0.");return t.gltfUpAxis=n["3d-tiles"]&&n["3d-tiles"].assetGltfUpAxis?n["3d-tiles"].assetGltfUpAxis:"Y",t.gltfArrayBuffer=at(e,r,s),t.gltfByteOffset=0,t.gltfByteLength=s,r%4==0||console.warn("".concat(t.type,": embedded glb is not aligned to a 4-byte boundary.")),t.byteOffset+t.byteLength}async function lc(t,e,r,n){const s=r["3d-tiles"]||{};if(function(t,e,r){switch(e){case ac:const e=new Uint8Array(t.gltfArrayBuffer,t.gltfByteOffset),r=(new TextDecoder).decode(e);t.gltfUrl=r.replace(/[\s\0]+$/,""),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength;break;case cc:break;default:throw new Error("b3dm: Illegal glTF format field")}}(t,e),s.loadGLTF){const{parse:e,fetch:s}=n;t.gltfUrl&&(t.gltfArrayBuffer=await s(t.gltfUrl,r),t.gltfByteOffset=0),t.gltfArrayBuffer&&(t.gltf=await e(t.gltfArrayBuffer,oc,r,n),delete t.gltfArrayBuffer,delete t.gltfByteOffset,delete t.gltfByteLength)}}async function hc(t,e,r,n,s){var i;r=function(t,e,r,n,s){r=Xi(t,e,r),r=Zi(t,e,r),r=$i(t,e,r),r=uc(t,e,r,n);const i=new Hi(t.featureTableJson,t.featureTableBinary);return t.rtcCenter=i.getGlobalProperty("RTC_CENTER",Gi.FLOAT,3),r}(t,e,r,n),await lc(t,cc,n,s);const o=null==t||null===(i=t.gltf)||void 0===i?void 0:i.extensions;return o&&o.CESIUM_RTC&&(t.rtcCenter=o.CESIUM_RTC.center),r}async function dc(t,e,r,n,s){return r=function(t,e,r,n,s){if(r=Xi(t,e,r),1!==t.version)throw new Error("Instanced 3D Model version ".concat(t.version," is not supported"));r=Zi(t,e,r);const i=new DataView(e);if(t.gltfFormat=i.getUint32(r,!0),r=$i(t,e,r+=4),r=uc(t,e,r,n),0===t.featureTableJsonByteLength)throw new Error("i3dm parser: featureTableJsonByteLength is zero.");const o=new Hi(t.featureTableJson,t.featureTableBinary),a=o.getGlobalProperty("INSTANCES_LENGTH");if(o.featuresLength=a,!Number.isFinite(a))throw new Error("i3dm parser: INSTANCES_LENGTH must be defined");t.eastNorthUp=o.getGlobalProperty("EAST_NORTH_UP"),t.rtcCenter=o.getGlobalProperty("RTC_CENTER",Gi.FLOAT,3);new Yi(t.batchTableJson,t.batchTableBinary,a);return function(t,e,r,n){const s=[new Array(n),t._batchTable][0],i=new cr;new cr,new cr,new cr;const o=new pr,a=new Pr,c=new cr,u={},l=new Tr,h=[],d=[],f=new cr,A=new cr;for(let r=0;r<n;r++){let n;if(e.hasProperty("POSITION"))n=e.getProperty("POSITION",Gi.FLOAT,3,r,i);else if(e.hasProperty("POSITION_QUANTIZED")){n=e.getProperty("POSITION_QUANTIZED",Gi.UNSIGNED_SHORT,3,r,i);const t=e.getGlobalProperty("QUANTIZED_VOLUME_OFFSET",Gi.FLOAT,3,f);if(!t)throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");const s=e.getGlobalProperty("QUANTIZED_VOLUME_SCALE",Gi.FLOAT,3,A);if(!s)throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");const o=65535;for(let e=0;e<3;e++)n[e]=n[e]/o*s[e]+t[e]}if(!n)throw new Error("i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.");if(i.copy(n),u.translation=i,t.normalUp=e.getProperty("NORMAL_UP",Gi.FLOAT,3,r,h),t.normalRight=e.getProperty("NORMAL_RIGHT",Gi.FLOAT,3,r,d),t.normalUp){if(!t.normalRight)throw new Error("i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.");t.hasCustomOrientation=!0}else{if(t.octNormalUp=e.getProperty("NORMAL_UP_OCT32P",Gi.UNSIGNED_SHORT,2,h),t.octNormalRight=e.getProperty("NORMAL_RIGHT_OCT32P",Gi.UNSIGNED_SHORT,2,d),t.octNormalUp){if(!t.octNormalRight)throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");throw new Error("i3dm: oct-encoded orientation not implemented")}t.eastNorthUp?(An.WGS84.eastNorthUpToFixedFrame(i,l),l.getRotationMatrix3(o)):o.identity()}a.fromMatrix3(o),u.rotation=a,c.set(1,1,1);const m=e.getProperty("SCALE",Gi.FLOAT,1,r);Number.isFinite(m)&&c.multiplyByScalar(m);const p=e.getProperty("SCALE_NON_UNIFORM",Gi.FLOAT,3,r,h);p&&c.scale(p),u.scale=c;let B=e.getProperty("BATCH_ID",Gi.UNSIGNED_SHORT,1,r);void 0===B&&(B=r);const g=(new Tr).fromQuaternion(u.rotation);l.identity(),l.translate(u.translation),l.multiplyRight(g),l.scale(u.scale);const y=l.clone();s[r]={modelMatrix:y,batchId:B}}t.instances=s}(t,o,0,a),r}(t,e,r,n),await lc(t,t.gltfFormat,n,s),r}async function fc(t,e=0,r,n,s={}){switch(s.byteOffset=e,s.type=function(t,e=0){const r=new DataView(t);return"".concat(String.fromCharCode(r.getUint8(e+0))).concat(String.fromCharCode(r.getUint8(e+1))).concat(String.fromCharCode(r.getUint8(e+2))).concat(String.fromCharCode(r.getUint8(e+3)))}(t,e),s.type){case Ks:return await async function(t,e,r,n,s,i){r=Xi(t,e,r);const o=new DataView(e);for(t.tilesLength=o.getUint32(r,!0),r+=4,t.tiles=[];t.tiles.length<t.tilesLength&&t.byteLength-r>12;){const o={};t.tiles.push(o),r=await i(e,r,n,s,o)}return r}(s,t,e,r,n,fc);case Qs:return await hc(s,t,e,r,n);case zs:return await async function(t,e,r,n){t.rotateYtoZ=!0,t.gltfUpAxis=r["3d-tiles"]&&r["3d-tiles"].assetGltfUpAxis?r["3d-tiles"].assetGltfUpAxis:"Y";const{parse:s}=n;t.gltf=await s(e,oc,r,n)}(s,t,r,n);case qs:return await dc(s,t,e,r,n);case Vs:return await no(s,t,e,r,n);default:throw new Error("3DTileLoader: unknown type ".concat(s.type))}}async function Ac(t,e,r){const n=t[e].bufferView,s=t.bufferViews[n],i=t.buffers[s.buffer];if(i.uri){const t=await Rt(i.uri),e=await t.arrayBuffer();return new Uint8Array(e,s.byteOffset,s.byteLength)}return new Uint8Array(r,s.byteOffset,s.byteLength)}function mc(t){const e=new DataView(t);return e.getUint32(0,!0)+2**32*e.getUint32(4,!0)}const pc={id:"3d-tiles-subtree",name:"3D Tiles Subtree",module:"3d-tiles",version:"3.1.4",extensions:["subtree"],mimeTypes:["application/octet-stream"],tests:["subtree"],parse:async function(t){if(1952609651!==new Uint32Array(t.slice(0,4))[0])throw new Error("Wrong subtree file magic number");if(1!==new Uint32Array(t.slice(4,8))[0])throw new Error("Wrong subtree file verson, must be 1");const e=mc(t.slice(8,16)),r=new Uint8Array(t,24,e),n=new TextDecoder("utf8").decode(r),s=JSON.parse(n),i=mc(t.slice(16,24));let o=new ArrayBuffer(0);return i&&(o=t.slice(24+e)),"bufferView"in s.tileAvailability&&(s.tileAvailability.explicitBitstream=await Ac(s,"tileAvailability",o)),"bufferView"in s.contentAvailability&&(s.contentAvailability.explicitBitstream=await Ac(s,"contentAvailability",o)),"bufferView"in s.childSubtreeAvailability&&(s.childSubtreeAvailability.explicitBitstream=await Ac(s,"childSubtreeAvailability",o)),s},options:{}},Bc={QUADTREE:4,OCTREE:8};async function gc(t,e,r={mortonIndex:0,x:0,y:0,z:0},n=0,s=0,i={level:0,mortonIndex:0,x:0,y:0,z:0}){const{subdivisionScheme:o,subtreeLevels:a,maximumLevel:c,contentUrlTemplate:u,subtreesUriTemplate:l,basePath:h}=e,d={children:[],lodMetricValue:0,contentUrl:""},f=Bc[o],A=1&n,m=n>>1&1,p=n>>2&1,B=(f**s-1)/(f-1);let g=bc(r.mortonIndex,n),y=B+g,C=bc(r.x,A),b=bc(r.y,m),w=bc(r.z,p),T=!1;s+1>a&&(T=yc(t.childSubtreeAvailability,g));const E=bc(i.x,C),_=bc(i.y,b),M=bc(i.z,w),v=s+i.level;if(T){const e=wc("".concat(h,"/").concat(l),v,E,_,M);t=await ve(e,pc),i.mortonIndex=g,i.x=C,i.y=b,i.z=w,i.level=s,g=0,y=0,C=0,b=0,w=0,s=0}if(!yc(t.tileAvailability,y)||s>c)return d;yc(t.contentAvailability,y)&&(d.contentUrl=wc(u,v,E,_,M));const I=s+1,F={mortonIndex:g,x:C,y:b,z:w};for(let r=0;r<f;r++){const n=await gc(t,e,F,r,I,i);if(n.contentUrl||n.children.length){const t=Cc(n,v+1,{childTileX:C,childTileY:b,childTileZ:w},e);d.children.push(t)}}return d}function yc(t,e){return"constant"in t?Boolean(t.constant):!!t.explicitBitstream&&function(t,e){const r=Math.floor(t/8),n=t%8;return 1==(e[r]>>n&1)}(e,t.explicitBitstream)}function Cc(t,e,r,n){const{basePath:s,refine:i,getRefine:o,lodMetricType:a,getTileType:c,rootLodMetricValue:u,rootBoundingVolume:l}=n,h=t.contentUrl&&t.contentUrl.replace("".concat(s,"/"),""),d=u/2**e,f=function(t,e,r){if(e.region){const{childTileX:n,childTileY:s,childTileZ:i}=r,[o,a,c,u,l,h]=e.region,d=2**t,f=(c-o)/d,A=(u-a)/d,m=(h-l)/d,[p,B]=[o+f*n,o+f*(n+1)],[g,y]=[a+A*s,a+A*(s+1)],[C,b]=[l+m*i,l+m*(i+1)];return{region:[p,g,B,y,C,b]}}return console.warn("Unsupported bounding volume type: ",e),null}(e,l,r);return{children:t.children,contentUrl:t.contentUrl,content:{uri:h},id:t.contentUrl,refine:o(i),type:c(t),lodMetricType:a,lodMetricValue:d,boundingVolume:f}}function bc(t,e){return parseInt(t.toString(2)+e.toString(2),2)}function wc(t,e,r,n,s){const i=function(t){const e={};for(const r in t)e["{".concat(r,"}")]=t[r];return e}({level:e,x:r,y:n,z:s});return t.replace(/{level}|{x}|{y}|{z}/gi,(t=>i[t]))}function Tc(t){if(!t.contentUrl)return ms;const e=t.contentUrl.split(".").pop();switch(e){case"pnts":return Bs;case"i3dm":case"b3dm":case"glb":case"gltf":return ps;default:return e}}function Ec(t){switch(t){case"REPLACE":case"replace":return As;case"ADD":case"add":return fs;default:return t}}function _c(t,e){if(!t)return null;if(t.content){const r=t.content.uri||t.content.url;t.contentUrl="".concat(e.basePath,"/").concat(r)}return t.id=t.contentUrl,t.lodMetricType=bs,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,t.type=Tc(t),t.refine=Ec(t.refine),t}async function Mc(t){if(!t.root)return null;const e=t.basePath,r=t.root.extensions["3DTILES_implicit_tiling"],{subdivisionScheme:n,maximumLevel:s,subtreeLevels:i,subtrees:{uri:o}}=r,a=wc(o,0,0,0,0),c="".concat(e,"/").concat(a),u=await ve(c,pc),l="".concat(e,"/").concat(t.root.content.uri),h=t.root.refine,d=t.root.geometricError,f=t.root.boundingVolume,A={contentUrlTemplate:l,subtreesUriTemplate:o,subdivisionScheme:n,subtreeLevels:i,maximumLevel:s,refine:h,basePath:e,lodMetricType:bs,rootLodMetricValue:d,rootBoundingVolume:f,getTileType:Tc,getRefine:Ec};return await async function(t,e,r){if(!t)return null;t.lodMetricType=bs,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform;const{children:n,contentUrl:s}=await gc(e,r);s&&(t.contentUrl=s,t.content={uri:s.replace("".concat(r.basePath,"/"),"")});return t.refine=Ec(t.refine),t.type=Tc(t),t.children=n,t.id=t.contentUrl,t}(t.root,u,A)}const vc={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.1.4",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:async function(t,e,r){const n=e["3d-tiles"]||{};let s;s="auto"===n.isTileset?r.url&&-1!==r.url.indexOf(".json"):n.isTileset;t=s?await async function(t,e,r){var n;const s=JSON.parse((new TextDecoder).decode(t));return s.loader=e.loader||vc,s.url=r.url,s.basePath=function(t){return Bt(t.url)}(s),s.root=function(t){var e,r;return(null==t||null===(e=t.extensionsRequired)||void 0===e?void 0:e.includes("3DTILES_implicit_tiling"))&&(null==t||null===(r=t.extensionsUsed)||void 0===r?void 0:r.includes("3DTILES_implicit_tiling"))}(s)?await Mc(s):function(t){const e=t.basePath,r=_c(t.root,t),n=[];for(n.push(r);n.length>0;){const t=(n.pop()||{}).children||[];for(const r of t)_c(r,{basePath:e}),n.push(r)}return r}(s),s.type=Cs,s.lodMetricType=bs,s.lodMetricValue=(null===(n=s.root)||void 0===n?void 0:n.lodMetricValue)||0,s}(t,e,r):await async function(t,e,r){const n={content:{featureIds:null}},s=0;return await fc(t,s,e,r,n.content),n.content}(t,e,r);return t},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};const Ic="https://api.cesium.com/v1/assets";async function Fc(t,e){if(!e){const r=await async function(t){F(t);const e=Ic,r={Authorization:"Bearer ".concat(t)},n=await Rt(e,{fetch:{headers:r}});if(!n.ok)throw new Error(n.statusText);return await n.json()}(t);for(const t of r.items)"3DTILES"===t.type&&(e=t.id)}const r=await async function(t,e){F(t,e);const r={Authorization:"Bearer ".concat(t)},n="".concat(Ic,"/").concat(e);let s=await Rt("".concat(n),{fetch:{headers:r}});if(!s.ok)throw new Error(s.statusText);let i=await s.json();if(s=await Rt("".concat(n,"/endpoint"),{fetch:{headers:r}}),!s.ok)throw new Error(s.statusText);const o=await s.json();return i={...i,...o},i}(t,e),{type:n,url:s}=r;return F("3DTILES"===n&&s),r.headers={Authorization:"Bearer ".concat(r.accessToken)},r}const Dc={...vc,id:"cesium-ion",name:"Cesium Ion",preload:async function(t,e={}){e=e["cesium-ion"]||{};const{accessToken:r}=e;let n=e.assetId;if(!Number.isFinite(n)){const e=t.match(/\/([0-9]+)\/tileset.json/);n=e&&e[1]}return Fc(r,n)},parse:async(t,e,r)=>((e={...e})["3d-tiles"]=e["cesium-ion"],e.loader=Dc,vc.parse(t,e,r)),options:{"cesium-ion":{...vc.options["3d-tiles"],accessToken:null}}};function Gc(n){const s=64,i=document.createElement("canvas");i.width=s,i.height=s;const o=i.getContext("2d");o.rect(0,0,s,s);const a=o.createLinearGradient(0,0,s,s);for(let t=0;t<n.length;t++){const e=n[t];a.addColorStop(e[0],"#"+e[1].getHexString())}o.fillStyle=a,o.fill();const c=new t(i);return c.needsUpdate=!0,c.minFilter=e,c.wrapS=r,c.wrapT=r,c.repeat.set(2,2),c}function Rc(t){t.updateMatrix(),t.updateMatrixWorld(),t.matrixWorldInverse.copy(t.matrixWorld).invert();const e=new s;return e.setFromProjectionMatrix((new i).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse)),e}function Sc(t){const{boundingVolume:e}=t;let r=0;t.content&&(r=Math.min(t.content.byteLength/5e5,1));const n=new f(r,1,0),s=new A(1,1,1),o=new i;e.halfAxes?o.copy(Oc(e.halfAxes)):e.radius&&s.scale(2*e.radius,2*e.radius,2*e.radius),s.applyMatrix4(o);const a=new m(s),u=new p(a,new B({color:n}));return u.position.copy(new c(...e.center)),u}function Oc(t){const e=t;return(new i).fromArray([2*e[0],2*e[1],2*e[2],0,2*e[3],2*e[4],2*e[5],0,2*e[6],2*e[7],2*e[8],0,0,0,0,1])}const xc={SPECTRAL:[[0,new f(.3686,.3098,.6353)],[.1,new f(.1961,.5333,.7412)],[.2,new f(.4,.7608,.6471)],[.3,new f(.6706,.8667,.6431)],[.4,new f(.902,.9608,.5961)],[.5,new f(1,1,.749)],[.6,new f(.9961,.8784,.5451)],[.7,new f(.9922,.6824,.3804)],[.8,new f(.9569,.4275,.2627)],[.9,new f(.8353,.2431,.3098)],[1,new f(.6196,.0039,.2588)]],PLASMA:[[0,new f(.241,.015,.61)],[.1,new f(.387,.001,.654)],[.2,new f(.524,.025,.653)],[.3,new f(.651,.125,.596)],[.4,new f(.752,.227,.513)],[.5,new f(.837,.329,.431)],[.6,new f(.907,.435,.353)],[.7,new f(.963,.554,.272)],[.8,new f(.992,.681,.195)],[.9,new f(.987,.822,.144)],[1,new f(.94,.975,.131)]],YELLOW_GREEN:[[0,new f(.1647,.2824,.3451)],[.1,new f(.1338,.3555,.4227)],[.2,new f(.061,.4319,.4864)],[.3,new f(0,.5099,.5319)],[.4,new f(0,.5881,.5569)],[.5,new f(.137,.665,.5614)],[.6,new f(.2906,.7395,.5477)],[.7,new f(.4453,.8099,.5201)],[.8,new f(.6102,.8748,.485)],[.9,new f(.7883,.9323,.4514)],[1,new f(.9804,.9804,.4314)]],VIRIDIS:[[0,new f(.267,.005,.329)],[.1,new f(.283,.141,.458)],[.2,new f(.254,.265,.53)],[.3,new f(.207,.372,.553)],[.4,new f(.164,.471,.558)],[.5,new f(.128,.567,.551)],[.6,new f(.135,.659,.518)],[.7,new f(.267,.749,.441)],[.8,new f(.478,.821,.318)],[.9,new f(.741,.873,.15)],[1,new f(.993,.906,.144)]],INFERNO:[[0,new f(.077,.042,.206)],[.1,new f(.225,.036,.388)],[.2,new f(.373,.074,.432)],[.3,new f(.522,.128,.42)],[.4,new f(.665,.182,.37)],[.5,new f(.797,.255,.287)],[.6,new f(.902,.364,.184)],[.7,new f(.969,.516,.063)],[.8,new f(.988,.683,.072)],[.9,new f(.961,.859,.298)],[1,new f(.988,.998,.645)]],GRAYSCALE:[[0,new f(0,0,0)],[1,new f(1,1,1)]],TURBO:[[0,new f(.18995,.07176,.23217)],[.07,new f(.25107,.25237,.63374)],[.13,new f(.27628,.42118,.89123)],[.2,new f(.25862,.57958,.99876)],[.27,new f(.15844,.73551,.92305)],[.33,new f(.09267,.86554,.7623)],[.4,new f(.19659,.94901,.59466)],[.47,new f(.42778,.99419,.38575)],[.53,new f(.64362,.98999,.23356)],[.6,new f(.80473,.92452,.20459)],[.67,new f(.93301,.81236,.22667)],[.73,new f(.99314,.67408,.20348)],[.8,new f(.9836,.49291,.12849)],[.87,new f(.92105,.31489,.05475)],[.93,new f(.81608,.18462,.01809)],[1,new f(.66449,.08436,.00424)]],RAINBOW:[[0,new f(.278,0,.714)],[1/6,new f(0,0,1)],[2/6,new f(0,1,1)],[.5,new f(0,1,0)],[4/6,new f(1,1,0)],[5/6,new f(1,.64,0)],[1,new f(1,0,0)]],CONTOUR:[[0,new f(0,0,0)],[.03,new f(0,0,0)],[.04,new f(1,1,1)],[1,new f(1,1,1)]]};var Uc,Lc,Nc;!function(t){t[t.Intensity=1]="Intensity",t[t.Classification=2]="Classification",t[t.Elevation=3]="Elevation",t[t.RGB=4]="RGB",t[t.White=5]="White"}(Uc||(Uc={})),function(t){t[t.FlatTexture=1]="FlatTexture",t[t.ShadedTexture=2]="ShadedTexture",t[t.ShadedNoTexture=3]="ShadedNoTexture"}(Lc||(Lc={})),function(t){t[t.Reset=1]="Reset",t[t.Mercator=2]="Mercator",t[t.WGS84Cartesian=3]="WGS84Cartesian"}(Nc||(Nc={}));const Hc="undefined"!=typeof document?Gc(xc.RAINBOW):null,Jc="undefined"!=typeof document?Gc(xc.GRAYSCALE):null,Pc={throttleRequests:!0,maxRequests:64,updateInterval:.1,maxConcurrency:1,maximumScreenSpaceError:16,maximumMemoryUsage:32,viewDistanceScale:1,skipLevelOfDetail:!1,updateTransforms:!0,shading:Lc.FlatTexture,transparent:!1,pointCloudColoring:Uc.White,pointSize:1,worker:!0,wireframe:!1,debug:!1,basisTranscoderPath:null,dracoDecoderPath:null,material:null,computeNormals:!1,shaderCallback:null,geoTransform:Nc.Reset,preloadTilesCount:null};class jc{static load(t){return I(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},Pc),t.options),{url:r}=t,s=e.updateInterval,f={};if(e.cesiumIONToken){f["cesium-ion"]={accessToken:e.cesiumIONToken};const t=yield Dc.preload(r,f);f.fetch={headers:t.headers}}t.loadingManager&&t.loadingManager.itemStart(r);const A=yield ve(r,vc,Object.assign({},f)),m={},p={},B=[],F=new o,D=new o;e.debug||(D.visible=!1);const G={pointSize:{type:"f",value:e.pointSize},gradient:{type:"t",value:Hc},grayscale:{type:"t",value:Jc},rootCenter:{type:"vec3",value:new c},rootNormal:{type:"vec3",value:new c},coloring:{type:"i",value:e.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new n(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},R=new g({uniforms:G,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:e.transparent,vertexColors:!0});let S=null,O=null;const x=new _;let U,L;e.basisTranscoderPath&&(U=new v,U.detectSupport(t.renderer),U.setTranscoderPath(e.basisTranscoderPath+"/"),U.setWorkerLimit(1),x.setKTX2Loader(U)),e.dracoDecoderPath&&(L=new M,L.setDecoderPath(e.dracoDecoderPath+"/"),L.setWorkerLimit(e.maxConcurrency),x.setDRACOLoader(L));const N=new u({transparent:e.transparent}),H={maximumMemoryUsage:e.maximumMemoryUsage,maximumScreenSpaceError:e.maximumScreenSpaceError,viewDistanceScale:e.viewDistanceScale,skipLevelOfDetail:e.skipLevelOfDetail,updateTransforms:e.updateTransforms,throttleRequests:e.throttleRequests,maxRequests:e.maxRequests,contentLoader:t=>I(this,void 0,void 0,(function*(){let r=null;switch(t.type){case Bs:r=function(t,e,r,n){const s={rtc_center:t.content.rtcCenter,points:t.content.attributes.positions,intensities:t.content.attributes.intensity,classifications:t.content.attributes.classification,rgb:null,rgba:null},{colors:o}=t.content.attributes;o&&3===o.size&&(s.rgb=o.value);o&&4===o.size&&(s.rgba=o.value);const a=new C;a.setAttribute("position",new b(s.points,3));const c=(new i).fromArray(t.computedTransform).premultiply(n);s.rgba?a.setAttribute("color",new b(s.rgba,4)):s.rgb&&a.setAttribute("color",new w(s.rgb,3,!0));s.intensities&&a.setAttribute("intensity",new T(s.intensities,1,!0));s.classifications&&a.setAttribute("classification",new w(s.classifications,1,!1));const u=new E(a,r.material||e);if(s.rtc_center){const t=s.rtc_center;c.multiply((new i).makeTranslation(t[0],t[1],t[2]))}return u.applyMatrix4(c),u}(t,R,e,$);break;case ps:case gs:r=yield function(t,e,r,n,s){return I(this,void 0,void 0,(function*(){return new Promise(((o,a)=>{var u;const l=(new i).makeRotationAxis(new c(1,0,0),Math.PI/2),h="Z"!==(null===(u=e.tileset.asset)||void 0===u?void 0:u.gltfUpAxis),d=(new i).fromArray(e.computedTransform).premultiply(s);h&&d.multiply(l),t.parse(e.content.gltfArrayBuffer,e.contentUrl?e.contentUrl.substr(0,e.contentUrl.lastIndexOf("/")+1):"",(t=>{const e=t.scenes[0];e.applyMatrix4(d),e.traverse((t=>{if("Mesh"==t.type){const e=t,s=e.material,i=s.map;n.material?(e.material=n.material.clone(),s.dispose()):n.shading==Lc.FlatTexture&&(e.material=r.clone(),s.dispose()),n.shading!=Lc.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:i}:e.material.map=i:(i&&i.dispose(),e.material.map=null),n.shaderCallback&&(e.onBeforeRender=n.shaderCallback),e.material.wireframe=n.wireframe,n.computeNormals&&e.geometry.computeVertexNormals()}})),o(e)}),(t=>{a(new Error(`error parsing gltf in tile ${e.id}: ${t}`))}))}))}))}(x,t,N,e,$)}if(r&&(r.visible=!1,m[t.id]=r,F.add(m[t.id]),e.debug)){const e=Sc(t);D.add(e),p[t.id]=e}})),onTileLoad:t=>I(this,void 0,void 0,(function*(){J&&(!K&&(null==t?void 0:t.depth)<=5&&tt(t),J._frameNumber++,rt(J,m,O,S))})),onTileUnload:t=>{B.push(t)},onTileError:(t,e)=>{console.error("Tile error",t.id,e)}},J=new ks(A,Object.assign(Object.assign({},H),{loadOptions:Object.assign(Object.assign({},f),{maxConcurrency:e.maxConcurrency,worker:e.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})})),P=new i,j=new i,k=new c;let K=!1;if(J.root.boundingVolume?(J.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),e.geoTransform=Nc.WGS84Cartesian),j.setPosition(J.root.boundingVolume.center[0],J.root.boundingVolume.center[1],J.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),e.debug){const t=Sc(J.root);D.add(t),p[J.root.id]=t}let V=!1,Q=!1;G.rootCenter.value.copy(k),G.rootNormal.value.copy(new c(0,0,1).normalize()),J.stats.get("Loader concurrency").count=e.maxConcurrency,J.stats.get("Maximum SSE").count=e.maximumScreenSpaceError,J.stats.get("Maximum mem usage").count=e.maximumMemoryUsage;let q=0;const z=(new i).makeTranslation(1/0,1/0,1/0);let W=null;const Y=new c(1/0,1/0,1/0);let X=null;F.updateMatrixWorld(!0);const Z=(new i).copy(F.matrixWorld),$=(new i).copy(Z).invert();if(tt(J.root),et(),e.debug&&(p[J.root.id].applyMatrix4(P),D.matrixWorld.copy(F.matrixWorld)),e.geoTransform==Nc.Mercator){const t=function(t,e){const r=2*Math.PI*6378137/2,s=e*r/180;let i=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180);return i=i*r/180,new n(s,i)}(J.cartographicCenter[1],J.cartographicCenter[0]);k.set(t.x,0,-t.y),F.position.copy(k),F.rotation.set(-Math.PI/2,0,0),F.updateMatrixWorld(!0)}else e.geoTransform==Nc.WGS84Cartesian&&(F.applyMatrix4(j),F.updateMatrixWorld(!0),k.copy(F.position));function tt(t){if(!t.boundingVolume.halfAxes)return;const e=t.boundingVolume.halfAxes,r=(new i).extractRotation(Oc(e)).premultiply((new i).extractRotation($));if(!(new y).setFromRotationMatrix(r).equals(new y)){K=!0;const t=new c(j.elements[12],j.elements[13],j.elements[14]);j.extractRotation(r),j.setPosition(t),et()}}function et(){e.geoTransform!=Nc.WGS84Cartesian&&(P.copy(j).invert(),P.premultiply(Z),P.copy(Z).multiply((new i).copy(j).invert()),J.modelMatrix=new Tr(P.toArray()))}function rt(r,s,i,o){if(V)return;if(!X||o.aspect!=W){const t=new ts({fov:o.fov/180*Math.PI,aspectRatio:o.aspect,near:o.near,far:o.far});X=t.sseDenominator,W=o.aspect,e.debug&&console.log("Updated sse denonimator:",X)}const a=Rc(o).planes.map((t=>new jn(t.normal.toArray(),t.constant))),c=new Qn(a),u=new n;i.getSize(u);const l={camera:{position:Y.toArray()},height:u.y,frameNumber:r._frameNumber,sseDenominator:X,cullingVolume:c,viewport:{id:0}};r._cache.reset(),r._traverser.traverse(r.root,l,r.options);for(const t of r.tiles)t.selected?s[t.id]?s[t.id].visible=!0:console.error("TILE SELECTED BUT NOT LOADED!!",t.id):s[t.id]&&(s[t.id].visible=!1);for(;B.length>0;){const t=B.pop();s[t.id]&&t.contentState==cs&&(F.remove(s[t.id]),Kc(s[t.id]),delete s[t.id]),p[t.id]&&(Kc(p[t.id]),D.remove(p[t.id]),delete p[t.id])}const h=r.stats.get("Tiles Loaded").count,d=r.stats.get("Tiles Loading").count;return t.onProgress&&t.onProgress(h,h+d),t.loadingManager&&!Q&&0==d&&(null==e.preloadTilesCount||h>=e.preloadTilesCount)&&(Q=!0,t.loadingManager.itemEnd(t.url)),l}return{model:F,runtime:{getTileset:()=>J,getStats:()=>J.stats,showTiles:t=>{D.visible=t},setWireframe:t=>{e.wireframe=t,F.traverse((e=>{e instanceof h&&(e.material.wireframe=t)}))},setDebug:t=>{e.debug=t,D.visible=t},setShading:t=>{e.shading=t},getTileBoxes:()=>D,setViewDistanceScale:t=>{J.options.viewDistanceScale=t,J._frameNumber++,rt(J,m,O,S)},setHideGround:t=>{G.hideGround.value=t},setPointCloudColoring:t=>{G.coloring.value=t},setElevationRange:t=>{G.elevationRange.value.set(t[0],t[1])},setMaxIntensity:t=>{G.maxIntensity.value=t},setIntensityContrast:t=>{G.intensityContrast.value=t},setPointAlpha:t=>{G.alpha.value=t},getLatLongHeightFromPosition:t=>{const e=J.ellipsoid.cartesianToCartographic((new c).copy(t).applyMatrix4((new i).copy(P).invert()).toArray());return{lat:e[1],long:e[0],height:e[2]}},getPositionFromLatLongHeight:t=>{const e=J.ellipsoid.cartographicToCartesian([t.long,t.lat,t.height]);return new c(...e).applyMatrix4(P)},getCameraFrustum:t=>{const e=Rc(t).planes.map((t=>new jn(t.normal.toArray(),t.constant))).map((t=>function(t){const e=new o,r=new a(10,5),n=new c(...t.projectPointOntoPlane([0,0,0])),s=new c(t.normal.x,t.normal.y,t.normal.z),i=(new c).copy(n).add(s);r.lookAt(i),r.translate(n.x,n.y,n.z);const f=new u({color:65535,side:l}),A=new h(r,f),m=new d(s,n,5,16776960);return e.add(m),e.add(A),e}(t))),r=new o;for(const t of e)r.add(t);return r},update:function(t,r,n){if(S=n,O=r,q+=t,J&&q>=s){if(!Z.equals(F.matrixWorld)){Z.copy(F.matrixWorld),et();const t=(new c).setFromMatrixPosition(Z);G.rootCenter.value.copy(t),G.rootNormal.value.copy(new c(0,0,1).applyMatrix4(Z).normalize()),$.copy(Z).invert(),e.debug&&(p[J.root.id].matrixWorld.copy(P),p[J.root.id].applyMatrix4(Z))}!(n.matrixWorld.equals(z)&&n.aspect==W)&&(q=0,J._frameNumber++,n.getWorldPosition(Y),z.copy(n.matrixWorld),rt(J,m,r,n))}},dispose:function(){for(V=!0,J._destroy();F.children.length>0;){const t=F.children[0];Kc(t),F.remove(t)}for(;D.children.length>0;){const t=D.children[0];D.remove(t),t.geometry.dispose(),t.material.dispose()}U&&U.dispose(),L&&L.dispose()}}}}))}}function kc(t){var e,r,n,s;(null===(e=null==t?void 0:t.uniforms)||void 0===e?void 0:e.map)?null===(n=null===(r=null==t?void 0:t.uniforms)||void 0===r?void 0:r.map.value)||void 0===n||n.dispose():t.map&&(null===(s=t.map)||void 0===s||s.dispose()),t.dispose()}function Kc(t){t.traverse((t=>{if(t.isMesh)if(t.geometry.dispose(),t.material.isMaterial)kc(t.material);else for(const e of t.material)kc(e)}));for(let e=t.children.length-1;e>=0;e--){const r=t.children[e];t.remove(r)}}export{Nc as GeoTransform,jc as Loader3DTiles,Uc as PointCloudColoring,Lc as Shading};
- //# sourceMappingURL=three-loader-3dtiles.esm.min.js.map
|