@doegis/core
Version:
DOE GIS API
2 lines (1 loc) • 80.3 kB
JavaScript
function e(e,r){for(var t=0;t<r.length;t++){const n=r[t];if("string"!=typeof n&&!Array.isArray(n))for(const r in n)if("default"!==r&&!(r in e)){const t=Object.getOwnPropertyDescriptor(n,r);t&&Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>n[r]})}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var r,t,n,o={};r={get exports(){return o},set exports(e){o=e}},t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,n=function(e){var r,n,o=void 0!==(e=e||{})?e:{};o.ready=new Promise((function(e,t){r=e,n=t}));var a,i,s,u=Object.assign({},o),c="./this.program",f=!0,l="";function d(e){return o.locateFile?o.locateFile(e,l):l+e}"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),t&&(l=t),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"",a=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},i=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t()},n.onerror=t,n.send(null)};var m,p,h=o.print||console.log.bind(console),v=o.printErr||console.warn.bind(console);Object.assign(o,u),u=null,o.arguments&&o.arguments,o.thisProgram&&(c=o.thisProgram),o.quit&&o.quit,o.wasmBinary&&(m=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&Q("no native wasm support detected");var _=!1;function g(e,r){e||Q(r)}var y,w,E,b,k,x,S,D,F,A,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function C(e,r,t){for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&P)return P.decode(e.subarray(r,o));for(var a="";r<o;){var i=e[r++];if(128&i){var s=63&e[r++];if(192!=(224&i)){var u=63&e[r++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&e[r++])<65536)a+=String.fromCharCode(i);else{var c=i-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a}function T(e,r){return e?C(E,e,r):""}function j(e,r,t,n){if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o}function B(e,r,t){return j(e,E,r,t)}function M(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++t)),n<=127?++r:r+=n<=2047?2:n<=65535?3:4}return r}function L(e){y=e,o.HEAP8=w=new Int8Array(e),o.HEAP16=b=new Int16Array(e),o.HEAP32=x=new Int32Array(e),o.HEAPU8=E=new Uint8Array(e),o.HEAPU16=k=new Uint16Array(e),o.HEAPU32=S=new Uint32Array(e),o.HEAPF32=D=new Float32Array(e),o.HEAPF64=F=new Float64Array(e)}o.INITIAL_MEMORY;var R=[],I=[],N=[];function O(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)Z(o.preRun.shift());ae(R)}function z(){o.noFSInit||we.init.initialized||we.init(),we.ignorePermissions=!1,ae(I)}function W(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)U(o.postRun.shift());ae(N)}function Z(e){R.unshift(e)}function H(e){I.unshift(e)}function U(e){N.unshift(e)}var q=0,V=null;function G(e){return e}function Y(e){q++,o.monitorRunDependencies&&o.monitorRunDependencies(q)}function X(e){if(q--,o.monitorRunDependencies&&o.monitorRunDependencies(q),0==q&&V){var r=V;V=null,r()}}function Q(e){o.onAbort&&o.onAbort(e),v(e="Aborted("+e+")"),_=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw n(r),r}var K,J,$,ee="data:application/octet-stream;base64,";function re(e){return e.startsWith(ee)}function te(e){try{if(e==K&&m)return new Uint8Array(m);if(!s)throw"both async and sync fetching of the wasm failed"}catch(v){Q(v)}}function ne(){return!m&&f&&"function"==typeof fetch?fetch(K,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+K+"'";return e.arrayBuffer()})).catch((function(){return te(K)})):Promise.resolve().then((function(){return te(K)}))}function oe(){var e={a:po};function r(e,r){var t=e.exports;o.asm=t,L((p=o.asm.Za).buffer),A=o.asm.$a,H(o.asm._a),X()}function t(e){r(e.instance)}function a(r){return ne().then((function(r){return WebAssembly.instantiate(r,e)})).then((function(e){return e})).then(r,(function(e){v("failed to asynchronously prepare wasm: "+e),Q(e)}))}function i(){return m||"function"!=typeof WebAssembly.instantiateStreaming||re(K)||"function"!=typeof fetch?a(t):fetch(K,{credentials:"same-origin"}).then((function(r){return WebAssembly.instantiateStreaming(r,e).then(t,(function(e){return v("wasm streaming compile failed: "+e),v("falling back to ArrayBuffer instantiation"),a(t)}))}))}if(Y(),o.instantiateWasm)try{return o.instantiateWasm(e,r)}catch(s){return v("Module.instantiateWasm callback failed with error: "+s),!1}return i().catch(n),{}}function ae(e){for(;e.length>0;)e.shift()(o)}function ie(e,r){w.set(e,r)}function se(e,r,t,n){Q("Assertion failed: "+T(e)+", at: "+[r?T(r):"unknown filename",t,n?T(n):"unknown function"])}function ue(e){return vo(e+24)+24}function ce(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){S[this.ptr+4>>2]=e},this.get_type=function(){return S[this.ptr+4>>2]},this.set_destructor=function(e){S[this.ptr+8>>2]=e},this.get_destructor=function(){return S[this.ptr+8>>2]},this.set_refcount=function(e){x[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,w[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,w[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(e,r){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(r),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=x[this.ptr>>2];x[this.ptr>>2]=e+1},this.release_ref=function(){var e=x[this.ptr>>2];return x[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){S[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return S[this.ptr+16>>2]},this.get_exception_ptr=function(){if(wo(this.get_type()))return S[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}function fe(e,r,t){throw new ce(e).init(r,t),e}function le(e){return x[yo()>>2]=e,e}re(K="vxlLayer.wasm")||(K=d(K));var de={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=de.isAbs(e),t="/"===e.substr(-1);return(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=de.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:e=>{if("/"===e)return"/";var r=(e=(e=de.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return de.normalize(e.join("/"))},join2:(e,r)=>de.normalize(e+"/"+r)};function me(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}return function(){Q("randomDevice")}}var pe={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:we.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=de.isAbs(n)}return(r?"/":"")+(e=de.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r<e.length&&""===e[r];r++);for(var t=e.length-1;t>=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=pe.resolve(e).substr(1),r=pe.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.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("/")}};function he(e,r,t){var n=t>0?t:M(e)+1,o=new Array(n),a=j(e,o,0,o.length);return r&&(o.length=a),o}var ve={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){ve.ttys[e]={input:[],output:[],ops:r},we.registerDevice(e,ve.stream_ops)},stream_ops:{open:function(e){var r=ve.ttys[e.node.rdev];if(!r)throw new we.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new we.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(u){throw new we.ErrnoError(29)}if(void 0===s&&0===a)throw new we.ErrnoError(6);if(null==s)break;a++,r[t+i]=s}return a&&(e.node.timestamp=Date.now()),a},write:function(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new we.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch(i){throw new we.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:function(e){if(!e.input.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(r=window.prompt("Input: "))&&(r+="\n"):"function"==typeof readline&&null!==(r=readline())&&(r+="\n"),!r)return null;e.input=he(r,!0)}return e.input.shift()},put_char:function(e,r){null===r||10===r?(h(C(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(h(C(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,r){null===r||10===r?(v(C(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(v(C(e.output,0)),e.output=[])}}};function _e(e){Q()}var ge={ops_table:null,mount:function(e){return ge.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){if(we.isBlkdev(t)||we.isFIFO(t))throw new we.ErrnoError(63);ge.ops_table||(ge.ops_table={dir:{node:{getattr:ge.node_ops.getattr,setattr:ge.node_ops.setattr,lookup:ge.node_ops.lookup,mknod:ge.node_ops.mknod,rename:ge.node_ops.rename,unlink:ge.node_ops.unlink,rmdir:ge.node_ops.rmdir,readdir:ge.node_ops.readdir,symlink:ge.node_ops.symlink},stream:{llseek:ge.stream_ops.llseek}},file:{node:{getattr:ge.node_ops.getattr,setattr:ge.node_ops.setattr},stream:{llseek:ge.stream_ops.llseek,read:ge.stream_ops.read,write:ge.stream_ops.write,allocate:ge.stream_ops.allocate,mmap:ge.stream_ops.mmap,msync:ge.stream_ops.msync}},link:{node:{getattr:ge.node_ops.getattr,setattr:ge.node_ops.setattr,readlink:ge.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ge.node_ops.getattr,setattr:ge.node_ops.setattr},stream:we.chrdev_stream_ops}});var o=we.createNode(e,r,t,n);return we.isDir(o.mode)?(o.node_ops=ge.ops_table.dir.node,o.stream_ops=ge.ops_table.dir.stream,o.contents={}):we.isFile(o.mode)?(o.node_ops=ge.ops_table.file.node,o.stream_ops=ge.ops_table.file.stream,o.usedBytes=0,o.contents=null):we.isLink(o.mode)?(o.node_ops=ge.ops_table.link.node,o.stream_ops=ge.ops_table.link.stream):we.isChrdev(o.mode)&&(o.node_ops=ge.ops_table.chrdev.node,o.stream_ops=ge.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1048576;r=Math.max(r,t*(t<n?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var o=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(o.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,r){if(e.usedBytes!=r)if(0==r)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr:function(e){var r={};return r.dev=we.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,we.isDir(e.mode)?r.size=4096:we.isFile(e.mode)?r.size=e.usedBytes:we.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr:function(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&ge.resizeFileStorage(e,r.size)},lookup:function(e,r){throw we.genericErrors[44]},mknod:function(e,r,t,n){return ge.createNode(e,r,t,n)},rename:function(e,r,t){if(we.isDir(e.mode)){var n;try{n=we.lookupNode(r,t)}catch(a){}if(n)for(var o in n.contents)throw new we.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink:function(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir:function(e,r){var t=we.lookupNode(e,r);for(var n in t.contents)throw new we.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir:function(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink:function(e,r,t){var n=ge.createNode(e,r,41471,0);return n.link=t,n},readlink:function(e){if(!we.isLink(e.mode))throw new we.ErrnoError(28);return e.link}},stream_ops:{read:function(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)r.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)r[t+s]=a[o+s];return i},write:function(e,r,t,n,o,a){if(r.buffer===w.buffer&&(a=!1),!n)return 0;var i=e.node;if(i.timestamp=Date.now(),r.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=r.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=r.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(r.subarray(t,t+n),o),n}if(ge.expandFileStorage(i,o+n),i.contents.subarray&&r.subarray)i.contents.set(r.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=r[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek:function(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&we.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new we.ErrnoError(28);return n},allocate:function(e,r,t){ge.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap:function(e,r,t,n,o){if(!we.isFile(e.node.mode))throw new we.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==y){if((t>0||t+r<s.length)&&(s=s.subarray?s.subarray(t,t+r):Array.prototype.slice.call(s,t,t+r)),i=!0,!(a=_e()))throw new we.ErrnoError(48);w.set(s,a)}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:function(e,r,t,n,o){if(!we.isFile(e.node.mode))throw new we.ErrnoError(43);return 2&o||ge.stream_ops.write(e,r,0,n,t,!1),0}}};function ye(e,r,t,n){var o=n?"":G("al "+e);i(e,(function(t){g(t,'Loading data file "'+e+'" failed (no arrayBuffer).'),r(new Uint8Array(t)),o&&X()}),(function(r){if(!t)throw'Loading data file "'+e+'" failed.';t()})),o&&Y()}var we={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,r={})=>{if(!(e=pe.resolve(we.cwd(),e)))return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if((r=Object.assign(t,r)).recurse_count>8)throw new we.ErrnoError(32);for(var n=de.normalizeArray(e.split("/").filter((e=>!!e)),!1),o=we.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&r.parent)break;if(o=we.lookupNode(o,n[i]),a=de.join2(a,n[i]),we.isMountpoint(o)&&(!s||s&&r.follow_mount)&&(o=o.mounted.root),!s||r.follow)for(var u=0;we.isLink(o.mode);){var c=we.readlink(a);if(a=pe.resolve(de.dirname(a),c),o=we.lookupPath(a,{recurse_count:r.recurse_count+1}).node,u++>40)throw new we.ErrnoError(32)}}return{path:a,node:o}},getPath:e=>{for(var r;;){if(we.isRoot(e)){var t=e.mount.mountpoint;return r?"/"!==t[t.length-1]?t+"/"+r:t+r:t}r=r?e.name+"/"+r:e.name,e=e.parent}},hashName:(e,r)=>{for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%we.nameTable.length},hashAddNode:e=>{var r=we.hashName(e.parent.id,e.name);e.name_next=we.nameTable[r],we.nameTable[r]=e},hashRemoveNode:e=>{var r=we.hashName(e.parent.id,e.name);if(we.nameTable[r]===e)we.nameTable[r]=e.name_next;else for(var t=we.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:(e,r)=>{var t=we.mayLookup(e);if(t)throw new we.ErrnoError(t,e);for(var n=we.hashName(e.id,r),o=we.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return we.lookup(e,r)},createNode:(e,r,t,n)=>{var o=new we.FSNode(e,r,t,n);return we.hashAddNode(o),o},destroyNode:e=>{we.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var r=we.flagModes[e];if(void 0===r)throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:e=>{var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>we.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var r=we.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:(e,r)=>{try{return we.lookupNode(e,r),20}catch(t){}return we.nodePermissions(e,"wx")},mayDelete:(e,r,t)=>{var n;try{n=we.lookupNode(e,r)}catch(a){return a.errno}var o=we.nodePermissions(e,"wx");if(o)return o;if(t){if(!we.isDir(n.mode))return 54;if(we.isRoot(n)||we.getPath(n)===we.cwd())return 10}else if(we.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?we.isLink(e.mode)?32:we.isDir(e.mode)&&("r"!==we.flagsToPermissionString(r)||512&r)?31:we.nodePermissions(e,we.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd:(e=0,r=we.MAX_OPEN_FDS)=>{for(var t=e;t<=r;t++)if(!we.streams[t])return t;throw new we.ErrnoError(33)},getStream:e=>we.streams[e],createStream:(e,r,t)=>{we.FSStream||(we.FSStream=function(){this.shared={}},we.FSStream.prototype={},Object.defineProperties(we.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new we.FSStream,e);var n=we.nextfd(r,t);return e.fd=n,we.streams[n]=e,e},closeStream:e=>{we.streams[e]=null},chrdev_stream_ops:{open:e=>{var r=we.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new we.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice:(e,r)=>{we.devices[e]={stream_ops:r}},getDevice:e=>we.devices[e],getMounts:e=>{for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:(e,r)=>{"function"==typeof e&&(r=e,e=!1),we.syncFSRequests++,we.syncFSRequests>1&&v("warning: "+we.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=we.getMounts(we.root.mount),n=0;function o(e){return we.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount:(e,r,t)=>{var n,o="/"===t,a=!t;if(o&&we.root)throw new we.ErrnoError(10);if(!o&&!a){var i=we.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,we.isMountpoint(n))throw new we.ErrnoError(10);if(!we.isDir(n.mode))throw new we.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?we.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount:e=>{var r=we.lookupPath(e,{follow_mount:!1});if(!we.isMountpoint(r.node))throw new we.ErrnoError(28);var t=r.node,n=t.mounted,o=we.getMounts(n);Object.keys(we.nameTable).forEach((e=>{for(var r=we.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&we.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=we.lookupPath(e,{parent:!0}).node,o=de.basename(e);if(!o||"."===o||".."===o)throw new we.ErrnoError(28);var a=we.mayCreate(n,o);if(a)throw new we.ErrnoError(a);if(!n.node_ops.mknod)throw new we.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,we.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,we.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{we.mkdir(n,r)}catch(a){if(20!=a.errno)throw a}}},mkdev:(e,r,t)=>(void 0===t&&(t=r,r=438),r|=8192,we.mknod(e,r,t)),symlink:(e,r)=>{if(!pe.resolve(e))throw new we.ErrnoError(44);var t=we.lookupPath(r,{parent:!0}).node;if(!t)throw new we.ErrnoError(44);var n=de.basename(r),o=we.mayCreate(t,n);if(o)throw new we.ErrnoError(o);if(!t.node_ops.symlink)throw new we.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename:(e,r)=>{var t,n,o=de.dirname(e),a=de.dirname(r),i=de.basename(e),s=de.basename(r);if(t=we.lookupPath(e,{parent:!0}).node,n=we.lookupPath(r,{parent:!0}).node,!t||!n)throw new we.ErrnoError(44);if(t.mount!==n.mount)throw new we.ErrnoError(75);var u,c=we.lookupNode(t,i),f=pe.relative(e,a);if("."!==f.charAt(0))throw new we.ErrnoError(28);if("."!==(f=pe.relative(r,o)).charAt(0))throw new we.ErrnoError(55);try{u=we.lookupNode(n,s)}catch(m){}if(c!==u){var l=we.isDir(c.mode),d=we.mayDelete(t,i,l);if(d)throw new we.ErrnoError(d);if(d=u?we.mayDelete(n,s,l):we.mayCreate(n,s))throw new we.ErrnoError(d);if(!t.node_ops.rename)throw new we.ErrnoError(63);if(we.isMountpoint(c)||u&&we.isMountpoint(u))throw new we.ErrnoError(10);if(n!==t&&(d=we.nodePermissions(t,"w")))throw new we.ErrnoError(d);we.hashRemoveNode(c);try{t.node_ops.rename(c,n,s)}catch(m){throw m}finally{we.hashAddNode(c)}}},rmdir:e=>{var r=we.lookupPath(e,{parent:!0}).node,t=de.basename(e),n=we.lookupNode(r,t),o=we.mayDelete(r,t,!0);if(o)throw new we.ErrnoError(o);if(!r.node_ops.rmdir)throw new we.ErrnoError(63);if(we.isMountpoint(n))throw new we.ErrnoError(10);r.node_ops.rmdir(r,t),we.destroyNode(n)},readdir:e=>{var r=we.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new we.ErrnoError(54);return r.node_ops.readdir(r)},unlink:e=>{var r=we.lookupPath(e,{parent:!0}).node;if(!r)throw new we.ErrnoError(44);var t=de.basename(e),n=we.lookupNode(r,t),o=we.mayDelete(r,t,!1);if(o)throw new we.ErrnoError(o);if(!r.node_ops.unlink)throw new we.ErrnoError(63);if(we.isMountpoint(n))throw new we.ErrnoError(10);r.node_ops.unlink(r,t),we.destroyNode(n)},readlink:e=>{var r=we.lookupPath(e).node;if(!r)throw new we.ErrnoError(44);if(!r.node_ops.readlink)throw new we.ErrnoError(28);return pe.resolve(we.getPath(r.parent),r.node_ops.readlink(r))},stat:(e,r)=>{var t=we.lookupPath(e,{follow:!r}).node;if(!t)throw new we.ErrnoError(44);if(!t.node_ops.getattr)throw new we.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>we.stat(e,!0),chmod:(e,r,t)=>{var n;if(!(n="string"==typeof e?we.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new we.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod:(e,r)=>{we.chmod(e,r,!0)},fchmod:(e,r)=>{var t=we.getStream(e);if(!t)throw new we.ErrnoError(8);we.chmod(t.node,r)},chown:(e,r,t,n)=>{var o;if(!(o="string"==typeof e?we.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new we.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown:(e,r,t)=>{we.chown(e,r,t,!0)},fchown:(e,r,t)=>{var n=we.getStream(e);if(!n)throw new we.ErrnoError(8);we.chown(n.node,r,t)},truncate:(e,r)=>{if(r<0)throw new we.ErrnoError(28);var t;if(!(t="string"==typeof e?we.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new we.ErrnoError(63);if(we.isDir(t.mode))throw new we.ErrnoError(31);if(!we.isFile(t.mode))throw new we.ErrnoError(28);var n=we.nodePermissions(t,"w");if(n)throw new we.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=we.getStream(e);if(!t)throw new we.ErrnoError(8);if(0==(2097155&t.flags))throw new we.ErrnoError(28);we.truncate(t.node,r)},utime:(e,r,t)=>{var n=we.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open:(e,r,t)=>{if(""===e)throw new we.ErrnoError(44);var n;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?we.modeStringToFlags(r):r)?4095&t|32768:0,"object"==typeof e)n=e;else{e=de.normalize(e);try{n=we.lookupPath(e,{follow:!(131072&r)}).node}catch(u){}}var a=!1;if(64&r)if(n){if(128&r)throw new we.ErrnoError(20)}else n=we.mknod(e,t,0),a=!0;if(!n)throw new we.ErrnoError(44);if(we.isChrdev(n.mode)&&(r&=-513),65536&r&&!we.isDir(n.mode))throw new we.ErrnoError(54);if(!a){var i=we.mayOpen(n,r);if(i)throw new we.ErrnoError(i)}512&r&&!a&&we.truncate(n,0),r&=-131713;var s=we.createStream({node:n,path:we.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!o.logReadFiles||1&r||(we.readFiles||(we.readFiles={}),e in we.readFiles||(we.readFiles[e]=1)),s},close:e=>{if(we.isClosed(e))throw new we.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{we.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,r,t)=>{if(we.isClosed(e))throw new we.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new we.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new we.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:(e,r,t,n,o)=>{if(n<0||o<0)throw new we.ErrnoError(28);if(we.isClosed(e))throw new we.ErrnoError(8);if(1==(2097155&e.flags))throw new we.ErrnoError(8);if(we.isDir(e.node.mode))throw new we.ErrnoError(31);if(!e.stream_ops.read)throw new we.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new we.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write:(e,r,t,n,o,a)=>{if(n<0||o<0)throw new we.ErrnoError(28);if(we.isClosed(e))throw new we.ErrnoError(8);if(0==(2097155&e.flags))throw new we.ErrnoError(8);if(we.isDir(e.node.mode))throw new we.ErrnoError(31);if(!e.stream_ops.write)throw new we.ErrnoError(28);e.seekable&&1024&e.flags&&we.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new we.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},allocate:(e,r,t)=>{if(we.isClosed(e))throw new we.ErrnoError(8);if(r<0||t<=0)throw new we.ErrnoError(28);if(0==(2097155&e.flags))throw new we.ErrnoError(8);if(!we.isFile(e.node.mode)&&!we.isDir(e.node.mode))throw new we.ErrnoError(43);if(!e.stream_ops.allocate)throw new we.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:(e,r,t,n,o)=>{if(0!=(2&n)&&0==(2&o)&&2!=(2097155&e.flags))throw new we.ErrnoError(2);if(1==(2097155&e.flags))throw new we.ErrnoError(2);if(!e.stream_ops.mmap)throw new we.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,munmap:e=>0,ioctl:(e,r,t)=>{if(!e.stream_ops.ioctl)throw new we.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:(e,r={})=>{if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error('Invalid encoding type "'+r.encoding+'"');var t,n=we.open(e,r.flags),o=we.stat(e).size,a=new Uint8Array(o);return we.read(n,a,0,o,0),"utf8"===r.encoding?t=C(a,0):"binary"===r.encoding&&(t=a),we.close(n),t},writeFile:(e,r,t={})=>{t.flags=t.flags||577;var n=we.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(M(r)+1),a=j(r,o,0,o.length);we.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");we.write(n,r,0,r.byteLength,void 0,t.canOwn)}we.close(n)},cwd:()=>we.currentPath,chdir:e=>{var r=we.lookupPath(e,{follow:!0});if(null===r.node)throw new we.ErrnoError(44);if(!we.isDir(r.node.mode))throw new we.ErrnoError(54);var t=we.nodePermissions(r.node,"x");if(t)throw new we.ErrnoError(t);we.currentPath=r.path},createDefaultDirectories:()=>{we.mkdir("/tmp"),we.mkdir("/home"),we.mkdir("/home/web_user")},createDefaultDevices:()=>{we.mkdir("/dev"),we.registerDevice(we.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),we.mkdev("/dev/null",we.makedev(1,3)),ve.register(we.makedev(5,0),ve.default_tty_ops),ve.register(we.makedev(6,0),ve.default_tty1_ops),we.mkdev("/dev/tty",we.makedev(5,0)),we.mkdev("/dev/tty1",we.makedev(6,0));var e=me();we.createDevice("/dev","random",e),we.createDevice("/dev","urandom",e),we.mkdir("/dev/shm"),we.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{we.mkdir("/proc");var e=we.mkdir("/proc/self");we.mkdir("/proc/self/fd"),we.mount({mount:()=>{var r=we.createNode(e,"fd",16895,73);return r.node_ops={lookup:(e,r)=>{var t=+r,n=we.getStream(t);if(!n)throw new we.ErrnoError(8);var o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{o.stdin?we.createDevice("/dev","stdin",o.stdin):we.symlink("/dev/tty","/dev/stdin"),o.stdout?we.createDevice("/dev","stdout",null,o.stdout):we.symlink("/dev/tty","/dev/stdout"),o.stderr?we.createDevice("/dev","stderr",null,o.stderr):we.symlink("/dev/tty1","/dev/stderr"),we.open("/dev/stdin",0),we.open("/dev/stdout",1),we.open("/dev/stderr",1)},ensureErrnoError:()=>{we.ErrnoError||(we.ErrnoError=function(e,r){this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},we.ErrnoError.prototype=new Error,we.ErrnoError.prototype.constructor=we.ErrnoError,[44].forEach((e=>{we.genericErrors[e]=new we.ErrnoError(e),we.genericErrors[e].stack="<generic error, no stack>"})))},staticInit:()=>{we.ensureErrnoError(),we.nameTable=new Array(4096),we.mount(ge,{},"/"),we.createDefaultDirectories(),we.createDefaultDevices(),we.createSpecialDirectories(),we.filesystems={MEMFS:ge}},init:(e,r,t)=>{we.init.initialized=!0,we.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=r||o.stdout,o.stderr=t||o.stderr,we.createStandardStreams()},quit:()=>{we.init.initialized=!1;for(var e=0;e<we.streams.length;e++){var r=we.streams[e];r&&we.close(r)}},getMode:(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},findObject:(e,r)=>{var t=we.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{e=(n=we.lookupPath(e,{follow:!r})).path}catch(o){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=we.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=de.basename(e),n=we.lookupPath(e,{follow:!r}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(o){t.error=o.errno}return t},createPath:(e,r,t,n)=>{e="string"==typeof e?e:we.getPath(e);for(var o=r.split("/").reverse();o.length;){var a=o.pop();if(a){var i=de.join2(e,a);try{we.mkdir(i)}catch(s){}e=i}}return i},createFile:(e,r,t,n,o)=>{var a=de.join2("string"==typeof e?e:we.getPath(e),r),i=we.getMode(n,o);return we.create(a,i)},createDataFile:(e,r,t,n,o,a)=>{var i=r;e&&(e="string"==typeof e?e:we.getPath(e),i=r?de.join2(e,r):e);var s=we.getMode(n,o),u=we.create(i,s);if(t){if("string"==typeof t){for(var c=new Array(t.length),f=0,l=t.length;f<l;++f)c[f]=t.charCodeAt(f);t=c}we.chmod(u,146|s);var d=we.open(u,577);we.write(d,t,0,t.length,0,a),we.close(d),we.chmod(u,s)}return u},createDevice:(e,r,t,n)=>{var o=de.join2("string"==typeof e?e:we.getPath(e),r),a=we.getMode(!!t,!!n);we.createDevice.major||(we.createDevice.major=64);var i=we.makedev(we.createDevice.major++,0);return we.registerDevice(i,{open:e=>{e.seekable=!1},close:e=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(e,r,n,o,a)=>{for(var i=0,s=0;s<o;s++){var u;try{u=t()}catch(c){throw new we.ErrnoError(29)}if(void 0===u&&0===i)throw new we.ErrnoError(6);if(null==u)break;i++,r[n+s]=u}return i&&(e.node.timestamp=Date.now()),i},write:(e,r,t,o,a)=>{for(var i=0;i<o;i++)try{n(r[t+i])}catch(s){throw new we.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),i}}),we.mkdev(o,a,i)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.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(!a)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=he(a(e.url),!0),e.usedBytes=e.contents.length}catch(r){throw new we.ErrnoError(29)}},createLazyFile:(e,r,t,n,o)=>{function a(){this.lengthKnown=!1,this.chunks=[]}if(a.prototype.get=function(e){if(!(e>this.length-1||e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}},a.prototype.setDataGetter=function(e){this.getter=e},a.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=(e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>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="+e+"-"+r),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||[]):he(o.responseText||"",!0)},u=this;u.setDataGetter((e=>{var r=e*i,t=(e+1)*i-1;if(t=Math.min(t,n-1),void 0===u.chunks[e]&&(u.chunks[e]=s(r,t)),void 0===u.chunks[e])throw new Error("doXHR failed!");return u.chunks[e]})),!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},"undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,url:t},s=we.createFile(e,r,i,n,o);i.contents?s.contents=i.contents:i.url&&(s.contents=null,s.url=i.url),Object.defineProperties(s,{usedBytes:{get:function(){return this.contents.length}}});var u={};function c(e,r,t,n,o){var a=e.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++)r[t+s]=a[o+s];else for(s=0;s<i;s++)r[t+s]=a.get(o+s);return i}return Object.keys(s.stream_ops).forEach((e=>{var r=s.stream_ops[e];u[e]=function(){return we.forceLoadFile(s),r.apply(null,arguments)}})),u.read=(e,r,t,n,o)=>(we.forceLoadFile(s),c(e,r,t,n,o)),u.mmap=(e,r,t,n,o)=>{we.forceLoadFile(s);var a=_e();if(!a)throw new we.ErrnoError(48);return c(e,w,a,r,t),{ptr:a,allocated:!0}},s.stream_ops=u,s},createPreloadedFile:(e,r,t,n,o,a,i,s,u,c)=>{var f=r?pe.resolve(de.join2(e,r)):e;function l(t){function l(t){c&&c(),s||we.createDataFile(e,r,t,n,o,u),a&&a(),X()}Browser.handledByPreloadPlugin(t,f,l,(()=>{i&&i(),X()}))||l(t)}Y(),"string"==typeof t?ye(t,(e=>l(e)),i):l(t)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=we.indexedDB();try{var o=n.open(we.DB_NAME(),we.DB_VERSION)}catch(a){return t(a)}o.onupgradeneeded=()=>{h("creating db"),o.result.createObjectStore(we.DB_STORE_NAME)},o.onsuccess=()=>{var n=o.result.transaction([we.DB_STORE_NAME],"readwrite"),a=n.objectStore(we.DB_STORE_NAME),i=0,s=0,u=e.length;function c(){0==s?r():t()}e.forEach((e=>{var r=a.put(we.analyzePath(e).object.contents,e);r.onsuccess=()=>{++i+s==u&&c()},r.onerror=()=>{s++,i+s==u&&c()}})),n.onerror=t},o.onerror=t},loadFilesFromDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=we.indexedDB();try{var o=n.open(we.DB_NAME(),we.DB_VERSION)}catch(a){return t(a)}o.onupgradeneeded=t,o.onsuccess=()=>{var n=o.result;try{var i=n.transaction([we.DB_STORE_NAME],"readonly")}catch(a){return void t(a)}var s=i.objectStore(we.DB_STORE_NAME),u=0,c=0,f=e.length;function l(){0==c?r():t()}e.forEach((e=>{var r=s.get(e);r.onsuccess=()=>{we.analyzePath(e).exists&&we.unlink(e),we.createDataFile(de.dirname(e),de.basename(e),r.result,!0,!0,!0),++u+c==f&&l()},r.onerror=()=>{c++,u+c==f&&l()}})),i.onerror=t},o.onerror=t}},Ee={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(de.isAbs(r))return r;var n;if(-100===e)n=we.cwd();else{var o=we.getStream(e);if(!o)throw new we.ErrnoError(8);n=o.path}if(0==r.length){if(!t)throw new we.ErrnoError(44);return n}return de.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(o){if(o&&o.node&&de.normalize(r)!==de.normalize(we.getPath(o.node)))return-54;throw o}return x[t>>2]=n.dev,x[t+4>>2]=0,x[t+8>>2]=n.ino,x[t+12>>2]=n.mode,x[t+16>>2]=n.nlink,x[t+20>>2]=n.uid,x[t+24>>2]=n.gid,x[t+28>>2]=n.rdev,x[t+32>>2]=0,$=[n.size>>>0,(J=n.size,+Math.abs(J)>=1?J>0?(0|Math.min(+Math.floor(J/4294967296),4294967295))>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],x[t+40>>2]=$[0],x[t+44>>2]=$[1],x[t+48>>2]=4096,x[t+52>>2]=n.blocks,x[t+56>>2]=n.atime.getTime()/1e3|0,x[t+64>>2]=0,x[t+72>>2]=n.mtime.getTime()/1e3|0,x[t+80>>2]=0,x[t+88>>2]=n.ctime.getTime()/1e3|0,x[t+96>>2]=0,$=[n.ino>>>0,(J=n.ino,+Math.abs(J)>=1?J>0?(0|Math.min(+Math.floor(J/4294967296),4294967295))>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],x[t+104>>2]=$[0],x[t+108>>2]=$[1],0},doMsync:function(e,r,t,n,o){var a=E.slice(e,e+t);we.msync(r,a,o,t,n)},varargs:void 0,get:function(){return Ee.varargs+=4,x[Ee.varargs-4>>2]},getStr:function(e){return T(e)},getStreamFromFD:function(e){var r=we.getStream(e);if(!r)throw new we.ErrnoError(8);return r}};function be(e,r,t){Ee.varargs=t;try{var n=Ee.getStreamFromFD(e);switch(r){case 0:return(o=Ee.get())<0?-28:we.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=Ee.get();return n.flags|=o,0;case 5:return o=Ee.get(),b[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return le(28),-1}}catch(a){if(void 0===we||!(a instanceof we.ErrnoError))throw a;return-a.errno}}function ke(e,r,t){Ee.varargs=t;try{var n=Ee.getStreamFromFD(e);switch(r){case 21509:case 21505:case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:case 21523:case 21524:return n.tty?0:-59;case 21519:if(!n.tty)return-59;var o=Ee.get();return x[o>>2]=0,0;case 21520:return n.tty?-28:-59;case 21531:return o=Ee.get(),we.ioctl(n,r,o);default:Q("bad ioctl syscall "+r)}}catch(a){if(void 0===we||!(a instanceof we.ErrnoError))throw a;return-a.errno}}function xe(e,r,t,n){Ee.varargs=n;try{r=Ee.getStr(r),r=Ee.calculateAt(e,r);var o=n?Ee.get():0;return we.open(r,t,o).fd}catch(a){if(void 0===we||!(a instanceof we.ErrnoError))throw a;return-a.errno}}var Se={};function De(e){for(;e.length;){var r=e.pop();e.pop()(r)}}function Fe(e){return this.fromWireType(x[e>>2])}var Ae={},Pe={},Ce={},Te=48,je=57;function Be(e){if(void 0===e)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=Te&&r<=je?"_"+e:e}function Me(e,r){return e=Be(e),function(){return r.apply(this,arguments)}}function Le(e,r){var t=Me(r,(function(e){this.name=r,this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},t}var Re=void 0;function Ie(e){throw new Re(e)}function Ne(e,r,t){function n(r){var n=t(r);n.length!==e.length&&Ie("Mismatched type converter count");for(var o=0;o<e.length;++o)Ge(e[o],n[o])}e.forEach((function(e){Ce[e]=r}));var o=new Array(r.length),a=[],i=0;r.forEach(((e,r)=>{Pe.hasOwnProperty(e)?o[r]=Pe[e]:(a.push(e),Ae.hasOwnProperty(e)||(Ae[e]=[]),Ae[e].push((()=>{o[r]=Pe[e],++i===a.length&&n(o)})))})),0===a.length&&n(o)}function Oe(e){var r=Se[e];delete Se[e];var t=r.rawConstructor,n=r.rawDestructor,o=r.fields;Ne([e],o.map((e=>e.getterReturnType)).concat(o.map((e=>e.setterArgumentType))),(e=>{var a={};return o.forEach(((r,t)=>{var n=r.fieldName,i=e[t],s=r.getter,u=r.getterContext,c=e[t+o.length],f=r.setter,l=r.setterContext;a[n]={read:e=>i.fromWireType(s(u,e)),write:(e,r)=>{var t=[];f(l,e,c.toWireType(t,r)),De(t)}}})),[{name:r.name,fromWireType:function(e){var r={};for(var t in a)r[t]=a[t].read(e);return n(e),r},toWireType:function(e,r){for(var o in a)if(!(o in r))throw new TypeError('Missing field: "'+o+'"');var i=t();for(o in a)a[o].write(i,r[o]);return null!==e&&e.push(n,i),i},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:n}]}))}function ze(e,r,t,n,o){}function We(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Ze(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);He=e}var He=void 0;function Ue(e){for(var r="",t=e;E[t];)r+=He[E[t++]];return r}var qe=void 0;function Ve(e){throw new qe(e)}function Ge(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=r.name;if(e||Ve('type "'+n+'" must have a positive integer typeid pointer'),Pe.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;Ve("Cannot register type '"+n+"' twice")}if(Pe[e]=r,delete Ce[e],Ae.hasOwnProperty(e)){var o=Ae[e];delete Ae[e],o.forEach((e=>e()))}}function Ye(e,r,t,n,o){var a=We(t);Ge(e,{name:r=Ue(r),fromWireType:function(e){return!!e},toWireType:function(e,r){return r?n:o},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===t)n=w;else if(2===t)n=b;else{if(4!==t)throw new TypeError("Unknown boolean type size: "+r);n=x}return this.fromWireType(n[e>>a])},destructorFunction:null})}var Xe=[],Qe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Ke(e){e>4&&0==--Qe[e].refcount&&(Qe[e]=void 0,Xe.push(e))}function Je(){for(var e=0,r=5;r<Qe.length;++r)void 0!==Qe[r]&&++e;return e}function $e(){for(var e=5;e<Qe.length;++e)if(void 0!==Qe[e])return Qe[e];return null}function er(){o.count_emval_handles=Je,o.get_first_emval=$e}var rr={toValue:e=>(e||Ve("Cannot use deleted val. handle = "+e),Qe[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var r=Xe.length?Xe.pop():Qe.length;return Qe[r]={refcount:1,value:e},r}}};function tr(e,r){Ge(e,{name:r=Ue(r),fromWireType:function(e){var r=rr.toValue(e);return Ke(e),r},toWireType:function(e,r){return rr.toHandle(r)},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:null})}function nr(e,r,t){if(void 0===e[r].overloadTable){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||Ve("Function '"+t+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[r].overloadTable+")!"),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function or(e,r,t){o.hasOwnProperty(e)?((void 0===t||void 0!==o[e].overloadTable&&void 0!==o[e].overloadTable[t])&&Ve("Cannot register public name '"+e+"' twice"),nr(o,e,e),o.hasOwnProperty(t)&&Ve("Cannot register multiple overloads of a function with the same number of arguments ("+t+")!"),o[e].overloadTable[t]=r):(o[e]=r,void 0!==t&&(o[e].numArguments=t))}function ar(e,r,t){switch(r){case 0:return function(e){var r=t?w:E;return this.fromWireType(r[e])};case 1:return function(e){var r=t?b:k;return this.fromWireType(r[e>>1])};case 2:return function(e){var r=t?x:S;return this.fromWireType(r[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function ir(e,r,t,n){var o=We(t);function a(){}r=Ue(r),a.values={},Ge(e,{name:r,constructor:a,fromWireType:function(e){return this.constructor.values[e]},toWireType:function(e,r){return r.value},argPackAdvance:8,readValueFromPointer:ar(r,o,n),destructorFunction:null}),or(r,a)}function sr(e){var r=_o(e),t=Ue(r);return ho(r),t}function ur(e,r){var t=Pe[e];return void 0===t&&Ve(r+" has unknown type "+sr(e)),t}function cr(e,r,t){var n=ur(e,"enum");r=Ue(r);var o=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:t},constructor:{value:Me(n.name+"_"+r,(function(){}))}});o.values[t]=a,o[r]=a}function fr(e,r){switch(r){case 2:return function(e){return this.fromWireType(D[e>>2])};case 3:return function(e){return this.fromWireType(F[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function lr(e,r,t){var n=We(t);Ge(e,{name:r=Ue(r),fromWireType:function(e){return e},toWireType:function(e,r){return r},argPackAdvance:8,readValueFromPointer:fr(r,n),destructorFunction:null})}function dr(e,r,t,n,o){var a=r.length;a<2&&Ve("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var i=null!==r[1]&&null!==t,s=!1,u=1;u<r.length;++u)if(null!==r[u]&&void 0===r[u].destructorFunction){s=!0;break}var c="void"!==r[0].name,f=a-2,l=new Array(f),d=[],m=[];return function(){var t;arguments.length!==f&&Ve("function "+e+" called with "+arguments.length+" arguments, expected "+f+" args!"),m.length=0,d.length=i?2:1,d[0]=o,i&&(t=r[1].toWireType(m,this),d[1]=t);for(var a=0;a<f;++a)l[a]=r[a+2].toWireType(m,arguments[a]),d.push(l[a]);function u(e){if(s)De(m);else for(var n=i?1:2;n<r.length;n++){var o=1===n?t:l[n-2];null!==r[n].destructorFunction&&r[n].destructorFunction(o)}if(c)return r[0].fromWireType(e)}return u(n.apply(null,d))}}function mr(e,r){for(var t=[],n=0;n<e;n++)t.push(S[r+4*n>>2]);return t}function pr(e,r,t){o.hasOwnProperty(e)||Ie("Replacing nonexistant public symbol"),void 0!==o[e].overloadTable&&void 0!==t?o[e].overloadTable[t]=r:(o[e]=r,o[e].argCount=t)}function hr(e,r,t){var n=o["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)}var vr=[];function _r(e){var r=vr[e];return r||(e>=vr.length&&(vr.length=e+1),vr[e]=r=A.get(e)),r}function gr(e,r,t){return e.includes("j")?hr(e,r,t):_r(r).apply(null,t)}function yr(e,r){var t=[];return function(){return t.length=0,Object.assign(t,arguments),gr(e,r,t)}}function wr(e,r){function t(){return e.includes("j")?yr(e,r):_r(r)}e=Ue(e);var n=t();return"function"!=typeof n&&Ve("unknown function pointer with signature "+e+": "+r),n}var Er=void 0;function br(e,r){var t=[],n={};function o(e){n[e]||Pe[e]||(Ce[e]?Ce[e].forEach(o):(t.push(e),n[e]=!0))}throw r.forEach(o),new Er(e+": "+t.map(sr).join([", "]))}function kr(e,r,t,n,o,a){var i=mr(r,t);e=Ue(e),o=wr(n,o),or(e,(function(){br("Cannot call "+e+" due to unbound types",i)}),r-1),Ne([],i,(function(t){var n=[t[0],null].concat(t.slice(1));return pr(e,dr(e,n,null,o,a),r-1),[]}))}function xr(e,r,t){switch(r){case 0:return t?function(e){return w[e]}:function(e){return E[e]};case 1:return t?function(e){return b[e>>1]}:function(e){return k[e>>1]};case 2:return t?function(e){return x[e>>2]}:function(e){return S[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Sr(e,r,t,n,o){r=Ue(r);var a=We(t),i=e=>e;if(0===n){var s=32-8*t;i=e=>e<<s>>>s}var u=r.includes("unsigned"),c=(e,r)=>{};Ge(e,{name:r,fromWireType:i,toWireType:u?function(e,r){return c(r,this.name),r>>>0}:function(e,r){return c(r,this.name),r},argPackAdvance:8,readValueFromPointer:xr(r,a,0!==n),destructorFunction:null})}function Dr(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][r];function o(e){var r=S,t=r[e>>=2],o=r[e+1];return new n(y,o,t)}Ge(e,{name:t=Ue(t),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Fr(e,r){var t="std::string"===(r=Ue(r));Ge(e,{name:r,fromWireType:function(e){var r,n=S[e>>2],o=e+4;if(t)for(var a=o,i=0;i<=n;++i){var s=o+i;if(i==n||0==E[s]){var u=T(a,s-a);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),a=s+1}}else{var c=new Array(n);for(i=0;i<n;++i)c[i]=String.fromCharCode(E[o+i]);r=c.join("")}return ho(e),r},toWireType:function(e,r){var n;r instanceof ArrayBuffer&&(r=new Uint8Array(r));var o="string"==typeof r;o||r instanceof Uint8Array||r instanceof Uint8ClampedArray||r instanceof Int8Array||Ve("Cannot pass non-string to std::string"),n=t&&o?M(r):r.length;var a=vo(4+n+1),i=a+4;if(S[a>>2]=n,t&&o)B(r,i,n+1);else if(o)for(var s=0;s<n;++s){var u=r.charCodeAt(s);u>255&&(ho(i),Ve("String has UTF-16 code units that do not fit in 8 bits")),E[i+s]=u}else for(s=0;s<n;++s)E[i+s]=r[s];return null!==e&&e.push(ho,a),a},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:function(e){ho(e)}})}var Ar="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Pr(e,r){for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&k[n];)++n;if((t=n<<1)-e>32&&Ar)return Ar.decode(E.subarray(e,t));for(var a="",i=0;!(i>=r/2);++i){var s=b[e+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a}function Cr(e,r,t){if(void 0===t&&(t=2147483647),t<2)return 0;for(var n=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);b[r>>1]=i,r+=2}return b[r>>1]=0,r-n}function Tr(e){return 2*e.length}function jr(e,r){for(var t=0,n="";!(t>=r/4);){var o=x[e+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(5529