UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

1 lines • 49.9 kB
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[8714],{98714:(r,e,t)=>{t.r(e),t.d(e,{default:()=>o});var n,o=(n="undefined"!=typeof document?document.currentScript?.src:void 0,function(r={}){var e,t,o=r,a=new Promise(((r,n)=>{e=r,t=n})),i="object"==typeof window,s="undefined"!=typeof WorkerGlobalScope;"object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&process.type;var u,l,d=Object.assign({},o),c="./this.program",f="";(i||s)&&(s?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),n&&(f=n),f=f.startsWith("blob:")?"":f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(l=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),u=async r=>{var e=await fetch(r,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw new Error(e.status+" : "+e.url)});var h=o.print||console.log.bind(console),p=o.printErr||console.error.bind(console);Object.assign(o,d),d=null,o.arguments&&o.arguments,o.thisProgram&&(c=o.thisProgram);var m,v,w,y,g,E,k,b,_,A=o.wasmBinary,F=!1;function P(){var r=m.buffer;o.HEAP8=v=new Int8Array(r),o.HEAP16=y=new Int16Array(r),o.HEAPU8=w=new Uint8Array(r),o.HEAPU16=g=new Uint16Array(r),o.HEAP32=E=new Int32Array(r),o.HEAPU32=k=new Uint32Array(r),o.HEAPF32=b=new Float32Array(r),o.HEAPF64=_=new Float64Array(r)}var D=[],S=[],T=[];function C(r){D.unshift(r)}function M(r){T.unshift(r)}var j=0,R=null;function x(r){j++,o.monitorRunDependencies?.(j)}function $(r){if(j--,o.monitorRunDependencies?.(j),0==j&&R){var e=R;R=null,e()}}function N(r){o.onAbort?.(r),p(r="Aborted("+r+")"),F=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw t(e),e}var z,O,W,B=r=>r.startsWith("data:application/octet-stream;base64,");async function U(r,e,t){if(!r&&"function"==typeof WebAssembly.instantiateStreaming&&!B(e)&&"function"==typeof fetch)try{var n=fetch(e,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,t)}catch(r){p(`wasm streaming compile failed: ${r}`),p("falling back to ArrayBuffer instantiation")}return async function(r,e){try{var t=await async function(r){if(!A)try{var e=await u(r);return new Uint8Array(e)}catch{}return function(r){if(r==z&&A)return new Uint8Array(A);if(l)return l(r);throw"both async and sync fetching of the wasm failed"}(r)}(r);return await WebAssembly.instantiate(t,e)}catch(r){p(`failed to asynchronously prepare wasm: ${r}`),N(r)}}(e,t)}var L=r=>{for(;r.length>0;)r.shift()(o)};o.noExitRuntime;class I{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){k[this.ptr+4>>2]=r}get_type(){return k[this.ptr+4>>2]}set_destructor(r){k[this.ptr+8>>2]=r}get_destructor(){return k[this.ptr+8>>2]}set_caught(r){r=r?1:0,v[this.ptr+12]=r}get_caught(){return 0!=v[this.ptr+12]}set_rethrown(r){r=r?1:0,v[this.ptr+13]=r}get_rethrown(){return 0!=v[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){k[this.ptr+16>>2]=r}get_adjusted_ptr(){return k[this.ptr+16>>2]}}var H,V,q,X=r=>{for(var e="",t=r;w[t];)e+=H[w[t++]];return e},G={},K={},J={},Q=r=>{throw new V(r)},Y=r=>{throw new q(r)};function Z(r,e,t={}){return function(r,e,t={}){var n=e.name;if(r||Q(`type "${n}" must have a positive integer typeid pointer`),K.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;Q(`Cannot register type '${n}' twice`)}if(K[r]=e,delete J[r],G.hasOwnProperty(r)){var o=G[r];delete G[r],o.forEach((r=>r()))}}(r,e,t)}var rr=[],er=[],tr=r=>{r>9&&0==--er[r+1]&&(er[r]=void 0,rr.push(r))},nr=r=>(r||Q("Cannot use deleted val. handle = "+r),er[r]),or=r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=rr.pop()||er.length;return er[e]=r,er[e+1]=1,e}}};function ar(r){return this.fromWireType(k[r>>2])}var ir={name:"emscripten::val",fromWireType:r=>{var e=nr(r);return tr(r),e},toWireType:(r,e)=>or(e),argPackAdvance:8,readValueFromPointer:ar,destructorFunction:null},sr=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(b[r>>2])};case 8:return function(r){return this.fromWireType(_[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},ur=(r,e)=>Object.defineProperty(e,"name",{value:r}),lr=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function dr(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function cr(r,e){if(!(r instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof r} which is not a function`);var t=ur(r.name||"unknownFunctionName",(function(){}));t.prototype=r.prototype;var n=new t,o=r.apply(n,e);return o instanceof Object?o:n}var fr,hr,pr=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||Q(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[n.length].apply(this,n)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},mr=(r,e,t)=>{o.hasOwnProperty(r)?((void 0===t||void 0!==o[r].overloadTable&&void 0!==o[r].overloadTable[t])&&Q(`Cannot register public name '${r}' twice`),pr(o,r,r),o[r].overloadTable.hasOwnProperty(t)&&Q(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),o[r].overloadTable[t]=e):(o[r]=e,o[r].argCount=t)},vr=(r,e,t)=>{o.hasOwnProperty(r)||Y("Replacing nonexistent public symbol"),void 0!==o[r].overloadTable&&void 0!==t?o[r].overloadTable[t]=e:(o[r]=e,o[r].argCount=t)},wr=[],yr=r=>{var e=wr[r];return e||(r>=wr.length&&(wr.length=r+1),wr[r]=e=fr.get(r)),e},gr=(r,e)=>{var t=(r=X(r)).includes("j")?((r,e)=>(...t)=>((r,e,t=[])=>r.includes("j")?((r,e,t)=>(r=r.replace(/p/g,"i"),(0,o["dynCall_"+r])(e,...t)))(r,e,t):yr(e)(...t))(r,e,t))(r,e):yr(e);return"function"!=typeof t&&Q(`unknown function pointer with signature ${r}: ${e}`),t},Er=r=>{var e=se(r),t=X(e);return le(e),t},kr=(r,e,t)=>{switch(e){case 1:return t?r=>v[r]:r=>w[r];case 2:return t?r=>y[r>>1]:r=>g[r>>1];case 4:return t?r=>E[r>>2]:r=>k[r>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},br=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&r.charCodeAt(++i)),s<=127){if(t>=a)break;e[t++]=s}else if(s<=2047){if(t+1>=a)break;e[t++]=192|s>>6,e[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;e[t++]=224|s>>12,e[t++]=128|s>>6&63,e[t++]=128|63&s}else{if(t+3>=a)break;e[t++]=240|s>>18,e[t++]=128|s>>12&63,e[t++]=128|s>>6&63,e[t++]=128|63&s}}return e[t]=0,t-o},_r=(r,e,t)=>br(r,w,e,t),Ar=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},Fr="undefined"!=typeof TextDecoder?new TextDecoder:void 0,Pr=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&Fr)return Fr.decode(r.subarray(e,o));for(var a="";e<o;){var i=r[e++];if(128&i){var s=63&r[e++];if(192!=(224&i)){var u=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var l=i-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},Dr=(r,e)=>r?Pr(w,r,e):"",Sr="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Tr=(r,e)=>{for(var t=r,n=t>>1,o=n+e/2;!(n>=o)&&g[n];)++n;if((t=n<<1)-r>32&&Sr)return Sr.decode(w.subarray(r,t));for(var a="",i=0;!(i>=e/2);++i){var s=y[r+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},Cr=(r,e,t)=>{if(t??=2147483647,t<2)return 0;for(var n=e,o=(t-=2)<2*r.length?t/2:r.length,a=0;a<o;++a){var i=r.charCodeAt(a);y[e>>1]=i,e+=2}return y[e>>1]=0,e-n},Mr=r=>2*r.length,jr=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var o=E[r+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},Rr=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,o=n+t-4,a=0;a<r.length;++a){var i=r.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),E[e>>2]=i,(e+=4)+4>o)break}return E[e>>2]=0,e-n},xr=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},$r=(r,e)=>{var t=K[r];return void 0===t&&Q(`${e} has unknown type ${Er(r)}`),t},Nr=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(k[e>>2]=or(n)),o},zr=[],Or={},Wr=r=>{var e=Or[r];return void 0===e?X(r):e},Br=()=>"object"==typeof globalThis?globalThis:Function("return this")(),Ur=(r,e)=>Math.ceil(r/e)*e,Lr=r=>{var e=(r-m.buffer.byteLength+65535)/65536|0;try{return m.grow(e),P(),1}catch(r){}},Ir={},Hr=()=>{if(!Hr.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(var e in Ir)void 0===Ir[e]?delete r[e]:r[e]=Ir[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);Hr.strings=t}return Hr.strings},Vr={isAbs:r=>"/"===r.charAt(0),splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=Vr.isAbs(r),t="/"===r.substr(-1);return(r=Vr.normalizeArray(r.split("/").filter((r=>!!r)),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=Vr.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:r=>{if("/"===r)return"/";var e=(r=(r=Vr.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?r:r.substr(e+1)},join:(...r)=>Vr.normalize(r.join("/")),join2:(r,e)=>Vr.normalize(r+"/"+e)},qr=r=>(qr=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return r=>crypto.getRandomValues(r);N("initRandomDevice")})())(r),Xr={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:te.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=Vr.isAbs(o)}return(t?"/":"")+(e=Vr.normalizeArray(e.split("/").filter((r=>!!r)),!t).join("/"))||"."},relative:(r,e)=>{function t(r){for(var e=0;e<r.length&&""===r[e];e++);for(var t=r.length-1;t>=0&&""===r[t];t--);return e>t?[]:r.slice(e,t-e+1)}r=Xr.resolve(r).substr(1),e=Xr.resolve(e).substr(1);for(var n=t(r.split("/")),o=t(e.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},Gr=[];function Kr(r,e,t){var n=Ar(r)+1,o=new Array(n),a=br(r,o,0,o.length);return o.length=a,o}var Jr={ttys:[],init(){},shutdown(){},register(r,e){Jr.ttys[r]={input:[],output:[],ops:e},te.registerDevice(r,Jr.stream_ops)},stream_ops:{open(r){var e=Jr.ttys[r.node.rdev];if(!e)throw new te.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new te.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(r){throw new te.ErrnoError(29)}if(void 0===s&&0===a)throw new te.ErrnoError(6);if(null==s)break;a++,e[t+i]=s}return a&&(r.node.atime=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new te.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(r){throw new te.ErrnoError(29)}return n&&(r.node.mtime=r.node.ctime=Date.now()),a}},default_tty_ops:{get_char:r=>(()=>{if(!Gr.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;Gr=Kr(r)}return Gr.shift()})(),put_char(r,e){null===e||10===e?(h(Pr(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(h(Pr(r.output)),r.output=[])},ioctl_tcgets:r=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(r,e,t)=>0,ioctl_tiocgwinsz:r=>[24,80]},default_tty1_ops:{put_char(r,e){null===e||10===e?(p(Pr(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(p(Pr(r.output)),r.output=[])}}},Qr=r=>{N()},Yr={ops_table:null,mount:r=>Yr.createNode(null,"/",16895,0),createNode(r,e,t,n){if(te.isBlkdev(t)||te.isFIFO(t))throw new te.ErrnoError(63);Yr.ops_table||={dir:{node:{getattr:Yr.node_ops.getattr,setattr:Yr.node_ops.setattr,lookup:Yr.node_ops.lookup,mknod:Yr.node_ops.mknod,rename:Yr.node_ops.rename,unlink:Yr.node_ops.unlink,rmdir:Yr.node_ops.rmdir,readdir:Yr.node_ops.readdir,symlink:Yr.node_ops.symlink},stream:{llseek:Yr.stream_ops.llseek}},file:{node:{getattr:Yr.node_ops.getattr,setattr:Yr.node_ops.setattr},stream:{llseek:Yr.stream_ops.llseek,read:Yr.stream_ops.read,write:Yr.stream_ops.write,allocate:Yr.stream_ops.allocate,mmap:Yr.stream_ops.mmap,msync:Yr.stream_ops.msync}},link:{node:{getattr:Yr.node_ops.getattr,setattr:Yr.node_ops.setattr,readlink:Yr.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Yr.node_ops.getattr,setattr:Yr.node_ops.setattr},stream:te.chrdev_stream_ops}};var o=te.createNode(r,e,t,n);return te.isDir(o.mode)?(o.node_ops=Yr.ops_table.dir.node,o.stream_ops=Yr.ops_table.dir.stream,o.contents={}):te.isFile(o.mode)?(o.node_ops=Yr.ops_table.file.node,o.stream_ops=Yr.ops_table.file.stream,o.usedBytes=0,o.contents=null):te.isLink(o.mode)?(o.node_ops=Yr.ops_table.link.node,o.stream_ops=Yr.ops_table.link.stream):te.isChrdev(o.mode)&&(o.node_ops=Yr.ops_table.chrdev.node,o.stream_ops=Yr.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),r&&(r.contents[e]=o,r.atime=r.mtime=r.ctime=o.atime),o},getFileDataAsTypedArray:r=>r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0),expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){e=Math.max(e,t*(t<1048576?2:1.125)>>>0),0!=t&&(e=Math.max(e,256));var n=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(n.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(0==e)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=te.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,te.isDir(r.mode)?e.size=4096:te.isFile(r.mode)?e.size=r.usedBytes:te.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.atime),e.mtime=new Date(r.mtime),e.ctime=new Date(r.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){for(const t of["mode","atime","mtime","ctime"])e[t]&&(r[t]=e[t]);void 0!==e.size&&Yr.resizeFileStorage(r,e.size)},lookup(r,e){throw Yr.doesNotExistError},mknod:(r,e,t,n)=>Yr.createNode(r,e,t,n),rename(r,e,t){var n;try{n=te.lookupNode(e,t)}catch(r){}if(n){if(te.isDir(r.mode))for(var o in n.contents)throw new te.ErrnoError(55);te.hashRemoveNode(n)}delete r.parent.contents[r.name],e.contents[t]=r,r.name=t,e.ctime=e.mtime=r.parent.ctime=r.parent.mtime=Date.now()},unlink(r,e){delete r.contents[e],r.ctime=r.mtime=Date.now()},rmdir(r,e){var t=te.lookupNode(r,e);for(var n in t.contents)throw new te.ErrnoError(55);delete r.contents[e],r.ctime=r.mtime=Date.now()},readdir:r=>[".","..",...Object.keys(r.contents)],symlink(r,e,t){var n=Yr.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!te.isLink(r.mode))throw new te.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var i=Math.min(r.node.usedBytes-o,n);if(i>8&&a.subarray)e.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)e[t+s]=a[o+s];return i},write(r,e,t,n,o,a){if(e.buffer===v.buffer&&(a=!1),!n)return 0;var i=r.node;if(i.mtime=i.ctime=Date.now(),e.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=e.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=e.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(e.subarray(t,t+n),o),n}if(Yr.expandFileStorage(i,o+n),i.contents.subarray&&e.subarray)i.contents.set(e.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=e[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(1===t?n+=r.position:2===t&&te.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new te.ErrnoError(28);return n},allocate(r,e,t){Yr.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!te.isFile(r.node.mode))throw new te.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==v.buffer){if(i=!0,!(a=Qr()))throw new te.ErrnoError(48);s&&((t>0||t+e<s.length)&&(s=s.subarray?s.subarray(t,t+e):Array.prototype.slice.call(s,t,t+e)),v.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(Yr.stream_ops.write(r,e,0,n,t,!1),0)}},Zr=async r=>{var e=await u(r);return new Uint8Array(e)},re=o.preloadPlugins||[],ee=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},te={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(r){this.node=r}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.id=te.nextInode++,this.name=e,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return te.isDir(this.mode)}get isDevice(){return te.isChrdev(this.mode)}},lookupPath(r,e={}){if(!r)return{path:"",node:null};e.follow_mount??=!0,Vr.isAbs(r)||(r=te.cwd()+"/"+r);r:for(var t=0;t<40;t++){for(var n=r.split("/").filter((r=>!!r&&"."!==r)),o=te.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if(".."!==n[i]){a=Vr.join2(a,n[i]);try{o=te.lookupNode(o,n[i])}catch(r){if(44===r?.errno&&s&&e.noent_okay)return{path:a};throw r}if(!te.isMountpoint(o)||s&&!e.follow_mount||(o=o.mounted.root),te.isLink(o.mode)&&(!s||e.follow)){if(!o.node_ops.readlink)throw new te.ErrnoError(52);var u=o.node_ops.readlink(o);Vr.isAbs(u)||(u=Vr.dirname(a)+"/"+u),r=u+"/"+n.slice(i+1).join("/");continue r}}else a=Vr.dirname(a),o=o.parent}return{path:a,node:o}}throw new te.ErrnoError(32)},getPath(r){for(var e;;){if(te.isRoot(r)){var t=r.mount.mountpoint;return e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%te.nameTable.length},hashAddNode(r){var e=te.hashName(r.parent.id,r.name);r.name_next=te.nameTable[e],te.nameTable[e]=r},hashRemoveNode(r){var e=te.hashName(r.parent.id,r.name);if(te.nameTable[e]===r)te.nameTable[e]=r.name_next;else for(var t=te.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=te.mayLookup(r);if(t)throw new te.ErrnoError(t);for(var n=te.hashName(r.id,e),o=te.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return te.lookup(r,e)},createNode(r,e,t,n){var o=new te.FSNode(r,e,t,n);return te.hashAddNode(o),o},destroyNode(r){te.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>32768==(61440&r),isDir:r=>16384==(61440&r),isLink:r=>40960==(61440&r),isChrdev:r=>8192==(61440&r),isBlkdev:r=>24576==(61440&r),isFIFO:r=>4096==(61440&r),isSocket:r=>!(49152&~r),flagsToPermissionString(r){var e=["r","w","rw"][3&r];return 512&r&&(e+="w"),e},nodePermissions:(r,e)=>te.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup:r=>te.isDir(r.mode)?te.nodePermissions(r,"x")||(r.node_ops.lookup?0:2):54,mayCreate(r,e){if(!te.isDir(r.mode))return 54;try{return te.lookupNode(r,e),20}catch(r){}return te.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=te.lookupNode(r,e)}catch(r){return r.errno}var o=te.nodePermissions(r,"wx");if(o)return o;if(t){if(!te.isDir(n.mode))return 54;if(te.isRoot(n)||te.getPath(n)===te.cwd())return 10}else if(te.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?te.isLink(r.mode)?32:te.isDir(r.mode)&&("r"!==te.flagsToPermissionString(e)||512&e)?31:te.nodePermissions(r,te.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=te.MAX_OPEN_FDS;r++)if(!te.streams[r])return r;throw new te.ErrnoError(33)},getStreamChecked(r){var e=te.getStream(r);if(!e)throw new te.ErrnoError(8);return e},getStream:r=>te.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new te.FSStream,r),-1==e&&(e=te.nextfd()),r.fd=e,te.streams[e]=r,r),closeStream(r){te.streams[r]=null},dupStream(r,e=-1){var t=te.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=te.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new te.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){te.devices[r]={stream_ops:e}},getDevice:r=>te.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){"function"==typeof r&&(e=r,r=!1),te.syncFSRequests++,te.syncFSRequests>1&&p(`warning: ${te.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=te.getMounts(te.root.mount),n=0;function o(r){return te.syncFSRequests--,e(r)}function a(r){if(r)return a.errored?void 0:(a.errored=!0,o(r));++n>=t.length&&o(null)}t.forEach((e=>{if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)}))},mount(r,e,t){var n,o="/"===t,a=!t;if(o&&te.root)throw new te.ErrnoError(10);if(!o&&!a){var i=te.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,te.isMountpoint(n))throw new te.ErrnoError(10);if(!te.isDir(n.mode))throw new te.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},u=r.mount(s);return u.mount=s,s.root=u,o?te.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(r){var e=te.lookupPath(r,{follow_mount:!1});if(!te.isMountpoint(e.node))throw new te.ErrnoError(28);var t=e.node,n=t.mounted,o=te.getMounts(n);Object.keys(te.nameTable).forEach((r=>{for(var e=te.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&te.destroyNode(e),e=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(r,e)=>r.node_ops.lookup(r,e),mknod(r,e,t){var n=te.lookupPath(r,{parent:!0}).node,o=Vr.basename(r);if(!o||"."===o||".."===o)throw new te.ErrnoError(28);var a=te.mayCreate(n,o);if(a)throw new te.ErrnoError(a);if(!n.node_ops.mknod)throw new te.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:te.nextInode,ffree:te.nextInode-1,fsid:42,flags:2,namelen:255},t=te.lookupPath(r,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(e,t.node_ops.statfs(t.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,te.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,te.mknod(r,e,0)),mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{te.mkdir(n,e)}catch(r){if(20!=r.errno)throw r}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,te.mknod(r,e,t)),symlink(r,e){if(!Xr.resolve(r))throw new te.ErrnoError(44);var t=te.lookupPath(e,{parent:!0}).node;if(!t)throw new te.ErrnoError(44);var n=Vr.basename(e),o=te.mayCreate(t,n);if(o)throw new te.ErrnoError(o);if(!t.node_ops.symlink)throw new te.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=Vr.dirname(r),a=Vr.dirname(e),i=Vr.basename(r),s=Vr.basename(e);if(t=te.lookupPath(r,{parent:!0}).node,n=te.lookupPath(e,{parent:!0}).node,!t||!n)throw new te.ErrnoError(44);if(t.mount!==n.mount)throw new te.ErrnoError(75);var u,l=te.lookupNode(t,i),d=Xr.relative(r,a);if("."!==d.charAt(0))throw new te.ErrnoError(28);if("."!==(d=Xr.relative(e,o)).charAt(0))throw new te.ErrnoError(55);try{u=te.lookupNode(n,s)}catch(r){}if(l!==u){var c=te.isDir(l.mode),f=te.mayDelete(t,i,c);if(f)throw new te.ErrnoError(f);if(f=u?te.mayDelete(n,s,c):te.mayCreate(n,s))throw new te.ErrnoError(f);if(!t.node_ops.rename)throw new te.ErrnoError(63);if(te.isMountpoint(l)||u&&te.isMountpoint(u))throw new te.ErrnoError(10);if(n!==t&&(f=te.nodePermissions(t,"w")))throw new te.ErrnoError(f);te.hashRemoveNode(l);try{t.node_ops.rename(l,n,s),l.parent=n}catch(r){throw r}finally{te.hashAddNode(l)}}},rmdir(r){var e=te.lookupPath(r,{parent:!0}).node,t=Vr.basename(r),n=te.lookupNode(e,t),o=te.mayDelete(e,t,!0);if(o)throw new te.ErrnoError(o);if(!e.node_ops.rmdir)throw new te.ErrnoError(63);if(te.isMountpoint(n))throw new te.ErrnoError(10);e.node_ops.rmdir(e,t),te.destroyNode(n)},readdir(r){var e=te.lookupPath(r,{follow:!0}).node;if(!e.node_ops.readdir)throw new te.ErrnoError(54);return e.node_ops.readdir(e)},unlink(r){var e=te.lookupPath(r,{parent:!0}).node;if(!e)throw new te.ErrnoError(44);var t=Vr.basename(r),n=te.lookupNode(e,t),o=te.mayDelete(e,t,!1);if(o)throw new te.ErrnoError(o);if(!e.node_ops.unlink)throw new te.ErrnoError(63);if(te.isMountpoint(n))throw new te.ErrnoError(10);e.node_ops.unlink(e,t),te.destroyNode(n)},readlink(r){var e=te.lookupPath(r).node;if(!e)throw new te.ErrnoError(44);if(!e.node_ops.readlink)throw new te.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=te.lookupPath(r,{follow:!e}).node;if(!t)throw new te.ErrnoError(44);if(!t.node_ops.getattr)throw new te.ErrnoError(63);return t.node_ops.getattr(t)},lstat:r=>te.stat(r,!0),chmod(r,e,t){var n;if(!(n="string"==typeof r?te.lookupPath(r,{follow:!t}).node:r).node_ops.setattr)throw new te.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,ctime:Date.now()})},lchmod(r,e){te.chmod(r,e,!0)},fchmod(r,e){var t=te.getStreamChecked(r);te.chmod(t.node,e)},chown(r,e,t,n){var o;if(!(o="string"==typeof r?te.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new te.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){te.chown(r,e,t,!0)},fchown(r,e,t){var n=te.getStreamChecked(r);te.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new te.ErrnoError(28);var t;if(!(t="string"==typeof r?te.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new te.ErrnoError(63);if(te.isDir(t.mode))throw new te.ErrnoError(31);if(!te.isFile(t.mode))throw new te.ErrnoError(28);var n=te.nodePermissions(t,"w");if(n)throw new te.ErrnoError(n);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=te.getStreamChecked(r);if(!(2097155&t.flags))throw new te.ErrnoError(28);te.truncate(t.node,e)},utime(r,e,t){var n=te.lookupPath(r,{follow:!0}).node;n.node_ops.setattr(n,{atime:e,mtime:t})},open(r,e,t=438){if(""===r)throw new te.ErrnoError(44);var n;if(t=64&(e="string"==typeof e?(r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(void 0===e)throw new Error(`Unknown file open mode: ${r}`);return e})(e):e)?4095&t|32768:0,"object"==typeof r)n=r;else{var a=te.lookupPath(r,{follow:!(131072&e),noent_okay:!0});n=a.node,r=a.path}var i=!1;if(64&e)if(n){if(128&e)throw new te.ErrnoError(20)}else n=te.mknod(r,t,0),i=!0;if(!n)throw new te.ErrnoError(44);if(te.isChrdev(n.mode)&&(e&=-513),65536&e&&!te.isDir(n.mode))throw new te.ErrnoError(54);if(!i){var s=te.mayOpen(n,e);if(s)throw new te.ErrnoError(s)}512&e&&!i&&te.truncate(n,0),e&=-131713;var u=te.createStream({node:n,path:te.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),!o.logReadFiles||1&e||r in te.readFiles||(te.readFiles[r]=1),u},close(r){if(te.isClosed(r))throw new te.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(r){throw r}finally{te.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(te.isClosed(r))throw new te.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new te.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new te.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new te.ErrnoError(28);if(te.isClosed(r))throw new te.ErrnoError(8);if(1==(2097155&r.flags))throw new te.ErrnoError(8);if(te.isDir(r.node.mode))throw new te.ErrnoError(31);if(!r.stream_ops.read)throw new te.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new te.ErrnoError(70)}else o=r.position;var i=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=i),i},write(r,e,t,n,o,a){if(n<0||o<0)throw new te.ErrnoError(28);if(te.isClosed(r))throw new te.ErrnoError(8);if(!(2097155&r.flags))throw new te.ErrnoError(8);if(te.isDir(r.node.mode))throw new te.ErrnoError(31);if(!r.stream_ops.write)throw new te.ErrnoError(28);r.seekable&&1024&r.flags&&te.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new te.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},allocate(r,e,t){if(te.isClosed(r))throw new te.ErrnoError(8);if(e<0||t<=0)throw new te.ErrnoError(28);if(!(2097155&r.flags))throw new te.ErrnoError(8);if(!te.isFile(r.node.mode)&&!te.isDir(r.node.mode))throw new te.ErrnoError(43);if(!r.stream_ops.allocate)throw new te.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new te.ErrnoError(2);if(1==(2097155&r.flags))throw new te.ErrnoError(2);if(!r.stream_ops.mmap)throw new te.ErrnoError(43);if(!e)throw new te.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,o)},msync:(r,e,t,n,o)=>r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0,ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new te.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=te.open(r,e.flags),o=te.stat(r).size,a=new Uint8Array(o);return te.read(n,a,0,o,0),"utf8"===e.encoding?t=Pr(a):"binary"===e.encoding&&(t=a),te.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=te.open(r,t.flags,t.mode);if("string"==typeof e){var o=new Uint8Array(Ar(e)+1),a=br(e,o,0,o.length);te.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");te.write(n,e,0,e.byteLength,void 0,t.canOwn)}te.close(n)},cwd:()=>te.currentPath,chdir(r){var e=te.lookupPath(r,{follow:!0});if(null===e.node)throw new te.ErrnoError(44);if(!te.isDir(e.node.mode))throw new te.ErrnoError(54);var t=te.nodePermissions(e.node,"x");if(t)throw new te.ErrnoError(t);te.currentPath=e.path},createDefaultDirectories(){te.mkdir("/tmp"),te.mkdir("/home"),te.mkdir("/home/web_user")},createDefaultDevices(){te.mkdir("/dev"),te.registerDevice(te.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),te.mkdev("/dev/null",te.makedev(1,3)),Jr.register(te.makedev(5,0),Jr.default_tty_ops),Jr.register(te.makedev(6,0),Jr.default_tty1_ops),te.mkdev("/dev/tty",te.makedev(5,0)),te.mkdev("/dev/tty1",te.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(e=qr(r).byteLength),r[--e]);te.createDevice("/dev","random",t),te.createDevice("/dev","urandom",t),te.mkdir("/dev/shm"),te.mkdir("/dev/shm/tmp")},createSpecialDirectories(){te.mkdir("/proc");var r=te.mkdir("/proc/self");te.mkdir("/proc/self/fd"),te.mount({mount(){var e=te.createNode(r,"fd",16895,73);return e.stream_ops={llseek:Yr.stream_ops.llseek},e.node_ops={lookup(r,e){var t=+e,n=te.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(te.streams.entries()).filter((([r,e])=>e)).map((([r,e])=>r.toString()))},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?te.createDevice("/dev","stdin",r):te.symlink("/dev/tty","/dev/stdin"),e?te.createDevice("/dev","stdout",null,e):te.symlink("/dev/tty","/dev/stdout"),t?te.createDevice("/dev","stderr",null,t):te.symlink("/dev/tty1","/dev/stderr"),te.open("/dev/stdin",0),te.open("/dev/stdout",1),te.open("/dev/stderr",1)},staticInit(){te.nameTable=new Array(4096),te.mount(Yr,{},"/"),te.createDefaultDirectories(),te.createDefaultDevices(),te.createSpecialDirectories(),te.filesystems={MEMFS:Yr}},init(r,e,t){te.initialized=!0,r??=o.stdin,e??=o.stdout,t??=o.stderr,te.createStandardStreams(r,e,t)},quit(){te.initialized=!1;for(var r=0;r<te.streams.length;r++){var e=te.streams[r];e&&te.close(e)}},findObject(r,e){var t=te.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=te.lookupPath(r,{follow:!e})).path}catch(r){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=te.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=Vr.basename(r),n=te.lookupPath(r,{follow:!e}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(r){t.error=r.errno}return t},createPath(r,e,t,n){r="string"==typeof r?r:te.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=Vr.join2(r,a);try{te.mkdir(i)}catch(r){}r=i}}return i},createFile(r,e,t,n,o){var a=Vr.join2("string"==typeof r?r:te.getPath(r),e),i=ee(n,o);return te.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:te.getPath(r),i=e?Vr.join2(r,e):r);var s=ee(n,o),u=te.create(i,s);if(t){if("string"==typeof t){for(var l=new Array(t.length),d=0,c=t.length;d<c;++d)l[d]=t.charCodeAt(d);t=l}te.chmod(u,146|s);var f=te.open(u,577);te.write(f,t,0,t.length,0,a),te.close(f),te.chmod(u,s)}},createDevice(r,e,t,n){var o=Vr.join2("string"==typeof r?r:te.getPath(r),e),a=ee(!!t,!!n);te.createDevice.major??=64;var i=te.makedev(te.createDevice.major++,0);return te.registerDevice(i,{open(r){r.seekable=!1},close(r){n?.buffer?.length&&n(10)},read(r,e,n,o,a){for(var i=0,s=0;s<o;s++){var u;try{u=t()}catch(r){throw new te.ErrnoError(29)}if(void 0===u&&0===i)throw new te.ErrnoError(6);if(null==u)break;i++,e[n+s]=u}return i&&(r.node.atime=Date.now()),i},write(r,e,t,o,a){for(var i=0;i<o;i++)try{n(e[t+i])}catch(r){throw new te.ErrnoError(29)}return o&&(r.node.mtime=r.node.ctime=Date.now()),i}}),te.mkdev(o,a,i)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{r.contents=l(r.url),r.usedBytes=r.contents.length}catch(r){throw new te.ErrnoError(29)}},createLazyFile(r,e,t,n,o){class a{lengthKnown=!1;chunks=[];get(r){if(!(r>this.length-1||r<0)){var e=r%this.chunkSize,t=r/this.chunkSize|0;return this.getter(t)[e]}}setDataGetter(r){this.getter=r}cacheLength(){var r=new XMLHttpRequest;if(r.open("HEAD",t,!1),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw new Error("Couldn't load "+t+". Status: "+r.status);var e,n=Number(r.getResponseHeader("Content-length")),o=(e=r.getResponseHeader("Accept-Ranges"))&&"bytes"===e,a=(e=r.getResponseHeader("Content-Encoding"))&&"gzip"===e,i=1048576;o||(i=n);var s=(r,e)=>{if(r>e)throw new Error("invalid range ("+r+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+r+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):Kr(o.responseText||"")},u=this;u.setDataGetter((r=>{var e=r*i,t=(r+1)*i-1;if(t=Math.min(t,n-1),void 0===u.chunks[r]&&(u.chunks[r]=s(e,t)),void 0===u.chunks[r])throw new Error("doXHR failed!");return u.chunks[r]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,h("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new a}}else i={isDevice:!1,url:t};var u=te.createFile(r,e,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function d(r,e,t,n,o){var a=r.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)e[t+s]=a[o+s];else for(s=0;s<i;s++)e[t+s]=a.get(o+s);return i}return Object.keys(u.stream_ops).forEach((r=>{var e=u.stream_ops[r];l[r]=(...r)=>(te.forceLoadFile(u),e(...r))})),l.read=(r,e,t,n,o)=>(te.forceLoadFile(u),d(r,e,t,n,o)),l.mmap=(r,e,t,n,o)=>{te.forceLoadFile(u);var a=Qr();if(!a)throw new te.ErrnoError(48);return d(r,v,a,e,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ne={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(Vr.isAbs(e))return e;var n;if(n=-100===r?te.cwd():ne.getStreamFromFD(r).path,0==e.length){if(!t)throw new te.ErrnoError(44);return n}return n+"/"+e},doStat(r,e,t){var n=r(e);E[t>>2]=n.dev,E[t+4>>2]=n.mode,k[t+8>>2]=n.nlink,E[t+12>>2]=n.uid,E[t+16>>2]=n.gid,E[t+20>>2]=n.rdev,W=[n.size>>>0,(O=n.size,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[t+24>>2]=W[0],E[t+28>>2]=W[1],E[t+32>>2]=4096,E[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return W=[Math.floor(o/1e3)>>>0,(O=Math.floor(o/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[t+40>>2]=W[0],E[t+44>>2]=W[1],k[t+48>>2]=o%1e3*1e3*1e3,W=[Math.floor(a/1e3)>>>0,(O=Math.floor(a/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[t+56>>2]=W[0],E[t+60>>2]=W[1],k[t+64>>2]=a%1e3*1e3*1e3,W=[Math.floor(i/1e3)>>>0,(O=Math.floor(i/1e3),+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[t+72>>2]=W[0],E[t+76>>2]=W[1],k[t+80>>2]=i%1e3*1e3*1e3,W=[n.ino>>>0,(O=n.ino,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[t+88>>2]=W[0],E[t+92>>2]=W[1],0},doMsync(r,e,t,n,o){if(!te.isFile(e.node.mode))throw new te.ErrnoError(43);if(2&n)return 0;var a=w.slice(r,r+t);te.msync(e,a,o,t,n)},getStreamFromFD:r=>te.getStreamChecked(r),varargs:void 0,getStr:r=>Dr(r)};(()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);H=r})(),V=o.BindingError=class extends Error{constructor(r){super(r),this.name="BindingError"}},q=o.InternalError=class extends Error{constructor(r){super(r),this.name="InternalError"}},er.push(0,1,void 0,1,null,1,!0,1,!1,1),o.count_emval_handles=()=>er.length/2-5-rr.length,hr=o.UnboundTypeError=((r,e)=>{var t=ur(e,(function(r){this.name=e,this.message=r;var t=new Error(r).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t})(Error,"UnboundTypeError"),te.createPreloadedFile=(r,e,t,n,o,a,i,s,u,l)=>{var d=e?Xr.resolve(Vr.join2(r,e)):r;function c(t){function c(t){l?.(),s||((r,e,t,n,o,a)=>{te.createDataFile(r,e,t,n,o,a)})(r,e,t,n,o,u),a?.(),$()}((r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return re.forEach((a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)})),o})(t,d,c,(()=>{i?.(),$()}))||c(t)}x(),"string"==typeof t?Zr(t).then(c,i):c(t)},te.staticInit(),Yr.doesNotExistError=new te.ErrnoError(44),Yr.doesNotExistError.stack="<generic error, no stack>";var oe,ae={q:(r,e,t)=>{throw new I(r).init(e,t),r},w:()=>N(""),s:(r,e,t,n,o)=>{},D:(r,e,t,n)=>{Z(r,{name:e=X(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:8,readValueFromPointer:function(r){return this.fromWireType(w[r])},destructorFunction:null})},B:r=>Z(r,ir),o:(r,e,t)=>{Z(r,{name:e=X(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:8,readValueFromPointer:sr(e,t),destructorFunction:null})},p:(r,e,t,n,o,a,i,s)=>{var u=((r,e)=>{for(var t=[],n=0;n<r;n++)t.push(k[e+4*n>>2]);return t})(e,t);r=(r=>{const e=(r=r.trim()).indexOf("(");return-1!==e?r.substr(0,e):r})(r=X(r)),o=gr(n,o),mr(r,(function(){((r,e)=>{var t=[],n={};throw e.forEach((function r(e){n[e]||K[e]||(J[e]?J[e].forEach(r):(t.push(e),n[e]=!0))})),new hr(`${r}: `+t.map(Er).join([", "]))})(`Cannot call ${r} due to unbound types`,u)}),e-1),((r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&Y("Mismatched type converter count");for(var o=0;o<r.length;++o)Z(r[o],n[o])}r.forEach((r=>J[r]=e));var o=new Array(e.length),a=[],i=0;e.forEach(((r,e)=>{K.hasOwnProperty(r)?o[e]=K[r]:(a.push(r),G.hasOwnProperty(r)||(G[r]=[]),G[r].push((()=>{o[e]=K[r],++i===a.length&&n(o)})))})),0===a.length&&n(o)})([],u,(t=>{var n=[t[0],null].concat(t.slice(1));return vr(r,function(r,e,t,n,o,a){var i=e.length;i<2&&Q("argTypes array size mismatch! Must at least get return value and 'this' types!"),e[1];for(var s=dr(e),u="void"!==e[0].name,l=[r,Q,n,o,lr,e[0],e[1]],d=0;d<i-2;++d)l.push(e[d+2]);if(!s)for(d=2;d<e.length;++d)null!==e[d].destructorFunction&&l.push(e[d].destructorFunction);let[c,f]=function(r,e,t,n){for(var o=dr(r),a=r.length-2,i=[],s=["fn"],u=0;u<a;++u)i.push(`arg${u}`),s.push(`arg${u}Wired`);i=i.join(","),s=s.join(",");var l=`return function (${i}) {\n`;o&&(l+="var destructors = [];\n");var d=o?"destructors":"null",c=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(u=0;u<a;++u)l+=`var arg${u}Wired = argType${u}['toWireType'](${d}, arg${u});\n`,c.push(`argType${u}`);if(l+=(t||n?"var rv = ":"")+`invoker(${s});\n`,o)l+="runDestructors(destructors);\n";else for(u=2;u<r.length;++u){var f=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==r[u].destructorFunction&&(l+=`${f}_dtor(${f});\n`,c.push(`${f}_dtor`))}return t&&(l+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[c,l+="}\n"]}(e,0,u,a);c.push(f);var h=cr(Function,c)(...l);return ur(r,h)}(r,n,0,o,a,i),e-1),[]}))},c:(r,e,t,n,o)=>{e=X(e);var a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i}var s=e.includes("unsigned");Z(r,{name:e,fromWireType:a,toWireType:s?function(r,e){return this.name,e>>>0}:function(r,e){return this.name,e},argPackAdvance:8,readValueFromPointer:kr(e,t,0!==n),destructorFunction:null})},a:(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(r){var e=k[r>>2],t=k[r+4>>2];return new n(v.buffer,t,e)}Z(r,{name:t=X(t),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},C:(r,e)=>{Z(r,{name:e=X(e),fromWireType(r){for(var e,t=k[r>>2],n=r+4,o=n,a=0;a<=t;++a){var i=n+a;if(a==t||0==w[i]){var s=Dr(o,i-o);void 0===e?e=s:(e+=String.fromCharCode(0),e+=s),o=i+1}}return le(r),e},toWireType(r,e){var t;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var n="string"==typeof e;n||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Q("Cannot pass non-string to std::string"),t=n?Ar(e):e.length;var o=ue(4+t+1),a=o+4;if(k[o>>2]=t,n)_r(e,a,t+1);else if(n)for(var i=0;i<t;++i){var s=e.charCodeAt(i);s>255&&(le(a),Q("String has UTF-16 code units that do not fit in 8 bits")),w[a+i]=s}else for(i=0;i<t;++i)w[a+i]=e[i];return null!==r&&r.push(le,o),o},argPackAdvance:8,readValueFromPointer:ar,destructorFunction(r){le(r)}})},i:(r,e,t)=>{var n,o,a,i;t=X(t),2===e?(n=Tr,o=Cr,i=Mr,a=r=>g[r>>1]):4===e&&(n=jr,o=Rr,i=xr,a=r=>k[r>>2]),Z(r,{name:t,fromWireType:r=>{for(var t,o=k[r>>2],i=r+4,s=0;s<=o;++s){var u=r+4+s*e;if(s==o||0==a(u)){var l=n(i,u-i);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),i=u+e}}return le(r),t},toWireType:(r,n)=>{"string"!=typeof n&&Q(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=ue(4+a+e);return k[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(le,s),s},argPackAdvance:8,readValueFromPointer:ar,destructorFunction(r){le(r)}})},E:(r,e)=>{Z(r,{isVoid:!0,name:e=X(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},A:(r,e,t)=>w.copyWithin(r,e,e+t),m:(r,e,t)=>(r=nr(r),e=$r(e,"emval::as"),Nr(e,t,r)),k:(r,e,t,n)=>(r=zr[r])(null,e=nr(e),t,n),j:(r,e,t,n,o)=>(r=zr[r])(e=nr(e),e[t=Wr(t)],n,o),b:tr,F:r=>0===r?or(Br()):(r=Wr(r),or(Br()[r])),g:(r,e,t)=>{var n=((r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=$r(k[e+4*n>>2],"parameter "+n);return t})(r,e),o=n.shift();r--;var a="return function (obj, func, destructorsRef, args) {\n",i=0,s=[];0===t&&s.push("obj");for(var u=["retType"],l=[o],d=0;d<r;++d)s.push("arg"+d),u.push("argType"+d),l.push(n[d]),a+=` var arg${d} = argType${d}.readValueFromPointer(args${i?"+"+i:""});\n`,i+=n[d].argPackAdvance;a+=` var rv = ${1===t?"new func":"func.call"}(${s.join(", ")});\n`,o.isVoid||(u.push("emval_returnValue"),l.push(Nr),a+=" return emval_returnValue(retType, destructorsRef, rv);\n"),a+="};\n",u.push(a);var c=cr(Function,u)(...l),f=`methodCaller<(${n.map((r=>r.name)).join(", ")}) => ${o.name}>`;return(r=>{var e=zr.length;return zr.push(r),e})(ur(f,c))},l:r=>(r=Wr(r),or(o[r])),e:(r,e)=>(r=nr(r),e=nr(e),or(r[e])),h:r=>{r>9&&(er[r+1]+=1)},f:r=>or(Wr(r)),d:r=>{var e=nr(r);lr(e),tr(r)},t:(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),u=i.getTimezoneOffset(),l=Math.max(s,u);k[r>>2]=60*l,E[e>>2]=Number(s!=u);var d=r=>{var e=r>=0?"-":"+",t=Math.abs(r);return`UTC${e}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},c=d(s),f=d(u);u<s?(_r(c,t,17),_r(f,n,17)):(_r(c,n,17),_r(f,t,17))},z:r=>{var e=w.length,t=2147483648;if((r>>>=0)>t)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);o=Math.min(o,r+100663296);var a=Math.min(t,Ur(Math.max(r,o),65536));if(Lr(a))return!0}return!1},u:(r,e)=>{var t=0;return Hr().forEach(((n,o)=>{var a=e+t;k[r+4*o>>2]=a,((r,e)=>{for(var t=0;t<r.length;++t)v[e++]=r.charCodeAt(t);v[e]=0})(n,a),t+=n.length+1})),0},v:(r,e)=>{var t=Hr();k[r>>2]=t.length;var n=0;return t.forEach((r=>n+=r.length+1)),k[e>>2]=n,0},x:function(r){try{var e=ne.getStreamFromFD(r);return te.close(e),0}catch(r){if(void 0===te||"ErrnoError"!==r.name)throw r;return r.errno}},y:function(r,e,t,n){try{var o=((r,e,t)=>{for(var n=0,o=0;o<t;o++){var a=k[e>>2],i=k[e+4>>2];e+=8;var s=te.read(r,v,a,i,undefined);if(s<0)return-1;if(n+=s,s<i)break}return n})(ne.getStreamFromFD(r),e,t);return k[n>>2]=o,0}catch(r){if(void 0===te||"ErrnoError"!==r.name)throw r;return r.errno}},r:function(r,e,t,n,o){var a=((r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*e:NaN)(e,t);try{if(isNaN(a))return 61;var i=ne.getStreamFromFD(r);return te.llseek(i,a,n),W=[i.position>>>0,(O=i.position,+Math.abs(O)>=1?O>0?+Math.floor(O/4294967296)>>>0:~~+Math.ceil((O-+(~~O>>>0))/4294967296)>>>0:0)],E[o>>2]=W[0],E[o+4>>2]=W[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(r){if(void 0===te||"ErrnoError"!==r.name)throw r;return r.errno}},n:function(r,e,t,n){try{var o=((r,e,t)=>{for(var n=0,o=0;o<t;o++){var a=k[e>>2],i=k[e+4>>2];e+=8;var s=te.write(r,v,a,i,undefined);if(s<0)return-1;if(n+=s,s<i)break}return n})(ne.getStreamFromFD(r),e,t);return k[n>>2]=o,0}catch(r){if(void 0===te||"ErrnoError"!==r.name)throw r;return r.errno}}};!async function(){function r(r,e){return oe=r.exports,m=oe.G,P(),fr=oe.J,function(r){S.unshift(r)}(oe.H),$(),oe}x();var e={a:ae};if(o.instantiateWasm)try{return o.instantiateWasm(e,r)}catch(r){p(`Module.instantiateWasm callback failed with error: ${r}`),t(r)}z??=function(){var r="dxt_encoder.wasm";return B(r)?r:function(r){return o.locateFile?o.locateFile(r,f):f+r}(r)}();try{var n=await U(A,z,e);return function(e){r(e.instance)}(n),n}catch(r){return void t(r)}}();var ie,se=r=>(se=oe.I)(r),ue=r=>(ue=oe.K)(r),le=r=>(le=oe.L)(r);function de(){function r(){ie||(ie=!0,o.calledRun=!0,F||(o.noFSInit||te.initialized||te.init(),te.ignorePermissions=!1,L(S),e(o),o.onRuntimeInitialized?.(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)M(o.postRun.shift());L(T)}()))}j>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)C(o.preRun.shift());L(D)}(),j>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((()=>{setTimeout((()=>o.setStatus("")),1),r()}),1)):r()))}if(o.dynCall_jiji=(r,e,t,n,a)=>(o.dynCall_jiji=oe.M)(r,e,t,n,a),o.dynCall_viijii=(r,e,t,n,a,i,s)=>(o.dynCall_viijii=oe.N)(r,e,t,n,a,i,s),o.dynCall_iiiiij=(r,e,t,n,a,i,s)=>(o.dynCall_iiiiij=oe.O)(r,e,t,n,a,i,s),o.dynCall_iiiiijj=(r,e,t,n,a,i,s,u,l)=>(o.dynCall_iiiiijj=oe.P)(r,e,t,n,a,i,s,u,l),o.dynCall_iiiiiijj=(r,e,t,n,a,i,s,u,l,d)=>(o.dynCall_iiiiiijj=oe.Q)(r,e,t,n,a,i,s,u,l,d),R=function r(){ie||de(),ie||(R=r)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return de(),a})}}]);