@loaders.gl/i3s 3.0.13 → 3.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.es5.min.js +1 -1
- package/dist/dist.es5.min.js.map +1 -1
- package/dist/dist.min.js +1 -1
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +2 -2
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/i3s-attribute-loader.js +132 -53
- package/dist/es5/i3s-attribute-loader.js.map +1 -1
- package/dist/es5/i3s-content-loader.js +36 -10
- package/dist/es5/i3s-content-loader.js.map +1 -1
- package/dist/es5/i3s-loader.js +175 -51
- package/dist/es5/i3s-loader.js.map +1 -1
- package/dist/es5/i3s-node-page-loader.js +51 -8
- package/dist/es5/i3s-node-page-loader.js.map +1 -1
- package/dist/es5/index.js +4 -4
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js +313 -163
- package/dist/es5/lib/helpers/i3s-nodepages-tiles.js.map +1 -1
- package/dist/es5/lib/parsers/constants.js +9 -9
- package/dist/es5/lib/parsers/constants.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-attribute.js +68 -26
- package/dist/es5/lib/parsers/parse-i3s-attribute.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js +405 -276
- package/dist/es5/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/es5/lib/parsers/parse-i3s.js +70 -31
- package/dist/es5/lib/parsers/parse-i3s.js.map +1 -1
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js +8 -4
- package/dist/es5/lib/utils/convert-i3s-obb-to-mbs.js.map +1 -1
- package/dist/es5/lib/utils/url-utils.js +14 -17
- package/dist/es5/lib/utils/url-utils.js.map +1 -1
- package/dist/esm/i3s-attribute-loader.js +1 -1
- package/dist/esm/i3s-content-loader.js +1 -1
- package/dist/esm/i3s-loader.js +1 -1
- package/dist/esm/i3s-node-page-loader.js +1 -1
- package/dist/i3s-content-worker.js +1 -1
- package/dist/i3s-content-worker.js.map +1 -1
- package/package.json +9 -9
package/dist/dist.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=14)}([,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s})),r.d(e,"d",(function(){return a})),r.d(e,"c",(function(){return c}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window||{},s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a="function"==typeof importScripts,c="undefined"!=typeof window&&void 0!==window.orientation,u=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);u&&parseFloat(u[1])}).call(this,r(5),r(4))},,function(t,e,r){"use strict";(function(t,n){r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"==typeof n&&n},o=i.window||i.self||i.global,s=i.process||{};console}).call(this,r(5),r(4))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function _(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new _(t,e)),1!==u.length||h||a(d)},_.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window,s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);a&&parseFloat(a[1])}).call(this,r(5),r(4))},function(t,e){},function(t,e){},,,function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));var n=r(12);function i(){return!("object"==typeof t&&"[object process]"===String(t)&&!t.browser)||Object(n.a)()}}).call(this,r(4))},function(t,e,r){"use strict";(function(t){function n(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"==typeof t.versions&&Boolean(t.versions.electron))return!0;const r="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;return!!(n&&n.indexOf("Electron")>=0)}r.d(e,"a",(function(){return n}))}).call(this,r(4))},,function(t,e,r){(function(e){const n=r(18),i="undefined"==typeof window?e:window;i.loaders=i.loaders||{},t.exports=Object.assign(i.loaders,n)}).call(this,r(5))},,,function(t,e){},function(t,e,r){"use strict";r.r(e),r.d(e,"I3SLoader",(function(){return Lo})),r.d(e,"I3SContentLoader",(function(){return Ei})),r.d(e,"I3SAttributeLoader",(function(){return Ho})),r.d(e,"loadFeatureAttributes",(function(){return ko}));const n=t=>"boolean"==typeof t,i=t=>"function"==typeof t,o=t=>null!==t&&"object"==typeof t,s=t=>o(t)&&t.constructor==={}.constructor,a=t=>t&&"function"==typeof t[Symbol.iterator],c=t=>t&&"function"==typeof t[Symbol.asyncIterator],u=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,h=t=>"undefined"!=typeof Blob&&t instanceof Blob,l=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||o(t)&&i(t.tee)&&i(t.cancel)&&i(t.getReader))(t)||(t=>o(t)&&i(t.read)&&i(t.pipe)&&n(t.readable))(t);function f(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function d(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 _(t){var e,r;let n;return f(t,"null loader"),f(d(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}var m=r(23);let p="";const g={};const S=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,y=/^([-\w.]+\/[-\w.+]+)/;function E(t){const e=y.exec(t);return e?e[1]:t}function R(t){const e=S.exec(t);return e?e[1]:""}const w=/\?.*/;function A(t){if(u(t)){const e=b(t.url||"");return{url:e,type:E(t.headers.get("content-type")||"")||R(e)}}return h(t)?{url:b(t.name||""),type:t.type||""}:"string"==typeof t?{url:b(t),type:R(t)}:{url:"",type:""}}function b(t){return t.replace(w,"")}async function T(t){if(u(t))return t;const e={},r=function(t){return u(t)?t.headers["content-length"]||-1:h(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:i}=A(t);i&&(e["content-type"]=i);const o=await async function(t){if("string"==typeof t)return"data:,"+t.slice(0,5);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 e=t.slice(0,5);return"data:base64,"+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)}(e)}return null}(t);o&&(e["x-first-bytes"]=o),"string"==typeof t&&(t=(new TextEncoder).encode(t));const s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:n}),s}async function M(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const r=t.headers.get("Content-Type");let n=t.statusText;r.includes("application/json")&&(n+=" "+await t.text()),e+=n,e=e.length>60?e.slice(60)+"...":e}catch(t){}return e}(t);throw new Error(e)}}async function C(t,e){if("string"==typeof t){t=function(t){for(const e in g)if(t.startsWith(e)){const r=g[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${p}${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 T(t)}var D=r(11);const P=Object(D.a)();class O{constructor(t,e,r="sessionStorage"){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 x(t,e,r,n=600){const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));const o=t.width*r,s=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}const v={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function I(t){return"string"==typeof t?v[t.toUpperCase()]||v.WHITE:t}function B(t,e){if(!t)throw new Error(e||"Assertion failed")}var L=r(3);function G(){let t;if(P&&L.b.performance)t=L.b.performance.now();else if(L.a.hrtime){const e=L.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const U={debug:P&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},N={enabled:!0,level:0};function H(){}const k={},F={once:!0};function X(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}class j{constructor({id:t}={id:""}){this.id=t,this.VERSION="3.0.13",this._startTs=G(),this._deltaTs=G(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new O("__probe-".concat(this.id,"__"),N),this.userData={},this.timeStamp("".concat(this.id," started")),function(t,e=["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((G()-this._startTs).toPrecision(10))}getDelta(){return Number((G()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}assert(t,e){B(t,e)}warn(t){return this._getLogFunction(0,t,U.warn,arguments,F)}error(t){return this._getLogFunction(0,t,U.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,U.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,U.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,U.debug||U.info,arguments,F)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||H,r&&[r],{tag:X(e)}):H}image({logLevel:t,priority:e,image:n,message:i="",scale:o=1}){return this._shouldLog(t||e)?P?function({image:t,message:e="",scale:r=1}){if("string"==typeof t){const n=new Image;return n.onload=()=>{const t=x(n,e,r);console.log(...t)},n.src=t,H}const n=t.nodeName||"";if("img"===n.toLowerCase())return console.log(...x(t,e,r)),H;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...x(n,e,r)),n.src=t.toDataURL(),H}return H}({image:n,message:i,scale:o}):function({image:t,message:e="",scale:n=1}){let i=null;try{i=r(17)}catch(t){}if(i)return()=>i(t,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(t=>console.log(t));return H}({image:n,message:i,scale:o}):H}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}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||H)}group(t,e,r={collapsed:!1}){r=K({logLevel:t,message:e,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e,r={}){return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||H)}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()>=z(t)}_getLogFunction(t,e,r,n=[],i){if(this._shouldLog(t)){i=K({logLevel:t,message:e,args:n,opts:i}),B(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=G();const o=i.tag||i.message;if(i.once){if(k[o])return H;k[o]=G()}return e=function(t,e,r){if("string"==typeof e){const s=r.time?function(t,e=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(s," ").concat(e):"".concat(t,": ").concat(e),n=e,i=r.color,o=r.background,P||"string"!=typeof n||(i&&(i=I(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=I(o),n="[".concat(o+10,"m").concat(n,"[49m"))),e=n}var n,i,o;return e}(this.id,i.message,i),r.bind(console,e,...i.args)}return H}}function z(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 B(Number.isFinite(e)&&e>=0),e}function K(t){const{logLevel:e,message:r}=t;t.logLevel=z(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(t.args=n,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 i=typeof t.message;return B("string"===i||"object"===i),Object.assign(t,t.opts)}j.VERSION="3.0.13";const W=new j({id:"loaders.gl"});class q{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const V={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var t,e,r;r=void 0,(e="console")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,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:[]},$={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 Q(){m.a.loaders=m.a.loaders||{};const{loaders:t}=m.a;return t._state=t._state||{},t._state}const Z=()=>{const t=Q();return t.globalOptions=t.globalOptions||{...V},t.globalOptions};function Y(t,e,r,n){return r=r||[],function(t,e){tt(t,null,V,$,e);for(const r of e){const n=t&&t[r.id]||{},i=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};tt(n,r.id,i,o,e)}}(t,r=Array.isArray(r)?r:[r]),rt(e,t,n)}function J(t,e){const r=Z(),n=t||r;return"function"==typeof n.fetch?n.fetch:o(n.fetch)?t=>C(t,n):null!=e&&e.fetch?null==e?void 0:e.fetch:C}function tt(t,e,r,n,i){const s=e||"Top level",a=e?e+".":"";for(const c in t){const u=!e&&o(t[c]),h="baseUri"===c&&!e,l="workerUrl"===c&&e;if(!(c in r)&&!h&&!l)if(c in n)W.warn(`${s} loader option '${a}${c}' no longer supported, use '${n[c]}'`)();else if(!u){const t=et(c,i);W.warn(`${s} loader option '${a}${c}' not recognized. ${t}`)()}}}function et(t,e){const r=t.toLowerCase();let n="";for(const i of e)for(const e in i.options){if(t===e)return`Did you mean '${i.id}.${e}'?`;const o=e.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${i.id}.${e}'?`)}return n}function rt(t,e,r){const n={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(n,r),null===n.log&&(n.log=new q),nt(n,Z()),nt(n,e),n}function nt(t,e){for(const r in e)if(r in e){const n=e[r];s(n)&&s(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function it(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var ot=r(1);const st=new Map;function at(t){it(t.source&&!t.url||!t.source&&t.url);let e=st.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return ct((e=t,`try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var e}(t.url),st.set(t.url,e)),t.source&&(e=ct(t.source),st.set(t.source,e))),it(e),e}function ct(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function ut(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}function ht(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const lt=()=>{};class ft{static isSupported(){return"undefined"!=typeof Worker}constructor(t){ht(this,"name",void 0),ht(this,"source",void 0),ht(this,"url",void 0),ht(this,"terminated",!1),ht(this,"worker",void 0),ht(this,"onMessage",void 0),ht(this,"onError",void 0),ht(this,"_loadableURL","");const{name:e,source:r,url:n}=t;it(r||n),this.name=e,this.source=r,this.url=n,this.onMessage=lt,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=lt,this.onError=lt,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||function t(e,r=!0,n){const i=n||new Set;if(e){if(ut(e))i.add(e);else if(ut(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"==typeof e)for(const n in e)t(e[n],r,i)}else;return void 0===n?Array.from(i):[]}(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name}. `,t.message&&(e+=t.message+" in "),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=at({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}}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class _t{constructor(t,e){dt(this,"name",void 0),dt(this,"workerThread",void 0),dt(this,"isRunning",void 0),dt(this,"result",void 0),dt(this,"_resolve",void 0),dt(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){it(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){it(this.isRunning),this.isRunning=!1,this._reject(t)}}function mt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class pt{constructor(t){mt(this,"name","unnamed"),mt(this,"source",void 0),mt(this,"url",void 0),mt(this,"maxConcurrency",1),mt(this,"maxMobileConcurrency",1),mt(this,"onDebug",()=>{}),mt(this,"reuseWorkers",!0),mt(this,"props",{}),mt(this,"jobQueue",[]),mt(this,"idleQueue",[]),mt(this,"count",0),mt(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 _t(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=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new ft({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return ot.c?this.maxMobileConcurrency:this.maxConcurrency}}function gt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const St={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class yt{static isSupported(){return ft.isSupported()}static getWorkerFarm(t={}){return yt._workerFarm=yt._workerFarm||new yt({}),yt._workerFarm.setProps(t),yt._workerFarm}constructor(t){gt(this,"props",void 0),gt(this,"workerPools",new Map),this.props={...St},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 i=this.workerPools.get(e);return i||(i=new pt({name:e,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}gt(yt,"_workerFarm",void 0);async function Et(t,e,r,n,i){const o=t.id,s=function(t,e={}){const r=e[t.id]||{},n=t.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==t.id||(i=e.workerUrl),"test"===e._workerType&&(i=`modules/${t.module}/dist/${n}`),!i){let e=t.version;"latest"===e&&(e="latest");const r=e?"@"+e:"";i=`https://unpkg.com/@loaders.gl/${t.module}${r}/dist/${n}`}return it(i),i}(t,r),a=yt.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r));const c=await a.startJob("process-on-worker",Rt.bind(null,i));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(n.error);break;case"process":const{id:i,input:o,options:s}=n;try{const r=await t(o,s);e.postMessage("done",{id:i,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}var wt=r(7);function At(t){var e;if((e=t)&&"object"==typeof e&&e.isBuffer&&(t=function(t){return wt.toArrayBuffer?wt.toArrayBuffer(t):t}(t)),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")}async function bt(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 i=0;for(const t of e)n.set(t,i),i+=t.byteLength;return n.buffer}(...e)}const Tt=262144;function Mt(t,e){return m.b?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:i,value:o}=await t;if(i)return;yield At(o)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield At(e)}(t)}function Ct(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<t.length;){const e=Math.min(t.length-n,r),o=t.slice(n,n+e);n+=e,yield i.encode(o)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=Tt}=e;let n=0;for(;n<t.byteLength;){const e=Math.min(t.byteLength-n,r),i=new ArrayBuffer(e),o=new Uint8Array(t,n,e);new Uint8Array(i).set(o),n+=e,yield i}}(t,e);if(h(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,i=await t.slice(n,e).arrayBuffer();n=e,yield i}}(t,e);if(l(t))return Mt(t,e);if(u(t)){return Mt(t.body,e)}throw new Error("makeIterator")}const Dt="Cannot convert supplied data type";async function Pt(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;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(r)}return 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(Dt)}(t,e);if(h(t)&&(t=await T(t)),u(t)){const r=t;return await M(r),e.binary?await r.arrayBuffer():await r.text()}if(l(t)&&(t=Ct(t,r)),a(t)||c(t))return bt(t);throw new Error(Dt)}const Ot=()=>{const t=Q();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const xt=/\.([^.]+)$/;function vt(t,e=[],r,n){if(!It(t))return null;if(e&&!Array.isArray(e))return _(e);let i=[];e&&(i=i.concat(e)),null!=r&&r.ignoreRegisteredLoaders||i.push(...Ot()),function(t){for(const e of t)_(e)}(i);const o=function(t,e,r,n){const{url:i,type:o}=A(t),s=i||(null==n?void 0:n.url);let a=null;null!=r&&r.mimeType&&(a=Lt(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&xt.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,s),a=a||Lt(e,o),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(Gt(e,r))return r}else if(ArrayBuffer.isView(e)){if(Ut(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(Ut(e,0,r))return r}return null}(e,t),a=a||Lt(e,null==r?void 0:r.fallbackMimeType),a}(t,i,r,n);if(!(o||null!=r&&r.nothrow))throw new Error(Bt(t));return o}function It(t){return!(t instanceof Response&&204===t.status)}function Bt(t){const{url:e,type:r}=A(t);let n="No valid loader found";return t&&(n+=` data: "${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)}", contentType: "${r}"`),e&&(n+=" url: "+e),n}function Lt(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x."+r.id)return r}return null}function Gt(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some(e=>t.startsWith(e))}function Ut(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),i=new Uint8Array(e);for(let t=0;t<n.length;++t)if(n[t]!==i[t])return!1;return!0}(n,t,n.byteLength);switch(typeof n){case"function":return n(t,r);case"string":const i=Nt(t,e,n.length);return n===i;default:return!1}}(t,e,r,n))}function Nt(t,e,r){if(t.byteLength<e+r)return"";const n=new DataView(t);let i="";for(let t=0;t<r;t++)i+=String.fromCharCode(n.getUint8(e+t));return i}async function Ht(t,e,r,n){it(!n||"object"==typeof n),!e||Array.isArray(e)||d(e)||(n=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:i}=A(t),o=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),s=await async function(t,e=[],r,n){if(!It(t))return null;let i=vt(t,e,{...r,nothrow:!0},n);if(i)return i;if(h(t)&&(i=vt(t=await t.slice(0,10).arrayBuffer(),e,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Bt(t));return i}(t,o,r);return s?(n=function(t,e,r=null){if(r)return r;const n={fetch:J(e,t),...t};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Ht,loaders:o},r=Y(r,s,o,i),n),await async function(t,e,r,n){if(function(t,e="3.0.13"){it(t,"no worker provided");const r=t.version}(t),e=await Pt(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,n,t);if(function(t,e){return!!yt.isSupported()&&(t.worker&&(null==e?void 0:e.worker))}(t,r))return await Et(t,e,r,0,Ht);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 it(!t.parseSync),new Error(t.id+" loader - no parser found and worker is disabled")}(s,t,r,n)):null}async function kt(t,e,r,n){Array.isArray(e)||d(e)||(void 0,r=e,e=void 0);const i=J(r);let o=t;return"string"==typeof t&&(o=await i(t)),h(t)&&(o=await i(t)),await Ht(o,e,r)}function Ft(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const Xt=1/Math.PI*180,jt=1/180*Math.PI,zt={};function Kt(t,{precision:e=zt.precision||4}={}){return t=function(t){return Math.round(t/zt.EPSILON)*zt.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Wt(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function qt(t,e,r){if(Wt(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 Vt(t){return function(t,e){return qt(t,t=>t*jt,e)}(t)}function $t(t){return function(t,e){return qt(t,t=>t*Xt,e)}(t)}function Qt(t,e,r){const n=zt.EPSILON;r&&(zt.EPSILON=r);try{if(t===e)return!0;if(Wt(t)&&Wt(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Qt(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)<=zt.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{zt.EPSILON=n}}zt.EPSILON=1e-12,zt.debug=!1,zt.precision=4,zt.printTypes=!1,zt.printDegrees=!1,zt.printRowMajor=!0;class Zt 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 Ft(!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:Wt(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(zt)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Kt(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(!Qt(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 i=t[n];this[n]=i+r*(e[n]-i)}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(zt.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 Yt(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Jt(t,e,r=""){if(zt.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 te={};function ee(t,e){te[t]||(te[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class re extends Zt{get ELEMENTS(){return Ft(!1),0}copy(t){return Ft(!1),this}get x(){return this[0]}set x(t){this[0]=Yt(t)}get y(){return this[1]}set y(t){this[1]=Yt(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 Yt(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Yt(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 Ft(t>=0&&t<this.ELEMENTS,"index is out of range"),Yt(this[t])}setComponent(t,e){return Ft(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 ne=1e-6,ie="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function oe(){var t=new ie(3);return ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function se(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function ae(t,e,r){var n=new ie(3);return n[0]=t,n[1]=e,n[2]=r,n}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ue(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2];return t[0]=i*c-o*a,t[1]=o*s-n*c,t[2]=n*a-i*s,t}function he(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}function le(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var fe,de=se;fe=oe();function _e(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}const me=[0,0,0],pe={};class ge extends re{static get ZERO(){return pe.ZERO=pe.ZERO||Object.freeze(new ge(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Wt(t)?this.copy(t):(zt.debug&&(Yt(t),Yt(e),Yt(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 zt.debug&&(Yt(t.x),Yt(t.y),Yt(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]=Yt(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2],u=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+c*c),h=u&&ce(e,r)/u,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,c,u,h}cross(t){return ue(this,this,t),this.check()}rotateX({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[0],a[1]=s[1]*Math.cos(o)-s[2]*Math.sin(o),a[2]=s[1]*Math.sin(o)+s[2]*Math.cos(o),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateY({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[2]*Math.sin(o)+s[0]*Math.cos(o),a[1]=s[1],a[2]=s[2]*Math.cos(o)-s[0]*Math.sin(o),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateZ({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[0]*Math.cos(o)-s[1]*Math.sin(o),a[1]=s[0]*Math.sin(o)+s[1]*Math.cos(o),a[2]=s[2],r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return he(this,this,t),this.check()}transformAsVector(t){return _e(this,this,t),this.check()}transformByMatrix3(t){return le(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g;return e=this,r=this,i=(n=t)[0],o=n[1],s=n[2],a=n[3],c=r[0],u=r[1],h=r[2],_=o*(d=i*u-o*c)-s*(f=s*c-i*h),m=s*(l=o*h-s*u)-i*d,p=i*f-o*l,l*=g=2*a,f*=g,d*=g,_*=2,m*=2,p*=2,e[0]=c+l+_,e[1]=u+f+m,e[2]=h+d+p,this.check()}}class Se extends Zt{get ELEMENTS(){return Ft(!1),0}get RANK(){return Ft(!1),0}toString(){let t="[";if(zt.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]=Yt(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 ye(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=e[9],d=e[10],_=e[11],m=e[12],p=e[13],g=e[14],S=e[15],y=r[0],E=r[1],R=r[2],w=r[3];return t[0]=y*n+E*a+R*l+w*m,t[1]=y*i+E*c+R*f+w*p,t[2]=y*o+E*u+R*d+w*g,t[3]=y*s+E*h+R*_+w*S,y=r[4],E=r[5],R=r[6],w=r[7],t[4]=y*n+E*a+R*l+w*m,t[5]=y*i+E*c+R*f+w*p,t[6]=y*o+E*u+R*d+w*g,t[7]=y*s+E*h+R*_+w*S,y=r[8],E=r[9],R=r[10],w=r[11],t[8]=y*n+E*a+R*l+w*m,t[9]=y*i+E*c+R*f+w*p,t[10]=y*o+E*u+R*d+w*g,t[11]=y*s+E*h+R*_+w*S,y=r[12],E=r[13],R=r[14],w=r[15],t[12]=y*n+E*a+R*l+w*m,t[13]=y*i+E*c+R*f+w*p,t[14]=y*o+E*u+R*d+w*g,t[15]=y*s+E*h+R*_+w*S,t}function Ee(t,e,r){var n=r[0],i=r[1],o=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]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Re(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],s=e[5],a=e[6],c=e[8],u=e[9],h=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,s,a),t[2]=Math.hypot(c,u,h),t}!function(){var t,e=(t=new ie(2),ie!=Float32Array&&(t[0]=0,t[1]=0),t)}();function we(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function Ae(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}!function(){var t,e=(t=new ie(4),ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();const be=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Te=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Me=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}),Ce={};class De extends Se{static get IDENTITY(){return Ce.IDENTITY=Ce.IDENTITY||Object.freeze(new De(be)),Ce.IDENTITY}static get ZERO(){return Ce.ZERO=Ce.ZERO||Object.freeze(new De(Te)),Ce.ZERO}get INDICES(){return Me}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,i,o,s,a,c,u,h,l,f,d,_,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=c,this[9]=u,this[10]=h,this[11]=l,this[12]=f,this[13]=d,this[14]=_,this[15]=m,this.check()}setRowMajor(t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m){return this[0]=t,this[1]=i,this[2]=c,this[3]=f,this[4]=e,this[5]=o,this[6]=u,this[7]=d,this[8]=r,this[9]=s,this[10]=h,this[11]=_,this[12]=n,this[13]=a,this[14]=l,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(be)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,h=n*s,l=n*a,f=i*s,d=i*a,_=i*c,m=o*s,p=o*a,g=o*c;t[0]=1-l-_,t[1]=h+g,t[2]=f-p,t[3]=0,t[4]=h-g,t[5]=1-u-_,t[6]=d+m,t[7]=0,t[8]=f+p,t[9]=d-m,t[10]=1-u-l,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:i,far:o}){return o===1/0?De._computeInfinitePerspectiveOffCenter(this,t,e,r,n,i):function(t,e,r,n,i,o,s){var a=1/(r-e),c=1/(i-n),u=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*c,t[10]=(s+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*u,t[15]=0}(this,t,e,r,n,i,o),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),c=(r+e)/(r-e),u=(i+n)/(i-n),h=-2*o;return t[0]=s,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]=h,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 i,o,s,a,c,u,h,l,f,d,_=e[0],m=e[1],p=e[2],g=n[0],S=n[1],y=n[2],E=r[0],R=r[1],w=r[2];Math.abs(_-E)<ne&&Math.abs(m-R)<ne&&Math.abs(p-w)<ne?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):(h=_-E,l=m-R,f=p-w,i=S*(f*=d=1/Math.hypot(h,l,f))-y*(l*=d),o=y*(h*=d)-g*f,s=g*l-S*h,(d=Math.hypot(i,o,s))?(i*=d=1/d,o*=d,s*=d):(i=0,o=0,s=0),a=l*s-f*o,c=f*i-h*s,u=h*o-l*i,(d=Math.hypot(a,c,u))?(a*=d=1/d,c*=d,u*=d):(a=0,c=0,u=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=l,t[7]=0,t[8]=s,t[9]=u,t[10]=f,t[11]=0,t[12]=-(i*_+o*m+s*p),t[13]=-(a*_+c*m+u*p),t[14]=-(h*_+l*m+f*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:i=.1,far:o=500}){return function(t,e,r,n,i,o,s){var a=1/(e-r),c=1/(n-i),u=1/(o-s);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]=(i+n)*c,t[14]=(s+o)*u,t[15]=1}(this,t,e,r,n,i,o),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:i=500}){if(t>2*Math.PI)throw Error("radians");const o=t/2,s=r*Math.tan(o),a=s*e;return(new De).ortho({left:-a,right:a,bottom:-s,top:s,near:n,far:i})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,n,i){var o,s=1/Math.tan(e/2);t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,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!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n)}(this,t,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8],h=t[9],l=t[10],f=t[11],d=t[12],_=t[13],m=t[14],p=t[15],(e*s-r*o)*(l*p-f*m)-(e*a-n*o)*(h*p-f*_)+(e*c-i*o)*(h*m-l*_)+(r*a-n*s)*(u*p-f*d)-(r*c-i*s)*(u*m-l*d)+(n*c-i*a)*(u*_-h*d);var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p}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],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,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],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=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]=o,t[11]=e[14],t[12]=i,t[13]=s,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(){var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g,S,y,E,R,w,A,b,T,M,C,D,P,O;return t=this,r=(e=this)[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],h=e[8],l=e[9],f=e[10],d=e[11],_=e[12],m=e[13],p=e[14],g=e[15],(O=(S=r*a-n*s)*(P=f*g-d*p)-(y=r*c-i*s)*(D=l*g-d*m)+(E=r*u-o*s)*(C=l*p-f*m)+(R=n*c-i*a)*(M=h*g-d*_)-(w=n*u-o*a)*(T=h*p-f*_)+(A=i*u-o*c)*(b=h*m-l*_))&&(O=1/O,t[0]=(a*P-c*D+u*C)*O,t[1]=(i*D-n*P-o*C)*O,t[2]=(m*A-p*w+g*R)*O,t[3]=(f*w-l*A-d*R)*O,t[4]=(c*M-s*P-u*T)*O,t[5]=(r*P-i*M+o*T)*O,t[6]=(p*E-_*A-g*y)*O,t[7]=(h*A-f*E+d*y)*O,t[8]=(s*D-a*M+u*b)*O,t[9]=(n*M-r*D-o*b)*O,t[10]=(_*w-m*E+g*S)*O,t[11]=(l*E-h*w-d*S)*O,t[12]=(a*T-s*C-c*b)*O,t[13]=(r*C-n*T+i*b)*O,t[14]=(m*y-_*R-p*S)*O,t[15]=(h*R-l*y+f*S)*O),this.check()}multiplyLeft(t){return ye(this,t,this),this.check()}multiplyRight(t){return ye(this,this,t),this.check()}rotateX(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[4],a=r[5],c=r[6],u=r[7],h=r[8],l=r[9],f=r[10],d=r[11],r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=s*o+h*i,e[5]=a*o+l*i,e[6]=c*o+f*i,e[7]=u*o+d*i,e[8]=h*o-s*i,e[9]=l*o-a*i,e[10]=f*o-c*i,e[11]=d*o-u*i,this.check()}rotateY(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[0],a=r[1],c=r[2],u=r[3],h=r[8],l=r[9],f=r[10],d=r[11],r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=s*o-h*i,e[1]=a*o-l*i,e[2]=c*o-f*i,e[3]=u*o-d*i,e[8]=s*i+h*o,e[9]=a*i+l*o,e[10]=c*i+f*o,e[11]=u*i+d*o,this.check()}rotateZ(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[0],a=r[1],c=r[2],u=r[3],h=r[4],l=r[5],f=r[6],d=r[7],r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=s*o+h*i,e[1]=a*o+l*i,e[2]=c*o+f*i,e[3]=u*o+d*i,e[4]=h*o-s*i,e[5]=l*o-a*i,e[6]=f*o-c*i,e[7]=d*o-u*i,this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,c,u,h,l,f,d,_,m,p,g,S,y,E,R,w,A,b,T,M,C,D=n[0],P=n[1],O=n[2],x=Math.hypot(D,P,O);x<ne||(D*=x=1/x,P*=x,O*=x,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],c=e[1],u=e[2],h=e[3],l=e[4],f=e[5],d=e[6],_=e[7],m=e[8],p=e[9],g=e[10],S=e[11],y=D*D*s+o,E=P*D*s+O*i,R=O*D*s-P*i,w=D*P*s-O*i,A=P*P*s+o,b=O*P*s+D*i,T=D*O*s+P*i,M=P*O*s-D*i,C=O*O*s+o,t[0]=a*y+l*E+m*R,t[1]=c*y+f*E+p*R,t[2]=u*y+d*E+g*R,t[3]=h*y+_*E+S*R,t[4]=a*w+l*A+m*b,t[5]=c*w+f*A+p*b,t[6]=u*w+d*A+g*b,t[7]=h*w+_*A+S*b,t[8]=a*T+l*M+m*C,t[9]=c*T+f*M+p*C,t[10]=u*T+d*M+g*C,t[11]=h*T+_*M+S*C,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)?Ee(this,this,t):Ee(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g,S;return e=this,r=this,p=(n=t)[0],g=n[1],S=n[2],r===e?(e[12]=r[0]*p+r[4]*g+r[8]*S+r[12],e[13]=r[1]*p+r[5]*g+r[9]*S+r[13],e[14]=r[2]*p+r[6]*g+r[10]*S+r[14],e[15]=r[3]*p+r[7]*g+r[11]*S+r[15]):(i=r[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=r[9],_=r[10],m=r[11],e[0]=i,e[1]=o,e[2]=s,e[3]=a,e[4]=c,e[5]=u,e[6]=h,e[7]=l,e[8]=f,e[9]=d,e[10]=_,e[11]=m,e[12]=i*p+c*g+f*S+r[12],e[13]=o*p+u*g+d*S+r[13],e[14]=s*p+h*g+_*S+r[14],e[15]=a*p+l*g+m*S+r[15]),this.check()}transform(t,e){return 4===t.length?(r=e||[-0,-0,-0,-0],i=this,o=(n=t)[0],s=n[1],a=n[2],c=n[3],r[0]=i[0]*o+i[4]*s+i[8]*a+i[12]*c,r[1]=i[1]*o+i[5]*s+i[9]*a+i[13]*c,r[2]=i[2]*o+i[6]*s+i[10]*a+i[14]*c,r[3]=i[3]*o+i[7]*s+i[11]*a+i[15]*c,Jt(e=r,4),e):this.transformAsPoint(t,e);var r,n,i,o,s,a,c}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:n=e||[-0,-0],o=this,s=(i=t)[0],a=i[1],n[0]=o[0]*s+o[4]*a+o[12],n[1]=o[1]*s+o[5]*a+o[13],e=n;break;case 3:e=he(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var n,i,o,s,a;return Jt(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:e=_e(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Jt(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 ee("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return ee("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return ee("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}var Pe=.1,Oe=1e-12,xe=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const ve=t=>t,Ie=new ge;function Be(t,e,r=ve){return Wt(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}function Le(t,e,r=ve){return Wt(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}const Ge=new ge,Ue=new ge,Ne=new ge;const He=new ge,ke={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"}},Fe={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Xe={east:new ge,north:new ge,up:new ge,west:new ge,south:new ge,down:new ge},je=new ge,ze=new ge,Ke=new ge;function We(t,e,r,n,i,o){const s=ke[e]&&ke[e][r];let a,c,u;Ft(s&&(!n||n===s));const h=He.copy(i);if(Qt(h.x,0,1e-14)&&Qt(h.y,0,1e-14)){const t=Math.sign(h.z);a=je.fromArray(Fe[e]),"east"!==e&&"west"!==e&&a.scale(t),c=ze.fromArray(Fe[r]),"east"!==r&&"west"!==r&&c.scale(t),u=Ke.fromArray(Fe[n]),"east"!==n&&"west"!==n&&u.scale(t)}else{const{up:i,east:o,north:s}=Xe;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:l,west:f,south:d}=Xe;l.copy(i).scale(-1),f.copy(o).scale(-1),d.copy(s).scale(-1),a=Xe[e],c=Xe[r],u=Xe[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=u.x,o[9]=u.y,o[10]=u.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const qe=new ge,Ve=new ge,$e=new ge,Qe=new ge,Ze=new ge,Ye=new ge;let Je;class tr{static get WGS84(){return Je=Je||new tr(6378137,6378137,6356752.314245179),Je}constructor(t=0,e=0,r=0){Ft(t>=0),Ft(e>=0),Ft(r>=0),this.radii=new ge(t,e,r),this.radiiSquared=new ge(t*t,e*e,r*r),this.radiiToTheFourth=new ge(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new ge(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new ge(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=Pe,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=Ve,n=$e,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Ye.from(t);const r=this.scaleToGeodeticSurface(Ye,Qe);if(!r)return;const n=this.geodeticSurfaceNormal(r,Ve),i=Ze;i.copy(Ye).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(ce(i,Ye))*se(i);return Le([o,s,a],e,zt._cartographicRadians?ve:$t)}eastNorthUpToFixedFrame(t,e=new De){return We(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new De){return We(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return qe.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=Ie){return Be(t,e,zt._cartographicRadians?ve:Vt)}(t),n=r[0],i=r[1],o=Math.cos(i);return qe.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),qe.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return qe.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new ge){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;Ge.from(t);const s=t.x,a=t.y,c=t.z,u=n.x,h=n.y,l=n.z,f=s*s*u*u,d=a*a*h*h,_=c*c*l*l,m=f+d+_,p=Math.sqrt(1/m);if(!Number.isFinite(p))return;const g=Ue;if(g.copy(t).scale(p),m<o)return g.to(r);const S=i.x,y=i.y,E=i.z,R=Ne;R.set(g.x*S*2,g.y*y*2,g.z*E*2);let w,A,b,T,M=(1-p)*t.len()/(.5*R.len()),C=0;do{M-=C,w=1/(1+M*S),A=1/(1+M*y),b=1/(1+M*E);const t=w*w,e=A*A,r=b*b;T=f*t+d*e+_*r-1;C=T/(-2*(f*(t*w)*S+d*(e*A)*y+_*(r*b)*E))}while(Math.abs(T)>Oe);return Ge.scale([w,A,b]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Qe.from(t);const r=Qe.x,n=Qe.y,i=Qe.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return Qe.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Qe.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Qe.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){Ft(Qt(this.radii.x,this.radii.y,xe)),Ft(this.radii.z>0),Qe.from(t);const n=Qe.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return Qe.set(0,0,n).to(r)}}function er(t,e){if(!t)throw new Error(e)}var rr=r(6);const{_parseImageNode:nr}=rr.a,ir="undefined"!=typeof Image,or="undefined"!=typeof ImageBitmap,sr=Boolean(nr),ar=!!rr.b||sr;function cr(t){const e=hr(t);if(!e)throw new Error("Not an image");return e}function ur(t){switch(cr(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")}}function hr(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}const lr=/^data:image\/svg\+xml/,fr=/\.svg((\?|#).*)?$/;function dr(t){return t&&(lr.test(t)||fr.test(t))}function _r(t,e){if(dr(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function mr(t,e,r){const n=function(t,e){if(dr(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,"+btoa(e)}return _r(t,e)}(t,r),i=self.URL||self.webkitURL,o="string"!=typeof n&&i.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 ${t}: ${e}`))}catch(t){n(t)}})}(o||n,e)}finally{o&&i.revokeObjectURL(o)}}const pr={};let gr=!0;async function Sr(t,e,r){let n;if(dr(r)){n=await mr(t,e,r)}else n=_r(t,r);const i=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||pr)return!1;return!0}(e)&&gr||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),gr=!1}return await createImageBitmap(t)}(n,i)}function yr(t){const e=Er(t);return function(t){const e=Er(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,!1)))return null;return{mimeType:"image/png",width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}(e)||function(t){const e=Er(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,!1)&&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 i=2;for(;i+9<e.byteLength;){const t=e.getUint16(i,!1);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(i+5,!1),width:e.getUint16(i+7,!1)};if(!r.has(t))return null;i+=2,i+=e.getUint16(i,!1)}return null}(e)||function(t){const e=Er(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:e.getUint16(6,!0),height:e.getUint16(8,!0)}}(e)||function(t){const e=Er(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,!1)&&e.getUint32(2,!0)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,!0),height:e.getUint32(22,!0)}}(e)}function Er(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 Rr={id:"image",module:"images",name:"Images",version:"3.0.13",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:i}=r||{};let o;switch(function(t){switch(t){case"auto":case"data":return function(){if(or)return"imagebitmap";if(ir)return"image";if(ar)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return or||ir||ar;case"imagebitmap":return or;case"image":return ir;case"data":return ar;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(n)){case"imagebitmap":o=await Sr(t,e,i);break;case"image":o=await mr(t,e,i);break;case"data":o=await function(t,e){const{mimeType:r}=yr(t)||{},{_parseImageNode:n}=rr.a;return er(n),n(t,r,e)}(t,e);break;default:er(!1)}return"data"===n&&(o=ur(o)),o},tests:[t=>Boolean(yr(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},wr={name:"Draco",id:"draco",module:"draco",version:"3.0.13",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}}};function Ar(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class br{constructor(t,e){Ar(this,"fields",void 0),Ar(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 br(r,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new br(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof br){const n=t;e=n.fields,r=Tr(Tr(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 i=Object.values(n);return new br(i,r)}}function Tr(t,e){return new Map([...t||new Map,...e||new Map])}let Mr,Cr,Dr,Pr,Or,xr,vr,Ir;function Br(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!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"}(Mr||(Mr={}));class Lr{static isNull(t){return t&&t.typeId===Mr.Null}static isInt(t){return t&&t.typeId===Mr.Int}static isFloat(t){return t&&t.typeId===Mr.Float}static isBinary(t){return t&&t.typeId===Mr.Binary}static isUtf8(t){return t&&t.typeId===Mr.Utf8}static isBool(t){return t&&t.typeId===Mr.Bool}static isDecimal(t){return t&&t.typeId===Mr.Decimal}static isDate(t){return t&&t.typeId===Mr.Date}static isTime(t){return t&&t.typeId===Mr.Time}static isTimestamp(t){return t&&t.typeId===Mr.Timestamp}static isInterval(t){return t&&t.typeId===Mr.Interval}static isList(t){return t&&t.typeId===Mr.List}static isStruct(t){return t&&t.typeId===Mr.Struct}static isUnion(t){return t&&t.typeId===Mr.Union}static isFixedSizeBinary(t){return t&&t.typeId===Mr.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===Mr.FixedSizeList}static isMap(t){return t&&t.typeId===Mr.Map}static isDictionary(t){return t&&t.typeId===Mr.Dictionary}get typeId(){return Mr.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;Cr=Symbol.toStringTag;class Gr extends Lr{constructor(t,e){super(),Br(this,"isSigned",void 0),Br(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return Mr.Int}get[Cr](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class Ur extends Gr{constructor(){super(!0,8)}}class Nr extends Gr{constructor(){super(!0,16)}}class Hr extends Gr{constructor(){super(!0,32)}}class kr extends Gr{constructor(){super(!1,8)}}class Fr extends Gr{constructor(){super(!1,16)}}class Xr extends Gr{constructor(){super(!1,32)}}const jr=32,zr=64;Dr=Symbol.toStringTag;class Kr extends Lr{constructor(t){super(),Br(this,"precision",void 0),this.precision=t}get typeId(){return Mr.Float}get[Dr](){return"Float"}toString(){return"Float"+this.precision}}class Wr extends Kr{constructor(){super(jr)}}class qr extends Kr{constructor(){super(zr)}}Symbol.toStringTag;Symbol.toStringTag;Pr=Symbol.toStringTag;Or=Symbol.toStringTag;xr=Symbol.toStringTag;vr=Symbol.toStringTag;Ir=Symbol.toStringTag;class Vr extends Lr{constructor(t,e){super(),Br(this,"listSize",void 0),Br(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return Mr.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Ir](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}function $r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Qr{constructor(t,e,r=!1,n=new Map){$r(this,"name",void 0),$r(this,"type",void 0),$r(this,"nullable",void 0),$r(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 Qr(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`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}function Zr(t,e,r){const n=r?Yr(r.metadata):void 0,i=function(t){switch(t.constructor){case Int8Array:return new Ur;case Uint8Array:return new kr;case Int16Array:return new Nr;case Uint16Array:return new Fr;case Int32Array:return new Hr;case Uint32Array:return new Xr;case Float32Array:return new Wr;case Float64Array:return new qr;default:throw new Error("array type not supported")}}(e.value);return new Qr(t,new Vr(e.size,new Qr("value",i)),!1,n)}function Yr(t){const e=new Map;for(const r in t)e.set(r+".string",JSON.stringify(t[r]));return e}function Jr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const tn={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},en={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class rn{constructor(t){Jr(this,"draco",void 0),Jr(this,"decoder",void 0),Jr(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),i=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,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e="DRACO decompression failed: "+t.error_msg();throw new Error(e)}const o=this._getDracoLoaderData(i,n,e),s=this._getMeshData(i,o,e),a=function(t){let e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-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],h=a[t+2];e=c<e?c:e,r=u<r?u:r,n=h<n?h:n,i=c>i?c:i,o=u>o?u:o,s=h>s?h:s}return[[e,r,n],[i,o,s]]}(s.attributes),c=function(t,e,r){const n=Yr(e.metadata),i=[],o=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=Zr(e,t[e],o[e]);i.push(r)}if(r){const t=Zr("indices",r);i.push(t)}return new br(i,n)}(s.attributes,o,s.indices);return{loader:"draco",loaderData:o,header:{vertexCount:i.num_points(),boundingBox:a},...s,schema:c}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),i=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:i}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const i=this.decoder.GetAttribute(t,n),o=this._getAttributeMetadata(t,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:o};const s=this._getQuantizationTransform(i,e);s&&(r[i.unique_id()].quantization_transform=s);const a=this._getOctahedronTransform(i,e);a&&(r[i.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.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const i of Object.values(t.attributes)){const t=this._deduceAttributeName(i,r);i.name=t;const{value:o,size:s}=this._getAttributeValues(e,i);n[t]={value:o,size:s,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.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=en[e.data_type],n=e.num_components,i=t.num_points()*n,o=i*r.BYTES_PER_ELEMENT,s=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(o);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,s,o,c),a=new r(this.draco.HEAPF32.buffer,c,i).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 tn){if(this.draco[t]===n)return tn[t]}const i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:"CUSTOM_ATTRIBUTE_"+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}}var nn=r(8);const on={};async function sn(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(!ot.b)return`modules/${e}/dist/libs/${t}`;if(r.CDN)return it(r.CDN.startsWith("http")),`${r.CDN}/${e}@3.0.13/dist/libs/${t}`;if(ot.d)return"../src/libs/"+t;return`modules/${e}/src/libs/${t}`}(t,e,r)),on[t]=on[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!ot.b)return nn.requireFromFile&&await nn.requireFromFile(t);if(ot.d)return importScripts(t);const e=await fetch(t);return function(t,e){if(!ot.b)return nn.requireFromString&&nn.requireFromString(t,e);if(ot.d)return eval.call(ot.a,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 on[t]}let an;async function cn(t){const e=t.modules||{};return an=e.draco3d?an||e.draco3d.createDecoderModule({}).then(t=>({draco:t})):an||async function(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",t);break;case"wasm":default:[e,r]=await Promise.all([await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",t),await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","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 an}const un={...wr,parse:async function(t,e){const{draco:r}=await cn(e),n=new rn(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};new Uint8Array([0]);const hn=[171,75,84,88,32,50,48,187,13,10,26,10];var ln,fn,dn,_n,mn,pn,gn,Sn,yn;(yn=ln||(ln={}))[yn.NONE=0]="NONE",yn[yn.BASISLZ=1]="BASISLZ",yn[yn.ZSTD=2]="ZSTD",yn[yn.ZLIB=3]="ZLIB",function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(fn||(fn={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(dn||(dn={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(_n||(_n={})),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"}(mn||(mn={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(pn||(pn={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(gn||(gn={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Sn||(Sn={}));class En{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=ln.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:fn.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:dn.UNSPECIFIED,colorPrimaries:_n.SRGB,transferFunction:_n.SRGB,flags:pn.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Rn{constructor(t,e,r,n){this._dataView=new DataView(t.buffer,t.byteOffset+e,r),this._littleEndian=n,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function wn(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function An(t,e){const r=new Array(e.mipMapLevels);let n=e.width,i=e.height,o=0;for(let s=0;s<e.mipMapLevels;++s){const a=Tn(e,n,i,t,s),c=bn(t,s,o,a);r[s]={compressed:!0,format:e.internalFormat,data:c,width:n,height:i,levelSize:a},n=Math.max(1,n>>1),i=Math.max(1,i>>1),o+=a}return r}function bn(t,e,r,n){return Array.isArray(t)?t[e].levelData:new Uint8Array(t.buffer,t.byteOffset+r,n)}function Tn(t,e,r,n,i){return Array.isArray(n)?t.sizeFunction(n[i]):t.sizeFunction(e,r)}const Mn={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919},Cn={131:Mn.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Mn.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Mn.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Mn.COMPRESSED_RED_RGTC1_EXT,140:Mn.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Mn.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Mn.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Mn.COMPRESSED_RGB8_ETC2,148:Mn.COMPRESSED_SRGB8_ETC2,149:Mn.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Mn.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Mn.COMPRESSED_RGBA8_ETC2_EAC,152:Mn.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Mn.COMPRESSED_R11_EAC,154:Mn.COMPRESSED_SIGNED_R11_EAC,155:Mn.COMPRESSED_RG11_EAC,156:Mn.COMPRESSED_SIGNED_RG11_EAC,157:Mn.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Mn.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Mn.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Mn.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Mn.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Mn.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Mn.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Mn.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Mn.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Mn.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Mn.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Mn.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Mn.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Mn.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Mn.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Mn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Mn.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Mn.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Mn.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Mn.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Mn.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Mn.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Mn.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Mn.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Mn.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Mn.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Mn.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Mn.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Mn.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Mn.COMPRESSED_RGBA_ASTC_12x12_KHR};const Dn=[171,75,84,88,32,50,48,187,13,10,26,10];function Pn(t){const e=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,hn.length);if(e[0]!==hn[0]||e[1]!==hn[1]||e[2]!==hn[2]||e[3]!==hn[3]||e[4]!==hn[4]||e[5]!==hn[5]||e[6]!==hn[6]||e[7]!==hn[7]||e[8]!==hn[8]||e[9]!==hn[9]||e[10]!==hn[10]||e[11]!==hn[11])throw new Error("Missing KTX 2.0 identifier.");const r=new En,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Rn(t,hn.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const o=i._nextUint32();r.supercompressionScheme=i._nextUint32();const s=i._nextUint32(),a=i._nextUint32(),c=i._nextUint32(),u=i._nextUint32(),h=i._nextUint64(),l=i._nextUint64(),f=new Rn(t,hn.length+n,3*o*8,!0);for(let e=0;e<o;e++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});const d=new Rn(t,s,a,!0),_={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:{x:d._nextUint8()+1,y:d._nextUint8()+1,z:d._nextUint8()+1,w:d._nextUint8()+1},bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},m=(_.descriptorBlockSize/4-6)/4;for(let t=0;t<m;t++)_.samples[t]={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelID:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:d._nextUint32(),sampleUpper:d._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const p=new Rn(t,c,u,!0);for(;p._offset<u;){const t=p._nextUint32(),e=p._scan(t),n=wn(e),i=p._scan(t-e.byteLength);r.keyValue[n]=n.match(/^ktx/i)?wn(i):i,t%4&&p._skip(4-t%4)}if(l<=0)return r;const g=new Rn(t,h,l,!0),S=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),R=g._nextUint32(),w=g._nextUint32(),A=g._nextUint32(),b=[];for(let t=0;t<o;t++)b.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const T=h+g._offset,M=T+E,C=M+R,D=C+w,P=new Uint8Array(t.buffer,t.byteOffset+T,E),O=new Uint8Array(t.buffer,t.byteOffset+M,R),x=new Uint8Array(t.buffer,t.byteOffset+C,w),v=new Uint8Array(t.buffer,t.byteOffset+D,A);return r.globalData={endpointCount:S,selectorCount:y,imageDescs:b,endpointsData:P,selectorsData:O,tablesData:x,extendedData:v},r}(new Uint8Array(t)),r=Math.max(1,e.levels.length),n=e.pixelWidth,i=e.pixelHeight,o=(s=e.vkFormat,Cn[s]);var s;return An(e.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:t=>t.uncompressedByteLength,internalFormat:o})}const On={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4,PIXEL_FORMATS:{DXT1:Mn.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Mn.COMPRESSED_RGB_ATC_WEBGL,ATCA:Mn.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Mn.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},SIZE_FUNCTIONS:{DXT1:vn,DXT3:In,DXT5:In,"ATC ":vn,ATCA:In,ATCI:In}};function xn(t){const e=new Int32Array(t,0,On.HEADER_LENGTH),r=e[On.HEADER_PF_FOURCC_INDEX];f(Boolean(e[On.HEADER_PF_FLAGS_INDEX]&On.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const o=On.PIXEL_FORMATS[n],s=On.SIZE_FUNCTIONS[n];f(o&&s,"DDS: Unknown pixel format "+r);let a=1;e[On.HEADER_FLAGS_INDEX]&On.DDSD_MIPMAPCOUNT&&(a=Math.max(1,e[On.MIPMAPCOUNT_INDEX]));const c=e[On.HEADER_WIDTH_INDEX],u=e[On.HEADER_HEIGHT_INDEX],h=e[On.HEADER_SIZE_INDEX]+4;return An(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:s,internalFormat:o})}function vn(t,e){return(t+3>>2)*(e+3>>2)*8}function In(t,e){return(t+3>>2)*(e+3>>2)*16}const Bn=55727696,Ln=1347834371,Gn=13,Un=52,Nn=0,Hn=2,kn=4,Fn=6,Xn=7,jn=11,zn=12,Kn={0:[Mn.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Mn.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Mn.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Mn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Mn.COMPRESSED_RGB_ETC1_WEBGL],7:[Mn.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Mn.COMPRESSED_RGB8_ETC2],23:[Mn.COMPRESSED_RGBA8_ETC2_EAC],24:[Mn.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Mn.COMPRESSED_R11_EAC],26:[Mn.COMPRESSED_RG11_EAC],27:[Mn.COMPRESSED_RGBA_ASTC_4X4_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Mn.COMPRESSED_RGBA_ASTC_5X4_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Mn.COMPRESSED_RGBA_ASTC_5X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Mn.COMPRESSED_RGBA_ASTC_6X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Mn.COMPRESSED_RGBA_ASTC_6X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Mn.COMPRESSED_RGBA_ASTC_8X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Mn.COMPRESSED_RGBA_ASTC_8X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Mn.COMPRESSED_RGBA_ASTC_8X8_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Mn.COMPRESSED_RGBA_ASTC_10X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Mn.COMPRESSED_RGBA_ASTC_10X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Mn.COMPRESSED_RGBA_ASTC_10X8_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Mn.COMPRESSED_RGBA_ASTC_10X10_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Mn.COMPRESSED_RGBA_ASTC_12X10_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Mn.COMPRESSED_RGBA_ASTC_12X12_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Wn={0:qn,1:qn,2:Vn,3:Vn,6:$n,7:$n,9:Qn,11:Qn,22:$n,23:Qn,24:$n,25:$n,26:Qn,27:Qn,28:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16},29:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16},30:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16},31:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16},32:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16},33:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16},34:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16},35:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16},36:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16},37:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16},38:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16},39:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16},40:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16}};function qn(t,e){return(t=Math.max(t,16))*(e=Math.max(e,8))/4}function Vn(t,e){return(t=Math.max(t,8))*(e=Math.max(e,8))/2}function $n(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8}function Qn(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16}function Zn(t){if(function(t){const e=new Uint8Array(t.buffer||t,t.byteOffset||0,Dn.length);return!(e[0]!==Dn[0]||e[1]!==Dn[1]||e[2]!==Dn[2]||e[3]!==Dn[3]||e[4]!==Dn[4]||e[5]!==Dn[5]||e[6]!==Dn[6]||e[7]!==Dn[7]||e[8]!==Dn[8]||e[9]!==Dn[9]||e[10]!==Dn[10]||e[11]!==Dn[11])}(t))return Pn(t);if(function(t){return new Uint32Array(t,0,On.HEADER_LENGTH)[On.MAGIC_NUMBER_INDEX]===On.MAGIC_NUMBER}(t))return xn(t);if(function(t){const e=new Uint32Array(t,0,Gn)[Nn];return e===Bn||e===Ln}(t))return function(t){const e=new Uint32Array(t,0,Gn),r=e[Hn],n=e[kn],i=Kn[r]||[],o=i.length>1&&n?i[1]:i[0],s=Wn[r],a=e[jn],c=e[Xn],u=e[Fn],h=Un+e[zn];return An(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:s,internalFormat:o})}(t);throw new Error("Texture container format not recognized")}const Yn={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.0.13",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/"}}},Jn={...Yn,parse:async t=>Zn(t)};function ti(t,e=null){return e?`${t}?token=${e}`:t}var ei=5121,ri=5125,ni=5126,ii=5130;const oi={UInt8:Uint8Array,UInt16:Uint16Array,UInt32:Uint32Array,Float32:Float32Array,UInt64:Float64Array},si={UInt8:ei,UInt16:ri,Float32:ni,UInt32:ri,UInt64:ii},ai={position:"position",normal:"normal",uv0:"uv0",color:"color",region:"region"},ci={vertexAttributes:"vertexAttributes",featureAttributeOrder:"featureAttributeOrder",featureAttributes:"featureAttributes"},ui="header",hi="vertexCount",li="featureCount",fi={UInt8:1,UInt16:2,UInt32:4,Float32:4,UInt64:8},di=new ge([0,0,0]),_i={jpeg:Rr,png:Rr,"ktx-etc2":Jn,dds:Jn};async function mi(t,e,r,n,i){if(e.content=e.content||{},e.content.featureIds=e.content.featureIds||null,e.content.featureData=function(t,e){const r=e.store.defaultGeometrySchema,n=r;for(const t in ci)for(const e in ai){const i=r[t][e];if(i){const{byteOffset:r=0,count:o=0,valueType:s,valuesPerElement:a}=i;n[t][e]={valueType:s,valuesPerElement:a,byteOffset:r,count:o}}}return n.attributesOrder=r.ordering,n}(0,r),e.content.attributes={},e.textureUrl){var o;const t=ti(e.textureUrl,null==n||null===(o=n.i3s)||void 0===o?void 0:o.token),r=_i[e.textureFormat]||Rr,s=await fetch(t),a=await s.arrayBuffer();if(r===Rr){const t={image:{type:"data"}};e.content.texture=await i.parse(a,t)}else if(r===Jn){const t=await kt(a,Jn);e.content.texture={compressed:!0,mipmaps:!1,width:t[0].width,height:t[0].height,data:t}}}return e.content.material=function(t,e){let r;t?r={...t,pbrMetallicRoughness:t.pbrMetallicRoughness?{...t.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},e?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=yi(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=yi(r.pbrMetallicRoughness.baseColorFactor));return function(t,e){const r={source:{image:e}};t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?t.pbrMetallicRoughness.baseColorTexture={...t.pbrMetallicRoughness.baseColorTexture,texture:r}:t.emissiveTexture?t.emissiveTexture={...t.emissiveTexture,texture:r}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?t.pbrMetallicRoughness.metallicRoughnessTexture={...t.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:t.normalTexture?t.normalTexture={...t.normalTexture,texture:r}:t.occlusionTexture&&(t.occlusionTexture={...t.occlusionTexture,texture:r})}(r,e),r}(e.materialDefinition,e.content.texture),e.content.material&&(e.content.texture=null),await async function(t,e={},r){if(!e.content)return e;const n=e.content;let i,o,s=0,a=0;if(e.isDracoGeometry){const e=await Ht(t,un,{draco:{attributeNameEntry:"i3s-attribute-type"}});o=e.header.vertexCount;const r=e.indices.value,{POSITION:n,NORMAL:s,COLOR_0:a,TEXCOORD_0:c,"feature-index":u,"uv-region":h}=e.attributes;i={position:n,normal:s,color:a,uv0:c,uvRegion:h,id:u,indices:r},function(t,e){for(const r in e.loaderData.attributes){const n=e.loaderData.attributes[r];switch(n.name){case"POSITION":t.position.metadata=n.metadata;break;case"feature-index":t.id.metadata=n.metadata}}}(i,e);const l=function(t){return t&&t.metadata&&t.metadata["i3s-feature-ids"]&&t.metadata["i3s-feature-ids"].intArray}(u);l&&function(t,e){const r=t.id.value,n=new Float32Array(r.length);for(let t=0;t<r.length;t++)n[t]=e[r[t]];t.id.value=n}(i,l)}else{const{vertexAttributes:e,attributesOrder:r,featureAttributes:c,featureAttributeOrder:u}=n.featureData,h=function(t,e){let r=0,n=0,i=0;const o=t.featureData[ui];for(const t in o){const{property:s,type:a}=o[t],c=oi[a];s===hi&&(n=new c(e,0,4)[0],r+=fi[a]),s===li&&(i=new c(e,4,4)[0],r+=fi[a])}return{vertexCount:n,featureCount:i,byteOffset:r}}(n,t);s=h.byteOffset,o=h.vertexCount,a=h.featureCount;const{attributes:l,byteOffset:f}=gi(t,s,e,o,r),{attributes:d}=gi(t,f,c,a,u);!function(t){const{id:e,faceRange:r}=t;if(!e||!r)return;const n=e.value,i=r.value,o=i[i.length-1]+1,s=new Uint32Array(3*o);let a=0,c=0;for(let t=1;t<i.length;t+=2){const e=Number(n[a]),r=i[t],o=i[t-1],u=c+3*(r-o+1);s.fill(e,c,u),a++,c=u}t.id.value=s}(d),i=function(t,e){return{...t,...e}}(l,d)}const{enuMatrix:c,cartographicOrigin:u,cartesianOrigin:h}=function(t,e){const r=e.mbs,n=t.value,i=t.metadata,o=new De,s=new ge(r[0],r[1],r[2]),a=new ge;return tr.WGS84.cartographicToCartesian(s,a),tr.WGS84.eastNorthUpToFixedFrame(a,o),t.value=function(t,e={},r){const n=new Float64Array(t.length),i=e["i3s-scale_x"]&&e["i3s-scale_x"].double||1,o=e["i3s-scale_y"]&&e["i3s-scale_y"].double||1;for(let e=0;e<n.length;e+=3)n[e]=t[e]*i+r.x,n[e+1]=t[e+1]*o+r.y,n[e+2]=t[e+2]+r.z;for(let t=0;t<n.length;t+=3)tr.WGS84.cartographicToCartesian(n.subarray(t,t+3),di),n[t]=di.x,n[t+1]=di.y,n[t+2]=di.z;return n}(n,i,s),{enuMatrix:o,fixedFrameToENUMatrix:o.invert(),cartographicOrigin:s,cartesianOrigin:a}}(i.position,e),l=(new De).multiplyRight(c);n.attributes={positions:i.position,normals:i.normal,colors:pi(i.color),texCoords:i.uv0,uvRegions:pi(i.uvRegion)},n.indices=i.indices||null,i.id&&i.id.value&&(e.content.featureIds=i.id.value);for(const t in n.attributes)n.attributes[t]||delete n.attributes[t];return n.vertexCount=o,n.cartographicCenter=u,n.cartesianOrigin=h,n.modelMatrix=l.invert(),n.byteLength=t.byteLength,e}(t,e)}function pi(t){return t?(t.normalized=!0,t):t}function gi(t,e,r,n,i){const o={};for(const s of i)if(r[s]){const{valueType:i,valuesPerElement:a}=r[s],c=n;if(e+c*a>t.byteLength)break;const u=t.slice(e);let h=[];if("UInt64"===i)h=Si(u,c*a,fi[i]);else{h=new(0,oi[i])(u,0,c*a)}switch(o[s]={value:h,type:si[i],size:a},s){case"color":o.color.normalized=!0}e+=c*a*fi[i]}return{attributes:o,byteOffset:e}}function Si(t,e,r){const n=[],i=new DataView(t);let o=0;for(let t=0;t<e;t++){const t=i.getUint32(o,!0)+2**32*i.getUint32(o+4,!0);n.push(t),o+=r}return n}function yi(t){const e=[...t];for(let r=0;r<t.length;r++)e[r]=t[r]/255;return e}const Ei={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:"3.0.13",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const{tile:n,tileset:i}=(null==e?void 0:e.i3s)||{};return await mi(t,n,i,e,r),n.content},extensions:["bin"],options:{"i3s-content":{}}};const Ri=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new ge,new ge;const wi=new ge,Ai=new ge;class bi{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new ge,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=wi.from(e),this.center=(new ge).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 bi(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,i=t.radius,o=wi.copy(n).subtract(e),s=o.magnitude();if(r>=s+i)return this.clone();if(i>=s+r)return t.clone();const a=.5*(r+s+i);return Ai.copy(o).scale((-r+a)/s).add(e),this.center.copy(Ai),this.radius=a,this}expand(t){const e=(t=wi.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=Re(wi,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){return(t=wi.from(t)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}intersectPlane(t){const e=this.center,r=this.radius,n=t.normal.dot(e)+t.distance;return n<-r?Ri.OUTSIDE:n<r?Ri.INTERSECTING:Ri.INSIDE}}function Ti(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=r[0],d=r[1],_=r[2],m=r[3],p=r[4],g=r[5],S=r[6],y=r[7],E=r[8];return t[0]=f*n+d*s+_*u,t[1]=f*i+d*a+_*h,t[2]=f*o+d*c+_*l,t[3]=m*n+p*s+g*u,t[4]=m*i+p*a+g*h,t[5]=m*o+p*c+g*l,t[6]=S*n+y*s+E*u,t[7]=S*i+y*a+E*h,t[8]=S*o+y*c+E*l,t}function Mi(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const Ci=Object.freeze([1,0,0,0,1,0,0,0,1]),Di=Object.freeze([0,0,0,0,0,0,0,0,0]),Pi=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Oi={};class xi extends Se{static get IDENTITY(){return Oi.IDENTITY=Oi.IDENTITY||Object.freeze(new xi(Ci)),Oi.IDENTITY}static get ZERO(){return Oi.ZERO=Oi.ZERO||Object.freeze(new xi(Di)),Oi.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Pi}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,i,o,s,a,c){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,r,n,i,o,s,a,c){return this[0]=t,this[1]=n,this[2]=s,this[3]=e,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=c,this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8],e*(u*o-s*c)+r*(-u*i+s*a)+n*(c*i-o*a);var t,e,r,n,i,o,s,a,c,u}identity(){return this.copy(Ci)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,h=n*s,l=n*a,f=i*s,d=i*a,_=i*c,m=o*s,p=o*a,g=o*c;t[0]=1-l-_,t[3]=h-g,t[6]=f+p,t[1]=h+g,t[4]=1-u-_,t[7]=d-m,t[2]=f-p,t[5]=d+m,t[8]=1-u-l}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}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(){var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_;return t=this,r=(e=this)[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],h=e[8],(_=r*(l=h*s-a*u)+n*(f=-h*o+a*c)+i*(d=u*o-s*c))&&(_=1/_,t[0]=l*_,t[1]=(-h*n+i*u)*_,t[2]=(a*n-i*s)*_,t[3]=f*_,t[4]=(h*r-i*c)*_,t[5]=(-a*r+i*o)*_,t[6]=d*_,t[7]=(-u*r+n*c)*_,t[8]=(s*r-n*o)*_),this.check()}multiplyLeft(t){return Ti(this,t,this),this.check()}multiplyRight(t){return Ti(this,this,t),this.check()}rotate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_;return e=this,n=t,i=(r=this)[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=Math.sin(n),_=Math.cos(n),e[0]=_*i+d*a,e[1]=_*o+d*c,e[2]=_*s+d*u,e[3]=_*a-d*i,e[4]=_*c-d*o,e[5]=_*u-d*s,e[6]=h,e[7]=l,e[8]=f,this.check()}scale(t){return Array.isArray(t)?Mi(this,this,t):Mi(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_;return e=this,n=t,i=(r=this)[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=n[0],_=n[1],e[0]=i,e[1]=o,e[2]=s,e[3]=a,e[4]=c,e[5]=u,e[6]=d*i+_*a+h,e[7]=d*o+_*c+l,e[8]=d*s+_*u+f,this.check()}transform(t,e){switch(t.length){case 2:r=e||[-0,-0],i=this,o=(n=t)[0],s=n[1],r[0]=i[0]*o+i[3]*s+i[6],r[1]=i[1]*o+i[4]*s+i[7],e=r;break;case 3:e=le(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n+r[3]*i+r[6]*o,t[1]=r[1]*n+r[4]*i+r[7]*o,t[2]=r[2]*n+r[5]*i+r[8]*o,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var r,n,i,o,s;return Jt(e,t.length),e}transformVector(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}}function vi(){var t=new ie(4);return ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ii(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 Bi(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=r[0],c=r[1],u=r[2],h=r[3];return t[0]=n*h+s*a+i*u-o*c,t[1]=i*h+s*c+o*a-n*u,t[2]=o*h+s*u+n*c-i*a,t[3]=s*h-n*a-i*c-o*u,t}function Li(t,e,r,n){var i,o,s,a,c,u=e[0],h=e[1],l=e[2],f=e[3],d=r[0],_=r[1],m=r[2],p=r[3];return(o=u*d+h*_+l*m+f*p)<0&&(o=-o,d=-d,_=-_,m=-m,p=-p),1-o>ne?(i=Math.acos(o),s=Math.sin(i),a=Math.sin((1-n)*i)/s,c=Math.sin(n*i)/s):(a=1-n,c=n),t[0]=a*u+c*d,t[1]=a*h+c*_,t[2]=a*l+c*m,t[3]=a*f+c*p,t}function Gi(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 i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}var Ui,Ni,Hi,ki,Fi,Xi,ji,zi=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},Ki=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},Wi=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},qi=function(t,e,r,n){var i=e[0],o=e[1],s=e[2],a=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=s+n*(r[2]-s),t[3]=a+n*(r[3]-a),t},Vi=we,$i=Ae,Qi=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=n*s,t[2]=i*s,t[3]=o*s,t},Zi=(Ui=oe(),Ni=ae(1,0,0),Hi=ae(0,1,0),function(t,e,r){var n=ce(e,r);return n<-.999999?(ue(Ui,Ni,e),de(Ui)<1e-6&&ue(Ui,Hi,e),function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o}(Ui,Ui),Ii(t,Ui,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(ue(Ui,e,r),t[0]=Ui[0],t[1]=Ui[1],t[2]=Ui[2],t[3]=1+n,Qi(t,t))});ki=vi(),Fi=vi(),Xi=new ie(9),ie!=Float32Array&&(Xi[1]=0,Xi[2]=0,Xi[3]=0,Xi[5]=0,Xi[6]=0,Xi[7]=0),Xi[0]=1,Xi[4]=1,Xi[8]=1,ji=Xi;const Yi=[0,0,0,1];class Ji extends Zt{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 Gi(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 Ii(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]=Yt(t)}get y(){return this[1]}set y(t){this[1]=Yt(t)}get z(){return this[2]}set z(t){this[2]=Yt(t)}get w(){return this[3]}set w(t){this[3]=Yt(t)}len(){return Vi(this)}lengthSquared(){return $i(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return Wi(this,t)}rotationTo(t,e){return Zi(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return zi(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],n=e[1],i=e[2];t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(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],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;t[0]=-r*a,t[1]=-n*a,t[2]=-i*a,t[3]=o*a}(this,this),this.check()}lerp(t,e,r){return qi(this,t,e,r),this.check()}multiplyRight(t,e){return Ft(!e),Bi(this,this,t),this.check()}multiplyLeft(t,e){return Ft(!e),Bi(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],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+s*a,t[1]=i*c+o*a,t[2]=o*c-i*a,t[3]=s*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-o*a,t[1]=i*c+s*a,t[2]=o*c+n*a,t[3]=s*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+i*a,t[1]=i*c-n*a,t[2]=o*c+s*a,t[3]=s*c-o*a}(this,this,t),this.check()}scale(t){return Ki(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=Yi,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return Li(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2],u=r[3],h=u*n+a*o-c*i,l=u*i+c*n-s*o,f=u*o+s*i-a*n,d=-s*n-a*i-c*o;t[0]=h*u+d*-s+l*-c-f*-a,t[1]=l*u+d*-a+f*-s-h*-c,t[2]=f*u+d*-c+h*-a-l*-s,t[3]=e[3]}(e,t,this),Jt(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)}}const to=new ge,eo=new ge,ro=new ge,no=new ge,io=new ge,oo=new ge,so=new ge,ao=0,co=1,uo=2,ho=3,lo=4,fo=5,_o=6,mo=7,po=8;class go{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new ge).from(t),this.halfAxes=new xi(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new ge(t).len(),new ge(e).len(),new ge(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new ge(t).normalize(),i=new ge(e).normalize(),o=new ge(r).normalize();return(new Ji).fromMatrix3(new xi([...n,...i,...o]))}fromCenterHalfSizeQuaternion(t,e,r){const n=new Ji(r),i=(new xi).fromQuaternion(n);return i[0]=i[0]*e[0],i[1]=i[1]*e[0],i[2]=i[2]*e[0],i[3]=i[3]*e[1],i[4]=i[4]*e[1],i[5]=i[5]*e[1],i[6]=i[6]*e[2],i[7]=i[7]*e[2],i[8]=i[8]*e[2],this.center=(new ge).from(t),this.halfAxes=i,this}clone(){return new go(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new bi){const e=this.halfAxes,r=e.getColumn(0,ro),n=e.getColumn(1,no),i=e.getColumn(2,io),o=to.copy(r).add(n).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,n=this.halfAxes,i=r.x,o=r.y,s=r.z,a=Math.abs(i*n[ao]+o*n[co]+s*n[uo])+Math.abs(i*n[ho]+o*n[lo]+s*n[fo])+Math.abs(i*n[_o]+o*n[mo]+s*n[po]),c=r.dot(e)+t.distance;return c<=-a?Ri.OUTSIDE:c>=a?Ri.INSIDE:Ri.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=eo.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,ro),i=r.getColumn(1,no),o=r.getColumn(2,io),s=n.magnitude(),a=i.magnitude(),c=o.magnitude();n.normalize(),i.normalize(),o.normalize();let u,h=0;return u=Math.abs(e.dot(n))-s,u>0&&(h+=u*u),u=Math.abs(e.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(e.dot(o))-c,u>0&&(h+=u*u),h}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const o=this.center,s=this.halfAxes,a=s.getColumn(0,ro),c=s.getColumn(1,no),u=s.getColumn(2,io),h=oo.copy(a).add(c).add(u).add(o),l=so.copy(h).subtract(t);let f=e.dot(l);return n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).add(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).subtract(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).subtract(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).add(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).add(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).subtract(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).subtract(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),r[0]=n,r[1]=i,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,ro);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,no);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,io);return n.transformAsPoint(t),this.halfAxes=new xi([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const So=new ge,yo=new ge;class Eo{constructor(t=[0,0,1],e=0){this.normal=new ge,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Ft(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=So.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),Ft(Qt(this.normal.len(),1)),this.distance=n,this}clone(t){return new Eo(this.normal,this.distance)}equals(t){return Qt(this.distance,t.distance)&&Qt(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=yo.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=So.from(t);const r=this.getPointDistance(t),n=yo.copy(this.normal).scale(r);return t.subtract(n).to(e)}}new ge([1,0,0]),new ge([0,1,0]),new ge([0,0,1]),new ge,new ge,new Eo(new ge(1,0,0),0);new ge,new ge,new ge,new ge,new ge;new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,Math.PI;new xi,new xi,new xi,new xi,new xi;new ge,new ge,new ge,new ge,new ge,new xi,new xi,new xi;const Ro=2,wo="mesh",Ao="I3S",bo=["","WEBKIT_","MOZ_"],To={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 Mo=null;function Co(t){if(!Mo){t=t||function(){try{return document.createElement("canvas").getContext("webgl")}catch(t){return null}}()||void 0,Mo=new Set;for(const e of bo)for(const r in To)if(t&&t.getExtension(`${e}${r}`)){const t=To[r];Mo.add(t)}}return Mo}async function Do(t){return JSON.parse((new TextDecoder).decode(t))}const Po={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.0.13",mimeTypes:["application/json"],parse:async function(t){return t=Do(t)},extensions:["json"],options:{}};function Oo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class xo{constructor(t,e){Oo(this,"tileset",void 0),Oo(this,"nodePages",void 0),Oo(this,"nodesPerPage",void 0),Oo(this,"options",void 0),Oo(this,"lodSelectionMetricType",void 0),Oo(this,"textureDefinitionsSelectedFormats",void 0),this.tileset={...t},this.nodesPerPage=t.nodePages.nodesPerPage,this.lodSelectionMetricType=t.nodePages.lodSelectionMetricType,this.options=e,this.nodePages=[],this.textureDefinitionsSelectedFormats=[],this._initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){const e=Math.floor(t/this.nodesPerPage);if(!this.nodePages[e]){var r;const t=ti(`${this.tileset.url}/nodepages/${e}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.nodePages[e]=kt(t,Po,this.options),this.nodePages[e]=await this.nodePages[e]}this.nodePages[e]instanceof Promise&&(this.nodePages[e]=await this.nodePages[e]);const n=t%this.nodesPerPage;return this.nodePages[e].nodes[n]}async formTileFromNodePages(t){const e=await this.getNodeById(t),r=[];for(const t of e.children||[]){const e=await this.getNodeById(t);r.push({id:t,obb:e.obb})}let n=null,i=null,o=null,s="jpeg",a=[],c=!1;if(e&&e.mesh){const{url:t,isDracoGeometry:r}=e.mesh.geometry&&this._getContentUrl(e.mesh.geometry)||{url:null,isDracoGeometry:null};n=t,c=r;const[u,h]=this._getInformationFromMaterial(e.mesh.material);o=h,s=u.format||s,u.name&&(i=`${this.tileset.url}/nodes/${e.mesh.material.resource}/textures/${u.name}`),this.tileset.attributeStorageInfo&&(a=function(t,e){const r=[],{attributeStorageInfo:n,url:i}=t;for(let t=0;t<n.length;t++){const o=n[t].key;r.push(`${i}/nodes/${e}/attributes/${o}/0`)}return r}(this.tileset,e.mesh.attribute.resource))}return vo({id:t,lodSelection:this._getLodSelection(e),obb:e.obb,contentUrl:n,textureUrl:i,attributeUrls:a,materialDefinition:o,textureFormat:s,children:r,isDracoGeometry:c})}_getContentUrl(t){let e={};const r=this.tileset.geometryDefinitions[t.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(t=>t.compressedAttributes&&"draco"===t.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(t=>!t.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);e={url:`${this.tileset.url}/nodes/${t.resource}/geometries/${n}`,isDracoGeometry:i}}return e}_getLodSelection(t){const e=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&e.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(.25*Math.PI))}),e.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),e}_getInformationFromMaterial(t){const e={name:null,format:null};if(t){const r=this.tileset.materialDefinitions[t.definition],n=r&&r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;if(n||0===n){return[this.textureDefinitionsSelectedFormats[n]||e,r]}return[e,r]}return[e,null]}_initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];const e=this._getSupportedTextureFormats(),r=t.textureSetDefinitions||[];for(const t of r){const r=t&&t.formats||[];let n=null;for(const t of e){const e=r.find(e=>e.format===t);if(e){n=e;break}}this.textureDefinitionsSelectedFormats.push(n)}}_getSupportedTextureFormats(){const t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const e=Co();e.has("etc2")&&t.push("ktx-etc2"),e.has("dxt")&&t.push("dds")}return t.push("jpg"),t.push("png"),t}}function vo(t){const e=t.obb?[...tr.WGS84.cartographicToCartesian(t.obb.center),...t.obb.halfSize,...t.obb.quaternion]:void 0;let r;if(t.mbs)r=[...tr.WGS84.cartographicToCartesian(t.mbs.slice(0,3)),t.mbs[3]];else if(e){const n=(new go).fromCenterHalfSizeQuaternion(e.slice(0,3),t.obb.halfSize,t.obb.quaternion).getBoundingSphere();r=[...n.center,n.radius],t.mbs=[...t.obb.center,n.radius]}return t.boundingVolume={sphere:r,box:e},t.lodMetricType=t.lodSelection[0].metricType,t.lodMetricValue=t.lodSelection[0].maxError,t.transformMatrix=t.transform,t.type=wo,t.refine=Ro,t}const Io=/layers\/[0-9]+$/,Bo=/nodes\/([0-9-]+|root)$/,Lo={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.0.13",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const n=r.url;e.i3s=e.i3s||{};if("504b0304"===function(t){if(t instanceof ArrayBuffer)return[...new Uint8Array(t,0,4)].map(t=>t.toString(16).padStart(2,"0")).join("");return null}(t))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,o;i="auto"===e.i3s.isTileset?Io.test(n):e.i3s.isTileset;o="auto"===e.isTileHeader?Bo.test(n):e.i3s.isTileHeader;i?t=await async function(t,e,r){const n=JSON.parse((new TextDecoder).decode(t));return n.loader=Lo,await async function(t,e,r){if(t.url=r.url,t.nodePages)t.nodePagesTile=new xo(t,e),t.root=await t.nodePagesTile.formTileFromNodePages(0);else{var n;const r=ti(t.url+"/nodes/root",null===(n=e.i3s)||void 0===n?void 0:n.token);t.root=await kt(r,t.loader,{i3s:{loadContent:!1,isTileHeader:!0,isTileset:!1}})}t.basePath=t.url,t.type=Ao,t.lodMetricType=t.root.lodMetricType,t.lodMetricValue=t.root.lodMetricValue}(n,e,r),n}(t,e,r):o?(t=await async function(t,e,r){return function(t,e,r){return t.url=r.url,t.featureData&&(t.featureUrl=`${t.url}/${t.featureData[0].href}`),t.geometryData&&(t.contentUrl=`${t.url}/${t.geometryData[0].href}`),t.textureData&&(t.textureUrl=`${t.url}/${t.textureData[0].href}`),t.attributeData&&(t.attributeUrls=function(t){const{url:e,attributeData:r}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(t)),vo(t)}(t=JSON.parse((new TextDecoder).decode(t)),0,r)}(t,0,r),e.i3s.loadContent&&(e.i3s.tile=t,await kt(t.contentUrl,Lo,e))):t=await async function(t,e){return await Ht(t,Ei,e)}(t,e);return t},extensions:["bin"],options:{i3s:{loadContent:!0,token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,useDracoGeometry:!0,useCompressedTextures:!0}}};async function Go(t,e){const{attributeName:r,attributeType:n}=e;return r?{[r]:n?Uo(n,t):null}:{}}function Uo(t,e){switch(t){case"String":return function(t){const e=[];try{const r=new DataView(t,0,4).getUint32(0,!0),n=new Uint32Array(t,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),o=new Uint8Array(t,i,r);e.push(n.decode(o)),i+=r}}catch(t){console.error("Parse string attribute error: ",t.message)}return e}(e);case"Oid32":return No(e);case"Float64":return function(t){return new Float64Array(t,8)}(e);default:return No(e)}}function No(t){return new Uint32Array(t,4)}const Ho={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.0.13",mimeTypes:["application/binary"],parse:async function(t,e){return t=Go(t,e)},extensions:["bin"],options:{},binary:!0};async function ko(t,e,r={}){const{attributeStorageInfo:n,attributeUrls:i}=function(t){const e=t&&t.tileset&&t.tileset.tileset&&t.tileset.tileset.attributeStorageInfo,r=t&&t.header&&t.header.attributeUrls;return{attributeStorageInfo:e,attributeUrls:r}}(t);if(!n||!i||!e)return null;let o=[];const s=[];for(let t=0;t<n.length;t++){var a;const e=ti(i[t],null===(a=r.i3s)||void 0===a?void 0:a.token),o=n[t].name,c=Fo(n[t]),u={...r,attributeName:o,attributeType:c},h=kt(e,Ho,u);s.push(h)}try{o=await Promise.allSettled(s)}catch(t){}return o.length?function(t,e,r){const n=t.find(t=>t.value.OBJECTID);if(!n)return null;const i=n.value.OBJECTID.indexOf(r);if(i<0)return null;return function(t,e,r){const n={};for(let i=0;i<r.length;i++){const o=r[i].name,s=Xo(t,i,o);n[o]=jo(s,e)}return n}(t,i,e)}(o,n,e):null}function Fo(t){return t.hasOwnProperty("objectIds")?"Oid32":t.hasOwnProperty("attributeValues")?t.attributeValues.valueType:""}function Xo(t,e,r){const n=t[e];return"rejected"===n.status?null:n.value[r]}function jo(t,e){return t&&t[e]?t[e].toString().replace(/\u0000/g,"").trim():""}},,,,,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window||{},s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);a&&parseFloat(a[1])}).call(this,r(5),r(4))}])}));
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=14)}([,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s})),r.d(e,"d",(function(){return a})),r.d(e,"c",(function(){return c}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window||{},s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a="function"==typeof importScripts,c="undefined"!=typeof window&&void 0!==window.orientation,u=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);u&&parseFloat(u[1])}).call(this,r(5),r(4))},,function(t,e,r){"use strict";(function(t,n){r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document,process:"object"==typeof n&&n},o=i.window||i.self||i.global,s=i.process||{};console}).call(this,r(5),r(4))},function(t,e){var r,n,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var t=a(f);h=!0;for(var e=u.length;e;){for(c=u,u=[];++l<e;)c&&c[l].run();l=-1,e=u.length}c=null,h=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function _(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new _(t,e)),1!==u.length||h||a(d)},_.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window,s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);a&&parseFloat(a[1])}).call(this,r(5),r(4))},function(t,e){},function(t,e){},,,function(t,e,r){"use strict";(function(t){r.d(e,"a",(function(){return i}));var n=r(12);function i(){return!("object"==typeof t&&"[object process]"===String(t)&&!t.browser)||Object(n.a)()}}).call(this,r(4))},function(t,e,r){"use strict";(function(t){function n(e){if("undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type)return!0;if(void 0!==t&&"object"==typeof t.versions&&Boolean(t.versions.electron))return!0;const r="object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent,n=e||r;return!!(n&&n.indexOf("Electron")>=0)}r.d(e,"a",(function(){return n}))}).call(this,r(4))},,function(t,e,r){(function(e){const n=r(18),i="undefined"==typeof window?e:window;i.loaders=i.loaders||{},t.exports=Object.assign(i.loaders,n)}).call(this,r(5))},,,function(t,e){},function(t,e,r){"use strict";r.r(e),r.d(e,"I3SLoader",(function(){return Lo})),r.d(e,"I3SContentLoader",(function(){return Ei})),r.d(e,"I3SAttributeLoader",(function(){return Ho})),r.d(e,"loadFeatureAttributes",(function(){return ko}));const n=t=>"boolean"==typeof t,i=t=>"function"==typeof t,o=t=>null!==t&&"object"==typeof t,s=t=>o(t)&&t.constructor==={}.constructor,a=t=>t&&"function"==typeof t[Symbol.iterator],c=t=>t&&"function"==typeof t[Symbol.asyncIterator],u=t=>"undefined"!=typeof Response&&t instanceof Response||t&&t.arrayBuffer&&t.text&&t.json,h=t=>"undefined"!=typeof Blob&&t instanceof Blob,l=t=>(t=>"undefined"!=typeof ReadableStream&&t instanceof ReadableStream||o(t)&&i(t.tee)&&i(t.cancel)&&i(t.getReader))(t)||(t=>o(t)&&i(t.read)&&i(t.pipe)&&n(t.readable))(t);function f(t,e){if(!t)throw new Error(e||"loader assertion failed.")}function d(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 _(t){var e,r;let n;return f(t,"null loader"),f(d(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}var m=r(23);let p="";const g={};const S=/^data:([-\w.]+\/[-\w.+]+)(;|,)/,y=/^([-\w.]+\/[-\w.+]+)/;function E(t){const e=y.exec(t);return e?e[1]:t}function R(t){const e=S.exec(t);return e?e[1]:""}const w=/\?.*/;function A(t){if(u(t)){const e=b(t.url||"");return{url:e,type:E(t.headers.get("content-type")||"")||R(e)}}return h(t)?{url:b(t.name||""),type:t.type||""}:"string"==typeof t?{url:b(t),type:R(t)}:{url:"",type:""}}function b(t){return t.replace(w,"")}async function T(t){if(u(t))return t;const e={},r=function(t){return u(t)?t.headers["content-length"]||-1:h(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:i}=A(t);i&&(e["content-type"]=i);const o=await async function(t){if("string"==typeof t)return"data:,"+t.slice(0,5);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 e=t.slice(0,5);return"data:base64,"+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)}(e)}return null}(t);o&&(e["x-first-bytes"]=o),"string"==typeof t&&(t=(new TextEncoder).encode(t));const s=new Response(t,{headers:e});return Object.defineProperty(s,"url",{value:n}),s}async function M(t){if(!t.ok){const e=await async function(t){let e=`Failed to fetch resource ${t.url} (${t.status}): `;try{const r=t.headers.get("Content-Type");let n=t.statusText;r.includes("application/json")&&(n+=" "+await t.text()),e+=n,e=e.length>60?e.slice(60)+"...":e}catch(t){}return e}(t);throw new Error(e)}}async function C(t,e){if("string"==typeof t){t=function(t){for(const e in g)if(t.startsWith(e)){const r=g[e];t=t.replace(e,r)}return t.startsWith("http://")||t.startsWith("https://")||(t=`${p}${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 T(t)}var D=r(11);const P=Object(D.a)();class O{constructor(t,e,r="sessionStorage"){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 x(t,e,r,n=600){const i=t.src.replace(/\(/g,"%28").replace(/\)/g,"%29");t.width>n&&(r=Math.min(r,n/t.width));const o=t.width*r,s=t.height*r,a=["font-size:1px;","padding:".concat(Math.floor(s/2),"px ").concat(Math.floor(o/2),"px;"),"line-height:".concat(s,"px;"),"background:url(".concat(i,");"),"background-size:".concat(o,"px ").concat(s,"px;"),"color:transparent;"].join("");return["".concat(e," %c+"),a]}const v={BLACK:30,RED:31,GREEN:32,YELLOW:33,BLUE:34,MAGENTA:35,CYAN:36,WHITE:37,BRIGHT_BLACK:90,BRIGHT_RED:91,BRIGHT_GREEN:92,BRIGHT_YELLOW:93,BRIGHT_BLUE:94,BRIGHT_MAGENTA:95,BRIGHT_CYAN:96,BRIGHT_WHITE:97};function I(t){return"string"==typeof t?v[t.toUpperCase()]||v.WHITE:t}function B(t,e){if(!t)throw new Error(e||"Assertion failed")}var L=r(3);function G(){let t;if(P&&L.b.performance)t=L.b.performance.now();else if(L.a.hrtime){const e=L.a.hrtime();t=1e3*e[0]+e[1]/1e6}else t=Date.now();return t}const U={debug:P&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},N={enabled:!0,level:0};function H(){}const k={},F={once:!0};function X(t){for(const e in t)for(const r in t[e])return r||"untitled";return"empty"}class j{constructor({id:t}={id:""}){this.id=t,this.VERSION="3.0.14",this._startTs=G(),this._deltaTs=G(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new O("__probe-".concat(this.id,"__"),N),this.userData={},this.timeStamp("".concat(this.id," started")),function(t,e=["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((G()-this._startTs).toPrecision(10))}getDelta(){return Number((G()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._storage.updateConfiguration({enabled:t}),this}setLevel(t){return this._storage.updateConfiguration({level:t}),this}assert(t,e){B(t,e)}warn(t){return this._getLogFunction(0,t,U.warn,arguments,F)}error(t){return this._getLogFunction(0,t,U.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,U.log,arguments,{time:!0,once:!0})}log(t,e){return this._getLogFunction(t,e,U.debug,arguments)}info(t,e){return this._getLogFunction(t,e,console.info,arguments)}once(t,e){return this._getLogFunction(t,e,U.debug||U.info,arguments,F)}table(t,e,r){return e?this._getLogFunction(t,e,console.table||H,r&&[r],{tag:X(e)}):H}image({logLevel:t,priority:e,image:n,message:i="",scale:o=1}){return this._shouldLog(t||e)?P?function({image:t,message:e="",scale:r=1}){if("string"==typeof t){const n=new Image;return n.onload=()=>{const t=x(n,e,r);console.log(...t)},n.src=t,H}const n=t.nodeName||"";if("img"===n.toLowerCase())return console.log(...x(t,e,r)),H;if("canvas"===n.toLowerCase()){const n=new Image;return n.onload=()=>console.log(...x(n,e,r)),n.src=t.toDataURL(),H}return H}({image:n,message:i,scale:o}):function({image:t,message:e="",scale:n=1}){let i=null;try{i=r(17)}catch(t){}if(i)return()=>i(t,{fit:"box",width:"".concat(Math.round(80*n),"%")}).then(t=>console.log(t));return H}({image:n,message:i,scale:o}):H}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}get(t){return this._storage.config[t]}set(t,e){this._storage.updateConfiguration({[t]:e})}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||H)}group(t,e,r={collapsed:!1}){r=K({logLevel:t,message:e,opts:r});const{collapsed:n}=r;return r.method=(n?console.groupCollapsed:console.group)||console.info,this._getLogFunction(r)}groupCollapsed(t,e,r={}){return this.group(t,e,Object.assign({},r,{collapsed:!0}))}groupEnd(t){return this._getLogFunction(t,"",console.groupEnd||H)}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()>=z(t)}_getLogFunction(t,e,r,n=[],i){if(this._shouldLog(t)){i=K({logLevel:t,message:e,args:n,opts:i}),B(r=r||i.method),i.total=this.getTotal(),i.delta=this.getDelta(),this._deltaTs=G();const o=i.tag||i.message;if(i.once){if(k[o])return H;k[o]=G()}return e=function(t,e,r){if("string"==typeof e){const s=r.time?function(t,e=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(s," ").concat(e):"".concat(t,": ").concat(e),n=e,i=r.color,o=r.background,P||"string"!=typeof n||(i&&(i=I(i),n="[".concat(i,"m").concat(n,"[39m")),o&&(i=I(o),n="[".concat(o+10,"m").concat(n,"[49m"))),e=n}var n,i,o;return e}(this.id,i.message,i),r.bind(console,e,...i.args)}return H}}function z(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 B(Number.isFinite(e)&&e>=0),e}function K(t){const{logLevel:e,message:r}=t;t.logLevel=z(e);const n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(t.args=n,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 i=typeof t.message;return B("string"===i||"object"===i),Object.assign(t,t.opts)}j.VERSION="3.0.14";const W=new j({id:"loaders.gl"});class q{log(){return()=>{}}info(){return()=>{}}warn(){return()=>{}}error(){return()=>{}}}const V={fetch:null,mimeType:void 0,nothrow:!1,log:new class{constructor(){var t,e,r;r=void 0,(e="console")in(t=this)?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,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:[]},$={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 Q(){m.a.loaders=m.a.loaders||{};const{loaders:t}=m.a;return t._state=t._state||{},t._state}const Z=()=>{const t=Q();return t.globalOptions=t.globalOptions||{...V},t.globalOptions};function Y(t,e,r,n){return r=r||[],function(t,e){tt(t,null,V,$,e);for(const r of e){const n=t&&t[r.id]||{},i=r.options&&r.options[r.id]||{},o=r.deprecatedOptions&&r.deprecatedOptions[r.id]||{};tt(n,r.id,i,o,e)}}(t,r=Array.isArray(r)?r:[r]),rt(e,t,n)}function J(t,e){const r=Z(),n=t||r;return"function"==typeof n.fetch?n.fetch:o(n.fetch)?t=>C(t,n):null!=e&&e.fetch?null==e?void 0:e.fetch:C}function tt(t,e,r,n,i){const s=e||"Top level",a=e?e+".":"";for(const c in t){const u=!e&&o(t[c]),h="baseUri"===c&&!e,l="workerUrl"===c&&e;if(!(c in r)&&!h&&!l)if(c in n)W.warn(`${s} loader option '${a}${c}' no longer supported, use '${n[c]}'`)();else if(!u){const t=et(c,i);W.warn(`${s} loader option '${a}${c}' not recognized. ${t}`)()}}}function et(t,e){const r=t.toLowerCase();let n="";for(const i of e)for(const e in i.options){if(t===e)return`Did you mean '${i.id}.${e}'?`;const o=e.toLowerCase();(r.startsWith(o)||o.startsWith(r))&&(n=n||`Did you mean '${i.id}.${e}'?`)}return n}function rt(t,e,r){const n={...t.options||{}};return function(t,e){e&&!("baseUri"in t)&&(t.baseUri=e)}(n,r),null===n.log&&(n.log=new q),nt(n,Z()),nt(n,e),n}function nt(t,e){for(const r in e)if(r in e){const n=e[r];s(n)&&s(t[r])?t[r]={...t[r],...e[r]}:t[r]=e[r]}}function it(t,e){if(!t)throw new Error(e||"loaders.gl assertion failed.")}var ot=r(1);const st=new Map;function at(t){it(t.source&&!t.url||!t.source&&t.url);let e=st.get(t.source||t.url);return e||(t.url&&(e=function(t){if(!t.startsWith("http"))return t;return ct((e=t,`try {\n importScripts('${e}');\n} catch (error) {\n console.error(error);\n throw error;\n}`));var e}(t.url),st.set(t.url,e)),t.source&&(e=ct(t.source),st.set(t.source,e))),it(e),e}function ct(t){const e=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(e)}function ut(t){return!!t&&(t instanceof ArrayBuffer||("undefined"!=typeof MessagePort&&t instanceof MessagePort||("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas)))}function ht(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const lt=()=>{};class ft{static isSupported(){return"undefined"!=typeof Worker}constructor(t){ht(this,"name",void 0),ht(this,"source",void 0),ht(this,"url",void 0),ht(this,"terminated",!1),ht(this,"worker",void 0),ht(this,"onMessage",void 0),ht(this,"onError",void 0),ht(this,"_loadableURL","");const{name:e,source:r,url:n}=t;it(r||n),this.name=e,this.source=r,this.url=n,this.onMessage=lt,this.onError=t=>console.log(t),this.worker=this._createBrowserWorker()}destroy(){this.onMessage=lt,this.onError=lt,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||function t(e,r=!0,n){const i=n||new Set;if(e){if(ut(e))i.add(e);else if(ut(e.buffer))i.add(e.buffer);else if(ArrayBuffer.isView(e));else if(r&&"object"==typeof e)for(const n in e)t(e[n],r,i)}else;return void 0===n?Array.from(i):[]}(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name}. `,t.message&&(e+=t.message+" in "),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=at({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}}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class _t{constructor(t,e){dt(this,"name",void 0),dt(this,"workerThread",void 0),dt(this,"isRunning",void 0),dt(this,"result",void 0),dt(this,"_resolve",void 0),dt(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){it(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){it(this.isRunning),this.isRunning=!1,this._reject(t)}}function mt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class pt{constructor(t){mt(this,"name","unnamed"),mt(this,"source",void 0),mt(this,"url",void 0),mt(this,"maxConcurrency",1),mt(this,"maxMobileConcurrency",1),mt(this,"onDebug",()=>{}),mt(this,"reuseWorkers",!0),mt(this,"props",{}),mt(this,"jobQueue",[]),mt(this,"idleQueue",[]),mt(this,"count",0),mt(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 _t(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=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new ft({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return ot.c?this.maxMobileConcurrency:this.maxConcurrency}}function gt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const St={maxConcurrency:3,maxMobileConcurrency:1,onDebug:()=>{},reuseWorkers:!0};class yt{static isSupported(){return ft.isSupported()}static getWorkerFarm(t={}){return yt._workerFarm=yt._workerFarm||new yt({}),yt._workerFarm.setProps(t),yt._workerFarm}constructor(t){gt(this,"props",void 0),gt(this,"workerPools",new Map),this.props={...St},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 i=this.workerPools.get(e);return i||(i=new pt({name:e,source:r,url:n}),i.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,i)),i}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}}gt(yt,"_workerFarm",void 0);async function Et(t,e,r,n,i){const o=t.id,s=function(t,e={}){const r=e[t.id]||{},n=t.id+"-worker.js";let i=r.workerUrl;if(i||"compression"!==t.id||(i=e.workerUrl),"test"===e._workerType&&(i=`modules/${t.module}/dist/${n}`),!i){let e=t.version;"latest"===e&&(e="latest");const r=e?"@"+e:"";i=`https://unpkg.com/@loaders.gl/${t.module}${r}/dist/${n}`}return it(i),i}(t,r),a=yt.getWorkerFarm(r).getWorkerPool({name:o,url:s});r=JSON.parse(JSON.stringify(r));const c=await a.startJob("process-on-worker",Rt.bind(null,i));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(n.error);break;case"process":const{id:i,input:o,options:s}=n;try{const r=await t(o,s);e.postMessage("done",{id:i,result:r})}catch(t){const r=t instanceof Error?t.message:"unknown error";e.postMessage("error",{id:i,error:r})}break;default:console.warn("parse-with-worker unknown message "+r)}}var wt=r(7);function At(t){var e;if((e=t)&&"object"==typeof e&&e.isBuffer&&(t=function(t){return wt.toArrayBuffer?wt.toArrayBuffer(t):t}(t)),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")}async function bt(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 i=0;for(const t of e)n.set(t,i),i+=t.byteLength;return n.buffer}(...e)}const Tt=262144;function Mt(t,e){return m.b?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:i,value:o}=await t;if(i)return;yield At(o)}}catch(t){r.releaseLock()}}(t,e):async function*(t,e){for await(const e of t)yield At(e)}(t)}function Ct(t,e){if("string"==typeof t)return function*(t,e){const r=(null==e?void 0:e.chunkSize)||262144;let n=0;const i=new TextEncoder;for(;n<t.length;){const e=Math.min(t.length-n,r),o=t.slice(n,n+e);n+=e,yield i.encode(o)}}(t,e);if(t instanceof ArrayBuffer)return function*(t,e={}){const{chunkSize:r=Tt}=e;let n=0;for(;n<t.byteLength;){const e=Math.min(t.byteLength-n,r),i=new ArrayBuffer(e),o=new Uint8Array(t,n,e);new Uint8Array(i).set(o),n+=e,yield i}}(t,e);if(h(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,i=await t.slice(n,e).arrayBuffer();n=e,yield i}}(t,e);if(l(t))return Mt(t,e);if(u(t)){return Mt(t.body,e)}throw new Error("makeIterator")}const Dt="Cannot convert supplied data type";async function Pt(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;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(r)}return 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(Dt)}(t,e);if(h(t)&&(t=await T(t)),u(t)){const r=t;return await M(r),e.binary?await r.arrayBuffer():await r.text()}if(l(t)&&(t=Ct(t,r)),a(t)||c(t))return bt(t);throw new Error(Dt)}const Ot=()=>{const t=Q();return t.loaderRegistry=t.loaderRegistry||[],t.loaderRegistry};const xt=/\.([^.]+)$/;function vt(t,e=[],r,n){if(!It(t))return null;if(e&&!Array.isArray(e))return _(e);let i=[];e&&(i=i.concat(e)),null!=r&&r.ignoreRegisteredLoaders||i.push(...Ot()),function(t){for(const e of t)_(e)}(i);const o=function(t,e,r,n){const{url:i,type:o}=A(t),s=i||(null==n?void 0:n.url);let a=null;null!=r&&r.mimeType&&(a=Lt(e,null==r?void 0:r.mimeType));return a=a||function(t,e){const r=e&&xt.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,s),a=a||Lt(e,o),a=a||function(t,e){if(!e)return null;for(const r of t)if("string"==typeof e){if(Gt(e,r))return r}else if(ArrayBuffer.isView(e)){if(Ut(e.buffer,e.byteOffset,r))return r}else if(e instanceof ArrayBuffer){if(Ut(e,0,r))return r}return null}(e,t),a=a||Lt(e,null==r?void 0:r.fallbackMimeType),a}(t,i,r,n);if(!(o||null!=r&&r.nothrow))throw new Error(Bt(t));return o}function It(t){return!(t instanceof Response&&204===t.status)}function Bt(t){const{url:e,type:r}=A(t);let n="No valid loader found";return t&&(n+=` data: "${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)}", contentType: "${r}"`),e&&(n+=" url: "+e),n}function Lt(t,e){for(const r of t){if(r.mimeTypes&&r.mimeTypes.includes(e))return r;if(e==="application/x."+r.id)return r}return null}function Gt(t,e){if(e.testText)return e.testText(t);return(Array.isArray(e.tests)?e.tests:[e.tests]).some(e=>t.startsWith(e))}function Ut(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),i=new Uint8Array(e);for(let t=0;t<n.length;++t)if(n[t]!==i[t])return!1;return!0}(n,t,n.byteLength);switch(typeof n){case"function":return n(t,r);case"string":const i=Nt(t,e,n.length);return n===i;default:return!1}}(t,e,r,n))}function Nt(t,e,r){if(t.byteLength<e+r)return"";const n=new DataView(t);let i="";for(let t=0;t<r;t++)i+=String.fromCharCode(n.getUint8(e+t));return i}async function Ht(t,e,r,n){it(!n||"object"==typeof n),!e||Array.isArray(e)||d(e)||(n=void 0,r=e,e=void 0),t=await t,r=r||{};const{url:i}=A(t),o=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),s=await async function(t,e=[],r,n){if(!It(t))return null;let i=vt(t,e,{...r,nothrow:!0},n);if(i)return i;if(h(t)&&(i=vt(t=await t.slice(0,10).arrayBuffer(),e,r,n)),!(i||null!=r&&r.nothrow))throw new Error(Bt(t));return i}(t,o,r);return s?(n=function(t,e,r=null){if(r)return r;const n={fetch:J(e,t),...t};return Array.isArray(n.loaders)||(n.loaders=null),n}({url:i,parse:Ht,loaders:o},r=Y(r,s,o,i),n),await async function(t,e,r,n){if(function(t,e="3.0.14"){it(t,"no worker provided");const r=t.version}(t),e=await Pt(e,t,r),t.parseTextSync&&"string"==typeof e)return r.dataType="text",t.parseTextSync(e,r,n,t);if(function(t,e){return!!yt.isSupported()&&(t.worker&&(null==e?void 0:e.worker))}(t,r))return await Et(t,e,r,0,Ht);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 it(!t.parseSync),new Error(t.id+" loader - no parser found and worker is disabled")}(s,t,r,n)):null}async function kt(t,e,r,n){Array.isArray(e)||d(e)||(void 0,r=e,e=void 0);const i=J(r);let o=t;return"string"==typeof t&&(o=await i(t)),h(t)&&(o=await i(t)),await Ht(o,e,r)}function Ft(t,e){if(!t)throw new Error("math.gl assertion ".concat(e))}const Xt=1/Math.PI*180,jt=1/180*Math.PI,zt={};function Kt(t,{precision:e=zt.precision||4}={}){return t=function(t){return Math.round(t/zt.EPSILON)*zt.EPSILON}(t),"".concat(parseFloat(t.toPrecision(e)))}function Wt(t){return Array.isArray(t)||ArrayBuffer.isView(t)&&!(t instanceof DataView)}function qt(t,e,r){if(Wt(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 Vt(t){return function(t,e){return qt(t,t=>t*jt,e)}(t)}function $t(t){return function(t,e){return qt(t,t=>t*Xt,e)}(t)}function Qt(t,e,r){const n=zt.EPSILON;r&&(zt.EPSILON=r);try{if(t===e)return!0;if(Wt(t)&&Wt(e)){if(t.length!==e.length)return!1;for(let r=0;r<t.length;++r)if(!Qt(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)<=zt.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))}finally{zt.EPSILON=n}}zt.EPSILON=1e-12,zt.debug=!1,zt.precision=4,zt.printTypes=!1,zt.printDegrees=!1,zt.printRowMajor=!0;class Zt 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 Ft(!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:Wt(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(zt)}formatString(t){let e="";for(let r=0;r<this.ELEMENTS;++r)e+=(r>0?", ":"")+Kt(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(!Qt(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 i=t[n];this[n]=i+r*(e[n]-i)}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(zt.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 Yt(t){if(!Number.isFinite(t))throw new Error("Invalid number ".concat(t));return t}function Jt(t,e,r=""){if(zt.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 te={};function ee(t,e){te[t]||(te[t]=!0,console.warn("".concat(t," has been removed in version ").concat(e,", see upgrade guide for more information")))}class re extends Zt{get ELEMENTS(){return Ft(!1),0}copy(t){return Ft(!1),this}get x(){return this[0]}set x(t){this[0]=Yt(t)}get y(){return this[1]}set y(t){this[1]=Yt(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 Yt(e)}dot(t){let e=0;for(let r=0;r<this.ELEMENTS;++r)e+=this[r]*t[r];return Yt(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 Ft(t>=0&&t<this.ELEMENTS,"index is out of range"),Yt(this[t])}setComponent(t,e){return Ft(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 ne=1e-6,ie="undefined"!=typeof Float32Array?Float32Array:Array;Math.random;Math.PI;function oe(){var t=new ie(3);return ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function se(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function ae(t,e,r){var n=new ie(3);return n[0]=t,n[1]=e,n[2]=r,n}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ue(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2];return t[0]=i*c-o*a,t[1]=o*s-n*c,t[2]=n*a-i*s,t}function he(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,t[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,t[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,t[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,t}function le(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var fe,de=se;fe=oe();function _e(t,e,r){const n=e[0],i=e[1],o=e[2],s=r[3]*n+r[7]*i+r[11]*o||1;return t[0]=(r[0]*n+r[4]*i+r[8]*o)/s,t[1]=(r[1]*n+r[5]*i+r[9]*o)/s,t[2]=(r[2]*n+r[6]*i+r[10]*o)/s,t}const me=[0,0,0],pe={};class ge extends re{static get ZERO(){return pe.ZERO=pe.ZERO||Object.freeze(new ge(0,0,0,0))}constructor(t=0,e=0,r=0){super(-0,-0,-0),1===arguments.length&&Wt(t)?this.copy(t):(zt.debug&&(Yt(t),Yt(e),Yt(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 zt.debug&&(Yt(t.x),Yt(t.y),Yt(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]=Yt(t)}angle(t){return r=t,n=(e=this)[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2],u=Math.sqrt(n*n+i*i+o*o)*Math.sqrt(s*s+a*a+c*c),h=u&&ce(e,r)/u,Math.acos(Math.min(Math.max(h,-1),1));var e,r,n,i,o,s,a,c,u,h}cross(t){return ue(this,this,t),this.check()}rotateX({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[0],a[1]=s[1]*Math.cos(o)-s[2]*Math.sin(o),a[2]=s[1]*Math.sin(o)+s[2]*Math.cos(o),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateY({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[2]*Math.sin(o)+s[0]*Math.cos(o),a[1]=s[1],a[2]=s[2]*Math.cos(o)-s[0]*Math.sin(o),r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}rotateZ({radians:t,origin:e=me}){var r,n,i,o,s,a;return r=this,i=e,o=t,a=[],(s=[])[0]=(n=this)[0]-i[0],s[1]=n[1]-i[1],s[2]=n[2]-i[2],a[0]=s[0]*Math.cos(o)-s[1]*Math.sin(o),a[1]=s[0]*Math.sin(o)+s[1]*Math.cos(o),a[2]=s[2],r[0]=a[0]+i[0],r[1]=a[1]+i[1],r[2]=a[2]+i[2],this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return he(this,this,t),this.check()}transformAsVector(t){return _e(this,this,t),this.check()}transformByMatrix3(t){return le(this,this,t),this.check()}transformByMatrix2(t){return function(t,e,r){const n=e[0],i=e[1];t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t[2]=e[2]}(this,this,t),this.check()}transformByQuaternion(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g;return e=this,r=this,i=(n=t)[0],o=n[1],s=n[2],a=n[3],c=r[0],u=r[1],h=r[2],_=o*(d=i*u-o*c)-s*(f=s*c-i*h),m=s*(l=o*h-s*u)-i*d,p=i*f-o*l,l*=g=2*a,f*=g,d*=g,_*=2,m*=2,p*=2,e[0]=c+l+_,e[1]=u+f+m,e[2]=h+d+p,this.check()}}class Se extends Zt{get ELEMENTS(){return Ft(!1),0}get RANK(){return Ft(!1),0}toString(){let t="[";if(zt.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]=Yt(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 ye(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=e[9],d=e[10],_=e[11],m=e[12],p=e[13],g=e[14],S=e[15],y=r[0],E=r[1],R=r[2],w=r[3];return t[0]=y*n+E*a+R*l+w*m,t[1]=y*i+E*c+R*f+w*p,t[2]=y*o+E*u+R*d+w*g,t[3]=y*s+E*h+R*_+w*S,y=r[4],E=r[5],R=r[6],w=r[7],t[4]=y*n+E*a+R*l+w*m,t[5]=y*i+E*c+R*f+w*p,t[6]=y*o+E*u+R*d+w*g,t[7]=y*s+E*h+R*_+w*S,y=r[8],E=r[9],R=r[10],w=r[11],t[8]=y*n+E*a+R*l+w*m,t[9]=y*i+E*c+R*f+w*p,t[10]=y*o+E*u+R*d+w*g,t[11]=y*s+E*h+R*_+w*S,y=r[12],E=r[13],R=r[14],w=r[15],t[12]=y*n+E*a+R*l+w*m,t[13]=y*i+E*c+R*f+w*p,t[14]=y*o+E*u+R*d+w*g,t[15]=y*s+E*h+R*_+w*S,t}function Ee(t,e,r){var n=r[0],i=r[1],o=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]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Re(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],s=e[5],a=e[6],c=e[8],u=e[9],h=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,s,a),t[2]=Math.hypot(c,u,h),t}!function(){var t,e=(t=new ie(2),ie!=Float32Array&&(t[0]=0,t[1]=0),t)}();function we(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function Ae(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}!function(){var t,e=(t=new ie(4),ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();const be=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),Te=Object.freeze([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Me=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}),Ce={};class De extends Se{static get IDENTITY(){return Ce.IDENTITY=Ce.IDENTITY||Object.freeze(new De(be)),Ce.IDENTITY}static get ZERO(){return Ce.ZERO=Ce.ZERO||Object.freeze(new De(Te)),Ce.ZERO}get INDICES(){return Me}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,i,o,s,a,c,u,h,l,f,d,_,m){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=c,this[9]=u,this[10]=h,this[11]=l,this[12]=f,this[13]=d,this[14]=_,this[15]=m,this.check()}setRowMajor(t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m){return this[0]=t,this[1]=i,this[2]=c,this[3]=f,this[4]=e,this[5]=o,this[6]=u,this[7]=d,this[8]=r,this[9]=s,this[10]=h,this[11]=_,this[12]=n,this[13]=a,this[14]=l,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(be)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,h=n*s,l=n*a,f=i*s,d=i*a,_=i*c,m=o*s,p=o*a,g=o*c;t[0]=1-l-_,t[1]=h+g,t[2]=f-p,t[3]=0,t[4]=h-g,t[5]=1-u-_,t[6]=d+m,t[7]=0,t[8]=f+p,t[9]=d-m,t[10]=1-u-l,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:i,far:o}){return o===1/0?De._computeInfinitePerspectiveOffCenter(this,t,e,r,n,i):function(t,e,r,n,i,o,s){var a=1/(r-e),c=1/(i-n),u=1/(o-s);t[0]=2*o*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*c,t[6]=0,t[7]=0,t[8]=(r+e)*a,t[9]=(i+n)*c,t[10]=(s+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=s*o*2*u,t[15]=0}(this,t,e,r,n,i,o),this.check()}static _computeInfinitePerspectiveOffCenter(t,e,r,n,i,o){const s=2*o/(r-e),a=2*o/(i-n),c=(r+e)/(r-e),u=(i+n)/(i-n),h=-2*o;return t[0]=s,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]=h,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 i,o,s,a,c,u,h,l,f,d,_=e[0],m=e[1],p=e[2],g=n[0],S=n[1],y=n[2],E=r[0],R=r[1],w=r[2];Math.abs(_-E)<ne&&Math.abs(m-R)<ne&&Math.abs(p-w)<ne?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):(h=_-E,l=m-R,f=p-w,i=S*(f*=d=1/Math.hypot(h,l,f))-y*(l*=d),o=y*(h*=d)-g*f,s=g*l-S*h,(d=Math.hypot(i,o,s))?(i*=d=1/d,o*=d,s*=d):(i=0,o=0,s=0),a=l*s-f*o,c=f*i-h*s,u=h*o-l*i,(d=Math.hypot(a,c,u))?(a*=d=1/d,c*=d,u*=d):(a=0,c=0,u=0),t[0]=i,t[1]=a,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=l,t[7]=0,t[8]=s,t[9]=u,t[10]=f,t[11]=0,t[12]=-(i*_+o*m+s*p),t[13]=-(a*_+c*m+u*p),t[14]=-(h*_+l*m+f*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:i=.1,far:o=500}){return function(t,e,r,n,i,o,s){var a=1/(e-r),c=1/(n-i),u=1/(o-s);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]=(i+n)*c,t[14]=(s+o)*u,t[15]=1}(this,t,e,r,n,i,o),this.check()}orthographic({fovy:t=45*Math.PI/180,aspect:e=1,focalDistance:r=1,near:n=.1,far:i=500}){if(t>2*Math.PI)throw Error("radians");const o=t/2,s=r*Math.tan(o),a=s*e;return(new De).ortho({left:-a,right:a,bottom:-s,top:s,near:n,far:i})}perspective({fovy:t,fov:e=45*Math.PI/180,aspect:r=1,near:n=.1,far:i=500}={}){if((t=t||e)>2*Math.PI)throw Error("radians");return function(t,e,r,n,i){var o,s=1/Math.tan(e/2);t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,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!=i&&i!==1/0?(o=1/(n-i),t[10]=(i+n)*o,t[14]=2*i*n*o):(t[10]=-1,t[14]=-2*n)}(this,t,r,n,i),this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8],h=t[9],l=t[10],f=t[11],d=t[12],_=t[13],m=t[14],p=t[15],(e*s-r*o)*(l*p-f*m)-(e*a-n*o)*(h*p-f*_)+(e*c-i*o)*(h*m-l*_)+(r*a-n*s)*(u*p-f*d)-(r*c-i*s)*(u*m-l*d)+(n*c-i*a)*(u*_-h*d);var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p}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],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=0,t[4]=this[4]*n,t[5]=this[5]*i,t[6]=this[6]*o,t[7]=0,t[8]=this[8]*n,t[9]=this[9]*i,t[10]=this[10]*o,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],i=1/r[1],o=1/r[2];return t[0]=this[0]*n,t[1]=this[1]*i,t[2]=this[2]*o,t[3]=this[4]*n,t[4]=this[5]*i,t[5]=this[6]*o,t[6]=this[8]*n,t[7]=this[9]*i,t[8]=this[10]*o,t}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],s=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]=o,t[11]=e[14],t[12]=i,t[13]=s,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(){var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g,S,y,E,R,w,A,b,T,M,C,D,P,O;return t=this,r=(e=this)[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],h=e[8],l=e[9],f=e[10],d=e[11],_=e[12],m=e[13],p=e[14],g=e[15],(O=(S=r*a-n*s)*(P=f*g-d*p)-(y=r*c-i*s)*(D=l*g-d*m)+(E=r*u-o*s)*(C=l*p-f*m)+(R=n*c-i*a)*(M=h*g-d*_)-(w=n*u-o*a)*(T=h*p-f*_)+(A=i*u-o*c)*(b=h*m-l*_))&&(O=1/O,t[0]=(a*P-c*D+u*C)*O,t[1]=(i*D-n*P-o*C)*O,t[2]=(m*A-p*w+g*R)*O,t[3]=(f*w-l*A-d*R)*O,t[4]=(c*M-s*P-u*T)*O,t[5]=(r*P-i*M+o*T)*O,t[6]=(p*E-_*A-g*y)*O,t[7]=(h*A-f*E+d*y)*O,t[8]=(s*D-a*M+u*b)*O,t[9]=(n*M-r*D-o*b)*O,t[10]=(_*w-m*E+g*S)*O,t[11]=(l*E-h*w-d*S)*O,t[12]=(a*T-s*C-c*b)*O,t[13]=(r*C-n*T+i*b)*O,t[14]=(m*y-_*R-p*S)*O,t[15]=(h*R-l*y+f*S)*O),this.check()}multiplyLeft(t){return ye(this,t,this),this.check()}multiplyRight(t){return ye(this,this,t),this.check()}rotateX(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[4],a=r[5],c=r[6],u=r[7],h=r[8],l=r[9],f=r[10],d=r[11],r!==e&&(e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[4]=s*o+h*i,e[5]=a*o+l*i,e[6]=c*o+f*i,e[7]=u*o+d*i,e[8]=h*o-s*i,e[9]=l*o-a*i,e[10]=f*o-c*i,e[11]=d*o-u*i,this.check()}rotateY(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[0],a=r[1],c=r[2],u=r[3],h=r[8],l=r[9],f=r[10],d=r[11],r!==e&&(e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=s*o-h*i,e[1]=a*o-l*i,e[2]=c*o-f*i,e[3]=u*o-d*i,e[8]=s*i+h*o,e[9]=a*i+l*o,e[10]=c*i+f*o,e[11]=u*i+d*o,this.check()}rotateZ(t){var e,r,n,i,o,s,a,c,u,h,l,f,d;return e=this,r=this,n=t,i=Math.sin(n),o=Math.cos(n),s=r[0],a=r[1],c=r[2],u=r[3],h=r[4],l=r[5],f=r[6],d=r[7],r!==e&&(e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15]),e[0]=s*o+h*i,e[1]=a*o+l*i,e[2]=c*o+f*i,e[3]=u*o+d*i,e[4]=h*o-s*i,e[5]=l*o-a*i,e[6]=f*o-c*i,e[7]=d*o-u*i,this.check()}rotateXYZ([t,e,r]){return this.rotateX(t).rotateY(e).rotateZ(r)}rotateAxis(t,e){return function(t,e,r,n){var i,o,s,a,c,u,h,l,f,d,_,m,p,g,S,y,E,R,w,A,b,T,M,C,D=n[0],P=n[1],O=n[2],x=Math.hypot(D,P,O);x<ne||(D*=x=1/x,P*=x,O*=x,i=Math.sin(r),s=1-(o=Math.cos(r)),a=e[0],c=e[1],u=e[2],h=e[3],l=e[4],f=e[5],d=e[6],_=e[7],m=e[8],p=e[9],g=e[10],S=e[11],y=D*D*s+o,E=P*D*s+O*i,R=O*D*s-P*i,w=D*P*s-O*i,A=P*P*s+o,b=O*P*s+D*i,T=D*O*s+P*i,M=P*O*s-D*i,C=O*O*s+o,t[0]=a*y+l*E+m*R,t[1]=c*y+f*E+p*R,t[2]=u*y+d*E+g*R,t[3]=h*y+_*E+S*R,t[4]=a*w+l*A+m*b,t[5]=c*w+f*A+p*b,t[6]=u*w+d*A+g*b,t[7]=h*w+_*A+S*b,t[8]=a*T+l*M+m*C,t[9]=c*T+f*M+p*C,t[10]=u*T+d*M+g*C,t[11]=h*T+_*M+S*C,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)?Ee(this,this,t):Ee(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_,m,p,g,S;return e=this,r=this,p=(n=t)[0],g=n[1],S=n[2],r===e?(e[12]=r[0]*p+r[4]*g+r[8]*S+r[12],e[13]=r[1]*p+r[5]*g+r[9]*S+r[13],e[14]=r[2]*p+r[6]*g+r[10]*S+r[14],e[15]=r[3]*p+r[7]*g+r[11]*S+r[15]):(i=r[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=r[9],_=r[10],m=r[11],e[0]=i,e[1]=o,e[2]=s,e[3]=a,e[4]=c,e[5]=u,e[6]=h,e[7]=l,e[8]=f,e[9]=d,e[10]=_,e[11]=m,e[12]=i*p+c*g+f*S+r[12],e[13]=o*p+u*g+d*S+r[13],e[14]=s*p+h*g+_*S+r[14],e[15]=a*p+l*g+m*S+r[15]),this.check()}transform(t,e){return 4===t.length?(r=e||[-0,-0,-0,-0],i=this,o=(n=t)[0],s=n[1],a=n[2],c=n[3],r[0]=i[0]*o+i[4]*s+i[8]*a+i[12]*c,r[1]=i[1]*o+i[5]*s+i[9]*a+i[13]*c,r[2]=i[2]*o+i[6]*s+i[10]*a+i[14]*c,r[3]=i[3]*o+i[7]*s+i[11]*a+i[15]*c,Jt(e=r,4),e):this.transformAsPoint(t,e);var r,n,i,o,s,a,c}transformAsPoint(t,e){const{length:r}=t;switch(r){case 2:n=e||[-0,-0],o=this,s=(i=t)[0],a=i[1],n[0]=o[0]*s+o[4]*a+o[12],n[1]=o[1]*s+o[5]*a+o[13],e=n;break;case 3:e=he(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var n,i,o,s,a;return Jt(e,t.length),e}transformAsVector(t,e){switch(t.length){case 2:e=function(t,e,r){const n=e[0],i=e[1],o=r[3]*n+r[7]*i||1;return t[0]=(r[0]*n+r[4]*i)/o,t[1]=(r[1]*n+r[5]*i)/o,t}(e||[-0,-0],t,this);break;case 3:e=_e(e||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return Jt(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 ee("Matrix4.transformPoint","3.0"),this.transformAsPoint(t,e)}transformVector(t,e){return ee("Matrix4.transformVector","3.0"),this.transformAsPoint(t,e)}transformDirection(t,e){return ee("Matrix4.transformDirection","3.0"),this.transformAsVector(t,e)}}var Pe=.1,Oe=1e-12,xe=1e-15;Math.PI,Math.PI,Math.PI,Math.PI;Math.max(6378137,6378137,6356752.314245179);const ve=t=>t,Ie=new ge;function Be(t,e,r=ve){return Wt(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}function Le(t,e,r=ve){return Wt(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}const Ge=new ge,Ue=new ge,Ne=new ge;const He=new ge,ke={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"}},Fe={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Xe={east:new ge,north:new ge,up:new ge,west:new ge,south:new ge,down:new ge},je=new ge,ze=new ge,Ke=new ge;function We(t,e,r,n,i,o){const s=ke[e]&&ke[e][r];let a,c,u;Ft(s&&(!n||n===s));const h=He.copy(i);if(Qt(h.x,0,1e-14)&&Qt(h.y,0,1e-14)){const t=Math.sign(h.z);a=je.fromArray(Fe[e]),"east"!==e&&"west"!==e&&a.scale(t),c=ze.fromArray(Fe[r]),"east"!==r&&"west"!==r&&c.scale(t),u=Ke.fromArray(Fe[n]),"east"!==n&&"west"!==n&&u.scale(t)}else{const{up:i,east:o,north:s}=Xe;o.set(-h.y,h.x,0).normalize(),t.geodeticSurfaceNormal(h,i),s.copy(i).cross(o);const{down:l,west:f,south:d}=Xe;l.copy(i).scale(-1),f.copy(o).scale(-1),d.copy(s).scale(-1),a=Xe[e],c=Xe[r],u=Xe[n]}return o[0]=a.x,o[1]=a.y,o[2]=a.z,o[3]=0,o[4]=c.x,o[5]=c.y,o[6]=c.z,o[7]=0,o[8]=u.x,o[9]=u.y,o[10]=u.z,o[11]=0,o[12]=h.x,o[13]=h.y,o[14]=h.z,o[15]=1,o}const qe=new ge,Ve=new ge,$e=new ge,Qe=new ge,Ze=new ge,Ye=new ge;let Je;class tr{static get WGS84(){return Je=Je||new tr(6378137,6378137,6356752.314245179),Je}constructor(t=0,e=0,r=0){Ft(t>=0),Ft(e>=0),Ft(r>=0),this.radii=new ge(t,e,r),this.radiiSquared=new ge(t*t,e*e,r*r),this.radiiToTheFourth=new ge(t*t*t*t,e*e*e*e,r*r*r*r),this.oneOverRadii=new ge(0===t?0:1/t,0===e?0:1/e,0===r?0:1/r),this.oneOverRadiiSquared=new ge(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=Pe,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=Ve,n=$e,[,,i]=t;this.geodeticSurfaceNormalCartographic(t,r),n.copy(this.radiiSquared).scale(r);const o=Math.sqrt(r.dot(n));return n.scale(1/o),r.scale(i),n.add(r),n.to(e)}cartesianToCartographic(t,e=[0,0,0]){Ye.from(t);const r=this.scaleToGeodeticSurface(Ye,Qe);if(!r)return;const n=this.geodeticSurfaceNormal(r,Ve),i=Ze;i.copy(Ye).subtract(r);const o=Math.atan2(n.y,n.x),s=Math.asin(n.z),a=Math.sign(ce(i,Ye))*se(i);return Le([o,s,a],e,zt._cartographicRadians?ve:$t)}eastNorthUpToFixedFrame(t,e=new De){return We(this,"east","north","up",t,e)}localFrameToFixedFrame(t,e,r,n,i=new De){return We(this,t,e,r,n,i)}geocentricSurfaceNormal(t,e=[0,0,0]){return qe.from(t).normalize().to(e)}geodeticSurfaceNormalCartographic(t,e=[0,0,0]){const r=function(t,e=Ie){return Be(t,e,zt._cartographicRadians?ve:Vt)}(t),n=r[0],i=r[1],o=Math.cos(i);return qe.set(o*Math.cos(n),o*Math.sin(n),Math.sin(i)).normalize(),qe.to(e)}geodeticSurfaceNormal(t,e=[0,0,0]){return qe.from(t).scale(this.oneOverRadiiSquared).normalize().to(e)}scaleToGeodeticSurface(t,e){return function(t,e,r=new ge){const{oneOverRadii:n,oneOverRadiiSquared:i,centerToleranceSquared:o}=e;Ge.from(t);const s=t.x,a=t.y,c=t.z,u=n.x,h=n.y,l=n.z,f=s*s*u*u,d=a*a*h*h,_=c*c*l*l,m=f+d+_,p=Math.sqrt(1/m);if(!Number.isFinite(p))return;const g=Ue;if(g.copy(t).scale(p),m<o)return g.to(r);const S=i.x,y=i.y,E=i.z,R=Ne;R.set(g.x*S*2,g.y*y*2,g.z*E*2);let w,A,b,T,M=(1-p)*t.len()/(.5*R.len()),C=0;do{M-=C,w=1/(1+M*S),A=1/(1+M*y),b=1/(1+M*E);const t=w*w,e=A*A,r=b*b;T=f*t+d*e+_*r-1;C=T/(-2*(f*(t*w)*S+d*(e*A)*y+_*(r*b)*E))}while(Math.abs(T)>Oe);return Ge.scale([w,A,b]).to(r)}(t,this,e)}scaleToGeocentricSurface(t,e=[0,0,0]){Qe.from(t);const r=Qe.x,n=Qe.y,i=Qe.z,o=this.oneOverRadiiSquared,s=1/Math.sqrt(r*r*o.x+n*n*o.y+i*i*o.z);return Qe.multiplyScalar(s).to(e)}transformPositionToScaledSpace(t,e=[0,0,0]){return Qe.from(t).scale(this.oneOverRadii).to(e)}transformPositionFromScaledSpace(t,e=[0,0,0]){return Qe.from(t).scale(this.radii).to(e)}getSurfaceNormalIntersectionWithZAxis(t,e=0,r=[0,0,0]){Ft(Qt(this.radii.x,this.radii.y,xe)),Ft(this.radii.z>0),Qe.from(t);const n=Qe.z*(1-this.squaredXOverSquaredZ);if(!(Math.abs(n)>=this.radii.z-e))return Qe.set(0,0,n).to(r)}}function er(t,e){if(!t)throw new Error(e)}var rr=r(6);const{_parseImageNode:nr}=rr.a,ir="undefined"!=typeof Image,or="undefined"!=typeof ImageBitmap,sr=Boolean(nr),ar=!!rr.b||sr;function cr(t){const e=hr(t);if(!e)throw new Error("Not an image");return e}function ur(t){switch(cr(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")}}function hr(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?"imagebitmap":"undefined"!=typeof Image&&t instanceof Image?"image":t&&"object"==typeof t&&t.data&&t.width&&t.height?"data":null}const lr=/^data:image\/svg\+xml/,fr=/\.svg((\?|#).*)?$/;function dr(t){return t&&(lr.test(t)||fr.test(t))}function _r(t,e){if(dr(e))throw new Error("SVG cannot be parsed directly to imagebitmap");return new Blob([new Uint8Array(t)])}async function mr(t,e,r){const n=function(t,e){if(dr(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,"+btoa(e)}return _r(t,e)}(t,r),i=self.URL||self.webkitURL,o="string"!=typeof n&&i.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 ${t}: ${e}`))}catch(t){n(t)}})}(o||n,e)}finally{o&&i.revokeObjectURL(o)}}const pr={};let gr=!0;async function Sr(t,e,r){let n;if(dr(r)){n=await mr(t,e,r)}else n=_r(t,r);const i=e&&e.imagebitmap;return await async function(t,e=null){!function(t){for(const e in t||pr)return!1;return!0}(e)&&gr||(e=null);if(e)try{return await createImageBitmap(t,e)}catch(t){console.warn(t),gr=!1}return await createImageBitmap(t)}(n,i)}function yr(t){const e=Er(t);return function(t){const e=Er(t);if(!(e.byteLength>=24&&2303741511===e.getUint32(0,!1)))return null;return{mimeType:"image/png",width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}(e)||function(t){const e=Er(t);if(!(e.byteLength>=3&&65496===e.getUint16(0,!1)&&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 i=2;for(;i+9<e.byteLength;){const t=e.getUint16(i,!1);if(n.has(t))return{mimeType:"image/jpeg",height:e.getUint16(i+5,!1),width:e.getUint16(i+7,!1)};if(!r.has(t))return null;i+=2,i+=e.getUint16(i,!1)}return null}(e)||function(t){const e=Er(t);if(!(e.byteLength>=10&&1195984440===e.getUint32(0,!1)))return null;return{mimeType:"image/gif",width:e.getUint16(6,!0),height:e.getUint16(8,!0)}}(e)||function(t){const e=Er(t);if(!(e.byteLength>=14&&16973===e.getUint16(0,!1)&&e.getUint32(2,!0)===e.byteLength))return null;return{mimeType:"image/bmp",width:e.getUint32(18,!0),height:e.getUint32(22,!0)}}(e)}function Er(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 Rr={id:"image",module:"images",name:"Images",version:"3.0.14",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:i}=r||{};let o;switch(function(t){switch(t){case"auto":case"data":return function(){if(or)return"imagebitmap";if(ir)return"image";if(ar)return"data";throw new Error("Install '@loaders.gl/polyfills' to parse images under Node.js")}();default:return function(t){switch(t){case"auto":return or||ir||ar;case"imagebitmap":return or;case"image":return ir;case"data":return ar;default:throw new Error(`@loaders.gl/images: image ${t} not supported in this environment`)}}(t),t}}(n)){case"imagebitmap":o=await Sr(t,e,i);break;case"image":o=await mr(t,e,i);break;case"data":o=await function(t,e){const{mimeType:r}=yr(t)||{},{_parseImageNode:n}=rr.a;return er(n),n(t,r,e)}(t,e);break;default:er(!1)}return"data"===n&&(o=ur(o)),o},tests:[t=>Boolean(yr(new DataView(t)))],options:{image:{type:"auto",decode:!0}}},wr={name:"Draco",id:"draco",module:"draco",version:"3.0.14",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}}};function Ar(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class br{constructor(t,e){Ar(this,"fields",void 0),Ar(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 br(r,this.metadata)}selectAt(...t){const e=t.map(t=>this.fields[t]).filter(Boolean);return new br(e,this.metadata)}assign(t){let e,r=this.metadata;if(t instanceof br){const n=t;e=n.fields,r=Tr(Tr(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 i=Object.values(n);return new br(i,r)}}function Tr(t,e){return new Map([...t||new Map,...e||new Map])}let Mr,Cr,Dr,Pr,Or,xr,vr,Ir;function Br(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}!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"}(Mr||(Mr={}));class Lr{static isNull(t){return t&&t.typeId===Mr.Null}static isInt(t){return t&&t.typeId===Mr.Int}static isFloat(t){return t&&t.typeId===Mr.Float}static isBinary(t){return t&&t.typeId===Mr.Binary}static isUtf8(t){return t&&t.typeId===Mr.Utf8}static isBool(t){return t&&t.typeId===Mr.Bool}static isDecimal(t){return t&&t.typeId===Mr.Decimal}static isDate(t){return t&&t.typeId===Mr.Date}static isTime(t){return t&&t.typeId===Mr.Time}static isTimestamp(t){return t&&t.typeId===Mr.Timestamp}static isInterval(t){return t&&t.typeId===Mr.Interval}static isList(t){return t&&t.typeId===Mr.List}static isStruct(t){return t&&t.typeId===Mr.Struct}static isUnion(t){return t&&t.typeId===Mr.Union}static isFixedSizeBinary(t){return t&&t.typeId===Mr.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===Mr.FixedSizeList}static isMap(t){return t&&t.typeId===Mr.Map}static isDictionary(t){return t&&t.typeId===Mr.Dictionary}get typeId(){return Mr.NONE}compareTo(t){return this===t}}Symbol.toStringTag;Symbol.toStringTag;Cr=Symbol.toStringTag;class Gr extends Lr{constructor(t,e){super(),Br(this,"isSigned",void 0),Br(this,"bitWidth",void 0),this.isSigned=t,this.bitWidth=e}get typeId(){return Mr.Int}get[Cr](){return"Int"}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}class Ur extends Gr{constructor(){super(!0,8)}}class Nr extends Gr{constructor(){super(!0,16)}}class Hr extends Gr{constructor(){super(!0,32)}}class kr extends Gr{constructor(){super(!1,8)}}class Fr extends Gr{constructor(){super(!1,16)}}class Xr extends Gr{constructor(){super(!1,32)}}const jr=32,zr=64;Dr=Symbol.toStringTag;class Kr extends Lr{constructor(t){super(),Br(this,"precision",void 0),this.precision=t}get typeId(){return Mr.Float}get[Dr](){return"Float"}toString(){return"Float"+this.precision}}class Wr extends Kr{constructor(){super(jr)}}class qr extends Kr{constructor(){super(zr)}}Symbol.toStringTag;Symbol.toStringTag;Pr=Symbol.toStringTag;Or=Symbol.toStringTag;xr=Symbol.toStringTag;vr=Symbol.toStringTag;Ir=Symbol.toStringTag;class Vr extends Lr{constructor(t,e){super(),Br(this,"listSize",void 0),Br(this,"children",void 0),this.listSize=t,this.children=[e]}get typeId(){return Mr.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get[Ir](){return"FixedSizeList"}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}function $r(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class Qr{constructor(t,e,r=!1,n=new Map){$r(this,"name",void 0),$r(this,"type",void 0),$r(this,"nullable",void 0),$r(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 Qr(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`${this.type}${this.nullable?", nullable":""}${this.metadata?", metadata: "+this.metadata:""}`}}function Zr(t,e,r){const n=r?Yr(r.metadata):void 0,i=function(t){switch(t.constructor){case Int8Array:return new Ur;case Uint8Array:return new kr;case Int16Array:return new Nr;case Uint16Array:return new Fr;case Int32Array:return new Hr;case Uint32Array:return new Xr;case Float32Array:return new Wr;case Float64Array:return new qr;default:throw new Error("array type not supported")}}(e.value);return new Qr(t,new Vr(e.size,new Qr("value",i)),!1,n)}function Yr(t){const e=new Map;for(const r in t)e.set(r+".string",JSON.stringify(t[r]));return e}function Jr(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const tn={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},en={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};class rn{constructor(t){Jr(this,"draco",void 0),Jr(this,"decoder",void 0),Jr(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),i=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,i);break;case this.draco.POINT_CLOUD:t=this.decoder.DecodeBufferToPointCloud(r,i);break;default:throw new Error("DRACO: Unknown geometry type.")}if(!t.ok()||!i.ptr){const e="DRACO decompression failed: "+t.error_msg();throw new Error(e)}const o=this._getDracoLoaderData(i,n,e),s=this._getMeshData(i,o,e),a=function(t){let e=1/0,r=1/0,n=1/0,i=-1/0,o=-1/0,s=-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],h=a[t+2];e=c<e?c:e,r=u<r?u:r,n=h<n?h:n,i=c>i?c:i,o=u>o?u:o,s=h>s?h:s}return[[e,r,n],[i,o,s]]}(s.attributes),c=function(t,e,r){const n=Yr(e.metadata),i=[],o=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=Zr(e,t[e],o[e]);i.push(r)}if(r){const t=Zr("indices",r);i.push(t)}return new br(i,n)}(s.attributes,o,s.indices);return{loader:"draco",loaderData:o,header:{vertexCount:i.num_points(),boundingBox:a},...s,schema:c}}finally{this.draco.destroy(r),i&&this.draco.destroy(i)}}_getDracoLoaderData(t,e,r){const n=this._getTopLevelMetadata(t),i=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:i}}_getDracoAttributes(t,e){const r={};for(let n=0;n<t.num_attributes();n++){const i=this.decoder.GetAttribute(t,n),o=this._getAttributeMetadata(t,n);r[i.unique_id()]={unique_id:i.unique_id(),attribute_type:i.attribute_type(),data_type:i.data_type(),num_components:i.num_components(),byte_offset:i.byte_offset(),byte_stride:i.byte_stride(),normalized:i.normalized(),attribute_index:n,metadata:o};const s=this._getQuantizationTransform(i,e);s&&(r[i.unique_id()].quantization_transform=s);const a=this._getOctahedronTransform(i,e);a&&(r[i.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.");if(t instanceof this.draco.Mesh)switch(r.topology){case"triangle-strip":return{topology:"triangle-strip",mode:4,attributes:n,indices:{value:this._getTriangleStripIndices(t),size:1}};case"triangle-list":default:return{topology:"triangle-list",mode:5,attributes:n,indices:{value:this._getTriangleListIndices(t),size:1}}}return{topology:"point-list",mode:0,attributes:n}}_getMeshAttributes(t,e,r){const n={};for(const i of Object.values(t.attributes)){const t=this._deduceAttributeName(i,r);i.name=t;const{value:o,size:s}=this._getAttributeValues(e,i);n[t]={value:o,size:s,byteOffset:i.byte_offset,byteStride:i.byte_stride,normalized:i.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=en[e.data_type],n=e.num_components,i=t.num_points()*n,o=i*r.BYTES_PER_ELEMENT,s=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(o);try{const n=this.decoder.GetAttribute(t,e.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(t,n,s,o,c),a=new r(this.draco.HEAPF32.buffer,c,i).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 tn){if(this.draco[t]===n)return tn[t]}const i=e.attributeNameEntry||"name";return t.metadata[i]?t.metadata[i].string:"CUSTOM_ATTRIBUTE_"+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}}var nn=r(8);const on={};async function sn(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(!ot.b)return`modules/${e}/dist/libs/${t}`;if(r.CDN)return it(r.CDN.startsWith("http")),`${r.CDN}/${e}@3.0.14/dist/libs/${t}`;if(ot.d)return"../src/libs/"+t;return`modules/${e}/src/libs/${t}`}(t,e,r)),on[t]=on[t]||async function(t){if(t.endsWith("wasm")){const e=await fetch(t);return await e.arrayBuffer()}if(!ot.b)return nn.requireFromFile&&await nn.requireFromFile(t);if(ot.d)return importScripts(t);const e=await fetch(t);return function(t,e){if(!ot.b)return nn.requireFromString&&nn.requireFromString(t,e);if(ot.d)return eval.call(ot.a,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 on[t]}let an;async function cn(t){const e=t.modules||{};return an=e.draco3d?an||e.draco3d.createDecoderModule({}).then(t=>({draco:t})):an||async function(t){let e,r;switch(t.draco&&t.draco.decoderType){case"js":e=await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.js","draco",t);break;case"wasm":default:[e,r]=await Promise.all([await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_wasm_wrapper.js","draco",t),await sn("https://www.gstatic.com/draco/versioned/decoders/1.4.1/draco_decoder.wasm","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 an}const un={...wr,parse:async function(t,e){const{draco:r}=await cn(e),n=new rn(r);try{return n.parseSync(t,null==e?void 0:e.draco)}finally{n.destroy()}}};new Uint8Array([0]);const hn=[171,75,84,88,32,50,48,187,13,10,26,10];var ln,fn,dn,_n,mn,pn,gn,Sn,yn;(yn=ln||(ln={}))[yn.NONE=0]="NONE",yn[yn.BASISLZ=1]="BASISLZ",yn[yn.ZSTD=2]="ZSTD",yn[yn.ZLIB=3]="ZLIB",function(t){t[t.BASICFORMAT=0]="BASICFORMAT"}(fn||(fn={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC"}(dn||(dn={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB"}(_n||(_n={})),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"}(mn||(mn={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED"}(pn||(pn={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA"}(gn||(gn={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG"}(Sn||(Sn={}));class En{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=ln.NONE,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:fn.BASICFORMAT,versionNumber:2,descriptorBlockSize:40,colorModel:dn.UNSPECIFIED,colorPrimaries:_n.SRGB,transferFunction:_n.SRGB,flags:pn.ALPHA_STRAIGHT,texelBlockDimension:{x:4,y:4,z:1,w:1},bytesPlane:[],samples:[]}],this.keyValue={},this.globalData=null}}class Rn{constructor(t,e,r,n){this._dataView=new DataView(t.buffer,t.byteOffset+e,r),this._littleEndian=n,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_skip(t){return this._offset+=t,this}_scan(t,e=0){const r=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}}function wn(t){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):Buffer.from(t).toString("utf8")}function An(t,e){const r=new Array(e.mipMapLevels);let n=e.width,i=e.height,o=0;for(let s=0;s<e.mipMapLevels;++s){const a=Tn(e,n,i,t,s),c=bn(t,s,o,a);r[s]={compressed:!0,format:e.internalFormat,data:c,width:n,height:i,levelSize:a},n=Math.max(1,n>>1),i=Math.max(1,i>>1),o+=a}return r}function bn(t,e,r,n){return Array.isArray(t)?t[e].levelData:new Uint8Array(t.buffer,t.byteOffset+r,n)}function Tn(t,e,r,n,i){return Array.isArray(n)?t.sizeFunction(n[i]):t.sizeFunction(e,r)}const Mn={COMPRESSED_RGB_S3TC_DXT1_EXT:33776,COMPRESSED_RGBA_S3TC_DXT1_EXT:33777,COMPRESSED_RGBA_S3TC_DXT3_EXT:33778,COMPRESSED_RGBA_S3TC_DXT5_EXT:33779,COMPRESSED_R11_EAC:37488,COMPRESSED_SIGNED_R11_EAC:37489,COMPRESSED_RG11_EAC:37490,COMPRESSED_SIGNED_RG11_EAC:37491,COMPRESSED_RGB8_ETC2:37492,COMPRESSED_RGBA8_ETC2_EAC:37493,COMPRESSED_SRGB8_ETC2:37494,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:37495,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:37496,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:37497,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:35840,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:35842,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:35841,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:35843,COMPRESSED_RGB_ETC1_WEBGL:36196,COMPRESSED_RGB_ATC_WEBGL:35986,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:35987,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:34798,COMPRESSED_RGBA_ASTC_4X4_KHR:37808,COMPRESSED_RGBA_ASTC_5X4_KHR:37809,COMPRESSED_RGBA_ASTC_5X5_KHR:37810,COMPRESSED_RGBA_ASTC_6X5_KHR:37811,COMPRESSED_RGBA_ASTC_6X6_KHR:37812,COMPRESSED_RGBA_ASTC_8X5_KHR:37813,COMPRESSED_RGBA_ASTC_8X6_KHR:37814,COMPRESSED_RGBA_ASTC_8X8_KHR:37815,COMPRESSED_RGBA_ASTC_10X5_KHR:37816,COMPRESSED_RGBA_ASTC_10X6_KHR:37817,COMPRESSED_RGBA_ASTC_10X8_KHR:37818,COMPRESSED_RGBA_ASTC_10X10_KHR:37819,COMPRESSED_RGBA_ASTC_12X10_KHR:37820,COMPRESSED_RGBA_ASTC_12X12_KHR:37821,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:37840,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:37841,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:37842,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:37843,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:37844,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:37845,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:37846,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:37847,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:37848,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:37849,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:37850,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:37851,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:37852,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:37853,COMPRESSED_RED_RGTC1_EXT:36283,COMPRESSED_SIGNED_RED_RGTC1_EXT:36284,COMPRESSED_RED_GREEN_RGTC2_EXT:36285,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:36286,COMPRESSED_SRGB_S3TC_DXT1_EXT:35916,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:35917,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:35918,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:35919},Cn={131:Mn.COMPRESSED_RGB_S3TC_DXT1_EXT,132:Mn.COMPRESSED_SRGB_S3TC_DXT1_EXT,133:Mn.COMPRESSED_RGBA_S3TC_DXT1_EXT,134:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,135:Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,136:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,137:Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,138:Mn.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,139:Mn.COMPRESSED_RED_RGTC1_EXT,140:Mn.COMPRESSED_SIGNED_RED_RGTC1_EXT,141:Mn.COMPRESSED_RED_GREEN_RGTC2_EXT,142:Mn.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,147:Mn.COMPRESSED_RGB8_ETC2,148:Mn.COMPRESSED_SRGB8_ETC2,149:Mn.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,150:Mn.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,151:Mn.COMPRESSED_RGBA8_ETC2_EAC,152:Mn.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,153:Mn.COMPRESSED_R11_EAC,154:Mn.COMPRESSED_SIGNED_R11_EAC,155:Mn.COMPRESSED_RG11_EAC,156:Mn.COMPRESSED_SIGNED_RG11_EAC,157:Mn.COMPRESSED_RGBA_ASTC_4x4_KHR,158:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,159:Mn.COMPRESSED_RGBA_ASTC_5x4_KHR,160:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR,161:Mn.COMPRESSED_RGBA_ASTC_5x5_KHR,162:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,163:Mn.COMPRESSED_RGBA_ASTC_6x5_KHR,164:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,165:Mn.COMPRESSED_RGBA_ASTC_6x6_KHR,166:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,167:Mn.COMPRESSED_RGBA_ASTC_8x5_KHR,168:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,169:Mn.COMPRESSED_RGBA_ASTC_8x6_KHR,170:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,171:Mn.COMPRESSED_RGBA_ASTC_8x8_KHR,172:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,173:Mn.COMPRESSED_RGBA_ASTC_10x5_KHR,174:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,175:Mn.COMPRESSED_RGBA_ASTC_10x6_KHR,176:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,177:Mn.COMPRESSED_RGBA_ASTC_10x8_KHR,178:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,179:Mn.COMPRESSED_RGBA_ASTC_10x10_KHR,180:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,181:Mn.COMPRESSED_RGBA_ASTC_12x10_KHR,182:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,183:Mn.COMPRESSED_RGBA_ASTC_12x12_KHR,184:Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,1000054e3:Mn.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,1000054001:Mn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,1000066e3:Mn.COMPRESSED_RGBA_ASTC_4x4_KHR,1000066001:Mn.COMPRESSED_RGBA_ASTC_5x4_KHR,1000066002:Mn.COMPRESSED_RGBA_ASTC_5x5_KHR,1000066003:Mn.COMPRESSED_RGBA_ASTC_6x5_KHR,1000066004:Mn.COMPRESSED_RGBA_ASTC_6x6_KHR,1000066005:Mn.COMPRESSED_RGBA_ASTC_8x5_KHR,1000066006:Mn.COMPRESSED_RGBA_ASTC_8x6_KHR,1000066007:Mn.COMPRESSED_RGBA_ASTC_8x8_KHR,1000066008:Mn.COMPRESSED_RGBA_ASTC_10x5_KHR,1000066009:Mn.COMPRESSED_RGBA_ASTC_10x6_KHR,1000066010:Mn.COMPRESSED_RGBA_ASTC_10x8_KHR,1000066011:Mn.COMPRESSED_RGBA_ASTC_10x10_KHR,1000066012:Mn.COMPRESSED_RGBA_ASTC_12x10_KHR,1000066013:Mn.COMPRESSED_RGBA_ASTC_12x12_KHR};const Dn=[171,75,84,88,32,50,48,187,13,10,26,10];function Pn(t){const e=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,hn.length);if(e[0]!==hn[0]||e[1]!==hn[1]||e[2]!==hn[2]||e[3]!==hn[3]||e[4]!==hn[4]||e[5]!==hn[5]||e[6]!==hn[6]||e[7]!==hn[7]||e[8]!==hn[8]||e[9]!==hn[9]||e[10]!==hn[10]||e[11]!==hn[11])throw new Error("Missing KTX 2.0 identifier.");const r=new En,n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Rn(t,hn.length,n,!0);r.vkFormat=i._nextUint32(),r.typeSize=i._nextUint32(),r.pixelWidth=i._nextUint32(),r.pixelHeight=i._nextUint32(),r.pixelDepth=i._nextUint32(),r.layerCount=i._nextUint32(),r.faceCount=i._nextUint32();const o=i._nextUint32();r.supercompressionScheme=i._nextUint32();const s=i._nextUint32(),a=i._nextUint32(),c=i._nextUint32(),u=i._nextUint32(),h=i._nextUint64(),l=i._nextUint64(),f=new Rn(t,hn.length+n,3*o*8,!0);for(let e=0;e<o;e++)r.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+f._nextUint64(),f._nextUint64()),uncompressedByteLength:f._nextUint64()});const d=new Rn(t,s,a,!0),_={vendorId:d._skip(4)._nextUint16(),descriptorType:d._nextUint16(),versionNumber:d._nextUint16(),descriptorBlockSize:d._nextUint16(),colorModel:d._nextUint8(),colorPrimaries:d._nextUint8(),transferFunction:d._nextUint8(),flags:d._nextUint8(),texelBlockDimension:{x:d._nextUint8()+1,y:d._nextUint8()+1,z:d._nextUint8()+1,w:d._nextUint8()+1},bytesPlane:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],samples:[]},m=(_.descriptorBlockSize/4-6)/4;for(let t=0;t<m;t++)_.samples[t]={bitOffset:d._nextUint16(),bitLength:d._nextUint8(),channelID:d._nextUint8(),samplePosition:[d._nextUint8(),d._nextUint8(),d._nextUint8(),d._nextUint8()],sampleLower:d._nextUint32(),sampleUpper:d._nextUint32()};r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(_);const p=new Rn(t,c,u,!0);for(;p._offset<u;){const t=p._nextUint32(),e=p._scan(t),n=wn(e),i=p._scan(t-e.byteLength);r.keyValue[n]=n.match(/^ktx/i)?wn(i):i,t%4&&p._skip(4-t%4)}if(l<=0)return r;const g=new Rn(t,h,l,!0),S=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),R=g._nextUint32(),w=g._nextUint32(),A=g._nextUint32(),b=[];for(let t=0;t<o;t++)b.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const T=h+g._offset,M=T+E,C=M+R,D=C+w,P=new Uint8Array(t.buffer,t.byteOffset+T,E),O=new Uint8Array(t.buffer,t.byteOffset+M,R),x=new Uint8Array(t.buffer,t.byteOffset+C,w),v=new Uint8Array(t.buffer,t.byteOffset+D,A);return r.globalData={endpointCount:S,selectorCount:y,imageDescs:b,endpointsData:P,selectorsData:O,tablesData:x,extendedData:v},r}(new Uint8Array(t)),r=Math.max(1,e.levels.length),n=e.pixelWidth,i=e.pixelHeight,o=(s=e.vkFormat,Cn[s]);var s;return An(e.levels,{mipMapLevels:r,width:n,height:i,sizeFunction:t=>t.uncompressedByteLength,internalFormat:o})}const On={MAGIC_NUMBER:542327876,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,HEADER_SIZE_INDEX:1,HEADER_FLAGS_INDEX:2,HEADER_HEIGHT_INDEX:3,HEADER_WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,HEADER_PF_FLAGS_INDEX:20,HEADER_PF_FOURCC_INDEX:21,DDSD_MIPMAPCOUNT:131072,DDPF_FOURCC:4,PIXEL_FORMATS:{DXT1:Mn.COMPRESSED_RGB_S3TC_DXT1_EXT,DXT3:Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT,DXT5:Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT,"ATC ":Mn.COMPRESSED_RGB_ATC_WEBGL,ATCA:Mn.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,ATCI:Mn.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL},SIZE_FUNCTIONS:{DXT1:vn,DXT3:In,DXT5:In,"ATC ":vn,ATCA:In,ATCI:In}};function xn(t){const e=new Int32Array(t,0,On.HEADER_LENGTH),r=e[On.HEADER_PF_FOURCC_INDEX];f(Boolean(e[On.HEADER_PF_FLAGS_INDEX]&On.DDPF_FOURCC),"DDS: Unsupported format, must contain a FourCC code");const n=(i=r,String.fromCharCode(255&i,i>>8&255,i>>16&255,i>>24&255));var i;const o=On.PIXEL_FORMATS[n],s=On.SIZE_FUNCTIONS[n];f(o&&s,"DDS: Unknown pixel format "+r);let a=1;e[On.HEADER_FLAGS_INDEX]&On.DDSD_MIPMAPCOUNT&&(a=Math.max(1,e[On.MIPMAPCOUNT_INDEX]));const c=e[On.HEADER_WIDTH_INDEX],u=e[On.HEADER_HEIGHT_INDEX],h=e[On.HEADER_SIZE_INDEX]+4;return An(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:s,internalFormat:o})}function vn(t,e){return(t+3>>2)*(e+3>>2)*8}function In(t,e){return(t+3>>2)*(e+3>>2)*16}const Bn=55727696,Ln=1347834371,Gn=13,Un=52,Nn=0,Hn=2,kn=4,Fn=6,Xn=7,jn=11,zn=12,Kn={0:[Mn.COMPRESSED_RGB_PVRTC_2BPPV1_IMG],1:[Mn.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],2:[Mn.COMPRESSED_RGB_PVRTC_4BPPV1_IMG],3:[Mn.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],6:[Mn.COMPRESSED_RGB_ETC1_WEBGL],7:[Mn.COMPRESSED_RGB_S3TC_DXT1_EXT],9:[Mn.COMPRESSED_RGBA_S3TC_DXT3_EXT],11:[Mn.COMPRESSED_RGBA_S3TC_DXT5_EXT],22:[Mn.COMPRESSED_RGB8_ETC2],23:[Mn.COMPRESSED_RGBA8_ETC2_EAC],24:[Mn.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],25:[Mn.COMPRESSED_R11_EAC],26:[Mn.COMPRESSED_RG11_EAC],27:[Mn.COMPRESSED_RGBA_ASTC_4X4_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR],28:[Mn.COMPRESSED_RGBA_ASTC_5X4_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR],29:[Mn.COMPRESSED_RGBA_ASTC_5X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR],30:[Mn.COMPRESSED_RGBA_ASTC_6X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR],31:[Mn.COMPRESSED_RGBA_ASTC_6X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR],32:[Mn.COMPRESSED_RGBA_ASTC_8X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR],33:[Mn.COMPRESSED_RGBA_ASTC_8X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR],34:[Mn.COMPRESSED_RGBA_ASTC_8X8_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR],35:[Mn.COMPRESSED_RGBA_ASTC_10X5_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR],36:[Mn.COMPRESSED_RGBA_ASTC_10X6_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR],37:[Mn.COMPRESSED_RGBA_ASTC_10X8_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR],38:[Mn.COMPRESSED_RGBA_ASTC_10X10_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR],39:[Mn.COMPRESSED_RGBA_ASTC_12X10_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR],40:[Mn.COMPRESSED_RGBA_ASTC_12X12_KHR,Mn.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR]},Wn={0:qn,1:qn,2:Vn,3:Vn,6:$n,7:$n,9:Qn,11:Qn,22:$n,23:Qn,24:$n,25:$n,26:Qn,27:Qn,28:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16},29:function(t,e){return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16},30:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16},31:function(t,e){return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16},32:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16},33:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16},34:function(t,e){return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16},35:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16},36:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16},37:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16},38:function(t,e){return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16},39:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16},40:function(t,e){return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16}};function qn(t,e){return(t=Math.max(t,16))*(e=Math.max(e,8))/4}function Vn(t,e){return(t=Math.max(t,8))*(e=Math.max(e,8))/2}function $n(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8}function Qn(t,e){return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16}function Zn(t){if(function(t){const e=new Uint8Array(t.buffer||t,t.byteOffset||0,Dn.length);return!(e[0]!==Dn[0]||e[1]!==Dn[1]||e[2]!==Dn[2]||e[3]!==Dn[3]||e[4]!==Dn[4]||e[5]!==Dn[5]||e[6]!==Dn[6]||e[7]!==Dn[7]||e[8]!==Dn[8]||e[9]!==Dn[9]||e[10]!==Dn[10]||e[11]!==Dn[11])}(t))return Pn(t);if(function(t){return new Uint32Array(t,0,On.HEADER_LENGTH)[On.MAGIC_NUMBER_INDEX]===On.MAGIC_NUMBER}(t))return xn(t);if(function(t){const e=new Uint32Array(t,0,Gn)[Nn];return e===Bn||e===Ln}(t))return function(t){const e=new Uint32Array(t,0,Gn),r=e[Hn],n=e[kn],i=Kn[r]||[],o=i.length>1&&n?i[1]:i[0],s=Wn[r],a=e[jn],c=e[Xn],u=e[Fn],h=Un+e[zn];return An(new Uint8Array(t,h),{mipMapLevels:a,width:c,height:u,sizeFunction:s,internalFormat:o})}(t);throw new Error("Texture container format not recognized")}const Yn={name:"Texture Containers",id:"compressed-texture",module:"textures",version:"3.0.14",worker:!0,extensions:["ktx","ktx2","dds","pvr"],mimeTypes:["image/ktx2","image/ktx","image/vnd-ms.dds","image/x-dds","application/octet-stream"],binary:!0,options:{"compressed-texture":{libraryPath:"libs/"}}},Jn={...Yn,parse:async t=>Zn(t)};function ti(t,e=null){return e?`${t}?token=${e}`:t}var ei=5121,ri=5125,ni=5126,ii=5130;const oi={UInt8:Uint8Array,UInt16:Uint16Array,UInt32:Uint32Array,Float32:Float32Array,UInt64:Float64Array},si={UInt8:ei,UInt16:ri,Float32:ni,UInt32:ri,UInt64:ii},ai={position:"position",normal:"normal",uv0:"uv0",color:"color",region:"region"},ci={vertexAttributes:"vertexAttributes",featureAttributeOrder:"featureAttributeOrder",featureAttributes:"featureAttributes"},ui="header",hi="vertexCount",li="featureCount",fi={UInt8:1,UInt16:2,UInt32:4,Float32:4,UInt64:8},di=new ge([0,0,0]),_i={jpeg:Rr,png:Rr,"ktx-etc2":Jn,dds:Jn};async function mi(t,e,r,n,i){if(e.content=e.content||{},e.content.featureIds=e.content.featureIds||null,e.content.featureData=function(t,e){const r=e.store.defaultGeometrySchema,n=r;for(const t in ci)for(const e in ai){const i=r[t][e];if(i){const{byteOffset:r=0,count:o=0,valueType:s,valuesPerElement:a}=i;n[t][e]={valueType:s,valuesPerElement:a,byteOffset:r,count:o}}}return n.attributesOrder=r.ordering,n}(0,r),e.content.attributes={},e.textureUrl){var o;const t=ti(e.textureUrl,null==n||null===(o=n.i3s)||void 0===o?void 0:o.token),r=_i[e.textureFormat]||Rr,s=await fetch(t),a=await s.arrayBuffer();if(r===Rr){const t={image:{type:"data"}};e.content.texture=await i.parse(a,t)}else if(r===Jn){const t=await kt(a,Jn);e.content.texture={compressed:!0,mipmaps:!1,width:t[0].width,height:t[0].height,data:t}}}return e.content.material=function(t,e){let r;t?r={...t,pbrMetallicRoughness:t.pbrMetallicRoughness?{...t.pbrMetallicRoughness}:{baseColorFactor:[255,255,255,255]}}:(r={pbrMetallicRoughness:{}},e?r.pbrMetallicRoughness.baseColorTexture={texCoord:0}:r.pbrMetallicRoughness.baseColorFactor=[255,255,255,255]);r.alphaCutoff=r.alphaCutoff||.25,r.alphaMode&&(r.alphaMode=r.alphaMode.toUpperCase());r.emissiveFactor&&(r.emissiveFactor=yi(r.emissiveFactor));r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorFactor&&(r.pbrMetallicRoughness.baseColorFactor=yi(r.pbrMetallicRoughness.baseColorFactor));return function(t,e){const r={source:{image:e}};t.pbrMetallicRoughness&&t.pbrMetallicRoughness.baseColorTexture?t.pbrMetallicRoughness.baseColorTexture={...t.pbrMetallicRoughness.baseColorTexture,texture:r}:t.emissiveTexture?t.emissiveTexture={...t.emissiveTexture,texture:r}:t.pbrMetallicRoughness&&t.pbrMetallicRoughness.metallicRoughnessTexture?t.pbrMetallicRoughness.metallicRoughnessTexture={...t.pbrMetallicRoughness.metallicRoughnessTexture,texture:r}:t.normalTexture?t.normalTexture={...t.normalTexture,texture:r}:t.occlusionTexture&&(t.occlusionTexture={...t.occlusionTexture,texture:r})}(r,e),r}(e.materialDefinition,e.content.texture),e.content.material&&(e.content.texture=null),await async function(t,e={},r){if(!e.content)return e;const n=e.content;let i,o,s=0,a=0;if(e.isDracoGeometry){const e=await Ht(t,un,{draco:{attributeNameEntry:"i3s-attribute-type"}});o=e.header.vertexCount;const r=e.indices.value,{POSITION:n,NORMAL:s,COLOR_0:a,TEXCOORD_0:c,"feature-index":u,"uv-region":h}=e.attributes;i={position:n,normal:s,color:a,uv0:c,uvRegion:h,id:u,indices:r},function(t,e){for(const r in e.loaderData.attributes){const n=e.loaderData.attributes[r];switch(n.name){case"POSITION":t.position.metadata=n.metadata;break;case"feature-index":t.id.metadata=n.metadata}}}(i,e);const l=function(t){return t&&t.metadata&&t.metadata["i3s-feature-ids"]&&t.metadata["i3s-feature-ids"].intArray}(u);l&&function(t,e){const r=t.id.value,n=new Float32Array(r.length);for(let t=0;t<r.length;t++)n[t]=e[r[t]];t.id.value=n}(i,l)}else{const{vertexAttributes:e,attributesOrder:r,featureAttributes:c,featureAttributeOrder:u}=n.featureData,h=function(t,e){let r=0,n=0,i=0;const o=t.featureData[ui];for(const t in o){const{property:s,type:a}=o[t],c=oi[a];s===hi&&(n=new c(e,0,4)[0],r+=fi[a]),s===li&&(i=new c(e,4,4)[0],r+=fi[a])}return{vertexCount:n,featureCount:i,byteOffset:r}}(n,t);s=h.byteOffset,o=h.vertexCount,a=h.featureCount;const{attributes:l,byteOffset:f}=gi(t,s,e,o,r),{attributes:d}=gi(t,f,c,a,u);!function(t){const{id:e,faceRange:r}=t;if(!e||!r)return;const n=e.value,i=r.value,o=i[i.length-1]+1,s=new Uint32Array(3*o);let a=0,c=0;for(let t=1;t<i.length;t+=2){const e=Number(n[a]),r=i[t],o=i[t-1],u=c+3*(r-o+1);s.fill(e,c,u),a++,c=u}t.id.value=s}(d),i=function(t,e){return{...t,...e}}(l,d)}const{enuMatrix:c,cartographicOrigin:u,cartesianOrigin:h}=function(t,e){const r=e.mbs,n=t.value,i=t.metadata,o=new De,s=new ge(r[0],r[1],r[2]),a=new ge;return tr.WGS84.cartographicToCartesian(s,a),tr.WGS84.eastNorthUpToFixedFrame(a,o),t.value=function(t,e={},r){const n=new Float64Array(t.length),i=e["i3s-scale_x"]&&e["i3s-scale_x"].double||1,o=e["i3s-scale_y"]&&e["i3s-scale_y"].double||1;for(let e=0;e<n.length;e+=3)n[e]=t[e]*i+r.x,n[e+1]=t[e+1]*o+r.y,n[e+2]=t[e+2]+r.z;for(let t=0;t<n.length;t+=3)tr.WGS84.cartographicToCartesian(n.subarray(t,t+3),di),n[t]=di.x,n[t+1]=di.y,n[t+2]=di.z;return n}(n,i,s),{enuMatrix:o,fixedFrameToENUMatrix:o.invert(),cartographicOrigin:s,cartesianOrigin:a}}(i.position,e),l=(new De).multiplyRight(c);n.attributes={positions:i.position,normals:i.normal,colors:pi(i.color),texCoords:i.uv0,uvRegions:pi(i.uvRegion)},n.indices=i.indices||null,i.id&&i.id.value&&(e.content.featureIds=i.id.value);for(const t in n.attributes)n.attributes[t]||delete n.attributes[t];return n.vertexCount=o,n.cartographicCenter=u,n.cartesianOrigin=h,n.modelMatrix=l.invert(),n.byteLength=t.byteLength,e}(t,e)}function pi(t){return t?(t.normalized=!0,t):t}function gi(t,e,r,n,i){const o={};for(const s of i)if(r[s]){const{valueType:i,valuesPerElement:a}=r[s],c=n;if(e+c*a>t.byteLength)break;const u=t.slice(e);let h=[];if("UInt64"===i)h=Si(u,c*a,fi[i]);else{h=new(0,oi[i])(u,0,c*a)}switch(o[s]={value:h,type:si[i],size:a},s){case"color":o.color.normalized=!0}e+=c*a*fi[i]}return{attributes:o,byteOffset:e}}function Si(t,e,r){const n=[],i=new DataView(t);let o=0;for(let t=0;t<e;t++){const t=i.getUint32(o,!0)+2**32*i.getUint32(o+4,!0);n.push(t),o+=r}return n}function yi(t){const e=[...t];for(let r=0;r<t.length;r++)e[r]=t[r]/255;return e}const Ei={name:"I3S Content (Indexed Scene Layers)",id:"i3s-content",module:"i3s",worker:!0,version:"3.0.14",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const{tile:n,tileset:i}=(null==e?void 0:e.i3s)||{};return await mi(t,n,i,e,r),n.content},extensions:["bin"],options:{"i3s-content":{}}};const Ri=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1});new ge,new ge;const wi=new ge,Ai=new ge;class bi{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new ge,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=wi.from(e),this.center=(new ge).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 bi(this.center,this.radius)}union(t){const e=this.center,r=this.radius,n=t.center,i=t.radius,o=wi.copy(n).subtract(e),s=o.magnitude();if(r>=s+i)return this.clone();if(i>=s+r)return t.clone();const a=.5*(r+s+i);return Ai.copy(o).scale((-r+a)/s).add(e),this.center.copy(Ai),this.radius=a,this}expand(t){const e=(t=wi.from(t)).subtract(this.center).magnitude();return e>this.radius&&(this.radius=e),this}transform(t){this.center.transform(t);const e=Re(wi,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){return(t=wi.from(t)).subtract(this.center).lengthSquared()-this.radius*this.radius}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}intersectPlane(t){const e=this.center,r=this.radius,n=t.normal.dot(e)+t.distance;return n<-r?Ri.OUTSIDE:n<r?Ri.INTERSECTING:Ri.INSIDE}}function Ti(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=e[4],c=e[5],u=e[6],h=e[7],l=e[8],f=r[0],d=r[1],_=r[2],m=r[3],p=r[4],g=r[5],S=r[6],y=r[7],E=r[8];return t[0]=f*n+d*s+_*u,t[1]=f*i+d*a+_*h,t[2]=f*o+d*c+_*l,t[3]=m*n+p*s+g*u,t[4]=m*i+p*a+g*h,t[5]=m*o+p*c+g*l,t[6]=S*n+y*s+E*u,t[7]=S*i+y*a+E*h,t[8]=S*o+y*c+E*l,t}function Mi(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}const Ci=Object.freeze([1,0,0,0,1,0,0,0,1]),Di=Object.freeze([0,0,0,0,0,0,0,0,0]),Pi=Object.freeze({COL0ROW0:0,COL0ROW1:1,COL0ROW2:2,COL1ROW0:3,COL1ROW1:4,COL1ROW2:5,COL2ROW0:6,COL2ROW1:7,COL2ROW2:8}),Oi={};class xi extends Se{static get IDENTITY(){return Oi.IDENTITY=Oi.IDENTITY||Object.freeze(new xi(Ci)),Oi.IDENTITY}static get ZERO(){return Oi.ZERO=Oi.ZERO||Object.freeze(new xi(Di)),Oi.ZERO}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return Pi}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,i,o,s,a,c){return this[0]=t,this[1]=e,this[2]=r,this[3]=n,this[4]=i,this[5]=o,this[6]=s,this[7]=a,this[8]=c,this.check()}setRowMajor(t,e,r,n,i,o,s,a,c){return this[0]=t,this[1]=n,this[2]=s,this[3]=e,this[4]=i,this[5]=a,this[6]=r,this[7]=o,this[8]=c,this.check()}determinant(){return e=(t=this)[0],r=t[1],n=t[2],i=t[3],o=t[4],s=t[5],a=t[6],c=t[7],u=t[8],e*(u*o-s*c)+r*(-u*i+s*a)+n*(c*i-o*a);var t,e,r,n,i,o,s,a,c,u}identity(){return this.copy(Ci)}fromQuaternion(t){return function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r+r,a=n+n,c=i+i,u=r*s,h=n*s,l=n*a,f=i*s,d=i*a,_=i*c,m=o*s,p=o*a,g=o*c;t[0]=1-l-_,t[3]=h-g,t[6]=f+p,t[1]=h+g,t[4]=1-u-_,t[7]=d-m,t[2]=f-p,t[5]=d+m,t[8]=1-u-l}(this,t),this.check()}transpose(){return function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}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(){var t,e,r,n,i,o,s,a,c,u,h,l,f,d,_;return t=this,r=(e=this)[0],n=e[1],i=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],h=e[8],(_=r*(l=h*s-a*u)+n*(f=-h*o+a*c)+i*(d=u*o-s*c))&&(_=1/_,t[0]=l*_,t[1]=(-h*n+i*u)*_,t[2]=(a*n-i*s)*_,t[3]=f*_,t[4]=(h*r-i*c)*_,t[5]=(-a*r+i*o)*_,t[6]=d*_,t[7]=(-u*r+n*c)*_,t[8]=(s*r-n*o)*_),this.check()}multiplyLeft(t){return Ti(this,t,this),this.check()}multiplyRight(t){return Ti(this,this,t),this.check()}rotate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_;return e=this,n=t,i=(r=this)[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=Math.sin(n),_=Math.cos(n),e[0]=_*i+d*a,e[1]=_*o+d*c,e[2]=_*s+d*u,e[3]=_*a-d*i,e[4]=_*c-d*o,e[5]=_*u-d*s,e[6]=h,e[7]=l,e[8]=f,this.check()}scale(t){return Array.isArray(t)?Mi(this,this,t):Mi(this,this,[t,t,t]),this.check()}translate(t){var e,r,n,i,o,s,a,c,u,h,l,f,d,_;return e=this,n=t,i=(r=this)[0],o=r[1],s=r[2],a=r[3],c=r[4],u=r[5],h=r[6],l=r[7],f=r[8],d=n[0],_=n[1],e[0]=i,e[1]=o,e[2]=s,e[3]=a,e[4]=c,e[5]=u,e[6]=d*i+_*a+h,e[7]=d*o+_*c+l,e[8]=d*s+_*u+f,this.check()}transform(t,e){switch(t.length){case 2:r=e||[-0,-0],i=this,o=(n=t)[0],s=n[1],r[0]=i[0]*o+i[3]*s+i[6],r[1]=i[1]*o+i[4]*s+i[7],e=r;break;case 3:e=le(e||[-0,-0,-0],t,this);break;case 4:e=function(t,e,r){const n=e[0],i=e[1],o=e[2];return t[0]=r[0]*n+r[3]*i+r[6]*o,t[1]=r[1]*n+r[4]*i+r[7]*o,t[2]=r[2]*n+r[5]*i+r[8]*o,t[3]=e[3],t}(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}var r,n,i,o,s;return Jt(e,t.length),e}transformVector(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}transformVector2(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}transformVector3(t,e){return ee("Matrix3.transformVector"),this.transform(t,e)}}function vi(){var t=new ie(4);return ie!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Ii(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 Bi(t,e,r){var n=e[0],i=e[1],o=e[2],s=e[3],a=r[0],c=r[1],u=r[2],h=r[3];return t[0]=n*h+s*a+i*u-o*c,t[1]=i*h+s*c+o*a-n*u,t[2]=o*h+s*u+n*c-i*a,t[3]=s*h-n*a-i*c-o*u,t}function Li(t,e,r,n){var i,o,s,a,c,u=e[0],h=e[1],l=e[2],f=e[3],d=r[0],_=r[1],m=r[2],p=r[3];return(o=u*d+h*_+l*m+f*p)<0&&(o=-o,d=-d,_=-_,m=-m,p=-p),1-o>ne?(i=Math.acos(o),s=Math.sin(i),a=Math.sin((1-n)*i)/s,c=Math.sin(n*i)/s):(a=1-n,c=n),t[0]=a*u+c*d,t[1]=a*h+c*_,t[2]=a*l+c*m,t[3]=a*f+c*p,t}function Gi(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 i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var o=(i+1)%3,s=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*o+o]-e[3*s+s]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*o+s]-e[3*s+o])*r,t[o]=(e[3*o+i]+e[3*i+o])*r,t[s]=(e[3*s+i]+e[3*i+s])*r}return t}var Ui,Ni,Hi,ki,Fi,Xi,ji,zi=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},Ki=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},Wi=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},qi=function(t,e,r,n){var i=e[0],o=e[1],s=e[2],a=e[3];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=s+n*(r[2]-s),t[3]=a+n*(r[3]-a),t},Vi=we,$i=Ae,Qi=function(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=n*s,t[2]=i*s,t[3]=o*s,t},Zi=(Ui=oe(),Ni=ae(1,0,0),Hi=ae(0,1,0),function(t,e,r){var n=ce(e,r);return n<-.999999?(ue(Ui,Ni,e),de(Ui)<1e-6&&ue(Ui,Hi,e),function(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o}(Ui,Ui),Ii(t,Ui,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(ue(Ui,e,r),t[0]=Ui[0],t[1]=Ui[1],t[2]=Ui[2],t[3]=1+n,Qi(t,t))});ki=vi(),Fi=vi(),Xi=new ie(9),ie!=Float32Array&&(Xi[1]=0,Xi[2]=0,Xi[3]=0,Xi[5]=0,Xi[6]=0,Xi[7]=0),Xi[0]=1,Xi[4]=1,Xi[8]=1,ji=Xi;const Yi=[0,0,0,1];class Ji extends Zt{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 Gi(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 Ii(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]=Yt(t)}get y(){return this[1]}set y(t){this[1]=Yt(t)}get z(){return this[2]}set z(t){this[2]=Yt(t)}get w(){return this[3]}set w(t){this[3]=Yt(t)}len(){return Vi(this)}lengthSquared(){return $i(this)}dot(t,e){if(void 0!==e)throw new Error("Quaternion.dot only takes one argument");return Wi(this,t)}rotationTo(t,e){return Zi(this,t,e),this.check()}add(t,e){if(void 0!==e)throw new Error("Quaternion.add only takes one argument");return zi(this,this,t),this.check()}calculateW(){return function(t,e){var r=e[0],n=e[1],i=e[2];t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i))}(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],i=e[2],o=e[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;t[0]=-r*a,t[1]=-n*a,t[2]=-i*a,t[3]=o*a}(this,this),this.check()}lerp(t,e,r){return qi(this,t,e,r),this.check()}multiplyRight(t,e){return Ft(!e),Bi(this,this,t),this.check()}multiplyLeft(t,e){return Ft(!e),Bi(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],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+s*a,t[1]=i*c+o*a,t[2]=o*c-i*a,t[3]=s*c-n*a}(this,this,t),this.check()}rotateY(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c-o*a,t[1]=i*c+s*a,t[2]=o*c+n*a,t[3]=s*c-i*a}(this,this,t),this.check()}rotateZ(t){return function(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],s=e[3],a=Math.sin(r),c=Math.cos(r);t[0]=n*c+i*a,t[1]=i*c-n*a,t[2]=o*c+s*a,t[3]=s*c-o*a}(this,this,t),this.check()}scale(t){return Ki(this,this,t),this.check()}slerp(t,e,r){switch(arguments.length){case 1:({start:t=Yi,target:e,ratio:r}=arguments[0]);break;case 2:[e,r]=arguments,t=this}return Li(this,t,e,r),this.check()}transformVector4(t,e=t){return function(t,e,r){var n=e[0],i=e[1],o=e[2],s=r[0],a=r[1],c=r[2],u=r[3],h=u*n+a*o-c*i,l=u*i+c*n-s*o,f=u*o+s*i-a*n,d=-s*n-a*i-c*o;t[0]=h*u+d*-s+l*-c-f*-a,t[1]=l*u+d*-a+f*-s-h*-c,t[2]=f*u+d*-c+h*-a-l*-s,t[3]=e[3]}(e,t,this),Jt(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)}}const to=new ge,eo=new ge,ro=new ge,no=new ge,io=new ge,oo=new ge,so=new ge,ao=0,co=1,uo=2,ho=3,lo=4,fo=5,_o=6,mo=7,po=8;class go{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=(new ge).from(t),this.halfAxes=new xi(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2);return[new ge(t).len(),new ge(e).len(),new ge(r).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),r=this.halfAxes.getColumn(2),n=new ge(t).normalize(),i=new ge(e).normalize(),o=new ge(r).normalize();return(new Ji).fromMatrix3(new xi([...n,...i,...o]))}fromCenterHalfSizeQuaternion(t,e,r){const n=new Ji(r),i=(new xi).fromQuaternion(n);return i[0]=i[0]*e[0],i[1]=i[1]*e[0],i[2]=i[2]*e[0],i[3]=i[3]*e[1],i[4]=i[4]*e[1],i[5]=i[5]*e[1],i[6]=i[6]*e[2],i[7]=i[7]*e[2],i[8]=i[8]*e[2],this.center=(new ge).from(t),this.halfAxes=i,this}clone(){return new go(this.center,this.halfAxes)}equals(t){return this===t||Boolean(t)&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new bi){const e=this.halfAxes,r=e.getColumn(0,ro),n=e.getColumn(1,no),i=e.getColumn(2,io),o=to.copy(r).add(n).add(i);return t.center.copy(this.center),t.radius=o.magnitude(),t}intersectPlane(t){const e=this.center,r=t.normal,n=this.halfAxes,i=r.x,o=r.y,s=r.z,a=Math.abs(i*n[ao]+o*n[co]+s*n[uo])+Math.abs(i*n[ho]+o*n[lo]+s*n[fo])+Math.abs(i*n[_o]+o*n[mo]+s*n[po]),c=r.dot(e)+t.distance;return c<=-a?Ri.OUTSIDE:c>=a?Ri.INSIDE:Ri.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=eo.from(t).subtract(this.center),r=this.halfAxes,n=r.getColumn(0,ro),i=r.getColumn(1,no),o=r.getColumn(2,io),s=n.magnitude(),a=i.magnitude(),c=o.magnitude();n.normalize(),i.normalize(),o.normalize();let u,h=0;return u=Math.abs(e.dot(n))-s,u>0&&(h+=u*u),u=Math.abs(e.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(e.dot(o))-c,u>0&&(h+=u*u),h}computePlaneDistances(t,e,r=[-0,-0]){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;const o=this.center,s=this.halfAxes,a=s.getColumn(0,ro),c=s.getColumn(1,no),u=s.getColumn(2,io),h=oo.copy(a).add(c).add(u).add(o),l=so.copy(h).subtract(t);let f=e.dot(l);return n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).add(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).subtract(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),h.copy(o).add(a).subtract(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).add(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).add(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).subtract(c).add(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),o.copy(h).subtract(a).subtract(c).subtract(u),l.copy(h).subtract(t),f=e.dot(l),n=Math.min(f,n),i=Math.max(f,i),r[0]=n,r[1]=i,r}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,ro);e.transformAsPoint(t);const r=this.halfAxes.getColumn(1,no);r.transformAsPoint(t);const n=this.halfAxes.getColumn(2,io);return n.transformAsPoint(t),this.halfAxes=new xi([...e,...r,...n]),this}getTransform(){throw new Error("not implemented")}}const So=new ge,yo=new ge;class Eo{constructor(t=[0,0,1],e=0){this.normal=new ge,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return Ft(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=So.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),Ft(Qt(this.normal.len(),1)),this.distance=n,this}clone(t){return new Eo(this.normal,this.distance)}equals(t){return Qt(this.distance,t.distance)&&Qt(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=yo.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=So.from(t);const r=this.getPointDistance(t),n=yo.copy(this.normal).scale(r);return t.subtract(n).to(e)}}new ge([1,0,0]),new ge([0,1,0]),new ge([0,0,1]),new ge,new ge,new Eo(new ge(1,0,0),0);new ge,new ge,new ge,new ge,new ge;new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,new ge,Math.PI;new xi,new xi,new xi,new xi,new xi;new ge,new ge,new ge,new ge,new ge,new xi,new xi,new xi;const Ro=2,wo="mesh",Ao="I3S",bo=["","WEBKIT_","MOZ_"],To={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 Mo=null;function Co(t){if(!Mo){t=t||function(){try{return document.createElement("canvas").getContext("webgl")}catch(t){return null}}()||void 0,Mo=new Set;for(const e of bo)for(const r in To)if(t&&t.getExtension(`${e}${r}`)){const t=To[r];Mo.add(t)}}return Mo}async function Do(t){return JSON.parse((new TextDecoder).decode(t))}const Po={name:"I3S Node Page",id:"i3s-node-page",module:"i3s",version:"3.0.14",mimeTypes:["application/json"],parse:async function(t){return t=Do(t)},extensions:["json"],options:{}};function Oo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class xo{constructor(t,e){Oo(this,"tileset",void 0),Oo(this,"nodePages",void 0),Oo(this,"nodesPerPage",void 0),Oo(this,"options",void 0),Oo(this,"lodSelectionMetricType",void 0),Oo(this,"textureDefinitionsSelectedFormats",void 0),this.tileset={...t},this.nodesPerPage=t.nodePages.nodesPerPage,this.lodSelectionMetricType=t.nodePages.lodSelectionMetricType,this.options=e,this.nodePages=[],this.textureDefinitionsSelectedFormats=[],this._initSelectedFormatsForTextureDefinitions(t)}async getNodeById(t){const e=Math.floor(t/this.nodesPerPage);if(!this.nodePages[e]){var r;const t=ti(`${this.tileset.url}/nodepages/${e}`,null===(r=this.options.i3s)||void 0===r?void 0:r.token);this.nodePages[e]=kt(t,Po,this.options),this.nodePages[e]=await this.nodePages[e]}this.nodePages[e]instanceof Promise&&(this.nodePages[e]=await this.nodePages[e]);const n=t%this.nodesPerPage;return this.nodePages[e].nodes[n]}async formTileFromNodePages(t){const e=await this.getNodeById(t),r=[];for(const t of e.children||[]){const e=await this.getNodeById(t);r.push({id:t,obb:e.obb})}let n=null,i=null,o=null,s="jpeg",a=[],c=!1;if(e&&e.mesh){const{url:t,isDracoGeometry:r}=e.mesh.geometry&&this._getContentUrl(e.mesh.geometry)||{url:null,isDracoGeometry:null};n=t,c=r;const[u,h]=this._getInformationFromMaterial(e.mesh.material);o=h,s=u.format||s,u.name&&(i=`${this.tileset.url}/nodes/${e.mesh.material.resource}/textures/${u.name}`),this.tileset.attributeStorageInfo&&(a=function(t,e){const r=[],{attributeStorageInfo:n,url:i}=t;for(let t=0;t<n.length;t++){const o=n[t].key;r.push(`${i}/nodes/${e}/attributes/${o}/0`)}return r}(this.tileset,e.mesh.attribute.resource))}return vo({id:t,lodSelection:this._getLodSelection(e),obb:e.obb,contentUrl:n,textureUrl:i,attributeUrls:a,materialDefinition:o,textureFormat:s,children:r,isDracoGeometry:c})}_getContentUrl(t){let e={};const r=this.tileset.geometryDefinitions[t.definition];let n=-1;if(this.options.i3s&&this.options.i3s.useDracoGeometry&&(n=r.geometryBuffers.findIndex(t=>t.compressedAttributes&&"draco"===t.compressedAttributes.encoding)),-1===n&&(n=r.geometryBuffers.findIndex(t=>!t.compressedAttributes)),-1!==n){const i=Boolean(r.geometryBuffers[n].compressedAttributes);e={url:`${this.tileset.url}/nodes/${t.resource}/geometries/${n}`,isDracoGeometry:i}}return e}_getLodSelection(t){const e=[];return"maxScreenThresholdSQ"===this.lodSelectionMetricType&&e.push({metricType:"maxScreenThreshold",maxError:Math.sqrt(t.lodThreshold/(.25*Math.PI))}),e.push({metricType:this.lodSelectionMetricType,maxError:t.lodThreshold}),e}_getInformationFromMaterial(t){const e={name:null,format:null};if(t){const r=this.tileset.materialDefinitions[t.definition],n=r&&r.pbrMetallicRoughness&&r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;if(n||0===n){return[this.textureDefinitionsSelectedFormats[n]||e,r]}return[e,r]}return[e,null]}_initSelectedFormatsForTextureDefinitions(t){this.textureDefinitionsSelectedFormats=[];const e=this._getSupportedTextureFormats(),r=t.textureSetDefinitions||[];for(const t of r){const r=t&&t.formats||[];let n=null;for(const t of e){const e=r.find(e=>e.format===t);if(e){n=e;break}}this.textureDefinitionsSelectedFormats.push(n)}}_getSupportedTextureFormats(){const t=[];if(!this.options.i3s||this.options.i3s.useCompressedTextures){const e=Co();e.has("etc2")&&t.push("ktx-etc2"),e.has("dxt")&&t.push("dds")}return t.push("jpg"),t.push("png"),t}}function vo(t){const e=t.obb?[...tr.WGS84.cartographicToCartesian(t.obb.center),...t.obb.halfSize,...t.obb.quaternion]:void 0;let r;if(t.mbs)r=[...tr.WGS84.cartographicToCartesian(t.mbs.slice(0,3)),t.mbs[3]];else if(e){const n=(new go).fromCenterHalfSizeQuaternion(e.slice(0,3),t.obb.halfSize,t.obb.quaternion).getBoundingSphere();r=[...n.center,n.radius],t.mbs=[...t.obb.center,n.radius]}return t.boundingVolume={sphere:r,box:e},t.lodMetricType=t.lodSelection[0].metricType,t.lodMetricValue=t.lodSelection[0].maxError,t.transformMatrix=t.transform,t.type=wo,t.refine=Ro,t}const Io=/layers\/[0-9]+$/,Bo=/nodes\/([0-9-]+|root)$/,Lo={name:"I3S (Indexed Scene Layers)",id:"i3s",module:"i3s",version:"3.0.14",mimeTypes:["application/octet-stream"],parse:async function(t,e,r){const n=r.url;e.i3s=e.i3s||{};if("504b0304"===function(t){if(t instanceof ArrayBuffer)return[...new Uint8Array(t,0,4)].map(t=>t.toString(16).padStart(2,"0")).join("");return null}(t))throw new Error("Files with .slpk extention currently are not supported by I3SLoader");let i,o;i="auto"===e.i3s.isTileset?Io.test(n):e.i3s.isTileset;o="auto"===e.isTileHeader?Bo.test(n):e.i3s.isTileHeader;i?t=await async function(t,e,r){const n=JSON.parse((new TextDecoder).decode(t));return n.loader=Lo,await async function(t,e,r){if(t.url=r.url,t.nodePages)t.nodePagesTile=new xo(t,e),t.root=await t.nodePagesTile.formTileFromNodePages(0);else{var n;const r=ti(t.url+"/nodes/root",null===(n=e.i3s)||void 0===n?void 0:n.token);t.root=await kt(r,t.loader,{i3s:{loadContent:!1,isTileHeader:!0,isTileset:!1}})}t.basePath=t.url,t.type=Ao,t.lodMetricType=t.root.lodMetricType,t.lodMetricValue=t.root.lodMetricValue}(n,e,r),n}(t,e,r):o?(t=await async function(t,e,r){return function(t,e,r){return t.url=r.url,t.featureData&&(t.featureUrl=`${t.url}/${t.featureData[0].href}`),t.geometryData&&(t.contentUrl=`${t.url}/${t.geometryData[0].href}`),t.textureData&&(t.textureUrl=`${t.url}/${t.textureData[0].href}`),t.attributeData&&(t.attributeUrls=function(t){const{url:e,attributeData:r}=t,n=[];for(let t=0;t<r.length;t++){const i=r[t].href.replace("./","");n.push(`${e}/${i}`)}return n}(t)),vo(t)}(t=JSON.parse((new TextDecoder).decode(t)),0,r)}(t,0,r),e.i3s.loadContent&&(e.i3s.tile=t,await kt(t.contentUrl,Lo,e))):t=await async function(t,e){return await Ht(t,Ei,e)}(t,e);return t},extensions:["bin"],options:{i3s:{loadContent:!0,token:null,isTileset:"auto",isTileHeader:"auto",tile:null,tileset:null,useDracoGeometry:!0,useCompressedTextures:!0}}};async function Go(t,e){const{attributeName:r,attributeType:n}=e;return r?{[r]:n?Uo(n,t):null}:{}}function Uo(t,e){switch(t){case"String":return function(t){const e=[];try{const r=new DataView(t,0,4).getUint32(0,!0),n=new Uint32Array(t,8,r);let i=8+4*r;for(const r of n){const n=new TextDecoder("utf-8"),o=new Uint8Array(t,i,r);e.push(n.decode(o)),i+=r}}catch(t){console.error("Parse string attribute error: ",t.message)}return e}(e);case"Oid32":return No(e);case"Float64":return function(t){return new Float64Array(t,8)}(e);default:return No(e)}}function No(t){return new Uint32Array(t,4)}const Ho={name:"I3S Attribute",id:"i3s-attribute",module:"i3s",version:"3.0.14",mimeTypes:["application/binary"],parse:async function(t,e){return t=Go(t,e)},extensions:["bin"],options:{},binary:!0};async function ko(t,e,r={}){const{attributeStorageInfo:n,attributeUrls:i}=function(t){const e=t&&t.tileset&&t.tileset.tileset&&t.tileset.tileset.attributeStorageInfo,r=t&&t.header&&t.header.attributeUrls;return{attributeStorageInfo:e,attributeUrls:r}}(t);if(!n||!i||!e)return null;let o=[];const s=[];for(let t=0;t<n.length;t++){var a;const e=ti(i[t],null===(a=r.i3s)||void 0===a?void 0:a.token),o=n[t].name,c=Fo(n[t]),u={...r,attributeName:o,attributeType:c},h=kt(e,Ho,u);s.push(h)}try{o=await Promise.allSettled(s)}catch(t){}return o.length?function(t,e,r){const n=t.find(t=>t.value.OBJECTID);if(!n)return null;const i=n.value.OBJECTID.indexOf(r);if(i<0)return null;return function(t,e,r){const n={};for(let i=0;i<r.length;i++){const o=r[i].name,s=Xo(t,i,o);n[o]=jo(s,e)}return n}(t,i,e)}(o,n,e):null}function Fo(t){return t.hasOwnProperty("objectIds")?"Oid32":t.hasOwnProperty("attributeValues")?t.attributeValues.valueType:""}function Xo(t,e,r){const n=t[e];return"rejected"===n.status?null:n.value[r]}function jo(t,e){return t&&t[e]?t[e].toString().replace(/\u0000/g,"").trim():""}},,,,,function(t,e,r){"use strict";(function(t,n){r.d(e,"a",(function(){return o})),r.d(e,"b",(function(){return s}));const i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},o=i.global||i.self||i.window||{},s="object"!=typeof n||"[object process]"!==String(n)||n.browser,a=void 0!==n&&n.version&&/v([0-9]*)/.exec(n.version);a&&parseFloat(a[1])}).call(this,r(5),r(4))}])}));
|
|
2
2
|
//# sourceMappingURL=dist.min.js.map
|