/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
async function t(t={}){var r=t,e=!!globalThis.window,n=!!globalThis.WorkerGlobalScope;globalThis.process?.versions?.node&&globalThis.process;var i,a,o="",s="";function u(t){return r.locateFile?r.locateFile(t,s):s+t}if(e||n){try{s=new URL(".",o).href}catch{}n&&(a=t=>{var r=new XMLHttpRequest;return r.open("GET",t,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),i=async t=>{var r=await fetch(t,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}console.log.bind(console);var f,c,h,l,p,w,m,g=console.error.bind(console),y=!1,d=!1;function _(){var t=q.buffer;l=new Int8Array(t),p=new Uint8Array(t),w=new Uint32Array(t),new BigInt64Array(t),new BigUint64Array(t)}function v(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)P(r.preRun.shift());U(M)}function b(){d=!0,Q.f()}function R(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)W(r.postRun.shift());U(k)}function A(t){r.onAbort?.(t),g(t="Aborted("+t+")"),y=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw h?.(e),e}function S(){return r.locateFile?u("lerc-wasm.wasm"):new URL("lerc-wasm.wasm","").href}function T(t){if(t==m&&f)return new Uint8Array(f);if(a)return a(t);throw"both async and sync fetching of the wasm failed"}async function I(t){if(!f)try{var r=await i(t);return new Uint8Array(r)}catch{}return T(t)}async function x(t,r){try{var e=await I(t);return await WebAssembly.instantiate(e,r)}catch(n){g(`failed to asynchronously prepare wasm: ${n}`),A(n)}}async function B(t,r,e){if(!t)try{var n=fetch(r,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,e)}catch(i){g(`wasm streaming compile failed: ${i}`),g("falling back to ArrayBuffer instantiation")}return x(r,e)}function C(){return{a:V}}async function E(){function t(t,r){return K(Q=t.exports),_(),Q}function e(r){return t(r.instance)}var n=C();return r.instantiateWasm?new Promise((e,i)=>{r.instantiateWasm(n,(r,n)=>{e(t(r))})}):(m??=S(),e(await B(f,m,n)))}var U=t=>{for(;t.length>0;)t.shift()(r)},k=[],W=t=>k.push(t),M=[],P=t=>M.push(t),j=globalThis.TextDecoder&&new TextDecoder,D=(t,r,e,n)=>{for(var i=r+e;t[r]&&!(r>=i);)++r;return r},L=(t,r=0,e,n)=>{var i=D(t,r,e);if(i-r>16&&t.buffer&&j)return j.decode(t.subarray(r,i));for(var a="";r<i;){var o=t[r++];if(128&o){var s=63&t[r++];if(192!=(224&o)){var u=63&t[r++];if((o=224==(240&o)?(15&o)<<12|s<<6|u:(7&o)<<18|s<<12|u<<6|63&t[r++])<65536)a+=String.fromCharCode(o);else{var f=o-65536;a+=String.fromCharCode(55296|f>>10,56320|1023&f)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a},F=(t,r,e)=>t?L(p,t,r):"",$=(t,r,e,n)=>A(`Assertion failed: ${F(t)}, at: `+[r?F(r):"unknown filename",e,n?F(n):"unknown function"]);class G{constructor(t){this.excPtr=t,this.ptr=t-24}set_type(t){w[this.ptr+4>>2]=t}get_type(){return w[this.ptr+4>>2]}set_destructor(t){w[this.ptr+8>>2]=t}get_destructor(){return w[this.ptr+8>>2]}set_caught(t){t=t?1:0,l[this.ptr+12]=t}get_caught(){return 0!=l[this.ptr+12]}set_rethrown(t){t=t?1:0,l[this.ptr+13]=t}get_rethrown(){return 0!=l[this.ptr+13]}init(t,r){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(r)}set_adjusted_ptr(t){w[this.ptr+16>>2]=t}get_adjusted_ptr(){return w[this.ptr+16>>2]}}var q,z=(t,r,e)=>{throw new G(t).init(r,e),t},H=()=>A(""),N=()=>2147483648,O=(t,r)=>Math.ceil(t/r)*r,X=t=>{var r=(t-q.buffer.byteLength+65535)/65536|0;try{return q.grow(r),_(),1}catch(e){}},J=t=>{var r=p.length;t>>>=0;var e=N();if(t>e)return!1;for(var n=1;n<=4;n*=2){var i=r*(1+.2/n);i=Math.min(i,t+100663296);var a=Math.min(e,O(Math.max(t,i),65536));if(X(a))return!0}return!1};if(r.noExitRuntime&&r.noExitRuntime,r.print&&r.print,r.printErr&&(g=r.printErr),r.wasmBinary&&(f=r.wasmBinary),r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.shift()();function K(t){r._lerc_getBlobInfo=t.g,r._lerc_getDataRanges=t.h,r._lerc_decode_4D=t.i,r._free=t.j,r._malloc=t.k,r.memory=q=t.e,t.__indirect_function_table}var Q,V={a:$,b:z,c:H,d:J};function Y(){function t(){r.calledRun=!0,y||(b(),c?.(r),r.onRuntimeInitialized?.(),R())}v(),r.setStatus?(r.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>r.setStatus(""),1),t()},1)):t()}return Q=await E(),Y(),d?r:new Promise((t,r)=>{c=t,h=r})}export{t as default};
