/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.128 * * Copyright 2011-2022 Cesium Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Columbus View (Pat. Pend.) * * Portions licensed separately. * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details. */ import{a as on}from"./chunk-CRNKVPOJ.js";import{a as M}from"./chunk-7SDYTY36.js";import{a as re}from"./chunk-JBTCQLOL.js";import{b as sn}from"./chunk-IQDUXDOM.js";import{a as Pt,c as rr,d as sr,e as Le}from"./chunk-GDY26PU3.js";var cn=rr((ot,Et)=>{var pt=function(){var s=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(s=s||__filename),function(f){f=f||{};var r=typeof f<"u"?f:{},C,l;r.ready=new Promise(function(e,t){C=e,l=t});var E={},F;for(F in r)r.hasOwnProperty(F)&&(E[F]=r[F]);var g=[],m="./this.program",I=function(e,t){throw t},N=!1,d=!1,P=!1,Q=!1;N=typeof window=="object",d=typeof importScripts=="function",P=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",Q=!N&&!P&&!d;var u="";function W(e){return r.locateFile?r.locateFile(e,u):u+e}var J,ae,j,Be,Ce,Fe;P?(d?u=Pt("path").dirname(u)+"/":u=__dirname+"/",J=function(t,n){return Ce||(Ce=Pt("fs")),Fe||(Fe=Pt("path")),t=Fe.normalize(t),Ce.readFileSync(t,n?null:"utf8")},j=function(t){var n=J(t,!0);return n.buffer||(n=new Uint8Array(n)),D(n.buffer),n},process.argv.length>1&&(m=process.argv[1].replace(/\\/g,"/")),g=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof nr))throw e}),process.on("unhandledRejection",Oe),I=function(e){process.exit(e)},r.inspect=function(){return"[Emscripten Module object]"}):Q?(typeof read<"u"&&(J=function(t){return read(t)}),j=function(t){var n;return typeof readbuffer=="function"?new Uint8Array(readbuffer(t)):(n=read(t,"binary"),D(typeof n=="object"),n)},typeof scriptArgs<"u"?g=scriptArgs:typeof arguments<"u"&&(g=arguments),typeof quit=="function"&&(I=function(e){quit(e)}),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(N||d)&&(d?u=self.location.href:typeof document<"u"&&document.currentScript&&(u=document.currentScript.src),s&&(u=s),u.indexOf("blob:")!==0?u=u.substr(0,u.lastIndexOf("/")+1):u="",J=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},d&&(j=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),ae=function(e,t,n){var _=new XMLHttpRequest;_.open("GET",e,!0),_.responseType="arraybuffer",_.onload=function(){if(_.status==200||_.status==0&&_.response){t(_.response);return}n()},_.onerror=n,_.send(null)},Be=function(e){document.title=e});var it=r.print||console.log.bind(console),se=r.printErr||console.warn.bind(console);for(F in E)E.hasOwnProperty(F)&&(r[F]=E[F]);E=null,r.arguments&&(g=r.arguments),r.thisProgram&&(m=r.thisProgram),r.quit&&(I=r.quit);var Rt=0,vt=function(e){Rt=e},oe;r.wasmBinary&&(oe=r.wasmBinary);var On=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Oe("no native wasm support detected");var de,Ie=!1,ce;function D(e,t){e||Oe("Assertion failed: "+t)}var be=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function we(e,t,n){for(var _=t+n,o=t;e[o]&&!(o>=_);)++o;if(o-t>16&&e.subarray&&be)return be.decode(e.subarray(t,o));for(var a="";t>10,56320|T&1023)}}return a}function Se(e,t){return e?we(p,e,t):""}function He(e,t,n,_){if(!(_>0))return 0;for(var o=n,a=n+_-1,A=0;A=55296&&i<=57343){var R=e.charCodeAt(++A);i=65536+((i&1023)<<10)|R&1023}if(i<=127){if(n>=a)break;t[n++]=i}else if(i<=2047){if(n+1>=a)break;t[n++]=192|i>>6,t[n++]=128|i&63}else if(i<=65535){if(n+2>=a)break;t[n++]=224|i>>12,t[n++]=128|i>>6&63,t[n++]=128|i&63}else{if(n+3>=a)break;t[n++]=240|i>>18,t[n++]=128|i>>12&63,t[n++]=128|i>>6&63,t[n++]=128|i&63}}return t[n]=0,n-o}function Xe(e,t,n){return He(e,p,t,n)}function at(e){for(var t=0,n=0;n=55296&&_<=57343&&(_=65536+((_&1023)<<10)|e.charCodeAt(++n)&1023),_<=127?++t:_<=2047?t+=2:_<=65535?t+=3:t+=4}return t}var Ge=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function xe(e,t){for(var n=e,_=n>>1,o=_+t/2;!(_>=o)&&Ae[_];)++_;if(n=_<<1,n-e>32&&Ge)return Ge.decode(p.subarray(e,n));for(var a="",A=0;!(A>=t/2);++A){var i=k[e+A*2>>1];if(i==0)break;a+=String.fromCharCode(i)}return a}function ke(e,t,n){if(n===void 0&&(n=2147483647),n<2)return 0;n-=2;for(var _=t,o=n>1]=A,t+=2}return k[t>>1]=0,t-_}function $e(e){return e.length*2}function ct(e,t){for(var n=0,_="";!(n>=t/4);){var o=L[e+n*4>>2];if(o==0)break;if(++n,o>=65536){var a=o-65536;_+=String.fromCharCode(55296|a>>10,56320|a&1023)}else _+=String.fromCharCode(o)}return _}function At(e,t,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var _=t,o=_+n-4,a=0;a=55296&&A<=57343){var i=e.charCodeAt(++a);A=65536+((A&1023)<<10)|i&1023}if(L[t>>2]=A,t+=4,t+4>o)break}return L[t>>2]=0,t-_}function ft(e){for(var t=0,n=0;n=55296&&_<=57343&&++n,t+=4}return t}function Tt(e,t){return e%t>0&&(e+=t-e%t),e}var Ne,U,p,k,Ae,L,z,Ut,ht;function yt(e){Ne=e,r.HEAP8=U=new Int8Array(e),r.HEAP16=k=new Int16Array(e),r.HEAP32=L=new Int32Array(e),r.HEAPU8=p=new Uint8Array(e),r.HEAPU16=Ae=new Uint16Array(e),r.HEAPU32=z=new Uint32Array(e),r.HEAPF32=Ut=new Float32Array(e),r.HEAPF64=ht=new Float64Array(e)}var Tr=r.INITIAL_MEMORY||16777216,Ve,gt=[],Lt=[],ln=[],mt=[],Mn=!1;function Kn(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)dn(r.preRun.shift());We(gt)}function Bn(){Mn=!0,We(Lt)}function Cn(){We(ln)}function Fn(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Gn(r.postRun.shift());We(mt)}function dn(e){gt.unshift(e)}function Sn(e){Lt.unshift(e)}function Gn(e){mt.unshift(e)}var fe=0,ut=null,Pe=null;function Nn(e){fe++,r.monitorRunDependencies&&r.monitorRunDependencies(fe)}function Vn(e){if(fe--,r.monitorRunDependencies&&r.monitorRunDependencies(fe),fe==0&&(ut!==null&&(clearInterval(ut),ut=null),Pe)){var t=Pe;Pe=null,t()}}r.preloadedImages={},r.preloadedAudios={};function Oe(e){r.onAbort&&r.onAbort(e),e+="",se(e),Ie=!0,ce=1,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw l(t),t}function Dt(e,t){return String.prototype.startsWith?e.startsWith(t):e.indexOf(t)===0}var Pn="data:application/octet-stream;base64,";function It(e){return Dt(e,Pn)}var pn="file://";function bt(e){return Dt(e,pn)}var X="basis_transcoder.wasm";It(X)||(X=W(X));function wt(e){try{if(e==X&&oe)return new Uint8Array(oe);if(j)return j(e);throw"both async and sync fetching of the wasm failed"}catch(t){Oe(t)}}function En(){if(!oe&&(N||d)){if(typeof fetch=="function"&&!bt(X))return fetch(X,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+X+"'";return e.arrayBuffer()}).catch(function(){return wt(X)});if(ae)return new Promise(function(e,t){ae(X,function(n){e(new Uint8Array(n))},t)})}return Promise.resolve().then(function(){return wt(X)})}function vn(){var e={a:Q_};function t(A,i){var R=A.exports;r.asm=R,de=r.asm.K,yt(de.buffer),Ve=r.asm.O,Sn(r.asm.L),Vn("wasm-instantiate")}Nn("wasm-instantiate");function n(A){t(A.instance)}function _(A){return En().then(function(i){var R=WebAssembly.instantiate(i,e);return R}).then(A,function(i){se("failed to asynchronously prepare wasm: "+i),Oe(i)})}function o(){return!oe&&typeof WebAssembly.instantiateStreaming=="function"&&!It(X)&&!bt(X)&&typeof fetch=="function"?fetch(X,{credentials:"same-origin"}).then(function(A){var i=WebAssembly.instantiateStreaming(A,e);return i.then(n,function(R){return se("wasm streaming compile failed: "+R),se("falling back to ArrayBuffer instantiation"),_(n)})}):_(n)}if(r.instantiateWasm)try{var a=r.instantiateWasm(e,t);return a}catch(A){return se("Module.instantiateWasm callback failed with error: "+A),!1}return o().catch(l),{}}function We(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(r);continue}var n=t.func;typeof n=="number"?t.arg===void 0?Ve.get(n)():Ve.get(n)(t.arg):n(t.arg===void 0?null:t.arg)}}var je={};function Ye(e){for(;e.length;){var t=e.pop(),n=e.pop();n(t)}}function pe(e){return this.fromWireType(z[e>>2])}var le={},Te={},ze={},Un=48,hn=57;function qe(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=Un&&t<=hn?"_"+e:e}function Ze(e,t){return e=qe(e),new Function("body","return function "+e+`() { "use strict"; return body.apply(this, arguments); }; `)(t)}function Ot(e,t){var n=Ze(t,function(_){this.name=t,this.message=_;var o=new Error(_).stack;o!==void 0&&(this.stack=this.toString()+` `+o.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},n}var Ht=void 0;function Qe(e){throw new Ht(e)}function ie(e,t,n){e.forEach(function(i){ze[i]=t});function _(i){var R=n(i);R.length!==e.length&&Qe("Mismatched type converter count");for(var T=0;T>a])},destructorFunction:null})}function mn(e){if(!(this instanceof Re)||!(e instanceof Re))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,_=e.$$.ptrType.registeredClass,o=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;_.baseClass;)o=_.upcast(o),_=_.baseClass;return t===_&&n===o}function Dn(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function lt(e){function t(n){return n.$$.ptrType.registeredClass.name}S(t(e)+" instance already deleted")}var Mt=!1;function xt(e){}function In(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function kt(e){e.count.value-=1;var t=e.count.value===0;t&&In(e)}function Ee(e){return typeof FinalizationGroup>"u"?(Ee=function(t){return t},e):(Mt=new FinalizationGroup(function(t){for(var n=t.next();!n.done;n=t.next()){var _=n.value;_.ptr?kt(_):console.warn("object already deleted: "+_.ptr)}}),Ee=function(t){return Mt.register(t,t.$$,t.$$),t},xt=function(t){Mt.unregister(t.$$)},Ee(e))}function bn(){if(this.$$.ptr||lt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ee(Object.create(Object.getPrototypeOf(this),{$$:{value:Dn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function wn(){this.$$.ptr||lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),xt(this),kt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Hn(){return!this.$$.ptr}var ve=void 0,Ue=[];function Kt(){for(;Ue.length;){var e=Ue.pop();e.$$.deleteScheduled=!1,e.delete()}}function Xn(){return this.$$.ptr||lt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),Ue.push(this),Ue.length===1&&ve&&ve(Kt),this.$$.deleteScheduled=!0,this}function xn(){Re.prototype.isAliasOf=mn,Re.prototype.clone=bn,Re.prototype.delete=wn,Re.prototype.isDeleted=Hn,Re.prototype.deleteLater=Xn}function Re(){}var $t={};function Wt(e,t,n){if(e[t].overloadTable===void 0){var _=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||S("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[_.argCount]=_}}function Bt(e,t,n){r.hasOwnProperty(e)?((n===void 0||r[e].overloadTable!==void 0&&r[e].overloadTable[n]!==void 0)&&S("Cannot register public name '"+e+"' twice"),Wt(r,e,e),r.hasOwnProperty(n)&&S("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),r[e].overloadTable[n]=t):(r[e]=t,n!==void 0&&(r[e].numArguments=n))}function kn(e,t,n,_,o,a,A,i){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=_,this.baseClass=o,this.getActualType=a,this.upcast=A,this.downcast=i,this.pureVirtualFunctions=[]}function Ct(e,t,n){for(;t!==n;)t.upcast||S("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function $n(e,t){if(t===null)return this.isReference&&S("null is not a valid "+this.name),0;t.$$||S('Cannot pass "'+Ke(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass,_=Ct(t.$$.ptr,n,this.registeredClass);return _}function Wn(e,t){var n;if(t===null)return this.isReference&&S("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;t.$$||S('Cannot pass "'+Ke(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&S("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var _=t.$$.ptrType.registeredClass;if(n=Ct(t.$$.ptr,_,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&S("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:S("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var o=t.clone();n=this.rawShare(n,te(function(){o.delete()})),e!==null&&e.push(this.rawDestructor,n)}break;default:S("Unsupporting sharing policy")}return n}function jn(e,t){if(t===null)return this.isReference&&S("null is not a valid "+this.name),0;t.$$||S('Cannot pass "'+Ke(t)+'" as a '+this.name),t.$$.ptr||S("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&S("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass,_=Ct(t.$$.ptr,n,this.registeredClass);return _}function Yn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function zn(e){this.rawDestructor&&this.rawDestructor(e)}function qn(e){e!==null&&e.delete()}function jt(e,t,n){if(t===n)return e;if(n.baseClass===void 0)return null;var _=jt(e,t,n.baseClass);return _===null?null:n.downcast(_)}function Zn(){return Object.keys(he).length}function Qn(){var e=[];for(var t in he)he.hasOwnProperty(t)&&e.push(he[t]);return e}function Jn(e){ve=e,Ue.length&&ve&&ve(Kt)}function e_(){r.getInheritedInstanceCount=Zn,r.getLiveInheritedInstances=Qn,r.flushPendingDeletes=Kt,r.setDelayFunction=Jn}var he={};function t_(e,t){for(t===void 0&&S("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function n_(e,t){return t=t_(e,t),he[t]}function et(e,t){(!t.ptrType||!t.ptr)&&Qe("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,_=!!t.smartPtr;return n!==_&&Qe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ee(Object.create(e,{$$:{value:t}}))}function __(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=n_(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var _=n.clone();return this.destructor(e),_}function o(){return this.isSmartPointer?et(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):et(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=this.registeredClass.getActualType(t),A=$t[a];if(!A)return o.call(this);var i;this.isConst?i=A.constPointerType:i=A.pointerType;var R=jt(t,this.registeredClass,i.registeredClass);return R===null?o.call(this):this.isSmartPointer?et(i.registeredClass.instancePrototype,{ptrType:i,ptr:R,smartPtrType:this,smartPtr:e}):et(i.registeredClass.instancePrototype,{ptrType:i,ptr:R})}function r_(){ee.prototype.getPointee=Yn,ee.prototype.destructor=zn,ee.prototype.argPackAdvance=8,ee.prototype.readValueFromPointer=pe,ee.prototype.deleteObject=qn,ee.prototype.fromWireType=__}function ee(e,t,n,_,o,a,A,i,R,T,O){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=_,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=A,this.rawGetPointee=i,this.rawConstructor=R,this.rawShare=T,this.rawDestructor=O,!o&&t.baseClass===void 0?_?(this.toWireType=$n,this.destructorFunction=null):(this.toWireType=jn,this.destructorFunction=null):this.toWireType=Wn}function Yt(e,t,n){r.hasOwnProperty(e)||Qe("Replacing nonexistant public symbol"),r[e].overloadTable!==void 0&&n!==void 0?r[e].overloadTable[n]=t:(r[e]=t,r[e].argCount=n)}function s_(e,t,n){var _=r["dynCall_"+e];return n&&n.length?_.apply(null,[t].concat(n)):_.call(null,t)}function o_(e,t,n){return e.indexOf("j")!=-1?s_(e,t,n):Ve.get(t).apply(null,n)}function i_(e,t){var n=[];return function(){n.length=arguments.length;for(var _=0;_>2)+_]);return n}function a_(e,t,n,_,o,a){D(t>0);var A=Ft(t,n);o=Y(_,o);var i=[a],R=[];ie([],[e],function(T){T=T[0];var O="constructor "+T.name;if(T.registeredClass.constructor_body===void 0&&(T.registeredClass.constructor_body=[]),T.registeredClass.constructor_body[t-1]!==void 0)throw new Me("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+T.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return T.registeredClass.constructor_body[t-1]=function(){tt("Cannot construct "+T.name+" due to unbound types",A)},ie([],A,function(K){return T.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&S(O+" called with "+arguments.length+" arguments, expected "+(t-1)),R.length=0,i.length=t;for(var V=1;V0?", ":"")+K),G+=(T?"var rv = ":"")+"invoker(fn"+(K.length>0?", ":"")+K+`); `,i)G+=`runDestructors(destructors); `;else for(var R=A?1:2;R4&&--x[e].refcount===0&&(x[e]=void 0,dt.push(e))}function f_(){for(var e=0,t=5;t>1])};case 2:return function(_){var o=n?L:z;return this.fromWireType(o[_>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function M_(e,t,n,_){var o=Je(n);t=h(t);function a(){}a.values={},q(e,{name:t,constructor:a,fromWireType:function(A){return this.constructor.values[A]},toWireType:function(A,i){return i.value},argPackAdvance:8,readValueFromPointer:l_(t,o,_),destructorFunction:null}),Bt(t,a)}function nt(e,t){var n=Te[e];return n===void 0&&S(t+" has unknown type "+qt(e)),n}function K_(e,t,n){var _=nt(e,"enum");t=h(t);var o=_.constructor,a=Object.create(_.constructor.prototype,{value:{value:n},constructor:{value:Ze(_.name+"_"+t,function(){})}});o.values[n]=a,o[t]=a}function Ke(e){if(e===null)return"null";var t=typeof e;return t==="object"||t==="array"||t==="function"?e.toString():""+e}function B_(e,t){switch(t){case 2:return function(n){return this.fromWireType(Ut[n>>2])};case 3:return function(n){return this.fromWireType(ht[n>>3])};default:throw new TypeError("Unknown float type: "+e)}}function C_(e,t,n){var _=Je(n);t=h(t),q(e,{name:t,fromWireType:function(o){return o},toWireType:function(o,a){if(typeof a!="number"&&typeof a!="boolean")throw new TypeError('Cannot convert "'+Ke(a)+'" to '+this.name);return a},argPackAdvance:8,readValueFromPointer:B_(t,_),destructorFunction:null})}function F_(e,t,n,_,o,a){var A=Ft(t,n);e=h(e),o=Y(_,o),Bt(e,function(){tt("Cannot call "+e+" due to unbound types",A)},t-1),ie([],A,function(i){var R=[i[0],null].concat(i.slice(1));return Yt(e,Qt(e,R,null,o,a),t-1),[]})}function d_(e,t,n){switch(t){case 0:return n?function(o){return U[o]}:function(o){return p[o]};case 1:return n?function(o){return k[o>>1]}:function(o){return Ae[o>>1]};case 2:return n?function(o){return L[o>>2]}:function(o){return z[o>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function S_(e,t,n,_,o){t=h(t),o===-1&&(o=4294967295);var a=Je(n),A=function(T){return T};if(_===0){var i=32-8*n;A=function(T){return T<>>i}}var R=t.indexOf("unsigned")!=-1;q(e,{name:t,fromWireType:A,toWireType:function(T,O){if(typeof O!="number"&&typeof O!="boolean")throw new TypeError('Cannot convert "'+Ke(O)+'" to '+this.name);if(O<_||O>o)throw new TypeError('Passing a number "'+Ke(O)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+_+", "+o+"]!");return R?O>>>0:O|0},argPackAdvance:8,readValueFromPointer:d_(t,a,_!==0),destructorFunction:null})}function G_(e,t,n){var _=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],o=_[t];function a(A){A=A>>2;var i=z,R=i[A],T=i[A+1];return new o(Ne,T,R)}n=h(n),q(e,{name:n,fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})}function N_(e,t){t=h(t);var n=t==="std::string";q(e,{name:t,fromWireType:function(_){var o=z[_>>2],a;if(n)for(var A=_+4,i=0;i<=o;++i){var R=_+4+i;if(i==o||p[R]==0){var T=R-A,O=Se(A,T);a===void 0?a=O:(a+="\0",a+=O),A=R+1}}else{for(var K=new Array(o),i=0;i>2]=i,n&&A)Xe(o,R+4,i+1);else if(A)for(var T=0;T255&&(ne(R),S("String has UTF-16 code units that do not fit in 8 bits")),p[R+4+T]=O}else for(var T=0;T>2],O=a(),K,G=R+4,V=0;V<=T;++V){var y=R+4+V*t;if(V==T||O[y>>i]==0){var b=y-G,$=_(G,b);K===void 0?K=$:(K+="\0",K+=$),G=y+t}}return ne(R),K},toWireType:function(R,T){typeof T!="string"&&S("Cannot pass non-string to C++ string type "+n);var O=A(T),K=Nt(4+O+t);return z[K>>2]=O>>i,o(T,K+4,O+t),R!==null&&R.push(ne,K),K},argPackAdvance:8,readValueFromPointer:pe,destructorFunction:function(R){ne(R)}})}function P_(e,t,n,_,o,a){je[e]={name:h(t),rawConstructor:Y(n,_),rawDestructor:Y(o,a),fields:[]}}function p_(e,t,n,_,o,a,A,i,R,T){je[e].fields.push({fieldName:h(t),getterReturnType:n,getter:Y(_,o),getterContext:a,setterArgumentType:A,setter:Y(i,R),setterContext:T})}function E_(e,t){t=h(t),q(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(n,_){}})}function ye(e){return e||S("Cannot use deleted val. handle = "+e),x[e].value}function v_(e,t,n){e=ye(e),t=nt(t,"emval::as");var _=[],o=te(_);return L[n>>2]=o,t.toWireType(_,e)}var U_={};function _t(e){var t=U_[e];return t===void 0?h(e):t}var Gt=[];function h_(e,t,n,_){e=Gt[e],t=ye(t),n=_t(n),e(t,n,null,_)}function Jt(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function y_(e){return e===0?te(Jt()):(e=_t(e),te(Jt()[e]))}function g_(e){var t=Gt.length;return Gt.push(e),t}function L_(e,t){for(var n=new Array(e),_=0;_>2)+_],"parameter "+_);return n}function m_(e,t){for(var n=L_(e,t),_=n[0],o=_.name+"_$"+n.slice(1).map(function(V){return V.name}).join("_")+"$",a=["retType"],A=[_],i="",R=0;R4&&(x[e].refcount+=1)}function w_(e){for(var t="",n=0;n>> 2) + "+n+'], "parameter '+n+`"); var arg`+n+" = argType"+n+`.readValueFromPointer(args); args += argType`+n+`['argPackAdvance']; `;return _+="var obj = new constructor("+t+`); return __emval_register(obj); } `,new Function("requireRegisteredType","Module","__emval_register",_)(nt,r,te)}var en={};function H_(e,t,n,_){e=ye(e);var o=en[t];return o||(o=w_(t),en[t]=o),o(e,n,_)}function X_(e){return te(_t(e))}function x_(e){var t=x[e].value;Ye(t),St(e)}function k_(){Oe()}function $_(e,t,n){p.copyWithin(e,t,t+n)}function W_(e){try{return de.grow(e-Ne.byteLength+65535>>>16),yt(de.buffer),1}catch{}}function j_(e){var t=p.length;e=e>>>0;var n=2147483648;if(e>n)return!1;for(var _=1;_<=4;_*=2){var o=t*(1+.2/_);o=Math.min(o,e+100663296);var a=Math.min(n,Tt(Math.max(e,o),65536)),A=W_(a);if(A)return!0}return!1}var rt={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var n=rt.buffers[e];t===0||t===10?((e===1?it:se)(we(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){rt.varargs+=4;var e=L[rt.varargs-4>>2];return e},getStr:function(e){var t=Se(e);return t},get64:function(e,t){return e}};function Y_(e){return 0}function z_(e,t,n,_,o){}function q_(e,t,n,_){for(var o=0,a=0;a>2],i=L[t+(a*8+4)>>2],R=0;R>2]=o,0}function Z_(e){vt(e|0)}Ht=r.InternalError=Ot(Error,"InternalError"),gn(),Me=r.BindingError=Ot(Error,"BindingError"),xn(),r_(),e_(),zt=r.UnboundTypeError=Ot(Error,"UnboundTypeError"),u_();var Q_={t:yn,I:Ln,x:R_,w:a_,d:c_,k:A_,H:O_,n:M_,a:K_,A:C_,i:F_,j:S_,h:G_,B:N_,v:V_,u:P_,c:p_,J:E_,m:v_,s:h_,b:St,y:y_,p:m_,r:D_,e:I_,g:b_,q:H_,f:X_,l:x_,o:k_,E:$_,F:j_,G:Y_,C:z_,z:q_,D:Z_},ur=vn(),J_=r.___wasm_call_ctors=function(){return(J_=r.___wasm_call_ctors=r.asm.L).apply(null,arguments)},Nt=r._malloc=function(){return(Nt=r._malloc=r.asm.M).apply(null,arguments)},ne=r._free=function(){return(ne=r._free=r.asm.N).apply(null,arguments)},tn=r.___getTypeName=function(){return(tn=r.___getTypeName=r.asm.P).apply(null,arguments)},er=r.___embind_register_native_and_builtin_types=function(){return(er=r.___embind_register_native_and_builtin_types=r.asm.Q).apply(null,arguments)},tr=r.dynCall_jiji=function(){return(tr=r.dynCall_jiji=r.asm.R).apply(null,arguments)},st;function nr(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Pe=function e(){st||Vt(),st||(Pe=e)};function Vt(e){if(e=e||g,fe>0||(Kn(),fe>0))return;function t(){st||(st=!0,r.calledRun=!0,!Ie&&(Bn(),Cn(),C(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),Fn()))}r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),t()},1)):t()}if(r.run=Vt,r.preInit)for(typeof r.preInit=="function"&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return Vt(),f.ready}}();typeof ot=="object"&&typeof Et=="object"?Et.exports=pt:typeof define=="function"&&define.amd?define([],function(){return pt}):typeof ot=="object"&&(ot.BASIS=pt)});var B={UNSIGNED_BYTE:M.UNSIGNED_BYTE,UNSIGNED_SHORT:M.UNSIGNED_SHORT,UNSIGNED_INT:M.UNSIGNED_INT,FLOAT:M.FLOAT,HALF_FLOAT:M.HALF_FLOAT_OES,UNSIGNED_INT_24_8:M.UNSIGNED_INT_24_8,UNSIGNED_SHORT_4_4_4_4:M.UNSIGNED_SHORT_4_4_4_4,UNSIGNED_SHORT_5_5_5_1:M.UNSIGNED_SHORT_5_5_5_1,UNSIGNED_SHORT_5_6_5:M.UNSIGNED_SHORT_5_6_5};B.toWebGLConstant=function(s,f){switch(s){case B.UNSIGNED_BYTE:return M.UNSIGNED_BYTE;case B.UNSIGNED_SHORT:return M.UNSIGNED_SHORT;case B.UNSIGNED_INT:return M.UNSIGNED_INT;case B.FLOAT:return M.FLOAT;case B.HALF_FLOAT:return f.webgl2?M.HALF_FLOAT:M.HALF_FLOAT_OES;case B.UNSIGNED_INT_24_8:return M.UNSIGNED_INT_24_8;case B.UNSIGNED_SHORT_4_4_4_4:return M.UNSIGNED_SHORT_4_4_4_4;case B.UNSIGNED_SHORT_5_5_5_1:return M.UNSIGNED_SHORT_5_5_5_1;case B.UNSIGNED_SHORT_5_6_5:return B.UNSIGNED_SHORT_5_6_5}};B.isPacked=function(s){return s===B.UNSIGNED_INT_24_8||s===B.UNSIGNED_SHORT_4_4_4_4||s===B.UNSIGNED_SHORT_5_5_5_1||s===B.UNSIGNED_SHORT_5_6_5};B.sizeInBytes=function(s){switch(s){case B.UNSIGNED_BYTE:return 1;case B.UNSIGNED_SHORT:case B.UNSIGNED_SHORT_4_4_4_4:case B.UNSIGNED_SHORT_5_5_5_1:case B.UNSIGNED_SHORT_5_6_5:case B.HALF_FLOAT:return 2;case B.UNSIGNED_INT:case B.FLOAT:case B.UNSIGNED_INT_24_8:return 4}};B.validate=function(s){return s===B.UNSIGNED_BYTE||s===B.UNSIGNED_SHORT||s===B.UNSIGNED_INT||s===B.FLOAT||s===B.HALF_FLOAT||s===B.UNSIGNED_INT_24_8||s===B.UNSIGNED_SHORT_4_4_4_4||s===B.UNSIGNED_SHORT_5_5_5_1||s===B.UNSIGNED_SHORT_5_6_5};B.getTypedArrayConstructor=function(s){let f=B.sizeInBytes(s);return f===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:f===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:f===Float32Array.BYTES_PER_ELEMENT&&s===B.FLOAT?Float32Array:Uint32Array};var H=Object.freeze(B);var c={DEPTH_COMPONENT:M.DEPTH_COMPONENT,DEPTH_STENCIL:M.DEPTH_STENCIL,ALPHA:M.ALPHA,RED:M.RED,R:M.RED,RG:M.RG,RGB:M.RGB,RGBA:M.RGBA,LUMINANCE:M.LUMINANCE,LUMINANCE_ALPHA:M.LUMINANCE_ALPHA,RGB_DXT1:M.COMPRESSED_RGB_S3TC_DXT1_EXT,RGBA_DXT1:M.COMPRESSED_RGBA_S3TC_DXT1_EXT,RGBA_DXT3:M.COMPRESSED_RGBA_S3TC_DXT3_EXT,RGBA_DXT5:M.COMPRESSED_RGBA_S3TC_DXT5_EXT,RGB_PVRTC_4BPPV1:M.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,RGB_PVRTC_2BPPV1:M.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,RGBA_PVRTC_4BPPV1:M.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,RGBA_PVRTC_2BPPV1:M.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,RGBA_ASTC:M.COMPRESSED_RGBA_ASTC_4x4_WEBGL,RGB_ETC1:M.COMPRESSED_RGB_ETC1_WEBGL,RGB8_ETC2:M.COMPRESSED_RGB8_ETC2,RGBA8_ETC2_EAC:M.COMPRESSED_RGBA8_ETC2_EAC,RGBA_BC7:M.COMPRESSED_RGBA_BPTC_UNORM};c.componentsLength=function(s){switch(s){case c.RGB:return 3;case c.RGBA:return 4;case c.LUMINANCE_ALPHA:case c.RG:return 2;case c.ALPHA:case c.RED:case c.LUMINANCE:return 1;case c.R:return 4;default:return 1}};c.validate=function(s){return s===c.DEPTH_COMPONENT||s===c.DEPTH_STENCIL||s===c.ALPHA||s===c.RED||s===c.RG||s===c.RGB||s===c.RGBA||s===c.LUMINANCE||s===c.LUMINANCE_ALPHA||s===c.RGB_DXT1||s===c.RGBA_DXT1||s===c.RGBA_DXT3||s===c.RGBA_DXT5||s===c.RGB_PVRTC_4BPPV1||s===c.RGB_PVRTC_2BPPV1||s===c.RGBA_PVRTC_4BPPV1||s===c.RGBA_PVRTC_2BPPV1||s===c.RGBA_ASTC||s===c.RGB_ETC1||s===c.RGB8_ETC2||s===c.RGBA8_ETC2_EAC||s===c.RGBA_BC7||s===c.R};c.isColorFormat=function(s){return s===c.RED||s===c.ALPHA||s===c.RGB||s===c.RGBA||s===c.LUMINANCE||s===c.LUMINANCE_ALPHA||s===c.R};c.isDepthFormat=function(s){return s===c.DEPTH_COMPONENT||s===c.DEPTH_STENCIL};c.isCompressedFormat=function(s){return s===c.RGB_DXT1||s===c.RGBA_DXT1||s===c.RGBA_DXT3||s===c.RGBA_DXT5||s===c.RGB_PVRTC_4BPPV1||s===c.RGB_PVRTC_2BPPV1||s===c.RGBA_PVRTC_4BPPV1||s===c.RGBA_PVRTC_2BPPV1||s===c.RGBA_ASTC||s===c.RGB_ETC1||s===c.RGB8_ETC2||s===c.RGBA8_ETC2_EAC||s===c.RGBA_BC7};c.isDXTFormat=function(s){return s===c.RGB_DXT1||s===c.RGBA_DXT1||s===c.RGBA_DXT3||s===c.RGBA_DXT5};c.isPVRTCFormat=function(s){return s===c.RGB_PVRTC_4BPPV1||s===c.RGB_PVRTC_2BPPV1||s===c.RGBA_PVRTC_4BPPV1||s===c.RGBA_PVRTC_2BPPV1};c.isASTCFormat=function(s){return s===c.RGBA_ASTC};c.isETC1Format=function(s){return s===c.RGB_ETC1};c.isETC2Format=function(s){return s===c.RGB8_ETC2||s===c.RGBA8_ETC2_EAC};c.isBC7Format=function(s){return s===c.RGBA_BC7};c.compressedTextureSizeInBytes=function(s,f,r){switch(s){case c.RGB_DXT1:case c.RGBA_DXT1:case c.RGB_ETC1:case c.RGB8_ETC2:return Math.floor((f+3)/4)*Math.floor((r+3)/4)*8;case c.RGBA_DXT3:case c.RGBA_DXT5:case c.RGBA_ASTC:case c.RGBA8_ETC2_EAC:return Math.floor((f+3)/4)*Math.floor((r+3)/4)*16;case c.RGB_PVRTC_4BPPV1:case c.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(f,8)*Math.max(r,8)*4+7)/8);case c.RGB_PVRTC_2BPPV1:case c.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(f,16)*Math.max(r,8)*2+7)/8);case c.RGBA_BC7:return Math.ceil(f/4)*Math.ceil(r/4)*16;default:return 0}};c.textureSizeInBytes=function(s,f,r,C){let l=c.componentsLength(s);return H.isPacked(f)&&(l=1),l*H.sizeInBytes(f)*r*C};c.alignmentInBytes=function(s,f,r){let C=c.textureSizeInBytes(s,f,r,1)%4;return C===0?4:C===2?2:1};c.createTypedArray=function(s,f,r,C){let l=H.getTypedArrayConstructor(f),E=c.componentsLength(s)*r*C;return new l(E)};c.flipY=function(s,f,r,C,l){if(l===1)return s;let E=c.createTypedArray(f,r,C,l),F=c.componentsLength(f),g=C*F;for(let m=0;m>l,m=s.pixelHeight>>l,I=g*m*v.componentsLength(r);for(let N=0;N0)||!(m>0)||!(I>0))throw F.close(),F.delete(),new re("Invalid KTX2 file");let d,P,Q=f.dataFormatDescriptor[0],u=C.transcoder_texture_format;if(Q.colorModel===Tn)if(r.etc)d=N?v.RGBA8_ETC2_EAC:v.RGB8_ETC2,P=N?u.cTFETC2_RGBA:u.cTFETC1_RGB;else if(r.etc1&&!N)d=v.RGB_ETC1,P=u.cTFETC1_RGB;else if(r.s3tc)d=N?v.RGBA_DXT5:v.RGB_DXT1,P=N?u.cTFBC3_RGBA:u.cTFBC1_RGB;else if(r.pvrtc)d=N?v.RGBA_PVRTC_4BPPV1:v.RGB_PVRTC_4BPPV1,P=N?u.cTFPVRTC1_4_RGBA:u.cTFPVRTC1_4_RGB;else if(r.astc)d=v.RGBA_ASTC,P=u.cTFASTC_4x4_RGBA;else if(r.bc7)d=v.RGBA_BC7,P=u.cTFBC7_RGBA;else throw new re("No transcoding format target available for ETC1S compressed ktx2.");else if(Q.colorModel===un)if(r.astc)d=v.RGBA_ASTC,P=u.cTFASTC_4x4_RGBA;else if(r.bc7)d=v.RGBA_BC7,P=u.cTFBC7_RGBA;else if(r.s3tc)d=N?v.RGBA_DXT5:v.RGB_DXT1,P=N?u.cTFBC3_RGBA:u.cTFBC1_RGB;else if(r.etc)d=N?v.RGBA8_ETC2_EAC:v.RGB8_ETC2,P=N?u.cTFETC2_RGBA:u.cTFETC1_RGB;else if(r.etc1&&!N)d=v.RGB_ETC1,P=u.cTFETC1_RGB;else if(r.pvrtc)d=N?v.RGBA_PVRTC_4BPPV1:v.RGB_PVRTC_4BPPV1,P=N?u.cTFPVRTC1_4_RGBA:u.cTFPVRTC1_4_RGB;else throw new re("No transcoding format target available for UASTC compressed ktx2.");if(!F.startTranscoding())throw F.close(),F.delete(),new re("startTranscoding() failed");for(let W=0;W>W,m=f.pixelHeight>>W;let ae=F.getImageTranscodedSizeInBytes(W,0,0,P.value),j=new Uint8Array(ae),Be=F.transcodeImage(j,W,0,0,P.value,0,-1,-1);if(!Le(Be))throw new re("transcodeImage() failed.");l.push(j.buffer),J[fn[0]]={internalFormat:d,width:g,height:m,levelBuffer:j}}return F.close(),F.delete(),E}async function Ar(s,f){let r=s.webAssemblyConfig,C=An.default??self.BASIS;return Le(r.wasmBinaryFile)?De=await C(r):De=await C(),De.initializeBasis(),!0}function fr(s,f){let r=s.webAssemblyConfig;return Le(r)?Ar(s,f):Rr(s,f)}var Ur=on(fr);export{Ur as default};