/**
 * @license
 * Cesium - https://github.com/CesiumGS/cesium
 * Version 1.122
 *
 * 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-JQWRUZSV.js";import{a as M}from"./chunk-2NAI7YQ3.js";import{a as ie}from"./chunk-QE3ZUOZY.js";import{a as _n}from"./chunk-6KLVDWWE.js";import{b as nn}from"./chunk-6P5KAIBX.js";import{a as Gt,c as sr,d as or,e as ge}from"./chunk-4FSVUTPL.js";var Rn=sr(((e,t)=>{var r,n=(r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0,typeof __filename<"u"&&(r=r||__filename),function(e){var t,n,_=typeof(e=e||{})<"u"?e:{};_.ready=new Promise((function(e,r){t=e,n=r}));var i,o={};for(i in _)_.hasOwnProperty(i)&&(o[i]=_[i]);var a,s,u=[],R=!1,A=!1;R="object"==typeof window,A="function"==typeof importScripts,a="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,s=!R&&!a&&!A;var c,T,f,l,O,p="";a?(p=A?Gt("path").dirname(p)+"/":__dirname+"/",c=function(e,t){return l||(l=Gt("fs")),O||(O=Gt("path")),e=O.normalize(e),l.readFileSync(e,t?null:"utf8")},f=function(e){var t=c(e,!0);return t.buffer||(t=new Uint8Array(t)),K(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),u=process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof $t))throw e})),process.on("unhandledRejection",J),_.inspect=function(){return"[Emscripten Module object]"}):s?(typeof read<"u"&&(c=function(e){return read(e)}),f=function(e){var t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(K("object"==typeof(t=read(e,"binary"))),t)},typeof scriptArgs<"u"?u=scriptArgs:typeof arguments<"u"&&(u=arguments),typeof print<"u"&&(typeof console>"u"&&(console={}),console.log=print,console.warn=console.error=typeof printErr<"u"?printErr:print)):(R||A)&&(A?p=self.location.href:typeof document<"u"&&document.currentScript&&(p=document.currentScript.src),r&&(p=r),p=0!==p.indexOf("blob:")?p.substr(0,p.lastIndexOf("/")+1):"",c=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},A&&(f=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),T=function(e,t,r){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):r()},n.onerror=r,n.send(null)});var B,M=_.print||console.log.bind(console),C=_.printErr||console.warn.bind(console);for(i in o)o.hasOwnProperty(i)&&(_[i]=o[i]);o=null,_.arguments&&(u=_.arguments),_.thisProgram&&_.thisProgram,_.quit&&_.quit,_.wasmBinary&&(B=_.wasmBinary),_.noExitRuntime,"object"!=typeof WebAssembly&&J("no native wasm support detected");var h,d=!1;function K(e,t){e||J("Assertion failed: "+t)}var G=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function F(e,t,r){for(var n=t+r,_=t;e[_]&&!(_>=n);)++_;if(_-t>16&&e.subarray&&G)return G.decode(e.subarray(t,_));for(var i="";t<_;){var o=e[t++];if(128&o){var a=63&e[t++];if(192!=(224&o)){var s=63&e[t++];if((o=224==(240&o)?(15&o)<<12|a<<6|s:(7&o)<<18|a<<12|s<<6|63&e[t++])<65536)i+=String.fromCharCode(o);else{var u=o-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&o)<<6|a)}else i+=String.fromCharCode(o)}return i}function y(e,t){return e?F(v,e,t):""}var N,P,v,S,V,E,m,U,g,L=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function w(e,t){for(var r=e,n=r>>1,_=n+t/2;!(n>=_)&&V[n];)++n;if((r=n<<1)-e>32&&L)return L.decode(v.subarray(e,r));for(var i="",o=0;!(o>=t/2);++o){var a=S[e+2*o>>1];if(0==a)break;i+=String.fromCharCode(a)}return i}function b(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,_=(r-=2)<2*e.length?r/2:e.length,i=0;i<_;++i){var o=e.charCodeAt(i);S[t>>1]=o,t+=2}return S[t>>1]=0,t-n}function D(e){return 2*e.length}function I(e,t){for(var r=0,n="";!(r>=t/4);){var _=E[e+4*r>>2];if(0==_)break;if(++r,_>=65536){var i=_-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(_)}return n}function X(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var n=t,_=n+r-4,i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),E[t>>2]=o,(t+=4)+4>_)break}return E[t>>2]=0,t-n}function x(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function H(e,t){return e%t>0&&(e+=t-e%t),e}function $(e){N=e,_.HEAP8=P=new Int8Array(e),_.HEAP16=S=new Int16Array(e),_.HEAP32=E=new Int32Array(e),_.HEAPU8=v=new Uint8Array(e),_.HEAPU16=V=new Uint16Array(e),_.HEAPU32=m=new Uint32Array(e),_.HEAPF32=U=new Float32Array(e),_.HEAPF64=g=new Float64Array(e)}_.INITIAL_MEMORY;var k,W=[],j=[],z=[],Y=[],q=0,Z=null,Q=null;function J(e){_.onAbort&&_.onAbort(e),C(e+=""),d=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(e);throw n(t),t}function ee(e,t){return String.prototype.startsWith?e.startsWith(t):0===e.indexOf(t)}_.preloadedImages={},_.preloadedAudios={};var te="data:application/octet-stream;base64,";function re(e){return ee(e,te)}var ne="file://";function _e(e){return ee(e,ne)}var ie,oe="basis_transcoder.wasm";function ae(e){try{if(e==oe&&B)return new Uint8Array(B);if(f)return f(e);throw"both async and sync fetching of the wasm failed"}catch(e){J(e)}}function se(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?k.get(r)():k.get(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(_)}}re(oe)||(ie=oe,oe=_.locateFile?_.locateFile(ie,p):p+ie);var ue={};function Re(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Ae(e){return this.fromWireType(m[e>>2])}var ce={},Te={},fe={},le=48,Oe=57;function pe(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=le&&t<=Oe?"_"+e:e}function Be(e,t){return e=pe(e),new Function("body","return function "+e+'() {\n    "use strict";    return body.apply(this, arguments);\n};\n')(t)}function Me(e,t){var r=Be(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var Ce=void 0;function he(e){throw new Ce(e)}function de(e,t,r){function n(t){var n=r(t);n.length!==e.length&&he("Mismatched type converter count");for(var _=0;_<e.length;++_)Pe(e[_],n[_])}e.forEach((function(e){fe[e]=t}));var _=new Array(t.length),i=[],o=0;t.forEach((function(e,t){Te.hasOwnProperty(e)?_[t]=Te[e]:(i.push(e),ce.hasOwnProperty(e)||(ce[e]=[]),ce[e].push((function(){_[t]=Te[e],++o===i.length&&n(_)})))})),0===i.length&&n(_)}function Ke(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var Ge=void 0;function Fe(e){for(var t="",r=e;v[r];)t+=Ge[v[r++]];return t}var ye=void 0;function Ne(e){throw new ye(e)}function Pe(e,t,r){if(r=r||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||Ne('type "'+n+'" must have a positive integer typeid pointer'),Te.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Ne("Cannot register type '"+n+"' twice")}if(Te[e]=t,delete fe[e],ce.hasOwnProperty(e)){var _=ce[e];delete ce[e],_.forEach((function(e){e()}))}}function ve(e){if(!(this instanceof He&&e instanceof He))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=e.$$.ptrType.registeredClass,_=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)_=n.upcast(_),n=n.baseClass;return t===n&&r===_}function Se(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function Ve(e){Ne(e.$$.ptrType.registeredClass.name+" instance already deleted")}var Ee=!1;function me(e){}function Ue(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function ge(e){return typeof FinalizationGroup>"u"?(ge=function(e){return e},e):(Ee=new FinalizationGroup((function(e){for(var t=e.next();!t.done;t=e.next()){var r=t.value;r.ptr?Ue(r):console.warn("object already deleted: "+r.ptr)}})),me=function(e){Ee.unregister(e.$$)},(ge=function(e){return Ee.register(e,e.$$,e.$$),e})(e))}function Le(){if(this.$$.ptr||Ve(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=ge(Object.create(Object.getPrototypeOf(this),{$$:{value:Se(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function we(){this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ne("Object already scheduled for deletion"),me(this),Ue(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function be(){return!this.$$.ptr}var De=void 0,Ie=[];function Xe(){for(;Ie.length;){var e=Ie.pop();e.$$.deleteScheduled=!1,e.delete()}}function xe(){return this.$$.ptr||Ve(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Ne("Object already scheduled for deletion"),Ie.push(this),1===Ie.length&&De&&De(Xe),this.$$.deleteScheduled=!0,this}function He(){}var $e={};function ke(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Ne("Function '"+r+"' 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 We(e,t,r){_.hasOwnProperty(e)?((void 0===r||void 0!==_[e].overloadTable&&void 0!==_[e].overloadTable[r])&&Ne("Cannot register public name '"+e+"' twice"),ke(_,e,e),_.hasOwnProperty(r)&&Ne("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),_[e].overloadTable[r]=t):(_[e]=t,void 0!==r&&(_[e].numArguments=r))}function je(e,t,r,n,_,i,o,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=_,this.getActualType=i,this.upcast=o,this.downcast=a,this.pureVirtualFunctions=[]}function ze(e,t,r){for(;t!==r;)t.upcast||Ne("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Ye(e,t){if(null===t)return this.isReference&&Ne("null is not a valid "+this.name),0;t.$$||Ne('Cannot pass "'+Pt(t)+'" as a '+this.name),t.$$.ptr||Ne("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return ze(t.$$.ptr,r,this.registeredClass)}function qe(e,t){var r;if(null===t)return this.isReference&&Ne("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||Ne('Cannot pass "'+Pt(t)+'" as a '+this.name),t.$$.ptr||Ne("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Ne("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(r=ze(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Ne("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Ne("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var _=t.clone();r=this.rawShare(r,Ft((function(){_.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:Ne("Unsupporting sharing policy")}return r}function Ze(e,t){if(null===t)return this.isReference&&Ne("null is not a valid "+this.name),0;t.$$||Ne('Cannot pass "'+Pt(t)+'" as a '+this.name),t.$$.ptr||Ne("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Ne("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return ze(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Je(e){this.rawDestructor&&this.rawDestructor(e)}function et(e){null!==e&&e.delete()}function tt(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=tt(e,t,r.baseClass);return null===n?null:r.downcast(n)}function rt(){return Object.keys(it).length}function nt(){var e=[];for(var t in it)it.hasOwnProperty(t)&&e.push(it[t]);return e}function _t(e){De=e,Ie.length&&De&&De(Xe)}var it={};function ot(e,t){return t=function(e,t){for(void 0===t&&Ne("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),it[t]}function at(e,t){return(!t.ptrType||!t.ptr)&&he("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&he("Both smartPtrType and smartPtr must be specified"),t.count={value:1},ge(Object.create(e,{$$:{value:t}}))}function st(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ot(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function _(){return this.isSmartPointer?at(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):at(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var i,o=this.registeredClass.getActualType(t),a=$e[o];if(!a)return _.call(this);i=this.isConst?a.constPointerType:a.pointerType;var s=tt(t,this.registeredClass,i.registeredClass);return null===s?_.call(this):this.isSmartPointer?at(i.registeredClass.instancePrototype,{ptrType:i,ptr:s,smartPtrType:this,smartPtr:e}):at(i.registeredClass.instancePrototype,{ptrType:i,ptr:s})}function ut(e,t,r,n,_,i,o,a,s,u,R){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=_,this.pointeeType=i,this.sharingPolicy=o,this.rawGetPointee=a,this.rawConstructor=s,this.rawShare=u,this.rawDestructor=R,_||void 0!==t.baseClass?this.toWireType=qe:n?(this.toWireType=Ye,this.destructorFunction=null):(this.toWireType=Ze,this.destructorFunction=null)}function Rt(e,t,r){_.hasOwnProperty(e)||he("Replacing nonexistant public symbol"),void 0!==_[e].overloadTable&&void 0!==r?_[e].overloadTable[r]=t:(_[e]=t,_[e].argCount=r)}function At(e,t,r){return-1!=e.indexOf("j")?function(e,t,r){var n=_["dynCall_"+e];return r&&r.length?n.apply(null,[t].concat(r)):n.call(null,t)}(e,t,r):k.get(t).apply(null,r)}function ct(e,t){var r=-1!=(e=Fe(e)).indexOf("j")?function(e,t){var r=[];return function(){r.length=arguments.length;for(var n=0;n<arguments.length;n++)r[n]=arguments[n];return At(e,t,r)}}(e,t):k.get(t);return"function"!=typeof r&&Ne("unknown function pointer with signature "+e+": "+t),r}var Tt=void 0;function ft(e){var t=Ht(e),r=Fe(t);return xt(t),r}function lt(e,t){var r=[],n={};throw t.forEach((function e(t){if(!n[t]&&!Te[t]){if(fe[t])return void fe[t].forEach(e);r.push(t),n[t]=!0}})),new Tt(e+": "+r.map(ft).join([", "]))}function Ot(e,t){for(var r=[],n=0;n<e;n++)r.push(E[(t>>2)+n]);return r}function pt(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=Be(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,_=e.apply(n,t);return _ instanceof Object?_:n}function Bt(e,t,r,n,_){var i=t.length;i<2&&Ne("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,a=!1,s=1;s<t.length;++s)if(null!==t[s]&&void 0===t[s].destructorFunction){a=!0;break}var u="void"!==t[0].name,R="",A="";for(s=0;s<i-2;++s)R+=(0!==s?", ":"")+"arg"+s,A+=(0!==s?", ":"")+"arg"+s+"Wired";var c="return function "+pe(e)+"("+R+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";a&&(c+="var destructors = [];\n");var T=a?"destructors":"null",f=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],l=[Ne,n,_,Re,t[0],t[1]];for(o&&(c+="var thisWired = classParam.toWireType("+T+", this);\n"),s=0;s<i-2;++s)c+="var arg"+s+"Wired = argType"+s+".toWireType("+T+", arg"+s+"); // "+t[s+2].name+"\n",f.push("argType"+s),l.push(t[s+2]);if(o&&(A="thisWired"+(A.length>0?", ":"")+A),c+=(u?"var rv = ":"")+"invoker(fn"+(A.length>0?", ":"")+A+");\n",a)c+="runDestructors(destructors);\n";else for(s=o?1:2;s<t.length;++s){var O=1===s?"thisWired":"arg"+(s-2)+"Wired";null!==t[s].destructorFunction&&(c+=O+"_dtor("+O+"); // "+t[s].name+"\n",f.push(O+"_dtor"),l.push(t[s].destructorFunction))}return u&&(c+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),c+="}\n",f.push(c),pt(Function,f).apply(null,l)}var Mt=[],Ct=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ht(e){e>4&&0==--Ct[e].refcount&&(Ct[e]=void 0,Mt.push(e))}function dt(){for(var e=0,t=5;t<Ct.length;++t)void 0!==Ct[t]&&++e;return e}function Kt(){for(var e=5;e<Ct.length;++e)if(void 0!==Ct[e])return Ct[e];return null}function Ft(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=Mt.length?Mt.pop():Ct.length;return Ct[t]={refcount:1,value:e},t}}function yt(e,t,r){switch(t){case 0:return function(e){var t=r?P:v;return this.fromWireType(t[e])};case 1:return function(e){var t=r?S:V;return this.fromWireType(t[e>>1])};case 2:return function(e){var t=r?E:m;return this.fromWireType(t[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function Nt(e,t){var r=Te[e];return void 0===r&&Ne(t+" has unknown type "+ft(e)),r}function Pt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function vt(e,t){switch(t){case 2:return function(e){return this.fromWireType(U[e>>2])};case 3:return function(e){return this.fromWireType(g[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function St(e,t,r){switch(t){case 0:return r?function(e){return P[e]}:function(e){return v[e]};case 1:return r?function(e){return S[e>>1]}:function(e){return V[e>>1]};case 2:return r?function(e){return E[e>>2]}:function(e){return m[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Vt(e){return e||Ne("Cannot use deleted val. handle = "+e),Ct[e].value}var Et={};function mt(e){var t=Et[e];return void 0===t?Fe(e):t}var Ut=[];function gt(){return"object"==typeof globalThis?globalThis:Function("return this")()}var Lt={};function wt(e){try{return h.grow(e-N.byteLength+65535>>>16),$(h.buffer),1}catch{}}var bt={mappings:{},buffers:[null,[],[]],printChar:function(e,t){var r=bt.buffers[e];0===t||10===t?((1===e?M:C)(F(r,0)),r.length=0):r.push(t)},varargs:void 0,get:function(){return bt.varargs+=4,E[bt.varargs-4>>2]},getStr:function(e){return y(e)},get64:function(e,t){return e}};Ce=_.InternalError=Me(Error,"InternalError"),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Ge=e}(),ye=_.BindingError=Me(Error,"BindingError"),He.prototype.isAliasOf=ve,He.prototype.clone=Le,He.prototype.delete=we,He.prototype.isDeleted=be,He.prototype.deleteLater=xe,ut.prototype.getPointee=Qe,ut.prototype.destructor=Je,ut.prototype.argPackAdvance=8,ut.prototype.readValueFromPointer=Ae,ut.prototype.deleteObject=et,ut.prototype.fromWireType=st,_.getInheritedInstanceCount=rt,_.getLiveInheritedInstances=nt,_.flushPendingDeletes=Xe,_.setDelayFunction=_t,Tt=_.UnboundTypeError=Me(Error,"UnboundTypeError"),_.count_emval_handles=dt,_.get_first_emval=Kt;var Dt,It={t:function(e){var t=ue[e];delete ue[e];var r=t.rawConstructor,n=t.rawDestructor,_=t.fields;de([e],_.map((function(e){return e.getterReturnType})).concat(_.map((function(e){return e.setterArgumentType}))),(function(e){var i={};return _.forEach((function(t,r){var n=t.fieldName,o=e[r],a=t.getter,s=t.getterContext,u=e[r+_.length],R=t.setter,A=t.setterContext;i[n]={read:function(e){return o.fromWireType(a(s,e))},write:function(e,t){var r=[];R(A,e,u.toWireType(r,t)),Re(r)}}})),[{name:t.name,fromWireType:function(e){var t={};for(var r in i)t[r]=i[r].read(e);return n(e),t},toWireType:function(e,t){for(var _ in i)if(!(_ in t))throw new TypeError('Missing field:  "'+_+'"');var o=r();for(_ in i)i[_].write(o,t[_]);return null!==e&&e.push(n,o),o},argPackAdvance:8,readValueFromPointer:Ae,destructorFunction:n}]}))},I:function(e,t,r,n,_){var i=Ke(r);Pe(e,{name:t=Fe(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:_},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===r)n=P;else if(2===r)n=S;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=E}return this.fromWireType(n[e>>i])},destructorFunction:null})},x:function(e,t,r,n,_,i,o,a,s,u,R,A,c){R=Fe(R),i=ct(_,i),a&&(a=ct(o,a)),u&&(u=ct(s,u)),c=ct(A,c);var T=pe(R);We(T,(function(){lt("Cannot construct "+R+" due to unbound types",[n])})),de([e,t,r],n?[n]:[],(function(t){var r,_;t=t[0],_=n?(r=t.registeredClass).instancePrototype:He.prototype;var o=Be(T,(function(){if(Object.getPrototypeOf(this)!==s)throw new ye("Use 'new' to construct "+R);if(void 0===A.constructor_body)throw new ye(R+" has no accessible constructor");var e=A.constructor_body[arguments.length];if(void 0===e)throw new ye("Tried to invoke ctor of "+R+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(A.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),s=Object.create(_,{constructor:{value:o}});o.prototype=s;var A=new je(R,o,s,c,r,i,a,u),f=new ut(R,A,!0,!1,!1),l=new ut(R+"*",A,!1,!1,!1),O=new ut(R+" const*",A,!1,!0,!1);return $e[e]={pointerType:l,constPointerType:O},Rt(T,o),[f,l,O]}))},w:function(e,t,r,n,_,i){K(t>0);var o=Ot(t,r);_=ct(n,_);var a=[i],s=[];de([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){lt("Cannot construct "+e.name+" due to unbound types",o)},de([],o,(function(n){return e.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&Ne(r+" called with "+arguments.length+" arguments, expected "+(t-1)),s.length=0,a.length=t;for(var e=1;e<t;++e)a[e]=n[e].toWireType(s,arguments[e-1]);var i=_.apply(null,a);return Re(s),n[0].fromWireType(i)},[]})),[]}))},d:function(e,t,r,n,_,i,o,a){var s=Ot(r,n);t=Fe(t),i=ct(_,i),de([],[e],(function(e){var n=(e=e[0]).name+"."+t;function _(){lt("Cannot call "+n+" due to unbound types",s)}a&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,R=u[t];return void 0===R||void 0===R.overloadTable&&R.className!==e.name&&R.argCount===r-2?(_.argCount=r-2,_.className=e.name,u[t]=_):(ke(u,t,n),u[t].overloadTable[r-2]=_),de([],s,(function(_){var a=Bt(n,_,e,i,o);return void 0===u[t].overloadTable?(a.argCount=r-2,u[t]=a):u[t].overloadTable[r-2]=a,[]})),[]}))},k:function(e,t,r){e=Fe(e),de([],[t],(function(t){return t=t[0],_[e]=t.fromWireType(r),[]}))},H:function(e,t){Pe(e,{name:t=Fe(t),fromWireType:function(e){var t=Ct[e].value;return ht(e),t},toWireType:function(e,t){return Ft(t)},argPackAdvance:8,readValueFromPointer:Ae,destructorFunction:null})},n:function(e,t,r,n){var _=Ke(r);function i(){}t=Fe(t),i.values={},Pe(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:function(e,t){return t.value},argPackAdvance:8,readValueFromPointer:yt(t,_,n),destructorFunction:null}),We(t,i)},a:function(e,t,r){var n=Nt(e,"enum");t=Fe(t);var _=n.constructor,i=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Be(n.name+"_"+t,(function(){}))}});_.values[r]=i,_[t]=i},A:function(e,t,r){var n=Ke(r);Pe(e,{name:t=Fe(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+Pt(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:vt(t,n),destructorFunction:null})},i:function(e,t,r,n,_,i){var o=Ot(t,r);e=Fe(e),_=ct(n,_),We(e,(function(){lt("Cannot call "+e+" due to unbound types",o)}),t-1),de([],o,(function(r){var n=[r[0],null].concat(r.slice(1));return Rt(e,Bt(e,n,null,_,i),t-1),[]}))},j:function(e,t,r,n,_){t=Fe(t),-1===_&&(_=4294967295);var i=Ke(r),o=function(e){return e};if(0===n){var a=32-8*r;o=function(e){return e<<a>>>a}}var s=-1!=t.indexOf("unsigned");Pe(e,{name:t,fromWireType:o,toWireType:function(e,r){if("number"!=typeof r&&"boolean"!=typeof r)throw new TypeError('Cannot convert "'+Pt(r)+'" to '+this.name);if(r<n||r>_)throw new TypeError('Passing a number "'+Pt(r)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+_+"]!");return s?r>>>0:0|r},argPackAdvance:8,readValueFromPointer:St(t,i,0!==n),destructorFunction:null})},h:function(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function _(e){var t=m,r=t[e>>=2],_=t[e+1];return new n(N,_,r)}Pe(e,{name:r=Fe(r),fromWireType:_,argPackAdvance:8,readValueFromPointer:_},{ignoreDuplicateRegistrations:!0})},B:function(e,t){var r="std::string"===(t=Fe(t));Pe(e,{name:t,fromWireType:function(e){var t,n=m[e>>2];if(r)for(var _=e+4,i=0;i<=n;++i){var o=e+4+i;if(i==n||0==v[o]){var a=y(_,o-_);void 0===t?t=a:(t+="\0",t+=a),_=o+1}}else{var s=new Array(n);for(i=0;i<n;++i)s[i]=String.fromCharCode(v[e+4+i]);t=s.join("")}return xt(e),t},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n,_="string"==typeof t;_||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||Ne("Cannot pass non-string to std::string"),n=r&&_?function(){return function(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}(t)}:function(){return t.length};var i=n(),o=Xt(4+i+1);if(m[o>>2]=i,r&&_)!function(e,t,r){!function(e,t,r,n){if(!(n>0))return 0;for(var _=r+n-1,i=0;i<e.length;++i){var o=e.charCodeAt(i);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++i)),o<=127){if(r>=_)break;t[r++]=o}else if(o<=2047){if(r+1>=_)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=_)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=_)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}t[r]=0}(e,v,t,r)}(t,o+4,i+1);else if(_)for(var a=0;a<i;++a){var s=t.charCodeAt(a);s>255&&(xt(o),Ne("String has UTF-16 code units that do not fit in 8 bits")),v[o+4+a]=s}else for(a=0;a<i;++a)v[o+4+a]=t[a];return null!==e&&e.push(xt,o),o},argPackAdvance:8,readValueFromPointer:Ae,destructorFunction:function(e){xt(e)}})},v:function(e,t,r){var n,_,i,o,a;r=Fe(r),2===t?(n=w,_=b,o=D,i=function(){return V},a=1):4===t&&(n=I,_=X,o=x,i=function(){return m},a=2),Pe(e,{name:r,fromWireType:function(e){for(var r,_=m[e>>2],o=i(),s=e+4,u=0;u<=_;++u){var R=e+4+u*t;if(u==_||0==o[R>>a]){var A=n(s,R-s);void 0===r?r=A:(r+="\0",r+=A),s=R+t}}return xt(e),r},toWireType:function(e,n){"string"!=typeof n&&Ne("Cannot pass non-string to C++ string type "+r);var i=o(n),s=Xt(4+i+t);return m[s>>2]=i>>a,_(n,s+4,i+t),null!==e&&e.push(xt,s),s},argPackAdvance:8,readValueFromPointer:Ae,destructorFunction:function(e){xt(e)}})},u:function(e,t,r,n,_,i){ue[e]={name:Fe(t),rawConstructor:ct(r,n),rawDestructor:ct(_,i),fields:[]}},c:function(e,t,r,n,_,i,o,a,s,u){ue[e].fields.push({fieldName:Fe(t),getterReturnType:r,getter:ct(n,_),getterContext:i,setterArgumentType:o,setter:ct(a,s),setterContext:u})},J:function(e,t){Pe(e,{isVoid:!0,name:t=Fe(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},m:function(e,t,r){e=Vt(e),t=Nt(t,"emval::as");var n=[],_=Ft(n);return E[r>>2]=_,t.toWireType(n,e)},s:function(e,t,r,n){(e=Ut[e])(t=Vt(t),r=mt(r),null,n)},b:ht,y:function(e){return 0===e?Ft(gt()):(e=mt(e),Ft(gt()[e]))},p:function(e,t){for(var r=function(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Nt(E[(t>>2)+n],"parameter "+n);return r}(e,t),n=r[0],_=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",i=["retType"],o=[n],a="",s=0;s<e-1;++s)a+=(0!==s?", ":"")+"arg"+s,i.push("argType"+s),o.push(r[1+s]);var u="return function "+pe("methodCaller_"+_)+"(handle, name, destructors, args) {\n",R=0;for(s=0;s<e-1;++s)u+="    var arg"+s+" = argType"+s+".readValueFromPointer(args"+(R?"+"+R:"")+");\n",R+=r[s+1].argPackAdvance;for(u+="    var rv = handle[name]("+a+");\n",s=0;s<e-1;++s)r[s+1].deleteObject&&(u+="    argType"+s+".deleteObject(arg"+s+");\n");return n.isVoid||(u+="    return retType.toWireType(destructors, rv);\n"),u+="};\n",i.push(u),function(e){var t=Ut.length;return Ut.push(e),t}(pt(Function,i).apply(null,o))},r:function(e){return e=mt(e),Ft(_[e])},e:function(e,t){return Ft((e=Vt(e))[t=Vt(t)])},g:function(e){e>4&&(Ct[e].refcount+=1)},q:function(e,t,r,n){e=Vt(e);var i=Lt[t];return i||(i=function(e){for(var t="",r=0;r<e;++r)t+=(0!==r?", ":"")+"arg"+r;var n="return function emval_allocator_"+e+"(constructor, argTypes, args) {\n";for(r=0;r<e;++r)n+="var argType"+r+" = requireRegisteredType(Module['HEAP32'][(argTypes >>> 2) + "+r+'], "parameter '+r+'");\nvar arg'+r+" = argType"+r+".readValueFromPointer(args);\nargs += argType"+r+"['argPackAdvance'];\n";return n+="var obj = new constructor("+t+");\nreturn __emval_register(obj);\n}\n",new Function("requireRegisteredType","Module","__emval_register",n)(Nt,_,Ft)}(t),Lt[t]=i),i(e,r,n)},f:function(e){return Ft(mt(e))},l:function(e){Re(Ct[e].value),ht(e)},o:function(){J()},E:function(e,t,r){v.copyWithin(e,t,t+r)},F:function(e){var t=v.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var _=t*(1+.2/n);if(_=Math.min(_,e+100663296),wt(Math.min(r,H(Math.max(e,_),65536))))return!0}return!1},G:function(e){return 0},C:function(e,t,r,n,_){},z:function(e,t,r,n){for(var _=0,i=0;i<r;i++){for(var o=E[t+8*i>>2],a=E[t+(8*i+4)>>2],s=0;s<a;s++)bt.printChar(e,v[o+s]);_+=a}return E[n>>2]=_,0},D:function(e){}},Xt=(function(){var e={a:It};function t(e,t){var r=e.exports;_.asm=r,$((h=_.asm.K).buffer),k=_.asm.O,function(e){j.unshift(e)}(_.asm.L),function(e){if(q--,_.monitorRunDependencies&&_.monitorRunDependencies(q),0==q&&(null!==Z&&(clearInterval(Z),Z=null),Q)){var t=Q;Q=null,t()}}()}function r(e){t(e.instance)}function i(t){return function(){if(!B&&(R||A)){if("function"==typeof fetch&&!_e(oe))return fetch(oe,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+oe+"'";return e.arrayBuffer()})).catch((function(){return ae(oe)}));if(T)return new Promise((function(e,t){T(oe,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return ae(oe)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then(t,(function(e){C("failed to asynchronously prepare wasm: "+e),J(e)}))}if(q++,_.monitorRunDependencies&&_.monitorRunDependencies(q),_.instantiateWasm)try{return _.instantiateWasm(e,t)}catch(e){return C("Module.instantiateWasm callback failed with error: "+e),!1}(B||"function"!=typeof WebAssembly.instantiateStreaming||re(oe)||_e(oe)||"function"!=typeof fetch?i(r):fetch(oe,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(r,(function(e){return C("wasm streaming compile failed: "+e),C("falling back to ArrayBuffer instantiation"),i(r)}))}))).catch(n)}(),_.___wasm_call_ctors=function(){return(_.___wasm_call_ctors=_.asm.L).apply(null,arguments)},_._malloc=function(){return(Xt=_._malloc=_.asm.M).apply(null,arguments)}),xt=_._free=function(){return(xt=_._free=_.asm.N).apply(null,arguments)},Ht=_.___getTypeName=function(){return(Ht=_.___getTypeName=_.asm.P).apply(null,arguments)};function $t(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function kt(e){function r(){Dt||(Dt=!0,_.calledRun=!0,!d&&(se(j),se(z),t(_),_.onRuntimeInitialized&&_.onRuntimeInitialized(),function(){if(_.postRun)for("function"==typeof _.postRun&&(_.postRun=[_.postRun]);_.postRun.length;)e=_.postRun.shift(),Y.unshift(e);var e;se(Y)}()))}e=e||u,q>0||(function(){if(_.preRun)for("function"==typeof _.preRun&&(_.preRun=[_.preRun]);_.preRun.length;)e=_.preRun.shift(),W.unshift(e);var e;se(W)}(),q>0)||(_.setStatus?(_.setStatus("Running..."),setTimeout((function(){setTimeout((function(){_.setStatus("")}),1),r()}),1)):r())}if(_.___embind_register_native_and_builtin_types=function(){return(_.___embind_register_native_and_builtin_types=_.asm.Q).apply(null,arguments)},_.dynCall_jiji=function(){return(_.dynCall_jiji=_.asm.R).apply(null,arguments)},Q=function e(){Dt||kt(),Dt||(Q=e)},_.run=kt,_.preInit)for("function"==typeof _.preInit&&(_.preInit=[_.preInit]);_.preInit.length>0;)_.preInit.pop()();return kt(),e.ready});"object"==typeof e&&"object"==typeof t?t.exports=n:"function"==typeof define&&define.amd?define([],(function(){return n})):"object"==typeof e&&(e.BASIS=n)})),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,toWebGLConstant:function(e,t){switch(e){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 t.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}},isPacked:function(e){return e===B.UNSIGNED_INT_24_8||e===B.UNSIGNED_SHORT_4_4_4_4||e===B.UNSIGNED_SHORT_5_5_5_1||e===B.UNSIGNED_SHORT_5_6_5},sizeInBytes:function(e){switch(e){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}},validate:function(e){return e===B.UNSIGNED_BYTE||e===B.UNSIGNED_SHORT||e===B.UNSIGNED_INT||e===B.FLOAT||e===B.HALF_FLOAT||e===B.UNSIGNED_INT_24_8||e===B.UNSIGNED_SHORT_4_4_4_4||e===B.UNSIGNED_SHORT_5_5_5_1||e===B.UNSIGNED_SHORT_5_6_5},getTypedArrayConstructor:function(e){let t=B.sizeInBytes(e);return t===Uint8Array.BYTES_PER_ELEMENT?Uint8Array:t===Uint16Array.BYTES_PER_ELEMENT?Uint16Array:t===Float32Array.BYTES_PER_ELEMENT&&e===B.FLOAT?Float32Array:Uint32Array}},H=Object.freeze(B),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,componentsLength:function(e){switch(e){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:default:return 1}},validate:function(e){return e===A.DEPTH_COMPONENT||e===A.DEPTH_STENCIL||e===A.ALPHA||e===A.RED||e===A.RG||e===A.RGB||e===A.RGBA||e===A.LUMINANCE||e===A.LUMINANCE_ALPHA||e===A.RGB_DXT1||e===A.RGBA_DXT1||e===A.RGBA_DXT3||e===A.RGBA_DXT5||e===A.RGB_PVRTC_4BPPV1||e===A.RGB_PVRTC_2BPPV1||e===A.RGBA_PVRTC_4BPPV1||e===A.RGBA_PVRTC_2BPPV1||e===A.RGBA_ASTC||e===A.RGB_ETC1||e===A.RGB8_ETC2||e===A.RGBA8_ETC2_EAC||e===A.RGBA_BC7},isColorFormat:function(e){return e===A.RED||e===A.ALPHA||e===A.RGB||e===A.RGBA||e===A.LUMINANCE||e===A.LUMINANCE_ALPHA},isDepthFormat:function(e){return e===A.DEPTH_COMPONENT||e===A.DEPTH_STENCIL},isCompressedFormat:function(e){return e===A.RGB_DXT1||e===A.RGBA_DXT1||e===A.RGBA_DXT3||e===A.RGBA_DXT5||e===A.RGB_PVRTC_4BPPV1||e===A.RGB_PVRTC_2BPPV1||e===A.RGBA_PVRTC_4BPPV1||e===A.RGBA_PVRTC_2BPPV1||e===A.RGBA_ASTC||e===A.RGB_ETC1||e===A.RGB8_ETC2||e===A.RGBA8_ETC2_EAC||e===A.RGBA_BC7},isDXTFormat:function(e){return e===A.RGB_DXT1||e===A.RGBA_DXT1||e===A.RGBA_DXT3||e===A.RGBA_DXT5},isPVRTCFormat:function(e){return e===A.RGB_PVRTC_4BPPV1||e===A.RGB_PVRTC_2BPPV1||e===A.RGBA_PVRTC_4BPPV1||e===A.RGBA_PVRTC_2BPPV1},isASTCFormat:function(e){return e===A.RGBA_ASTC},isETC1Format:function(e){return e===A.RGB_ETC1},isETC2Format:function(e){return e===A.RGB8_ETC2||e===A.RGBA8_ETC2_EAC},isBC7Format:function(e){return e===A.RGBA_BC7},compressedTextureSizeInBytes:function(e,t,r){switch(e){case A.RGB_DXT1:case A.RGBA_DXT1:case A.RGB_ETC1:case A.RGB8_ETC2:return Math.floor((t+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((t+3)/4)*Math.floor((r+3)/4)*16;case A.RGB_PVRTC_4BPPV1:case A.RGBA_PVRTC_4BPPV1:return Math.floor((Math.max(t,8)*Math.max(r,8)*4+7)/8);case A.RGB_PVRTC_2BPPV1:case A.RGBA_PVRTC_2BPPV1:return Math.floor((Math.max(t,16)*Math.max(r,8)*2+7)/8);case A.RGBA_BC7:return Math.ceil(t/4)*Math.ceil(r/4)*16;default:return 0}},textureSizeInBytes:function(e,t,r,n){let _=A.componentsLength(e);return H.isPacked(t)&&(_=1),_*H.sizeInBytes(t)*r*n},alignmentInBytes:function(e,t,r){let n=A.textureSizeInBytes(e,t,r,1)%4;return 0===n?4:2===n?2:1},createTypedArray:function(e,t,r,n){return new(H.getTypedArrayConstructor(t))(A.componentsLength(e)*r*n)},flipY:function(e,t,r,n,_){if(1===_)return e;let i=A.createTypedArray(t,r,n,_),o=A.componentsLength(t),a=n*o;for(let t=0;t<_;++t){let r=t*n*o,s=(_-t-1)*n*o;for(let t=0;t<a;++t)i[s+t]=e[r+t]}return i},toInternalFormat:function(e,t,r){if(!r.webgl2)return e;if(e===A.DEPTH_STENCIL)return M.DEPTH24_STENCIL8;if(e===A.DEPTH_COMPONENT){if(t===H.UNSIGNED_SHORT)return M.DEPTH_COMPONENT16;if(t===H.UNSIGNED_INT)return M.DEPTH_COMPONENT24}if(t===H.FLOAT)switch(e){case A.RGBA:return M.RGBA32F;case A.RGB:return M.RGB32F;case A.RG:return M.RG32F;case A.RED:return M.R32F}if(t===H.HALF_FLOAT)switch(e){case A.RGBA:return M.RGBA16F;case A.RGB:return M.RGB16F;case A.RG:return M.RG16F;case A.RED:return M.R16F}return e}},E=Object.freeze(A),Rr={VK_FORMAT_UNDEFINED:0,VK_FORMAT_R4G4_UNORM_PACK8:1,VK_FORMAT_R4G4B4A4_UNORM_PACK16:2,VK_FORMAT_B4G4R4A4_UNORM_PACK16:3,VK_FORMAT_R5G6B5_UNORM_PACK16:4,VK_FORMAT_B5G6R5_UNORM_PACK16:5,VK_FORMAT_R5G5B5A1_UNORM_PACK16:6,VK_FORMAT_B5G5R5A1_UNORM_PACK16:7,VK_FORMAT_A1R5G5B5_UNORM_PACK16:8,VK_FORMAT_R8_UNORM:9,VK_FORMAT_R8_SNORM:10,VK_FORMAT_R8_USCALED:11,VK_FORMAT_R8_SSCALED:12,VK_FORMAT_R8_UINT:13,VK_FORMAT_R8_SINT:14,VK_FORMAT_R8_SRGB:15,VK_FORMAT_R8G8_UNORM:16,VK_FORMAT_R8G8_SNORM:17,VK_FORMAT_R8G8_USCALED:18,VK_FORMAT_R8G8_SSCALED:19,VK_FORMAT_R8G8_UINT:20,VK_FORMAT_R8G8_SINT:21,VK_FORMAT_R8G8_SRGB:22,VK_FORMAT_R8G8B8_UNORM:23,VK_FORMAT_R8G8B8_SNORM:24,VK_FORMAT_R8G8B8_USCALED:25,VK_FORMAT_R8G8B8_SSCALED:26,VK_FORMAT_R8G8B8_UINT:27,VK_FORMAT_R8G8B8_SINT:28,VK_FORMAT_R8G8B8_SRGB:29,VK_FORMAT_B8G8R8_UNORM:30,VK_FORMAT_B8G8R8_SNORM:31,VK_FORMAT_B8G8R8_USCALED:32,VK_FORMAT_B8G8R8_SSCALED:33,VK_FORMAT_B8G8R8_UINT:34,VK_FORMAT_B8G8R8_SINT:35,VK_FORMAT_B8G8R8_SRGB:36,VK_FORMAT_R8G8B8A8_UNORM:37,VK_FORMAT_R8G8B8A8_SNORM:38,VK_FORMAT_R8G8B8A8_USCALED:39,VK_FORMAT_R8G8B8A8_SSCALED:40,VK_FORMAT_R8G8B8A8_UINT:41,VK_FORMAT_R8G8B8A8_SINT:42,VK_FORMAT_R8G8B8A8_SRGB:43,VK_FORMAT_B8G8R8A8_UNORM:44,VK_FORMAT_B8G8R8A8_SNORM:45,VK_FORMAT_B8G8R8A8_USCALED:46,VK_FORMAT_B8G8R8A8_SSCALED:47,VK_FORMAT_B8G8R8A8_UINT:48,VK_FORMAT_B8G8R8A8_SINT:49,VK_FORMAT_B8G8R8A8_SRGB:50,VK_FORMAT_A8B8G8R8_UNORM_PACK32:51,VK_FORMAT_A8B8G8R8_SNORM_PACK32:52,VK_FORMAT_A8B8G8R8_USCALED_PACK32:53,VK_FORMAT_A8B8G8R8_SSCALED_PACK32:54,VK_FORMAT_A8B8G8R8_UINT_PACK32:55,VK_FORMAT_A8B8G8R8_SINT_PACK32:56,VK_FORMAT_A8B8G8R8_SRGB_PACK32:57,VK_FORMAT_A2R10G10B10_UNORM_PACK32:58,VK_FORMAT_A2R10G10B10_SNORM_PACK32:59,VK_FORMAT_A2R10G10B10_USCALED_PACK32:60,VK_FORMAT_A2R10G10B10_SSCALED_PACK32:61,VK_FORMAT_A2R10G10B10_UINT_PACK32:62,VK_FORMAT_A2R10G10B10_SINT_PACK32:63,VK_FORMAT_A2B10G10R10_UNORM_PACK32:64,VK_FORMAT_A2B10G10R10_SNORM_PACK32:65,VK_FORMAT_A2B10G10R10_USCALED_PACK32:66,VK_FORMAT_A2B10G10R10_SSCALED_PACK32:67,VK_FORMAT_A2B10G10R10_UINT_PACK32:68,VK_FORMAT_A2B10G10R10_SINT_PACK32:69,VK_FORMAT_R16_UNORM:70,VK_FORMAT_R16_SNORM:71,VK_FORMAT_R16_USCALED:72,VK_FORMAT_R16_SSCALED:73,VK_FORMAT_R16_UINT:74,VK_FORMAT_R16_SINT:75,VK_FORMAT_R16_SFLOAT:76,VK_FORMAT_R16G16_UNORM:77,VK_FORMAT_R16G16_SNORM:78,VK_FORMAT_R16G16_USCALED:79,VK_FORMAT_R16G16_SSCALED:80,VK_FORMAT_R16G16_UINT:81,VK_FORMAT_R16G16_SINT:82,VK_FORMAT_R16G16_SFLOAT:83,VK_FORMAT_R16G16B16_UNORM:84,VK_FORMAT_R16G16B16_SNORM:85,VK_FORMAT_R16G16B16_USCALED:86,VK_FORMAT_R16G16B16_SSCALED:87,VK_FORMAT_R16G16B16_UINT:88,VK_FORMAT_R16G16B16_SINT:89,VK_FORMAT_R16G16B16_SFLOAT:90,VK_FORMAT_R16G16B16A16_UNORM:91,VK_FORMAT_R16G16B16A16_SNORM:92,VK_FORMAT_R16G16B16A16_USCALED:93,VK_FORMAT_R16G16B16A16_SSCALED:94,VK_FORMAT_R16G16B16A16_UINT:95,VK_FORMAT_R16G16B16A16_SINT:96,VK_FORMAT_R16G16B16A16_SFLOAT:97,VK_FORMAT_R32_UINT:98,VK_FORMAT_R32_SINT:99,VK_FORMAT_R32_SFLOAT:100,VK_FORMAT_R32G32_UINT:101,VK_FORMAT_R32G32_SINT:102,VK_FORMAT_R32G32_SFLOAT:103,VK_FORMAT_R32G32B32_UINT:104,VK_FORMAT_R32G32B32_SINT:105,VK_FORMAT_R32G32B32_SFLOAT:106,VK_FORMAT_R32G32B32A32_UINT:107,VK_FORMAT_R32G32B32A32_SINT:108,VK_FORMAT_R32G32B32A32_SFLOAT:109,VK_FORMAT_R64_UINT:110,VK_FORMAT_R64_SINT:111,VK_FORMAT_R64_SFLOAT:112,VK_FORMAT_R64G64_UINT:113,VK_FORMAT_R64G64_SINT:114,VK_FORMAT_R64G64_SFLOAT:115,VK_FORMAT_R64G64B64_UINT:116,VK_FORMAT_R64G64B64_SINT:117,VK_FORMAT_R64G64B64_SFLOAT:118,VK_FORMAT_R64G64B64A64_UINT:119,VK_FORMAT_R64G64B64A64_SINT:120,VK_FORMAT_R64G64B64A64_SFLOAT:121,VK_FORMAT_B10G11R11_UFLOAT_PACK32:122,VK_FORMAT_E5B9G9R9_UFLOAT_PACK32:123,VK_FORMAT_D16_UNORM:124,VK_FORMAT_X8_D24_UNORM_PACK32:125,VK_FORMAT_D32_SFLOAT:126,VK_FORMAT_S8_UINT:127,VK_FORMAT_D16_UNORM_S8_UINT:128,VK_FORMAT_D24_UNORM_S8_UINT:129,VK_FORMAT_D32_SFLOAT_S8_UINT:130,VK_FORMAT_BC1_RGB_UNORM_BLOCK:131,VK_FORMAT_BC1_RGB_SRGB_BLOCK:132,VK_FORMAT_BC1_RGBA_UNORM_BLOCK:133,VK_FORMAT_BC1_RGBA_SRGB_BLOCK:134,VK_FORMAT_BC2_UNORM_BLOCK:135,VK_FORMAT_BC2_SRGB_BLOCK:136,VK_FORMAT_BC3_UNORM_BLOCK:137,VK_FORMAT_BC3_SRGB_BLOCK:138,VK_FORMAT_BC4_UNORM_BLOCK:139,VK_FORMAT_BC4_SNORM_BLOCK:140,VK_FORMAT_BC5_UNORM_BLOCK:141,VK_FORMAT_BC5_SNORM_BLOCK:142,VK_FORMAT_BC6H_UFLOAT_BLOCK:143,VK_FORMAT_BC6H_SFLOAT_BLOCK:144,VK_FORMAT_BC7_UNORM_BLOCK:145,VK_FORMAT_BC7_SRGB_BLOCK:146,VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:147,VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK:148,VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK:149,VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK:150,VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK:151,VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK:152,VK_FORMAT_EAC_R11_UNORM_BLOCK:153,VK_FORMAT_EAC_R11_SNORM_BLOCK:154,VK_FORMAT_EAC_R11G11_UNORM_BLOCK:155,VK_FORMAT_EAC_R11G11_SNORM_BLOCK:156,VK_FORMAT_ASTC_4x4_UNORM_BLOCK:157,VK_FORMAT_ASTC_4x4_SRGB_BLOCK:158,VK_FORMAT_ASTC_5x4_UNORM_BLOCK:159,VK_FORMAT_ASTC_5x4_SRGB_BLOCK:160,VK_FORMAT_ASTC_5x5_UNORM_BLOCK:161,VK_FORMAT_ASTC_5x5_SRGB_BLOCK:162,VK_FORMAT_ASTC_6x5_UNORM_BLOCK:163,VK_FORMAT_ASTC_6x5_SRGB_BLOCK:164,VK_FORMAT_ASTC_6x6_UNORM_BLOCK:165,VK_FORMAT_ASTC_6x6_SRGB_BLOCK:166,VK_FORMAT_ASTC_8x5_UNORM_BLOCK:167,VK_FORMAT_ASTC_8x5_SRGB_BLOCK:168,VK_FORMAT_ASTC_8x6_UNORM_BLOCK:169,VK_FORMAT_ASTC_8x6_SRGB_BLOCK:170,VK_FORMAT_ASTC_8x8_UNORM_BLOCK:171,VK_FORMAT_ASTC_8x8_SRGB_BLOCK:172,VK_FORMAT_ASTC_10x5_UNORM_BLOCK:173,VK_FORMAT_ASTC_10x5_SRGB_BLOCK:174,VK_FORMAT_ASTC_10x6_UNORM_BLOCK:175,VK_FORMAT_ASTC_10x6_SRGB_BLOCK:176,VK_FORMAT_ASTC_10x8_UNORM_BLOCK:177,VK_FORMAT_ASTC_10x8_SRGB_BLOCK:178,VK_FORMAT_ASTC_10x10_UNORM_BLOCK:179,VK_FORMAT_ASTC_10x10_SRGB_BLOCK:180,VK_FORMAT_ASTC_12x10_UNORM_BLOCK:181,VK_FORMAT_ASTC_12x10_SRGB_BLOCK:182,VK_FORMAT_ASTC_12x12_UNORM_BLOCK:183,VK_FORMAT_ASTC_12x12_SRGB_BLOCK:184,VK_FORMAT_G8B8G8R8_422_UNORM:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM:1000156006,VK_FORMAT_R10X6_UNORM_PACK16:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16:1000156016,VK_FORMAT_R12X4_UNORM_PACK16:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM:1000156033,VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG:1000054e3,VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG:1000054001,VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG:1000054002,VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG:1000054003,VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG:1000054004,VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG:1000054005,VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG:1000054006,VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG:1000054007,VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT:1000066e3,VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT:1000066001,VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT:1000066002,VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT:1000066003,VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT:1000066004,VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT:1000066005,VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT:1000066006,VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT:1000066007,VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT:1000066008,VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT:1000066009,VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT:1000066010,VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT:1000066011,VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT:1000066012,VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT:1000066013,VK_FORMAT_G8B8G8R8_422_UNORM_KHR:1000156e3,VK_FORMAT_B8G8R8G8_422_UNORM_KHR:1000156001,VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:1000156002,VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:1000156003,VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:1000156004,VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:1000156005,VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:1000156006,VK_FORMAT_R10X6_UNORM_PACK16_KHR:1000156007,VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:1000156008,VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:1000156009,VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:1000156010,VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:1000156011,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:1000156012,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:1000156013,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:1000156014,VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:1000156015,VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:1000156016,VK_FORMAT_R12X4_UNORM_PACK16_KHR:1000156017,VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:1000156018,VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:1000156019,VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:1000156020,VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:1000156021,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:1000156022,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:1000156023,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:1000156024,VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:1000156025,VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:1000156026,VK_FORMAT_G16B16G16R16_422_UNORM_KHR:1000156027,VK_FORMAT_B16G16R16G16_422_UNORM_KHR:1000156028,VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:1000156029,VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:1000156030,VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:1000156031,VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:1000156032,VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR:1000156033},Le=Object.freeze(Rr),Vt=class{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}},Oe=class{constructor(e,t,r,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=n,this._offset=0}_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){let t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){let r=this._offset,n=0;for(;this._dataView.getUint8(this._offset)!==t&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,n)}},dr=new Uint8Array([0]),b=[171,75,84,88,32,50,48,187,13,10,26,10];function sn(e){return(new TextDecoder).decode(e)}function on(e){let t=new Uint8Array(e.buffer,e.byteOffset,b.length);if(t[0]!==b[0]||t[1]!==b[1]||t[2]!==b[2]||t[3]!==b[3]||t[4]!==b[4]||t[5]!==b[5]||t[6]!==b[6]||t[7]!==b[7]||t[8]!==b[8]||t[9]!==b[9]||t[10]!==b[10]||t[11]!==b[11])throw new Error("Missing KTX 2.0 identifier.");let r=new Vt,n=17*Uint32Array.BYTES_PER_ELEMENT,_=new Oe(e,b.length,n,!0);r.vkFormat=_._nextUint32(),r.typeSize=_._nextUint32(),r.pixelWidth=_._nextUint32(),r.pixelHeight=_._nextUint32(),r.pixelDepth=_._nextUint32(),r.layerCount=_._nextUint32(),r.faceCount=_._nextUint32();let i=_._nextUint32();r.supercompressionScheme=_._nextUint32();let o=_._nextUint32(),a=_._nextUint32(),s=_._nextUint32(),u=_._nextUint32(),R=_._nextUint64(),A=_._nextUint64(),c=3*i*8,T=new Oe(e,b.length+n,c,!0);for(let t=0;t<i;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+T._nextUint64(),T._nextUint64()),uncompressedByteLength:T._nextUint64()});let f=new Oe(e,o,a,!0),l={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},O=(l.descriptorBlockSize/4-6)/4;for(let e=0;e<O;e++){let t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),l.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(l);let p=new Oe(e,s,u,!0);for(;p._offset<u;){let e=p._nextUint32(),t=p._scan(e),n=sn(t);if(r.keyValue[n]=p._nextUint8Array(e-t.byteLength-1),n.match(/^ktx/i)){let e=sn(r.keyValue[n]);r.keyValue[n]=e.substring(0,e.lastIndexOf("\0"))}let _=e%4?4-e%4:0;p._skip(_)}if(A<=0)return r;let B=new Oe(e,R,A,!0),M=B._nextUint16(),C=B._nextUint16(),h=B._nextUint32(),d=B._nextUint32(),K=B._nextUint32(),G=B._nextUint32(),F=[];for(let e=0;e<i;e++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});let y=R+B._offset,N=y+h,P=N+d,v=P+K,S=new Uint8Array(e.buffer,e.byteOffset+y,h),V=new Uint8Array(e.buffer,e.byteOffset+N,d),E=new Uint8Array(e.buffer,e.byteOffset+P,K),m=new Uint8Array(e.buffer,e.byteOffset+v,G);return r.globalData={endpointCount:M,selectorCount:C,imageDescs:F,endpointsData:S,selectorsData:V,tablesData:E,extendedData:m},r}var me,an=or(Rn(),1),cn=["positiveX","negativeX","positiveY","negativeY","positiveZ","negativeZ"],An=163,fn=166;function ar(e,t){nn.typeOf.object("transcoderModule",me);let r,n=e.ktx2Buffer,_=e.supportedTargetFormats;try{r=on(n)}catch{throw new ie("Invalid KTX2 file.")}if(0!==r.layerCount)throw new ie("KTX2 texture arrays are not supported.");if(0!==r.pixelDepth)throw new ie("KTX2 3D textures are unsupported.");let i=r.dataFormatDescriptor[0],o=new Array(r.levelCount);return 0!==r.vkFormat||i.colorModel!==An&&i.colorModel!==fn?(t.push(n.buffer),cr(r,o)):Ar(n,r,_,me,t,o),o}function cr(e,t){let r,n=e.vkFormat===Le.VK_FORMAT_R8G8B8_SRGB?E.RGB:E.RGBA;e.vkFormat===Le.VK_FORMAT_R8G8B8A8_UNORM?r=H.UNSIGNED_BYTE:e.vkFormat===Le.VK_FORMAT_R16G16B16A16_SFLOAT?r=H.HALF_FLOAT:e.vkFormat===Le.VK_FORMAT_R32G32B32A32_SFLOAT&&(r=H.FLOAT);for(let _=0;_<e.levels.length;++_){let i={};t[_]=i;let o=e.levels[_].levelData,a=e.pixelWidth>>_,s=e.pixelHeight>>_,u=a*s*E.componentsLength(n);for(let t=0;t<e.faceCount;++t){let _,R=o.byteOffset+u*e.typeSize*t;_=ge(r)&&1!==H.sizeInBytes(r)?2===H.sizeInBytes(r)?new Uint16Array(o.buffer,R,u):new Float32Array(o.buffer,R,u):new Uint8Array(o.buffer,R,u),i[cn[t]]={internalFormat:n,datatype:r,width:a,height:s,levelBuffer:_}}}}function Ar(e,t,r,n,_,i){let o=new n.KTX2File(e),a=o.getWidth(),s=o.getHeight(),u=o.getLevels(),R=o.getHasAlpha();if(!(a>0&&s>0&&u>0))throw o.close(),o.delete(),new ie("Invalid KTX2 file");let A,c,T=t.dataFormatDescriptor[0],f=n.transcoder_texture_format;if(T.colorModel===An)if(r.etc)A=R?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,c=R?f.cTFETC2_RGBA:f.cTFETC1_RGB;else if(r.etc1&&!R)A=E.RGB_ETC1,c=f.cTFETC1_RGB;else if(r.s3tc)A=R?E.RGBA_DXT5:E.RGB_DXT1,c=R?f.cTFBC3_RGBA:f.cTFBC1_RGB;else if(r.pvrtc)A=R?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,c=R?f.cTFPVRTC1_4_RGBA:f.cTFPVRTC1_4_RGB;else if(r.astc)A=E.RGBA_ASTC,c=f.cTFASTC_4x4_RGBA;else{if(!r.bc7)throw new ie("No transcoding format target available for ETC1S compressed ktx2.");A=E.RGBA_BC7,c=f.cTFBC7_RGBA}else if(T.colorModel===fn)if(r.astc)A=E.RGBA_ASTC,c=f.cTFASTC_4x4_RGBA;else if(r.bc7)A=E.RGBA_BC7,c=f.cTFBC7_RGBA;else if(r.s3tc)A=R?E.RGBA_DXT5:E.RGB_DXT1,c=R?f.cTFBC3_RGBA:f.cTFBC1_RGB;else if(r.etc)A=R?E.RGBA8_ETC2_EAC:E.RGB8_ETC2,c=R?f.cTFETC2_RGBA:f.cTFETC1_RGB;else if(r.etc1&&!R)A=E.RGB_ETC1,c=f.cTFETC1_RGB;else{if(!r.pvrtc)throw new ie("No transcoding format target available for UASTC compressed ktx2.");A=R?E.RGBA_PVRTC_4BPPV1:E.RGB_PVRTC_4BPPV1,c=R?f.cTFPVRTC1_4_RGBA:f.cTFPVRTC1_4_RGB}if(!o.startTranscoding())throw o.close(),o.delete(),new ie("startTranscoding() failed");for(let e=0;e<t.levels.length;++e){let r={};i[e]=r,a=t.pixelWidth>>e,s=t.pixelHeight>>e;let n=o.getImageTranscodedSizeInBytes(e,0,0,c.value),u=new Uint8Array(n),R=o.transcodeImage(u,e,0,0,c.value,0,-1,-1);if(!ge(R))throw new ie("transcodeImage() failed.");_.push(u.buffer),r[cn[0]]={internalFormat:A,width:a,height:s,levelBuffer:u}}return o.close(),o.delete(),i}async function fr(e,t){let r=e.webAssemblyConfig,n=_n(an.default,self.BASIS);return(me=ge(r.wasmBinaryFile)?await n(r):await n()).initializeBasis(),!0}function Tr(e,t){let r=e.webAssemblyConfig;return ge(r)?fr(e,t):ar(e,t)}var yr=rn(Tr);export{yr as default};