UNPKG

terriajs

Version:

Geospatial data visualization platform.

1 lines 86.9 kB
(self.webpackChunkterriajs=self.webpackChunkterriajs||[]).push([[892],{30892:(r,t,e)=>{var n,o=e(48287).hp,i=(n=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0)||"/index.js",function(r){var t,i,a=void 0!==(r=r||{})?r:{};a.ready=new Promise((function(r,e){t=r,i=e}));var u,s={};for(u in a)a.hasOwnProperty(u)&&(s[u]=a[u]);var c,f,l,d,p,h=[],m="./this.program",v="object"==typeof window,y="function"==typeof importScripts,g="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,w="";g?(w=y?e(37447).dirname(w)+"/":"//",c=function(r,t){return d||(d=e(42171)),p||(p=e(37447)),r=p.normalize(r),d.readFileSync(r,t?null:"utf8")},l=function(r){var t=c(r,!0);return t.buffer||(t=new Uint8Array(t)),D(t.buffer),t},f=function(r,t,n){d||(d=e(42171)),p||(p=e(37447)),r=p.normalize(r),d.readFile(r,(function(r,e){r?n(r):t(e.buffer)}))},process.argv.length>1&&(m=process.argv[1].replace(/\\/g,"/")),h=process.argv.slice(2),process.on("uncaughtException",(function(r){if(!(r instanceof _e))throw r})),process.on("unhandledRejection",(function(r){throw r})),a.inspect=function(){return"[Emscripten Module object]"}):(v||y)&&(y?w=self.location.href:"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src),n&&(w=n),w=0!==w.indexOf("blob:")?w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):"",c=function(r){var t=new XMLHttpRequest;return t.open("GET",r,!1),t.send(null),t.responseText},y&&(l=function(r){var t=new XMLHttpRequest;return t.open("GET",r,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),f=function(r,t,e){var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):e()},n.onerror=e,n.send(null)});var _=a.print||console.log.bind(console),E=a.printErr||console.warn.bind(console);for(u in s)s.hasOwnProperty(u)&&(a[u]=s[u]);s=null,a.arguments&&(h=a.arguments),a.thisProgram&&(m=a.thisProgram),a.quit&&a.quit;var b,k,j=0,C=function(r){j=r};a.wasmBinary&&(b=a.wasmBinary),a.noExitRuntime,"object"!=typeof WebAssembly&&fr("no native wasm support detected");var P=!1;function D(r,t){r||fr("Assertion failed: "+t)}var T="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function S(r,t,e){for(var n=t+e,o=t;r[o]&&!(o>=n);)++o;if(o-t>16&&r.subarray&&T)return T.decode(r.subarray(t,o));for(var i="";t<o;){var a=r[t++];if(128&a){var u=63&r[t++];if(192!=(224&a)){var s=63&r[t++];if((a=224==(240&a)?(15&a)<<12|u<<6|s:(7&a)<<18|u<<12|s<<6|63&r[t++])<65536)i+=String.fromCharCode(a);else{var c=a-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&a)<<6|u)}else i+=String.fromCharCode(a)}return i}function F(r,t){return r?S(O,r,t):""}function A(r,t,e,n){if(!(n>0))return 0;for(var o=e,i=e+n-1,a=0;a<r.length;++a){var u=r.charCodeAt(a);if(u>=55296&&u<=57343&&(u=65536+((1023&u)<<10)|1023&r.charCodeAt(++a)),u<=127){if(e>=i)break;t[e++]=u}else if(u<=2047){if(e+1>=i)break;t[e++]=192|u>>6,t[e++]=128|63&u}else if(u<=65535){if(e+2>=i)break;t[e++]=224|u>>12,t[e++]=128|u>>6&63,t[e++]=128|63&u}else{if(e+3>=i)break;t[e++]=240|u>>18,t[e++]=128|u>>12&63,t[e++]=128|u>>6&63,t[e++]=128|63&u}}return t[e]=0,e-o}function $(r,t,e){return A(r,O,t,e)}function M(r){for(var t=0,e=0;e<r.length;++e){var n=r.charCodeAt(e);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&r.charCodeAt(++e)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}var x,R,O,z,B,N,W,I,H,U="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function L(r,t){for(var e=r,n=e>>1,o=n+t/2;!(n>=o)&&B[n];)++n;if((e=n<<1)-r>32&&U)return U.decode(O.subarray(r,e));for(var i="",a=0;!(a>=t/2);++a){var u=z[r+2*a>>1];if(0==u)break;i+=String.fromCharCode(u)}return i}function V(r,t,e){if(void 0===e&&(e=2147483647),e<2)return 0;for(var n=t,o=(e-=2)<2*r.length?e/2:r.length,i=0;i<o;++i){var a=r.charCodeAt(i);z[t>>1]=a,t+=2}return z[t>>1]=0,t-n}function Y(r){return 2*r.length}function q(r,t){for(var e=0,n="";!(e>=t/4);){var o=N[r+4*e>>2];if(0==o)break;if(++e,o>=65536){var i=o-65536;n+=String.fromCharCode(55296|i>>10,56320|1023&i)}else n+=String.fromCharCode(o)}return n}function G(r,t,e){if(void 0===e&&(e=2147483647),e<4)return 0;for(var n=t,o=n+e-4,i=0;i<r.length;++i){var a=r.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&r.charCodeAt(++i)),N[t>>2]=a,(t+=4)+4>o)break}return N[t>>2]=0,t-n}function X(r){for(var t=0,e=0;e<r.length;++e){var n=r.charCodeAt(e);n>=55296&&n<=57343&&++e,t+=4}return t}function K(r){x=r,a.HEAP8=R=new Int8Array(r),a.HEAP16=z=new Int16Array(r),a.HEAP32=N=new Int32Array(r),a.HEAPU8=O=new Uint8Array(r),a.HEAPU16=B=new Uint16Array(r),a.HEAPU32=W=new Uint32Array(r),a.HEAPF32=I=new Float32Array(r),a.HEAPF64=H=new Float64Array(r)}a.INITIAL_MEMORY;var J,Z,Q,rr,tr,er=[],nr=[],or=[],ir=0,ar=null,ur=null;function sr(r){ir++,a.monitorRunDependencies&&a.monitorRunDependencies(ir)}function cr(r){if(ir--,a.monitorRunDependencies&&a.monitorRunDependencies(ir),0==ir&&(null!==ar&&(clearInterval(ar),ar=null),ur)){var t=ur;ur=null,t()}}function fr(r){a.onAbort&&a.onAbort(r),E(r="Aborted("+r+")"),P=!0,r+=". Build with -s ASSERTIONS=1 for more info.";var t=new WebAssembly.RuntimeError(r);throw i(t),t}function lr(r){return r.startsWith("data:application/octet-stream;base64,")}function dr(r){return r.startsWith("file://")}function pr(r){try{if(r==Z&&b)return new Uint8Array(b);if(l)return l(r);throw"both async and sync fetching of the wasm failed"}catch(r){fr(r)}}function hr(r){for(;r.length>0;){var t=r.shift();if("function"!=typeof t){var e=t.func;"number"==typeof e?void 0===t.arg?vr(e)():vr(e)(t.arg):e(void 0===t.arg?null:t.arg)}else t(a)}}a.preloadedImages={},a.preloadedAudios={},lr(Z="assimpjs.wasm")||(Q=Z,Z=a.locateFile?a.locateFile(Q,w):w+Q);var mr=[];function vr(r){var t=mr[r];return t||(r>=mr.length&&(mr.length=r+1),mr[r]=t=J.get(r)),t}function yr(r){this.excPtr=r,this.ptr=r-16,this.set_type=function(r){N[this.ptr+4>>2]=r},this.get_type=function(){return N[this.ptr+4>>2]},this.set_destructor=function(r){N[this.ptr+8>>2]=r},this.get_destructor=function(){return N[this.ptr+8>>2]},this.set_refcount=function(r){N[this.ptr>>2]=r},this.set_caught=function(r){r=r?1:0,R[this.ptr+12|0]=r},this.get_caught=function(){return 0!=R[this.ptr+12|0]},this.set_rethrown=function(r){r=r?1:0,R[this.ptr+13|0]=r},this.get_rethrown=function(){return 0!=R[this.ptr+13|0]},this.init=function(r,t){this.set_type(r),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var r=N[this.ptr>>2];N[this.ptr>>2]=r+1},this.release_ref=function(){var r=N[this.ptr>>2];return N[this.ptr>>2]=r-1,1===r}}function gr(r){this.free=function(){Xt(this.ptr),this.ptr=0},this.set_base_ptr=function(r){N[this.ptr>>2]=r},this.get_base_ptr=function(){return N[this.ptr>>2]},this.set_adjusted_ptr=function(r){N[this.ptr+4>>2]=r},this.get_adjusted_ptr_addr=function(){return this.ptr+4},this.get_adjusted_ptr=function(){return N[this.ptr+4>>2]},this.get_exception_ptr=function(){if(ee(this.get_exception_info().get_type()))return N[this.get_base_ptr()>>2];var r=this.get_adjusted_ptr();return 0!==r?r:this.get_base_ptr()},this.get_exception_info=function(){return new yr(this.get_base_ptr())},void 0===r?(this.ptr=Gt(8),this.set_adjusted_ptr(0)):this.ptr=r}var wr=[];function _r(r){r.add_ref()}var Er=0;function br(r){return Xt(new yr(r).ptr)}function kr(r){if(r.release_ref()&&!r.get_rethrown()){var t=r.get_destructor();t&&vr(t)(r.excPtr),br(r.excPtr)}}var jr=0,Cr={splitPath:function(r){return/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1)},normalizeArray:function(r,t){for(var e=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),e++):e&&(r.splice(n,1),e--)}if(t)for(;e;e--)r.unshift("..");return r},normalize:function(r){var t="/"===r.charAt(0),e="/"===r.substr(-1);return(r=Cr.normalizeArray(r.split("/").filter((function(r){return!!r})),!t).join("/"))||t||(r="."),r&&e&&(r+="/"),(t?"/":"")+r},dirname:function(r){var t=Cr.splitPath(r),e=t[0],n=t[1];return e||n?(n&&(n=n.substr(0,n.length-1)),e+n):"."},basename:function(r){if("/"===r)return"/";var t=(r=(r=Cr.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?r:r.substr(t+1)},extname:function(r){return Cr.splitPath(r)[3]},join:function(){var r=Array.prototype.slice.call(arguments,0);return Cr.normalize(r.join("/"))},join2:function(r,t){return Cr.normalize(r+"/"+t)}},Pr={resolve:function(){for(var r="",t=!1,e=arguments.length-1;e>=-1&&!t;e--){var n=e>=0?arguments[e]:Sr.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";r=n+"/"+r,t="/"===n.charAt(0)}return(t?"/":"")+(r=Cr.normalizeArray(r.split("/").filter((function(r){return!!r})),!t).join("/"))||"."},relative:function(r,t){function e(r){for(var t=0;t<r.length&&""===r[t];t++);for(var e=r.length-1;e>=0&&""===r[e];e--);return t>e?[]:r.slice(t,e-t+1)}r=Pr.resolve(r).substr(1),t=Pr.resolve(t).substr(1);for(var n=e(r.split("/")),o=e(t.split("/")),i=Math.min(n.length,o.length),a=i,u=0;u<i;u++)if(n[u]!==o[u]){a=u;break}var s=[];for(u=a;u<n.length;u++)s.push("..");return(s=s.concat(o.slice(a))).join("/")}},Dr={ttys:[],init:function(){},shutdown:function(){},register:function(r,t){Dr.ttys[r]={input:[],output:[],ops:t},Sr.registerDevice(r,Dr.stream_ops)},stream_ops:{open:function(r){var t=Dr.ttys[r.node.rdev];if(!t)throw new Sr.ErrnoError(43);r.tty=t,r.seekable=!1},close:function(r){r.tty.ops.flush(r.tty)},flush:function(r){r.tty.ops.flush(r.tty)},read:function(r,t,e,n,o){if(!r.tty||!r.tty.ops.get_char)throw new Sr.ErrnoError(60);for(var i=0,a=0;a<n;a++){var u;try{u=r.tty.ops.get_char(r.tty)}catch(r){throw new Sr.ErrnoError(29)}if(void 0===u&&0===i)throw new Sr.ErrnoError(6);if(null==u)break;i++,t[e+a]=u}return i&&(r.node.timestamp=Date.now()),i},write:function(r,t,e,n,o){if(!r.tty||!r.tty.ops.put_char)throw new Sr.ErrnoError(60);try{for(var i=0;i<n;i++)r.tty.ops.put_char(r.tty,t[e+i])}catch(r){throw new Sr.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),i}},default_tty_ops:{get_char:function(r){if(!r.input.length){var t=null;if(g){var e=o.alloc(256),n=0;try{n=d.readSync(process.stdin.fd,e,0,256,null)}catch(r){if(!r.toString().includes("EOF"))throw r;n=0}t=n>0?e.slice(0,n).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;r.input=Vt(t,!0)}return r.input.shift()},put_char:function(r,t){null===t||10===t?(_(S(r.output,0)),r.output=[]):0!=t&&r.output.push(t)},flush:function(r){r.output&&r.output.length>0&&(_(S(r.output,0)),r.output=[])}},default_tty1_ops:{put_char:function(r,t){null===t||10===t?(E(S(r.output,0)),r.output=[]):0!=t&&r.output.push(t)},flush:function(r){r.output&&r.output.length>0&&(E(S(r.output,0)),r.output=[])}}},Tr={ops_table:null,mount:function(r){return Tr.createNode(null,"/",16895,0)},createNode:function(r,t,e,n){if(Sr.isBlkdev(e)||Sr.isFIFO(e))throw new Sr.ErrnoError(63);Tr.ops_table||(Tr.ops_table={dir:{node:{getattr:Tr.node_ops.getattr,setattr:Tr.node_ops.setattr,lookup:Tr.node_ops.lookup,mknod:Tr.node_ops.mknod,rename:Tr.node_ops.rename,unlink:Tr.node_ops.unlink,rmdir:Tr.node_ops.rmdir,readdir:Tr.node_ops.readdir,symlink:Tr.node_ops.symlink},stream:{llseek:Tr.stream_ops.llseek}},file:{node:{getattr:Tr.node_ops.getattr,setattr:Tr.node_ops.setattr},stream:{llseek:Tr.stream_ops.llseek,read:Tr.stream_ops.read,write:Tr.stream_ops.write,allocate:Tr.stream_ops.allocate,mmap:Tr.stream_ops.mmap,msync:Tr.stream_ops.msync}},link:{node:{getattr:Tr.node_ops.getattr,setattr:Tr.node_ops.setattr,readlink:Tr.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Tr.node_ops.getattr,setattr:Tr.node_ops.setattr},stream:Sr.chrdev_stream_ops}});var o=Sr.createNode(r,t,e,n);return Sr.isDir(o.mode)?(o.node_ops=Tr.ops_table.dir.node,o.stream_ops=Tr.ops_table.dir.stream,o.contents={}):Sr.isFile(o.mode)?(o.node_ops=Tr.ops_table.file.node,o.stream_ops=Tr.ops_table.file.stream,o.usedBytes=0,o.contents=null):Sr.isLink(o.mode)?(o.node_ops=Tr.ops_table.link.node,o.stream_ops=Tr.ops_table.link.stream):Sr.isChrdev(o.mode)&&(o.node_ops=Tr.ops_table.chrdev.node,o.stream_ops=Tr.ops_table.chrdev.stream),o.timestamp=Date.now(),r&&(r.contents[t]=o,r.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(r){return r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0)},expandFileStorage:function(r,t){var e=r.contents?r.contents.length:0;if(!(e>=t)){t=Math.max(t,e*(e<1048576?2:1.125)>>>0),0!=e&&(t=Math.max(t,256));var n=r.contents;r.contents=new Uint8Array(t),r.usedBytes>0&&r.contents.set(n.subarray(0,r.usedBytes),0)}},resizeFileStorage:function(r,t){if(r.usedBytes!=t)if(0==t)r.contents=null,r.usedBytes=0;else{var e=r.contents;r.contents=new Uint8Array(t),e&&r.contents.set(e.subarray(0,Math.min(t,r.usedBytes))),r.usedBytes=t}},node_ops:{getattr:function(r){var t={};return t.dev=Sr.isChrdev(r.mode)?r.id:1,t.ino=r.id,t.mode=r.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=r.rdev,Sr.isDir(r.mode)?t.size=4096:Sr.isFile(r.mode)?t.size=r.usedBytes:Sr.isLink(r.mode)?t.size=r.link.length:t.size=0,t.atime=new Date(r.timestamp),t.mtime=new Date(r.timestamp),t.ctime=new Date(r.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(r,t){void 0!==t.mode&&(r.mode=t.mode),void 0!==t.timestamp&&(r.timestamp=t.timestamp),void 0!==t.size&&Tr.resizeFileStorage(r,t.size)},lookup:function(r,t){throw Sr.genericErrors[44]},mknod:function(r,t,e,n){return Tr.createNode(r,t,e,n)},rename:function(r,t,e){if(Sr.isDir(r.mode)){var n;try{n=Sr.lookupNode(t,e)}catch(r){}if(n)for(var o in n.contents)throw new Sr.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=e,t.contents[e]=r,t.timestamp=r.parent.timestamp,r.parent=t},unlink:function(r,t){delete r.contents[t],r.timestamp=Date.now()},rmdir:function(r,t){var e=Sr.lookupNode(r,t);for(var n in e.contents)throw new Sr.ErrnoError(55);delete r.contents[t],r.timestamp=Date.now()},readdir:function(r){var t=[".",".."];for(var e in r.contents)r.contents.hasOwnProperty(e)&&t.push(e);return t},symlink:function(r,t,e){var n=Tr.createNode(r,t,41471,0);return n.link=e,n},readlink:function(r){if(!Sr.isLink(r.mode))throw new Sr.ErrnoError(28);return r.link}},stream_ops:{read:function(r,t,e,n,o){var i=r.node.contents;if(o>=r.node.usedBytes)return 0;var a=Math.min(r.node.usedBytes-o,n);if(a>8&&i.subarray)t.set(i.subarray(o,o+a),e);else for(var u=0;u<a;u++)t[e+u]=i[o+u];return a},write:function(r,t,e,n,o,i){if(t.buffer===R.buffer&&(i=!1),!n)return 0;var a=r.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(i)return a.contents=t.subarray(e,e+n),a.usedBytes=n,n;if(0===a.usedBytes&&0===o)return a.contents=t.slice(e,e+n),a.usedBytes=n,n;if(o+n<=a.usedBytes)return a.contents.set(t.subarray(e,e+n),o),n}if(Tr.expandFileStorage(a,o+n),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(e,e+n),o);else for(var u=0;u<n;u++)a.contents[o+u]=t[e+u];return a.usedBytes=Math.max(a.usedBytes,o+n),n},llseek:function(r,t,e){var n=t;if(1===e?n+=r.position:2===e&&Sr.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new Sr.ErrnoError(28);return n},allocate:function(r,t,e){Tr.expandFileStorage(r.node,t+e),r.node.usedBytes=Math.max(r.node.usedBytes,t+e)},mmap:function(r,t,e,n,o,i){if(0!==t)throw new Sr.ErrnoError(28);if(!Sr.isFile(r.node.mode))throw new Sr.ErrnoError(43);var a,u,s=r.node.contents;if(2&i||s.buffer!==x){if((n>0||n+e<s.length)&&(s=s.subarray?s.subarray(n,n+e):Array.prototype.slice.call(s,n,n+e)),u=!0,!(a=void fr()))throw new Sr.ErrnoError(48);R.set(s,a)}else u=!1,a=s.byteOffset;return{ptr:a,allocated:u}},msync:function(r,t,e,n,o){if(!Sr.isFile(r.node.mode))throw new Sr.ErrnoError(43);return 2&o||Tr.stream_ops.write(r,t,0,n,e,!1),0}}},Sr={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:function(r,t){if(t=t||{},!(r=Pr.resolve(Sr.cwd(),r)))return{path:"",node:null};var e={follow_mount:!0,recurse_count:0};for(var n in e)void 0===t[n]&&(t[n]=e[n]);if(t.recurse_count>8)throw new Sr.ErrnoError(32);for(var o=Cr.normalizeArray(r.split("/").filter((function(r){return!!r})),!1),i=Sr.root,a="/",u=0;u<o.length;u++){var s=u===o.length-1;if(s&&t.parent)break;if(i=Sr.lookupNode(i,o[u]),a=Cr.join2(a,o[u]),Sr.isMountpoint(i)&&(!s||s&&t.follow_mount)&&(i=i.mounted.root),!s||t.follow)for(var c=0;Sr.isLink(i.mode);){var f=Sr.readlink(a);if(a=Pr.resolve(Cr.dirname(a),f),i=Sr.lookupPath(a,{recurse_count:t.recurse_count}).node,c++>40)throw new Sr.ErrnoError(32)}}return{path:a,node:i}},getPath:function(r){for(var t;;){if(Sr.isRoot(r)){var e=r.mount.mountpoint;return t?"/"!==e[e.length-1]?e+"/"+t:e+t:e}t=t?r.name+"/"+t:r.name,r=r.parent}},hashName:function(r,t){for(var e=0,n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n)|0;return(r+e>>>0)%Sr.nameTable.length},hashAddNode:function(r){var t=Sr.hashName(r.parent.id,r.name);r.name_next=Sr.nameTable[t],Sr.nameTable[t]=r},hashRemoveNode:function(r){var t=Sr.hashName(r.parent.id,r.name);if(Sr.nameTable[t]===r)Sr.nameTable[t]=r.name_next;else for(var e=Sr.nameTable[t];e;){if(e.name_next===r){e.name_next=r.name_next;break}e=e.name_next}},lookupNode:function(r,t){var e=Sr.mayLookup(r);if(e)throw new Sr.ErrnoError(e,r);for(var n=Sr.hashName(r.id,t),o=Sr.nameTable[n];o;o=o.name_next){var i=o.name;if(o.parent.id===r.id&&i===t)return o}return Sr.lookup(r,t)},createNode:function(r,t,e,n){var o=new Sr.FSNode(r,t,e,n);return Sr.hashAddNode(o),o},destroyNode:function(r){Sr.hashRemoveNode(r)},isRoot:function(r){return r===r.parent},isMountpoint:function(r){return!!r.mounted},isFile:function(r){return 32768==(61440&r)},isDir:function(r){return 16384==(61440&r)},isLink:function(r){return 40960==(61440&r)},isChrdev:function(r){return 8192==(61440&r)},isBlkdev:function(r){return 24576==(61440&r)},isFIFO:function(r){return 4096==(61440&r)},isSocket:function(r){return!(49152&~r)},flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:function(r){var t=Sr.flagModes[r];if(void 0===t)throw new Error("Unknown file open mode: "+r);return t},flagsToPermissionString:function(r){var t=["r","w","rw"][3&r];return 512&r&&(t+="w"),t},nodePermissions:function(r,t){return Sr.ignorePermissions||(!t.includes("r")||292&r.mode)&&(!t.includes("w")||146&r.mode)&&(!t.includes("x")||73&r.mode)?0:2},mayLookup:function(r){return Sr.nodePermissions(r,"x")||(r.node_ops.lookup?0:2)},mayCreate:function(r,t){try{return Sr.lookupNode(r,t),20}catch(r){}return Sr.nodePermissions(r,"wx")},mayDelete:function(r,t,e){var n;try{n=Sr.lookupNode(r,t)}catch(r){return r.errno}var o=Sr.nodePermissions(r,"wx");if(o)return o;if(e){if(!Sr.isDir(n.mode))return 54;if(Sr.isRoot(n)||Sr.getPath(n)===Sr.cwd())return 10}else if(Sr.isDir(n.mode))return 31;return 0},mayOpen:function(r,t){return r?Sr.isLink(r.mode)?32:Sr.isDir(r.mode)&&("r"!==Sr.flagsToPermissionString(t)||512&t)?31:Sr.nodePermissions(r,Sr.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(r,t){r=r||0,t=t||Sr.MAX_OPEN_FDS;for(var e=r;e<=t;e++)if(!Sr.streams[e])return e;throw new Sr.ErrnoError(33)},getStream:function(r){return Sr.streams[r]},createStream:function(r,t,e){Sr.FSStream||(Sr.FSStream=function(){},Sr.FSStream.prototype={object:{get:function(){return this.node},set:function(r){this.node=r}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return!!(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}}});var n=new Sr.FSStream;for(var o in r)n[o]=r[o];r=n;var i=Sr.nextfd(t,e);return r.fd=i,Sr.streams[i]=r,r},closeStream:function(r){Sr.streams[r]=null},chrdev_stream_ops:{open:function(r){var t=Sr.getDevice(r.node.rdev);r.stream_ops=t.stream_ops,r.stream_ops.open&&r.stream_ops.open(r)},llseek:function(){throw new Sr.ErrnoError(70)}},major:function(r){return r>>8},minor:function(r){return 255&r},makedev:function(r,t){return r<<8|t},registerDevice:function(r,t){Sr.devices[r]={stream_ops:t}},getDevice:function(r){return Sr.devices[r]},getMounts:function(r){for(var t=[],e=[r];e.length;){var n=e.pop();t.push(n),e.push.apply(e,n.mounts)}return t},syncfs:function(r,t){"function"==typeof r&&(t=r,r=!1),Sr.syncFSRequests++,Sr.syncFSRequests>1&&E("warning: "+Sr.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var e=Sr.getMounts(Sr.root.mount),n=0;function o(r){return Sr.syncFSRequests--,t(r)}function i(r){if(r)return i.errored?void 0:(i.errored=!0,o(r));++n>=e.length&&o(null)}e.forEach((function(t){if(!t.type.syncfs)return i(null);t.type.syncfs(t,r,i)}))},mount:function(r,t,e){var n,o="/"===e,i=!e;if(o&&Sr.root)throw new Sr.ErrnoError(10);if(!o&&!i){var a=Sr.lookupPath(e,{follow_mount:!1});if(e=a.path,n=a.node,Sr.isMountpoint(n))throw new Sr.ErrnoError(10);if(!Sr.isDir(n.mode))throw new Sr.ErrnoError(54)}var u={type:r,opts:t,mountpoint:e,mounts:[]},s=r.mount(u);return s.mount=u,u.root=s,o?Sr.root=s:n&&(n.mounted=u,n.mount&&n.mount.mounts.push(u)),s},unmount:function(r){var t=Sr.lookupPath(r,{follow_mount:!1});if(!Sr.isMountpoint(t.node))throw new Sr.ErrnoError(28);var e=t.node,n=e.mounted,o=Sr.getMounts(n);Object.keys(Sr.nameTable).forEach((function(r){for(var t=Sr.nameTable[r];t;){var e=t.name_next;o.includes(t.mount)&&Sr.destroyNode(t),t=e}})),e.mounted=null;var i=e.mount.mounts.indexOf(n);e.mount.mounts.splice(i,1)},lookup:function(r,t){return r.node_ops.lookup(r,t)},mknod:function(r,t,e){var n=Sr.lookupPath(r,{parent:!0}).node,o=Cr.basename(r);if(!o||"."===o||".."===o)throw new Sr.ErrnoError(28);var i=Sr.mayCreate(n,o);if(i)throw new Sr.ErrnoError(i);if(!n.node_ops.mknod)throw new Sr.ErrnoError(63);return n.node_ops.mknod(n,o,t,e)},create:function(r,t){return t=void 0!==t?t:438,t&=4095,t|=32768,Sr.mknod(r,t,0)},mkdir:function(r,t){return t=void 0!==t?t:511,t&=1023,t|=16384,Sr.mknod(r,t,0)},mkdirTree:function(r,t){for(var e=r.split("/"),n="",o=0;o<e.length;++o)if(e[o]){n+="/"+e[o];try{Sr.mkdir(n,t)}catch(r){if(20!=r.errno)throw r}}},mkdev:function(r,t,e){return void 0===e&&(e=t,t=438),t|=8192,Sr.mknod(r,t,e)},symlink:function(r,t){if(!Pr.resolve(r))throw new Sr.ErrnoError(44);var e=Sr.lookupPath(t,{parent:!0}).node;if(!e)throw new Sr.ErrnoError(44);var n=Cr.basename(t),o=Sr.mayCreate(e,n);if(o)throw new Sr.ErrnoError(o);if(!e.node_ops.symlink)throw new Sr.ErrnoError(63);return e.node_ops.symlink(e,n,r)},rename:function(r,t){var e,n,o=Cr.dirname(r),i=Cr.dirname(t),a=Cr.basename(r),u=Cr.basename(t);if(e=Sr.lookupPath(r,{parent:!0}).node,n=Sr.lookupPath(t,{parent:!0}).node,!e||!n)throw new Sr.ErrnoError(44);if(e.mount!==n.mount)throw new Sr.ErrnoError(75);var s,c=Sr.lookupNode(e,a),f=Pr.relative(r,i);if("."!==f.charAt(0))throw new Sr.ErrnoError(28);if("."!==(f=Pr.relative(t,o)).charAt(0))throw new Sr.ErrnoError(55);try{s=Sr.lookupNode(n,u)}catch(r){}if(c!==s){var l=Sr.isDir(c.mode),d=Sr.mayDelete(e,a,l);if(d)throw new Sr.ErrnoError(d);if(d=s?Sr.mayDelete(n,u,l):Sr.mayCreate(n,u))throw new Sr.ErrnoError(d);if(!e.node_ops.rename)throw new Sr.ErrnoError(63);if(Sr.isMountpoint(c)||s&&Sr.isMountpoint(s))throw new Sr.ErrnoError(10);if(n!==e&&(d=Sr.nodePermissions(e,"w")))throw new Sr.ErrnoError(d);Sr.hashRemoveNode(c);try{e.node_ops.rename(c,n,u)}catch(r){throw r}finally{Sr.hashAddNode(c)}}},rmdir:function(r){var t=Sr.lookupPath(r,{parent:!0}).node,e=Cr.basename(r),n=Sr.lookupNode(t,e),o=Sr.mayDelete(t,e,!0);if(o)throw new Sr.ErrnoError(o);if(!t.node_ops.rmdir)throw new Sr.ErrnoError(63);if(Sr.isMountpoint(n))throw new Sr.ErrnoError(10);t.node_ops.rmdir(t,e),Sr.destroyNode(n)},readdir:function(r){var t=Sr.lookupPath(r,{follow:!0}).node;if(!t.node_ops.readdir)throw new Sr.ErrnoError(54);return t.node_ops.readdir(t)},unlink:function(r){var t=Sr.lookupPath(r,{parent:!0}).node,e=Cr.basename(r),n=Sr.lookupNode(t,e),o=Sr.mayDelete(t,e,!1);if(o)throw new Sr.ErrnoError(o);if(!t.node_ops.unlink)throw new Sr.ErrnoError(63);if(Sr.isMountpoint(n))throw new Sr.ErrnoError(10);t.node_ops.unlink(t,e),Sr.destroyNode(n)},readlink:function(r){var t=Sr.lookupPath(r).node;if(!t)throw new Sr.ErrnoError(44);if(!t.node_ops.readlink)throw new Sr.ErrnoError(28);return Pr.resolve(Sr.getPath(t.parent),t.node_ops.readlink(t))},stat:function(r,t){var e=Sr.lookupPath(r,{follow:!t}).node;if(!e)throw new Sr.ErrnoError(44);if(!e.node_ops.getattr)throw new Sr.ErrnoError(63);return e.node_ops.getattr(e)},lstat:function(r){return Sr.stat(r,!0)},chmod:function(r,t,e){var n;if(!(n="string"==typeof r?Sr.lookupPath(r,{follow:!e}).node:r).node_ops.setattr)throw new Sr.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&t|-4096&n.mode,timestamp:Date.now()})},lchmod:function(r,t){Sr.chmod(r,t,!0)},fchmod:function(r,t){var e=Sr.getStream(r);if(!e)throw new Sr.ErrnoError(8);Sr.chmod(e.node,t)},chown:function(r,t,e,n){var o;if(!(o="string"==typeof r?Sr.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new Sr.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:function(r,t,e){Sr.chown(r,t,e,!0)},fchown:function(r,t,e){var n=Sr.getStream(r);if(!n)throw new Sr.ErrnoError(8);Sr.chown(n.node,t,e)},truncate:function(r,t){if(t<0)throw new Sr.ErrnoError(28);var e;if(!(e="string"==typeof r?Sr.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new Sr.ErrnoError(63);if(Sr.isDir(e.mode))throw new Sr.ErrnoError(31);if(!Sr.isFile(e.mode))throw new Sr.ErrnoError(28);var n=Sr.nodePermissions(e,"w");if(n)throw new Sr.ErrnoError(n);e.node_ops.setattr(e,{size:t,timestamp:Date.now()})},ftruncate:function(r,t){var e=Sr.getStream(r);if(!e)throw new Sr.ErrnoError(8);if(!(2097155&e.flags))throw new Sr.ErrnoError(28);Sr.truncate(e.node,t)},utime:function(r,t,e){var n=Sr.lookupPath(r,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(t,e)})},open:function(r,t,e,n,o){if(""===r)throw new Sr.ErrnoError(44);var i;if(e=void 0===e?438:e,e=64&(t="string"==typeof t?Sr.modeStringToFlags(t):t)?4095&e|32768:0,"object"==typeof r)i=r;else{r=Cr.normalize(r);try{i=Sr.lookupPath(r,{follow:!(131072&t)}).node}catch(r){}}var u=!1;if(64&t)if(i){if(128&t)throw new Sr.ErrnoError(20)}else i=Sr.mknod(r,e,0),u=!0;if(!i)throw new Sr.ErrnoError(44);if(Sr.isChrdev(i.mode)&&(t&=-513),65536&t&&!Sr.isDir(i.mode))throw new Sr.ErrnoError(54);if(!u){var s=Sr.mayOpen(i,t);if(s)throw new Sr.ErrnoError(s)}512&t&&Sr.truncate(i,0),t&=-131713;var c=Sr.createStream({node:i,path:Sr.getPath(i),id:i.id,flags:t,mode:i.mode,seekable:!0,position:0,stream_ops:i.stream_ops,node_ops:i.node_ops,ungotten:[],error:!1},n,o);return c.stream_ops.open&&c.stream_ops.open(c),!a.logReadFiles||1&t||(Sr.readFiles||(Sr.readFiles={}),r in Sr.readFiles||(Sr.readFiles[r]=1)),c},close:function(r){if(Sr.isClosed(r))throw new Sr.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(r){throw r}finally{Sr.closeStream(r.fd)}r.fd=null},isClosed:function(r){return null===r.fd},llseek:function(r,t,e){if(Sr.isClosed(r))throw new Sr.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new Sr.ErrnoError(70);if(0!=e&&1!=e&&2!=e)throw new Sr.ErrnoError(28);return r.position=r.stream_ops.llseek(r,t,e),r.ungotten=[],r.position},read:function(r,t,e,n,o){if(n<0||o<0)throw new Sr.ErrnoError(28);if(Sr.isClosed(r))throw new Sr.ErrnoError(8);if(1==(2097155&r.flags))throw new Sr.ErrnoError(8);if(Sr.isDir(r.node.mode))throw new Sr.ErrnoError(31);if(!r.stream_ops.read)throw new Sr.ErrnoError(28);var i=void 0!==o;if(i){if(!r.seekable)throw new Sr.ErrnoError(70)}else o=r.position;var a=r.stream_ops.read(r,t,e,n,o);return i||(r.position+=a),a},write:function(r,t,e,n,o,i){if(n<0||o<0)throw new Sr.ErrnoError(28);if(Sr.isClosed(r))throw new Sr.ErrnoError(8);if(!(2097155&r.flags))throw new Sr.ErrnoError(8);if(Sr.isDir(r.node.mode))throw new Sr.ErrnoError(31);if(!r.stream_ops.write)throw new Sr.ErrnoError(28);r.seekable&&1024&r.flags&&Sr.llseek(r,0,2);var a=void 0!==o;if(a){if(!r.seekable)throw new Sr.ErrnoError(70)}else o=r.position;var u=r.stream_ops.write(r,t,e,n,o,i);return a||(r.position+=u),u},allocate:function(r,t,e){if(Sr.isClosed(r))throw new Sr.ErrnoError(8);if(t<0||e<=0)throw new Sr.ErrnoError(28);if(!(2097155&r.flags))throw new Sr.ErrnoError(8);if(!Sr.isFile(r.node.mode)&&!Sr.isDir(r.node.mode))throw new Sr.ErrnoError(43);if(!r.stream_ops.allocate)throw new Sr.ErrnoError(138);r.stream_ops.allocate(r,t,e)},mmap:function(r,t,e,n,o,i){if(2&o&&!(2&i)&&2!=(2097155&r.flags))throw new Sr.ErrnoError(2);if(1==(2097155&r.flags))throw new Sr.ErrnoError(2);if(!r.stream_ops.mmap)throw new Sr.ErrnoError(43);return r.stream_ops.mmap(r,t,e,n,o,i)},msync:function(r,t,e,n,o){return r&&r.stream_ops.msync?r.stream_ops.msync(r,t,e,n,o):0},munmap:function(r){return 0},ioctl:function(r,t,e){if(!r.stream_ops.ioctl)throw new Sr.ErrnoError(59);return r.stream_ops.ioctl(r,t,e)},readFile:function(r,t){if((t=t||{}).flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var e,n=Sr.open(r,t.flags),o=Sr.stat(r).size,i=new Uint8Array(o);return Sr.read(n,i,0,o,0),"utf8"===t.encoding?e=S(i,0):"binary"===t.encoding&&(e=i),Sr.close(n),e},writeFile:function(r,t,e){(e=e||{}).flags=e.flags||577;var n=Sr.open(r,e.flags,e.mode);if("string"==typeof t){var o=new Uint8Array(M(t)+1),i=A(t,o,0,o.length);Sr.write(n,o,0,i,void 0,e.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");Sr.write(n,t,0,t.byteLength,void 0,e.canOwn)}Sr.close(n)},cwd:function(){return Sr.currentPath},chdir:function(r){var t=Sr.lookupPath(r,{follow:!0});if(null===t.node)throw new Sr.ErrnoError(44);if(!Sr.isDir(t.node.mode))throw new Sr.ErrnoError(54);var e=Sr.nodePermissions(t.node,"x");if(e)throw new Sr.ErrnoError(e);Sr.currentPath=t.path},createDefaultDirectories:function(){Sr.mkdir("/tmp"),Sr.mkdir("/home"),Sr.mkdir("/home/web_user")},createDefaultDevices:function(){Sr.mkdir("/dev"),Sr.registerDevice(Sr.makedev(1,3),{read:function(){return 0},write:function(r,t,e,n,o){return n}}),Sr.mkdev("/dev/null",Sr.makedev(1,3)),Dr.register(Sr.makedev(5,0),Dr.default_tty_ops),Dr.register(Sr.makedev(6,0),Dr.default_tty1_ops),Sr.mkdev("/dev/tty",Sr.makedev(5,0)),Sr.mkdev("/dev/tty1",Sr.makedev(6,0));var r=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var r=new Uint8Array(1);return function(){return crypto.getRandomValues(r),r[0]}}if(g)try{var t=e(78425);return function(){return t.randomBytes(1)[0]}}catch(r){}return function(){fr("randomDevice")}}();Sr.createDevice("/dev","random",r),Sr.createDevice("/dev","urandom",r),Sr.mkdir("/dev/shm"),Sr.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){Sr.mkdir("/proc");var r=Sr.mkdir("/proc/self");Sr.mkdir("/proc/self/fd"),Sr.mount({mount:function(){var t=Sr.createNode(r,"fd",16895,73);return t.node_ops={lookup:function(r,t){var e=+t,n=Sr.getStream(e);if(!n)throw new Sr.ErrnoError(8);var o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return n.path}}};return o.parent=o,o}},t}},{},"/proc/self/fd")},createStandardStreams:function(){a.stdin?Sr.createDevice("/dev","stdin",a.stdin):Sr.symlink("/dev/tty","/dev/stdin"),a.stdout?Sr.createDevice("/dev","stdout",null,a.stdout):Sr.symlink("/dev/tty","/dev/stdout"),a.stderr?Sr.createDevice("/dev","stderr",null,a.stderr):Sr.symlink("/dev/tty1","/dev/stderr"),Sr.open("/dev/stdin",0),Sr.open("/dev/stdout",1),Sr.open("/dev/stderr",1)},ensureErrnoError:function(){Sr.ErrnoError||(Sr.ErrnoError=function(r,t){this.node=t,this.setErrno=function(r){this.errno=r},this.setErrno(r),this.message="FS error"},Sr.ErrnoError.prototype=new Error,Sr.ErrnoError.prototype.constructor=Sr.ErrnoError,[44].forEach((function(r){Sr.genericErrors[r]=new Sr.ErrnoError(r),Sr.genericErrors[r].stack="<generic error, no stack>"})))},staticInit:function(){Sr.ensureErrnoError(),Sr.nameTable=new Array(4096),Sr.mount(Tr,{},"/"),Sr.createDefaultDirectories(),Sr.createDefaultDevices(),Sr.createSpecialDirectories(),Sr.filesystems={MEMFS:Tr}},init:function(r,t,e){Sr.init.initialized=!0,Sr.ensureErrnoError(),a.stdin=r||a.stdin,a.stdout=t||a.stdout,a.stderr=e||a.stderr,Sr.createStandardStreams()},quit:function(){Sr.init.initialized=!1;var r=a._fflush;r&&r(0);for(var t=0;t<Sr.streams.length;t++){var e=Sr.streams[t];e&&Sr.close(e)}},getMode:function(r,t){var e=0;return r&&(e|=365),t&&(e|=146),e},findObject:function(r,t){var e=Sr.analyzePath(r,t);return e.exists?e.object:null},analyzePath:function(r,t){try{r=(n=Sr.lookupPath(r,{follow:!t})).path}catch(r){}var e={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Sr.lookupPath(r,{parent:!0});e.parentExists=!0,e.parentPath=n.path,e.parentObject=n.node,e.name=Cr.basename(r),n=Sr.lookupPath(r,{follow:!t}),e.exists=!0,e.path=n.path,e.object=n.node,e.name=n.node.name,e.isRoot="/"===n.path}catch(r){e.error=r.errno}return e},createPath:function(r,t,e,n){r="string"==typeof r?r:Sr.getPath(r);for(var o=t.split("/").reverse();o.length;){var i=o.pop();if(i){var a=Cr.join2(r,i);try{Sr.mkdir(a)}catch(r){}r=a}}return a},createFile:function(r,t,e,n,o){var i=Cr.join2("string"==typeof r?r:Sr.getPath(r),t),a=Sr.getMode(n,o);return Sr.create(i,a)},createDataFile:function(r,t,e,n,o,i){var a=t?Cr.join2("string"==typeof r?r:Sr.getPath(r),t):r,u=Sr.getMode(n,o),s=Sr.create(a,u);if(e){if("string"==typeof e){for(var c=new Array(e.length),f=0,l=e.length;f<l;++f)c[f]=e.charCodeAt(f);e=c}Sr.chmod(s,146|u);var d=Sr.open(s,577);Sr.write(d,e,0,e.length,0,i),Sr.close(d),Sr.chmod(s,u)}return s},createDevice:function(r,t,e,n){var o=Cr.join2("string"==typeof r?r:Sr.getPath(r),t),i=Sr.getMode(!!e,!!n);Sr.createDevice.major||(Sr.createDevice.major=64);var a=Sr.makedev(Sr.createDevice.major++,0);return Sr.registerDevice(a,{open:function(r){r.seekable=!1},close:function(r){n&&n.buffer&&n.buffer.length&&n(10)},read:function(r,t,n,o,i){for(var a=0,u=0;u<o;u++){var s;try{s=e()}catch(r){throw new Sr.ErrnoError(29)}if(void 0===s&&0===a)throw new Sr.ErrnoError(6);if(null==s)break;a++,t[n+u]=s}return a&&(r.node.timestamp=Date.now()),a},write:function(r,t,e,o,i){for(var a=0;a<o;a++)try{n(t[e+a])}catch(r){throw new Sr.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),a}}),Sr.mkdev(o,i,a)},forceLoadFile:function(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.");if(!c)throw new Error("Cannot load without read() or XMLHttpRequest.");try{r.contents=Vt(c(r.url),!0),r.usedBytes=r.contents.length}catch(r){throw new Sr.ErrnoError(29)}},createLazyFile:function(r,t,e,n,o){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(r){if(!(r>this.length-1||r<0)){var t=r%this.chunkSize,e=r/this.chunkSize|0;return this.getter(e)[t]}},i.prototype.setDataGetter=function(r){this.getter=r},i.prototype.cacheLength=function(){var r=new XMLHttpRequest;if(r.open("HEAD",e,!1),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw new Error("Couldn't load "+e+". Status: "+r.status);var t,n=Number(r.getResponseHeader("Content-length")),o=(t=r.getResponseHeader("Accept-Ranges"))&&"bytes"===t,i=(t=r.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;o||(a=n);var u=this;u.setDataGetter((function(r){var t=r*a,o=(r+1)*a-1;if(o=Math.min(o,n-1),void 0===u.chunks[r]&&(u.chunks[r]=function(r,t){if(r>t)throw new Error("invalid range ("+r+", "+t+") or no bytes requested!");if(t>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",e,!1),n!==a&&o.setRequestHeader("Range","bytes="+r+"-"+t),"undefined"!=typeof Uint8Array&&(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 "+e+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):Vt(o.responseText||"",!0)}(t,o)),void 0===u.chunks[r])throw new Error("doXHR failed!");return u.chunks[r]})),!i&&n||(a=n=1,n=this.getter(0).length,a=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!y)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new i;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:a}}else u={isDevice:!1,url:e};var s=Sr.createFile(r,t,u,n,o);u.contents?s.contents=u.contents:u.url&&(s.contents=null,s.url=u.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var c={};return Object.keys(s.stream_ops).forEach((function(r){var t=s.stream_ops[r];c[r]=function(){return Sr.forceLoadFile(s),t.apply(null,arguments)}})),c.read=function(r,t,e,n,o){Sr.forceLoadFile(s);var i=r.node.contents;if(o>=i.length)return 0;var a=Math.min(i.length-o,n);if(i.slice)for(var u=0;u<a;u++)t[e+u]=i[o+u];else for(u=0;u<a;u++)t[e+u]=i.get(o+u);return a},s.stream_ops=c,s},createPreloadedFile:function(r,t,e,n,o,i,u,s,c,l){Browser.init();var d=t?Pr.resolve(Cr.join2(r,t)):r;function p(e){function f(e){l&&l(),s||Sr.createDataFile(r,t,e,n,o,c),i&&i(),cr()}var p=!1;a.preloadPlugins.forEach((function(r){p||r.canHandle(d)&&(r.handle(e,d,f,(function(){u&&u(),cr()})),p=!0)})),p||f(e)}sr(),"string"==typeof e?function(r,t,e){var n="al "+r;f(r,(function(t){D(t,'Loading data file "'+r+'" failed (no arrayBuffer).'),p(new Uint8Array(t)),n&&cr()}),(function(t){if(!e)throw'Loading data file "'+r+'" failed.';e()})),n&&sr()}(e,0,u):p(e)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(r,t,e){t=t||function(){},e=e||function(){};var n=Sr.indexedDB();try{var o=n.open(Sr.DB_NAME(),Sr.DB_VERSION)}catch(r){return e(r)}o.onupgradeneeded=function(){_("creating db"),o.result.createObjectStore(Sr.DB_STORE_NAME)},o.onsuccess=function(){var n=o.result.transaction([Sr.DB_STORE_NAME],"readwrite"),i=n.objectStore(Sr.DB_STORE_NAME),a=0,u=0,s=r.length;function c(){0==u?t():e()}r.forEach((function(r){var t=i.put(Sr.analyzePath(r).object.contents,r);t.onsuccess=function(){++a+u==s&&c()},t.onerror=function(){u++,a+u==s&&c()}})),n.onerror=e},o.onerror=e},loadFilesFromDB:function(r,t,e){t=t||function(){},e=e||function(){};var n=Sr.indexedDB();try{var o=n.open(Sr.DB_NAME(),Sr.DB_VERSION)}catch(r){return e(r)}o.onupgradeneeded=e,o.onsuccess=function(){var n=o.result;try{var i=n.transaction([Sr.DB_STORE_NAME],"readonly")}catch(r){return void e(r)}var a=i.objectStore(Sr.DB_STORE_NAME),u=0,s=0,c=r.length;function f(){0==s?t():e()}r.forEach((function(r){var t=a.get(r);t.onsuccess=function(){Sr.analyzePath(r).exists&&Sr.unlink(r),Sr.createDataFile(Cr.dirname(r),Cr.basename(r),t.result,!0,!0,!0),++u+s==c&&f()},t.onerror=function(){s++,u+s==c&&f()}})),i.onerror=e},o.onerror=e}},Fr={mappings:{},DEFAULT_POLLMASK:5,calculateAt:function(r,t,e){if("/"===t[0])return t;var n;if(-100===r)n=Sr.cwd();else{var o=Sr.getStream(r);if(!o)throw new Sr.ErrnoError(8);n=o.path}if(0==t.length){if(!e)throw new Sr.ErrnoError(44);return n}return Cr.join2(n,t)},doStat:function(r,t,e){try{var n=r(t)}catch(r){if(r&&r.node&&Cr.normalize(t)!==Cr.normalize(Sr.getPath(r.node)))return-54;throw r}return N[e>>2]=n.dev,N[e+4>>2]=0,N[e+8>>2]=n.ino,N[e+12>>2]=n.mode,N[e+16>>2]=n.nlink,N[e+20>>2]=n.uid,N[e+24>>2]=n.gid,N[e+28>>2]=n.rdev,N[e+32>>2]=0,tr=[n.size>>>0,(rr=n.size,+Math.abs(rr)>=1?rr>0?(0|Math.min(+Math.floor(rr/4294967296),4294967295))>>>0:~~+Math.ceil((rr-+(~~rr>>>0))/4294967296)>>>0:0)],N[e+40>>2]=tr[0],N[e+44>>2]=tr[1],N[e+48>>2]=4096,N[e+52>>2]=n.blocks,N[e+56>>2]=n.atime.getTime()/1e3|0,N[e+60>>2]=0,N[e+64>>2]=n.mtime.getTime()/1e3|0,N[e+68>>2]=0,N[e+72>>2]=n.ctime.getTime()/1e3|0,N[e+76>>2]=0,tr=[n.ino>>>0,(rr=n.ino,+Math.abs(rr)>=1?rr>0?(0|Math.min(+Math.floor(rr/4294967296),4294967295))>>>0:~~+Math.ceil((rr-+(~~rr>>>0))/4294967296)>>>0:0)],N[e+80>>2]=tr[0],N[e+84>>2]=tr[1],0},doMsync:function(r,t,e,n,o){var i=O.slice(r,r+e);Sr.msync(t,i,o,e,n)},doMkdir:function(r,t){return"/"===(r=Cr.normalize(r))[r.length-1]&&(r=r.substr(0,r.length-1)),Sr.mkdir(r,t,0),0},doMknod:function(r,t,e){switch(61440&t){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return Sr.mknod(r,t,e),0},doReadlink:function(r,t,e){if(e<=0)return-28;var n=Sr.readlink(r),o=Math.min(e,M(n)),i=R[t+o];return $(n,t,e+1),R[t+o]=i,o},doAccess:function(r,t){if(-8&t)return-28;var e=Sr.lookupPath(r,{follow:!0}).node;if(!e)return-44;var n="";return 4&t&&(n+="r"),2&t&&(n+="w"),1&t&&(n+="x"),n&&Sr.nodePermissions(e,n)?-2:0},doDup:function(r,t,e){var n=Sr.getStream(e);return n&&Sr.close(n),Sr.open(r,t,0,e,e).fd},doReadv:function(r,t,e,n){for(var o=0,i=0;i<e;i++){var a=N[t+8*i>>2],u=N[t+(8*i+4)>>2],s=Sr.read(r,R,a,u,n);if(s<0)return-1;if(o+=s,s<u)break}return o},doWritev:function(r,t,e,n){for(var o=0,i=0;i<e;i++){var a=N[t+8*i>>2],u=N[t+(8*i+4)>>2],s=Sr.write(r,R,a,u,n);if(s<0)return-1;o+=s}return o},varargs:void 0,get:function(){return Fr.varargs+=4,N[Fr.varargs-4>>2]},getStr:function(r){return F(r)},getStreamFromFD:function(r){var t=Sr.getStream(r);if(!t)throw new Sr.ErrnoError(8);return t},get64:function(r,t){return r}};function Ar(r){return N[Jt()>>2]=r,r}function $r(r){switch(r){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+r)}}var Mr=void 0;function xr(r){for(var t="",e=r;O[e];)t+=Mr[O[e++]];return t}var Rr={},Or={},zr={};function Br(r){if(void 0===r)return"_unknown";var t=(r=r.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+r:r}function Nr(r,t){return r=Br(r),new Function("body","return function "+r+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function Wr(r,t){var e=Nr(t,(function(r){this.name=t,this.message=r;var e=new Error(r).stack;void 0!==e&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}));return e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},e}var Ir=void 0;function Hr(r){throw new Ir(r)}var Ur=void 0;function Lr(r){throw new Ur(r)}function Vr(r,t,e){function n(t){var n=e(t);n.length!==r.length&&Lr("Mismatched type converter count");for(var o=0;o<r.length;++o)Yr(r[o],n[o])}r.forEach((function(r){zr[r]=t}));var o=new Array(t.length),i=[],a=0;t.forEach((function(r,t){Or.hasOwnProperty(r)?o[t]=Or[r]:(i.push(r),Rr.hasOwnProperty(r)||(Rr[r]=[]),Rr[r].push((function(){o[t]=Or[r],++a===i.length&&n(o)})))})),0===i.length&&n(o)}function Yr(r,t,e){if(e=e||{},!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(r||Hr('type "'+n+'" must have a positive integer typeid pointer'),Or.hasOwnProperty(r)){if(e.ignoreDuplicateRegistrations)return;Hr("Cannot register type '"+n+"' twice")}if(Or[r]=t,delete zr[r],Rr.hasOwnProperty(r)){var o=Rr[r];delete Rr[r],o.forEach((function(r){r()}))}}function qr(r){Hr(r.$$.ptrType.registeredClass.name+" instance already deleted")}var Gr=!1;function Xr(r){}function Kr(r){r.count.value-=1,0===r.count.value&&function(r){r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)}(r)}function Jr(r){return"undefined"==typeof FinalizationGroup?(Jr=function(r){return r},r):(Gr=new FinalizationGroup((function(r){for(var t=r.next();!t.done;t=r.next()){var e=t.value;e.ptr?Kr(e):console.warn("object already deleted: "+e.ptr)}})),Jr=function(r){return Gr.register(r,r.$$,r.$$),r},Xr=function(r){Gr.unregister(r.$$)},Jr(r))}var Zr=void 0,Qr=[];function rt(){for(;Qr.length;){var r=Qr.pop();r.$$.deleteScheduled=!1,r.delete()}}function tt(){}var et={};function nt(r,t,e){if(void 0===r[t].overloadTable){var n=r[t];r[t]=function(){return r[t].overloadTable.hasOwnProperty(arguments.length)||Hr("Function '"+e+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+r[t].overloadTable+")!"),r[t].overloadTable[arguments.length].apply(this,arguments)},r[t].overloadTable=[],r[t].overloadTable[n.argCount]=n}}function ot(r,t,e){a.hasOwnProperty(r)?((void 0===e||void 0!==a[r].overloadTable&&void 0!==a[r].overloadTable[e])&&Hr("Cannot register public name '"+r+"' twice"),nt(a,r,r),a.hasOwnProperty(e)&&Hr("Cannot register multiple overloads of a function with the same number of arguments ("+e+")!"),a[r].overloadTable[e]=t):(a[r]=t,void 0!==e&&(a[r].numArguments=e))}function it(r,t,e,n,o,i,a,u){this.name=r,this.constructor=t,this.instancePrototype=e,this.rawDestructor=n,this.baseClass=o,this.getActualType=i,this.upcast=a,this.downcast=u,this.pureVirtualFunctions=[]}function at(r,t,e){for(;t!==e;)t.upcast||Hr("Expected null or instance of "+e.name+", got an instance of "+t.name),r=t.upcast(r),t=t.baseClass;return r}function ut(r,t){if(null===t)return this.isReference&&Hr("null is not a valid "+this.name),0;t.$$||Hr('Cannot pass "'+Dt(t)+'" as a '+this.name),t.$$.ptr||Hr("Cannot pass deleted object as a pointer of type "+this.name);var e=t.$$.ptrType.registeredClass;return at(t.$$.ptr,e,this.registeredClass)}function st(r,t){var e;if(null===t)return this.isReference&&Hr("null is not a valid "+this.name),this.isSmartPointer?(e=this.rawConstructor(),null!==r&&r.push(this.rawDestructor,e),e):0;t.$$||Hr('Cannot pass "'+Dt(t)+'" as a '+this.name),t.$$.ptr||Hr("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Hr("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(e=at(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Hr("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?e=t.$$.smartPtr:Hr("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:e=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)e=t.$$.smartPtr;else{var o=t.clone();e=this.rawShare(e,Pt.toHandle((function(){o.delete()}))),null!==r&&r.push(this.rawDestructor,e)}break;default:Hr("Unsupporting sharing policy")}return e}function ct(r,t){if(null===t)return this.isReference&&Hr("null is not a valid "+this.name),0;t.$$||Hr('Cannot pass "'+Dt(t)+'" as a '+this.name),t.$$.ptr||Hr("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Hr("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var e=t.$$.ptrType.registeredClass;return at(t.$$.ptr,e,this.registeredClass)}function ft(r){return this.fromWireType(W[r>>2])}function lt(r,t,e){if(t===e)return r;if(void 0===e.baseClass)return null;var n=lt(r,t,e.baseClass);return null===n?null:e.downcast(n)}var dt={};function pt(r,t){return t.ptrType&&t.ptr||Lr("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Lr("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Jr(Object.create(r,{$$:{value:t}}))}function ht(r,t,e,n,o,i,a,u,s,c,f){this.name=r,this.registeredClass=t,this.isReference=e,this.isConst=n,this.isSmartPointer=o,this.pointeeType=i,this.sharingPolicy=a,this.rawGetPointee=u,this.rawConstructor=s,this.rawShare=c,this.rawDestructor=f,o||void 0!==t.baseClass?this.toWireType=st:n?(this.toWireType=ut,this.destructorFunction=null):(this.toWireType=ct,this.destructorFunction=null)}function mt(r,t,e){a.hasOwnProperty(r)||Lr("Replacing nonexistant public symbol"),void 0!==a[r].overloadTable&&void 0!==e?a[r].overloadTable[e]=t:(a[r]=t,a[r].argCount=e)}function vt(r,t){var e,n,o,i=(r=xr(r)).includes("j")?(e=r,n=t,o=[],function(){o.length=arguments.length;for(var r=0;r<arguments.length;r++)o[r]=arguments[r];return function(r,t,e){return r.includes("j")?function(r,t,e){var n=a["dynCall_"+r];return e&&e.length?n.apply(null,[t].concat(e)):n.call(null,t)}(r,t,e):vr(t).apply(null,e)}(e,n,o)}):vr(t);return"function"!=typeof i&&Hr("unknown function pointer with signature "+r+": "+t),i}var yt=void 0;function gt(r){var t=Kt(r),e=xr(t);return Xt(t),e}function wt(r,t){var e=[],n={};throw t.forEach((function r(t){n[t]||Or[t]||(zr[t]?zr[t].forEach(r):(e.push(t),n[t]=!0))})),new yt(r+": "+e.map(gt).join([", "]))}function _t(r,t){for(var e=[],n=0;n<r;n++)e.push(N[(t>>2)+n]);return e}function Et(r){for(;r.length;){var t=r.pop();r.pop()(t)}}function bt(r,t,e,n,o){var i=t.length;i<2&&Hr("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==e,u=!1,s=1;s<t.length;++s)if(null!==t[s]&&void 0===t[s].destructorFunction){u=!0;break}var c="void"!==t[0].name,f="",l="";for(s=0;s<i-2;++s)f+=(0!==s?", ":"")+"arg"+s,l+=(0!==s?", ":"")+"arg"+s+"Wired";var d="return function "+Br(r)+"("+f+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+r+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";u&&(d+="var destructors = [];\n");var p=u?"destructors":"null",h=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[Hr,n,o,Et,t[0],t[1]];for(a&&(d+="var thisWired = classParam.