/** * @license * Cesium - https://github.com/CesiumGS/cesium * Version 1.121.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 rn}from"./chunk-D2OP72K3.js";import{a as M}from"./chunk-L3ZF6YQH.js";import{a as ie}from"./chunk-IHT3NRUE.js";import{a as _n}from"./chunk-XK5OJOFF.js";import{b as nn}from"./chunk-YLNT2FRE.js";import{a as Gt,c as sr,d as or,e as ge}from"./chunk-PIOASIZ6.js";var Rn=sr((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:{},C,l;r.ready=new Promise(function(e,t){C=e,l=t});var P={},F;for(F in r)r.hasOwnProperty(F)&&(P[F]=r[F]);var U=[],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 se,le,W,J,g,Fe;p?(d?u=Gt("path").dirname(u)+"/":u=__dirname+"/",se=function(t,n){return g||(g=Gt("fs")),Fe||(Fe=Gt("path")),t=Fe.normalize(t),g.readFileSync(t,n?null:"utf8")},W=function(t){var n=se(t,!0);return n.buffer||(n=new Uint8Array(n)),Se(n.buffer),n},process.argv.length>1&&(y=process.argv[1].replace(/\\/g,"/")),U=process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof rr))throw e}),process.on("unhandledRejection",Me),m=function(e){process.exit(e)},r.inspect=function(){return"[Emscripten Module object]"}):Q?(typeof read<"u"&&(se=function(t){return read(t)}),W=function(t){var n;return typeof readbuffer=="function"?new Uint8Array(readbuffer(t)):(n=read(t,"binary"),Se(typeof n=="object"),n)},typeof scriptArgs<"u"?U=scriptArgs:typeof arguments<"u"&&(U=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="",se=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)}),le=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)},J=function(e){document.title=e});var st=r.print||console.log.bind(console),ee=r.printErr||console.warn.bind(console);for(F in P)P.hasOwnProperty(F)&&(r[F]=P[F]);P=null,r.arguments&&(U=r.arguments),r.thisProgram&&(y=r.thisProgram),r.quit&&(m=r.quit);var De=0,Ie=function(e){De=e},ae;r.wasmBinary&&(ae=r.wasmBinary);var ot=r.noExitRuntime||!0;typeof WebAssembly!="object"&&Me("no native wasm support detected");var ce,de=!1,be;function Se(e,t){e||Me("Assertion failed: "+t)}var we=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function He(e,t,n){for(var _=t+n,s=t;e[s]&&!(s>=_);)++s;if(s-t>16&&e.subarray&&we)return we.decode(e.subarray(t,s));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(!(_>0))return 0;for(var s=n,a=n+_-1,c=0;c=55296&&o<=57343){var R=e.charCodeAt(++c);o=65536+((o&1023)<<10)|R&1023}if(o<=127){if(n>=a)break;t[n++]=o}else if(o<=2047){if(n+1>=a)break;t[n++]=192|o>>6,t[n++]=128|o&63}else if(o<=65535){if(n+2>=a)break;t[n++]=224|o>>12,t[n++]=128|o>>6&63,t[n++]=128|o&63}else{if(n+3>=a)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63,t[n++]=128|o>>6&63,t[n++]=128|o&63}}return t[n]=0,n-s}function L(e,t,n){return Rt(e,D,t,n)}function j(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 Ae=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function at(e,t){for(var n=e,_=n>>1,s=_+t/2;!(_>=s)&&Ge[_];)++_;if(n=_<<1,n-e>32&&Ae)return Ae.decode(D.subarray(e,n));for(var a="",c=0;!(c>=t/2);++c){var o=fe[e+c*2>>1];if(o==0)break;a+=String.fromCharCode(o)}return a}function xe(e,t,n){if(n===void 0&&(n=2147483647),n<2)return 0;n-=2;for(var _=t,s=n>1]=c,t+=2}return fe[t>>1]=0,t-_}function Tn(e){return e.length*2}function un(e,t){for(var n=0,_="";!(n>=t/4);){var s=w[e+n*4>>2];if(s==0)break;if(++n,s>=65536){var a=s-65536;_+=String.fromCharCode(55296|a>>10,56320|a&1023)}else _+=String.fromCharCode(s)}return _}function On(e,t,n){if(n===void 0&&(n=2147483647),n<4)return 0;for(var _=t,s=_+n-4,a=0;a=55296&&c<=57343){var o=e.charCodeAt(++a);c=65536+((c&1023)<<10)|o&1023}if(w[t>>2]=c,t+=4,t+4>s)break}return w[t>>2]=0,t-_}function ln(e){for(var t=0,n=0;n=55296&&_<=57343&&++n,t+=4}return t}function Mn(e,t){return e%t>0&&(e+=t-e%t),e}var ct,ke,D,fe,Ge,w,Y,Pt,Et;function vt(e){ct=e,r.HEAP8=ke=new Int8Array(e),r.HEAP16=fe=new Int16Array(e),r.HEAP32=w=new Int32Array(e),r.HEAPU8=D=new Uint8Array(e),r.HEAPU16=Ge=new Uint16Array(e),r.HEAPU32=Y=new Uint32Array(e),r.HEAPF32=Pt=new Float32Array(e),r.HEAPF64=Et=new Float64Array(e)}var ur=r.INITIAL_MEMORY||16777216,Ve,ht=[],Ut=[],Kn=[],yt=[],Bn=!1;function Cn(){if(r.preRun)for(typeof r.preRun=="function"&&(r.preRun=[r.preRun]);r.preRun.length;)Gn(r.preRun.shift());$e(ht)}function Fn(){Bn=!0,$e(Ut)}function dn(){$e(Kn)}function Sn(){if(r.postRun)for(typeof r.postRun=="function"&&(r.postRun=[r.postRun]);r.postRun.length;)Nn(r.postRun.shift());$e(yt)}function Gn(e){ht.unshift(e)}function Vn(e){Ut.unshift(e)}function Nn(e){yt.unshift(e)}var Te=0,At=null,Ne=null;function pn(e){Te++,r.monitorRunDependencies&&r.monitorRunDependencies(Te)}function Pn(e){if(Te--,r.monitorRunDependencies&&r.monitorRunDependencies(Te),Te==0&&(At!==null&&(clearInterval(At),At=null),Ne)){var t=Ne;Ne=null,t()}}r.preloadedImages={},r.preloadedAudios={};function Me(e){r.onAbort&&r.onAbort(e),e+="",ee(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 En="data:application/octet-stream;base64,";function Lt(e){return gt(e,En)}var vn="file://";function mt(e){return gt(e,vn)}var x="basis_transcoder.wasm";Lt(x)||(x=X(x));function Dt(e){try{if(e==x&&ae)return new Uint8Array(ae);if(W)return W(e);throw"both async and sync fetching of the wasm failed"}catch(t){Me(t)}}function hn(){if(!ae&&(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(le)return new Promise(function(e,t){le(x,function(n){e(new Uint8Array(n))},t)})}return Promise.resolve().then(function(){return Dt(x)})}function Un(){var e={a:er};function t(c,o){var R=c.exports;r.asm=R,ce=r.asm.K,vt(ce.buffer),Ve=r.asm.O,Vn(r.asm.L),Pn("wasm-instantiate")}pn("wasm-instantiate");function n(c){t(c.instance)}function _(c){return hn().then(function(o){var R=WebAssembly.instantiate(o,e);return R}).then(c,function(o){ee("failed to asynchronously prepare wasm: "+o),Me(o)})}function s(){return!ae&&typeof WebAssembly.instantiateStreaming=="function"&&!Lt(x)&&!mt(x)&&typeof fetch=="function"?fetch(x,{credentials:"same-origin"}).then(function(c){var o=WebAssembly.instantiateStreaming(c,e);return o.then(n,function(R){return ee("wasm streaming compile failed: "+R),ee("falling back to ArrayBuffer instantiation"),_(n)})}):_(n)}if(r.instantiateWasm)try{var a=r.instantiateWasm(e,t);return a}catch(c){return ee("Module.instantiateWasm callback failed with error: "+c),!1}return s().catch(l),{}}function $e(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 We={};function je(e){for(;e.length;){var t=e.pop(),n=e.pop();n(t)}}function pe(e){return this.fromWireType(Y[e>>2])}var Ke={},ue={},ze={},yn=48,gn=57;function Ye(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=yn&&t<=gn?"_"+e:e}function qe(e,t){return e=Ye(e),new Function("body","return function "+e+`() { "use strict"; return body.apply(this, arguments); }; `)(t)}function ft(e,t){var n=qe(t,function(_){this.name=t,this.message=_;var s=new Error(_).stack;s!==void 0&&(this.stack=this.toString()+` `+s.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 It=void 0;function Ze(e){throw new It(e)}function oe(e,t,n){e.forEach(function(o){ze[o]=t});function _(o){var R=n(o);R.length!==e.length&&Ze("Mismatched type converter count");for(var T=0;T>a])},destructorFunction:null})}function In(e){if(!(this instanceof Re)||!(e instanceof Re))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,_=e.$$.ptrType.registeredClass,s=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;_.baseClass;)s=_.upcast(s),_=_.baseClass;return t===_&&n===s}function bn(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(n){return n.$$.ptrType.registeredClass.name}S(t(e)+" instance already deleted")}var ut=!1;function wt(e){}function wn(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&&wn(e)}function Pe(e){return typeof FinalizationGroup>"u"?(Pe=function(t){return t},e):(ut=new FinalizationGroup(function(t){for(var n=t.next();!n.done;n=t.next()){var _=n.value;_.ptr?Ht(_):console.warn("object already deleted: "+_.ptr)}}),Pe=function(t){return ut.register(t,t.$$,t.$$),t},wt=function(t){ut.unregister(t.$$)},Pe(e))}function Hn(){if(this.$$.ptr||Tt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Pe(Object.create(Object.getPrototypeOf(this),{$$:{value:bn(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Xn(){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 xn(){return!this.$$.ptr}var Ee=void 0,ve=[];function Ot(){for(;ve.length;){var e=ve.pop();e.$$.deleteScheduled=!1,e.delete()}}function kn(){return this.$$.ptr||Tt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&S("Object already scheduled for deletion"),ve.push(this),ve.length===1&&Ee&&Ee(Ot),this.$$.deleteScheduled=!0,this}function $n(){Re.prototype.isAliasOf=In,Re.prototype.clone=Hn,Re.prototype.delete=Xn,Re.prototype.isDeleted=xn,Re.prototype.deleteLater=kn}function Re(){}var Xt={};function xt(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 lt(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"),xt(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 Wn(e,t,n,_,s,a,c,o){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=_,this.baseClass=s,this.getActualType=a,this.upcast=c,this.downcast=o,this.pureVirtualFunctions=[]}function Mt(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 jn(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 n=t.$$.ptrType.registeredClass,_=Mt(t.$$.ptr,n,this.registeredClass);return _}function zn(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 "'+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 _=t.$$.ptrType.registeredClass;if(n=Mt(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 s=t.clone();n=this.rawShare(n,ne(function(){s.delete()})),e!==null&&e.push(this.rawDestructor,n)}break;default:S("Unsupporting sharing policy")}return n}function Yn(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 n=t.$$.ptrType.registeredClass,_=Mt(t.$$.ptr,n,this.registeredClass);return _}function qn(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 kt(e,t,n){if(t===n)return e;if(n.baseClass===void 0)return null;var _=kt(e,t,n.baseClass);return _===null?null:n.downcast(_)}function Jn(){return Object.keys(he).length}function e_(){var e=[];for(var t in he)he.hasOwnProperty(t)&&e.push(he[t]);return e}function t_(e){Ee=e,ve.length&&Ee&&Ee(Ot)}function n_(){r.getInheritedInstanceCount=Jn,r.getLiveInheritedInstances=e_,r.flushPendingDeletes=Ot,r.setDelayFunction=t_}var he={};function __(e,t){for(t===void 0&&S("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function r_(e,t){return t=__(e,t),he[t]}function Je(e,t){(!t.ptrType||!t.ptr)&&Ze("makeClassHandle requires ptr and ptrType");var n=!!t.smartPtrType,_=!!t.smartPtr;return n!==_&&Ze("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Pe(Object.create(e,{$$:{value:t}}))}function i_(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=r_(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 s(){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 s.call(this);var o;this.isConst?o=c.constPointerType:o=c.pointerType;var R=kt(t,this.registeredClass,o.registeredClass);return R===null?s.call(this):this.isSmartPointer?Je(o.registeredClass.instancePrototype,{ptrType:o,ptr:R,smartPtrType:this,smartPtr:e}):Je(o.registeredClass.instancePrototype,{ptrType:o,ptr:R})}function s_(){te.prototype.getPointee=qn,te.prototype.destructor=Zn,te.prototype.argPackAdvance=8,te.prototype.readValueFromPointer=pe,te.prototype.deleteObject=Qn,te.prototype.fromWireType=i_}function te(e,t,n,_,s,a,c,o,R,T,O){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=_,this.isSmartPointer=s,this.pointeeType=a,this.sharingPolicy=c,this.rawGetPointee=o,this.rawConstructor=R,this.rawShare=T,this.rawDestructor=O,!s&&t.baseClass===void 0?_?(this.toWireType=jn,this.destructorFunction=null):(this.toWireType=Yn,this.destructorFunction=null):this.toWireType=zn}function $t(e,t,n){r.hasOwnProperty(e)||Ze("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 o_(e,t,n){var _=r["dynCall_"+e];return n&&n.length?_.apply(null,[t].concat(n)):_.call(null,t)}function R_(e,t,n){return e.indexOf("j")!=-1?o_(e,t,n):Ve.get(t).apply(null,n)}function a_(e,t){var n=[];return function(){n.length=arguments.length;for(var _=0;_>2)+_]);return n}function A_(e,t,n,_,s,a){Se(t>0);var c=Kt(t,n);s=z(_,s);var o=[a],R=[];oe([],[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)},oe([],c,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,o.length=t;for(var N=1;N0?", ":"")+K),G+=(T?"var rv = ":"")+"invoker(fn"+(K.length>0?", ":"")+K+`); `,o)G+=`runDestructors(destructors); `;else for(var R=c?1:2;R4&&--k[e].refcount===0&&(k[e]=void 0,Bt.push(e))}function u_(){for(var e=0,t=5;t>1])};case 2:return function(_){var s=n?w:Y;return this.fromWireType(s[_>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function B_(e,t,n,_){var s=Qe(n);t=v(t);function a(){}a.values={},q(e,{name:t,constructor:a,fromWireType:function(c){return this.constructor.values[c]},toWireType:function(c,o){return o.value},argPackAdvance:8,readValueFromPointer:K_(t,s,_),destructorFunction:null}),lt(t,a)}function tt(e,t){var n=ue[e];return n===void 0&&S(t+" has unknown type "+jt(e)),n}function C_(e,t,n){var _=tt(e,"enum");t=v(t);var s=_.constructor,a=Object.create(_.constructor.prototype,{value:{value:n},constructor:{value:qe(_.name+"_"+t,function(){})}});s.values[n]=a,s[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 F_(e,t){switch(t){case 2:return function(n){return this.fromWireType(Pt[n>>2])};case 3:return function(n){return this.fromWireType(Et[n>>3])};default:throw new TypeError("Unknown float type: "+e)}}function d_(e,t,n){var _=Qe(n);t=v(t),q(e,{name:t,fromWireType:function(s){return s},toWireType:function(s,a){if(typeof a!="number"&&typeof a!="boolean")throw new TypeError('Cannot convert "'+Ce(a)+'" to '+this.name);return a},argPackAdvance:8,readValueFromPointer:F_(t,_),destructorFunction:null})}function S_(e,t,n,_,s,a){var c=Kt(t,n);e=v(e),s=z(_,s),lt(e,function(){et("Cannot call "+e+" due to unbound types",c)},t-1),oe([],c,function(o){var R=[o[0],null].concat(o.slice(1));return $t(e,Yt(e,R,null,s,a),t-1),[]})}function G_(e,t,n){switch(t){case 0:return n?function(s){return ke[s]}:function(s){return D[s]};case 1:return n?function(s){return fe[s>>1]}:function(s){return Ge[s>>1]};case 2:return n?function(s){return w[s>>2]}:function(s){return Y[s>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function V_(e,t,n,_,s){t=v(t),s===-1&&(s=4294967295);var a=Qe(n),c=function(T){return T};if(_===0){var o=32-8*n;c=function(T){return T<>>o}}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(O<_||O>s)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 ['+_+", "+s+"]!");return R?O>>>0:O|0},argPackAdvance:8,readValueFromPointer:G_(t,a,_!==0),destructorFunction:null})}function N_(e,t,n){var _=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=_[t];function a(c){c=c>>2;var o=Y,R=o[c],T=o[c+1];return new s(ct,T,R)}n=v(n),q(e,{name:n,fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})}function p_(e,t){t=v(t);var n=t==="std::string";q(e,{name:t,fromWireType:function(_){var s=Y[_>>2],a;if(n)for(var c=_+4,o=0;o<=s;++o){var R=_+4+o;if(o==s||D[R]==0){var T=R-c,O=Xe(c,T);a===void 0?a=O:(a+="\0",a+=O),c=R+1}}else{for(var K=new Array(s),o=0;o>2]=o,n&&c)L(s,R+4,o+1);else if(c)for(var T=0;T255&&(_e(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(),K,G=R+4,N=0;N<=T;++N){var h=R+4+N*t;if(N==T||O[h>>o]==0){var I=h-G,$=_(G,I);K===void 0?K=$:(K+="\0",K+=$),G=h+t}}return _e(R),K},toWireType:function(R,T){typeof T!="string"&&S("Cannot pass non-string to C++ string type "+n);var O=c(T),K=dt(4+O+t);return Y[K>>2]=O>>o,s(T,K+4,O+t),R!==null&&R.push(_e,K),K},argPackAdvance:8,readValueFromPointer:pe,destructorFunction:function(R){_e(R)}})}function E_(e,t,n,_,s,a){We[e]={name:v(t),rawConstructor:z(n,_),rawDestructor:z(s,a),fields:[]}}function v_(e,t,n,_,s,a,c,o,R,T){We[e].fields.push({fieldName:v(t),getterReturnType:n,getter:z(_,s),getterContext:a,setterArgumentType:c,setter:z(o,R),setterContext:T})}function h_(e,t){t=v(t),q(e,{isVoid:!0,name:t,argPackAdvance:0,fromWireType:function(){},toWireType:function(n,_){}})}function Ue(e){return e||S("Cannot use deleted val. handle = "+e),k[e].value}function U_(e,t,n){e=Ue(e),t=tt(t,"emval::as");var _=[],s=ne(_);return w[n>>2]=s,t.toWireType(_,e)}var y_={};function nt(e){var t=y_[e];return t===void 0?v(e):t}var Ft=[];function g_(e,t,n,_){e=Ft[e],t=Ue(t),n=nt(n),e(t,n,null,_)}function qt(){return typeof globalThis=="object"?globalThis:function(){return Function}()("return this")()}function L_(e){return e===0?ne(qt()):(e=nt(e),ne(qt()[e]))}function m_(e){var t=Ft.length;return Ft.push(e),t}function D_(e,t){for(var n=new Array(e),_=0;_>2)+_],"parameter "+_);return n}function I_(e,t){for(var n=D_(e,t),_=n[0],s=_.name+"_$"+n.slice(1).map(function(N){return N.name}).join("_")+"$",a=["retType"],c=[_],o="",R=0;R4&&(k[e].refcount+=1)}function X_(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",_)(tt,r,ne)}var Zt={};function x_(e,t,n,_){e=Ue(e);var s=Zt[t];return s||(s=X_(t),Zt[t]=s),s(e,n,_)}function k_(e){return ne(nt(e))}function $_(e){var t=k[e].value;je(t),Ct(e)}function W_(){Me()}function j_(e,t,n){D.copyWithin(e,t,t+n)}function z_(e){try{return ce.grow(e-ct.byteLength+65535>>>16),vt(ce.buffer),1}catch{}}function Y_(e){var t=D.length;e=e>>>0;var n=2147483648;if(e>n)return!1;for(var _=1;_<=4;_*=2){var s=t*(1+.2/_);s=Math.min(s,e+100663296);var a=Math.min(n,Mn(Math.max(e,s),65536)),c=z_(a);if(c)return!0}return!1}var _t={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var n=_t.buffers[e];t===0||t===10?((e===1?st:ee)(He(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){_t.varargs+=4;var e=w[_t.varargs-4>>2];return e},getStr:function(e){var t=Xe(e);return t},get64:function(e,t){return e}};function q_(e){return 0}function Z_(e,t,n,_,s){}function Q_(e,t,n,_){for(var s=0,a=0;a>2],o=w[t+(a*8+4)>>2],R=0;R>2]=s,0}function J_(e){Ie(e|0)}It=r.InternalError=ft(Error,"InternalError"),mn(),Be=r.BindingError=ft(Error,"BindingError"),$n(),s_(),n_(),Wt=r.UnboundTypeError=ft(Error,"UnboundTypeError"),l_();var er={t:Ln,I:Dn,x:c_,w:A_,d:f_,k:T_,H:M_,n:B_,a:C_,A:d_,i:S_,j:V_,h:N_,B:p_,v:P_,u:E_,c:v_,J:h_,m:U_,s:g_,b:Ct,y:L_,p:I_,r:b_,e:w_,g:H_,q:x_,f:k_,l:$_,o:W_,E:j_,F:Y_,G:q_,C:Z_,z:Q_,D:J_},Or=Un(),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)},_e=r._free=function(){return(_e=r._free=r.asm.N).apply(null,arguments)},Qt=r.___getTypeName=function(){return(Qt=r.___getTypeName=r.asm.P).apply(null,arguments)},nr=r.___embind_register_native_and_builtin_types=function(){return(nr=r.___embind_register_native_and_builtin_types=r.asm.Q).apply(null,arguments)},_r=r.dynCall_jiji=function(){return(_r=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||U,Te>0||(Cn(),Te>0))return;function t(){rt||(rt=!0,r.calledRun=!0,!de&&(Fn(),dn(),C(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),Sn()))}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 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(i,f){switch(i){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(i){return i===B.UNSIGNED_INT_24_8||i===B.UNSIGNED_SHORT_4_4_4_4||i===B.UNSIGNED_SHORT_5_5_5_1||i===B.UNSIGNED_SHORT_5_6_5};B.sizeInBytes=function(i){switch(i){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(i){return i===B.UNSIGNED_BYTE||i===B.UNSIGNED_SHORT||i===B.UNSIGNED_INT||i===B.FLOAT||i===B.HALF_FLOAT||i===B.UNSIGNED_INT_24_8||i===B.UNSIGNED_SHORT_4_4_4_4||i===B.UNSIGNED_SHORT_5_5_5_1||i===B.UNSIGNED_SHORT_5_6_5};B.getTypedArrayConstructor=function(i){let f=B.sizeInBytes(i);return f===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:f===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:f===Float32Array.BYTES_PER_ELEMENT&&i===B.FLOAT?Float32Array:Uint32Array};var H=Object.freeze(B);var A={DEPTH_COMPONENT:M.DEPTH_COMPONENT,DEPTH_STENCIL:M.DEPTH_STENCIL,ALPHA:M.ALPHA,RED: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};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.RED||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,C){let l=A.componentsLength(i);return H.isPacked(f)&&(l=1),l*H.sizeInBytes(f)*r*C};A.alignmentInBytes=function(i,f,r){let C=A.textureSizeInBytes(i,f,r,1)%4;return C===0?4:C===2?2:1};A.createTypedArray=function(i,f,r,C){let l=H.getTypedArrayConstructor(f),P=A.componentsLength(i)*r*C;return new l(P)};A.flipY=function(i,f,r,C,l){if(l===1)return i;let P=A.createTypedArray(f,r,C,l),F=A.componentsLength(f),U=C*F;for(let y=0;y>l,y=i.pixelHeight>>l,m=U*y*E.componentsLength(r);for(let V=0;V0)||!(y>0)||!(m>0))throw F.close(),F.delete(),new ie("Invalid KTX2 file");let d,p,Q=f.dataFormatDescriptor[0],u=C.transcoder_texture_format;if(Q.colorModel===An)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 ie("No transcoding format target available for ETC1S compressed ktx2.");else if(Q.colorModel===fn)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 ie("No transcoding format target available for UASTC compressed ktx2.");if(!F.startTranscoding())throw F.close(),F.delete(),new ie("startTranscoding() failed");for(let X=0;X>X,y=f.pixelHeight>>X;let le=F.getImageTranscodedSizeInBytes(X,0,0,p.value),W=new Uint8Array(le),J=F.transcodeImage(W,X,0,0,p.value,0,-1,-1);if(!ge(J))throw new ie("transcodeImage() failed.");l.push(W.buffer),se[cn[0]]={internalFormat:d,width:U,height:y,levelBuffer:W}}return F.close(),F.delete(),P}async function fr(i,f){let r=i.webAssemblyConfig,C=_n(an.default,self.BASIS);return ge(r.wasmBinaryFile)?me=await C(r):me=await C(),me.initializeBasis(),!0}function Tr(i,f){let r=i.webAssemblyConfig;return ge(r)?fr(i,f):ar(i,f)}var yr=rn(Tr);export{yr as default};