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